class_docstr: Parse a qualified name into different parts.
  
  e.g. listing__ds__week ->
  entity_links: ["listing"]
  element_name: "ds"
  granularity: TimeGranularity.WEEK
class_docstr_tok: ["Parse","a","qualified","name","into","different","parts",".","e.g",".","listing__ds__week","-",">","entity_links",":","[","``","listing","''","]","element_name",":","``","ds","''","granularity",":","TimeGranularity.WEEK"]
docstr: Construct from a name e.g. listing__ds__month.
docstr_tok: ["Construct","from","a","name","e.g",".","listing__ds__month","."]
code: def from_name(qualified_name: str) -> StructuredLinkableSpecName:
      """Construct from a name e.g. listing__ds__month."""
      name_parts = qualified_name.split(DUNDER)
  
      # No dunder, e.g. "ds"
      if len(name_parts) == 1:
          return StructuredLinkableSpecName(
              entity_link_names=(), element_name=name_parts[0]
          )
  
      for date_part in DatePart:
          if name_parts[
              -1
          ] == StructuredLinkableSpecName.date_part_suffix(
              date_part=date_part
          ):
              raise ValueError(
                  "Dunder syntax not supported for querying date_part. Use `group_by` object syntax instead."
              )
  
      associated_granularity = None
      for granularity in TimeGranularity:
          if name_parts[-1] == granularity.value:
              associated_granularity = granularity
  
      # Has a time granularity
      if associated_granularity:
          #  e.g. "ds__month"
          if len(name_parts) == 2:
              return StructuredLinkableSpecName(
                  entity_link_names=(),
                  element_name=name_parts[0],
                  time_granularity=associated_granularity,
              )
          # e.g. "messages__ds__month"
          return StructuredLinkableSpecName(
              entity_link_names=tuple(name_parts[:-2]),
              element_name=name_parts[-2],
              time_granularity=associated_granularity,
          )
  
      # e.g. "messages__ds"
      else:
          return StructuredLinkableSpecName(
              entity_link_names=tuple(name_parts[:-1]),
              element_name=name_parts[-1],
          )
  
file_path: metricflow/metricflow/naming/linkable_spec_name.py
imports: from __future__ import annotations
  import logging
  from dataclasses import dataclass
  from typing import Optional, Tuple
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
label_desc: Use image node_id 1 for calling the StructuredLinkableSpecName obj's underlying member method code with example usage: obj.from_name(qualified_name) and returns: StructuredLinkableSpecName, StructuredLinkableSpecName, StructuredLinkableSpecName, StructuredLinkableSpecName