Python __builtin__.map() Examples
The following are 30
code examples of __builtin__.map().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
__builtin__
, or try the search function
.
Example #1
Source File: config.py From recordlinkage with BSD 3-Clause "New" or "Revised" License | 6 votes |
def is_instance_factory(_type): """ Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which raises ValueError if x is not an instance of `_type` """ if isinstance(_type, (tuple, list)): _type = tuple(_type) type_repr = "|".join(map(lambda x: x.__name__, _type)) else: type_repr = "'{typ}'".format(typ=_type.__name__) def inner(x): if not isinstance(x, _type): msg = "Value must be an instance of {type_repr}" raise ValueError(msg.format(type_repr=type_repr)) return inner
Example #2
Source File: __init__.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #3
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def __repr__(self): return "map(%r, %s)" % (self.func, ", ".join((_coconut.repr(i) for i in self.iters)))
Example #4
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def __copy__(self): return self.__class__(self.func, *_coconut.map(_coconut.copy.copy, self.iters))
Example #5
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def __iter__(self): from concurrent.futures import ProcessPoolExecutor with ProcessPoolExecutor() as executor: return _coconut.iter(_coconut.list(executor.map(self.func, *self.iters)))
Example #6
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def __iter__(self): from concurrent.futures import ThreadPoolExecutor from multiprocessing import cpu_count # cpu_count() * 5 is the default Python 3.5 thread count with ThreadPoolExecutor(cpu_count() * 5) as executor: return _coconut.iter(_coconut.list(executor.map(self.func, *self.iters)))
Example #7
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def makedata(data_type, *args): """Construct an object of the given data_type containing the given arguments.""" if _coconut.hasattr(data_type, "_make") and _coconut.issubclass(data_type, _coconut.tuple): return data_type._make(args) if _coconut.issubclass(data_type, (_coconut.map, _coconut.range, _coconut.abc.Iterator)): return args if _coconut.issubclass(data_type, _coconut.str): return "".join(args) return data_type(args)
Example #8
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def __new__(cls, function, *iterables): new_map = _coconut.map.__new__(cls, function, *iterables) new_map.func = function new_map.iters = iterables return new_map
Example #9
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def __repr__(self): return "map(%r, %s)" % (self.func, ", ".join((_coconut.repr(i) for i in self.iters)))
Example #10
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def __copy__(self): return self.__class__(self.func, *_coconut.map(_coconut.copy.copy, self.iters))
Example #11
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def __iter__(self): from concurrent.futures import ProcessPoolExecutor with ProcessPoolExecutor() as executor: return _coconut.iter(_coconut.list(executor.map(self.func, *self.iters)))
Example #12
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def __copy__(self): return self.__class__(*_coconut.map(_coconut.copy.copy, self.iters))
Example #13
Source File: setup.py From pyprover with Apache License 2.0 | 5 votes |
def makedata(data_type, *args): """Construct an object of the given data_type containing the given arguments.""" if _coconut.hasattr(data_type, "_make") and _coconut.issubclass(data_type, _coconut.tuple): return data_type._make(args) if _coconut.issubclass(data_type, (_coconut.map, _coconut.range, _coconut.abc.Iterator)): return args if _coconut.issubclass(data_type, _coconut.str): return "".join(args) return data_type(args)
Example #14
Source File: compatibility_utils.py From fb2mobi with MIT License | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #15
Source File: python.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #16
Source File: __coconut__.py From pyprover with Apache License 2.0 | 5 votes |
def __new__(cls, function, *iterables): new_map = _coconut.map.__new__(cls, function, *iterables) new_map.func = function new_map.iters = iterables return new_map
Example #17
Source File: __init__.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #18
Source File: noniterators.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def flatmap(f, items): return chain.from_iterable(map(f, items))
Example #19
Source File: __init__.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #20
Source File: __init__.py From coffeegrindsize with MIT License | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #21
Source File: noniterators.py From arissploit with GNU General Public License v3.0 | 5 votes |
def flatmap(f, items): return chain.from_iterable(map(f, items))
Example #22
Source File: __init__.py From arissploit with GNU General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #23
Source File: noniterators.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def flatmap(f, items): return chain.from_iterable(map(f, items))
Example #24
Source File: __init__.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #25
Source File: noniterators.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def flatmap(f, items): return chain.from_iterable(map(f, items))
Example #26
Source File: __init__.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #27
Source File: __init__.py From twitter-stock-recommendation with MIT License | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #28
Source File: __init__.py From deepWordBug with Apache License 2.0 | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #29
Source File: config.py From recordlinkage with BSD 3-Clause "New" or "Revised" License | 5 votes |
def lmap(*args, **kwargs): return list(map(*args, **kwargs))
Example #30
Source File: noniterators.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def flatmap(f, items): return chain.from_iterable(map(f, items))