Identify the module name from the class. If the class exists in the jar file, return war file name
if it is located under the war file, otherwise returning jar file name.
183419
private String getModuleFromClass(Class<?> klass, Map<String, ModuleProperties> moduleMap) {
        String file = getClassFileLocation(klass);
        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "File name : " + file);
        }
        String moduleName = null;
        for (Map.Entry<String, ModuleProperties> entry : moduleMap.entrySet()) {
            URL location = entry.getValue().getLocation();
            String filePath = location.getFile();
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "location : " + filePath);
            }

            if (location.getProtocol().equals("file") && file.startsWith(filePath)) {
                moduleName = entry.getKey();
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "module name from the list  : " + moduleName);
                }
                break;
            }
        }
        if (moduleName == null) {
            moduleName = file;
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "no match. use filename as module name : " + moduleName);
            }
        }
        return moduleName;
    }
317433
def extract_class(jar, name):
    

    with jar.open(name) as entry:
        return LinkableClass(javatools.unpack_class(entry))
199997
def get_class(name, config_key, module):
    """"""
    clsmembers = inspect.getmembers(module, inspect.isclass)
    for string_name, act_class in clsmembers:
        if string_name == name:
            return act_class

    # Check if the user has specified a plugin and if the class is in there
    cfg = get_project_configuration()
    if config_key in cfg:
        modname = os.path.splitext(os.path.basename(cfg[config_key]))[0]
        if os.path.isfile(cfg[config_key]):
            usermodule = imp.load_source(modname, cfg[config_key])
            clsmembers = inspect.getmembers(usermodule, inspect.isclass)
            for string_name, act_class in clsmembers:
                if string_name == name:
                    return act_class
        else:
            logging.warning("File '%s' does not exist. Adjust ~/.hwrtrc.",
                            cfg['data_analyzation_plugins'])

    logging.debug("Unknown class '%s'.", name)
    return None
784181
protected Path getModuleJarPath(ModuleId moduleId) {
        Path moduleJarPath = rootDir.resolve(moduleId + ".jar");
        return moduleJarPath;
    }
362887
def find_class(self, cls):
        
        for doc_cls in self.classes():
            if cls is doc_cls.cls:
                return doc_cls
        for module in self.submodules():
            doc_cls = module.find_class(cls)
            if not isinstance(doc_cls, External):
                return doc_cls
        return External('%s.%s' % (cls.__module__, cls.__name__))
317518
def _get_module_name(function):
    
    module_name = function.__module__
    if module_name == '__main__':
        # get the main module object of the function
        main_module = inspect.getmodule(function)
        # get the module name from __file__ by getting the base name and removing the .py extension
        # e.g. test1.py => test1
        if hasattr(main_module, '__file__'):
            module_name = os.path.splitext(os.path.basename(main_module.__file__))[0]
    return module_name
390964
def class_name(obj):
    

    name = obj.__name__
    module = getattr(obj, '__module__')

    if module:
        name = f'{module}.{name}'
    return name
259633
def parse_module_class(self):
        
        cname = self.class_name
        match = re.match(self.CLASS_REGEX, cname)
        if not match:
            raise ValueError(f'not a fully qualified class name: {cname}')
        return match.groups()
1030270
def identify_module(arg):
    
    try:
        __import__(arg)
    except Exception:
        exc = sys.exc_info()[1]
        raise ModuleNotFound("%s: %s" % (type(exc).__name__, str(exc)))

    mod = sys.modules[arg]
    return mod
1028440
public String getClassName(ClassDoc cd) {
        PackageDoc pd = cd.containingPackage();
        if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) {
            return cd.name();
        } else {
            return cd.qualifiedName();
        }
    }
103325
def _classname(self):
        """"""
        if self.__class__.__module__ in (None,):
            return self.__class__.__name__
        else:
            return "%s.%s" % (self.__class__.__module__, self.__class__.__name__)
1039476
def getTypesModuleName(self):
        
        if self.types_module_name is not None:
            return self.types_module_name

        name = GetModuleBaseNameFromWSDL(self._wsdl)
        if not name:
            raise WsdlGeneratorError, 'could not determine a service name'
        
        if self.types_module_suffix is None:
            return name

        return '%s%s' %(name, self.types_module_suffix)
1057424
public static String getPackageName(Class<?> clazz) {
		Assert.notNull(clazz, "Class must not be null");
		return getPackageName(clazz.getName());
	}
1359919
def _get_calling_module(self):
        
        for frame in inspect.stack():
            mod = inspect.getmodule(frame[0])
            logger.debug(f'calling module: {mod}')
            if mod is not None:
                mod_name = mod.__name__
                if mod_name != __name__:
                    return mod
1231825
private static File _getClassSource (final String className)
  {
    if (className != null)
    {
      final String classResource = className.replace ('.', '/') + ".class";
      return _getResourceSource (classResource, Thread.currentThread ().getContextClassLoader ());
    }
    return null;
  }
946395
def _get_module_name_from_fname(fname):
    """"""
    fname = fname.replace(".pyc", ".py")
    for mobj in sys.modules.values():
        if (
            hasattr(mobj, "__file__")
            and mobj.__file__
            and (mobj.__file__.replace(".pyc", ".py") == fname)
        ):
            module_name = mobj.__name__
            return module_name
    raise RuntimeError("Module could not be found")
1301322
def getClientModuleName(self):
        
        name = GetModuleBaseNameFromWSDL(self._wsdl)
        if not name:
            raise WsdlGeneratorError, 'could not determine a service name'
        
        if self.client_module_suffix is None:
            return name

        return '%s%s' %(name, self.client_module_suffix)