{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the fully qualified name of an object."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Unlike what we typically think of the fully qualified name of an object only comporting identifiers and dots(.) this uses a colon as the separator between the module part and the object's name and sub attributes."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This is to lift an ambiguity when trying to get an object back from its fully qualified name."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Assuming the following files, top level init imports a function from a submodule that has the same name as the submodule     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# project/__init__.py\nfrom .sub import sub",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A submodule that define a class (here we use lowercase for the example     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# project/sub.py\n\nclass sub:\n    attribute:str\n\nattribute = 'hello'",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "and a second submodule     "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "# project/attribute.py\n\nNone",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Using qualified names only with dots ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "."
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") Can make it difficult to find out which object we are referring, or at least implements the logic to get those object back."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For example, to get the object "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "project.sub.attribute"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", one would "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "import project"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x = getattr(project, 'sub')"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "getattr(x, 'attribute')"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Though because of the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "from .sub import sub"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", we end up getting the class attribute instead of the module."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This ambiguity is lifted with a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": ":"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as we now explicitly know the module part. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "package.sub.attribute"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "package.sub:attribute"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Note that "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "package:sub.attribute"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is also non-ambiguous, even if not the right fully qualified name for an object."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Moreover, using "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": ":"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as a separator make the implementation much easier, as in the case of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "package.sub:attribute"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", it is possible to directly execute "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "importlib.import_module('package.sub')"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to obtain a reference to the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "sub"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " submodule, without try/except or recursive "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "getattr"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " checking the the type of an object."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/papyri/utils.py",
  "item_line": 20,
  "item_type": "function",
  "aliases": [
    "papyri.gen.full_qual"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "obj",
        "annotation": "Any",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": "FullQual | None",
    "target_name": "full_qual"
  },
  "references": null,
  "qa": "papyri.utils:full_qual",
  "arbitrary": [],
  "local_refs": []
}