class_docstr: Magics related to code management (loading, saving, editing, ...).
docstr: Upload code to dpaste.com, returning the URL.
  
  Usage:\
    %pastebin [-d "Custom description"][-e 24] 1-7
  
  The argument can be an input history range, a filename, or the name of a
  string or macro.
  
  If no arguments are given, uploads the history of this session up to
  this point.
  
  Options:
  
    -d: Pass a custom description. The default will say
        "Pasted from IPython".
    -e: Pass number of days for the link to be expired.
        The default will be 7 days.
code: def pastebin(self, parameter_s=""):
      """Upload code to dpaste.com, returning the URL.
  
          Usage:\\
            %pastebin [-d "Custom description"][-e 24] 1-7
  
          The argument can be an input history range, a filename, or the name of a
          string or macro.
  
          If no arguments are given, uploads the history of this session up to
          this point.
  
          Options:
  
            -d: Pass a custom description. The default will say
                "Pasted from IPython".
            -e: Pass number of days for the link to be expired.
                The default will be 7 days.
          """
      opts, args = self.parse_options(parameter_s, "d:e:")
  
      try:
          code = self.shell.find_user_code(args)
      except (ValueError, TypeError) as e:
          print(e.args[0])
          return
  
      expiry_days = 7
      try:
          expiry_days = int(opts.get("e", 7))
      except ValueError as e:
          print(e.args[0].capitalize())
          return
      if expiry_days < 1 or expiry_days > 365:
          print("Expiry days should be in range of 1 to 365")
          return
  
      post_data = urlencode(
          {
              "title": opts.get("d", "Pasted from IPython"),
              "syntax": "python",
              "content": code,
              "expiry_days": expiry_days,
          }
      ).encode("utf-8")
  
      request = Request(
          "https://dpaste.com/api/v2/",
          headers={"User-Agent": "IPython v{}".format(version)},
      )
      response = urlopen(request, post_data)
      return response.headers.get("Location")
  
imports: import inspect
  import io
  import os
  import re
  import sys
  import ast
  from itertools import chain
  from urllib.request import Request, urlopen
  from urllib.parse import urlencode
  from pathlib import Path
  from IPython.core.error import TryNext, StdinNotImplementedError, UsageError
  from IPython.core.macro import Macro
  from IPython.core.magic import Magics, magics_class, line_magic
  from IPython.core.oinspect import find_file, find_source_lines
  from IPython.core.release import version
  from IPython.testing.skipdoctest import skip_doctest
  from IPython.utils.contexts import preserve_keys
  from IPython.utils.path import get_py_filename
  from warnings import warn
  from logging import error
  from IPython.utils.text import get_text_list
label_desc: Use image node_id 3 for calling the CodeMagics obj's underlying member method code with example usage: obj.pastebin(parameter_s) and returns: response