New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

overlaymodule

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overlaymodule - pypi Package Compare versions

Comparing version
0.0.2
to
0.0.3
+1
-1
PKG-INFO
Metadata-Version: 2.1
Name: overlaymodule
Version: 0.0.2
Version: 0.0.3
Summary: A Special Module Loader that can load modules with overlays.

@@ -5,0 +5,0 @@ Home-page: https://github.com/llacroix/overlaymodule

@@ -25,3 +25,3 @@ import setuptools

name="overlaymodule",
version="0.0.2",
version="0.0.3",
author="Loïc Faure-Lacroix",

@@ -28,0 +28,0 @@ author_email="lamerstar@gmail.com",

Metadata-Version: 2.1
Name: overlaymodule
Version: 0.0.2
Version: 0.0.3
Summary: A Special Module Loader that can load modules with overlays.

@@ -5,0 +5,0 @@ Home-page: https://github.com/llacroix/overlaymodule

@@ -7,3 +7,5 @@ import importlib

import pdb
class OverlayFinder(MetaPathFinder):

@@ -24,3 +26,5 @@ def __init__(self, base_module, base_path, overlays):

if not module_path.exists():
module_path = module_path.parent.parent / f"{module_path.parent.name}.py"
module_path = (
module_path.parent.parent / f"{module_path.parent.name}.py"
)

@@ -32,3 +36,2 @@ if not module_path.exists():

def find_spec(self, fullname, path=None, target=None):

@@ -42,11 +45,34 @@ module = fullname.split('.')

if not module_path:
return
if module_path:
return importlib.util.spec_from_file_location(
fullname,
str(module_path),
loader=self.source_loader
)
spec = importlib.util.spec_from_file_location(
parent_module_name = ".".join(module[0:-1])
parent_module = importlib.import_module(parent_module_name)
lookup_paths = [
Path(path)
for path in parent_module.__path__
]
for path in lookup_paths:
module_path = self.get_source_path(path, [module[-1]])
if module_path:
break
else:
return
if module_path.name == '__init__.py':
search_location = [str(module_path.parent)]
else:
search_location = None
return importlib.util.spec_from_file_location(
fullname,
str(module_path),
loader=self.source_loader
loader=self.source_loader,
submodule_search_locations=search_location
)
return spec

@@ -5,2 +5,3 @@ from pathlib import Path

from importlib._bootstrap_external import SourceFileLoader
import pdb

@@ -16,4 +17,10 @@

self._looked_up_overlays = False
self.modules = {}
def get_filename(self, fullname):
if fullname in self.modules:
module = self.modules[fullname]
if Path(module.__file__).exists():
return module.__file__
module = fullname.split('.')

@@ -74,2 +81,4 @@ module_path = None

def exec_module(self, module):
self.modules[module.__name__] = module
super().exec_module(module)

@@ -76,0 +85,0 @@