:returns:
            a fake `CompositionInfo` instance with the given gsim logic tree
            object; if None, builds automatically a fake gsim logic tree
343087
def fake(cls, gsimlt=None):
        
        weight = 1
        gsim_lt = gsimlt or logictree.GsimLogicTree.from_('[FromFile]')
        fakeSM = logictree.LtSourceModel(
            'scenario', weight,  'b1',
            [sourceconverter.SourceGroup('*', eff_ruptures=1)],
            gsim_lt.get_num_paths(), ordinal=0, samples=1)
        return cls(gsim_lt, seed=0, num_samples=0, source_models=[fakeSM],
                   totweight=0)
147895
def _create_memory_database_interface(self) -> GraphDatabaseInterface:
        
        Base = declarative_base()
        engine = sqlalchemy.create_engine("sqlite://", poolclass=StaticPool)
        Session = sessionmaker(bind=engine)

        dbi: GraphDatabaseInterface = create_graph_database_interface(
            sqlalchemy, Session(), Base, sqlalchemy.orm.relationship
        )

        Base.metadata.drop_all(engine)
        Base.metadata.create_all(engine)

        return dbi
267200
def as_treemap(self):
        
        if self._treemap_cache:
            return self._treemap_cache
        self._treemap_cache = treemap = TreeMap(self)
        return treemap
732122
def apply_type_shim(cls, _context=None) -> Iterator:
    
    if cls.name in ["IntField", "SmallIntField"]:
        base_nodes = scoped_nodes.builtin_lookup("int")
    elif cls.name in ["CharField", "TextField"]:
        base_nodes = scoped_nodes.builtin_lookup("str")
    elif cls.name == "BooleanField":
        base_nodes = scoped_nodes.builtin_lookup("bool")
    elif cls.name == "FloatField":
        base_nodes = scoped_nodes.builtin_lookup("float")
    elif cls.name == "DecimalField":
        base_nodes = MANAGER.ast_from_module_name("decimal").lookup("Decimal")
    elif cls.name == "DatetimeField":
        base_nodes = MANAGER.ast_from_module_name("datetime").lookup("datetime")
    elif cls.name == "DateField":
        base_nodes = MANAGER.ast_from_module_name("datetime").lookup("date")
    elif cls.name == "ForeignKeyField":
        base_nodes = MANAGER.ast_from_module_name("tortoise.fields").lookup("BackwardFKRelation")
    elif cls.name == "ManyToManyField":
        base_nodes = MANAGER.ast_from_module_name("tortoise.fields").lookup(
            "ManyToManyRelationManager"
        )
    else:
        return iter([cls])

    return iter([cls] + base_nodes[1])
942573
def ion_or_solid_comp_object(formula):
    
    m = re.search(r"\[([^\[\]]+)\]|\(aq\)", formula)
    if m:
        comp_obj = Ion.from_formula(formula)
    elif re.search(r"\(s\)", formula):
        comp_obj = Composition(formula[:-3])
    else:
        comp_obj = Composition(formula)
    return comp_obj
1195567
def _find_impl(cls, role, interface):
        
        module = _relation_module(role, interface)
        if not module:
            return None
        return cls._find_subclass(module)
333604
def get_composition_id(self):
        
        # Implemented from template for osid.learning.Activity.get_objective_id
        if not bool(self._my_map['compositionId']):
            raise errors.IllegalState('composition empty')
        return Id(self._my_map['compositionId'])
863226
def get_composition_metadata(self):
        
        # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
        metadata = dict(self._mdata['composition'])
        metadata.update({'existing_id_values': self._my_map['compositionId']})
        return Metadata(**metadata)
1205478
def manifestation_model_factory(*, validator=validators.is_manifestation_model,
                                ld_type='CreativeWork', **kwargs):
    
    return _model_factory(validator=validator, ld_type=ld_type, **kwargs)
1192253
def convert(self, root_cls):
        

        d = self.__dict__
        d['sl'] = self.sl

        try:
            cls = root_cls.get_class(root_cls.sl)
        except (AttributeError, TypeError):
            # Hopefully because root_cls is a module
            cls = root_cls.get_class(self.sl)

        return cls(**d)
325799
def save_composition(self, composition_form, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceAdminSession.update_resource
        if composition_form.is_for_update():
            return self.update_composition(composition_form, *args, **kwargs)
        else:
            return self.create_composition(composition_form, *args, **kwargs)
513705
def make(class_name, base, schema):
    
    return type(class_name, (base,), dict(SCHEMA=schema))
772928
def _uses_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        if not sctx.schema_data.if_features(stmt, sctx.text_mid):
            return
        grp, gid = sctx.schema_data.get_definition(stmt, sctx)
        if stmt.find1("when"):
            sn = GroupNode()
            self._add_child(sn)
        else:
            sn = self
        sn._handle_substatements(grp, gid)
        for augst in stmt.find_all("augment"):
            sn._augment_stmt(augst, sctx)
        for refst in stmt.find_all("refine"):
            sn._refine_stmt(refst, sctx)
45921
def get_composition_form(self, *args, **kwargs):
        """"""
        # Implemented from kitosid template for -
        # osid.resource.ResourceAdminSession.get_resource_form_for_update
        # This method might be a bit sketchy. Time will tell.
        if isinstance(args[-1], list) or 'composition_record_types' in kwargs:
            return self.get_composition_form_for_create(*args, **kwargs)
        else:
            return self.get_composition_form_for_update(*args, **kwargs)
1093452
def inheritance_tree(include_mods = false)
      return [self] unless include_mods
      [self] + mixins(:instance, :class).map do |m|
        next if m == self
        next m unless m.respond_to?(:inheritance_tree)
        m.inheritance_tree(true)
      end.compact.flatten.uniq
    end
336420
def dependent_on_composite_state(self):
        
        composite_state = NodesCompositeState()

        for dependent_on in self.tree.dependent_on:
            node_b = self.find_counterpart_in(dependent_on)

            if node_b is None:
                # special case when counterpart tree has no process with corresponding time_qualifier
                # for example Financial Monthly has no counterpart in Third-party Daily Report -
                # so we assume that its not blocked
                continue

            composite_state.enlist(node_b)

        return composite_state
355220
def compose(*decorators):
    
    def composed(f):
        for decor in reversed(decorators):
            f = decor(f)
        return f
    return composed