repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
mila-iqia/fuel
fuel/transformers/__init__.py
ExpectsAxisLabels.verify_axis_labels
def verify_axis_labels(self, expected, actual, source_name): """Verify that axis labels for a given source are as expected. Parameters ---------- expected : tuple A tuple of strings representing the expected axis labels. actual : tuple or None A tuple of ...
python
def verify_axis_labels(self, expected, actual, source_name): """Verify that axis labels for a given source are as expected. Parameters ---------- expected : tuple A tuple of strings representing the expected axis labels. actual : tuple or None A tuple of ...
[ "def", "verify_axis_labels", "(", "self", ",", "expected", ",", "actual", ",", "source_name", ")", ":", "if", "not", "getattr", "(", "self", ",", "'_checked_axis_labels'", ",", "False", ")", ":", "self", ".", "_checked_axis_labels", "=", "defaultdict", "(", ...
Verify that axis labels for a given source are as expected. Parameters ---------- expected : tuple A tuple of strings representing the expected axis labels. actual : tuple or None A tuple of strings representing the actual axis labels, or `None` if th...
[ "Verify", "that", "axis", "labels", "for", "a", "given", "source", "are", "as", "expected", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/transformers/__init__.py#L34-L67
train
mila-iqia/fuel
fuel/transformers/__init__.py
Batch.get_data
def get_data(self, request=None): """Get data from the dataset.""" if request is None: raise ValueError data = [[] for _ in self.sources] for i in range(request): try: for source_data, example in zip( data, next(self.child_e...
python
def get_data(self, request=None): """Get data from the dataset.""" if request is None: raise ValueError data = [[] for _ in self.sources] for i in range(request): try: for source_data, example in zip( data, next(self.child_e...
[ "def", "get_data", "(", "self", ",", "request", "=", "None", ")", ":", "if", "request", "is", "None", ":", "raise", "ValueError", "data", "=", "[", "[", "]", "for", "_", "in", "self", ".", "sources", "]", "for", "i", "in", "range", "(", "request", ...
Get data from the dataset.
[ "Get", "data", "from", "the", "dataset", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/transformers/__init__.py#L608-L626
train
mila-iqia/fuel
fuel/utils/parallel.py
_producer_wrapper
def _producer_wrapper(f, port, addr='tcp://127.0.0.1'): """A shim that sets up a socket and starts the producer callable. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. port : int The port on wh...
python
def _producer_wrapper(f, port, addr='tcp://127.0.0.1'): """A shim that sets up a socket and starts the producer callable. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. port : int The port on wh...
[ "def", "_producer_wrapper", "(", "f", ",", "port", ",", "addr", "=", "'tcp://127.0.0.1'", ")", ":", "try", ":", "context", "=", "zmq", ".", "Context", "(", ")", "socket", "=", "context", ".", "socket", "(", "zmq", ".", "PUSH", ")", "socket", ".", "co...
A shim that sets up a socket and starts the producer callable. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. port : int The port on which the socket should connect. addr : str, optional ...
[ "A", "shim", "that", "sets", "up", "a", "socket", "and", "starts", "the", "producer", "callable", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/parallel.py#L14-L36
train
mila-iqia/fuel
fuel/utils/parallel.py
_spawn_producer
def _spawn_producer(f, port, addr='tcp://127.0.0.1'): """Start a process that sends results on a PUSH socket. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. Returns ------- process : multiproce...
python
def _spawn_producer(f, port, addr='tcp://127.0.0.1'): """Start a process that sends results on a PUSH socket. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. Returns ------- process : multiproce...
[ "def", "_spawn_producer", "(", "f", ",", "port", ",", "addr", "=", "'tcp://127.0.0.1'", ")", ":", "process", "=", "Process", "(", "target", "=", "_producer_wrapper", ",", "args", "=", "(", "f", ",", "port", ",", "addr", ")", ")", "process", ".", "start...
Start a process that sends results on a PUSH socket. Parameters ---------- f : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. Returns ------- process : multiprocessing.Process The process handle of the created produ...
[ "Start", "a", "process", "that", "sends", "results", "on", "a", "PUSH", "socket", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/parallel.py#L39-L56
train
mila-iqia/fuel
fuel/utils/parallel.py
producer_consumer
def producer_consumer(producer, consumer, addr='tcp://127.0.0.1', port=None, context=None): """A producer-consumer pattern. Parameters ---------- producer : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. co...
python
def producer_consumer(producer, consumer, addr='tcp://127.0.0.1', port=None, context=None): """A producer-consumer pattern. Parameters ---------- producer : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. co...
[ "def", "producer_consumer", "(", "producer", ",", "consumer", ",", "addr", "=", "'tcp://127.0.0.1'", ",", "port", "=", "None", ",", "context", "=", "None", ")", ":", "context_created", "=", "False", "if", "context", "is", "None", ":", "context_created", "=",...
A producer-consumer pattern. Parameters ---------- producer : callable Callable that takes a single argument, a handle for a ZeroMQ PUSH socket. Must be picklable. consumer : callable Callable that takes a single argument, a handle for a ZeroMQ PULL socket. addr : st...
[ "A", "producer", "-", "consumer", "pattern", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/parallel.py#L59-L113
train
mila-iqia/fuel
fuel/converters/dogs_vs_cats.py
convert_dogs_vs_cats
def convert_dogs_vs_cats(directory, output_directory, output_filename='dogs_vs_cats.hdf5'): """Converts the Dogs vs. Cats dataset to HDF5. Converts the Dogs vs. Cats dataset to an HDF5 dataset compatible with :class:`fuel.datasets.dogs_vs_cats`. The converted dataset is saved as ...
python
def convert_dogs_vs_cats(directory, output_directory, output_filename='dogs_vs_cats.hdf5'): """Converts the Dogs vs. Cats dataset to HDF5. Converts the Dogs vs. Cats dataset to an HDF5 dataset compatible with :class:`fuel.datasets.dogs_vs_cats`. The converted dataset is saved as ...
[ "def", "convert_dogs_vs_cats", "(", "directory", ",", "output_directory", ",", "output_filename", "=", "'dogs_vs_cats.hdf5'", ")", ":", "# Prepare output file", "output_path", "=", "os", ".", "path", ".", "join", "(", "output_directory", ",", "output_filename", ")", ...
Converts the Dogs vs. Cats dataset to HDF5. Converts the Dogs vs. Cats dataset to an HDF5 dataset compatible with :class:`fuel.datasets.dogs_vs_cats`. The converted dataset is saved as 'dogs_vs_cats.hdf5'. It assumes the existence of the following files: * `dogs_vs_cats.train.zip` * `dogs_vs_...
[ "Converts", "the", "Dogs", "vs", ".", "Cats", "dataset", "to", "HDF5", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/dogs_vs_cats.py#L16-L113
train
mila-iqia/fuel
fuel/bin/fuel_download.py
main
def main(args=None): """Entry point for `fuel-download` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's downloading utility. If this argument is not sp...
python
def main(args=None): """Entry point for `fuel-download` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's downloading utility. If this argument is not sp...
[ "def", "main", "(", "args", "=", "None", ")", ":", "built_in_datasets", "=", "dict", "(", "downloaders", ".", "all_downloaders", ")", "if", "fuel", ".", "config", ".", "extra_downloaders", ":", "for", "name", "in", "fuel", ".", "config", ".", "extra_downlo...
Entry point for `fuel-download` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's downloading utility. If this argument is not specified, `sys.argv[1:]` will...
[ "Entry", "point", "for", "fuel", "-", "download", "script", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/bin/fuel_download.py#L19-L64
train
mila-iqia/fuel
fuel/downloaders/mnist.py
fill_subparser
def fill_subparser(subparser): """Sets up a subparser to download the MNIST dataset files. The following MNIST dataset files are downloaded from Yann LeCun's website [LECUN]: `train-images-idx3-ubyte.gz`, `train-labels-idx1-ubyte.gz`, `t10k-images-idx3-ubyte.gz`, `t10k-labels-idx1-ubyte.gz`. P...
python
def fill_subparser(subparser): """Sets up a subparser to download the MNIST dataset files. The following MNIST dataset files are downloaded from Yann LeCun's website [LECUN]: `train-images-idx3-ubyte.gz`, `train-labels-idx1-ubyte.gz`, `t10k-images-idx3-ubyte.gz`, `t10k-labels-idx1-ubyte.gz`. P...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "filenames", "=", "[", "'train-images-idx3-ubyte.gz'", ",", "'train-labels-idx1-ubyte.gz'", ",", "'t10k-images-idx3-ubyte.gz'", ",", "'t10k-labels-idx1-ubyte.gz'", "]", "urls", "=", "[", "'http://yann.lecun.com/exdb/mnist/'...
Sets up a subparser to download the MNIST dataset files. The following MNIST dataset files are downloaded from Yann LeCun's website [LECUN]: `train-images-idx3-ubyte.gz`, `train-labels-idx1-ubyte.gz`, `t10k-images-idx3-ubyte.gz`, `t10k-labels-idx1-ubyte.gz`. Parameters ---------- subparser...
[ "Sets", "up", "a", "subparser", "to", "download", "the", "MNIST", "dataset", "files", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/mnist.py#L4-L22
train
mila-iqia/fuel
fuel/bin/fuel_info.py
main
def main(args=None): """Entry point for `fuel-info` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's information utility. If this argument is not specif...
python
def main(args=None): """Entry point for `fuel-info` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's information utility. If this argument is not specif...
[ "def", "main", "(", "args", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Extracts metadata from a Fuel-converted HDF5 file.'", ")", "parser", ".", "add_argument", "(", "\"filename\"", ",", "help", "=", "\"HDF5...
Entry point for `fuel-info` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's information utility. If this argument is not specified, `sys.argv[1:]` will ...
[ "Entry", "point", "for", "fuel", "-", "info", "script", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/bin/fuel_info.py#L22-L51
train
mila-iqia/fuel
fuel/converters/caltech101_silhouettes.py
convert_silhouettes
def convert_silhouettes(size, directory, output_directory, output_filename=None): """ Convert the CalTech 101 Silhouettes Datasets. Parameters ---------- size : {16, 28} Convert either the 16x16 or 28x28 sized version of the dataset. directory : str Directory...
python
def convert_silhouettes(size, directory, output_directory, output_filename=None): """ Convert the CalTech 101 Silhouettes Datasets. Parameters ---------- size : {16, 28} Convert either the 16x16 or 28x28 sized version of the dataset. directory : str Directory...
[ "def", "convert_silhouettes", "(", "size", ",", "directory", ",", "output_directory", ",", "output_filename", "=", "None", ")", ":", "if", "size", "not", "in", "(", "16", ",", "28", ")", ":", "raise", "ValueError", "(", "'size must be 16 or 28'", ")", "if", ...
Convert the CalTech 101 Silhouettes Datasets. Parameters ---------- size : {16, 28} Convert either the 16x16 or 28x28 sized version of the dataset. directory : str Directory in which the required input files reside. output_filename : str Where to save the converted dataset.
[ "Convert", "the", "CalTech", "101", "Silhouettes", "Datasets", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/caltech101_silhouettes.py#L9-L61
train
mila-iqia/fuel
fuel/schemes.py
cross_validation
def cross_validation(scheme_class, num_examples, num_folds, strict=True, **kwargs): """Return pairs of schemes to be used for cross-validation. Parameters ---------- scheme_class : subclass of :class:`IndexScheme` or :class:`BatchScheme` The type of the returned schemes. Th...
python
def cross_validation(scheme_class, num_examples, num_folds, strict=True, **kwargs): """Return pairs of schemes to be used for cross-validation. Parameters ---------- scheme_class : subclass of :class:`IndexScheme` or :class:`BatchScheme` The type of the returned schemes. Th...
[ "def", "cross_validation", "(", "scheme_class", ",", "num_examples", ",", "num_folds", ",", "strict", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "strict", "and", "num_examples", "%", "num_folds", "!=", "0", ":", "raise", "ValueError", "(", "(", ...
Return pairs of schemes to be used for cross-validation. Parameters ---------- scheme_class : subclass of :class:`IndexScheme` or :class:`BatchScheme` The type of the returned schemes. The constructor is called with an iterator and `**kwargs` as arguments. num_examples : int The...
[ "Return", "pairs", "of", "schemes", "to", "be", "used", "for", "cross", "-", "validation", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/schemes.py#L260-L305
train
mila-iqia/fuel
fuel/bin/fuel_convert.py
main
def main(args=None): """Entry point for `fuel-convert` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's conversion utility. If this argument is not spec...
python
def main(args=None): """Entry point for `fuel-convert` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's conversion utility. If this argument is not spec...
[ "def", "main", "(", "args", "=", "None", ")", ":", "built_in_datasets", "=", "dict", "(", "converters", ".", "all_converters", ")", "if", "fuel", ".", "config", ".", "extra_converters", ":", "for", "name", "in", "fuel", ".", "config", ".", "extra_converter...
Entry point for `fuel-convert` script. This function can also be imported and used from Python. Parameters ---------- args : iterable, optional (default: None) A list of arguments that will be passed to Fuel's conversion utility. If this argument is not specified, `sys.argv[1:]` will ...
[ "Entry", "point", "for", "fuel", "-", "convert", "script", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/bin/fuel_convert.py#L24-L98
train
mila-iqia/fuel
fuel/utils/lock.py
refresh_lock
def refresh_lock(lock_file): """'Refresh' an existing lock. 'Refresh' an existing lock by re-writing the file containing the owner's unique id, using a new (randomly generated) id, which is also returned. """ unique_id = '%s_%s_%s' % ( os.getpid(), ''.join([str(random.randint(0...
python
def refresh_lock(lock_file): """'Refresh' an existing lock. 'Refresh' an existing lock by re-writing the file containing the owner's unique id, using a new (randomly generated) id, which is also returned. """ unique_id = '%s_%s_%s' % ( os.getpid(), ''.join([str(random.randint(0...
[ "def", "refresh_lock", "(", "lock_file", ")", ":", "unique_id", "=", "'%s_%s_%s'", "%", "(", "os", ".", "getpid", "(", ")", ",", "''", ".", "join", "(", "[", "str", "(", "random", ".", "randint", "(", "0", ",", "9", ")", ")", "for", "i", "in", ...
Refresh' an existing lock. 'Refresh' an existing lock by re-writing the file containing the owner's unique id, using a new (randomly generated) id, which is also returned.
[ "Refresh", "an", "existing", "lock", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L95-L118
train
mila-iqia/fuel
fuel/utils/lock.py
get_lock
def get_lock(lock_dir, **kw): """Obtain lock on compilation directory. Parameters ---------- lock_dir : str Lock directory. kw : dict Additional arguments to be forwarded to the `lock` function when acquiring the lock. Notes ----- We can lock only on 1 directory...
python
def get_lock(lock_dir, **kw): """Obtain lock on compilation directory. Parameters ---------- lock_dir : str Lock directory. kw : dict Additional arguments to be forwarded to the `lock` function when acquiring the lock. Notes ----- We can lock only on 1 directory...
[ "def", "get_lock", "(", "lock_dir", ",", "*", "*", "kw", ")", ":", "if", "not", "hasattr", "(", "get_lock", ",", "'n_lock'", ")", ":", "# Initialization.", "get_lock", ".", "n_lock", "=", "0", "if", "not", "hasattr", "(", "get_lock", ",", "'lock_is_enabl...
Obtain lock on compilation directory. Parameters ---------- lock_dir : str Lock directory. kw : dict Additional arguments to be forwarded to the `lock` function when acquiring the lock. Notes ----- We can lock only on 1 directory at a time.
[ "Obtain", "lock", "on", "compilation", "directory", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L297-L356
train
mila-iqia/fuel
fuel/utils/lock.py
release_lock
def release_lock(): """Release lock on compilation directory.""" get_lock.n_lock -= 1 assert get_lock.n_lock >= 0 # Only really release lock once all lock requests have ended. if get_lock.lock_is_enabled and get_lock.n_lock == 0: get_lock.start_time = None get_lock.unlocker.unlock()
python
def release_lock(): """Release lock on compilation directory.""" get_lock.n_lock -= 1 assert get_lock.n_lock >= 0 # Only really release lock once all lock requests have ended. if get_lock.lock_is_enabled and get_lock.n_lock == 0: get_lock.start_time = None get_lock.unlocker.unlock()
[ "def", "release_lock", "(", ")", ":", "get_lock", ".", "n_lock", "-=", "1", "assert", "get_lock", ".", "n_lock", ">=", "0", "# Only really release lock once all lock requests have ended.", "if", "get_lock", ".", "lock_is_enabled", "and", "get_lock", ".", "n_lock", "...
Release lock on compilation directory.
[ "Release", "lock", "on", "compilation", "directory", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L359-L366
train
mila-iqia/fuel
fuel/utils/lock.py
release_readlock
def release_readlock(lockdir_name): """Release a previously obtained readlock. Parameters ---------- lockdir_name : str Name of the previously obtained readlock """ # Make sure the lock still exists before deleting it if os.path.exists(lockdir_name) and os.path.isdir(lockdir_name):...
python
def release_readlock(lockdir_name): """Release a previously obtained readlock. Parameters ---------- lockdir_name : str Name of the previously obtained readlock """ # Make sure the lock still exists before deleting it if os.path.exists(lockdir_name) and os.path.isdir(lockdir_name):...
[ "def", "release_readlock", "(", "lockdir_name", ")", ":", "# Make sure the lock still exists before deleting it", "if", "os", ".", "path", ".", "exists", "(", "lockdir_name", ")", "and", "os", ".", "path", ".", "isdir", "(", "lockdir_name", ")", ":", "os", ".", ...
Release a previously obtained readlock. Parameters ---------- lockdir_name : str Name of the previously obtained readlock
[ "Release", "a", "previously", "obtained", "readlock", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L392-L403
train
mila-iqia/fuel
fuel/utils/lock.py
get_readlock
def get_readlock(pid, path): """Obtain a readlock on a file. Parameters ---------- path : str Name of the file on which to obtain a readlock """ timestamp = int(time.time() * 1e6) lockdir_name = "%s.readlock.%i.%i" % (path, pid, timestamp) os.mkdir(lockdir_name) # Register...
python
def get_readlock(pid, path): """Obtain a readlock on a file. Parameters ---------- path : str Name of the file on which to obtain a readlock """ timestamp = int(time.time() * 1e6) lockdir_name = "%s.readlock.%i.%i" % (path, pid, timestamp) os.mkdir(lockdir_name) # Register...
[ "def", "get_readlock", "(", "pid", ",", "path", ")", ":", "timestamp", "=", "int", "(", "time", ".", "time", "(", ")", "*", "1e6", ")", "lockdir_name", "=", "\"%s.readlock.%i.%i\"", "%", "(", "path", ",", "pid", ",", "timestamp", ")", "os", ".", "mkd...
Obtain a readlock on a file. Parameters ---------- path : str Name of the file on which to obtain a readlock
[ "Obtain", "a", "readlock", "on", "a", "file", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L406-L420
train
mila-iqia/fuel
fuel/utils/lock.py
Unlocker.unlock
def unlock(self): """Remove current lock. This function does not crash if it is unable to properly delete the lock file and directory. The reason is that it should be allowed for multiple jobs running in parallel to unlock the same directory at the same time (e.g. when reaching ...
python
def unlock(self): """Remove current lock. This function does not crash if it is unable to properly delete the lock file and directory. The reason is that it should be allowed for multiple jobs running in parallel to unlock the same directory at the same time (e.g. when reaching ...
[ "def", "unlock", "(", "self", ")", ":", "# If any error occurs, we assume this is because someone else tried to", "# unlock this directory at the same time.", "# Note that it is important not to have both remove statements within", "# the same try/except block. The reason is that while the attempt...
Remove current lock. This function does not crash if it is unable to properly delete the lock file and directory. The reason is that it should be allowed for multiple jobs running in parallel to unlock the same directory at the same time (e.g. when reaching their timeout limit).
[ "Remove", "current", "lock", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/lock.py#L69-L92
train
mila-iqia/fuel
fuel/downloaders/base.py
filename_from_url
def filename_from_url(url, path=None): """Parses a URL to determine a file name. Parameters ---------- url : str URL to parse. """ r = requests.get(url, stream=True) if 'Content-Disposition' in r.headers: filename = re.findall(r'filename=([^;]+)', ...
python
def filename_from_url(url, path=None): """Parses a URL to determine a file name. Parameters ---------- url : str URL to parse. """ r = requests.get(url, stream=True) if 'Content-Disposition' in r.headers: filename = re.findall(r'filename=([^;]+)', ...
[ "def", "filename_from_url", "(", "url", ",", "path", "=", "None", ")", ":", "r", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "if", "'Content-Disposition'", "in", "r", ".", "headers", ":", "filename", "=", "re", ".", "fin...
Parses a URL to determine a file name. Parameters ---------- url : str URL to parse.
[ "Parses", "a", "URL", "to", "determine", "a", "file", "name", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/base.py#L39-L54
train
mila-iqia/fuel
fuel/downloaders/base.py
download
def download(url, file_handle, chunk_size=1024): """Downloads a given URL to a specific file. Parameters ---------- url : str URL to download. file_handle : file Where to save the downloaded URL. """ r = requests.get(url, stream=True) total_length = r.headers.get('conte...
python
def download(url, file_handle, chunk_size=1024): """Downloads a given URL to a specific file. Parameters ---------- url : str URL to download. file_handle : file Where to save the downloaded URL. """ r = requests.get(url, stream=True) total_length = r.headers.get('conte...
[ "def", "download", "(", "url", ",", "file_handle", ",", "chunk_size", "=", "1024", ")", ":", "r", "=", "requests", ".", "get", "(", "url", ",", "stream", "=", "True", ")", "total_length", "=", "r", ".", "headers", ".", "get", "(", "'content-length'", ...
Downloads a given URL to a specific file. Parameters ---------- url : str URL to download. file_handle : file Where to save the downloaded URL.
[ "Downloads", "a", "given", "URL", "to", "a", "specific", "file", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/base.py#L57-L79
train
mila-iqia/fuel
fuel/downloaders/base.py
default_downloader
def default_downloader(directory, urls, filenames, url_prefix=None, clear=False): """Downloads or clears files from URLs and filenames. Parameters ---------- directory : str The directory in which downloaded files are saved. urls : list A list of URLs to downl...
python
def default_downloader(directory, urls, filenames, url_prefix=None, clear=False): """Downloads or clears files from URLs and filenames. Parameters ---------- directory : str The directory in which downloaded files are saved. urls : list A list of URLs to downl...
[ "def", "default_downloader", "(", "directory", ",", "urls", ",", "filenames", ",", "url_prefix", "=", "None", ",", "clear", "=", "False", ")", ":", "# Parse file names from URL if not provided", "for", "i", ",", "url", "in", "enumerate", "(", "urls", ")", ":",...
Downloads or clears files from URLs and filenames. Parameters ---------- directory : str The directory in which downloaded files are saved. urls : list A list of URLs to download. filenames : list A list of file names for the corresponding URLs. url_prefix : str, optiona...
[ "Downloads", "or", "clears", "files", "from", "URLs", "and", "filenames", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/base.py#L96-L140
train
mila-iqia/fuel
fuel/utils/__init__.py
find_in_data_path
def find_in_data_path(filename): """Searches for a file within Fuel's data path. This function loops over all paths defined in Fuel's data path and returns the first path in which the file is found. Parameters ---------- filename : str Name of the file to find. Returns -------...
python
def find_in_data_path(filename): """Searches for a file within Fuel's data path. This function loops over all paths defined in Fuel's data path and returns the first path in which the file is found. Parameters ---------- filename : str Name of the file to find. Returns -------...
[ "def", "find_in_data_path", "(", "filename", ")", ":", "for", "path", "in", "config", ".", "data_path", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "os", ".", "path", ".", "expandvars", "(", "path", ")", ")", "file_path", "=", "os", ...
Searches for a file within Fuel's data path. This function loops over all paths defined in Fuel's data path and returns the first path in which the file is found. Parameters ---------- filename : str Name of the file to find. Returns ------- file_path : str Path to the...
[ "Searches", "for", "a", "file", "within", "Fuel", "s", "data", "path", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L406-L434
train
mila-iqia/fuel
fuel/utils/__init__.py
lazy_property_factory
def lazy_property_factory(lazy_property): """Create properties that perform lazy loading of attributes.""" def lazy_property_getter(self): if not hasattr(self, '_' + lazy_property): self.load() if not hasattr(self, '_' + lazy_property): raise ValueError("{} wasn't loaded"...
python
def lazy_property_factory(lazy_property): """Create properties that perform lazy loading of attributes.""" def lazy_property_getter(self): if not hasattr(self, '_' + lazy_property): self.load() if not hasattr(self, '_' + lazy_property): raise ValueError("{} wasn't loaded"...
[ "def", "lazy_property_factory", "(", "lazy_property", ")", ":", "def", "lazy_property_getter", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_'", "+", "lazy_property", ")", ":", "self", ".", "load", "(", ")", "if", "not", "hasattr", ...
Create properties that perform lazy loading of attributes.
[ "Create", "properties", "that", "perform", "lazy", "loading", "of", "attributes", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L437-L449
train
mila-iqia/fuel
fuel/utils/__init__.py
do_not_pickle_attributes
def do_not_pickle_attributes(*lazy_properties): r"""Decorator to assign non-pickable properties. Used to assign properties which will not be pickled on some class. This decorator creates a series of properties whose values won't be serialized; instead, their values will be reloaded (e.g. from disk) by ...
python
def do_not_pickle_attributes(*lazy_properties): r"""Decorator to assign non-pickable properties. Used to assign properties which will not be pickled on some class. This decorator creates a series of properties whose values won't be serialized; instead, their values will be reloaded (e.g. from disk) by ...
[ "def", "do_not_pickle_attributes", "(", "*", "lazy_properties", ")", ":", "def", "wrap_class", "(", "cls", ")", ":", "if", "not", "hasattr", "(", "cls", ",", "'load'", ")", ":", "raise", "ValueError", "(", "\"no load method implemented\"", ")", "# Attach the laz...
r"""Decorator to assign non-pickable properties. Used to assign properties which will not be pickled on some class. This decorator creates a series of properties whose values won't be serialized; instead, their values will be reloaded (e.g. from disk) by the :meth:`load` function after deserializing th...
[ "r", "Decorator", "to", "assign", "non", "-", "pickable", "properties", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L452-L513
train
mila-iqia/fuel
fuel/utils/__init__.py
Subset.sorted_fancy_indexing
def sorted_fancy_indexing(indexable, request): """Safe fancy indexing. Some objects, such as h5py datasets, only support list indexing if the list is sorted. This static method adds support for unsorted list indexing by sorting the requested indices, accessing the corresponding...
python
def sorted_fancy_indexing(indexable, request): """Safe fancy indexing. Some objects, such as h5py datasets, only support list indexing if the list is sorted. This static method adds support for unsorted list indexing by sorting the requested indices, accessing the corresponding...
[ "def", "sorted_fancy_indexing", "(", "indexable", ",", "request", ")", ":", "if", "len", "(", "request", ")", ">", "1", ":", "indices", "=", "numpy", ".", "argsort", "(", "request", ")", "data", "=", "numpy", ".", "empty", "(", "shape", "=", "(", "le...
Safe fancy indexing. Some objects, such as h5py datasets, only support list indexing if the list is sorted. This static method adds support for unsorted list indexing by sorting the requested indices, accessing the corresponding elements and re-shuffling the result. Pa...
[ "Safe", "fancy", "indexing", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L175-L200
train
mila-iqia/fuel
fuel/utils/__init__.py
Subset.slice_to_numerical_args
def slice_to_numerical_args(slice_, num_examples): """Translate a slice's attributes into numerical attributes. Parameters ---------- slice_ : :class:`slice` Slice for which numerical attributes are wanted. num_examples : int Number of examples in the ind...
python
def slice_to_numerical_args(slice_, num_examples): """Translate a slice's attributes into numerical attributes. Parameters ---------- slice_ : :class:`slice` Slice for which numerical attributes are wanted. num_examples : int Number of examples in the ind...
[ "def", "slice_to_numerical_args", "(", "slice_", ",", "num_examples", ")", ":", "start", "=", "slice_", ".", "start", "if", "slice_", ".", "start", "is", "not", "None", "else", "0", "stop", "=", "slice_", ".", "stop", "if", "slice_", ".", "stop", "is", ...
Translate a slice's attributes into numerical attributes. Parameters ---------- slice_ : :class:`slice` Slice for which numerical attributes are wanted. num_examples : int Number of examples in the indexable that is to be sliced through. This determin...
[ "Translate", "a", "slice", "s", "attributes", "into", "numerical", "attributes", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L203-L219
train
mila-iqia/fuel
fuel/utils/__init__.py
Subset.get_list_representation
def get_list_representation(self): """Returns this subset's representation as a list of indices.""" if self.is_list: return self.list_or_slice else: return self[list(range(self.num_examples))]
python
def get_list_representation(self): """Returns this subset's representation as a list of indices.""" if self.is_list: return self.list_or_slice else: return self[list(range(self.num_examples))]
[ "def", "get_list_representation", "(", "self", ")", ":", "if", "self", ".", "is_list", ":", "return", "self", ".", "list_or_slice", "else", ":", "return", "self", "[", "list", "(", "range", "(", "self", ".", "num_examples", ")", ")", "]" ]
Returns this subset's representation as a list of indices.
[ "Returns", "this", "subset", "s", "representation", "as", "a", "list", "of", "indices", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L221-L226
train
mila-iqia/fuel
fuel/utils/__init__.py
Subset.index_within_subset
def index_within_subset(self, indexable, subset_request, sort_indices=False): """Index an indexable object within the context of this subset. Parameters ---------- indexable : indexable object The object to index through. subset_request : ...
python
def index_within_subset(self, indexable, subset_request, sort_indices=False): """Index an indexable object within the context of this subset. Parameters ---------- indexable : indexable object The object to index through. subset_request : ...
[ "def", "index_within_subset", "(", "self", ",", "indexable", ",", "subset_request", ",", "sort_indices", "=", "False", ")", ":", "# Translate the request within the context of this subset to a", "# request to the indexable object", "if", "isinstance", "(", "subset_request", "...
Index an indexable object within the context of this subset. Parameters ---------- indexable : indexable object The object to index through. subset_request : :class:`list` or :class:`slice` List of positive integer indices or slice that constitutes th...
[ "Index", "an", "indexable", "object", "within", "the", "context", "of", "this", "subset", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L228-L266
train
mila-iqia/fuel
fuel/utils/__init__.py
Subset.num_examples
def num_examples(self): """The number of examples this subset spans.""" if self.is_list: return len(self.list_or_slice) else: start, stop, step = self.slice_to_numerical_args( self.list_or_slice, self.original_num_examples) return stop - start
python
def num_examples(self): """The number of examples this subset spans.""" if self.is_list: return len(self.list_or_slice) else: start, stop, step = self.slice_to_numerical_args( self.list_or_slice, self.original_num_examples) return stop - start
[ "def", "num_examples", "(", "self", ")", ":", "if", "self", ".", "is_list", ":", "return", "len", "(", "self", ".", "list_or_slice", ")", "else", ":", "start", ",", "stop", ",", "step", "=", "self", ".", "slice_to_numerical_args", "(", "self", ".", "li...
The number of examples this subset spans.
[ "The", "number", "of", "examples", "this", "subset", "spans", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/utils/__init__.py#L290-L297
train
mila-iqia/fuel
fuel/streams.py
DataStream.get_epoch_iterator
def get_epoch_iterator(self, **kwargs): """Get an epoch iterator for the data stream.""" if not self._fresh_state: self.next_epoch() else: self._fresh_state = False return super(DataStream, self).get_epoch_iterator(**kwargs)
python
def get_epoch_iterator(self, **kwargs): """Get an epoch iterator for the data stream.""" if not self._fresh_state: self.next_epoch() else: self._fresh_state = False return super(DataStream, self).get_epoch_iterator(**kwargs)
[ "def", "get_epoch_iterator", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "_fresh_state", ":", "self", ".", "next_epoch", "(", ")", "else", ":", "self", ".", "_fresh_state", "=", "False", "return", "super", "(", "DataStream",...
Get an epoch iterator for the data stream.
[ "Get", "an", "epoch", "iterator", "for", "the", "data", "stream", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/streams.py#L172-L178
train
mila-iqia/fuel
fuel/downloaders/binarized_mnist.py
fill_subparser
def fill_subparser(subparser): """Sets up a subparser to download the binarized MNIST dataset files. The binarized MNIST dataset files (`binarized_mnist_{train,valid,test}.amat`) are downloaded from Hugo Larochelle's website [HUGO]. .. [HUGO] http://www.cs.toronto.edu/~larocheh/public/datasets/ ...
python
def fill_subparser(subparser): """Sets up a subparser to download the binarized MNIST dataset files. The binarized MNIST dataset files (`binarized_mnist_{train,valid,test}.amat`) are downloaded from Hugo Larochelle's website [HUGO]. .. [HUGO] http://www.cs.toronto.edu/~larocheh/public/datasets/ ...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "sets", "=", "[", "'train'", ",", "'valid'", ",", "'test'", "]", "urls", "=", "[", "'http://www.cs.toronto.edu/~larocheh/public/datasets/'", "+", "'binarized_mnist/binarized_mnist_{}.amat'", ".", "format", "(", "s",...
Sets up a subparser to download the binarized MNIST dataset files. The binarized MNIST dataset files (`binarized_mnist_{train,valid,test}.amat`) are downloaded from Hugo Larochelle's website [HUGO]. .. [HUGO] http://www.cs.toronto.edu/~larocheh/public/datasets/ binarized_mnist/binarized_mnist_{...
[ "Sets", "up", "a", "subparser", "to", "download", "the", "binarized", "MNIST", "dataset", "files", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/binarized_mnist.py#L4-L25
train
mila-iqia/fuel
fuel/downloaders/youtube_audio.py
download
def download(directory, youtube_id, clear=False): """Download the audio of a YouTube video. The audio is downloaded in the highest available quality. Progress is printed to `stdout`. The file is named `youtube_id.m4a`, where `youtube_id` is the 11-character code identifiying the YouTube video (can ...
python
def download(directory, youtube_id, clear=False): """Download the audio of a YouTube video. The audio is downloaded in the highest available quality. Progress is printed to `stdout`. The file is named `youtube_id.m4a`, where `youtube_id` is the 11-character code identifiying the YouTube video (can ...
[ "def", "download", "(", "directory", ",", "youtube_id", ",", "clear", "=", "False", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "'{}.m4a'", ".", "format", "(", "youtube_id", ")", ")", "if", "clear", ":", "os", "....
Download the audio of a YouTube video. The audio is downloaded in the highest available quality. Progress is printed to `stdout`. The file is named `youtube_id.m4a`, where `youtube_id` is the 11-character code identifiying the YouTube video (can be determined from the URL). Parameters --------...
[ "Download", "the", "audio", "of", "a", "YouTube", "video", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/youtube_audio.py#L10-L38
train
mila-iqia/fuel
fuel/downloaders/youtube_audio.py
fill_subparser
def fill_subparser(subparser): """Sets up a subparser to download audio of YouTube videos. Adds the compulsory `--youtube-id` flag. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command. """ subparser.add_argument( ...
python
def fill_subparser(subparser): """Sets up a subparser to download audio of YouTube videos. Adds the compulsory `--youtube-id` flag. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command. """ subparser.add_argument( ...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "subparser", ".", "add_argument", "(", "'--youtube-id'", ",", "type", "=", "str", ",", "required", "=", "True", ",", "help", "=", "(", "\"The YouTube ID of the video from which to extract audio, \"", "\"usually an 1...
Sets up a subparser to download audio of YouTube videos. Adds the compulsory `--youtube-id` flag. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command.
[ "Sets", "up", "a", "subparser", "to", "download", "audio", "of", "YouTube", "videos", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/downloaders/youtube_audio.py#L41-L57
train
mila-iqia/fuel
fuel/converters/youtube_audio.py
convert_youtube_audio
def convert_youtube_audio(directory, output_directory, youtube_id, channels, sample, output_filename=None): """Converts downloaded YouTube audio to HDF5 format. Requires `ffmpeg` to be installed and available on the command line (i.e. available on your `PATH`). Parameters ...
python
def convert_youtube_audio(directory, output_directory, youtube_id, channels, sample, output_filename=None): """Converts downloaded YouTube audio to HDF5 format. Requires `ffmpeg` to be installed and available on the command line (i.e. available on your `PATH`). Parameters ...
[ "def", "convert_youtube_audio", "(", "directory", ",", "output_directory", ",", "youtube_id", ",", "channels", ",", "sample", ",", "output_filename", "=", "None", ")", ":", "input_file", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "'{}.m4a'", ...
Converts downloaded YouTube audio to HDF5 format. Requires `ffmpeg` to be installed and available on the command line (i.e. available on your `PATH`). Parameters ---------- directory : str Directory in which input files reside. output_directory : str Directory in which to save ...
[ "Converts", "downloaded", "YouTube", "audio", "to", "HDF5", "format", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/youtube_audio.py#L11-L62
train
mila-iqia/fuel
fuel/converters/youtube_audio.py
fill_subparser
def fill_subparser(subparser): """Sets up a subparser to convert YouTube audio files. Adds the compulsory `--youtube-id` flag as well as the optional `sample` and `channels` flags. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio`...
python
def fill_subparser(subparser): """Sets up a subparser to convert YouTube audio files. Adds the compulsory `--youtube-id` flag as well as the optional `sample` and `channels` flags. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio`...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "subparser", ".", "add_argument", "(", "'--youtube-id'", ",", "type", "=", "str", ",", "required", "=", "True", ",", "help", "=", "(", "\"The YouTube ID of the video from which to extract audio, \"", "\"usually an 1...
Sets up a subparser to convert YouTube audio files. Adds the compulsory `--youtube-id` flag as well as the optional `sample` and `channels` flags. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `youtube_audio` command.
[ "Sets", "up", "a", "subparser", "to", "convert", "YouTube", "audio", "files", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/youtube_audio.py#L65-L93
train
mila-iqia/fuel
fuel/converters/ilsvrc2012.py
convert_ilsvrc2012
def convert_ilsvrc2012(directory, output_directory, output_filename='ilsvrc2012.hdf5', shuffle_seed=config.default_seed): """Converter for data from the ILSVRC 2012 competition. Source files for this dataset can be obtained by registering at [ILSVRC2012WEB]. ...
python
def convert_ilsvrc2012(directory, output_directory, output_filename='ilsvrc2012.hdf5', shuffle_seed=config.default_seed): """Converter for data from the ILSVRC 2012 competition. Source files for this dataset can be obtained by registering at [ILSVRC2012WEB]. ...
[ "def", "convert_ilsvrc2012", "(", "directory", ",", "output_directory", ",", "output_filename", "=", "'ilsvrc2012.hdf5'", ",", "shuffle_seed", "=", "config", ".", "default_seed", ")", ":", "devkit_path", "=", "os", ".", "path", ".", "join", "(", "directory", ","...
Converter for data from the ILSVRC 2012 competition. Source files for this dataset can be obtained by registering at [ILSVRC2012WEB]. Parameters ---------- input_directory : str Path from which to read raw data files. output_directory : str Path to which to save the HDF5 file. ...
[ "Converter", "for", "data", "from", "the", "ILSVRC", "2012", "competition", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/ilsvrc2012.py#L35-L78
train
mila-iqia/fuel
fuel/converters/ilsvrc2012.py
fill_subparser
def fill_subparser(subparser): """Sets up a subparser to convert the ILSVRC2012 dataset files. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `ilsvrc2012` command. """ subparser.add_argument( "--shuffle-seed", help="Seed to use for ran...
python
def fill_subparser(subparser): """Sets up a subparser to convert the ILSVRC2012 dataset files. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `ilsvrc2012` command. """ subparser.add_argument( "--shuffle-seed", help="Seed to use for ran...
[ "def", "fill_subparser", "(", "subparser", ")", ":", "subparser", ".", "add_argument", "(", "\"--shuffle-seed\"", ",", "help", "=", "\"Seed to use for randomizing order of the \"", "\"training set on disk.\"", ",", "default", "=", "config", ".", "default_seed", ",", "ty...
Sets up a subparser to convert the ILSVRC2012 dataset files. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `ilsvrc2012` command.
[ "Sets", "up", "a", "subparser", "to", "convert", "the", "ILSVRC2012", "dataset", "files", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/ilsvrc2012.py#L81-L94
train
mila-iqia/fuel
fuel/converters/ilsvrc2012.py
read_metadata_mat_file
def read_metadata_mat_file(meta_mat): """Read ILSVRC2012 metadata from the distributed MAT file. Parameters ---------- meta_mat : str or file-like object The filename or file-handle for `meta.mat` from the ILSVRC2012 development kit. Returns ------- synsets : ndarray, 1-dim...
python
def read_metadata_mat_file(meta_mat): """Read ILSVRC2012 metadata from the distributed MAT file. Parameters ---------- meta_mat : str or file-like object The filename or file-handle for `meta.mat` from the ILSVRC2012 development kit. Returns ------- synsets : ndarray, 1-dim...
[ "def", "read_metadata_mat_file", "(", "meta_mat", ")", ":", "mat", "=", "loadmat", "(", "meta_mat", ",", "squeeze_me", "=", "True", ")", "synsets", "=", "mat", "[", "'synsets'", "]", "new_dtype", "=", "numpy", ".", "dtype", "(", "[", "(", "'ILSVRC2012_ID'"...
Read ILSVRC2012 metadata from the distributed MAT file. Parameters ---------- meta_mat : str or file-like object The filename or file-handle for `meta.mat` from the ILSVRC2012 development kit. Returns ------- synsets : ndarray, 1-dimensional, compound dtype A table cont...
[ "Read", "ILSVRC2012", "metadata", "from", "the", "distributed", "MAT", "file", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/converters/ilsvrc2012.py#L231-L294
train
mila-iqia/fuel
fuel/config_parser.py
multiple_paths_parser
def multiple_paths_parser(value): """Parses data_path argument. Parameters ---------- value : str a string of data paths separated by ":". Returns ------- value : list a list of strings indicating each data paths. """ if isinstance(value, six.string_types): ...
python
def multiple_paths_parser(value): """Parses data_path argument. Parameters ---------- value : str a string of data paths separated by ":". Returns ------- value : list a list of strings indicating each data paths. """ if isinstance(value, six.string_types): ...
[ "def", "multiple_paths_parser", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "value", ".", "split", "(", "os", ".", "path", ".", "pathsep", ")", "return", "value" ]
Parses data_path argument. Parameters ---------- value : str a string of data paths separated by ":". Returns ------- value : list a list of strings indicating each data paths.
[ "Parses", "data_path", "argument", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/config_parser.py#L108-L124
train
mila-iqia/fuel
fuel/config_parser.py
Configuration.add_config
def add_config(self, key, type_, default=NOT_SET, env_var=None): """Add a configuration setting. Parameters ---------- key : str The name of the configuration setting. This must be a valid Python attribute name i.e. alphanumeric with underscores. type : f...
python
def add_config(self, key, type_, default=NOT_SET, env_var=None): """Add a configuration setting. Parameters ---------- key : str The name of the configuration setting. This must be a valid Python attribute name i.e. alphanumeric with underscores. type : f...
[ "def", "add_config", "(", "self", ",", "key", ",", "type_", ",", "default", "=", "NOT_SET", ",", "env_var", "=", "None", ")", ":", "self", ".", "config", "[", "key", "]", "=", "{", "'type'", ":", "type_", "}", "if", "env_var", "is", "not", "None", ...
Add a configuration setting. Parameters ---------- key : str The name of the configuration setting. This must be a valid Python attribute name i.e. alphanumeric with underscores. type : function A function such as ``float``, ``int`` or ``str`` which t...
[ "Add", "a", "configuration", "setting", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/config_parser.py#L168-L196
train
mila-iqia/fuel
fuel/server.py
send_arrays
def send_arrays(socket, arrays, stop=False): """Send NumPy arrays using the buffer interface and some metadata. Parameters ---------- socket : :class:`zmq.Socket` The socket to send data over. arrays : list A list of :class:`numpy.ndarray` to transfer. stop : bool, optional ...
python
def send_arrays(socket, arrays, stop=False): """Send NumPy arrays using the buffer interface and some metadata. Parameters ---------- socket : :class:`zmq.Socket` The socket to send data over. arrays : list A list of :class:`numpy.ndarray` to transfer. stop : bool, optional ...
[ "def", "send_arrays", "(", "socket", ",", "arrays", ",", "stop", "=", "False", ")", ":", "if", "arrays", ":", "# The buffer protocol only works on contiguous arrays", "arrays", "=", "[", "numpy", ".", "ascontiguousarray", "(", "array", ")", "for", "array", "in",...
Send NumPy arrays using the buffer interface and some metadata. Parameters ---------- socket : :class:`zmq.Socket` The socket to send data over. arrays : list A list of :class:`numpy.ndarray` to transfer. stop : bool, optional Instead of sending a series of NumPy arrays, sen...
[ "Send", "NumPy", "arrays", "using", "the", "buffer", "interface", "and", "some", "metadata", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/server.py#L12-L45
train
mila-iqia/fuel
fuel/server.py
recv_arrays
def recv_arrays(socket): """Receive a list of NumPy arrays. Parameters ---------- socket : :class:`zmq.Socket` The socket to receive the arrays on. Returns ------- list A list of :class:`numpy.ndarray` objects. Raises ------ StopIteration If the first J...
python
def recv_arrays(socket): """Receive a list of NumPy arrays. Parameters ---------- socket : :class:`zmq.Socket` The socket to receive the arrays on. Returns ------- list A list of :class:`numpy.ndarray` objects. Raises ------ StopIteration If the first J...
[ "def", "recv_arrays", "(", "socket", ")", ":", "headers", "=", "socket", ".", "recv_json", "(", ")", "if", "'stop'", "in", "headers", ":", "raise", "StopIteration", "arrays", "=", "[", "]", "for", "header", "in", "headers", ":", "data", "=", "socket", ...
Receive a list of NumPy arrays. Parameters ---------- socket : :class:`zmq.Socket` The socket to receive the arrays on. Returns ------- list A list of :class:`numpy.ndarray` objects. Raises ------ StopIteration If the first JSON object received contains the...
[ "Receive", "a", "list", "of", "NumPy", "arrays", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/server.py#L48-L81
train
mila-iqia/fuel
fuel/server.py
start_server
def start_server(data_stream, port=5557, hwm=10): """Start a data processing server. This command starts a server in the current process that performs the actual data processing (by retrieving data from the given data stream). It also starts a second process, the broker, which mediates between the ...
python
def start_server(data_stream, port=5557, hwm=10): """Start a data processing server. This command starts a server in the current process that performs the actual data processing (by retrieving data from the given data stream). It also starts a second process, the broker, which mediates between the ...
[ "def", "start_server", "(", "data_stream", ",", "port", "=", "5557", ",", "hwm", "=", "10", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "'INFO'", ")", "context", "=", "zmq", ".", "Context", "(", ")", "socket", "=", "context", ".", "so...
Start a data processing server. This command starts a server in the current process that performs the actual data processing (by retrieving data from the given data stream). It also starts a second process, the broker, which mediates between the server and the client. The broker also keeps a buffer of ...
[ "Start", "a", "data", "processing", "server", "." ]
1d6292dc25e3a115544237e392e61bff6631d23c
https://github.com/mila-iqia/fuel/blob/1d6292dc25e3a115544237e392e61bff6631d23c/fuel/server.py#L84-L131
train
apacha/OMR-Datasets
omrdatasettools/image_generators/HomusImageGenerator.py
HomusImageGenerator.create_images
def create_images(raw_data_directory: str, destination_directory: str, stroke_thicknesses: List[int], canvas_width: int = None, canvas_height: int = None, staff_line_spacing: int = 14, sta...
python
def create_images(raw_data_directory: str, destination_directory: str, stroke_thicknesses: List[int], canvas_width: int = None, canvas_height: int = None, staff_line_spacing: int = 14, sta...
[ "def", "create_images", "(", "raw_data_directory", ":", "str", ",", "destination_directory", ":", "str", ",", "stroke_thicknesses", ":", "List", "[", "int", "]", ",", "canvas_width", ":", "int", "=", "None", ",", "canvas_height", ":", "int", "=", "None", ","...
Creates a visual representation of the Homus Dataset by parsing all text-files and the symbols as specified by the parameters by drawing lines that connect the points from each stroke of each symbol. Each symbol will be drawn in the center of a fixed canvas, specified by width and height. :par...
[ "Creates", "a", "visual", "representation", "of", "the", "Homus", "Dataset", "by", "parsing", "all", "text", "-", "files", "and", "the", "symbols", "as", "specified", "by", "the", "parameters", "by", "drawing", "lines", "that", "connect", "the", "points", "f...
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/HomusImageGenerator.py#L13-L105
train
apacha/OMR-Datasets
omrdatasettools/image_generators/MuscimaPlusPlusImageGenerator.py
MuscimaPlusPlusImageGenerator.extract_and_render_all_symbol_masks
def extract_and_render_all_symbol_masks(self, raw_data_directory: str, destination_directory: str): """ Extracts all symbols from the raw XML documents and generates individual symbols from the masks :param raw_data_directory: The directory, that contains the xml-files and matching images ...
python
def extract_and_render_all_symbol_masks(self, raw_data_directory: str, destination_directory: str): """ Extracts all symbols from the raw XML documents and generates individual symbols from the masks :param raw_data_directory: The directory, that contains the xml-files and matching images ...
[ "def", "extract_and_render_all_symbol_masks", "(", "self", ",", "raw_data_directory", ":", "str", ",", "destination_directory", ":", "str", ")", ":", "print", "(", "\"Extracting Symbols from Muscima++ Dataset...\"", ")", "xml_files", "=", "self", ".", "get_all_xml_file_pa...
Extracts all symbols from the raw XML documents and generates individual symbols from the masks :param raw_data_directory: The directory, that contains the xml-files and matching images :param destination_directory: The directory, in which the symbols should be generated into. One sub-folder per ...
[ "Extracts", "all", "symbols", "from", "the", "raw", "XML", "documents", "and", "generates", "individual", "symbols", "from", "the", "masks" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/MuscimaPlusPlusImageGenerator.py#L23-L35
train
apacha/OMR-Datasets
omrdatasettools/converters/ImageColorInverter.py
ImageColorInverter.invert_images
def invert_images(self, image_directory: str, image_file_ending: str = "*.bmp"): """ In-situ converts the white on black images of a directory to black on white images :param image_directory: The directory, that contains the images :param image_file_ending: The pattern for finding files...
python
def invert_images(self, image_directory: str, image_file_ending: str = "*.bmp"): """ In-situ converts the white on black images of a directory to black on white images :param image_directory: The directory, that contains the images :param image_file_ending: The pattern for finding files...
[ "def", "invert_images", "(", "self", ",", "image_directory", ":", "str", ",", "image_file_ending", ":", "str", "=", "\"*.bmp\"", ")", ":", "image_paths", "=", "[", "y", "for", "x", "in", "os", ".", "walk", "(", "image_directory", ")", "for", "y", "in", ...
In-situ converts the white on black images of a directory to black on white images :param image_directory: The directory, that contains the images :param image_file_ending: The pattern for finding files in the image_directory
[ "In", "-", "situ", "converts", "the", "white", "on", "black", "images", "of", "a", "directory", "to", "black", "on", "white", "images" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/converters/ImageColorInverter.py#L15-L26
train
apacha/OMR-Datasets
omrdatasettools/image_generators/CapitanImageGenerator.py
CapitanImageGenerator.create_capitan_images
def create_capitan_images(self, raw_data_directory: str, destination_directory: str, stroke_thicknesses: List[int]) -> None: """ Creates a visual representation of the Capitan strokes by parsing all text-files and the symbols as specified ...
python
def create_capitan_images(self, raw_data_directory: str, destination_directory: str, stroke_thicknesses: List[int]) -> None: """ Creates a visual representation of the Capitan strokes by parsing all text-files and the symbols as specified ...
[ "def", "create_capitan_images", "(", "self", ",", "raw_data_directory", ":", "str", ",", "destination_directory", ":", "str", ",", "stroke_thicknesses", ":", "List", "[", "int", "]", ")", "->", "None", ":", "symbols", "=", "self", ".", "load_capitan_symbols", ...
Creates a visual representation of the Capitan strokes by parsing all text-files and the symbols as specified by the parameters by drawing lines that connect the points from each stroke of each symbol. :param raw_data_directory: The directory, that contains the raw capitan dataset :param destin...
[ "Creates", "a", "visual", "representation", "of", "the", "Capitan", "strokes", "by", "parsing", "all", "text", "-", "files", "and", "the", "symbols", "as", "specified", "by", "the", "parameters", "by", "drawing", "lines", "that", "connect", "the", "points", ...
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/CapitanImageGenerator.py#L13-L29
train
apacha/OMR-Datasets
omrdatasettools/image_generators/CapitanImageGenerator.py
CapitanImageGenerator.draw_capitan_stroke_images
def draw_capitan_stroke_images(self, symbols: List[CapitanSymbol], destination_directory: str, stroke_thicknesses: List[int]) -> None: """ Creates a visual representation of the Capitan strokes by drawing lines that connect the points...
python
def draw_capitan_stroke_images(self, symbols: List[CapitanSymbol], destination_directory: str, stroke_thicknesses: List[int]) -> None: """ Creates a visual representation of the Capitan strokes by drawing lines that connect the points...
[ "def", "draw_capitan_stroke_images", "(", "self", ",", "symbols", ":", "List", "[", "CapitanSymbol", "]", ",", "destination_directory", ":", "str", ",", "stroke_thicknesses", ":", "List", "[", "int", "]", ")", "->", "None", ":", "total_number_of_symbols", "=", ...
Creates a visual representation of the Capitan strokes by drawing lines that connect the points from each stroke of each symbol. :param symbols: The list of parsed Capitan-symbols :param destination_directory: The directory, in which the symbols should be generated into. One sub-folder per ...
[ "Creates", "a", "visual", "representation", "of", "the", "Capitan", "strokes", "by", "drawing", "lines", "that", "connect", "the", "points", "from", "each", "stroke", "of", "each", "symbol", "." ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/CapitanImageGenerator.py#L44-L82
train
apacha/OMR-Datasets
omrdatasettools/image_generators/Rectangle.py
Rectangle.overlap
def overlap(r1: 'Rectangle', r2: 'Rectangle'): """ Overlapping rectangles overlap both horizontally & vertically """ h_overlaps = (r1.left <= r2.right) and (r1.right >= r2.left) v_overlaps = (r1.bottom >= r2.top) and (r1.top <= r2.bottom) return h_overlaps and v_overlaps
python
def overlap(r1: 'Rectangle', r2: 'Rectangle'): """ Overlapping rectangles overlap both horizontally & vertically """ h_overlaps = (r1.left <= r2.right) and (r1.right >= r2.left) v_overlaps = (r1.bottom >= r2.top) and (r1.top <= r2.bottom) return h_overlaps and v_overlaps
[ "def", "overlap", "(", "r1", ":", "'Rectangle'", ",", "r2", ":", "'Rectangle'", ")", ":", "h_overlaps", "=", "(", "r1", ".", "left", "<=", "r2", ".", "right", ")", "and", "(", "r1", ".", "right", ">=", "r2", ".", "left", ")", "v_overlaps", "=", "...
Overlapping rectangles overlap both horizontally & vertically
[ "Overlapping", "rectangles", "overlap", "both", "horizontally", "&", "vertically" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/Rectangle.py#L18-L24
train
apacha/OMR-Datasets
omrdatasettools/image_generators/AudiverisOmrImageGenerator.py
AudiverisOmrImageGenerator.extract_symbols
def extract_symbols(self, raw_data_directory: str, destination_directory: str): """ Extracts the symbols from the raw XML documents and matching images of the Audiveris OMR dataset into individual symbols :param raw_data_directory: The directory, that contains the xml-files and matching...
python
def extract_symbols(self, raw_data_directory: str, destination_directory: str): """ Extracts the symbols from the raw XML documents and matching images of the Audiveris OMR dataset into individual symbols :param raw_data_directory: The directory, that contains the xml-files and matching...
[ "def", "extract_symbols", "(", "self", ",", "raw_data_directory", ":", "str", ",", "destination_directory", ":", "str", ")", ":", "print", "(", "\"Extracting Symbols from Audiveris OMR Dataset...\"", ")", "all_xml_files", "=", "[", "y", "for", "x", "in", "os", "."...
Extracts the symbols from the raw XML documents and matching images of the Audiveris OMR dataset into individual symbols :param raw_data_directory: The directory, that contains the xml-files and matching images :param destination_directory: The directory, in which the symbols should be generate...
[ "Extracts", "the", "symbols", "from", "the", "raw", "XML", "documents", "and", "matching", "images", "of", "the", "Audiveris", "OMR", "dataset", "into", "individual", "symbols" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/AudiverisOmrImageGenerator.py#L16-L35
train
apacha/OMR-Datasets
omrdatasettools/image_generators/HomusSymbol.py
HomusSymbol.initialize_from_string
def initialize_from_string(content: str) -> 'HomusSymbol': """ Create and initializes a new symbol from a string :param content: The content of a symbol as read from the text-file :return: The initialized symbol :rtype: HomusSymbol """ if content is None or cont...
python
def initialize_from_string(content: str) -> 'HomusSymbol': """ Create and initializes a new symbol from a string :param content: The content of a symbol as read from the text-file :return: The initialized symbol :rtype: HomusSymbol """ if content is None or cont...
[ "def", "initialize_from_string", "(", "content", ":", "str", ")", "->", "'HomusSymbol'", ":", "if", "content", "is", "None", "or", "content", "is", "\"\"", ":", "return", "None", "lines", "=", "content", ".", "splitlines", "(", ")", "min_x", "=", "sys", ...
Create and initializes a new symbol from a string :param content: The content of a symbol as read from the text-file :return: The initialized symbol :rtype: HomusSymbol
[ "Create", "and", "initializes", "a", "new", "symbol", "from", "a", "string" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/HomusSymbol.py#L21-L62
train
apacha/OMR-Datasets
omrdatasettools/image_generators/HomusSymbol.py
HomusSymbol.draw_into_bitmap
def draw_into_bitmap(self, export_path: ExportPath, stroke_thickness: int, margin: int = 0) -> None: """ Draws the symbol in the original size that it has plus an optional margin :param export_path: The path, where the symbols should be created on disk :param stroke_thickness: Pen-thick...
python
def draw_into_bitmap(self, export_path: ExportPath, stroke_thickness: int, margin: int = 0) -> None: """ Draws the symbol in the original size that it has plus an optional margin :param export_path: The path, where the symbols should be created on disk :param stroke_thickness: Pen-thick...
[ "def", "draw_into_bitmap", "(", "self", ",", "export_path", ":", "ExportPath", ",", "stroke_thickness", ":", "int", ",", "margin", ":", "int", "=", "0", ")", "->", "None", ":", "self", ".", "draw_onto_canvas", "(", "export_path", ",", "stroke_thickness", ","...
Draws the symbol in the original size that it has plus an optional margin :param export_path: The path, where the symbols should be created on disk :param stroke_thickness: Pen-thickness for drawing the symbol in pixels :param margin: An optional margin for each symbol
[ "Draws", "the", "symbol", "in", "the", "original", "size", "that", "it", "has", "plus", "an", "optional", "margin" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/HomusSymbol.py#L64-L76
train
apacha/OMR-Datasets
omrdatasettools/image_generators/HomusSymbol.py
HomusSymbol.draw_onto_canvas
def draw_onto_canvas(self, export_path: ExportPath, stroke_thickness: int, margin: int, destination_width: int, destination_height: int, staff_line_spacing: int = 14, staff_line_vertical_offsets: List[int] = None, bounding_boxes: dict = None, ra...
python
def draw_onto_canvas(self, export_path: ExportPath, stroke_thickness: int, margin: int, destination_width: int, destination_height: int, staff_line_spacing: int = 14, staff_line_vertical_offsets: List[int] = None, bounding_boxes: dict = None, ra...
[ "def", "draw_onto_canvas", "(", "self", ",", "export_path", ":", "ExportPath", ",", "stroke_thickness", ":", "int", ",", "margin", ":", "int", ",", "destination_width", ":", "int", ",", "destination_height", ":", "int", ",", "staff_line_spacing", ":", "int", "...
Draws the symbol onto a canvas with a fixed size :param bounding_boxes: The dictionary into which the bounding-boxes will be added of each generated image :param export_path: The path, where the symbols should be created on disk :param stroke_thickness: :param margin: :param des...
[ "Draws", "the", "symbol", "onto", "a", "canvas", "with", "a", "fixed", "size" ]
d0a22a03ae35caeef211729efa340e1ec0e01ea5
https://github.com/apacha/OMR-Datasets/blob/d0a22a03ae35caeef211729efa340e1ec0e01ea5/omrdatasettools/image_generators/HomusSymbol.py#L78-L148
train
datascopeanalytics/scrubadub
scrubadub/import_magic.py
update_locals
def update_locals(locals_instance, instance_iterator, *args, **kwargs): """import all of the detector classes into the local namespace to make it easy to do things like `import scrubadub.detectors.NameDetector` without having to add each new ``Detector`` or ``Filth`` """ # http://stackoverflow.com/a...
python
def update_locals(locals_instance, instance_iterator, *args, **kwargs): """import all of the detector classes into the local namespace to make it easy to do things like `import scrubadub.detectors.NameDetector` without having to add each new ``Detector`` or ``Filth`` """ # http://stackoverflow.com/a...
[ "def", "update_locals", "(", "locals_instance", ",", "instance_iterator", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# http://stackoverflow.com/a/4526709/564709", "# http://stackoverflow.com/a/511059/564709", "for", "instance", "in", "instance_iterator", "(", "...
import all of the detector classes into the local namespace to make it easy to do things like `import scrubadub.detectors.NameDetector` without having to add each new ``Detector`` or ``Filth``
[ "import", "all", "of", "the", "detector", "classes", "into", "the", "local", "namespace", "to", "make", "it", "easy", "to", "do", "things", "like", "import", "scrubadub", ".", "detectors", ".", "NameDetector", "without", "having", "to", "add", "each", "new",...
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/import_magic.py#L34-L42
train
datascopeanalytics/scrubadub
scrubadub/filth/__init__.py
iter_filth_clss
def iter_filth_clss(): """Iterate over all of the filths that are included in this sub-package. This is a convenience method for capturing all new Filth that are added over time. """ return iter_subclasses( os.path.dirname(os.path.abspath(__file__)), Filth, _is_abstract_filth...
python
def iter_filth_clss(): """Iterate over all of the filths that are included in this sub-package. This is a convenience method for capturing all new Filth that are added over time. """ return iter_subclasses( os.path.dirname(os.path.abspath(__file__)), Filth, _is_abstract_filth...
[ "def", "iter_filth_clss", "(", ")", ":", "return", "iter_subclasses", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", ",", "Filth", ",", "_is_abstract_filth", ",", ")" ]
Iterate over all of the filths that are included in this sub-package. This is a convenience method for capturing all new Filth that are added over time.
[ "Iterate", "over", "all", "of", "the", "filths", "that", "are", "included", "in", "this", "sub", "-", "package", ".", "This", "is", "a", "convenience", "method", "for", "capturing", "all", "new", "Filth", "that", "are", "added", "over", "time", "." ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/filth/__init__.py#L13-L22
train
datascopeanalytics/scrubadub
scrubadub/filth/__init__.py
iter_filths
def iter_filths(): """Iterate over all instances of filth""" for filth_cls in iter_filth_clss(): if issubclass(filth_cls, RegexFilth): m = next(re.finditer(r"\s+", "fake pattern string")) yield filth_cls(m) else: yield filth_cls()
python
def iter_filths(): """Iterate over all instances of filth""" for filth_cls in iter_filth_clss(): if issubclass(filth_cls, RegexFilth): m = next(re.finditer(r"\s+", "fake pattern string")) yield filth_cls(m) else: yield filth_cls()
[ "def", "iter_filths", "(", ")", ":", "for", "filth_cls", "in", "iter_filth_clss", "(", ")", ":", "if", "issubclass", "(", "filth_cls", ",", "RegexFilth", ")", ":", "m", "=", "next", "(", "re", ".", "finditer", "(", "r\"\\s+\"", ",", "\"fake pattern string\...
Iterate over all instances of filth
[ "Iterate", "over", "all", "instances", "of", "filth" ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/filth/__init__.py#L25-L32
train
datascopeanalytics/scrubadub
scrubadub/filth/base.py
MergedFilth._update_content
def _update_content(self, other_filth): """this updates the bounds, text and placeholder for the merged filth """ if self.end < other_filth.beg or other_filth.end < self.beg: raise exceptions.FilthMergeError( "a_filth goes from [%s, %s) and b_filth goes from [...
python
def _update_content(self, other_filth): """this updates the bounds, text and placeholder for the merged filth """ if self.end < other_filth.beg or other_filth.end < self.beg: raise exceptions.FilthMergeError( "a_filth goes from [%s, %s) and b_filth goes from [...
[ "def", "_update_content", "(", "self", ",", "other_filth", ")", ":", "if", "self", ".", "end", "<", "other_filth", ".", "beg", "or", "other_filth", ".", "end", "<", "self", ".", "beg", ":", "raise", "exceptions", ".", "FilthMergeError", "(", "\"a_filth goe...
this updates the bounds, text and placeholder for the merged filth
[ "this", "updates", "the", "bounds", "text", "and", "placeholder", "for", "the", "merged", "filth" ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/filth/base.py#L65-L94
train
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.add_detector
def add_detector(self, detector_cls): """Add a ``Detector`` to scrubadub""" if not issubclass(detector_cls, detectors.base.Detector): raise TypeError(( '"%(detector_cls)s" is not a subclass of Detector' ) % locals()) # TODO: should add tests to make sure f...
python
def add_detector(self, detector_cls): """Add a ``Detector`` to scrubadub""" if not issubclass(detector_cls, detectors.base.Detector): raise TypeError(( '"%(detector_cls)s" is not a subclass of Detector' ) % locals()) # TODO: should add tests to make sure f...
[ "def", "add_detector", "(", "self", ",", "detector_cls", ")", ":", "if", "not", "issubclass", "(", "detector_cls", ",", "detectors", ".", "base", ".", "Detector", ")", ":", "raise", "TypeError", "(", "(", "'\"%(detector_cls)s\" is not a subclass of Detector'", ")"...
Add a ``Detector`` to scrubadub
[ "Add", "a", "Detector", "to", "scrubadub" ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L24-L38
train
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.clean
def clean(self, text, **kwargs): """This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned. """ if sy...
python
def clean(self, text, **kwargs): """This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned. """ if sy...
[ "def", "clean", "(", "self", ",", "text", ",", "*", "*", "kwargs", ")", ":", "if", "sys", ".", "version_info", "<", "(", "3", ",", "0", ")", ":", "# Only in Python 2. In 3 every string is a Python 2 unicode", "if", "not", "isinstance", "(", "text", ",", "u...
This is the master method that cleans all of the filth out of the dirty dirty ``text``. All keyword arguments to this function are passed through to the ``Filth.replace_with`` method to fine-tune how the ``Filth`` is cleaned.
[ "This", "is", "the", "master", "method", "that", "cleans", "all", "of", "the", "filth", "out", "of", "the", "dirty", "dirty", "text", ".", "All", "keyword", "arguments", "to", "this", "function", "are", "passed", "through", "to", "the", "Filth", ".", "re...
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L44-L62
train
datascopeanalytics/scrubadub
scrubadub/scrubbers.py
Scrubber.iter_filth
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/5647...
python
def iter_filth(self, text): """Iterate over the different types of filth that can exist. """ # currently doing this by aggregating all_filths and then sorting # inline instead of with a Filth.__cmp__ method, which is apparently # much slower http://stackoverflow.com/a/988728/5647...
[ "def", "iter_filth", "(", "self", ",", "text", ")", ":", "# currently doing this by aggregating all_filths and then sorting", "# inline instead of with a Filth.__cmp__ method, which is apparently", "# much slower http://stackoverflow.com/a/988728/564709", "#", "# NOTE: we could probably do t...
Iterate over the different types of filth that can exist.
[ "Iterate", "over", "the", "different", "types", "of", "filth", "that", "can", "exist", "." ]
914bda49a16130b44af43df6a2f84755477c407c
https://github.com/datascopeanalytics/scrubadub/blob/914bda49a16130b44af43df6a2f84755477c407c/scrubadub/scrubbers.py#L64-L96
train
terrycain/aioboto3
aioboto3/s3/inject.py
download_file
async def download_file(self, Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None): """Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transf...
python
async def download_file(self, Bucket, Key, Filename, ExtraArgs=None, Callback=None, Config=None): """Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transf...
[ "async", "def", "download_file", "(", "self", ",", "Bucket", ",", "Key", ",", "Filename", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "with", "open", "(", "Filename", ",", "'wb'", ")", "as", "ope...
Download an S3 object to a file. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt') Similar behavior as S3Transfer's download_file() method, except that parameters are capitalized.
[ "Download", "an", "S3", "object", "to", "a", "file", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L17-L30
train
terrycain/aioboto3
aioboto3/s3/inject.py
download_fileobj
async def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None): """Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. ...
python
async def download_fileobj(self, Bucket, Key, Fileobj, ExtraArgs=None, Callback=None, Config=None): """Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. ...
[ "async", "def", "download_fileobj", "(", "self", ",", "Bucket", ",", "Key", ",", "Fileobj", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "try", ":", "resp", "=", "await", "self", ".", "get_object", ...
Download an object from S3 to a file-like object. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart download in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'wb') as dat...
[ "Download", "an", "object", "from", "S3", "to", "a", "file", "-", "like", "object", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L33-L95
train
terrycain/aioboto3
aioboto3/s3/inject.py
upload_fileobj
async def upload_fileobj(self, Fileobj: BinaryIO, Bucket: str, Key: str, ExtraArgs: Optional[Dict[str, Any]] = None, Callback: Optional[Callable[[int], None]] = None, Config: Optional[S3TransferConfig] = None): """Upload a file-like object to S3. The file-like ...
python
async def upload_fileobj(self, Fileobj: BinaryIO, Bucket: str, Key: str, ExtraArgs: Optional[Dict[str, Any]] = None, Callback: Optional[Callable[[int], None]] = None, Config: Optional[S3TransferConfig] = None): """Upload a file-like object to S3. The file-like ...
[ "async", "def", "upload_fileobj", "(", "self", ",", "Fileobj", ":", "BinaryIO", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "ExtraArgs", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ",", "Callback", ":", ...
Upload a file-like object to S3. The file-like object must be in binary mode. This is a managed transfer which will perform a multipart upload in multiple threads if necessary. Usage:: import boto3 s3 = boto3.client('s3') with open('filename', 'rb') as data: s3.u...
[ "Upload", "a", "file", "-", "like", "object", "to", "S3", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L98-L203
train
terrycain/aioboto3
aioboto3/s3/inject.py
upload_file
async def upload_file(self, Filename, Bucket, Key, ExtraArgs=None, Callback=None, Config=None): """Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's u...
python
async def upload_file(self, Filename, Bucket, Key, ExtraArgs=None, Callback=None, Config=None): """Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's u...
[ "async", "def", "upload_file", "(", "self", ",", "Filename", ",", "Bucket", ",", "Key", ",", "ExtraArgs", "=", "None", ",", "Callback", "=", "None", ",", "Config", "=", "None", ")", ":", "with", "open", "(", "Filename", ",", "'rb'", ")", "as", "open_...
Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's upload_file() method, except that parameters are capitalized.
[ "Upload", "a", "file", "to", "an", "S3", "object", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/inject.py#L206-L219
train
terrycain/aioboto3
aioboto3/resources.py
AIOBoto3ResourceFactory._create_action
def _create_action(factory_self, action_model, resource_name, service_context, is_load=False): """ Creates a new method which makes a request to the underlying AWS service. """ # Create the action in in this closure but before the ``do_action`` # me...
python
def _create_action(factory_self, action_model, resource_name, service_context, is_load=False): """ Creates a new method which makes a request to the underlying AWS service. """ # Create the action in in this closure but before the ``do_action`` # me...
[ "def", "_create_action", "(", "factory_self", ",", "action_model", ",", "resource_name", ",", "service_context", ",", "is_load", "=", "False", ")", ":", "# Create the action in in this closure but before the ``do_action``", "# method below is invoked, which allows instances of the ...
Creates a new method which makes a request to the underlying AWS service.
[ "Creates", "a", "new", "method", "which", "makes", "a", "request", "to", "the", "underlying", "AWS", "service", "." ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/resources.py#L183-L240
train
terrycain/aioboto3
aioboto3/s3/cse.py
AsymmetricCryptoContext.from_der_private_key
def from_der_private_key(data: bytes, password: Optional[str] = None) -> _RSAPrivateKey: """ Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with """ return serialization.lo...
python
def from_der_private_key(data: bytes, password: Optional[str] = None) -> _RSAPrivateKey: """ Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with """ return serialization.lo...
[ "def", "from_der_private_key", "(", "data", ":", "bytes", ",", "password", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "_RSAPrivateKey", ":", "return", "serialization", ".", "load_der_private_key", "(", "data", ",", "password", ",", "default_back...
Convert private key in DER encoding to a Private key object :param data: private key bytes :param password: password the private key is encrypted with
[ "Convert", "private", "key", "in", "DER", "encoding", "to", "a", "Private", "key", "object" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L149-L156
train
terrycain/aioboto3
aioboto3/s3/cse.py
S3CSE.get_object
async def get_object(self, Bucket: str, Key: str, **kwargs) -> dict: """ S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object """ ...
python
async def get_object(self, Bucket: str, Key: str, **kwargs) -> dict: """ S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object """ ...
[ "async", "def", "get_object", "(", "self", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "*", "*", "kwargs", ")", "->", "dict", ":", "if", "self", ".", "_s3_client", "is", "None", ":", "await", "self", ".", "setup", "(", ")", "# Ok so if ...
S3 GetObject. Takes same args as Boto3 documentation Decrypts any CSE :param Bucket: S3 Bucket :param Key: S3 Key (filepath) :return: returns same response as a normal S3 get_object
[ "S3", "GetObject", ".", "Takes", "same", "args", "as", "Boto3", "documentation" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L330-L389
train
terrycain/aioboto3
aioboto3/s3/cse.py
S3CSE.put_object
async def put_object(self, Body: Union[bytes, IO], Bucket: str, Key: str, Metadata: Dict = None, **kwargs): """ PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath) """ ...
python
async def put_object(self, Body: Union[bytes, IO], Bucket: str, Key: str, Metadata: Dict = None, **kwargs): """ PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath) """ ...
[ "async", "def", "put_object", "(", "self", ",", "Body", ":", "Union", "[", "bytes", ",", "IO", "]", ",", "Bucket", ":", "str", ",", "Key", ":", "str", ",", "Metadata", ":", "Dict", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "self", "...
PutObject. Takes same args as Boto3 documentation Encrypts files :param: Body: File data :param Bucket: S3 Bucket :param Key: S3 Key (filepath)
[ "PutObject", ".", "Takes", "same", "args", "as", "Boto3", "documentation" ]
0fd192175461f7bb192f3ed9a872591caf8474ac
https://github.com/terrycain/aioboto3/blob/0fd192175461f7bb192f3ed9a872591caf8474ac/aioboto3/s3/cse.py#L482-L549
train
astrofrog/fast-histogram
fast_histogram/histogram.py
histogram1d
def histogram1d(x, bins, range, weights=None): """ Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tupl...
python
def histogram1d(x, bins, range, weights=None): """ Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tupl...
[ "def", "histogram1d", "(", "x", ",", "bins", ",", "range", ",", "weights", "=", "None", ")", ":", "nx", "=", "bins", "if", "not", "np", ".", "isscalar", "(", "bins", ")", ":", "raise", "TypeError", "(", "'bins should be an integer'", ")", "xmin", ",", ...
Compute a 1D histogram assuming equally spaced bins. Parameters ---------- x : `~numpy.ndarray` The position of the points to bin in the 1D histogram bins : int The number of bins range : iterable The range as a tuple of (xmin, xmax) weights : `~numpy.ndarray` Th...
[ "Compute", "a", "1D", "histogram", "assuming", "equally", "spaced", "bins", "." ]
ace4f2444fba2e21fa3cd9dad966f6b65b60660f
https://github.com/astrofrog/fast-histogram/blob/ace4f2444fba2e21fa3cd9dad966f6b65b60660f/fast_histogram/histogram.py#L15-L58
train
astrofrog/fast-histogram
fast_histogram/histogram.py
histogram2d
def histogram2d(x, y, bins, range, weights=None): """ Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as...
python
def histogram2d(x, y, bins, range, weights=None): """ Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as...
[ "def", "histogram2d", "(", "x", ",", "y", ",", "bins", ",", "range", ",", "weights", "=", "None", ")", ":", "if", "isinstance", "(", "bins", ",", "numbers", ".", "Integral", ")", ":", "nx", "=", "ny", "=", "bins", "else", ":", "nx", ",", "ny", ...
Compute a 2D histogram assuming equally spaced bins. Parameters ---------- x, y : `~numpy.ndarray` The position of the points to bin in the 2D histogram bins : int or iterable The number of bins in each dimension. If given as an integer, the same number of bins is used for each ...
[ "Compute", "a", "2D", "histogram", "assuming", "equally", "spaced", "bins", "." ]
ace4f2444fba2e21fa3cd9dad966f6b65b60660f
https://github.com/astrofrog/fast-histogram/blob/ace4f2444fba2e21fa3cd9dad966f6b65b60660f/fast_histogram/histogram.py#L61-L121
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.to_networkx
def to_networkx(self): """ Return this network in NetworkX graph object. :return: Network as NetworkX graph object """ return nx_util.to_networkx(self.session.get(self.__url).json())
python
def to_networkx(self): """ Return this network in NetworkX graph object. :return: Network as NetworkX graph object """ return nx_util.to_networkx(self.session.get(self.__url).json())
[ "def", "to_networkx", "(", "self", ")", ":", "return", "nx_util", ".", "to_networkx", "(", "self", ".", "session", ".", "get", "(", "self", ".", "__url", ")", ".", "json", "(", ")", ")" ]
Return this network in NetworkX graph object. :return: Network as NetworkX graph object
[ "Return", "this", "network", "in", "NetworkX", "graph", "object", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L46-L52
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.to_dataframe
def to_dataframe(self, extra_edges_columns=[]): """ Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF. """ return df_util.to_dataframe( self.session.get(self.__url).json(), edges_attr_cols=extra_edges_colum...
python
def to_dataframe(self, extra_edges_columns=[]): """ Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF. """ return df_util.to_dataframe( self.session.get(self.__url).json(), edges_attr_cols=extra_edges_colum...
[ "def", "to_dataframe", "(", "self", ",", "extra_edges_columns", "=", "[", "]", ")", ":", "return", "df_util", ".", "to_dataframe", "(", "self", ".", "session", ".", "get", "(", "self", ".", "__url", ")", ".", "json", "(", ")", ",", "edges_attr_cols", "...
Return this network in pandas DataFrame. :return: Network as DataFrame. This is equivalent to SIF.
[ "Return", "this", "network", "in", "pandas", "DataFrame", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L54-L63
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_node
def add_node(self, node_name, dataframe=False): """ Add a single node to the network. """ if node_name is None: return None return self.add_nodes([node_name], dataframe=dataframe)
python
def add_node(self, node_name, dataframe=False): """ Add a single node to the network. """ if node_name is None: return None return self.add_nodes([node_name], dataframe=dataframe)
[ "def", "add_node", "(", "self", ",", "node_name", ",", "dataframe", "=", "False", ")", ":", "if", "node_name", "is", "None", ":", "return", "None", "return", "self", ".", "add_nodes", "(", "[", "node_name", "]", ",", "dataframe", "=", "dataframe", ")" ]
Add a single node to the network.
[ "Add", "a", "single", "node", "to", "the", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L82-L86
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_nodes
def add_nodes(self, node_name_list, dataframe=False): """ Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-cre...
python
def add_nodes(self, node_name_list, dataframe=False): """ Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-cre...
[ "def", "add_nodes", "(", "self", ",", "node_name_list", ",", "dataframe", "=", "False", ")", ":", "res", "=", "self", ".", "session", ".", "post", "(", "self", ".", "__url", "+", "'nodes'", ",", "data", "=", "json", ".", "dumps", "(", "node_name_list",...
Add new nodes to the network :param node_name_list: list of node names, e.g. ['a', 'b', 'c'] :param dataframe: If True, return a pandas dataframe instead of a dict. :return: A dict mapping names to SUIDs for the newly-created nodes.
[ "Add", "new", "nodes", "to", "the", "network" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L88-L102
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.add_edge
def add_edge(self, source, target, interaction='-', directed=True, dataframe=True): """ Add a single edge from source to target. """ new_edge = { 'source': source, 'target': target, 'interaction': interaction, 'directed': directed } return ...
python
def add_edge(self, source, target, interaction='-', directed=True, dataframe=True): """ Add a single edge from source to target. """ new_edge = { 'source': source, 'target': target, 'interaction': interaction, 'directed': directed } return ...
[ "def", "add_edge", "(", "self", ",", "source", ",", "target", ",", "interaction", "=", "'-'", ",", "directed", "=", "True", ",", "dataframe", "=", "True", ")", ":", "new_edge", "=", "{", "'source'", ":", "source", ",", "'target'", ":", "target", ",", ...
Add a single edge from source to target.
[ "Add", "a", "single", "edge", "from", "source", "to", "target", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L104-L112
train
cytoscape/py2cytoscape
py2cytoscape/data/cynetwork.py
CyNetwork.get_views
def get_views(self): """ Get views as a list of SUIDs :return: """ url = self.__url + 'views' return self.session.get(url).json()
python
def get_views(self): """ Get views as a list of SUIDs :return: """ url = self.__url + 'views' return self.session.get(url).json()
[ "def", "get_views", "(", "self", ")", ":", "url", "=", "self", ".", "__url", "+", "'views'", "return", "self", ".", "session", ".", "get", "(", "url", ")", ".", "json", "(", ")" ]
Get views as a list of SUIDs :return:
[ "Get", "views", "as", "a", "list", "of", "SUIDs" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/cynetwork.py#L304-L311
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/diffusion.py
diffusion.diffuse_advanced
def diffuse_advanced(self, heatColumnName=None, time=None, verbose=False): """ Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Col...
python
def diffuse_advanced(self, heatColumnName=None, time=None, verbose=False): """ Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Col...
[ "def", "diffuse_advanced", "(", "self", ",", "heatColumnName", "=", "None", ",", "time", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"heatColumnName\"", ",", "\"time\"", "]", ",", "[", "heatColumnName", ",",...
Diffusion will send the selected network view and its selected nodes to a web-based REST service to calculate network propagation. Results are returned and represented by columns in the node table. Columns are created for each execution of Diffusion and their names are returned in the re...
[ "Diffusion", "will", "send", "the", "selected", "network", "view", "and", "its", "selected", "nodes", "to", "a", "web", "-", "based", "REST", "service", "to", "calculate", "network", "propagation", ".", "Results", "are", "returned", "and", "represented", "by",...
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/diffusion.py#L30-L48
train
cytoscape/py2cytoscape
py2cytoscape/util/util_networkx.py
to_networkx
def to_networkx(cyjs, directed=True): """ Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph. """ if directed: g = nx.MultiDiGraph() else: g = nx.MultiGraph() network_data = cyjs[DATA] if network_data is no...
python
def to_networkx(cyjs, directed=True): """ Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph. """ if directed: g = nx.MultiDiGraph() else: g = nx.MultiGraph() network_data = cyjs[DATA] if network_data is no...
[ "def", "to_networkx", "(", "cyjs", ",", "directed", "=", "True", ")", ":", "if", "directed", ":", "g", "=", "nx", ".", "MultiDiGraph", "(", ")", "else", ":", "g", "=", "nx", ".", "MultiGraph", "(", ")", "network_data", "=", "cyjs", "[", "DATA", "]"...
Convert Cytoscape.js-style JSON object into NetworkX object. By default, data will be handles as a directed graph.
[ "Convert", "Cytoscape", ".", "js", "-", "style", "JSON", "object", "into", "NetworkX", "object", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_networkx.py#L120-L151
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.dialog
def dialog(self=None, wid=None, text=None, title=None, url=None, debug=False, verbose=False): """ Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools....
python
def dialog(self=None, wid=None, text=None, title=None, url=None, debug=False, verbose=False): """ Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools....
[ "def", "dialog", "(", "self", "=", "None", ",", "wid", "=", "None", ",", "text", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ",", "debug", "=", "False", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(",...
Launch and HTML browser in a separate window. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param debug: Show debug tools. boolean :param verbose: print more
[ "Launch", "and", "HTML", "browser", "in", "a", "separate", "window", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L13-L27
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.hide
def hide(self, wid, verbose=False): """ Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more """ PARAMS={"id":wid} response=api(url=self.__url+"/hide?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
python
def hide(self, wid, verbose=False): """ Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more """ PARAMS={"id":wid} response=api(url=self.__url+"/hide?",PARAMS=PARAMS, method="GET", verbose=verbose) return response
[ "def", "hide", "(", "self", ",", "wid", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"id\"", ":", "wid", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/hide?\"", ",", "PARAMS", "=", "PARAMS", ",", "m...
Hide and HTML browser in the Results Panel. :param wid: Window ID :param verbose: print more
[ "Hide", "and", "HTML", "browser", "in", "the", "Results", "Panel", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L29-L40
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/cybrowser.py
cybrowser.show
def show(self, wid=None, text=None, title=None, url=None, verbose=False): """ Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more """ PARA...
python
def show(self, wid=None, text=None, title=None, url=None, verbose=False): """ Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more """ PARA...
[ "def", "show", "(", "self", ",", "wid", "=", "None", ",", "text", "=", "None", ",", "title", "=", "None", ",", "url", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "}", "for", "p", ",", "v", "in", "zip", "(", "[", ...
Launch an HTML browser in the Results Panel. :param wid: Window ID :param text: HTML text :param title: Window Title :param url: URL :param verbose: print more
[ "Launch", "an", "HTML", "browser", "in", "the", "Results", "Panel", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/cybrowser.py#L42-L59
train
cytoscape/py2cytoscape
py2cytoscape/data/util_http.py
check_response
def check_response(res): """ Check HTTP response and raise exception if response is not OK. """ try: res.raise_for_status() # Alternative is res.ok except Exception as exc: # Bad response code, e.g. if adding an edge with nodes that doesn't exist try: err_info = res.json(...
python
def check_response(res): """ Check HTTP response and raise exception if response is not OK. """ try: res.raise_for_status() # Alternative is res.ok except Exception as exc: # Bad response code, e.g. if adding an edge with nodes that doesn't exist try: err_info = res.json(...
[ "def", "check_response", "(", "res", ")", ":", "try", ":", "res", ".", "raise_for_status", "(", ")", "# Alternative is res.ok", "except", "Exception", "as", "exc", ":", "# Bad response code, e.g. if adding an edge with nodes that doesn't exist", "try", ":", "err_info", ...
Check HTTP response and raise exception if response is not OK.
[ "Check", "HTTP", "response", "and", "raise", "exception", "if", "response", "is", "not", "OK", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/data/util_http.py#L3-L18
train
cytoscape/py2cytoscape
py2cytoscape/util/util_dataframe.py
from_dataframe
def from_dataframe(df, source_col='source', target_col='target', interaction_col='interaction', name='From DataFrame', edge_attr_cols=[]): """ Utility to convert Pandas DataFrame object into Cytoscape.js JSON :pa...
python
def from_dataframe(df, source_col='source', target_col='target', interaction_col='interaction', name='From DataFrame', edge_attr_cols=[]): """ Utility to convert Pandas DataFrame object into Cytoscape.js JSON :pa...
[ "def", "from_dataframe", "(", "df", ",", "source_col", "=", "'source'", ",", "target_col", "=", "'target'", ",", "interaction_col", "=", "'interaction'", ",", "name", "=", "'From DataFrame'", ",", "edge_attr_cols", "=", "[", "]", ")", ":", "network", "=", "c...
Utility to convert Pandas DataFrame object into Cytoscape.js JSON :param df: Dataframe to convert. :param source_col: Name of source column. :param target_col: Name of target column. :param interaction_col: Name of interaction column. :param name: Name of network. :param edge_attr_cols: List co...
[ "Utility", "to", "convert", "Pandas", "DataFrame", "object", "into", "Cytoscape", ".", "js", "JSON" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_dataframe.py#L6-L49
train
cytoscape/py2cytoscape
py2cytoscape/util/util_dataframe.py
to_dataframe
def to_dataframe(network, interaction='interaction', default_interaction='-', edges_attr_cols=[]): """ Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction col...
python
def to_dataframe(network, interaction='interaction', default_interaction='-', edges_attr_cols=[]): """ Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction col...
[ "def", "to_dataframe", "(", "network", ",", "interaction", "=", "'interaction'", ",", "default_interaction", "=", "'-'", ",", "edges_attr_cols", "=", "[", "]", ")", ":", "edges", "=", "network", "[", "'elements'", "]", "[", "'edges'", "]", "if", "edges_attr_...
Utility to convert a Cytoscape dictionary into a Pandas Dataframe. :param network: Dictionary to convert. :param interaction: Name of interaction column. :param default_interaction: Default value for missing interactions. :param edges_attr_cols: List containing other edges' attributes to include ...
[ "Utility", "to", "convert", "a", "Cytoscape", "dictionary", "into", "a", "Pandas", "Dataframe", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/util/util_dataframe.py#L52-L91
train
cytoscape/py2cytoscape
py2cytoscape/cytoscapejs/viewer.py
render
def render(network, style=DEF_STYLE, layout_algorithm=DEF_LAYOUT, background=DEF_BACKGROUND_COLOR, height=DEF_HEIGHT, width=DEF_WIDTH, style_file=STYLE_FILE, def_nodes=DEF_NODES, def_edges=DEF_EDGES): """Render network data with...
python
def render(network, style=DEF_STYLE, layout_algorithm=DEF_LAYOUT, background=DEF_BACKGROUND_COLOR, height=DEF_HEIGHT, width=DEF_WIDTH, style_file=STYLE_FILE, def_nodes=DEF_NODES, def_edges=DEF_EDGES): """Render network data with...
[ "def", "render", "(", "network", ",", "style", "=", "DEF_STYLE", ",", "layout_algorithm", "=", "DEF_LAYOUT", ",", "background", "=", "DEF_BACKGROUND_COLOR", ",", "height", "=", "DEF_HEIGHT", ",", "width", "=", "DEF_WIDTH", ",", "style_file", "=", "STYLE_FILE", ...
Render network data with embedded Cytoscape.js widget. :param network: dict (required) The network data should be in Cytoscape.js JSON format. :param style: str or dict If str, pick one of the preset style. [default: 'default'] If dict, it should be Cytoscape.js style CSS object :pa...
[ "Render", "network", "data", "with", "embedded", "Cytoscape", ".", "js", "widget", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cytoscapejs/viewer.py#L57-L118
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/edge.py
edge.create_attribute
def create_attribute(self,column=None,listType=None,namespace=None, network=None, atype=None, verbose=False): """ Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or st...
python
def create_attribute(self,column=None,listType=None,namespace=None, network=None, atype=None, verbose=False): """ Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or st...
[ "def", "create_attribute", "(", "self", ",", "column", "=", "None", ",", "listType", "=", "None", ",", "namespace", "=", "None", ",", "network", "=", "None", ",", "atype", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_netw...
Creates a new edge column. :param column (string, optional): Unique name of column :param listType (string, optional): Can be one of integer, long, double, or string. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hid...
[ "Creates", "a", "new", "edge", "column", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/edge.py#L13-L35
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/edge.py
edge.get
def get(self,edge=None,network=None,sourceNode=None, targetNode=None, atype=None, verbose=False): """ Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialo...
python
def get(self,edge=None,network=None,sourceNode=None, targetNode=None, atype=None, verbose=False): """ Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialo...
[ "def", "get", "(", "self", ",", "edge", "=", "None", ",", "network", "=", "None", ",", "sourceNode", "=", "None", ",", "targetNode", "=", "None", ",", "atype", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(",...
Returns the SUID of an edge that matches the passed parameters. If multiple edges are found, only one will be returned, and a warning will be reported in the Cytoscape Task History dialog. :param edge (string, optional): Selects an edge by name, or, if the parameter has the prefix s...
[ "Returns", "the", "SUID", "of", "an", "edge", "that", "matches", "the", "passed", "parameters", ".", "If", "multiple", "edges", "are", "found", "only", "one", "will", "be", "returned", "and", "a", "warning", "will", "be", "reported", "in", "the", "Cytoscap...
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/edge.py#L37-L68
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.add_edge
def add_edge(self, isDirected=None,name=None,network=None,sourceName=None,targetName=None, verbose=False): """ Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isD...
python
def add_edge(self, isDirected=None,name=None,network=None,sourceName=None,targetName=None, verbose=False): """ Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isD...
[ "def", "add_edge", "(", "self", ",", "isDirected", "=", "None", ",", "name", "=", "None", ",", "network", "=", "None", ",", "sourceName", "=", "None", ",", "targetName", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_networ...
Add a new edge between two existing nodes in a network. The names of the nodes must be specified and much match the value in the 'name' column for each node. :param isDirected (string, optional): Whether the edge should be directed or not. Even though all edges in Cytoscape have a s...
[ "Add", "a", "new", "edge", "between", "two", "existing", "nodes", "in", "a", "network", ".", "The", "names", "of", "the", "nodes", "must", "be", "specified", "and", "much", "match", "the", "value", "in", "the", "name", "column", "for", "each", "node", ...
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L45-L73
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.create
def create(self, edgeList=None, excludeEdges=None, networkName=None, nodeList=None, source=None, verbose=False): """ Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Spec...
python
def create(self, edgeList=None, excludeEdges=None, networkName=None, nodeList=None, source=None, verbose=False): """ Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Spec...
[ "def", "create", "(", "self", ",", "edgeList", "=", "None", ",", "excludeEdges", "=", "None", ",", "networkName", "=", "None", ",", "nodeList", "=", "None", ",", "source", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_netw...
Create a new network from a list of nodes and edges in an existing source network. The SUID of the network and view are returned. :param edgeList (string, optional): Specifies a list of edges. The keywords all, selected, or unselected can be used to specify edges by their select...
[ "Create", "a", "new", "network", "from", "a", "list", "of", "nodes", "and", "edges", "in", "an", "existing", "source", "network", ".", "The", "SUID", "of", "the", "network", "and", "view", "are", "returned", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L137-L170
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.create_empty
def create_empty(self, name=None, renderers=None, RootNetworkList=None, verbose=False): """ Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new networ...
python
def create_empty(self, name=None, renderers=None, RootNetworkList=None, verbose=False): """ Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new networ...
[ "def", "create_empty", "(", "self", ",", "name", "=", "None", ",", "renderers", "=", "None", ",", "RootNetworkList", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"name\"", ",", "\"renderers\"", ",", "\"Root...
Create a new, empty network. The new network may be created as part of an existing network collection or a new network collection. :param name (string, optional): Enter the name of the new network. :param renderers (string, optional): Select the renderer to use for the new network v...
[ "Create", "a", "new", "empty", "network", ".", "The", "new", "network", "may", "be", "created", "as", "part", "of", "an", "existing", "network", "collection", "or", "a", "new", "network", "collection", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L201-L218
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.list
def list(self, verbose=False): """ List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ] """ response=api(url=self.__url+"/list", method="POST", verbose=verbose) return response
python
def list(self, verbose=False): """ List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ] """ response=api(url=self.__url+"/list", method="POST", verbose=verbose) return response
[ "def", "list", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/list\"", ",", "method", "=", "\"POST\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
List all of the networks in the current session. :param verbose: print more :returns: [ list of network suids ]
[ "List", "all", "of", "the", "networks", "in", "the", "current", "session", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L532-L542
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.list_attributes
def list_attributes(self, namespace=None, network=None, verbose=False): """ Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also ...
python
def list_attributes(self, namespace=None, network=None, verbose=False): """ Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also ...
[ "def", "list_attributes", "(", "self", ",", "namespace", "=", "None", ",", "network", "=", "None", ",", "verbose", "=", "False", ")", ":", "network", "=", "check_network", "(", "self", ",", "network", ",", "verbose", "=", "verbose", ")", "PARAMS", "=", ...
Returns a list of column names assocated with a network. :param namespace (string, optional): Node, Edge, and Network objects support the default, local, and hidden namespaces. Root networks also support the shared namespace. Custom namespaces may be specified by App...
[ "Returns", "a", "list", "of", "column", "names", "assocated", "with", "a", "network", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L544-L562
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/network.py
network.rename
def rename(self, name=None, sourceNetwork=None, verbose=False): """ Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SU...
python
def rename(self, name=None, sourceNetwork=None, verbose=False): """ Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SU...
[ "def", "rename", "(", "self", ",", "name", "=", "None", ",", "sourceNetwork", "=", "None", ",", "verbose", "=", "False", ")", ":", "sourceNetwork", "=", "check_network", "(", "self", ",", "sourceNetwork", ",", "verbose", "=", "verbose", ")", "PARAMS", "=...
Rename an existing network. The SUID of the network is returned :param name (string): Enter a new title for the network :param sourceNetwork (string): Specifies a network by name, or by SUID if the prefix SUID: is used. The keyword CURRENT, or a blank value can also be used to s...
[ "Rename", "an", "existing", "network", ".", "The", "SUID", "of", "the", "network", "is", "returned" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/network.py#L619-L634
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.new
def new(self, verbose=False): """ Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more """ response=api(url=self.__url+"/new", verbose=verbose) return response
python
def new(self, verbose=False): """ Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more """ response=api(url=self.__url+"/new", verbose=verbose) return response
[ "def", "new", "(", "self", ",", "verbose", "=", "False", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/new\"", ",", "verbose", "=", "verbose", ")", "return", "response" ]
Destroys the current session and creates a new, empty one. :param wid: Window ID :param verbose: print more
[ "Destroys", "the", "current", "session", "and", "creates", "a", "new", "empty", "one", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L14-L23
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.open
def open(self, session_file=None,session_url=None, verbose=False): """ Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more """ ...
python
def open(self, session_file=None,session_url=None, verbose=False): """ Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more """ ...
[ "def", "open", "(", "self", ",", "session_file", "=", "None", ",", "session_url", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"file\"", ",", "\"url\"", "]", ",", "[", "session_file", ",", "session_url", ...
Opens a session from a local file or URL. :param session_file: The path to the session file (.cys) to be loaded. :param session_url: A URL that provides a session file. :param verbose: print more
[ "Opens", "a", "session", "from", "a", "local", "file", "or", "URL", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L26-L37
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/session.py
session.save
def save(self, session_file, verbose=False): """ Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must b...
python
def save(self, session_file, verbose=False): """ Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must b...
[ "def", "save", "(", "self", ",", "session_file", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "{", "\"file\"", ":", "session_file", "}", "response", "=", "api", "(", "url", "=", "self", ".", "__url", "+", "\"/save\"", ",", "PARAMS", "=", "P...
Saves the current session to an existing file, which will be replaced. If this is a new session that has not been saved yet, use 'save as' instead. :param session_file: The path to the file where the current session must be saved to. :param verbose: print more
[ "Saves", "the", "current", "session", "to", "an", "existing", "file", "which", "will", "be", "replaced", ".", "If", "this", "is", "a", "new", "session", "that", "has", "not", "been", "saved", "yet", "use", "save", "as", "instead", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/session.py#L40-L54
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.apply
def apply(self, styles=None, verbose=False): """ Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:u...
python
def apply(self, styles=None, verbose=False): """ Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:u...
[ "def", "apply", "(", "self", ",", "styles", "=", "None", ",", "verbose", "=", "False", ")", ":", "PARAMS", "=", "set_param", "(", "[", "\"styles\"", "]", ",", "[", "styles", "]", ")", "response", "=", "api", "(", "url", "=", "self", ".", "__url", ...
Applies the specified style to the selected views and returns the SUIDs of the affected views. :param styles (string): Name of Style to be applied to the selected views. = ['Directed', 'BioPAX_SIF', 'Bridging Reads Histogram:unique_0', 'PSIMI 25 Style', 'Coverage Histogram:best&...
[ "Applies", "the", "specified", "style", "to", "the", "selected", "views", "and", "returns", "the", "SUIDs", "of", "the", "affected", "views", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L13-L39
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.create_style
def create_style(self,title=None,defaults=None,mappings=None,verbose=VERBOSE): """ Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty ...
python
def create_style(self,title=None,defaults=None,mappings=None,verbose=VERBOSE): """ Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty ...
[ "def", "create_style", "(", "self", ",", "title", "=", "None", ",", "defaults", "=", "None", ",", "mappings", "=", "None", ",", "verbose", "=", "VERBOSE", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")",...
Creates a new visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :param host: cytoscape host address, default=cytoscape_host :param port: cytoscape p...
[ "Creates", "a", "new", "visual", "style" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L86-L129
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.update_style
def update_style(self, title=None,defaults=None,mappings=None, verbose=False): """ Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty ...
python
def update_style(self, title=None,defaults=None,mappings=None, verbose=False): """ Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty ...
[ "def", "update_style", "(", "self", ",", "title", "=", "None", ",", "defaults", "=", "None", ",", "mappings", "=", "None", ",", "verbose", "=", "False", ")", ":", "u", "=", "self", ".", "__url", "host", "=", "u", ".", "split", "(", "\"//\"", ")", ...
Updates a visual style :param title: title of the visual style :param defaults: a list of dictionaries for each visualProperty :param mappings: a list of dictionaries for each visualProperty :returns: nothing
[ "Updates", "a", "visual", "style" ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L131-L194
train
cytoscape/py2cytoscape
py2cytoscape/cyrest/vizmap.py
vizmap.simple_defaults
def simple_defaults(self, defaults_dic): """ Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic """ de...
python
def simple_defaults(self, defaults_dic): """ Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic """ de...
[ "def", "simple_defaults", "(", "self", ",", "defaults_dic", ")", ":", "defaults", "=", "[", "]", "for", "d", "in", "defaults_dic", ".", "keys", "(", ")", ":", "dic", "=", "{", "}", "dic", "[", "\"visualProperty\"", "]", "=", "d", "dic", "[", "\"value...
Simplifies defaults. :param defaults_dic: a dictionary of the form { visualProperty_A:value_A, visualProperty_B:value_B, ..} :returns: a list of dictionaries with each item corresponding to a given key in defaults_dic
[ "Simplifies", "defaults", "." ]
dd34de8d028f512314d0057168df7fef7c5d5195
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/vizmap.py#L278-L293
train