:type pyname: rope.base.pynamesdef.AssignedName
    :return: rope.base.pyobjectsdef.PyClass, str
    :rtype: tuple
191445
def get_class_with_attr_name(pyname):
    
    lineno = get_lineno_for_node(pyname.assignments[0].ast_node)
    holding_scope = pyname.module.get_scope().get_inner_scope_for_line(lineno)
    pyobject = holding_scope.pyobject
    if isinstance(pyobject, PyClass):
        pyclass = pyobject
    elif (isinstance(pyobject, PyFunction) and
          isinstance(pyobject.parent, PyClass)):
        pyclass = pyobject.parent
    else:
        return
    for name, attr in pyclass.get_attributes().items():
        if attr is pyname:
            return (pyclass, name)
1345557
def __non_body_parameter_descriptor(self, param):
    
    descriptor = {}

    descriptor['name'] = param.name

    param_type, param_format = self.__field_to_parameter_type_and_format(param)

    # Required
    if param.required:
      descriptor['required'] = True

    # Type
    descriptor['type'] = param_type

    # Format (optional)
    if param_format:
      descriptor['format'] = param_format

    # Default
    default = self.__parameter_default(param)
    if default is not None:
      descriptor['default'] = default

    # Repeated
    if param.repeated:
      descriptor['repeated'] = True

    # Enum
    enum_descriptor = self.__parameter_enum(param)
    if enum_descriptor is not None:
      descriptor['enum'] = enum_descriptor

    return descriptor
536162
def _get_class_name(error_code):
    
    if isinstance(error_code, int):
        return KNOWN_BASE_CLASSES.get(
            error_code, 'RPCError' + str(error_code).replace('-', 'Neg')
        )

    return snake_to_camel_case(
        error_code.replace('FIRSTNAME', 'FIRST_NAME').lower(), suffix='Error')
248938
def qualified_name(cls):
    
    module = cls.__module__
    if module is None or module == str.__class__.__module__:
        return cls.__name__
    return module + '.' + cls.__name__
44858
def name(self):
        
        res = type(self).__name__
        if self._id:
            res += ".{}".format(self._id)
        return res
347682
def create_finder(project, name, pyname, only_calls=False, imports=True,
                  unsure=None, docs=False, instance=None, in_hierarchy=False,
                  keywords=True):
    
    pynames_ = set([pyname])
    filters = []
    if only_calls:
        filters.append(CallsFilter())
    if not imports:
        filters.append(NoImportsFilter())
    if not keywords:
        filters.append(NoKeywordsFilter())
    if isinstance(instance, pynames.ParameterName):
        for pyobject in instance.get_objects():
            try:
                pynames_.add(pyobject[name])
            except exceptions.AttributeNotFoundError:
                pass
    for pyname in pynames_:
        filters.append(PyNameFilter(pyname))
        if in_hierarchy:
            filters.append(InHierarchyFilter(pyname))
    if unsure:
        filters.append(UnsureFilter(unsure))
    return Finder(project, name, filters=filters, docs=docs)
219925
def _get_body_instance(self):
        """"""
        pyof_class = self._get_body_class()

        if pyof_class is None:
            return BinaryData(b'')
        elif pyof_class is DescStats:
            return pyof_class()

        return FixedTypeList(pyof_class=pyof_class)
585300
def ToName(param_type):
    
    items = inspect.getmembers(ContractParameterType)

    if type(param_type) is bytes:
        param_type = int.from_bytes(param_type, 'little')

    for item in items:
        name = item[0]
        val = int(item[1].value)

        if val == param_type:
            return name

    return None
296290
def get_type(self):
        
        mtype = None
        if "type" not in self.meta_data:
            return mtype

        mtype = self.meta_data["type"]
        if isinstance(mtype, dict):
            mtype = self.meta_data.get("type", {}).get("name", "").upper()
        elif isinstance(mtype, str):
            mtype = mtype

        return mtype
220433
def serialize(self, elt, sw, pyobj, **kw):
        '''
        '''
        if isinstance(pyobj, TypeCode):
            raise TypeError, 'pyobj is a typecode instance.'
        
        what = getattr(pyobj, 'typecode', None)
        if what is not None and type(pyobj) is types.InstanceType:
            tc = pyobj.__class__
            what = Any.serialmap.get(tc)
            if not what:
                tc = (types.ClassType, pyobj.__class__.__name__)
                what = Any.serialmap.get(tc)
        
        self.logger.debug('processContents: %s', self.processContents)

        # failed to find a registered type for class
        if what is None:
            #TODO: seems incomplete.  what about facets.
            #if self.processContents == 'strict':
            what = Any(pname=(self.nspname,self.pname))
                
        self.logger.debug('serialize with %s', what.__class__.__name__)
        what.serialize(elt, sw, pyobj, **kw)
550942
def tableType( self ):
        
        if not self._tableType:
            if self._tableTypeName:
                self._tableType = Orb.instance().model(nstr(self._tableTypeName))
            
        return self._tableType
411284
def from_dynacRepr(cls, pynacRepr):
        
        pynacList = pynacRepr[1][0]

        L = float(pynacList[3])
        TTF = float(pynacList[4])
        TTFprime = float(pynacList[5])
        TTFprimeprime = float(pynacList[13])
        EField = float(pynacList[10])
        phase = float(pynacList[11])
        F = float(pynacList[14])
        atten = float(pynacList[15])

        gap = cls(L, TTF, TTFprime, TTFprimeprime, EField, phase, F, atten)
        gap.gapID = Param(val = int(pynacList[0]), unit = None)
        gap.energy = Param(val = float(pynacList[1]), unit = 'MeV')
        gap.beta = Param(val = float(pynacList[2]), unit = None)
        gap.S = Param(val = float(pynacList[6]), unit = None)
        gap.SP = Param(val = float(pynacList[7]), unit = None)
        gap.quadLength = Param(val = float(pynacList[8]), unit = 'cm')
        gap.quadStrength = Param(val = float(pynacList[9]), unit = 'kG/cm')
        gap.accumLen = Param(val = float(pynacList[12]), unit = 'cm')

        return gap
1022734
def bind(cls, origin, handler, *, name=None):
        
        name = cls.__name__ if name is None else name
        attrs = {
            "_origin": origin, "_handler": handler,
            "__module__": "origin",  # Could do better?
        }
        return type(name, (cls,), attrs)
1328172
def get_model_name(self):
        
        if self.model_name is None:
            raise ImproperlyConfigured(
                "%s requires either a definition of "
                "'model_name' or an implementation of 'get_model_name()'" %
                self.__class__.__name__)
        return self.model_name
1072445
def name(self):
        
        ret = ctypes.c_char_p()
        success = ctypes.c_int()
        check_call(_LIB.MXSymbolGetName(
            self.handle, ctypes.byref(ret), ctypes.byref(success)))
        if success.value != 0:
            return py_str(ret.value)
        else:
            return None
227188
def str_def(self):
        
        return "classname={!r}; read_timeout={!r}; read_retries={!r}; " \
            "message={!r};". \
            format(self.__class__.__name__, self.read_timeout,
                   self.read_retries, self.args[0])
1037941
def _get_sqla_coltype_class_from_str(coltype: str,
                                     dialect: Dialect) -> Type[TypeEngine]:
    
    # noinspection PyUnresolvedReferences
    ischema_names = dialect.ischema_names
    try:
        return ischema_names[coltype.upper()]
    except KeyError:
        return ischema_names[coltype.lower()]