Skip to content

Commit

Permalink
Add EuroPython 2015 talk
Browse files Browse the repository at this point in the history
  • Loading branch information
encukou committed Mar 11, 2016
1 parent 47d6732 commit 32f1506
Show file tree
Hide file tree
Showing 21 changed files with 3,628 additions and 0 deletions.
Binary file added 2015-07-europython/allthefish.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2015-07-europython/barcelona-aquarium.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2015-07-europython/bcannon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions 2015-07-europython/custom_finder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import sys
from importlib.machinery import ModuleSpec
import importlib.abc

class CustomModule:
pass

class CustomFinder:
def find_spec(self, name, path=None, target=None):
print('Finding', name, path, target)
if name == 'mymod':
return ModuleSpec(name, CustomLoader())

class CustomLoader:
def create_module(self, name):
print('Creating', name)
return CustomModule()

def exec_module(self, mod):
print(vars(mod))
print('Executing', mod)

sys.meta_path.insert(0, CustomFinder())

import mymod

print(mymod)



class CustomImporter(importlib.abc.InspectLoader):
def find_spec(self, name, path=None, target=None):
print('Finding', name, path, target)
if name == 'zzmod':
return ModuleSpec(name, self)

def get_source(self, name):
return 'p = 3'

sys.meta_path.insert(0, CustomImporter())

import zzmod

print(zzmod)
print(zzmod.p)
Binary file added 2015-07-europython/dabeaz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions 2015-07-europython/demo/another_directory/package/bar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print('importing bar')
4 changes: 4 additions & 0 deletions 2015-07-europython/demo/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import package

import package.foo
import package.bar
2 changes: 2 additions & 0 deletions 2015-07-europython/demo/package/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
print('importing package')
__path__.append('./another_directory')
1 change: 1 addition & 0 deletions 2015-07-europython/demo/package/foo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print('importing foo')
Binary file added 2015-07-europython/gears.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 32f1506

Please sign in to comment.