repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
eyurtsev/fcsparser | fcsparser/api.py | FCSParser.data | def data(self):
"""Get parsed DATA segment of the FCS file."""
if self._data is None:
with open(self.path, 'rb') as f:
self.read_data(f)
return self._data | python | def data(self):
"""Get parsed DATA segment of the FCS file."""
if self._data is None:
with open(self.path, 'rb') as f:
self.read_data(f)
return self._data | [
"def",
"data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_data",
"is",
"None",
":",
"with",
"open",
"(",
"self",
".",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"self",
".",
"read_data",
"(",
"f",
")",
"return",
"self",
".",
"_data"
] | Get parsed DATA segment of the FCS file. | [
"Get",
"parsed",
"DATA",
"segment",
"of",
"the",
"FCS",
"file",
"."
] | train | https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L436-L441 |
eyurtsev/fcsparser | fcsparser/api.py | FCSParser.analysis | def analysis(self):
"""Get ANALYSIS segment of the FCS file."""
if self._analysis is None:
with open(self.path, 'rb') as f:
self.read_analysis(f)
return self._analysis | python | def analysis(self):
"""Get ANALYSIS segment of the FCS file."""
if self._analysis is None:
with open(self.path, 'rb') as f:
self.read_analysis(f)
return self._analysis | [
"def",
"analysis",
"(",
"self",
")",
":",
"if",
"self",
".",
"_analysis",
"is",
"None",
":",
"with",
"open",
"(",
"self",
".",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"self",
".",
"read_analysis",
"(",
"f",
")",
"return",
"self",
".",
"_analysis"... | Get ANALYSIS segment of the FCS file. | [
"Get",
"ANALYSIS",
"segment",
"of",
"the",
"FCS",
"file",
"."
] | train | https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L444-L449 |
eyurtsev/fcsparser | fcsparser/api.py | FCSParser.reformat_meta | def reformat_meta(self):
"""Collect the meta data information in a more user friendly format.
Function looks through the meta data, collecting the channel related information into a
dataframe and moving it into the _channels_ key.
"""
meta = self.annotation # For shorthand (pas... | python | def reformat_meta(self):
"""Collect the meta data information in a more user friendly format.
Function looks through the meta data, collecting the channel related information into a
dataframe and moving it into the _channels_ key.
"""
meta = self.annotation # For shorthand (pas... | [
"def",
"reformat_meta",
"(",
"self",
")",
":",
"meta",
"=",
"self",
".",
"annotation",
"# For shorthand (passed by reference)",
"channel_properties",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"meta",
".",
"items",
"(",
")",
":",
"if",
"key",
"[",
":... | Collect the meta data information in a more user friendly format.
Function looks through the meta data, collecting the channel related information into a
dataframe and moving it into the _channels_ key. | [
"Collect",
"the",
"meta",
"data",
"information",
"in",
"a",
"more",
"user",
"friendly",
"format",
"."
] | train | https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L451-L489 |
eyurtsev/fcsparser | fcsparser/api.py | FCSParser.dataframe | def dataframe(self):
"""Construct Pandas dataframe."""
data = self.data
channel_names = self.get_channel_names()
return pd.DataFrame(data, columns=channel_names) | python | def dataframe(self):
"""Construct Pandas dataframe."""
data = self.data
channel_names = self.get_channel_names()
return pd.DataFrame(data, columns=channel_names) | [
"def",
"dataframe",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"data",
"channel_names",
"=",
"self",
".",
"get_channel_names",
"(",
")",
"return",
"pd",
".",
"DataFrame",
"(",
"data",
",",
"columns",
"=",
"channel_names",
")"
] | Construct Pandas dataframe. | [
"Construct",
"Pandas",
"dataframe",
"."
] | train | https://github.com/eyurtsev/fcsparser/blob/710e8e31d4b09ff6e73d47d86770be6ca2f4282c/fcsparser/api.py#L492-L496 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.get_binary_dist | def get_binary_dist(self, requirement):
"""
Get or create a cached binary distribution archive.
:param requirement: A :class:`.Requirement` object.
:returns: An iterable of tuples with two values each: A
:class:`tarfile.TarInfo` object and a file-like object.
... | python | def get_binary_dist(self, requirement):
"""
Get or create a cached binary distribution archive.
:param requirement: A :class:`.Requirement` object.
:returns: An iterable of tuples with two values each: A
:class:`tarfile.TarInfo` object and a file-like object.
... | [
"def",
"get_binary_dist",
"(",
"self",
",",
"requirement",
")",
":",
"cache_file",
"=",
"self",
".",
"cache",
".",
"get",
"(",
"requirement",
")",
"if",
"cache_file",
":",
"if",
"self",
".",
"needs_invalidation",
"(",
"requirement",
",",
"cache_file",
")",
... | Get or create a cached binary distribution archive.
:param requirement: A :class:`.Requirement` object.
:returns: An iterable of tuples with two values each: A
:class:`tarfile.TarInfo` object and a file-like object.
Gets the cached binary distribution that was previously buil... | [
"Get",
"or",
"create",
"a",
"cached",
"binary",
"distribution",
"archive",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L59-L122 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.needs_invalidation | def needs_invalidation(self, requirement, cache_file):
"""
Check whether a cached binary distribution needs to be invalidated.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
:returns: :data:`True` i... | python | def needs_invalidation(self, requirement, cache_file):
"""
Check whether a cached binary distribution needs to be invalidated.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
:returns: :data:`True` i... | [
"def",
"needs_invalidation",
"(",
"self",
",",
"requirement",
",",
"cache_file",
")",
":",
"if",
"self",
".",
"config",
".",
"trust_mod_times",
":",
"return",
"requirement",
".",
"last_modified",
">",
"os",
".",
"path",
".",
"getmtime",
"(",
"cache_file",
")... | Check whether a cached binary distribution needs to be invalidated.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
:returns: :data:`True` if the cached binary distribution needs to be
invalidated,... | [
"Check",
"whether",
"a",
"cached",
"binary",
"distribution",
"needs",
"to",
"be",
"invalidated",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L124-L137 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.recall_checksum | def recall_checksum(self, cache_file):
"""
Get the checksum of the input used to generate a binary distribution archive.
:param cache_file: The pathname of the binary distribution archive (a string).
:returns: The checksum (a string) or :data:`None` (when no checksum is available).
... | python | def recall_checksum(self, cache_file):
"""
Get the checksum of the input used to generate a binary distribution archive.
:param cache_file: The pathname of the binary distribution archive (a string).
:returns: The checksum (a string) or :data:`None` (when no checksum is available).
... | [
"def",
"recall_checksum",
"(",
"self",
",",
"cache_file",
")",
":",
"# EAFP instead of LBYL because of concurrency between pip-accel",
"# processes (https://docs.python.org/2/glossary.html#term-lbyl).",
"checksum_file",
"=",
"'%s.txt'",
"%",
"cache_file",
"try",
":",
"with",
"ope... | Get the checksum of the input used to generate a binary distribution archive.
:param cache_file: The pathname of the binary distribution archive (a string).
:returns: The checksum (a string) or :data:`None` (when no checksum is available). | [
"Get",
"the",
"checksum",
"of",
"the",
"input",
"used",
"to",
"generate",
"a",
"binary",
"distribution",
"archive",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L139-L159 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.persist_checksum | def persist_checksum(self, requirement, cache_file):
"""
Persist the checksum of the input used to generate a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
.. note:: The check... | python | def persist_checksum(self, requirement, cache_file):
"""
Persist the checksum of the input used to generate a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
.. note:: The check... | [
"def",
"persist_checksum",
"(",
"self",
",",
"requirement",
",",
"cache_file",
")",
":",
"if",
"not",
"self",
".",
"config",
".",
"trust_mod_times",
":",
"checksum_file",
"=",
"'%s.txt'",
"%",
"cache_file",
"with",
"AtomicReplace",
"(",
"checksum_file",
")",
"... | Persist the checksum of the input used to generate a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param cache_file: The pathname of a cached binary distribution (a string).
.. note:: The checksum is only calculated and persisted when
:attr:`~.Conf... | [
"Persist",
"the",
"checksum",
"of",
"the",
"input",
"used",
"to",
"generate",
"a",
"binary",
"distribution",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L161-L175 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.build_binary_dist | def build_binary_dist(self, requirement):
"""
Build a binary distribution archive from an unpacked source distribution.
:param requirement: A :class:`.Requirement` object.
:returns: The pathname of a binary distribution archive (a string).
:raises: :exc:`.BinaryDistributionError... | python | def build_binary_dist(self, requirement):
"""
Build a binary distribution archive from an unpacked source distribution.
:param requirement: A :class:`.Requirement` object.
:returns: The pathname of a binary distribution archive (a string).
:raises: :exc:`.BinaryDistributionError... | [
"def",
"build_binary_dist",
"(",
"self",
",",
"requirement",
")",
":",
"try",
":",
"return",
"self",
".",
"build_binary_dist_helper",
"(",
"requirement",
",",
"[",
"'bdist_dumb'",
",",
"'--format=tar'",
"]",
")",
"except",
"(",
"BuildFailed",
",",
"NoBuildOutput... | Build a binary distribution archive from an unpacked source distribution.
:param requirement: A :class:`.Requirement` object.
:returns: The pathname of a binary distribution archive (a string).
:raises: :exc:`.BinaryDistributionError` when the original command
and the fall back ... | [
"Build",
"a",
"binary",
"distribution",
"archive",
"from",
"an",
"unpacked",
"source",
"distribution",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L177-L217 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.build_binary_dist_helper | def build_binary_dist_helper(self, requirement, setup_command):
"""
Convert an unpacked source distribution to a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param setup_command: A list of strings with the arguments to
``setup.p... | python | def build_binary_dist_helper(self, requirement, setup_command):
"""
Convert an unpacked source distribution to a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param setup_command: A list of strings with the arguments to
``setup.p... | [
"def",
"build_binary_dist_helper",
"(",
"self",
",",
"requirement",
",",
"setup_command",
")",
":",
"build_timer",
"=",
"Timer",
"(",
")",
"# Make sure the source distribution contains a setup script.",
"setup_script",
"=",
"os",
".",
"path",
".",
"join",
"(",
"requir... | Convert an unpacked source distribution to a binary distribution.
:param requirement: A :class:`.Requirement` object.
:param setup_command: A list of strings with the arguments to
``setup.py``.
:returns: The pathname of the resulting binary distribution (a string).... | [
"Convert",
"an",
"unpacked",
"source",
"distribution",
"to",
"a",
"binary",
"distribution",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L219-L321 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.transform_binary_dist | def transform_binary_dist(self, archive_path):
"""
Transform binary distributions into a form that can be cached for future use.
:param archive_path: The pathname of the original binary distribution archive.
:returns: An iterable of tuples with two values each:
1. A :... | python | def transform_binary_dist(self, archive_path):
"""
Transform binary distributions into a form that can be cached for future use.
:param archive_path: The pathname of the original binary distribution archive.
:returns: An iterable of tuples with two values each:
1. A :... | [
"def",
"transform_binary_dist",
"(",
"self",
",",
"archive_path",
")",
":",
"# Copy the tar archive file by file so we can rewrite the pathnames.",
"logger",
".",
"debug",
"(",
"\"Transforming binary distribution: %s.\"",
",",
"archive_path",
")",
"archive",
"=",
"tarfile",
"... | Transform binary distributions into a form that can be cached for future use.
:param archive_path: The pathname of the original binary distribution archive.
:returns: An iterable of tuples with two values each:
1. A :class:`tarfile.TarInfo` object.
2. A file-like ob... | [
"Transform",
"binary",
"distributions",
"into",
"a",
"form",
"that",
"can",
"be",
"cached",
"for",
"future",
"use",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L323-L395 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.install_binary_dist | def install_binary_dist(self, members, virtualenv_compatible=True, prefix=None,
python=None, track_installed_files=False):
"""
Install a binary distribution into the given prefix.
:param members: An iterable of tuples with two values each:
1.... | python | def install_binary_dist(self, members, virtualenv_compatible=True, prefix=None,
python=None, track_installed_files=False):
"""
Install a binary distribution into the given prefix.
:param members: An iterable of tuples with two values each:
1.... | [
"def",
"install_binary_dist",
"(",
"self",
",",
"members",
",",
"virtualenv_compatible",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"python",
"=",
"None",
",",
"track_installed_files",
"=",
"False",
")",
":",
"# TODO This is quite slow for modules like Django. Spee... | Install a binary distribution into the given prefix.
:param members: An iterable of tuples with two values each:
1. A :class:`tarfile.TarInfo` object.
2. A file-like object.
:param prefix: The "prefix" under which the requirements should be
... | [
"Install",
"a",
"binary",
"distribution",
"into",
"the",
"given",
"prefix",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L397-L474 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.fix_hashbang | def fix_hashbang(self, contents, python):
"""
Rewrite hashbangs_ to use the correct Python executable.
:param contents: The contents of the script whose hashbang should be
fixed (a string).
:param python: The absolute pathname of the Python executable (a
... | python | def fix_hashbang(self, contents, python):
"""
Rewrite hashbangs_ to use the correct Python executable.
:param contents: The contents of the script whose hashbang should be
fixed (a string).
:param python: The absolute pathname of the Python executable (a
... | [
"def",
"fix_hashbang",
"(",
"self",
",",
"contents",
",",
"python",
")",
":",
"lines",
"=",
"contents",
".",
"splitlines",
"(",
")",
"if",
"lines",
":",
"hashbang",
"=",
"lines",
"[",
"0",
"]",
"# Get the base name of the command in the hashbang.",
"executable",... | Rewrite hashbangs_ to use the correct Python executable.
:param contents: The contents of the script whose hashbang should be
fixed (a string).
:param python: The absolute pathname of the Python executable (a
string).
:returns: The modified conten... | [
"Rewrite",
"hashbangs_",
"to",
"use",
"the",
"correct",
"Python",
"executable",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L476-L500 |
paylogic/pip-accel | pip_accel/bdist.py | BinaryDistributionManager.update_installed_files | def update_installed_files(self, installed_files):
"""
Track the files installed by a package so pip knows how to remove the package.
This method is used by :func:`install_binary_dist()` (which collects
the list of installed files for :func:`update_installed_files()`).
:param i... | python | def update_installed_files(self, installed_files):
"""
Track the files installed by a package so pip knows how to remove the package.
This method is used by :func:`install_binary_dist()` (which collects
the list of installed files for :func:`update_installed_files()`).
:param i... | [
"def",
"update_installed_files",
"(",
"self",
",",
"installed_files",
")",
":",
"# Find the *.egg-info directory where installed-files.txt should be created.",
"pkg_info_files",
"=",
"[",
"fn",
"for",
"fn",
"in",
"installed_files",
"if",
"fnmatch",
".",
"fnmatch",
"(",
"f... | Track the files installed by a package so pip knows how to remove the package.
This method is used by :func:`install_binary_dist()` (which collects
the list of installed files for :func:`update_installed_files()`).
:param installed_files: A list of absolute pathnames (strings) with the
... | [
"Track",
"the",
"files",
"installed",
"by",
"a",
"package",
"so",
"pip",
"knows",
"how",
"to",
"remove",
"the",
"package",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/bdist.py#L502-L525 |
paylogic/pip-accel | pip_accel/config.py | Config.available_configuration_files | def available_configuration_files(self):
"""A list of strings with the absolute pathnames of the available configuration files."""
known_files = [GLOBAL_CONFIG, LOCAL_CONFIG, self.environment.get('PIP_ACCEL_CONFIG')]
absolute_paths = [parse_path(pathname) for pathname in known_files if pathname]... | python | def available_configuration_files(self):
"""A list of strings with the absolute pathnames of the available configuration files."""
known_files = [GLOBAL_CONFIG, LOCAL_CONFIG, self.environment.get('PIP_ACCEL_CONFIG')]
absolute_paths = [parse_path(pathname) for pathname in known_files if pathname]... | [
"def",
"available_configuration_files",
"(",
"self",
")",
":",
"known_files",
"=",
"[",
"GLOBAL_CONFIG",
",",
"LOCAL_CONFIG",
",",
"self",
".",
"environment",
".",
"get",
"(",
"'PIP_ACCEL_CONFIG'",
")",
"]",
"absolute_paths",
"=",
"[",
"parse_path",
"(",
"pathna... | A list of strings with the absolute pathnames of the available configuration files. | [
"A",
"list",
"of",
"strings",
"with",
"the",
"absolute",
"pathnames",
"of",
"the",
"available",
"configuration",
"files",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L117-L121 |
paylogic/pip-accel | pip_accel/config.py | Config.load_configuration_file | def load_configuration_file(self, configuration_file):
"""
Load configuration defaults from a configuration file.
:param configuration_file: The pathname of a configuration file (a
string).
:raises: :exc:`Exception` when the configuration file cannot b... | python | def load_configuration_file(self, configuration_file):
"""
Load configuration defaults from a configuration file.
:param configuration_file: The pathname of a configuration file (a
string).
:raises: :exc:`Exception` when the configuration file cannot b... | [
"def",
"load_configuration_file",
"(",
"self",
",",
"configuration_file",
")",
":",
"configuration_file",
"=",
"parse_path",
"(",
"configuration_file",
")",
"logger",
".",
"debug",
"(",
"\"Loading configuration file: %s\"",
",",
"configuration_file",
")",
"parser",
"=",... | Load configuration defaults from a configuration file.
:param configuration_file: The pathname of a configuration file (a
string).
:raises: :exc:`Exception` when the configuration file cannot be
loaded. | [
"Load",
"configuration",
"defaults",
"from",
"a",
"configuration",
"file",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L123-L143 |
paylogic/pip-accel | pip_accel/config.py | Config.get | def get(self, property_name=None, environment_variable=None, configuration_option=None, default=None):
"""
Internal shortcut to get a configuration option's value.
:param property_name: The name of the property that users can set on
the :class:`Config` class (a str... | python | def get(self, property_name=None, environment_variable=None, configuration_option=None, default=None):
"""
Internal shortcut to get a configuration option's value.
:param property_name: The name of the property that users can set on
the :class:`Config` class (a str... | [
"def",
"get",
"(",
"self",
",",
"property_name",
"=",
"None",
",",
"environment_variable",
"=",
"None",
",",
"configuration_option",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"if",
"self",
".",
"overrides",
".",
"get",
"(",
"property_name",
")",
... | Internal shortcut to get a configuration option's value.
:param property_name: The name of the property that users can set on
the :class:`Config` class (a string).
:param environment_variable: The name of the environment variable (a
str... | [
"Internal",
"shortcut",
"to",
"get",
"a",
"configuration",
"option",
"s",
"value",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L158-L179 |
paylogic/pip-accel | pip_accel/config.py | Config.source_index | def source_index(self):
"""
The absolute pathname of pip-accel's source index directory (a string).
This is the ``sources`` subdirectory of :data:`data_directory`.
"""
return self.get(property_name='source_index',
default=os.path.join(self.data_directory,... | python | def source_index(self):
"""
The absolute pathname of pip-accel's source index directory (a string).
This is the ``sources`` subdirectory of :data:`data_directory`.
"""
return self.get(property_name='source_index',
default=os.path.join(self.data_directory,... | [
"def",
"source_index",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"property_name",
"=",
"'source_index'",
",",
"default",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"data_directory",
",",
"'sources'",
")",
")"
] | The absolute pathname of pip-accel's source index directory (a string).
This is the ``sources`` subdirectory of :data:`data_directory`. | [
"The",
"absolute",
"pathname",
"of",
"pip",
"-",
"accel",
"s",
"source",
"index",
"directory",
"(",
"a",
"string",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L194-L201 |
paylogic/pip-accel | pip_accel/config.py | Config.data_directory | def data_directory(self):
"""
The absolute pathname of the directory where pip-accel's data files are stored (a string).
- Environment variable: ``$PIP_ACCEL_CACHE``
- Configuration option: ``data-directory``
- Default: ``/var/cache/pip-accel`` if running as ``root``, ``~/.pip-a... | python | def data_directory(self):
"""
The absolute pathname of the directory where pip-accel's data files are stored (a string).
- Environment variable: ``$PIP_ACCEL_CACHE``
- Configuration option: ``data-directory``
- Default: ``/var/cache/pip-accel`` if running as ``root``, ``~/.pip-a... | [
"def",
"data_directory",
"(",
"self",
")",
":",
"return",
"expand_path",
"(",
"self",
".",
"get",
"(",
"property_name",
"=",
"'data_directory'",
",",
"environment_variable",
"=",
"'PIP_ACCEL_CACHE'",
",",
"configuration_option",
"=",
"'data-directory'",
",",
"defaul... | The absolute pathname of the directory where pip-accel's data files are stored (a string).
- Environment variable: ``$PIP_ACCEL_CACHE``
- Configuration option: ``data-directory``
- Default: ``/var/cache/pip-accel`` if running as ``root``, ``~/.pip-accel`` otherwise | [
"The",
"absolute",
"pathname",
"of",
"the",
"directory",
"where",
"pip",
"-",
"accel",
"s",
"data",
"files",
"are",
"stored",
"(",
"a",
"string",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L226-L237 |
paylogic/pip-accel | pip_accel/config.py | Config.install_prefix | def install_prefix(self):
"""
The absolute pathname of the installation prefix to use (a string).
This property is based on :data:`sys.prefix` except that when
:data:`sys.prefix` is ``/usr`` and we're running on a Debian derived
system ``/usr/local`` is used instead.
Th... | python | def install_prefix(self):
"""
The absolute pathname of the installation prefix to use (a string).
This property is based on :data:`sys.prefix` except that when
:data:`sys.prefix` is ``/usr`` and we're running on a Debian derived
system ``/usr/local`` is used instead.
Th... | [
"def",
"install_prefix",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"property_name",
"=",
"'install_prefix'",
",",
"default",
"=",
"'/usr/local'",
"if",
"sys",
".",
"prefix",
"==",
"'/usr'",
"and",
"self",
".",
"on_debian",
"else",
"sys",
".... | The absolute pathname of the installation prefix to use (a string).
This property is based on :data:`sys.prefix` except that when
:data:`sys.prefix` is ``/usr`` and we're running on a Debian derived
system ``/usr/local`` is used instead.
The reason for this is that on Debian derived sy... | [
"The",
"absolute",
"pathname",
"of",
"the",
"installation",
"prefix",
"to",
"use",
"(",
"a",
"string",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L246-L264 |
paylogic/pip-accel | pip_accel/config.py | Config.python_executable | def python_executable(self):
"""The absolute pathname of the Python executable (a string)."""
return self.get(property_name='python_executable',
default=sys.executable or os.path.join(self.install_prefix, 'bin', 'python')) | python | def python_executable(self):
"""The absolute pathname of the Python executable (a string)."""
return self.get(property_name='python_executable',
default=sys.executable or os.path.join(self.install_prefix, 'bin', 'python')) | [
"def",
"python_executable",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"property_name",
"=",
"'python_executable'",
",",
"default",
"=",
"sys",
".",
"executable",
"or",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"install_prefix",
",",... | The absolute pathname of the Python executable (a string). | [
"The",
"absolute",
"pathname",
"of",
"the",
"Python",
"executable",
"(",
"a",
"string",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L267-L270 |
paylogic/pip-accel | pip_accel/config.py | Config.auto_install | def auto_install(self):
"""
Whether automatic installation of missing system packages is enabled.
:data:`True` if automatic installation of missing system packages is
enabled, :data:`False` if it is disabled, :data:`None` otherwise (in this case
the user will be prompted at the ... | python | def auto_install(self):
"""
Whether automatic installation of missing system packages is enabled.
:data:`True` if automatic installation of missing system packages is
enabled, :data:`False` if it is disabled, :data:`None` otherwise (in this case
the user will be prompted at the ... | [
"def",
"auto_install",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"get",
"(",
"property_name",
"=",
"'auto_install'",
",",
"environment_variable",
"=",
"'PIP_ACCEL_AUTO_INSTALL'",
",",
"configuration_option",
"=",
"'auto-install'",
")",
"if",
"value",
"is",... | Whether automatic installation of missing system packages is enabled.
:data:`True` if automatic installation of missing system packages is
enabled, :data:`False` if it is disabled, :data:`None` otherwise (in this case
the user will be prompted at the appropriate time).
- Environment va... | [
"Whether",
"automatic",
"installation",
"of",
"missing",
"system",
"packages",
"is",
"enabled",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L273-L292 |
paylogic/pip-accel | pip_accel/config.py | Config.trust_mod_times | def trust_mod_times(self):
"""
Whether to trust file modification times for cache invalidation.
- Environment variable: ``$PIP_ACCEL_TRUST_MOD_TIMES``
- Configuration option: ``trust-mod-times``
- Default: :data:`True` unless the AppVeyor_ continuous integration
... | python | def trust_mod_times(self):
"""
Whether to trust file modification times for cache invalidation.
- Environment variable: ``$PIP_ACCEL_TRUST_MOD_TIMES``
- Configuration option: ``trust-mod-times``
- Default: :data:`True` unless the AppVeyor_ continuous integration
... | [
"def",
"trust_mod_times",
"(",
"self",
")",
":",
"on_appveyor",
"=",
"coerce_boolean",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'APPVEYOR'",
",",
"'False'",
")",
")",
"return",
"coerce_boolean",
"(",
"self",
".",
"get",
"(",
"property_name",
"=",
"'tru... | Whether to trust file modification times for cache invalidation.
- Environment variable: ``$PIP_ACCEL_TRUST_MOD_TIMES``
- Configuration option: ``trust-mod-times``
- Default: :data:`True` unless the AppVeyor_ continuous integration
environment is detected (see `issue 62`_).
... | [
"Whether",
"to",
"trust",
"file",
"modification",
"times",
"for",
"cache",
"invalidation",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L342-L358 |
paylogic/pip-accel | pip_accel/config.py | Config.s3_cache_readonly | def s3_cache_readonly(self):
"""
Whether the Amazon S3 bucket is considered read only.
If this is :data:`True` then the Amazon S3 bucket will only be used for
:class:`~pip_accel.caches.s3.S3CacheBackend.get()` operations (all
:class:`~pip_accel.caches.s3.S3CacheBackend.put()` op... | python | def s3_cache_readonly(self):
"""
Whether the Amazon S3 bucket is considered read only.
If this is :data:`True` then the Amazon S3 bucket will only be used for
:class:`~pip_accel.caches.s3.S3CacheBackend.get()` operations (all
:class:`~pip_accel.caches.s3.S3CacheBackend.put()` op... | [
"def",
"s3_cache_readonly",
"(",
"self",
")",
":",
"return",
"coerce_boolean",
"(",
"self",
".",
"get",
"(",
"property_name",
"=",
"'s3_cache_readonly'",
",",
"environment_variable",
"=",
"'PIP_ACCEL_S3_READONLY'",
",",
"configuration_option",
"=",
"'s3-readonly'",
",... | Whether the Amazon S3 bucket is considered read only.
If this is :data:`True` then the Amazon S3 bucket will only be used for
:class:`~pip_accel.caches.s3.S3CacheBackend.get()` operations (all
:class:`~pip_accel.caches.s3.S3CacheBackend.put()` operations will
be disabled).
- En... | [
"Whether",
"the",
"Amazon",
"S3",
"bucket",
"is",
"considered",
"read",
"only",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L427-L448 |
paylogic/pip-accel | pip_accel/config.py | Config.s3_cache_timeout | def s3_cache_timeout(self):
"""
The socket timeout in seconds for connections to Amazon S3 (an integer).
This value is injected into Boto's configuration to override the
default socket timeout used for connections to Amazon S3.
- Environment variable: ``$PIP_ACCEL_S3_TIMEOUT``
... | python | def s3_cache_timeout(self):
"""
The socket timeout in seconds for connections to Amazon S3 (an integer).
This value is injected into Boto's configuration to override the
default socket timeout used for connections to Amazon S3.
- Environment variable: ``$PIP_ACCEL_S3_TIMEOUT``
... | [
"def",
"s3_cache_timeout",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"get",
"(",
"property_name",
"=",
"'s3_cache_timeout'",
",",
"environment_variable",
"=",
"'PIP_ACCEL_S3_TIMEOUT'",
",",
"configuration_option",
"=",
"'s3-timeout'",
")",
"try",
":",
"n",... | The socket timeout in seconds for connections to Amazon S3 (an integer).
This value is injected into Boto's configuration to override the
default socket timeout used for connections to Amazon S3.
- Environment variable: ``$PIP_ACCEL_S3_TIMEOUT``
- Configuration option: ``s3-timeout``
... | [
"The",
"socket",
"timeout",
"in",
"seconds",
"for",
"connections",
"to",
"Amazon",
"S3",
"(",
"an",
"integer",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/config.py#L451-L472 |
paylogic/pip-accel | pip_accel/caches/s3.py | S3CacheBackend.get | def get(self, filename):
"""
Download a distribution archive from the configured Amazon S3 bucket.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`.
:... | python | def get(self, filename):
"""
Download a distribution archive from the configured Amazon S3 bucket.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`.
:... | [
"def",
"get",
"(",
"self",
",",
"filename",
")",
":",
"timer",
"=",
"Timer",
"(",
")",
"self",
".",
"check_prerequisites",
"(",
")",
"with",
"PatchedBotoConfig",
"(",
")",
":",
"# Check if the distribution archive is available.",
"raw_key",
"=",
"self",
".",
"... | Download a distribution archive from the configured Amazon S3 bucket.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`.
:raises: :exc:`.CacheBackendError` when any un... | [
"Download",
"a",
"distribution",
"archive",
"from",
"the",
"configured",
"Amazon",
"S3",
"bucket",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L143-L171 |
paylogic/pip-accel | pip_accel/caches/s3.py | S3CacheBackend.put | def put(self, filename, handle):
"""
Upload a distribution archive to the configured Amazon S3 bucket.
If the :attr:`~.Config.s3_cache_readonly` configuration option is
enabled this method does nothing.
:param filename: The filename of the distribution archive (a string).
... | python | def put(self, filename, handle):
"""
Upload a distribution archive to the configured Amazon S3 bucket.
If the :attr:`~.Config.s3_cache_readonly` configuration option is
enabled this method does nothing.
:param filename: The filename of the distribution archive (a string).
... | [
"def",
"put",
"(",
"self",
",",
"filename",
",",
"handle",
")",
":",
"if",
"self",
".",
"config",
".",
"s3_cache_readonly",
":",
"logger",
".",
"info",
"(",
"'Skipping upload to S3 bucket (using S3 in read only mode).'",
")",
"else",
":",
"timer",
"=",
"Timer",
... | Upload a distribution archive to the configured Amazon S3 bucket.
If the :attr:`~.Config.s3_cache_readonly` configuration option is
enabled this method does nothing.
:param filename: The filename of the distribution archive (a string).
:param handle: A file-like object that provides ac... | [
"Upload",
"a",
"distribution",
"archive",
"to",
"the",
"configured",
"Amazon",
"S3",
"bucket",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L173-L203 |
paylogic/pip-accel | pip_accel/caches/s3.py | S3CacheBackend.s3_bucket | def s3_bucket(self):
"""
Connect to the user defined Amazon S3 bucket.
Called on demand by :func:`get()` and :func:`put()`. Caches its
return value so that only a single connection is created.
:returns: A :class:`boto.s3.bucket.Bucket` object.
:raises: :exc:`.CacheBacke... | python | def s3_bucket(self):
"""
Connect to the user defined Amazon S3 bucket.
Called on demand by :func:`get()` and :func:`put()`. Caches its
return value so that only a single connection is created.
:returns: A :class:`boto.s3.bucket.Bucket` object.
:raises: :exc:`.CacheBacke... | [
"def",
"s3_bucket",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'cached_bucket'",
")",
":",
"self",
".",
"check_prerequisites",
"(",
")",
"with",
"PatchedBotoConfig",
"(",
")",
":",
"from",
"boto",
".",
"exception",
"import",
"BotoCli... | Connect to the user defined Amazon S3 bucket.
Called on demand by :func:`get()` and :func:`put()`. Caches its
return value so that only a single connection is created.
:returns: A :class:`boto.s3.bucket.Bucket` object.
:raises: :exc:`.CacheBackendDisabledError` when the user hasn't
... | [
"Connect",
"to",
"the",
"user",
"defined",
"Amazon",
"S3",
"bucket",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L206-L247 |
paylogic/pip-accel | pip_accel/caches/s3.py | S3CacheBackend.s3_connection | def s3_connection(self):
"""
Connect to the Amazon S3 API.
If the connection attempt fails because Boto can't find credentials the
attempt is retried once with an anonymous connection.
Called on demand by :attr:`s3_bucket`.
:returns: A :class:`boto.s3.connection.S3Conn... | python | def s3_connection(self):
"""
Connect to the Amazon S3 API.
If the connection attempt fails because Boto can't find credentials the
attempt is retried once with an anonymous connection.
Called on demand by :attr:`s3_bucket`.
:returns: A :class:`boto.s3.connection.S3Conn... | [
"def",
"s3_connection",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'cached_connection'",
")",
":",
"self",
".",
"check_prerequisites",
"(",
")",
"with",
"PatchedBotoConfig",
"(",
")",
":",
"import",
"boto",
"from",
"boto",
".",
"exce... | Connect to the Amazon S3 API.
If the connection attempt fails because Boto can't find credentials the
attempt is retried once with an anonymous connection.
Called on demand by :attr:`s3_bucket`.
:returns: A :class:`boto.s3.connection.S3Connection` object.
:raises: :exc:`.Cache... | [
"Connect",
"to",
"the",
"Amazon",
"S3",
"API",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L250-L302 |
paylogic/pip-accel | pip_accel/caches/s3.py | PatchedBotoConfig.get | def get(self, section, name, default=None, **kw):
"""Replacement for :func:`boto.pyami.config.Config.get()`."""
try:
return self.unbound_method(self.instance, section, name, **kw)
except Exception:
return default | python | def get(self, section, name, default=None, **kw):
"""Replacement for :func:`boto.pyami.config.Config.get()`."""
try:
return self.unbound_method(self.instance, section, name, **kw)
except Exception:
return default | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"name",
",",
"default",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"return",
"self",
".",
"unbound_method",
"(",
"self",
".",
"instance",
",",
"section",
",",
"name",
",",
"*",
"*",
"kw... | Replacement for :func:`boto.pyami.config.Config.get()`. | [
"Replacement",
"for",
":",
"func",
":",
"boto",
".",
"pyami",
".",
"config",
".",
"Config",
".",
"get",
"()",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/s3.py#L367-L372 |
paylogic/pip-accel | pip_accel/req.py | Requirement.related_archives | def related_archives(self):
"""
The pathnames of the source distribution(s) for this requirement (a list of strings).
.. note:: This property is very new in pip-accel and its logic may need
some time to mature. For now any misbehavior by this property
shouldn... | python | def related_archives(self):
"""
The pathnames of the source distribution(s) for this requirement (a list of strings).
.. note:: This property is very new in pip-accel and its logic may need
some time to mature. For now any misbehavior by this property
shouldn... | [
"def",
"related_archives",
"(",
"self",
")",
":",
"# Escape the requirement's name for use in a regular expression.",
"name_pattern",
"=",
"escape_name",
"(",
"self",
".",
"name",
")",
"# Escape the requirement's version for in a regular expression.",
"version_pattern",
"=",
"re"... | The pathnames of the source distribution(s) for this requirement (a list of strings).
.. note:: This property is very new in pip-accel and its logic may need
some time to mature. For now any misbehavior by this property
shouldn't be too much of a problem because the pathname... | [
"The",
"pathnames",
"of",
"the",
"source",
"distribution",
"(",
"s",
")",
"for",
"this",
"requirement",
"(",
"a",
"list",
"of",
"strings",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/req.py#L96-L122 |
paylogic/pip-accel | pip_accel/req.py | Requirement.last_modified | def last_modified(self):
"""
The last modified time of the requirement's source distribution archive(s) (a number).
The value of this property is based on the :attr:`related_archives`
property. If no related archives are found the current time is
reported. In the balance between... | python | def last_modified(self):
"""
The last modified time of the requirement's source distribution archive(s) (a number).
The value of this property is based on the :attr:`related_archives`
property. If no related archives are found the current time is
reported. In the balance between... | [
"def",
"last_modified",
"(",
"self",
")",
":",
"mtimes",
"=",
"list",
"(",
"map",
"(",
"os",
".",
"path",
".",
"getmtime",
",",
"self",
".",
"related_archives",
")",
")",
"return",
"max",
"(",
"mtimes",
")",
"if",
"mtimes",
"else",
"time",
".",
"time... | The last modified time of the requirement's source distribution archive(s) (a number).
The value of this property is based on the :attr:`related_archives`
property. If no related archives are found the current time is
reported. In the balance between not invalidating cached binary
distr... | [
"The",
"last",
"modified",
"time",
"of",
"the",
"requirement",
"s",
"source",
"distribution",
"archive",
"(",
"s",
")",
"(",
"a",
"number",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/req.py#L125-L136 |
paylogic/pip-accel | pip_accel/req.py | Requirement.is_wheel | def is_wheel(self):
"""
:data:`True` when the requirement is a wheel, :data:`False` otherwise.
.. note:: To my surprise it seems to be non-trivial to determine
whether a given :class:`pip.req.InstallRequirement` object
produced by pip's internal Python API co... | python | def is_wheel(self):
"""
:data:`True` when the requirement is a wheel, :data:`False` otherwise.
.. note:: To my surprise it seems to be non-trivial to determine
whether a given :class:`pip.req.InstallRequirement` object
produced by pip's internal Python API co... | [
"def",
"is_wheel",
"(",
"self",
")",
":",
"probably_sdist",
"=",
"os",
".",
"path",
".",
"isfile",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"source_directory",
",",
"'setup.py'",
")",
")",
"probably_wheel",
"=",
"len",
"(",
"glob",
".",
... | :data:`True` when the requirement is a wheel, :data:`False` otherwise.
.. note:: To my surprise it seems to be non-trivial to determine
whether a given :class:`pip.req.InstallRequirement` object
produced by pip's internal Python API concerns a source
distri... | [
":",
"data",
":",
"True",
"when",
"the",
"requirement",
"is",
"a",
"wheel",
":",
"data",
":",
"False",
"otherwise",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/req.py#L160-L199 |
paylogic/pip-accel | pip_accel/req.py | Requirement.wheel_metadata | def wheel_metadata(self):
"""Get the distribution metadata of an unpacked wheel distribution."""
if not self.is_wheel:
raise TypeError("Requirement is not a wheel distribution!")
for distribution in find_distributions(self.source_directory):
return distribution
ms... | python | def wheel_metadata(self):
"""Get the distribution metadata of an unpacked wheel distribution."""
if not self.is_wheel:
raise TypeError("Requirement is not a wheel distribution!")
for distribution in find_distributions(self.source_directory):
return distribution
ms... | [
"def",
"wheel_metadata",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_wheel",
":",
"raise",
"TypeError",
"(",
"\"Requirement is not a wheel distribution!\"",
")",
"for",
"distribution",
"in",
"find_distributions",
"(",
"self",
".",
"source_directory",
")",
... | Get the distribution metadata of an unpacked wheel distribution. | [
"Get",
"the",
"distribution",
"metadata",
"of",
"an",
"unpacked",
"wheel",
"distribution",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/req.py#L238-L245 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.validate_environment | def validate_environment(self):
"""
Make sure :data:`sys.prefix` matches ``$VIRTUAL_ENV`` (if defined).
This may seem like a strange requirement to dictate but it avoids hairy
issues like `documented here <https://github.com/paylogic/pip-accel/issues/5>`_.
The most sneaky thing... | python | def validate_environment(self):
"""
Make sure :data:`sys.prefix` matches ``$VIRTUAL_ENV`` (if defined).
This may seem like a strange requirement to dictate but it avoids hairy
issues like `documented here <https://github.com/paylogic/pip-accel/issues/5>`_.
The most sneaky thing... | [
"def",
"validate_environment",
"(",
"self",
")",
":",
"environment",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'VIRTUAL_ENV'",
")",
"if",
"environment",
":",
"if",
"not",
"same_directories",
"(",
"sys",
".",
"prefix",
",",
"environment",
")",
":",
"rais... | Make sure :data:`sys.prefix` matches ``$VIRTUAL_ENV`` (if defined).
This may seem like a strange requirement to dictate but it avoids hairy
issues like `documented here <https://github.com/paylogic/pip-accel/issues/5>`_.
The most sneaky thing is that ``pip`` doesn't have this problem
(... | [
"Make",
"sure",
":",
"data",
":",
"sys",
".",
"prefix",
"matches",
"$VIRTUAL_ENV",
"(",
"if",
"defined",
")",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L121-L144 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.initialize_directories | def initialize_directories(self):
"""Automatically create local directories required by pip-accel."""
makedirs(self.config.source_index)
makedirs(self.config.eggs_cache) | python | def initialize_directories(self):
"""Automatically create local directories required by pip-accel."""
makedirs(self.config.source_index)
makedirs(self.config.eggs_cache) | [
"def",
"initialize_directories",
"(",
"self",
")",
":",
"makedirs",
"(",
"self",
".",
"config",
".",
"source_index",
")",
"makedirs",
"(",
"self",
".",
"config",
".",
"eggs_cache",
")"
] | Automatically create local directories required by pip-accel. | [
"Automatically",
"create",
"local",
"directories",
"required",
"by",
"pip",
"-",
"accel",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L146-L149 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.clean_source_index | def clean_source_index(self):
"""
Cleanup broken symbolic links in the local source distribution index.
The purpose of this method requires some context to understand. Let me
preface this by stating that I realize I'm probably overcomplicating
things, but I like to preserve forw... | python | def clean_source_index(self):
"""
Cleanup broken symbolic links in the local source distribution index.
The purpose of this method requires some context to understand. Let me
preface this by stating that I realize I'm probably overcomplicating
things, but I like to preserve forw... | [
"def",
"clean_source_index",
"(",
"self",
")",
":",
"cleanup_timer",
"=",
"Timer",
"(",
")",
"cleanup_counter",
"=",
"0",
"for",
"entry",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"config",
".",
"source_index",
")",
":",
"pathname",
"=",
"os",
".",
... | Cleanup broken symbolic links in the local source distribution index.
The purpose of this method requires some context to understand. Let me
preface this by stating that I realize I'm probably overcomplicating
things, but I like to preserve forward / backward compatibility when
possible... | [
"Cleanup",
"broken",
"symbolic",
"links",
"in",
"the",
"local",
"source",
"distribution",
"index",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L151-L213 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.install_from_arguments | def install_from_arguments(self, arguments, **kw):
"""
Download, unpack, build and install the specified requirements.
This function is a simple wrapper for :func:`get_requirements()`,
:func:`install_requirements()` and :func:`cleanup_temporary_directories()`
that implements the... | python | def install_from_arguments(self, arguments, **kw):
"""
Download, unpack, build and install the specified requirements.
This function is a simple wrapper for :func:`get_requirements()`,
:func:`install_requirements()` and :func:`cleanup_temporary_directories()`
that implements the... | [
"def",
"install_from_arguments",
"(",
"self",
",",
"arguments",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"requirements",
"=",
"self",
".",
"get_requirements",
"(",
"arguments",
",",
"use_wheels",
"=",
"self",
".",
"arguments_allow_wheels",
"(",
"arguments",
... | Download, unpack, build and install the specified requirements.
This function is a simple wrapper for :func:`get_requirements()`,
:func:`install_requirements()` and :func:`cleanup_temporary_directories()`
that implements the default behavior of the pip accelerator. If you're
extending o... | [
"Download",
"unpack",
"build",
"and",
"install",
"the",
"specified",
"requirements",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L215-L251 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.get_requirements | def get_requirements(self, arguments, max_retries=None, use_wheels=False):
"""
Use pip to download and unpack the requested source distribution archives.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param max_retries... | python | def get_requirements(self, arguments, max_retries=None, use_wheels=False):
"""
Use pip to download and unpack the requested source distribution archives.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param max_retries... | [
"def",
"get_requirements",
"(",
"self",
",",
"arguments",
",",
"max_retries",
"=",
"None",
",",
"use_wheels",
"=",
"False",
")",
":",
"arguments",
"=",
"self",
".",
"decorate_arguments",
"(",
"arguments",
")",
"# Demote hash sum mismatch log messages from CRITICAL to ... | Use pip to download and unpack the requested source distribution archives.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param max_retries: The maximum number of times that pip will be asked
to download di... | [
"Use",
"pip",
"to",
"download",
"and",
"unpack",
"the",
"requested",
"source",
"distribution",
"archives",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L262-L321 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.decorate_arguments | def decorate_arguments(self, arguments):
"""
Change pathnames of local files into ``file://`` URLs with ``#md5=...`` fragments.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:returns: A copy of the command line argumen... | python | def decorate_arguments(self, arguments):
"""
Change pathnames of local files into ``file://`` URLs with ``#md5=...`` fragments.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:returns: A copy of the command line argumen... | [
"def",
"decorate_arguments",
"(",
"self",
",",
"arguments",
")",
":",
"arguments",
"=",
"list",
"(",
"arguments",
")",
"for",
"i",
",",
"value",
"in",
"enumerate",
"(",
"arguments",
")",
":",
"is_constraint_file",
"=",
"(",
"i",
">=",
"1",
"and",
"match_... | Change pathnames of local files into ``file://`` URLs with ``#md5=...`` fragments.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:returns: A copy of the command line arguments with pathnames of local
files rewritten ... | [
"Change",
"pathnames",
"of",
"local",
"files",
"into",
"file",
":",
"//",
"URLs",
"with",
"#md5",
"=",
"...",
"fragments",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L323-L363 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.unpack_source_dists | def unpack_source_dists(self, arguments, use_wheels=False):
"""
Find and unpack local source distributions and discover their metadata.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and p... | python | def unpack_source_dists(self, arguments, use_wheels=False):
"""
Find and unpack local source distributions and discover their metadata.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and p... | [
"def",
"unpack_source_dists",
"(",
"self",
",",
"arguments",
",",
"use_wheels",
"=",
"False",
")",
":",
"unpack_timer",
"=",
"Timer",
"(",
")",
"logger",
".",
"info",
"(",
"\"Unpacking distribution(s) ..\"",
")",
"with",
"PatchedAttribute",
"(",
"pip_install_modul... | Find and unpack local source distributions and discover their metadata.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and pip-accel are allowed to use wheels_
(:data:`False` by... | [
"Find",
"and",
"unpack",
"local",
"source",
"distributions",
"and",
"discover",
"their",
"metadata",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L365-L395 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.download_source_dists | def download_source_dists(self, arguments, use_wheels=False):
"""
Download missing source distributions.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and pip-accel are allowed to use whe... | python | def download_source_dists(self, arguments, use_wheels=False):
"""
Download missing source distributions.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and pip-accel are allowed to use whe... | [
"def",
"download_source_dists",
"(",
"self",
",",
"arguments",
",",
"use_wheels",
"=",
"False",
")",
":",
"download_timer",
"=",
"Timer",
"(",
")",
"logger",
".",
"info",
"(",
"\"Downloading missing distribution(s) ..\"",
")",
"requirements",
"=",
"self",
".",
"... | Download missing source distributions.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_wheels: Whether pip and pip-accel are allowed to use wheels_
(:data:`False` by default for backwards compatibil... | [
"Download",
"missing",
"source",
"distributions",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L397-L412 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.get_pip_requirement_set | def get_pip_requirement_set(self, arguments, use_remote_index, use_wheels=False):
"""
Get the unpacked requirement(s) specified by the caller by running pip.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_rem... | python | def get_pip_requirement_set(self, arguments, use_remote_index, use_wheels=False):
"""
Get the unpacked requirement(s) specified by the caller by running pip.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_rem... | [
"def",
"get_pip_requirement_set",
"(",
"self",
",",
"arguments",
",",
"use_remote_index",
",",
"use_wheels",
"=",
"False",
")",
":",
"# Compose the pip command line arguments. This is where a lot of the",
"# core logic of pip-accel is hidden and it uses some esoteric features",
"# of... | Get the unpacked requirement(s) specified by the caller by running pip.
:param arguments: The command line arguments to ``pip install ...`` (a
list of strings).
:param use_remote_index: A boolean indicating whether pip is allowed to
connect to ... | [
"Get",
"the",
"unpacked",
"requirement",
"(",
"s",
")",
"specified",
"by",
"the",
"caller",
"by",
"running",
"pip",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L414-L506 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.transform_pip_requirement_set | def transform_pip_requirement_set(self, requirement_set):
"""
Transform pip's requirement set into one that `pip-accel` can work with.
:param requirement_set: The :class:`pip.req.RequirementSet` object
reported by pip.
:returns: A list of :class:`pip_acce... | python | def transform_pip_requirement_set(self, requirement_set):
"""
Transform pip's requirement set into one that `pip-accel` can work with.
:param requirement_set: The :class:`pip.req.RequirementSet` object
reported by pip.
:returns: A list of :class:`pip_acce... | [
"def",
"transform_pip_requirement_set",
"(",
"self",
",",
"requirement_set",
")",
":",
"filtered_requirements",
"=",
"[",
"]",
"for",
"requirement",
"in",
"requirement_set",
".",
"requirements",
".",
"values",
"(",
")",
":",
"# The `satisfied_by' property is set by pip ... | Transform pip's requirement set into one that `pip-accel` can work with.
:param requirement_set: The :class:`pip.req.RequirementSet` object
reported by pip.
:returns: A list of :class:`pip_accel.req.Requirement` objects.
This function converts the :class:`pip.re... | [
"Transform",
"pip",
"s",
"requirement",
"set",
"into",
"one",
"that",
"pip",
"-",
"accel",
"can",
"work",
"with",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L508-L539 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.install_requirements | def install_requirements(self, requirements, **kw):
"""
Manually install a requirement set from binary and/or wheel distributions.
:param requirements: A list of :class:`pip_accel.req.Requirement` objects.
:param kw: Any keyword arguments are passed on to
:func:`~pip_... | python | def install_requirements(self, requirements, **kw):
"""
Manually install a requirement set from binary and/or wheel distributions.
:param requirements: A list of :class:`pip_accel.req.Requirement` objects.
:param kw: Any keyword arguments are passed on to
:func:`~pip_... | [
"def",
"install_requirements",
"(",
"self",
",",
"requirements",
",",
"*",
"*",
"kw",
")",
":",
"install_timer",
"=",
"Timer",
"(",
")",
"install_types",
"=",
"[",
"]",
"if",
"any",
"(",
"not",
"req",
".",
"is_wheel",
"for",
"req",
"in",
"requirements",
... | Manually install a requirement set from binary and/or wheel distributions.
:param requirements: A list of :class:`pip_accel.req.Requirement` objects.
:param kw: Any keyword arguments are passed on to
:func:`~pip_accel.bdist.BinaryDistributionManager.install_binary_dist()`.
:r... | [
"Manually",
"install",
"a",
"requirement",
"set",
"from",
"binary",
"and",
"/",
"or",
"wheel",
"distributions",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L541-L589 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.clear_build_directory | def clear_build_directory(self):
"""Clear the build directory where pip unpacks the source distribution archives."""
stat = os.stat(self.build_directory)
shutil.rmtree(self.build_directory)
os.makedirs(self.build_directory, stat.st_mode) | python | def clear_build_directory(self):
"""Clear the build directory where pip unpacks the source distribution archives."""
stat = os.stat(self.build_directory)
shutil.rmtree(self.build_directory)
os.makedirs(self.build_directory, stat.st_mode) | [
"def",
"clear_build_directory",
"(",
"self",
")",
":",
"stat",
"=",
"os",
".",
"stat",
"(",
"self",
".",
"build_directory",
")",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"build_directory",
")",
"os",
".",
"makedirs",
"(",
"self",
".",
"build_directory",
... | Clear the build directory where pip unpacks the source distribution archives. | [
"Clear",
"the",
"build",
"directory",
"where",
"pip",
"unpacks",
"the",
"source",
"distribution",
"archives",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L612-L616 |
paylogic/pip-accel | pip_accel/__init__.py | PipAccelerator.cleanup_temporary_directories | def cleanup_temporary_directories(self):
"""Delete the build directories and any temporary directories created by pip."""
while self.build_directories:
shutil.rmtree(self.build_directories.pop())
for requirement in self.reported_requirements:
requirement.remove_temporary_... | python | def cleanup_temporary_directories(self):
"""Delete the build directories and any temporary directories created by pip."""
while self.build_directories:
shutil.rmtree(self.build_directories.pop())
for requirement in self.reported_requirements:
requirement.remove_temporary_... | [
"def",
"cleanup_temporary_directories",
"(",
"self",
")",
":",
"while",
"self",
".",
"build_directories",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"build_directories",
".",
"pop",
"(",
")",
")",
"for",
"requirement",
"in",
"self",
".",
"reported_require... | Delete the build directories and any temporary directories created by pip. | [
"Delete",
"the",
"build",
"directories",
"and",
"any",
"temporary",
"directories",
"created",
"by",
"pip",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L618-L627 |
paylogic/pip-accel | pip_accel/__init__.py | DownloadLogFilter.filter | def filter(self, record):
"""Change the severity of selected log records."""
if isinstance(record.msg, basestring):
message = record.msg.lower()
if all(kw in message for kw in self.KEYWORDS):
record.levelname = 'DEBUG'
record.levelno = logging.DEBU... | python | def filter(self, record):
"""Change the severity of selected log records."""
if isinstance(record.msg, basestring):
message = record.msg.lower()
if all(kw in message for kw in self.KEYWORDS):
record.levelname = 'DEBUG'
record.levelno = logging.DEBU... | [
"def",
"filter",
"(",
"self",
",",
"record",
")",
":",
"if",
"isinstance",
"(",
"record",
".",
"msg",
",",
"basestring",
")",
":",
"message",
"=",
"record",
".",
"msg",
".",
"lower",
"(",
")",
"if",
"all",
"(",
"kw",
"in",
"message",
"for",
"kw",
... | Change the severity of selected log records. | [
"Change",
"the",
"severity",
"of",
"selected",
"log",
"records",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/__init__.py#L662-L669 |
paylogic/pip-accel | pip_accel/cli.py | main | def main():
"""The command line interface for the ``pip-accel`` program."""
arguments = sys.argv[1:]
# If no arguments are given, the help text of pip-accel is printed.
if not arguments:
usage()
sys.exit(0)
# If no install subcommand is given we pass the command line straight
# t... | python | def main():
"""The command line interface for the ``pip-accel`` program."""
arguments = sys.argv[1:]
# If no arguments are given, the help text of pip-accel is printed.
if not arguments:
usage()
sys.exit(0)
# If no install subcommand is given we pass the command line straight
# t... | [
"def",
"main",
"(",
")",
":",
"arguments",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"# If no arguments are given, the help text of pip-accel is printed.",
"if",
"not",
"arguments",
":",
"usage",
"(",
")",
"sys",
".",
"exit",
"(",
"0",
")",
"# If no install... | The command line interface for the ``pip-accel`` program. | [
"The",
"command",
"line",
"interface",
"for",
"the",
"pip",
"-",
"accel",
"program",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/cli.py#L28-L66 |
paylogic/pip-accel | pip_accel/caches/local.py | LocalCacheBackend.get | def get(self, filename):
"""
Check if a distribution archive exists in the local cache.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`.
"""
... | python | def get(self, filename):
"""
Check if a distribution archive exists in the local cache.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`.
"""
... | [
"def",
"get",
"(",
"self",
",",
"filename",
")",
":",
"pathname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config",
".",
"binary_cache",
",",
"filename",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"pathname",
")",
":",
"logger... | Check if a distribution archive exists in the local cache.
:param filename: The filename of the distribution archive (a string).
:returns: The pathname of a distribution archive on the local file
system or :data:`None`. | [
"Check",
"if",
"a",
"distribution",
"archive",
"exists",
"in",
"the",
"local",
"cache",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/local.py#L40-L54 |
paylogic/pip-accel | pip_accel/caches/local.py | LocalCacheBackend.put | def put(self, filename, handle):
"""
Store a distribution archive in the local cache.
:param filename: The filename of the distribution archive (a string).
:param handle: A file-like object that provides access to the
distribution archive.
"""
file... | python | def put(self, filename, handle):
"""
Store a distribution archive in the local cache.
:param filename: The filename of the distribution archive (a string).
:param handle: A file-like object that provides access to the
distribution archive.
"""
file... | [
"def",
"put",
"(",
"self",
",",
"filename",
",",
"handle",
")",
":",
"file_in_cache",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config",
".",
"binary_cache",
",",
"filename",
")",
"logger",
".",
"debug",
"(",
"\"Storing distribution archive i... | Store a distribution archive in the local cache.
:param filename: The filename of the distribution archive (a string).
:param handle: A file-like object that provides access to the
distribution archive. | [
"Store",
"a",
"distribution",
"archive",
"in",
"the",
"local",
"cache",
"."
] | train | https://github.com/paylogic/pip-accel/blob/ccad1b784927a322d996db593403b1d2d2e22666/pip_accel/caches/local.py#L56-L73 |
fle/django-multi-email-field | multi_email_field/forms.py | MultiEmailField.to_python | def to_python(self, value):
"Normalize data to a list of strings."
# Return None if no input was given.
if not value:
return []
return [v.strip() for v in value.splitlines() if v != ""] | python | def to_python(self, value):
"Normalize data to a list of strings."
# Return None if no input was given.
if not value:
return []
return [v.strip() for v in value.splitlines() if v != ""] | [
"def",
"to_python",
"(",
"self",
",",
"value",
")",
":",
"# Return None if no input was given.",
"if",
"not",
"value",
":",
"return",
"[",
"]",
"return",
"[",
"v",
".",
"strip",
"(",
")",
"for",
"v",
"in",
"value",
".",
"splitlines",
"(",
")",
"if",
"v... | Normalize data to a list of strings. | [
"Normalize",
"data",
"to",
"a",
"list",
"of",
"strings",
"."
] | train | https://github.com/fle/django-multi-email-field/blob/5488ab91053b8f7ed6c36a07c28d56efe85b1daf/multi_email_field/forms.py#L14-L19 |
fle/django-multi-email-field | multi_email_field/forms.py | MultiEmailField.validate | def validate(self, value):
"Check if value consists only of valid emails."
# Use the parent's handling of required fields, etc.
super(MultiEmailField, self).validate(value)
try:
for email in value:
validate_email(email)
except ValidationError:
... | python | def validate(self, value):
"Check if value consists only of valid emails."
# Use the parent's handling of required fields, etc.
super(MultiEmailField, self).validate(value)
try:
for email in value:
validate_email(email)
except ValidationError:
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"# Use the parent's handling of required fields, etc.",
"super",
"(",
"MultiEmailField",
",",
"self",
")",
".",
"validate",
"(",
"value",
")",
"try",
":",
"for",
"email",
"in",
"value",
":",
"validate_email... | Check if value consists only of valid emails. | [
"Check",
"if",
"value",
"consists",
"only",
"of",
"valid",
"emails",
"."
] | train | https://github.com/fle/django-multi-email-field/blob/5488ab91053b8f7ed6c36a07c28d56efe85b1daf/multi_email_field/forms.py#L21-L30 |
fle/django-multi-email-field | multi_email_field/widgets.py | MultiEmailWidget.prep_value | def prep_value(self, value):
""" Prepare value before effectively render widget """
if value in MULTI_EMAIL_FIELD_EMPTY_VALUES:
return ""
elif isinstance(value, six.string_types):
return value
elif isinstance(value, list):
return "\n".join(value)
... | python | def prep_value(self, value):
""" Prepare value before effectively render widget """
if value in MULTI_EMAIL_FIELD_EMPTY_VALUES:
return ""
elif isinstance(value, six.string_types):
return value
elif isinstance(value, list):
return "\n".join(value)
... | [
"def",
"prep_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"MULTI_EMAIL_FIELD_EMPTY_VALUES",
":",
"return",
"\"\"",
"elif",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
":",
"return",
"value",
"elif",
"isinstance",
"(... | Prepare value before effectively render widget | [
"Prepare",
"value",
"before",
"effectively",
"render",
"widget"
] | train | https://github.com/fle/django-multi-email-field/blob/5488ab91053b8f7ed6c36a07c28d56efe85b1daf/multi_email_field/widgets.py#L14-L22 |
ElementAI/greensim | greensim/__init__.py | pause | def pause() -> None:
"""
Pauses the current process indefinitely -- it will require another process to `resume()` it. When this resumption
happens, the process returns from this function.
"""
if _logger is not None:
_log(INFO, "Process", local.name, "pause")
Process.current().rsim()._gr.... | python | def pause() -> None:
"""
Pauses the current process indefinitely -- it will require another process to `resume()` it. When this resumption
happens, the process returns from this function.
"""
if _logger is not None:
_log(INFO, "Process", local.name, "pause")
Process.current().rsim()._gr.... | [
"def",
"pause",
"(",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"_log",
"(",
"INFO",
",",
"\"Process\"",
",",
"local",
".",
"name",
",",
"\"pause\"",
")",
"Process",
".",
"current",
"(",
")",
".",
"rsim",
"(",
")",
".",
"_... | Pauses the current process indefinitely -- it will require another process to `resume()` it. When this resumption
happens, the process returns from this function. | [
"Pauses",
"the",
"current",
"process",
"indefinitely",
"--",
"it",
"will",
"require",
"another",
"process",
"to",
"resume",
"()",
"it",
".",
"When",
"this",
"resumption",
"happens",
"the",
"process",
"returns",
"from",
"this",
"function",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L552-L559 |
ElementAI/greensim | greensim/__init__.py | advance | def advance(delay: float) -> None:
"""
Pauses the current process for the given delay (in simulated time). The process will be resumed when the simulation
has advanced to the moment corresponding to `now() + delay`.
"""
if _logger is not None:
_log(INFO, "Process", local.name, "advance", del... | python | def advance(delay: float) -> None:
"""
Pauses the current process for the given delay (in simulated time). The process will be resumed when the simulation
has advanced to the moment corresponding to `now() + delay`.
"""
if _logger is not None:
_log(INFO, "Process", local.name, "advance", del... | [
"def",
"advance",
"(",
"delay",
":",
"float",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"_log",
"(",
"INFO",
",",
"\"Process\"",
",",
"local",
".",
"name",
",",
"\"advance\"",
",",
"delay",
"=",
"delay",
")",
"curr",
"=",
"... | Pauses the current process for the given delay (in simulated time). The process will be resumed when the simulation
has advanced to the moment corresponding to `now() + delay`. | [
"Pauses",
"the",
"current",
"process",
"for",
"the",
"given",
"delay",
"(",
"in",
"simulated",
"time",
")",
".",
"The",
"process",
"will",
"be",
"resumed",
"when",
"the",
"simulation",
"has",
"advanced",
"to",
"the",
"moment",
"corresponding",
"to",
"now",
... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L562-L577 |
ElementAI/greensim | greensim/__init__.py | happens | def happens(intervals: Iterable[float], name: Optional[str] = None) -> Callable:
"""
Decorator used to set up a process that adds a new instance of another process at intervals dictated by the given
sequence (which may be infinite).
Example: the following program runs process named `my_process` 5 times... | python | def happens(intervals: Iterable[float], name: Optional[str] = None) -> Callable:
"""
Decorator used to set up a process that adds a new instance of another process at intervals dictated by the given
sequence (which may be infinite).
Example: the following program runs process named `my_process` 5 times... | [
"def",
"happens",
"(",
"intervals",
":",
"Iterable",
"[",
"float",
"]",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Callable",
":",
"def",
"hook",
"(",
"event",
":",
"Callable",
")",
":",
"def",
"make_happen",
"(",
"*",
... | Decorator used to set up a process that adds a new instance of another process at intervals dictated by the given
sequence (which may be infinite).
Example: the following program runs process named `my_process` 5 times, each time spaced by 2.0 time units.
```
from itertools import repeat
sim = Si... | [
"Decorator",
"used",
"to",
"set",
"up",
"a",
"process",
"that",
"adds",
"a",
"new",
"instance",
"of",
"another",
"process",
"at",
"intervals",
"dictated",
"by",
"the",
"given",
"sequence",
"(",
"which",
"may",
"be",
"infinite",
")",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L606-L637 |
ElementAI/greensim | greensim/__init__.py | tagged | def tagged(*tags: Tags) -> Callable:
global GREENSIM_TAG_ATTRIBUTE
"""
Decorator for adding a label to the process.
These labels are applied to any child Processes produced by event
"""
def hook(event: Callable):
def wrapper(*args, **kwargs):
event(*args, **kwargs)
se... | python | def tagged(*tags: Tags) -> Callable:
global GREENSIM_TAG_ATTRIBUTE
"""
Decorator for adding a label to the process.
These labels are applied to any child Processes produced by event
"""
def hook(event: Callable):
def wrapper(*args, **kwargs):
event(*args, **kwargs)
se... | [
"def",
"tagged",
"(",
"*",
"tags",
":",
"Tags",
")",
"->",
"Callable",
":",
"global",
"GREENSIM_TAG_ATTRIBUTE",
"def",
"hook",
"(",
"event",
":",
"Callable",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"event",
"(... | Decorator for adding a label to the process.
These labels are applied to any child Processes produced by event | [
"Decorator",
"for",
"adding",
"a",
"label",
"to",
"the",
"process",
".",
"These",
"labels",
"are",
"applied",
"to",
"any",
"child",
"Processes",
"produced",
"by",
"event"
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L640-L651 |
ElementAI/greensim | greensim/__init__.py | select | def select(*signals: Signal, **kwargs) -> List[Signal]:
"""
Allows the current process to wait for multiple concurrent signals. Waits until one of the signals turns on, at
which point this signal is returned.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end o... | python | def select(*signals: Signal, **kwargs) -> List[Signal]:
"""
Allows the current process to wait for multiple concurrent signals. Waits until one of the signals turns on, at
which point this signal is returned.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end o... | [
"def",
"select",
"(",
"*",
"signals",
":",
"Signal",
",",
"*",
"*",
"kwargs",
")",
"->",
"List",
"[",
"Signal",
"]",
":",
"class",
"CleanUp",
"(",
"Interrupt",
")",
":",
"pass",
"timeout",
"=",
"kwargs",
".",
"get",
"(",
"\"timeout\"",
",",
"None",
... | Allows the current process to wait for multiple concurrent signals. Waits until one of the signals turns on, at
which point this signal is returned.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end of which the process times out, and
stops waiting on the set ... | [
"Allows",
"the",
"current",
"process",
"to",
"wait",
"for",
"multiple",
"concurrent",
"signals",
".",
"Waits",
"until",
"one",
"of",
"the",
"signals",
"turns",
"on",
"at",
"which",
"point",
"this",
"signal",
"is",
"returned",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L834-L873 |
ElementAI/greensim | greensim/__init__.py | Simulator.events | def events(self) -> Iterable[Tuple[Optional[float], Callable, Sequence[Any], Mapping[str, Any]]]:
"""
Iterates over scheduled events. Each event is a 4-tuple composed of the moment (on the simulated clock) the
event should execute, the function corresponding to the event, its positional paramete... | python | def events(self) -> Iterable[Tuple[Optional[float], Callable, Sequence[Any], Mapping[str, Any]]]:
"""
Iterates over scheduled events. Each event is a 4-tuple composed of the moment (on the simulated clock) the
event should execute, the function corresponding to the event, its positional paramete... | [
"def",
"events",
"(",
"self",
")",
"->",
"Iterable",
"[",
"Tuple",
"[",
"Optional",
"[",
"float",
"]",
",",
"Callable",
",",
"Sequence",
"[",
"Any",
"]",
",",
"Mapping",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
":",
"return",
"(",
"(",
"event",
"."... | Iterates over scheduled events. Each event is a 4-tuple composed of the moment (on the simulated clock) the
event should execute, the function corresponding to the event, its positional parameters (as a tuple of
arbitrary length), and its keyword parameters (as a dictionary). | [
"Iterates",
"over",
"scheduled",
"events",
".",
"Each",
"event",
"is",
"a",
"4",
"-",
"tuple",
"composed",
"of",
"the",
"moment",
"(",
"on",
"the",
"simulated",
"clock",
")",
"the",
"event",
"should",
"execute",
"the",
"function",
"corresponding",
"to",
"t... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L220-L230 |
ElementAI/greensim | greensim/__init__.py | Simulator._schedule | def _schedule(self, delay: float, event: Callable, *args: Any, **kwargs: Any) -> int:
"""
Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator
time, so delay is expected to be a positive simulation time interval. The `event' parameter c... | python | def _schedule(self, delay: float, event: Callable, *args: Any, **kwargs: Any) -> int:
"""
Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator
time, so delay is expected to be a positive simulation time interval. The `event' parameter c... | [
"def",
"_schedule",
"(",
"self",
",",
"delay",
":",
"float",
",",
"event",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"int",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
... | Schedules a one-time event to be run along the simulation. The event is scheduled relative to current simulator
time, so delay is expected to be a positive simulation time interval. The `event' parameter corresponds to a
callable object (e.g. a function): it will be called so as to "execute" the event,... | [
"Schedules",
"a",
"one",
"-",
"time",
"event",
"to",
"be",
"run",
"along",
"the",
"simulation",
".",
"The",
"event",
"is",
"scheduled",
"relative",
"to",
"current",
"simulator",
"time",
"so",
"delay",
"is",
"expected",
"to",
"be",
"a",
"positive",
"simulat... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L232-L266 |
ElementAI/greensim | greensim/__init__.py | Simulator._cancel | def _cancel(self, id_cancel) -> None:
"""
Cancels a previously scheduled event. This method is private, and is meant for internal usage by the
:py:class:`Simulator` and :py:class:`Process` classes, and helper functions of this module.
"""
if _logger is not None:
self.... | python | def _cancel(self, id_cancel) -> None:
"""
Cancels a previously scheduled event. This method is private, and is meant for internal usage by the
:py:class:`Simulator` and :py:class:`Process` classes, and helper functions of this module.
"""
if _logger is not None:
self.... | [
"def",
"_cancel",
"(",
"self",
",",
"id_cancel",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"DEBUG",
",",
"\"cancel\"",
",",
"id",
"=",
"id_cancel",
")",
"for",
"event",
"in",
"self",
".",
"_events",
... | Cancels a previously scheduled event. This method is private, and is meant for internal usage by the
:py:class:`Simulator` and :py:class:`Process` classes, and helper functions of this module. | [
"Cancels",
"a",
"previously",
"scheduled",
"event",
".",
"This",
"method",
"is",
"private",
"and",
"is",
"meant",
"for",
"internal",
"usage",
"by",
"the",
":",
"py",
":",
"class",
":",
"Simulator",
"and",
":",
"py",
":",
"class",
":",
"Process",
"classes... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L268-L278 |
ElementAI/greensim | greensim/__init__.py | Simulator.add | def add(self, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation. The process is embodied by a function, which will be called with the given
positional and keyword parameters when the simulation runs. As a process, this function runs on a special ... | python | def add(self, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation. The process is embodied by a function, which will be called with the given
positional and keyword parameters when the simulation runs. As a process, this function runs on a special ... | [
"def",
"add",
"(",
"self",
",",
"fn_process",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"'Process'",
":",
"return",
"self",
".",
"add_in",
"(",
"0.0",
",",
"fn_process",
",",
"*",
"args",
",",
... | Adds a process to the simulation. The process is embodied by a function, which will be called with the given
positional and keyword parameters when the simulation runs. As a process, this function runs on a special green
thread, and thus will be able to call functions `now()`, `advance()`, `pause()` and... | [
"Adds",
"a",
"process",
"to",
"the",
"simulation",
".",
"The",
"process",
"is",
"embodied",
"by",
"a",
"function",
"which",
"will",
"be",
"called",
"with",
"the",
"given",
"positional",
"and",
"keyword",
"parameters",
"when",
"the",
"simulation",
"runs",
"."... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L280-L287 |
ElementAI/greensim | greensim/__init__.py | Simulator.add_in | def add_in(self, delay: float, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation, which is made to start after the given delay in simulated time.
See method add() for more details.
"""
process = Process(self, fn_process, self._gr... | python | def add_in(self, delay: float, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation, which is made to start after the given delay in simulated time.
See method add() for more details.
"""
process = Process(self, fn_process, self._gr... | [
"def",
"add_in",
"(",
"self",
",",
"delay",
":",
"float",
",",
"fn_process",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"'Process'",
":",
"process",
"=",
"Process",
"(",
"self",
",",
"fn_process",
... | Adds a process to the simulation, which is made to start after the given delay in simulated time.
See method add() for more details. | [
"Adds",
"a",
"process",
"to",
"the",
"simulation",
"which",
"is",
"made",
"to",
"start",
"after",
"the",
"given",
"delay",
"in",
"simulated",
"time",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L289-L299 |
ElementAI/greensim | greensim/__init__.py | Simulator.add_at | def add_at(self, moment: float, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation, which is made to start at the given exact time on the simulated clock. Note
that times in the past when compared to the current moment on the simulated clock are f... | python | def add_at(self, moment: float, fn_process: Callable, *args: Any, **kwargs: Any) -> 'Process':
"""
Adds a process to the simulation, which is made to start at the given exact time on the simulated clock. Note
that times in the past when compared to the current moment on the simulated clock are f... | [
"def",
"add_at",
"(",
"self",
",",
"moment",
":",
"float",
",",
"fn_process",
":",
"Callable",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"'Process'",
":",
"delay",
"=",
"moment",
"-",
"self",
".",
"now",
"(",
"... | Adds a process to the simulation, which is made to start at the given exact time on the simulated clock. Note
that times in the past when compared to the current moment on the simulated clock are forbidden.
See method add() for more details. | [
"Adds",
"a",
"process",
"to",
"the",
"simulation",
"which",
"is",
"made",
"to",
"start",
"at",
"the",
"given",
"exact",
"time",
"on",
"the",
"simulated",
"clock",
".",
"Note",
"that",
"times",
"in",
"the",
"past",
"when",
"compared",
"to",
"the",
"curren... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L301-L313 |
ElementAI/greensim | greensim/__init__.py | Simulator.run | def run(self, duration: float = inf) -> None:
"""
Runs the simulation until a stopping condition is met (no more events, or an event invokes method stop()), or
until the simulated clock hits the given duration.
"""
if _logger is not None:
self._log(INFO, "run", __now=... | python | def run(self, duration: float = inf) -> None:
"""
Runs the simulation until a stopping condition is met (no more events, or an event invokes method stop()), or
until the simulated clock hits the given duration.
"""
if _logger is not None:
self._log(INFO, "run", __now=... | [
"def",
"run",
"(",
"self",
",",
"duration",
":",
"float",
"=",
"inf",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"\"run\"",
",",
"__now",
"=",
"self",
".",
"now",
"(",
")",
",",
"du... | Runs the simulation until a stopping condition is met (no more events, or an event invokes method stop()), or
until the simulated clock hits the given duration. | [
"Runs",
"the",
"simulation",
"until",
"a",
"stopping",
"condition",
"is",
"met",
"(",
"no",
"more",
"events",
"or",
"an",
"event",
"invokes",
"method",
"stop",
"()",
")",
"or",
"until",
"the",
"simulated",
"clock",
"hits",
"the",
"given",
"duration",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L315-L346 |
ElementAI/greensim | greensim/__init__.py | Simulator.step | def step(self) -> None:
"""
Runs a single event of the simulation.
"""
event = heappop(self._events)
self._ts_now = event.timestamp or self._ts_now
event.execute(self) | python | def step(self) -> None:
"""
Runs a single event of the simulation.
"""
event = heappop(self._events)
self._ts_now = event.timestamp or self._ts_now
event.execute(self) | [
"def",
"step",
"(",
"self",
")",
"->",
"None",
":",
"event",
"=",
"heappop",
"(",
"self",
".",
"_events",
")",
"self",
".",
"_ts_now",
"=",
"event",
".",
"timestamp",
"or",
"self",
".",
"_ts_now",
"event",
".",
"execute",
"(",
"self",
")"
] | Runs a single event of the simulation. | [
"Runs",
"a",
"single",
"event",
"of",
"the",
"simulation",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L348-L354 |
ElementAI/greensim | greensim/__init__.py | Simulator.stop | def stop(self) -> None:
"""
Stops the running simulation once the current event is done executing.
"""
if self.is_running:
if _logger is not None:
self._log(INFO, "stop", __now=self.now())
self._is_running = False | python | def stop(self) -> None:
"""
Stops the running simulation once the current event is done executing.
"""
if self.is_running:
if _logger is not None:
self._log(INFO, "stop", __now=self.now())
self._is_running = False | [
"def",
"stop",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"is_running",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"\"stop\"",
",",
"__now",
"=",
"self",
".",
"now",
"(",
")",
")",
"self",
... | Stops the running simulation once the current event is done executing. | [
"Stops",
"the",
"running",
"simulation",
"once",
"the",
"current",
"event",
"is",
"done",
"executing",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L356-L363 |
ElementAI/greensim | greensim/__init__.py | Simulator._clear | def _clear(self) -> None:
"""
Resets the internal state of the simulator, and sets the simulated clock back to 0.0. This discards all
outstanding events and tears down hanging process instances.
"""
for _, event, _, _ in self.events():
if hasattr(event, "__self__") an... | python | def _clear(self) -> None:
"""
Resets the internal state of the simulator, and sets the simulated clock back to 0.0. This discards all
outstanding events and tears down hanging process instances.
"""
for _, event, _, _ in self.events():
if hasattr(event, "__self__") an... | [
"def",
"_clear",
"(",
"self",
")",
"->",
"None",
":",
"for",
"_",
",",
"event",
",",
"_",
",",
"_",
"in",
"self",
".",
"events",
"(",
")",
":",
"if",
"hasattr",
"(",
"event",
",",
"\"__self__\"",
")",
"and",
"isinstance",
"(",
"event",
".",
"__se... | Resets the internal state of the simulator, and sets the simulated clock back to 0.0. This discards all
outstanding events and tears down hanging process instances. | [
"Resets",
"the",
"internal",
"state",
"of",
"the",
"simulator",
"and",
"sets",
"the",
"simulated",
"clock",
"back",
"to",
"0",
".",
"0",
".",
"This",
"discards",
"all",
"outstanding",
"events",
"and",
"tears",
"down",
"hanging",
"process",
"instances",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L372-L381 |
ElementAI/greensim | greensim/__init__.py | Process._run | def _run(self, *args: Any, **kwargs: Any) -> None:
"""
Wraps around the process body (the function that implements a process within the simulation) so as to catch the
eventual Interrupt that may terminate the process.
"""
try:
self._body(*args, **kwargs)
i... | python | def _run(self, *args: Any, **kwargs: Any) -> None:
"""
Wraps around the process body (the function that implements a process within the simulation) so as to catch the
eventual Interrupt that may terminate the process.
"""
try:
self._body(*args, **kwargs)
i... | [
"def",
"_run",
"(",
"self",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"try",
":",
"self",
".",
"_body",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"_logger",
"is",
"not",
"None",
":"... | Wraps around the process body (the function that implements a process within the simulation) so as to catch the
eventual Interrupt that may terminate the process. | [
"Wraps",
"around",
"the",
"process",
"body",
"(",
"the",
"function",
"that",
"implements",
"a",
"process",
"within",
"the",
"simulation",
")",
"so",
"as",
"to",
"catch",
"the",
"eventual",
"Interrupt",
"that",
"may",
"terminate",
"the",
"process",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L467-L478 |
ElementAI/greensim | greensim/__init__.py | Process._bind_and_call_constructor | def _bind_and_call_constructor(self, t: type, *args) -> None:
"""
Accesses the __init__ method of a type directly and calls it with *args
This allows the constructors of both superclasses to be called, as described in get_binding.md
This could be done using two calls to super() with a ... | python | def _bind_and_call_constructor(self, t: type, *args) -> None:
"""
Accesses the __init__ method of a type directly and calls it with *args
This allows the constructors of both superclasses to be called, as described in get_binding.md
This could be done using two calls to super() with a ... | [
"def",
"_bind_and_call_constructor",
"(",
"self",
",",
"t",
":",
"type",
",",
"*",
"args",
")",
"->",
"None",
":",
"t",
".",
"__init__",
".",
"__get__",
"(",
"self",
")",
"(",
"*",
"args",
")"
] | Accesses the __init__ method of a type directly and calls it with *args
This allows the constructors of both superclasses to be called, as described in get_binding.md
This could be done using two calls to super() with a hack based on how Python searches __mro__:
```
super().__init__(r... | [
"Accesses",
"the",
"__init__",
"method",
"of",
"a",
"type",
"directly",
"and",
"calls",
"it",
"with",
"*",
"args"
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L480-L500 |
ElementAI/greensim | greensim/__init__.py | Process.current | def current() -> 'Process':
"""
Returns the instance of the process that is executing at the current moment.
"""
curr = greenlet.getcurrent()
if not isinstance(curr, Process):
raise TypeError("Current greenlet does not correspond to a Process instance.")
retur... | python | def current() -> 'Process':
"""
Returns the instance of the process that is executing at the current moment.
"""
curr = greenlet.getcurrent()
if not isinstance(curr, Process):
raise TypeError("Current greenlet does not correspond to a Process instance.")
retur... | [
"def",
"current",
"(",
")",
"->",
"'Process'",
":",
"curr",
"=",
"greenlet",
".",
"getcurrent",
"(",
")",
"if",
"not",
"isinstance",
"(",
"curr",
",",
"Process",
")",
":",
"raise",
"TypeError",
"(",
"\"Current greenlet does not correspond to a Process instance.\""... | Returns the instance of the process that is executing at the current moment. | [
"Returns",
"the",
"instance",
"of",
"the",
"process",
"that",
"is",
"executing",
"at",
"the",
"current",
"moment",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L503-L510 |
ElementAI/greensim | greensim/__init__.py | Process.resume | def resume(self) -> None:
"""
Resumes a process that has been previously paused by invoking function `pause()`. This does not interrupt the
current process or event: it merely schedules again the target process, so that its execution carries on at the
return of the `pause()` function, wh... | python | def resume(self) -> None:
"""
Resumes a process that has been previously paused by invoking function `pause()`. This does not interrupt the
current process or event: it merely schedules again the target process, so that its execution carries on at the
return of the `pause()` function, wh... | [
"def",
"resume",
"(",
"self",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"_log",
"(",
"INFO",
",",
"\"Process\"",
",",
"self",
".",
"local",
".",
"name",
",",
"\"resume\"",
")",
"self",
".",
"rsim",
"(",
")",
".",
"_schedule... | Resumes a process that has been previously paused by invoking function `pause()`. This does not interrupt the
current process or event: it merely schedules again the target process, so that its execution carries on at the
return of the `pause()` function, when this new wake-up event fires. | [
"Resumes",
"a",
"process",
"that",
"has",
"been",
"previously",
"paused",
"by",
"invoking",
"function",
"pause",
"()",
".",
"This",
"does",
"not",
"interrupt",
"the",
"current",
"process",
"or",
"event",
":",
"it",
"merely",
"schedules",
"again",
"the",
"tar... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L519-L527 |
ElementAI/greensim | greensim/__init__.py | Process.interrupt | def interrupt(self, inter: Optional[Interrupt] = None) -> None:
"""
Interrupts a process that has been previously :py:meth:`pause`d or made to :py:meth:`advance`, by resuming it
immediately and raising an :py:class:`Interrupt` exception on it. This exception can be captured by the
interr... | python | def interrupt(self, inter: Optional[Interrupt] = None) -> None:
"""
Interrupts a process that has been previously :py:meth:`pause`d or made to :py:meth:`advance`, by resuming it
immediately and raising an :py:class:`Interrupt` exception on it. This exception can be captured by the
interr... | [
"def",
"interrupt",
"(",
"self",
",",
"inter",
":",
"Optional",
"[",
"Interrupt",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"inter",
"is",
"None",
":",
"inter",
"=",
"Interrupt",
"(",
")",
"if",
"_logger",
"is",
"not",
"None",
":",
"_log",
"(... | Interrupts a process that has been previously :py:meth:`pause`d or made to :py:meth:`advance`, by resuming it
immediately and raising an :py:class:`Interrupt` exception on it. This exception can be captured by the
interrupted process and leveraged for various purposes, such as timing out on a wait or ge... | [
"Interrupts",
"a",
"process",
"that",
"has",
"been",
"previously",
":",
"py",
":",
"meth",
":",
"pause",
"d",
"or",
"made",
"to",
":",
"py",
":",
"meth",
":",
"advance",
"by",
"resuming",
"it",
"immediately",
"and",
"raising",
"an",
":",
"py",
":",
"... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L529-L549 |
ElementAI/greensim | greensim/__init__.py | Queue.join | def join(self, timeout: Optional[float] = None):
"""
Can be invoked only by a process: makes it join the queue. The order token is computed once for the process,
before it is enqueued. Another process or event, or control code of some sort, must invoke method `pop()` of the
queue so that... | python | def join(self, timeout: Optional[float] = None):
"""
Can be invoked only by a process: makes it join the queue. The order token is computed once for the process,
before it is enqueued. Another process or event, or control code of some sort, must invoke method `pop()` of the
queue so that... | [
"def",
"join",
"(",
"self",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
":",
"class",
"CancelBalk",
"(",
"Interrupt",
")",
":",
"pass",
"self",
".",
"_counter",
"+=",
"1",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
... | Can be invoked only by a process: makes it join the queue. The order token is computed once for the process,
before it is enqueued. Another process or event, or control code of some sort, must invoke method `pop()` of the
queue so that the process can eventually leave the queue and carry on with its exe... | [
"Can",
"be",
"invoked",
"only",
"by",
"a",
"process",
":",
"makes",
"it",
"join",
"the",
"queue",
".",
"The",
"order",
"token",
"is",
"computed",
"once",
"for",
"the",
"process",
"before",
"it",
"is",
"enqueued",
".",
"Another",
"process",
"or",
"event",... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L705-L761 |
ElementAI/greensim | greensim/__init__.py | Queue.pop | def pop(self):
"""
Removes the top process from the queue, and resumes its execution. For an empty queue, this method is a no-op.
This method may be invoked from anywhere (its use is not confined to processes, as method `join()` is).
"""
if not self.is_empty():
_, pro... | python | def pop(self):
"""
Removes the top process from the queue, and resumes its execution. For an empty queue, this method is a no-op.
This method may be invoked from anywhere (its use is not confined to processes, as method `join()` is).
"""
if not self.is_empty():
_, pro... | [
"def",
"pop",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_empty",
"(",
")",
":",
"_",
",",
"process",
"=",
"heappop",
"(",
"self",
".",
"_waiting",
")",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
... | Removes the top process from the queue, and resumes its execution. For an empty queue, this method is a no-op.
This method may be invoked from anywhere (its use is not confined to processes, as method `join()` is). | [
"Removes",
"the",
"top",
"process",
"from",
"the",
"queue",
"and",
"resumes",
"its",
"execution",
".",
"For",
"an",
"empty",
"queue",
"this",
"method",
"is",
"a",
"no",
"-",
"op",
".",
"This",
"method",
"may",
"be",
"invoked",
"from",
"anywhere",
"(",
... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L763-L772 |
ElementAI/greensim | greensim/__init__.py | Signal.turn_on | def turn_on(self) -> "Signal":
"""
Turns on the signal. If processes are waiting, they are all resumed. This may be invoked from any code.
Remark that while processes are simultaneously resumed in simulated time, they are effectively resumed in the
sequence corresponding to the queue di... | python | def turn_on(self) -> "Signal":
"""
Turns on the signal. If processes are waiting, they are all resumed. This may be invoked from any code.
Remark that while processes are simultaneously resumed in simulated time, they are effectively resumed in the
sequence corresponding to the queue di... | [
"def",
"turn_on",
"(",
"self",
")",
"->",
"\"Signal\"",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"\"turn-on\"",
")",
"self",
".",
"_is_on",
"=",
"True",
"while",
"not",
"self",
".",
"_queue",
".",
"is_emp... | Turns on the signal. If processes are waiting, they are all resumed. This may be invoked from any code.
Remark that while processes are simultaneously resumed in simulated time, they are effectively resumed in the
sequence corresponding to the queue discipline. Therefore, if one of the resumed processe... | [
"Turns",
"on",
"the",
"signal",
".",
"If",
"processes",
"are",
"waiting",
"they",
"are",
"all",
"resumed",
".",
"This",
"may",
"be",
"invoked",
"from",
"any",
"code",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L794-L808 |
ElementAI/greensim | greensim/__init__.py | Signal.turn_off | def turn_off(self) -> "Signal":
"""
Turns off the signal. This may be invoked from any code.
"""
if _logger is not None:
self._log(INFO, "turn-off")
self._is_on = False
return self | python | def turn_off(self) -> "Signal":
"""
Turns off the signal. This may be invoked from any code.
"""
if _logger is not None:
self._log(INFO, "turn-off")
self._is_on = False
return self | [
"def",
"turn_off",
"(",
"self",
")",
"->",
"\"Signal\"",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"\"turn-off\"",
")",
"self",
".",
"_is_on",
"=",
"False",
"return",
"self"
] | Turns off the signal. This may be invoked from any code. | [
"Turns",
"off",
"the",
"signal",
".",
"This",
"may",
"be",
"invoked",
"from",
"any",
"code",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L810-L817 |
ElementAI/greensim | greensim/__init__.py | Signal.wait | def wait(self, timeout: Optional[float] = None) -> None:
"""
Makes the current process wait for the signal. If it is closed, it will join the signal's queue.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end of which the process times out, and
... | python | def wait(self, timeout: Optional[float] = None) -> None:
"""
Makes the current process wait for the signal. If it is closed, it will join the signal's queue.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end of which the process times out, and
... | [
"def",
"wait",
"(",
"self",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"_logger",
"is",
"not",
"None",
":",
"self",
".",
"_log",
"(",
"INFO",
",",
"\"wait\"",
")",
"while",
"not",
"self",
".",
"... | Makes the current process wait for the signal. If it is closed, it will join the signal's queue.
:param timeout:
If this parameter is not ``None``, it is taken as a delay at the end of which the process times out, and
stops waiting for the :py:class:`Signal`. In such a situation, a :py:... | [
"Makes",
"the",
"current",
"process",
"wait",
"for",
"the",
"signal",
".",
"If",
"it",
"is",
"closed",
"it",
"will",
"join",
"the",
"signal",
"s",
"queue",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L819-L831 |
ElementAI/greensim | greensim/__init__.py | Resource.take | def take(self, num_instances: int = 1, timeout: Optional[float] = None) -> None:
"""
The current process reserves a certain number of instances. If there are not enough instances available, the
process is made to join a queue. When this method returns, the process holds the instances it has requ... | python | def take(self, num_instances: int = 1, timeout: Optional[float] = None) -> None:
"""
The current process reserves a certain number of instances. If there are not enough instances available, the
process is made to join a queue. When this method returns, the process holds the instances it has requ... | [
"def",
"take",
"(",
"self",
",",
"num_instances",
":",
"int",
"=",
"1",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
"->",
"None",
":",
"if",
"num_instances",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"f\"Process must request at... | The current process reserves a certain number of instances. If there are not enough instances available, the
process is made to join a queue. When this method returns, the process holds the instances it has requested to
take.
:param num_instances:
Number of resource instances to tak... | [
"The",
"current",
"process",
"reserves",
"a",
"certain",
"number",
"of",
"instances",
".",
"If",
"there",
"are",
"not",
"enough",
"instances",
"available",
"the",
"process",
"is",
"made",
"to",
"join",
"a",
"queue",
".",
"When",
"this",
"method",
"returns",
... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L912-L944 |
ElementAI/greensim | greensim/__init__.py | Resource.release | def release(self, num_instances: int = 1) -> None:
"""
The current process releases instances it has previously taken. It may thus release less than it has taken.
These released instances become free. If the total number of free instances then satisfy the request of the top
process of th... | python | def release(self, num_instances: int = 1) -> None:
"""
The current process releases instances it has previously taken. It may thus release less than it has taken.
These released instances become free. If the total number of free instances then satisfy the request of the top
process of th... | [
"def",
"release",
"(",
"self",
",",
"num_instances",
":",
"int",
"=",
"1",
")",
"->",
"None",
":",
"proc",
"=",
"Process",
".",
"current",
"(",
")",
"error_format",
"=",
"\"Process %s holds %s instances, but requests to release more (%s)\"",
"if",
"self",
".",
"... | The current process releases instances it has previously taken. It may thus release less than it has taken.
These released instances become free. If the total number of free instances then satisfy the request of the top
process of the waiting queue, it is popped off the queue and resumed. | [
"The",
"current",
"process",
"releases",
"instances",
"it",
"has",
"previously",
"taken",
".",
"It",
"may",
"thus",
"release",
"less",
"than",
"it",
"has",
"taken",
".",
"These",
"released",
"instances",
"become",
"free",
".",
"If",
"the",
"total",
"number",... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L946-L982 |
ElementAI/greensim | greensim/__init__.py | Resource.using | def using(self, num_instances: int = 1, timeout: Optional[float] = None):
"""
Context manager around resource reservation: when the code block under the with statement is entered, the
current process holds the instances it requested. When it exits, all these instances are released.
Do n... | python | def using(self, num_instances: int = 1, timeout: Optional[float] = None):
"""
Context manager around resource reservation: when the code block under the with statement is entered, the
current process holds the instances it requested. When it exits, all these instances are released.
Do n... | [
"def",
"using",
"(",
"self",
",",
"num_instances",
":",
"int",
"=",
"1",
",",
"timeout",
":",
"Optional",
"[",
"float",
"]",
"=",
"None",
")",
":",
"self",
".",
"take",
"(",
"num_instances",
",",
"timeout",
")",
"yield",
"self",
"self",
".",
"release... | Context manager around resource reservation: when the code block under the with statement is entered, the
current process holds the instances it requested. When it exits, all these instances are released.
Do not explicitly `release()` instances within the context block, at the risk of breaking instance... | [
"Context",
"manager",
"around",
"resource",
"reservation",
":",
"when",
"the",
"code",
"block",
"under",
"the",
"with",
"statement",
"is",
"entered",
"the",
"current",
"process",
"holds",
"the",
"instances",
"it",
"requested",
".",
"When",
"it",
"exits",
"all"... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/__init__.py#L985-L1001 |
ElementAI/greensim | greensim/progress.py | capture_print | def capture_print(file_dest_maybe: Optional[IO] = None):
"""Progress capture that writes updated metrics to an interactive terminal."""
file_dest: IO = file_dest_maybe or sys.stderr
def _print_progress(progress_min: float, rt_remaining: float, _mc: MeasureComparison) -> None:
nonlocal file_dest
... | python | def capture_print(file_dest_maybe: Optional[IO] = None):
"""Progress capture that writes updated metrics to an interactive terminal."""
file_dest: IO = file_dest_maybe or sys.stderr
def _print_progress(progress_min: float, rt_remaining: float, _mc: MeasureComparison) -> None:
nonlocal file_dest
... | [
"def",
"capture_print",
"(",
"file_dest_maybe",
":",
"Optional",
"[",
"IO",
"]",
"=",
"None",
")",
":",
"file_dest",
":",
"IO",
"=",
"file_dest_maybe",
"or",
"sys",
".",
"stderr",
"def",
"_print_progress",
"(",
"progress_min",
":",
"float",
",",
"rt_remainin... | Progress capture that writes updated metrics to an interactive terminal. | [
"Progress",
"capture",
"that",
"writes",
"updated",
"metrics",
"to",
"an",
"interactive",
"terminal",
"."
] | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/progress.py#L28-L42 |
ElementAI/greensim | greensim/progress.py | track_progress | def track_progress(
measure: MeasureProgress,
target: MetricProgress,
interval_check: float,
capture_maybe: Optional[CaptureProgress] = None
) -> None:
"""
Tracks progress against a certain end condition of the simulation (for instance, a certain duration on the simulated
clock), reporting t... | python | def track_progress(
measure: MeasureProgress,
target: MetricProgress,
interval_check: float,
capture_maybe: Optional[CaptureProgress] = None
) -> None:
"""
Tracks progress against a certain end condition of the simulation (for instance, a certain duration on the simulated
clock), reporting t... | [
"def",
"track_progress",
"(",
"measure",
":",
"MeasureProgress",
",",
"target",
":",
"MetricProgress",
",",
"interval_check",
":",
"float",
",",
"capture_maybe",
":",
"Optional",
"[",
"CaptureProgress",
"]",
"=",
"None",
")",
"->",
"None",
":",
"def",
"measure... | Tracks progress against a certain end condition of the simulation (for instance, a certain duration on the simulated
clock), reporting this progress as the simulation chugs along. Stops the simulation once the target has been
reached. By default, the progress is reported as printout on standard output, in a man... | [
"Tracks",
"progress",
"against",
"a",
"certain",
"end",
"condition",
"of",
"the",
"simulation",
"(",
"for",
"instance",
"a",
"certain",
"duration",
"on",
"the",
"simulated",
"clock",
")",
"reporting",
"this",
"progress",
"as",
"the",
"simulation",
"chugs",
"al... | train | https://github.com/ElementAI/greensim/blob/f160e8b57d69f6ef469f2e991cc07b7721e08a91/greensim/progress.py#L49-L84 |
libnano/primer3-py | primer3/wrappers.py | calcTm | def calcTm(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
max_nn_length=60, tm_method='santalucia',
salt_corrections_method='santalucia'):
''' Return the tm of `seq` as a float.
'''
tm_meth = _tm_methods.get(tm_method)
if tm_meth is None:
raise ValueError('{} is no... | python | def calcTm(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
max_nn_length=60, tm_method='santalucia',
salt_corrections_method='santalucia'):
''' Return the tm of `seq` as a float.
'''
tm_meth = _tm_methods.get(tm_method)
if tm_meth is None:
raise ValueError('{} is no... | [
"def",
"calcTm",
"(",
"seq",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"max_nn_length",
"=",
"60",
",",
"tm_method",
"=",
"'santalucia'",
",",
"salt_corrections_method",
"=",
"'san... | Return the tm of `seq` as a float. | [
"Return",
"the",
"tm",
"of",
"seq",
"as",
"a",
"float",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L70-L94 |
libnano/primer3-py | primer3/wrappers.py | _parse_ntthal | def _parse_ntthal(ntthal_output):
''' Helper method that uses regex to parse ntthal output. '''
parsed_vals = re.search(_ntthal_re, ntthal_output)
return THERMORESULT(
True, # Structure found
float(parsed_vals.group(1)), # dS
float(parsed_vals.group(2)), ... | python | def _parse_ntthal(ntthal_output):
''' Helper method that uses regex to parse ntthal output. '''
parsed_vals = re.search(_ntthal_re, ntthal_output)
return THERMORESULT(
True, # Structure found
float(parsed_vals.group(1)), # dS
float(parsed_vals.group(2)), ... | [
"def",
"_parse_ntthal",
"(",
"ntthal_output",
")",
":",
"parsed_vals",
"=",
"re",
".",
"search",
"(",
"_ntthal_re",
",",
"ntthal_output",
")",
"return",
"THERMORESULT",
"(",
"True",
",",
"# Structure found",
"float",
"(",
"parsed_vals",
".",
"group",
"(",
"1",... | Helper method that uses regex to parse ntthal output. | [
"Helper",
"method",
"that",
"uses",
"regex",
"to",
"parse",
"ntthal",
"output",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L110-L119 |
libnano/primer3-py | primer3/wrappers.py | calcThermo | def calcThermo(seq1, seq2, calc_type='ANY', mv_conc=50, dv_conc=0,
dntp_conc=0.8, dna_conc=50, temp_c=37, max_loop=30,
temp_only=False):
""" Main subprocess wrapper for calls to the ntthal executable.
Returns a named tuple with tm, ds, dh, and dg values or None if no
struc... | python | def calcThermo(seq1, seq2, calc_type='ANY', mv_conc=50, dv_conc=0,
dntp_conc=0.8, dna_conc=50, temp_c=37, max_loop=30,
temp_only=False):
""" Main subprocess wrapper for calls to the ntthal executable.
Returns a named tuple with tm, ds, dh, and dg values or None if no
struc... | [
"def",
"calcThermo",
"(",
"seq1",
",",
"seq2",
",",
"calc_type",
"=",
"'ANY'",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"temp_c",
"=",
"37",
",",
"max_loop",
"=",
"30",
",",... | Main subprocess wrapper for calls to the ntthal executable.
Returns a named tuple with tm, ds, dh, and dg values or None if no
structure / complex could be computed. | [
"Main",
"subprocess",
"wrapper",
"for",
"calls",
"to",
"the",
"ntthal",
"executable",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L122-L145 |
libnano/primer3-py | primer3/wrappers.py | calcHairpin | def calcHairpin(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
temp_c=37, max_loop=30, temp_only=False):
''' Return a namedtuple of the dS, dH, dG, and Tm of any hairpin struct
present.
'''
return calcThermo(seq, seq, 'HAIRPIN', mv_conc, dv_conc, dntp_conc,
... | python | def calcHairpin(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
temp_c=37, max_loop=30, temp_only=False):
''' Return a namedtuple of the dS, dH, dG, and Tm of any hairpin struct
present.
'''
return calcThermo(seq, seq, 'HAIRPIN', mv_conc, dv_conc, dntp_conc,
... | [
"def",
"calcHairpin",
"(",
"seq",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"temp_c",
"=",
"37",
",",
"max_loop",
"=",
"30",
",",
"temp_only",
"=",
"False",
")",
":",
"return... | Return a namedtuple of the dS, dH, dG, and Tm of any hairpin struct
present. | [
"Return",
"a",
"namedtuple",
"of",
"the",
"dS",
"dH",
"dG",
"and",
"Tm",
"of",
"any",
"hairpin",
"struct",
"present",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L148-L154 |
libnano/primer3-py | primer3/wrappers.py | calcHeterodimer | def calcHeterodimer(seq1, seq2, mv_conc=50, dv_conc=0, dntp_conc=0.8,
dna_conc=50, temp_c=37, max_loop=30, temp_only=False):
''' Return a tuple of the dS, dH, dG, and Tm of any predicted heterodimer.
'''
return calcThermo(seq1, seq2, 'ANY', mv_conc, dv_conc, dntp_conc,
... | python | def calcHeterodimer(seq1, seq2, mv_conc=50, dv_conc=0, dntp_conc=0.8,
dna_conc=50, temp_c=37, max_loop=30, temp_only=False):
''' Return a tuple of the dS, dH, dG, and Tm of any predicted heterodimer.
'''
return calcThermo(seq1, seq2, 'ANY', mv_conc, dv_conc, dntp_conc,
... | [
"def",
"calcHeterodimer",
"(",
"seq1",
",",
"seq2",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"temp_c",
"=",
"37",
",",
"max_loop",
"=",
"30",
",",
"temp_only",
"=",
"False",
... | Return a tuple of the dS, dH, dG, and Tm of any predicted heterodimer. | [
"Return",
"a",
"tuple",
"of",
"the",
"dS",
"dH",
"dG",
"and",
"Tm",
"of",
"any",
"predicted",
"heterodimer",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L157-L162 |
libnano/primer3-py | primer3/wrappers.py | assessOligo | def assessOligo(seq):
'''
Return the thermodynamic characteristics of hairpin/homodimer structures.
Returns a tuple of namedtuples (hairpin data, homodimer data) in which each
individual tuple is structured (dS, dH, dG, Tm).
'''
hairpin_out = calcHairpin(seq)
homodimer_out = calcHomodimer(... | python | def assessOligo(seq):
'''
Return the thermodynamic characteristics of hairpin/homodimer structures.
Returns a tuple of namedtuples (hairpin data, homodimer data) in which each
individual tuple is structured (dS, dH, dG, Tm).
'''
hairpin_out = calcHairpin(seq)
homodimer_out = calcHomodimer(... | [
"def",
"assessOligo",
"(",
"seq",
")",
":",
"hairpin_out",
"=",
"calcHairpin",
"(",
"seq",
")",
"homodimer_out",
"=",
"calcHomodimer",
"(",
"seq",
")",
"return",
"(",
"hairpin_out",
",",
"homodimer_out",
")"
] | Return the thermodynamic characteristics of hairpin/homodimer structures.
Returns a tuple of namedtuples (hairpin data, homodimer data) in which each
individual tuple is structured (dS, dH, dG, Tm). | [
"Return",
"the",
"thermodynamic",
"characteristics",
"of",
"hairpin",
"/",
"homodimer",
"structures",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L181-L191 |
libnano/primer3-py | primer3/wrappers.py | designPrimers | def designPrimers(p3_args, input_log=None, output_log=None, err_log=None):
''' Return the raw primer3_core output for the provided primer3 args.
Returns an ordered dict of the boulderIO-format primer3 output file
'''
sp = subprocess.Popen([pjoin(PRIMER3_HOME, 'primer3_core')],
... | python | def designPrimers(p3_args, input_log=None, output_log=None, err_log=None):
''' Return the raw primer3_core output for the provided primer3 args.
Returns an ordered dict of the boulderIO-format primer3 output file
'''
sp = subprocess.Popen([pjoin(PRIMER3_HOME, 'primer3_core')],
... | [
"def",
"designPrimers",
"(",
"p3_args",
",",
"input_log",
"=",
"None",
",",
"output_log",
"=",
"None",
",",
"err_log",
"=",
"None",
")",
":",
"sp",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"pjoin",
"(",
"PRIMER3_HOME",
",",
"'primer3_core'",
")",
"]",
... | Return the raw primer3_core output for the provided primer3 args.
Returns an ordered dict of the boulderIO-format primer3 output file | [
"Return",
"the",
"raw",
"primer3_core",
"output",
"for",
"the",
"provided",
"primer3",
"args",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/wrappers.py#L263-L284 |
libnano/primer3-py | setup.py | makeExecutable | def makeExecutable(fp):
''' Adds the executable bit to the file at filepath `fp`
'''
mode = ((os.stat(fp).st_mode) | 0o555) & 0o7777
setup_log.info("Adding executable bit to %s (mode is now %o)", fp, mode)
os.chmod(fp, mode) | python | def makeExecutable(fp):
''' Adds the executable bit to the file at filepath `fp`
'''
mode = ((os.stat(fp).st_mode) | 0o555) & 0o7777
setup_log.info("Adding executable bit to %s (mode is now %o)", fp, mode)
os.chmod(fp, mode) | [
"def",
"makeExecutable",
"(",
"fp",
")",
":",
"mode",
"=",
"(",
"(",
"os",
".",
"stat",
"(",
"fp",
")",
".",
"st_mode",
")",
"|",
"0o555",
")",
"&",
"0o7777",
"setup_log",
".",
"info",
"(",
"\"Adding executable bit to %s (mode is now %o)\"",
",",
"fp",
"... | Adds the executable bit to the file at filepath `fp` | [
"Adds",
"the",
"executable",
"bit",
"to",
"the",
"file",
"at",
"filepath",
"fp"
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/setup.py#L111-L116 |
libnano/primer3-py | primer3/bindings.py | calcHairpin | def calcHairpin(seq, mv_conc=50.0, dv_conc=0.0, dntp_conc=0.8, dna_conc=50.0,
temp_c=37, max_loop=30):
''' Calculate the hairpin formation thermodynamics of a DNA sequence.
**Note that the maximum length of `seq` is 60 bp.** This is a cap suggested
by the Primer3 team as the longest reasona... | python | def calcHairpin(seq, mv_conc=50.0, dv_conc=0.0, dntp_conc=0.8, dna_conc=50.0,
temp_c=37, max_loop=30):
''' Calculate the hairpin formation thermodynamics of a DNA sequence.
**Note that the maximum length of `seq` is 60 bp.** This is a cap suggested
by the Primer3 team as the longest reasona... | [
"def",
"calcHairpin",
"(",
"seq",
",",
"mv_conc",
"=",
"50.0",
",",
"dv_conc",
"=",
"0.0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50.0",
",",
"temp_c",
"=",
"37",
",",
"max_loop",
"=",
"30",
")",
":",
"_setThermoArgs",
"(",
"*",
"*",
... | Calculate the hairpin formation thermodynamics of a DNA sequence.
**Note that the maximum length of `seq` is 60 bp.** This is a cap suggested
by the Primer3 team as the longest reasonable sequence length for which
a two-state NN model produces reliable results (see primer3/src/libnano/thal.h:50).
Args... | [
"Calculate",
"the",
"hairpin",
"formation",
"thermodynamics",
"of",
"a",
"DNA",
"sequence",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/bindings.py#L70-L97 |
libnano/primer3-py | primer3/bindings.py | calcEndStability | def calcEndStability(seq1, seq2, mv_conc=50, dv_conc=0, dntp_conc=0.8,
dna_conc=50, temp_c=37, max_loop=30):
''' Calculate the 3' end stability of DNA sequence `seq1` against DNA
sequence `seq2`.
**Note that at least one of the two sequences must by <60 bp in length.**
This is a ca... | python | def calcEndStability(seq1, seq2, mv_conc=50, dv_conc=0, dntp_conc=0.8,
dna_conc=50, temp_c=37, max_loop=30):
''' Calculate the 3' end stability of DNA sequence `seq1` against DNA
sequence `seq2`.
**Note that at least one of the two sequences must by <60 bp in length.**
This is a ca... | [
"def",
"calcEndStability",
"(",
"seq1",
",",
"seq2",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"temp_c",
"=",
"37",
",",
"max_loop",
"=",
"30",
")",
":",
"_setThermoArgs",
"(",... | Calculate the 3' end stability of DNA sequence `seq1` against DNA
sequence `seq2`.
**Note that at least one of the two sequences must by <60 bp in length.**
This is a cap imposed by Primer3 as the longest reasonable sequence length
for which a two-state NN model produces reliable results (see
prime... | [
"Calculate",
"the",
"3",
"end",
"stability",
"of",
"DNA",
"sequence",
"seq1",
"against",
"DNA",
"sequence",
"seq2",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/bindings.py#L167-L201 |
libnano/primer3-py | primer3/bindings.py | calcTm | def calcTm(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
max_nn_length=60, tm_method='santalucia',
salt_corrections_method='santalucia'):
''' Calculate the melting temperature (Tm) of a DNA sequence.
Note that NN thermodynamics will be used to calculate the Tm of sequences
u... | python | def calcTm(seq, mv_conc=50, dv_conc=0, dntp_conc=0.8, dna_conc=50,
max_nn_length=60, tm_method='santalucia',
salt_corrections_method='santalucia'):
''' Calculate the melting temperature (Tm) of a DNA sequence.
Note that NN thermodynamics will be used to calculate the Tm of sequences
u... | [
"def",
"calcTm",
"(",
"seq",
",",
"mv_conc",
"=",
"50",
",",
"dv_conc",
"=",
"0",
",",
"dntp_conc",
"=",
"0.8",
",",
"dna_conc",
"=",
"50",
",",
"max_nn_length",
"=",
"60",
",",
"tm_method",
"=",
"'santalucia'",
",",
"salt_corrections_method",
"=",
"'san... | Calculate the melting temperature (Tm) of a DNA sequence.
Note that NN thermodynamics will be used to calculate the Tm of sequences
up to 60 bp in length, after which point the following formula will be
used::
Tm = 81.5 + 16.6(log10([mv_conc])) + 0.41(%GC) - 600/length
Args:
seq (str)... | [
"Calculate",
"the",
"melting",
"temperature",
"(",
"Tm",
")",
"of",
"a",
"DNA",
"sequence",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/bindings.py#L204-L234 |
libnano/primer3-py | primer3/bindings.py | designPrimers | def designPrimers(seq_args, global_args=None, misprime_lib=None,
mishyb_lib=None, debug=False):
''' Run the Primer3 design process.
If the global args have been previously set (either by a pervious
`designPrimers` call or by a `setGlobals` call), `designPrimers` may be
called with seq... | python | def designPrimers(seq_args, global_args=None, misprime_lib=None,
mishyb_lib=None, debug=False):
''' Run the Primer3 design process.
If the global args have been previously set (either by a pervious
`designPrimers` call or by a `setGlobals` call), `designPrimers` may be
called with seq... | [
"def",
"designPrimers",
"(",
"seq_args",
",",
"global_args",
"=",
"None",
",",
"misprime_lib",
"=",
"None",
",",
"mishyb_lib",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"if",
"global_args",
":",
"primerdesign",
".",
"setGlobals",
"(",
"global_args",... | Run the Primer3 design process.
If the global args have been previously set (either by a pervious
`designPrimers` call or by a `setGlobals` call), `designPrimers` may be
called with seqArgs alone (as a means of optimization).
Args:
seq_args (dict) : Primer3 sequence/design args a... | [
"Run",
"the",
"Primer3",
"design",
"process",
"."
] | train | https://github.com/libnano/primer3-py/blob/0901c0ef3ac17afd69329d23db71136c00bcb635/primer3/bindings.py#L246-L272 |
mitodl/PyLmod | pylmod/gradebook.py | GradeBook.unravel_sections | def unravel_sections(section_data):
"""Unravels section type dictionary into flat list of sections with
section type set as an attribute.
Args:
section_data(dict): Data return from py:method::get_sections
Returns:
list: Flat list of sections with ``sectionType``... | python | def unravel_sections(section_data):
"""Unravels section type dictionary into flat list of sections with
section type set as an attribute.
Args:
section_data(dict): Data return from py:method::get_sections
Returns:
list: Flat list of sections with ``sectionType``... | [
"def",
"unravel_sections",
"(",
"section_data",
")",
":",
"sections",
"=",
"[",
"]",
"for",
"type",
",",
"subsection_list",
"in",
"section_data",
".",
"items",
"(",
")",
":",
"for",
"section",
"in",
"subsection_list",
":",
"section",
"[",
"'sectionType'",
"]... | Unravels section type dictionary into flat list of sections with
section type set as an attribute.
Args:
section_data(dict): Data return from py:method::get_sections
Returns:
list: Flat list of sections with ``sectionType`` set to
type (i.e. recitation, ... | [
"Unravels",
"section",
"type",
"dictionary",
"into",
"flat",
"list",
"of",
"sections",
"with",
"section",
"type",
"set",
"as",
"an",
"attribute",
"."
] | train | https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L64-L80 |
mitodl/PyLmod | pylmod/gradebook.py | GradeBook.unravel_staff | def unravel_staff(staff_data):
"""Unravels staff role dictionary into flat list of staff
members with ``role`` set as an attribute.
Args:
staff_data(dict): Data return from py:method::get_staff
Returns:
list: Flat list of staff members with ``role`` set to
... | python | def unravel_staff(staff_data):
"""Unravels staff role dictionary into flat list of staff
members with ``role`` set as an attribute.
Args:
staff_data(dict): Data return from py:method::get_staff
Returns:
list: Flat list of staff members with ``role`` set to
... | [
"def",
"unravel_staff",
"(",
"staff_data",
")",
":",
"staff_list",
"=",
"[",
"]",
"for",
"role",
",",
"staff_members",
"in",
"staff_data",
"[",
"'data'",
"]",
".",
"items",
"(",
")",
":",
"for",
"member",
"in",
"staff_members",
":",
"member",
"[",
"'role... | Unravels staff role dictionary into flat list of staff
members with ``role`` set as an attribute.
Args:
staff_data(dict): Data return from py:method::get_staff
Returns:
list: Flat list of staff members with ``role`` set to
role type (i.e. course_admin, ... | [
"Unravels",
"staff",
"role",
"dictionary",
"into",
"flat",
"list",
"of",
"staff",
"members",
"with",
"role",
"set",
"as",
"an",
"attribute",
"."
] | train | https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L83-L99 |
mitodl/PyLmod | pylmod/gradebook.py | GradeBook.get_gradebook_id | def get_gradebook_id(self, gbuuid):
"""Return gradebookid for a given gradebook uuid.
Args:
gbuuid (str): gradebook uuid, i.e. ``STELLAR:/project/gbngtest``
Raises:
PyLmodUnexpectedData: No gradebook id returned
requests.RequestException: Exception connectio... | python | def get_gradebook_id(self, gbuuid):
"""Return gradebookid for a given gradebook uuid.
Args:
gbuuid (str): gradebook uuid, i.e. ``STELLAR:/project/gbngtest``
Raises:
PyLmodUnexpectedData: No gradebook id returned
requests.RequestException: Exception connectio... | [
"def",
"get_gradebook_id",
"(",
"self",
",",
"gbuuid",
")",
":",
"gradebook",
"=",
"self",
".",
"get",
"(",
"'gradebook'",
",",
"params",
"=",
"{",
"'uuid'",
":",
"gbuuid",
"}",
")",
"if",
"'data'",
"not",
"in",
"gradebook",
":",
"failure_messsage",
"=",... | Return gradebookid for a given gradebook uuid.
Args:
gbuuid (str): gradebook uuid, i.e. ``STELLAR:/project/gbngtest``
Raises:
PyLmodUnexpectedData: No gradebook id returned
requests.RequestException: Exception connection error
ValueError: Unable to decod... | [
"Return",
"gradebookid",
"for",
"a",
"given",
"gradebook",
"uuid",
"."
] | train | https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L101-L123 |
mitodl/PyLmod | pylmod/gradebook.py | GradeBook.get_options | def get_options(self, gradebook_id):
"""Get options for gradebook.
Get options dictionary for a gradebook. Options include gradebook
attributes.
Args:
gradebook_id (str): unique identifier for gradebook, i.e. ``2314``
Returns:
An example return value ... | python | def get_options(self, gradebook_id):
"""Get options for gradebook.
Get options dictionary for a gradebook. Options include gradebook
attributes.
Args:
gradebook_id (str): unique identifier for gradebook, i.e. ``2314``
Returns:
An example return value ... | [
"def",
"get_options",
"(",
"self",
",",
"gradebook_id",
")",
":",
"end_point",
"=",
"'gradebook/options/{gradebookId}'",
".",
"format",
"(",
"gradebookId",
"=",
"gradebook_id",
"or",
"self",
".",
"gradebook_id",
")",
"options",
"=",
"self",
".",
"get",
"(",
"e... | Get options for gradebook.
Get options dictionary for a gradebook. Options include gradebook
attributes.
Args:
gradebook_id (str): unique identifier for gradebook, i.e. ``2314``
Returns:
An example return value is:
.. code-block:: python
... | [
"Get",
"options",
"for",
"gradebook",
"."
] | train | https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L125-L181 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.