Ejemplo n.º 1
0
def create_simple_object(evaluator, obj):
    """
    Only allows creations of objects that are easily picklable across Python
    versions.
    """
    assert isinstance(obj, (int, float, str, bytes, unicode, slice, complex))
    return create_from_access_path(
        evaluator, evaluator.compiled_subprocess.create_simple_object(obj))
Ejemplo n.º 2
0
def load_module(evaluator, dotted_name, **kwargs):
    # Temporary, some tensorflow builtins cannot be loaded, so it's tried again
    # and again and it's really slow.
    if dotted_name.startswith('tensorflow.'):
        return None
    access_path = evaluator.compiled_subprocess.load_module(dotted_name=dotted_name, **kwargs)
    if access_path is None:
        return None
    return create_from_access_path(evaluator, access_path)
Ejemplo n.º 3
0
def load_module(evaluator, dotted_name, **kwargs):
    # Temporary, some tensorflow builtins cannot be loaded, so it's tried again
    # and again and it's really slow.
    if dotted_name.startswith('tensorflow.'):
        return None
    access_path = evaluator.compiled_subprocess.load_module(dotted_name=dotted_name, **kwargs)
    if access_path is None:
        return None
    return create_from_access_path(evaluator, access_path)
Ejemplo n.º 4
0
def create_simple_object(evaluator, obj):
    """
    Only allows creations of objects that are easily picklable across Python
    versions.
    """
    assert isinstance(obj, (int, float, str, bytes, unicode, slice, complex))
    return create_from_access_path(
        evaluator,
        evaluator.compiled_subprocess.create_simple_object(obj)
    )
Ejemplo n.º 5
0
def create_simple_object(evaluator, obj):
    """
    Only allows creations of objects that are easily picklable across Python
    versions.
    """
    assert type(obj) in (int, float, str, bytes, unicode, slice, complex,
                         bool), obj
    compiled_obj = create_from_access_path(
        evaluator, evaluator.compiled_subprocess.create_simple_object(obj))
    return CompiledValue(compiled_obj)
Ejemplo n.º 6
0
def load_module(evaluator, **kwargs):
    access_path = evaluator.compiled_subprocess.load_module(**kwargs)
    if access_path is None:
        return None
    return create_from_access_path(evaluator, access_path)
Ejemplo n.º 7
0
def get_special_object(evaluator, identifier):
    return create_from_access_path(
        evaluator,
        evaluator.compiled_subprocess.get_special_object(identifier)
    )
Ejemplo n.º 8
0
def load_module(evaluator, **kwargs):
    access_path = evaluator.compiled_subprocess.load_module(**kwargs)
    if access_path is None:
        return None
    return create_from_access_path(evaluator, access_path)
Ejemplo n.º 9
0
def get_special_object(evaluator, identifier):
    return create_from_access_path(
        evaluator,
        evaluator.compiled_subprocess.get_special_object(identifier))