Skip to content

Commit

Permalink
CLN cleanup unused functions (#249)
Browse files Browse the repository at this point in the history
* CLN cleanup unused functions

* CLN remove _getobject
  • Loading branch information
pierreglaser authored and ogrisel committed Feb 14, 2019
1 parent 47cc0f9 commit 936f16f
Showing 1 changed file with 0 additions and 46 deletions.
46 changes: 0 additions & 46 deletions cloudpickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,43 +979,6 @@ def _restore_attr(obj, attr):
return obj


def _get_module_builtins():
return pickle.__builtins__


def print_exec(stream):
ei = sys.exc_info()
traceback.print_exception(ei[0], ei[1], ei[2], None, stream)


def _modules_to_main(modList):
"""Force every module in modList to be placed into main"""
if not modList:
return

main = sys.modules['__main__']
for modname in modList:
if type(modname) is str:
try:
mod = __import__(modname)
except Exception:
sys.stderr.write('warning: could not import %s\n. '
'Your function may unexpectedly error due to this import failing;'
'A version mismatch is likely. Specific error was:\n' % modname)
print_exec(sys.stderr)
else:
setattr(main, mod.__name__, mod)


# object generators:
def _genpartial(func, args, kwds):
if not args:
args = ()
if not kwds:
kwds = {}
return partial(func, *args, **kwds)


def _gen_ellipsis():
return Ellipsis

Expand Down Expand Up @@ -1188,15 +1151,6 @@ def _is_dynamic(module):
return False


"""Constructors for 3rd party libraries
Note: These can never be renamed due to client compatibility issues"""


def _getobject(modname, attribute):
mod = __import__(modname, fromlist=[attribute])
return mod.__dict__[attribute]


""" Use copy_reg to extend global pickle definitions """

if sys.version_info < (3, 4): # pragma: no branch
Expand Down

0 comments on commit 936f16f

Please sign in to comment.