repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
nvictus/priority-queue-dictionary | pqdict/__init__.py | pqdict.pushpopitem | def pushpopitem(self, key, value, node_factory=_Node):
"""
Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict.
"""
heap = self._heap
position = self._position
... | python | def pushpopitem(self, key, value, node_factory=_Node):
"""
Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict.
"""
heap = self._heap
position = self._position
... | [
"def",
"pushpopitem",
"(",
"self",
",",
"key",
",",
"value",
",",
"node_factory",
"=",
"_Node",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"precedes",
"=",
"self",
".",
"_precedes",
"prio",
"=",
"self",
".",... | Equivalent to inserting a new item followed by removing the top
priority item, but faster. Raises ``KeyError`` if the new key is
already in the pqdict. | [
"Equivalent",
"to",
"inserting",
"a",
"new",
"item",
"followed",
"by",
"removing",
"the",
"top",
"priority",
"item",
"but",
"faster",
".",
"Raises",
"KeyError",
"if",
"the",
"new",
"key",
"is",
"already",
"in",
"the",
"pqdict",
"."
] | 577f9d3086058bec0e49cc2050dd9454b788d93b | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L305-L324 | train |
nvictus/priority-queue-dictionary | pqdict/__init__.py | pqdict.updateitem | def updateitem(self, key, new_val):
"""
Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict.
"""
if key not in self._position:
raise KeyError(key)
self[key] = new_val | python | def updateitem(self, key, new_val):
"""
Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict.
"""
if key not in self._position:
raise KeyError(key)
self[key] = new_val | [
"def",
"updateitem",
"(",
"self",
",",
"key",
",",
"new_val",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_position",
":",
"raise",
"KeyError",
"(",
"key",
")",
"self",
"[",
"key",
"]",
"=",
"new_val"
] | Update the priority value of an existing item. Raises ``KeyError`` if
key is not in the pqdict. | [
"Update",
"the",
"priority",
"value",
"of",
"an",
"existing",
"item",
".",
"Raises",
"KeyError",
"if",
"key",
"is",
"not",
"in",
"the",
"pqdict",
"."
] | 577f9d3086058bec0e49cc2050dd9454b788d93b | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L326-L334 | train |
nvictus/priority-queue-dictionary | pqdict/__init__.py | pqdict.replace_key | def replace_key(self, key, new_key):
"""
Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict.
"""
heap = self._heap
position = self._position
if new_key in ... | python | def replace_key(self, key, new_key):
"""
Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict.
"""
heap = self._heap
position = self._position
if new_key in ... | [
"def",
"replace_key",
"(",
"self",
",",
"key",
",",
"new_key",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"if",
"new_key",
"in",
"self",
":",
"raise",
"KeyError",
"(",
"'%s is already in the queue'",
"%",
"repr"... | Replace the key of an existing heap node in place. Raises ``KeyError``
if the key to replace does not exist or if the new key is already in
the pqdict. | [
"Replace",
"the",
"key",
"of",
"an",
"existing",
"heap",
"node",
"in",
"place",
".",
"Raises",
"KeyError",
"if",
"the",
"key",
"to",
"replace",
"does",
"not",
"exist",
"or",
"if",
"the",
"new",
"key",
"is",
"already",
"in",
"the",
"pqdict",
"."
] | 577f9d3086058bec0e49cc2050dd9454b788d93b | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L336-L349 | train |
nvictus/priority-queue-dictionary | pqdict/__init__.py | pqdict.swap_priority | def swap_priority(self, key1, key2):
"""
Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist.
"""
heap = self._heap
position = self._position
if key1 not in self or key2 not in self:
raise K... | python | def swap_priority(self, key1, key2):
"""
Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist.
"""
heap = self._heap
position = self._position
if key1 not in self or key2 not in self:
raise K... | [
"def",
"swap_priority",
"(",
"self",
",",
"key1",
",",
"key2",
")",
":",
"heap",
"=",
"self",
".",
"_heap",
"position",
"=",
"self",
".",
"_position",
"if",
"key1",
"not",
"in",
"self",
"or",
"key2",
"not",
"in",
"self",
":",
"raise",
"KeyError",
"po... | Fast way to swap the priority level of two items in the pqdict. Raises
``KeyError`` if either key does not exist. | [
"Fast",
"way",
"to",
"swap",
"the",
"priority",
"level",
"of",
"two",
"items",
"in",
"the",
"pqdict",
".",
"Raises",
"KeyError",
"if",
"either",
"key",
"does",
"not",
"exist",
"."
] | 577f9d3086058bec0e49cc2050dd9454b788d93b | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L351-L363 | train |
nvictus/priority-queue-dictionary | pqdict/__init__.py | pqdict.heapify | def heapify(self, key=__marker):
"""
Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``.
"""
if key is self.__marker:
n = len(self._heap)
for pos in reversed(range(n//2)):
... | python | def heapify(self, key=__marker):
"""
Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``.
"""
if key is self.__marker:
n = len(self._heap)
for pos in reversed(range(n//2)):
... | [
"def",
"heapify",
"(",
"self",
",",
"key",
"=",
"__marker",
")",
":",
"if",
"key",
"is",
"self",
".",
"__marker",
":",
"n",
"=",
"len",
"(",
"self",
".",
"_heap",
")",
"for",
"pos",
"in",
"reversed",
"(",
"range",
"(",
"n",
"//",
"2",
")",
")",... | Repair a broken heap. If the state of an item's priority value changes
you can re-sort the relevant item only by providing ``key``. | [
"Repair",
"a",
"broken",
"heap",
".",
"If",
"the",
"state",
"of",
"an",
"item",
"s",
"priority",
"value",
"changes",
"you",
"can",
"re",
"-",
"sort",
"the",
"relevant",
"item",
"only",
"by",
"providing",
"key",
"."
] | 577f9d3086058bec0e49cc2050dd9454b788d93b | https://github.com/nvictus/priority-queue-dictionary/blob/577f9d3086058bec0e49cc2050dd9454b788d93b/pqdict/__init__.py#L398-L413 | train |
ajk8/hatchery | hatchery/project.py | package_has_version_file | def package_has_version_file(package_name):
""" Check to make sure _version.py is contained in the package """
version_file_path = helpers.package_file_path('_version.py', package_name)
return os.path.isfile(version_file_path) | python | def package_has_version_file(package_name):
""" Check to make sure _version.py is contained in the package """
version_file_path = helpers.package_file_path('_version.py', package_name)
return os.path.isfile(version_file_path) | [
"def",
"package_has_version_file",
"(",
"package_name",
")",
":",
"version_file_path",
"=",
"helpers",
".",
"package_file_path",
"(",
"'_version.py'",
",",
"package_name",
")",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"version_file_path",
")"
] | Check to make sure _version.py is contained in the package | [
"Check",
"to",
"make",
"sure",
"_version",
".",
"py",
"is",
"contained",
"in",
"the",
"package"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L45-L48 | train |
ajk8/hatchery | hatchery/project.py | get_project_name | def get_project_name():
""" Grab the project name out of setup.py """
setup_py_content = helpers.get_file_content('setup.py')
ret = helpers.value_of_named_argument_in_function(
'name', 'setup', setup_py_content, resolve_varname=True
)
if ret and ret[0] == ret[-1] in ('"', "'"):
ret =... | python | def get_project_name():
""" Grab the project name out of setup.py """
setup_py_content = helpers.get_file_content('setup.py')
ret = helpers.value_of_named_argument_in_function(
'name', 'setup', setup_py_content, resolve_varname=True
)
if ret and ret[0] == ret[-1] in ('"', "'"):
ret =... | [
"def",
"get_project_name",
"(",
")",
":",
"setup_py_content",
"=",
"helpers",
".",
"get_file_content",
"(",
"'setup.py'",
")",
"ret",
"=",
"helpers",
".",
"value_of_named_argument_in_function",
"(",
"'name'",
",",
"'setup'",
",",
"setup_py_content",
",",
"resolve_va... | Grab the project name out of setup.py | [
"Grab",
"the",
"project",
"name",
"out",
"of",
"setup",
".",
"py"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L78-L86 | train |
ajk8/hatchery | hatchery/project.py | get_version | def get_version(package_name, ignore_cache=False):
""" Get the version which is currently configured by the package """
if ignore_cache:
with microcache.temporarily_disabled():
found = helpers.regex_in_package_file(
VERSION_SET_REGEX, '_version.py', package_name, return_match... | python | def get_version(package_name, ignore_cache=False):
""" Get the version which is currently configured by the package """
if ignore_cache:
with microcache.temporarily_disabled():
found = helpers.regex_in_package_file(
VERSION_SET_REGEX, '_version.py', package_name, return_match... | [
"def",
"get_version",
"(",
"package_name",
",",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"ignore_cache",
":",
"with",
"microcache",
".",
"temporarily_disabled",
"(",
")",
":",
"found",
"=",
"helpers",
".",
"regex_in_package_file",
"(",
"VERSION_SET_REGEX",
... | Get the version which is currently configured by the package | [
"Get",
"the",
"version",
"which",
"is",
"currently",
"configured",
"by",
"the",
"package"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L89-L103 | train |
ajk8/hatchery | hatchery/project.py | set_version | def set_version(package_name, version_str):
""" Set the version in _version.py to version_str """
current_version = get_version(package_name)
version_file_path = helpers.package_file_path('_version.py', package_name)
version_file_content = helpers.get_file_content(version_file_path)
version_file_con... | python | def set_version(package_name, version_str):
""" Set the version in _version.py to version_str """
current_version = get_version(package_name)
version_file_path = helpers.package_file_path('_version.py', package_name)
version_file_content = helpers.get_file_content(version_file_path)
version_file_con... | [
"def",
"set_version",
"(",
"package_name",
",",
"version_str",
")",
":",
"current_version",
"=",
"get_version",
"(",
"package_name",
")",
"version_file_path",
"=",
"helpers",
".",
"package_file_path",
"(",
"'_version.py'",
",",
"package_name",
")",
"version_file_conte... | Set the version in _version.py to version_str | [
"Set",
"the",
"version",
"in",
"_version",
".",
"py",
"to",
"version_str"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L106-L113 | train |
ajk8/hatchery | hatchery/project.py | version_is_valid | def version_is_valid(version_str):
""" Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True
"""
try:
packaging.version.Version(version_str)
except packaging.version.InvalidVers... | python | def version_is_valid(version_str):
""" Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True
"""
try:
packaging.version.Version(version_str)
except packaging.version.InvalidVers... | [
"def",
"version_is_valid",
"(",
"version_str",
")",
":",
"try",
":",
"packaging",
".",
"version",
".",
"Version",
"(",
"version_str",
")",
"except",
"packaging",
".",
"version",
".",
"InvalidVersion",
":",
"return",
"False",
"return",
"True"
] | Check to see if the version specified is a valid as far as pkg_resources is concerned
>>> version_is_valid('blah')
False
>>> version_is_valid('1.2.3')
True | [
"Check",
"to",
"see",
"if",
"the",
"version",
"specified",
"is",
"a",
"valid",
"as",
"far",
"as",
"pkg_resources",
"is",
"concerned"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L116-L128 | train |
ajk8/hatchery | hatchery/project.py | _get_uploaded_versions_warehouse | def _get_uploaded_versions_warehouse(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using warehouse api to find all of the "releases" """
url = '/'.join((index_url, project_name, 'json'))
response = requests.get(url, verify=requests_verify)
if response.status_code ... | python | def _get_uploaded_versions_warehouse(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using warehouse api to find all of the "releases" """
url = '/'.join((index_url, project_name, 'json'))
response = requests.get(url, verify=requests_verify)
if response.status_code ... | [
"def",
"_get_uploaded_versions_warehouse",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"url",
"=",
"'/'",
".",
"join",
"(",
"(",
"index_url",
",",
"project_name",
",",
"'json'",
")",
")",
"response",
"=",
"requests",
... | Query the pypi index at index_url using warehouse api to find all of the "releases" | [
"Query",
"the",
"pypi",
"index",
"at",
"index_url",
"using",
"warehouse",
"api",
"to",
"find",
"all",
"of",
"the",
"releases"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L131-L137 | train |
ajk8/hatchery | hatchery/project.py | _get_uploaded_versions_pypicloud | def _get_uploaded_versions_pypicloud(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using pypicloud api to find all versions """
api_url = index_url
for suffix in ('/pypi', '/pypi/', '/simple', '/simple/'):
if api_url.endswith(suffix):
api_url = api... | python | def _get_uploaded_versions_pypicloud(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using pypicloud api to find all versions """
api_url = index_url
for suffix in ('/pypi', '/pypi/', '/simple', '/simple/'):
if api_url.endswith(suffix):
api_url = api... | [
"def",
"_get_uploaded_versions_pypicloud",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"api_url",
"=",
"index_url",
"for",
"suffix",
"in",
"(",
"'/pypi'",
",",
"'/pypi/'",
",",
"'/simple'",
",",
"'/simple/'",
")",
":",
... | Query the pypi index at index_url using pypicloud api to find all versions | [
"Query",
"the",
"pypi",
"index",
"at",
"index_url",
"using",
"pypicloud",
"api",
"to",
"find",
"all",
"versions"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L140-L151 | train |
ajk8/hatchery | hatchery/project.py | version_already_uploaded | def version_already_uploaded(project_name, version_str, index_url, requests_verify=True):
""" Check to see if the version specified has already been uploaded to the configured index
"""
all_versions = _get_uploaded_versions(project_name, index_url, requests_verify)
return version_str in all_versions | python | def version_already_uploaded(project_name, version_str, index_url, requests_verify=True):
""" Check to see if the version specified has already been uploaded to the configured index
"""
all_versions = _get_uploaded_versions(project_name, index_url, requests_verify)
return version_str in all_versions | [
"def",
"version_already_uploaded",
"(",
"project_name",
",",
"version_str",
",",
"index_url",
",",
"requests_verify",
"=",
"True",
")",
":",
"all_versions",
"=",
"_get_uploaded_versions",
"(",
"project_name",
",",
"index_url",
",",
"requests_verify",
")",
"return",
... | Check to see if the version specified has already been uploaded to the configured index | [
"Check",
"to",
"see",
"if",
"the",
"version",
"specified",
"has",
"already",
"been",
"uploaded",
"to",
"the",
"configured",
"index"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L168-L172 | train |
ajk8/hatchery | hatchery/project.py | convert_readme_to_rst | def convert_readme_to_rst():
""" Attempt to convert a README.md file into README.rst """
project_files = os.listdir('.')
for filename in project_files:
if filename.lower() == 'readme':
raise ProjectError(
'found {} in project directory...'.format(filename) +
... | python | def convert_readme_to_rst():
""" Attempt to convert a README.md file into README.rst """
project_files = os.listdir('.')
for filename in project_files:
if filename.lower() == 'readme':
raise ProjectError(
'found {} in project directory...'.format(filename) +
... | [
"def",
"convert_readme_to_rst",
"(",
")",
":",
"project_files",
"=",
"os",
".",
"listdir",
"(",
"'.'",
")",
"for",
"filename",
"in",
"project_files",
":",
"if",
"filename",
".",
"lower",
"(",
")",
"==",
"'readme'",
":",
"raise",
"ProjectError",
"(",
"'foun... | Attempt to convert a README.md file into README.rst | [
"Attempt",
"to",
"convert",
"a",
"README",
".",
"md",
"file",
"into",
"README",
".",
"rst"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L208-L235 | train |
ajk8/hatchery | hatchery/project.py | get_packaged_files | def get_packaged_files(package_name):
""" Collect relative paths to all files which have already been packaged """
if not os.path.isdir('dist'):
return []
return [os.path.join('dist', filename) for filename in os.listdir('dist')] | python | def get_packaged_files(package_name):
""" Collect relative paths to all files which have already been packaged """
if not os.path.isdir('dist'):
return []
return [os.path.join('dist', filename) for filename in os.listdir('dist')] | [
"def",
"get_packaged_files",
"(",
"package_name",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"'dist'",
")",
":",
"return",
"[",
"]",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"'dist'",
",",
"filename",
")",
"for",
"filenam... | Collect relative paths to all files which have already been packaged | [
"Collect",
"relative",
"paths",
"to",
"all",
"files",
"which",
"have",
"already",
"been",
"packaged"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L238-L242 | train |
ajk8/hatchery | hatchery/project.py | multiple_packaged_versions | def multiple_packaged_versions(package_name):
""" Look through built package directory and see if there are multiple versions there """
dist_files = os.listdir('dist')
versions = set()
for filename in dist_files:
version = funcy.re_find(r'{}-(.+).tar.gz'.format(package_name), filename)
i... | python | def multiple_packaged_versions(package_name):
""" Look through built package directory and see if there are multiple versions there """
dist_files = os.listdir('dist')
versions = set()
for filename in dist_files:
version = funcy.re_find(r'{}-(.+).tar.gz'.format(package_name), filename)
i... | [
"def",
"multiple_packaged_versions",
"(",
"package_name",
")",
":",
"dist_files",
"=",
"os",
".",
"listdir",
"(",
"'dist'",
")",
"versions",
"=",
"set",
"(",
")",
"for",
"filename",
"in",
"dist_files",
":",
"version",
"=",
"funcy",
".",
"re_find",
"(",
"r'... | Look through built package directory and see if there are multiple versions there | [
"Look",
"through",
"built",
"package",
"directory",
"and",
"see",
"if",
"there",
"are",
"multiple",
"versions",
"there"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/project.py#L245-L253 | train |
djgagne/hagelslag | hagelslag/data/HailForecastGrid.py | HailForecastGrid.period_neighborhood_probability | def period_neighborhood_probability(self, radius, smoothing, threshold, stride,start_time,end_time):
"""
Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother ... | python | def period_neighborhood_probability(self, radius, smoothing, threshold, stride,start_time,end_time):
"""
Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother ... | [
"def",
"period_neighborhood_probability",
"(",
"self",
",",
"radius",
",",
"smoothing",
",",
"threshold",
",",
"stride",
",",
"start_time",
",",
"end_time",
")",
":",
"neighbor_x",
"=",
"self",
".",
"x",
"[",
":",
":",
"stride",
",",
":",
":",
"stride",
... | Calculate the neighborhood probability over the full period of the forecast
Args:
radius: circular radius from each point in km
smoothing: width of Gaussian smoother in km
threshold: intensity of exceedance
stride: number of grid points to skip for reduced neighb... | [
"Calculate",
"the",
"neighborhood",
"probability",
"over",
"the",
"full",
"period",
"of",
"the",
"forecast"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/HailForecastGrid.py#L94-L123 | train |
base4sistemas/satcfe | satcfe/resposta/consultarnumerosessao.py | RespostaConsultarNumeroSessao.analisar | def analisar(retorno):
"""Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``.
"""
if '|' not in retorno:
raise ErroRespostaSATInvalida('Resp... | python | def analisar(retorno):
"""Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``.
"""
if '|' not in retorno:
raise ErroRespostaSATInvalida('Resp... | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"if",
"'|'",
"not",
"in",
"retorno",
":",
"raise",
"ErroRespostaSATInvalida",
"(",
"'Resposta nao possui pipes '",
"'separando os campos: {!r}'",
".",
"format",
"(",
"retorno",
")",
")",
"resposta",
"=",
"_RespostaParcial... | Constrói uma :class:`RespostaSAT` ou especialização dependendo da
função SAT encontrada na sessão consultada.
:param unicode retorno: Retorno da função ``ConsultarNumeroSessao``. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"ou",
"especialização",
"dependendo",
"da",
"função",
"SAT",
"encontrada",
"na",
"sessão",
"consultada",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarnumerosessao.py#L65-L81 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | analisar_retorno | def analisar_retorno(retorno,
classe_resposta=RespostaSAT, campos=RespostaSAT.CAMPOS,
campos_alternativos=[], funcao=None, manter_verbatim=True):
"""Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados ent... | python | def analisar_retorno(retorno,
classe_resposta=RespostaSAT, campos=RespostaSAT.CAMPOS,
campos_alternativos=[], funcao=None, manter_verbatim=True):
"""Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados ent... | [
"def",
"analisar_retorno",
"(",
"retorno",
",",
"classe_resposta",
"=",
"RespostaSAT",
",",
"campos",
"=",
"RespostaSAT",
".",
"CAMPOS",
",",
"campos_alternativos",
"=",
"[",
"]",
",",
"funcao",
"=",
"None",
",",
"manter_verbatim",
"=",
"True",
")",
":",
"if... | Analisa o retorno (supostamente um retorno de uma função do SAT) conforme
o padrão e campos esperados. O retorno deverá possuir dados separados entre
si através de pipes e o número de campos deverá coincidir com os campos
especificados.
O campos devem ser especificados como uma tupla onde cada elemento... | [
"Analisa",
"o",
"retorno",
"(",
"supostamente",
"um",
"retorno",
"de",
"uma",
"função",
"do",
"SAT",
")",
"conforme",
"o",
"padrão",
"e",
"campos",
"esperados",
".",
"O",
"retorno",
"deverá",
"possuir",
"dados",
"separados",
"entre",
"si",
"através",
"de",
... | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L175-L268 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.comunicar_certificado_icpbrasil | def comunicar_certificado_icpbrasil(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ComunicarCertificadoICPB... | python | def comunicar_certificado_icpbrasil(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ComunicarCertificadoICPB... | [
"def",
"comunicar_certificado_icpbrasil",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ComunicarCertificadoICPBRASIL'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'050... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.comunicar_certificado_icpbrasil`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"comunicar_certificado_icpbrasil",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L80-L88 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.consultar_sat | def consultar_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarSAT')
if resposta.EEEEE not in ('08000',):
... | python | def consultar_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarSAT')
if resposta.EEEEE not in ('08000',):
... | [
"def",
"consultar_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConsultarSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'08000'",
",",
")",
":",
"raise... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.consultar_sat`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"consultar_sat",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L92-L100 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.configurar_interface_de_rede | def configurar_interface_de_rede(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConfigurarInterfaceDeRede')
... | python | def configurar_interface_de_rede(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConfigurarInterfaceDeRede')
... | [
"def",
"configurar_interface_de_rede",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConfigurarInterfaceDeRede'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'12000'",
... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.configurar_interface_de_rede`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"configurar_interface_de_rede",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L104-L112 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.associar_assinatura | def associar_assinatura(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AssociarAssinatura')
if resposta.EEEEE n... | python | def associar_assinatura(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AssociarAssinatura')
if resposta.EEEEE n... | [
"def",
"associar_assinatura",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AssociarAssinatura'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'13000'",
",",
")",
"... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.associar_assinatura`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"associar_assinatura",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L116-L124 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.atualizar_software_sat | def atualizar_software_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtualizarSoftwareSAT')
if resposta... | python | def atualizar_software_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='AtualizarSoftwareSAT')
if resposta... | [
"def",
"atualizar_software_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'AtualizarSoftwareSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'14000'",
",",
")"... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.atualizar_software_sat`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"atualizar_software_sat",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L128-L136 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.bloquear_sat | def bloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='BloquearSAT')
if resposta.EEEEE not in ('16000',):
... | python | def bloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='BloquearSAT')
if resposta.EEEEE not in ('16000',):
... | [
"def",
"bloquear_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'BloquearSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'16000'",
",",
")",
":",
"raise",... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.bloquear_sat`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"bloquear_sat",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L140-L148 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.desbloquear_sat | def desbloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='DesbloquearSAT')
if resposta.EEEEE not in ('1700... | python | def desbloquear_sat(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='DesbloquearSAT')
if resposta.EEEEE not in ('1700... | [
"def",
"desbloquear_sat",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'DesbloquearSAT'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'17000'",
",",
")",
":",
"r... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.desbloquear_sat`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"desbloquear_sat",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L152-L160 | train |
base4sistemas/satcfe | satcfe/resposta/padrao.py | RespostaSAT.trocar_codigo_de_ativacao | def trocar_codigo_de_ativacao(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='TrocarCodigoDeAtivacao')
if ... | python | def trocar_codigo_de_ativacao(retorno):
"""Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='TrocarCodigoDeAtivacao')
if ... | [
"def",
"trocar_codigo_de_ativacao",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'TrocarCodigoDeAtivacao'",
")",
"if",
"resposta",
".",
"EEEEE",
"not",
"in",
"(",
"'18000'",
",",
... | Constrói uma :class:`RespostaSAT` para o retorno (unicode) da função
:meth:`~satcfe.base.FuncoesSAT.trocar_codigo_de_ativacao`. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaSAT",
"para",
"o",
"retorno",
"(",
"unicode",
")",
"da",
"função",
":",
"meth",
":",
"~satcfe",
".",
"base",
".",
"FuncoesSAT",
".",
"trocar_codigo_de_ativacao",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/padrao.py#L164-L172 | train |
djgagne/hagelslag | hagelslag/data/ModelOutput.py | ModelOutput.load_data | def load_data(self):
"""
Load the specified variable from the ensemble files, then close the files.
"""
if self.ensemble_name.upper() == "SSEF":
if self.variable[0:2] == "rh":
pressure_level = self.variable[2:]
relh_vars = ["sph", "tmp"]
... | python | def load_data(self):
"""
Load the specified variable from the ensemble files, then close the files.
"""
if self.ensemble_name.upper() == "SSEF":
if self.variable[0:2] == "rh":
pressure_level = self.variable[2:]
relh_vars = ["sph", "tmp"]
... | [
"def",
"load_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"ensemble_name",
".",
"upper",
"(",
")",
"==",
"\"SSEF\"",
":",
"if",
"self",
".",
"variable",
"[",
"0",
":",
"2",
"]",
"==",
"\"rh\"",
":",
"pressure_level",
"=",
"self",
".",
"variable",... | Load the specified variable from the ensemble files, then close the files. | [
"Load",
"the",
"specified",
"variable",
"from",
"the",
"ensemble",
"files",
"then",
"close",
"the",
"files",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelOutput.py#L67-L172 | train |
djgagne/hagelslag | hagelslag/data/ModelOutput.py | ModelOutput.load_map_info | def load_map_info(self, map_file):
"""
Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information.
"""
if self.ensemble_name.upper() == "SSEF":
proj_d... | python | def load_map_info(self, map_file):
"""
Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information.
"""
if self.ensemble_name.upper() == "SSEF":
proj_d... | [
"def",
"load_map_info",
"(",
"self",
",",
"map_file",
")",
":",
"if",
"self",
".",
"ensemble_name",
".",
"upper",
"(",
")",
"==",
"\"SSEF\"",
":",
"proj_dict",
",",
"grid_dict",
"=",
"read_arps_map_file",
"(",
"map_file",
")",
"self",
".",
"dx",
"=",
"in... | Load map projection information and create latitude, longitude, x, y, i, and j grids for the projection.
Args:
map_file: File specifying the projection information. | [
"Load",
"map",
"projection",
"information",
"and",
"create",
"latitude",
"longitude",
"x",
"y",
"i",
"and",
"j",
"grids",
"for",
"the",
"projection",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/ModelOutput.py#L174-L204 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | read_geojson | def read_geojson(filename):
"""
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject
"""
json_file = open(filename)
data = json.load(json_file)
json_fil... | python | def read_geojson(filename):
"""
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject
"""
json_file = open(filename)
data = json.load(json_file)
json_fil... | [
"def",
"read_geojson",
"(",
"filename",
")",
":",
"json_file",
"=",
"open",
"(",
"filename",
")",
"data",
"=",
"json",
".",
"load",
"(",
"json_file",
")",
"json_file",
".",
"close",
"(",
")",
"times",
"=",
"data",
"[",
"\"properties\"",
"]",
"[",
"\"ti... | Reads a geojson file containing an STObject and initializes a new STObject from the information in the file.
Args:
filename: Name of the geojson file
Returns:
an STObject | [
"Reads",
"a",
"geojson",
"file",
"containing",
"an",
"STObject",
"and",
"initializes",
"a",
"new",
"STObject",
"from",
"the",
"information",
"in",
"the",
"file",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L540-L572 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.center_of_mass | def center_of_mass(self, time):
"""
Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass.
"""
if self.start_time <= time <=... | python | def center_of_mass(self, time):
"""
Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass.
"""
if self.start_time <= time <=... | [
"def",
"center_of_mass",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"diff",
"=",
"time",
"-",
"self",
".",
"start_time",
"valid",
"=",
"np",
".",
"flatnonzero",
"(",
"self",
... | Calculate the center of mass at a given timestep.
Args:
time: Time at which the center of mass calculation is performed
Returns:
The x- and y-coordinates of the center of mass. | [
"Calculate",
"the",
"center",
"of",
"mass",
"at",
"a",
"given",
"timestep",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L78-L102 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.trajectory | def trajectory(self):
"""
Calculates the center of mass for each time step and outputs an array
Returns:
"""
traj = np.zeros((2, self.times.size))
for t, time in enumerate(self.times):
traj[:, t] = self.center_of_mass(time)
return traj | python | def trajectory(self):
"""
Calculates the center of mass for each time step and outputs an array
Returns:
"""
traj = np.zeros((2, self.times.size))
for t, time in enumerate(self.times):
traj[:, t] = self.center_of_mass(time)
return traj | [
"def",
"trajectory",
"(",
"self",
")",
":",
"traj",
"=",
"np",
".",
"zeros",
"(",
"(",
"2",
",",
"self",
".",
"times",
".",
"size",
")",
")",
"for",
"t",
",",
"time",
"in",
"enumerate",
"(",
"self",
".",
"times",
")",
":",
"traj",
"[",
":",
"... | Calculates the center of mass for each time step and outputs an array
Returns: | [
"Calculates",
"the",
"center",
"of",
"mass",
"for",
"each",
"time",
"step",
"and",
"outputs",
"an",
"array"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L143-L153 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.get_corner | def get_corner(self, time):
"""
Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner inde... | python | def get_corner(self, time):
"""
Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner inde... | [
"def",
"get_corner",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"diff",
"=",
"time",
"-",
"self",
".",
"start_time",
"return",
"self",
".",
"i",
"[",
"diff",
"]",
"[",
"0",... | Gets the corner array indices of the STObject at a given time that corresponds
to the upper left corner of the bounding box for the STObject.
Args:
time: time at which the corner is being extracted.
Returns:
corner index. | [
"Gets",
"the",
"corner",
"array",
"indices",
"of",
"the",
"STObject",
"at",
"a",
"given",
"time",
"that",
"corresponds",
"to",
"the",
"upper",
"left",
"corner",
"of",
"the",
"bounding",
"box",
"for",
"the",
"STObject",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L155-L170 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.size | def size(self, time):
"""
Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels
"""
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_ti... | python | def size(self, time):
"""
Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels
"""
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_ti... | [
"def",
"size",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"start_time",
"<=",
"time",
"<=",
"self",
".",
"end_time",
":",
"return",
"self",
".",
"masks",
"[",
"time",
"-",
"self",
".",
"start_time",
"]",
".",
"sum",
"(",
")",
"else",
... | Gets the size of the object at a given time.
Args:
time: Time value being queried.
Returns:
size of the object in pixels | [
"Gets",
"the",
"size",
"of",
"the",
"object",
"at",
"a",
"given",
"time",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L172-L185 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.max_size | def max_size(self):
"""
Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels
"""
sizes = np.array([m.sum() for m in self.masks])
return sizes.max() | python | def max_size(self):
"""
Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels
"""
sizes = np.array([m.sum() for m in self.masks])
return sizes.max() | [
"def",
"max_size",
"(",
"self",
")",
":",
"sizes",
"=",
"np",
".",
"array",
"(",
"[",
"m",
".",
"sum",
"(",
")",
"for",
"m",
"in",
"self",
".",
"masks",
"]",
")",
"return",
"sizes",
".",
"max",
"(",
")"
] | Gets the largest size of the object over all timesteps.
Returns:
Maximum size of the object in pixels | [
"Gets",
"the",
"largest",
"size",
"of",
"the",
"object",
"over",
"all",
"timesteps",
".",
"Returns",
":",
"Maximum",
"size",
"of",
"the",
"object",
"in",
"pixels"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L187-L195 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.max_intensity | def max_intensity(self, time):
"""
Calculate the maximum intensity found at a timestep.
"""
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() | python | def max_intensity(self, time):
"""
Calculate the maximum intensity found at a timestep.
"""
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() | [
"def",
"max_intensity",
"(",
"self",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"return",
"self",
".",
"timesteps",
"[",
"ti",
"]",
".",
"max",
"(",
")"
] | Calculate the maximum intensity found at a timestep. | [
"Calculate",
"the",
"maximum",
"intensity",
"found",
"at",
"a",
"timestep",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L197-L203 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.extend | def extend(self, step):
"""
Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time.
"""
self.timesteps.extend(step.timesteps)
self.masks.extend(step.masks)
self.x.extend(step.... | python | def extend(self, step):
"""
Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time.
"""
self.timesteps.extend(step.timesteps)
self.masks.extend(step.masks)
self.x.extend(step.... | [
"def",
"extend",
"(",
"self",
",",
"step",
")",
":",
"self",
".",
"timesteps",
".",
"extend",
"(",
"step",
".",
"timesteps",
")",
"self",
".",
"masks",
".",
"extend",
"(",
"step",
".",
"masks",
")",
"self",
".",
"x",
".",
"extend",
"(",
"step",
"... | Adds the data from another STObject to this object.
Args:
step: another STObject being added after the current one in time. | [
"Adds",
"the",
"data",
"from",
"another",
"STObject",
"to",
"this",
"object",
".",
"Args",
":",
"step",
":",
"another",
"STObject",
"being",
"added",
"after",
"the",
"current",
"one",
"in",
"time",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L205-L224 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.boundary_polygon | def boundary_polygon(self, time):
"""
Get coordinates of object boundary in counter-clockwise order
"""
ti = np.where(time == self.times)[0][0]
com_x, com_y = self.center_of_mass(time)
# If at least one point along perimeter of the mask rectangle is unmasked, find_boundar... | python | def boundary_polygon(self, time):
"""
Get coordinates of object boundary in counter-clockwise order
"""
ti = np.where(time == self.times)[0][0]
com_x, com_y = self.center_of_mass(time)
# If at least one point along perimeter of the mask rectangle is unmasked, find_boundar... | [
"def",
"boundary_polygon",
"(",
"self",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"com_x",
",",
"com_y",
"=",
"self",
".",
"center_of_mass",
"(",
"time",
")",... | Get coordinates of object boundary in counter-clockwise order | [
"Get",
"coordinates",
"of",
"object",
"boundary",
"in",
"counter",
"-",
"clockwise",
"order"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L226-L247 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.estimate_motion | def estimate_motion(self, time, intensity_grid, max_u, max_v):
"""
Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correl... | python | def estimate_motion(self, time, intensity_grid, max_u, max_v):
"""
Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correl... | [
"def",
"estimate_motion",
"(",
"self",
",",
"time",
",",
"intensity_grid",
",",
"max_u",
",",
"max_v",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"mask_vals",
"=",
"np",
".... | Estimate the motion of the object with cross-correlation on the intensity values from the previous time step.
Args:
time: time being evaluated.
intensity_grid: 2D array of intensities used in cross correlation.
max_u: Maximum x-component of motion. Used to limit search area.... | [
"Estimate",
"the",
"motion",
"of",
"the",
"object",
"with",
"cross",
"-",
"correlation",
"on",
"the",
"intensity",
"values",
"from",
"the",
"previous",
"time",
"step",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L249-L293 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.count_overlap | def count_overlap(self, time, other_object, other_time):
"""
Counts the number of points that overlap between this STObject and another STObject. Used for tracking.
"""
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other... | python | def count_overlap(self, time, other_object, other_time):
"""
Counts the number of points that overlap between this STObject and another STObject. Used for tracking.
"""
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other... | [
"def",
"count_overlap",
"(",
"self",
",",
"time",
",",
"other_object",
",",
"other_time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"time",
"==",
"self",
".",
"times",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"(",
"... | Counts the number of points that overlap between this STObject and another STObject. Used for tracking. | [
"Counts",
"the",
"number",
"of",
"points",
"that",
"overlap",
"between",
"this",
"STObject",
"and",
"another",
"STObject",
".",
"Used",
"for",
"tracking",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L295-L310 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.extract_attribute_grid | def extract_attribute_grid(self, model_grid, potential=False, future=False):
"""
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from ... | python | def extract_attribute_grid(self, model_grid, potential=False, future=False):
"""
Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from ... | [
"def",
"extract_attribute_grid",
"(",
"self",
",",
"model_grid",
",",
"potential",
"=",
"False",
",",
"future",
"=",
"False",
")",
":",
"if",
"potential",
":",
"var_name",
"=",
"model_grid",
".",
"variable",
"+",
"\"-potential\"",
"timesteps",
"=",
"np",
"."... | Extracts the data from a ModelOutput or ModelGrid object within the bounding box region of the STObject.
Args:
model_grid: A ModelGrid or ModelOutput Object
potential: Extracts from the time before instead of the same time as the object | [
"Extracts",
"the",
"data",
"from",
"a",
"ModelOutput",
"or",
"ModelGrid",
"object",
"within",
"the",
"bounding",
"box",
"region",
"of",
"the",
"STObject",
".",
"Args",
":",
"model_grid",
":",
"A",
"ModelGrid",
"or",
"ModelOutput",
"Object",
"potential",
":",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L312-L333 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.extract_attribute_array | def extract_attribute_array(self, data_array, var_name):
"""
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array
"""
if var_name not in self.attributes.keys():
self.attribut... | python | def extract_attribute_array(self, data_array, var_name):
"""
Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array
"""
if var_name not in self.attributes.keys():
self.attribut... | [
"def",
"extract_attribute_array",
"(",
"self",
",",
"data_array",
",",
"var_name",
")",
":",
"if",
"var_name",
"not",
"in",
"self",
".",
"attributes",
".",
"keys",
"(",
")",
":",
"self",
".",
"attributes",
"[",
"var_name",
"]",
"=",
"[",
"]",
"for",
"t... | Extracts data from a 2D array that has the same dimensions as the grid used to identify the object.
Args:
data_array: 2D numpy array | [
"Extracts",
"data",
"from",
"a",
"2D",
"array",
"that",
"has",
"the",
"same",
"dimensions",
"as",
"the",
"grid",
"used",
"to",
"identify",
"the",
"object",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L335-L346 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.extract_tendency_grid | def extract_tendency_grid(self, model_grid):
"""
Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object.
"""
var_name = model_grid.variable + "-tendency"
self.attributes[var_name] = []
timesteps = np.arange(self.st... | python | def extract_tendency_grid(self, model_grid):
"""
Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object.
"""
var_name = model_grid.variable + "-tendency"
self.attributes[var_name] = []
timesteps = np.arange(self.st... | [
"def",
"extract_tendency_grid",
"(",
"self",
",",
"model_grid",
")",
":",
"var_name",
"=",
"model_grid",
".",
"variable",
"+",
"\"-tendency\"",
"self",
".",
"attributes",
"[",
"var_name",
"]",
"=",
"[",
"]",
"timesteps",
"=",
"np",
".",
"arange",
"(",
"sel... | Extracts the difference in model outputs
Args:
model_grid: ModelOutput or ModelGrid object. | [
"Extracts",
"the",
"difference",
"in",
"model",
"outputs"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L349-L364 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.calc_attribute_statistics | def calc_attribute_statistics(self, statistic_name):
"""
Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid.
... | python | def calc_attribute_statistics(self, statistic_name):
"""
Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid.
... | [
"def",
"calc_attribute_statistics",
"(",
"self",
",",
"statistic_name",
")",
":",
"stats",
"=",
"{",
"}",
"for",
"var",
",",
"grids",
"in",
"self",
".",
"attributes",
".",
"items",
"(",
")",
":",
"if",
"len",
"(",
"grids",
")",
">",
"1",
":",
"stats"... | Calculates summary statistics over the domains of each attribute.
Args:
statistic_name (string): numpy statistic, such as mean, std, max, min
Returns:
dict of statistics from each attribute grid. | [
"Calculates",
"summary",
"statistics",
"over",
"the",
"domains",
"of",
"each",
"attribute",
".",
"Args",
":",
"statistic_name",
"(",
"string",
")",
":",
"numpy",
"statistic",
"such",
"as",
"mean",
"std",
"max",
"min"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L366-L383 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.calc_attribute_statistic | def calc_attribute_statistic(self, attribute, statistic, time):
"""
Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attr... | python | def calc_attribute_statistic(self, attribute, statistic, time):
"""
Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attr... | [
"def",
"calc_attribute_statistic",
"(",
"self",
",",
"attribute",
",",
"statistic",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"... | Calculate statistics based on the values of an attribute. The following statistics are supported:
mean, max, min, std, ptp (range), median, skew (mean - median), and percentile_(percentile value).
Args:
attribute: Attribute extracted from model grid
statistic: Name of statistic ... | [
"Calculate",
"statistics",
"based",
"on",
"the",
"values",
"of",
"an",
"attribute",
".",
"The",
"following",
"statistics",
"are",
"supported",
":",
"mean",
"max",
"min",
"std",
"ptp",
"(",
"range",
")",
"median",
"skew",
"(",
"mean",
"-",
"median",
")",
... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L385-L419 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.calc_timestep_statistic | def calc_timestep_statistic(self, statistic, time):
"""
Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic
"""
... | python | def calc_timestep_statistic(self, statistic, time):
"""
Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic
"""
... | [
"def",
"calc_timestep_statistic",
"(",
"self",
",",
"statistic",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"ma",
"=",
"np",
".",
"where",
"(",
"self",
".",
... | Calculate statistics from the primary attribute of the StObject.
Args:
statistic: statistic being calculated
time: Timestep being investigated
Returns:
Value of the statistic | [
"Calculate",
"statistics",
"from",
"the",
"primary",
"attribute",
"of",
"the",
"StObject",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L421-L450 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.calc_shape_statistics | def calc_shape_statistics(self, stat_names):
"""
Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics
... | python | def calc_shape_statistics(self, stat_names):
"""
Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics
... | [
"def",
"calc_shape_statistics",
"(",
"self",
",",
"stat_names",
")",
":",
"stats",
"=",
"{",
"}",
"try",
":",
"all_props",
"=",
"[",
"regionprops",
"(",
"m",
")",
"for",
"m",
"in",
"self",
".",
"masks",
"]",
"except",
"TypeError",
":",
"print",
"(",
... | Calculate shape statistics using regionprops applied to the object mask.
Args:
stat_names: List of statistics to be extracted from those calculated by regionprops.
Returns:
Dictionary of shape statistics | [
"Calculate",
"shape",
"statistics",
"using",
"regionprops",
"applied",
"to",
"the",
"object",
"mask",
".",
"Args",
":",
"stat_names",
":",
"List",
"of",
"statistics",
"to",
"be",
"extracted",
"from",
"those",
"calculated",
"by",
"regionprops",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L452-L470 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.calc_shape_step | def calc_shape_step(self, stat_names, time):
"""
Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics
"""
... | python | def calc_shape_step(self, stat_names, time):
"""
Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics
"""
... | [
"def",
"calc_shape_step",
"(",
"self",
",",
"stat_names",
",",
"time",
")",
":",
"ti",
"=",
"np",
".",
"where",
"(",
"self",
".",
"times",
"==",
"time",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"props",
"=",
"regionprops",
"(",
"self",
".",
"masks",
"[... | Calculate shape statistics for a single time step
Args:
stat_names: List of shape statistics calculated from region props
time: Time being investigated
Returns:
List of shape statistics | [
"Calculate",
"shape",
"statistics",
"for",
"a",
"single",
"time",
"step"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L472-L498 | train |
djgagne/hagelslag | hagelslag/processing/STObject.py | STObject.to_geojson | def to_geojson(self, filename, proj, metadata=None):
"""
Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata de... | python | def to_geojson(self, filename, proj, metadata=None):
"""
Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata de... | [
"def",
"to_geojson",
"(",
"self",
",",
"filename",
",",
"proj",
",",
"metadata",
"=",
"None",
")",
":",
"if",
"metadata",
"is",
"None",
":",
"metadata",
"=",
"{",
"}",
"json_obj",
"=",
"{",
"\"type\"",
":",
"\"FeatureCollection\"",
",",
"\"features\"",
"... | Output the data in the STObject to a geoJSON file.
Args:
filename: Name of the file
proj: PyProj object for converting the x and y coordinates back to latitude and longitue values.
metadata: Metadata describing the object to be included in the top-level properties. | [
"Output",
"the",
"data",
"in",
"the",
"STObject",
"to",
"a",
"geoJSON",
"file",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/STObject.py#L500-L538 | train |
nion-software/nionswift | nion/swift/model/MemoryStorageSystem.py | MemoryStorageSystem.rewrite_properties | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__library_storage_lock:
self.__library_storage = properties
self.__write_properties(None) | python | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__library_storage_lock:
self.__library_storage = properties
self.__write_properties(None) | [
"def",
"rewrite_properties",
"(",
"self",
",",
"properties",
")",
":",
"with",
"self",
".",
"__library_storage_lock",
":",
"self",
".",
"__library_storage",
"=",
"properties",
"self",
".",
"__write_properties",
"(",
"None",
")"
] | Set the properties and write to disk. | [
"Set",
"the",
"properties",
"and",
"write",
"to",
"disk",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/MemoryStorageSystem.py#L113-L117 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.model | def model(self, v=None):
"Returns the model of node v"
if v is None:
v = self.estopping
hist = self.hist
trace = self.trace(v)
ins = None
if self._base._probability_calibration is not None:
node = hist[-1]
node.normalize()
X... | python | def model(self, v=None):
"Returns the model of node v"
if v is None:
v = self.estopping
hist = self.hist
trace = self.trace(v)
ins = None
if self._base._probability_calibration is not None:
node = hist[-1]
node.normalize()
X... | [
"def",
"model",
"(",
"self",
",",
"v",
"=",
"None",
")",
":",
"if",
"v",
"is",
"None",
":",
"v",
"=",
"self",
".",
"estopping",
"hist",
"=",
"self",
".",
"hist",
"trace",
"=",
"self",
".",
"trace",
"(",
"v",
")",
"ins",
"=",
"None",
"if",
"se... | Returns the model of node v | [
"Returns",
"the",
"model",
"of",
"node",
"v"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L252-L274 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.trace | def trace(self, n):
"Restore the position in the history of individual v's nodes"
trace_map = {}
self._trace(n, trace_map)
s = list(trace_map.keys())
s.sort()
return s | python | def trace(self, n):
"Restore the position in the history of individual v's nodes"
trace_map = {}
self._trace(n, trace_map)
s = list(trace_map.keys())
s.sort()
return s | [
"def",
"trace",
"(",
"self",
",",
"n",
")",
":",
"trace_map",
"=",
"{",
"}",
"self",
".",
"_trace",
"(",
"n",
",",
"trace_map",
")",
"s",
"=",
"list",
"(",
"trace_map",
".",
"keys",
"(",
")",
")",
"s",
".",
"sort",
"(",
")",
"return",
"s"
] | Restore the position in the history of individual v's nodes | [
"Restore",
"the",
"position",
"in",
"the",
"history",
"of",
"individual",
"v",
"s",
"nodes"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L276-L282 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.tournament | def tournament(self, negative=False):
"""Tournament selection and when negative is True it performs negative
tournament selection"""
if self.generation <= self._random_generations and not negative:
return self.random_selection()
if not self._negative_selection and negative:
... | python | def tournament(self, negative=False):
"""Tournament selection and when negative is True it performs negative
tournament selection"""
if self.generation <= self._random_generations and not negative:
return self.random_selection()
if not self._negative_selection and negative:
... | [
"def",
"tournament",
"(",
"self",
",",
"negative",
"=",
"False",
")",
":",
"if",
"self",
".",
"generation",
"<=",
"self",
".",
"_random_generations",
"and",
"not",
"negative",
":",
"return",
"self",
".",
"random_selection",
"(",
")",
"if",
"not",
"self",
... | Tournament selection and when negative is True it performs negative
tournament selection | [
"Tournament",
"selection",
"and",
"when",
"negative",
"is",
"True",
"it",
"performs",
"negative",
"tournament",
"selection"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L319-L333 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.create_population | def create_population(self):
"Create the initial population"
base = self._base
if base._share_inputs:
used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
used_inputs_naive = used_inputs_var
if base._pr_variable == 0:
used_inputs_var = Select... | python | def create_population(self):
"Create the initial population"
base = self._base
if base._share_inputs:
used_inputs_var = SelectNumbers([x for x in range(base.nvar)])
used_inputs_naive = used_inputs_var
if base._pr_variable == 0:
used_inputs_var = Select... | [
"def",
"create_population",
"(",
"self",
")",
":",
"base",
"=",
"self",
".",
"_base",
"if",
"base",
".",
"_share_inputs",
":",
"used_inputs_var",
"=",
"SelectNumbers",
"(",
"[",
"x",
"for",
"x",
"in",
"range",
"(",
"base",
".",
"nvar",
")",
"]",
")",
... | Create the initial population | [
"Create",
"the",
"initial",
"population"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L345-L390 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.add | def add(self, v):
"Add an individual to the population"
self.population.append(v)
self._current_popsize += 1
v.position = len(self._hist)
self._hist.append(v)
self.bsf = v
self.estopping = v
self._density += self.get_density(v) | python | def add(self, v):
"Add an individual to the population"
self.population.append(v)
self._current_popsize += 1
v.position = len(self._hist)
self._hist.append(v)
self.bsf = v
self.estopping = v
self._density += self.get_density(v) | [
"def",
"add",
"(",
"self",
",",
"v",
")",
":",
"self",
".",
"population",
".",
"append",
"(",
"v",
")",
"self",
".",
"_current_popsize",
"+=",
"1",
"v",
".",
"position",
"=",
"len",
"(",
"self",
".",
"_hist",
")",
"self",
".",
"_hist",
".",
"appe... | Add an individual to the population | [
"Add",
"an",
"individual",
"to",
"the",
"population"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L392-L400 | train |
mgraffg/EvoDAG | EvoDAG/population.py | BasePopulation.replace | def replace(self, v):
"""Replace an individual selected by negative tournament selection with
individual v"""
if self.popsize < self._popsize:
return self.add(v)
k = self.tournament(negative=True)
self.clean(self.population[k])
self.population[k] = v
v... | python | def replace(self, v):
"""Replace an individual selected by negative tournament selection with
individual v"""
if self.popsize < self._popsize:
return self.add(v)
k = self.tournament(negative=True)
self.clean(self.population[k])
self.population[k] = v
v... | [
"def",
"replace",
"(",
"self",
",",
"v",
")",
":",
"if",
"self",
".",
"popsize",
"<",
"self",
".",
"_popsize",
":",
"return",
"self",
".",
"add",
"(",
"v",
")",
"k",
"=",
"self",
".",
"tournament",
"(",
"negative",
"=",
"True",
")",
"self",
".",
... | Replace an individual selected by negative tournament selection with
individual v | [
"Replace",
"an",
"individual",
"selected",
"by",
"negative",
"tournament",
"selection",
"with",
"individual",
"v"
] | e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5 | https://github.com/mgraffg/EvoDAG/blob/e11fa1fd1ca9e69cca92696c86661a3dc7b3a1d5/EvoDAG/population.py#L402-L419 | train |
nion-software/nionswift | nion/swift/model/HDF5Handler.py | make_directory_if_needed | def make_directory_if_needed(directory_path):
"""
Make the directory path, if needed.
"""
if os.path.exists(directory_path):
if not os.path.isdir(directory_path):
raise OSError("Path is not a directory:", directory_path)
else:
os.makedirs(directory_path) | python | def make_directory_if_needed(directory_path):
"""
Make the directory path, if needed.
"""
if os.path.exists(directory_path):
if not os.path.isdir(directory_path):
raise OSError("Path is not a directory:", directory_path)
else:
os.makedirs(directory_path) | [
"def",
"make_directory_if_needed",
"(",
"directory_path",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"directory_path",
")",
":",
"raise",
"OSError",
"(",
"\"Path is ... | Make the directory path, if needed. | [
"Make",
"the",
"directory",
"path",
"if",
"needed",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/HDF5Handler.py#L18-L26 | train |
ajk8/hatchery | hatchery/main.py | hatchery | def hatchery():
""" Main entry point for the hatchery program """
args = docopt.docopt(__doc__)
task_list = args['<task>']
if not task_list or 'help' in task_list or args['--help']:
print(__doc__.format(version=_version.__version__, config_files=config.CONFIG_LOCATIONS))
return 0
l... | python | def hatchery():
""" Main entry point for the hatchery program """
args = docopt.docopt(__doc__)
task_list = args['<task>']
if not task_list or 'help' in task_list or args['--help']:
print(__doc__.format(version=_version.__version__, config_files=config.CONFIG_LOCATIONS))
return 0
l... | [
"def",
"hatchery",
"(",
")",
":",
"args",
"=",
"docopt",
".",
"docopt",
"(",
"__doc__",
")",
"task_list",
"=",
"args",
"[",
"'<task>'",
"]",
"if",
"not",
"task_list",
"or",
"'help'",
"in",
"task_list",
"or",
"args",
"[",
"'--help'",
"]",
":",
"print",
... | Main entry point for the hatchery program | [
"Main",
"entry",
"point",
"for",
"the",
"hatchery",
"program"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/main.py#L379-L430 | train |
ajk8/hatchery | hatchery/executor.py | call | def call(cmd_args, suppress_output=False):
""" Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notr... | python | def call(cmd_args, suppress_output=False):
""" Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notr... | [
"def",
"call",
"(",
"cmd_args",
",",
"suppress_output",
"=",
"False",
")",
":",
"if",
"not",
"funcy",
".",
"is_list",
"(",
"cmd_args",
")",
"and",
"not",
"funcy",
".",
"is_tuple",
"(",
"cmd_args",
")",
":",
"cmd_args",
"=",
"shlex",
".",
"split",
"(",
... | Call an arbitary command and return the exit value, stdout, and stderr as a tuple
Command can be passed in as either a string or iterable
>>> result = call('hatchery', suppress_output=True)
>>> result.exitval
0
>>> result = call(['hatchery', 'notreal'])
>>> result.exitval
1 | [
"Call",
"an",
"arbitary",
"command",
"and",
"return",
"the",
"exit",
"value",
"stdout",
"and",
"stderr",
"as",
"a",
"tuple"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/executor.py#L66-L85 | train |
ajk8/hatchery | hatchery/executor.py | setup | def setup(cmd_args, suppress_output=False):
""" Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1
"""
if not funcy.is_list(cmd_args) and not funcy.is_tuple(cmd_args):... | python | def setup(cmd_args, suppress_output=False):
""" Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1
"""
if not funcy.is_list(cmd_args) and not funcy.is_tuple(cmd_args):... | [
"def",
"setup",
"(",
"cmd_args",
",",
"suppress_output",
"=",
"False",
")",
":",
"if",
"not",
"funcy",
".",
"is_list",
"(",
"cmd_args",
")",
"and",
"not",
"funcy",
".",
"is_tuple",
"(",
"cmd_args",
")",
":",
"cmd_args",
"=",
"shlex",
".",
"split",
"(",... | Call a setup.py command or list of commands
>>> result = setup('--name', suppress_output=True)
>>> result.exitval
0
>>> result = setup('notreal')
>>> result.exitval
1 | [
"Call",
"a",
"setup",
".",
"py",
"command",
"or",
"list",
"of",
"commands"
] | e068c9f5366d2c98225babb03d4cde36c710194f | https://github.com/ajk8/hatchery/blob/e068c9f5366d2c98225babb03d4cde36c710194f/hatchery/executor.py#L88-L101 | train |
djgagne/hagelslag | hagelslag/data/MRMSGrid.py | MRMSGrid.load_data | def load_data(self):
"""
Loads data files and stores the output in the data attribute.
"""
data = []
valid_dates = []
mrms_files = np.array(sorted(os.listdir(self.path + self.variable + "/")))
mrms_file_dates = np.array([m_file.split("_")[-2].split("-")[0]
... | python | def load_data(self):
"""
Loads data files and stores the output in the data attribute.
"""
data = []
valid_dates = []
mrms_files = np.array(sorted(os.listdir(self.path + self.variable + "/")))
mrms_file_dates = np.array([m_file.split("_")[-2].split("-")[0]
... | [
"def",
"load_data",
"(",
"self",
")",
":",
"data",
"=",
"[",
"]",
"valid_dates",
"=",
"[",
"]",
"mrms_files",
"=",
"np",
".",
"array",
"(",
"sorted",
"(",
"os",
".",
"listdir",
"(",
"self",
".",
"path",
"+",
"self",
".",
"variable",
"+",
"\"/\"",
... | Loads data files and stores the output in the data attribute. | [
"Loads",
"data",
"files",
"and",
"stores",
"the",
"output",
"in",
"the",
"data",
"attribute",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/data/MRMSGrid.py#L44-L82 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | rescale_data | def rescale_data(data, data_min, data_max, out_min=0.0, out_max=100.0):
"""
Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
... | python | def rescale_data(data, data_min, data_max, out_min=0.0, out_max=100.0):
"""
Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
... | [
"def",
"rescale_data",
"(",
"data",
",",
"data_min",
",",
"data_max",
",",
"out_min",
"=",
"0.0",
",",
"out_max",
"=",
"100.0",
")",
":",
"return",
"(",
"out_max",
"-",
"out_min",
")",
"/",
"(",
"data_max",
"-",
"data_min",
")",
"*",
"(",
"data",
"-"... | Rescale your input data so that is ranges over integer values, which will perform better in the watershed.
Args:
data: 2D or 3D ndarray being rescaled
data_min: minimum value of input data for scaling purposes
data_max: maximum value of input data for scaling purposes
out_min: minim... | [
"Rescale",
"your",
"input",
"data",
"so",
"that",
"is",
"ranges",
"over",
"integer",
"values",
"which",
"will",
"perform",
"better",
"in",
"the",
"watershed",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L297-L311 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | EnhancedWatershed.label | def label(self, input_grid):
"""
Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels
"""
marked = self.find_local_maxima(input_grid)
marked = np.wher... | python | def label(self, input_grid):
"""
Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels
"""
marked = self.find_local_maxima(input_grid)
marked = np.wher... | [
"def",
"label",
"(",
"self",
",",
"input_grid",
")",
":",
"marked",
"=",
"self",
".",
"find_local_maxima",
"(",
"input_grid",
")",
"marked",
"=",
"np",
".",
"where",
"(",
"marked",
">=",
"0",
",",
"1",
",",
"0",
")",
"# splabel returns two things in a tupl... | Labels input grid using enhanced watershed algorithm.
Args:
input_grid (numpy.ndarray): Grid to be labeled.
Returns:
Array of labeled pixels | [
"Labels",
"input",
"grid",
"using",
"enhanced",
"watershed",
"algorithm",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L42-L57 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | EnhancedWatershed.find_local_maxima | def find_local_maxima(self, input_grid):
"""
Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects.
"""
pixels, q_data = self.quantize(input_g... | python | def find_local_maxima(self, input_grid):
"""
Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects.
"""
pixels, q_data = self.quantize(input_g... | [
"def",
"find_local_maxima",
"(",
"self",
",",
"input_grid",
")",
":",
"pixels",
",",
"q_data",
"=",
"self",
".",
"quantize",
"(",
"input_grid",
")",
"centers",
"=",
"OrderedDict",
"(",
")",
"for",
"p",
"in",
"pixels",
".",
"keys",
"(",
")",
":",
"cente... | Finds the local maxima in the inputGrid and perform region growing to identify objects.
Args:
input_grid: Raw input data.
Returns:
array with labeled objects. | [
"Finds",
"the",
"local",
"maxima",
"in",
"the",
"inputGrid",
"and",
"perform",
"region",
"growing",
"to",
"identify",
"objects",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L81-L166 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | EnhancedWatershed.set_maximum | def set_maximum(self, q_data, marked, center, bin_lower, foothills):
"""
Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordi... | python | def set_maximum(self, q_data, marked, center, bin_lower, foothills):
"""
Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordi... | [
"def",
"set_maximum",
"(",
"self",
",",
"q_data",
",",
"marked",
",",
"center",
",",
"bin_lower",
",",
"foothills",
")",
":",
"as_bin",
"=",
"[",
"]",
"# pixels to be included in peak",
"as_glob",
"=",
"[",
"]",
"# pixels to be globbed up as part of foothills",
"m... | Grow a region at a certain bin level and check if the region has reached the maximum size.
Args:
q_data: Quantized data array
marked: Array marking points that are objects
center: Coordinates of the center pixel of the region being grown
bin_lower: Intensity leve... | [
"Grow",
"a",
"region",
"at",
"a",
"certain",
"bin",
"level",
"and",
"check",
"if",
"the",
"region",
"has",
"reached",
"the",
"maximum",
"size",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L168-L221 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | EnhancedWatershed.remove_foothills | def remove_foothills(self, q_data, marked, bin_num, bin_lower, centers, foothills):
"""
Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered ... | python | def remove_foothills(self, q_data, marked, bin_num, bin_lower, centers, foothills):
"""
Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered ... | [
"def",
"remove_foothills",
"(",
"self",
",",
"q_data",
",",
"marked",
",",
"bin_num",
",",
"bin_lower",
",",
"centers",
",",
"foothills",
")",
":",
"hills",
"=",
"[",
"]",
"for",
"foot",
"in",
"foothills",
":",
"center",
"=",
"foot",
"[",
"0",
"]",
"... | Mark points determined to be foothills as globbed, so that they are not included in
future searches. Also searches neighboring points to foothill points to determine
if they should also be considered foothills.
Args:
q_data: Quantized data
marked: Marked
bin_... | [
"Mark",
"points",
"determined",
"to",
"be",
"foothills",
"as",
"globbed",
"so",
"that",
"they",
"are",
"not",
"included",
"in",
"future",
"searches",
".",
"Also",
"searches",
"neighboring",
"points",
"to",
"foothill",
"points",
"to",
"determine",
"if",
"they",... | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L223-L255 | train |
djgagne/hagelslag | hagelslag/processing/EnhancedWatershedSegmenter.py | EnhancedWatershed.quantize | def quantize(self, input_grid):
"""
Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data
"""
pixels = {}
... | python | def quantize(self, input_grid):
"""
Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data
"""
pixels = {}
... | [
"def",
"quantize",
"(",
"self",
",",
"input_grid",
")",
":",
"pixels",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"max_bin",
"+",
"1",
")",
":",
"pixels",
"[",
"i",
"]",
"=",
"[",
"]",
"data",
"=",
"(",
"np",
".",
"array",
"(... | Quantize a grid into discrete steps based on input parameters.
Args:
input_grid: 2-d array of values
Returns:
Dictionary of value pointing to pixel locations, and quantized 2-d array of data | [
"Quantize",
"a",
"grid",
"into",
"discrete",
"steps",
"based",
"on",
"input",
"parameters",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/EnhancedWatershedSegmenter.py#L270-L290 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.listall | def listall(self):
'''
will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName
'''
file_name = []
r = requests.get(
'%s/users/%s/gists' % (BASE_URL, self.user),
... | python | def listall(self):
'''
will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName
'''
file_name = []
r = requests.get(
'%s/users/%s/gists' % (BASE_URL, self.user),
... | [
"def",
"listall",
"(",
"self",
")",
":",
"file_name",
"=",
"[",
"]",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/users/%s/gists'",
"%",
"(",
"BASE_URL",
",",
"self",
".",
"user",
")",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"r... | will display all the filenames.
Result can be stored in an array for easy fetching of gistNames
for future purposes.
eg. a = Gist().mygists().listall()
print a[0] #to fetch first gistName | [
"will",
"display",
"all",
"the",
"filenames",
".",
"Result",
"can",
"be",
"stored",
"in",
"an",
"array",
"for",
"easy",
"fetching",
"of",
"gistNames",
"for",
"future",
"purposes",
".",
"eg",
".",
"a",
"=",
"Gist",
"()",
".",
"mygists",
"()",
".",
"list... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L13-L34 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.content | def content(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname
'''
self.gist_name = ''
if 'name' in args:
self.gist_name = arg... | python | def content(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname
'''
self.gist_name = ''
if 'name' in args:
self.gist_name = arg... | [
"def",
"content",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"self",
".",
"gist_name",
"=",
"''",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
... | Doesn't require manual fetching of gistID of a gist
passing gistName will return the content of gist. In case,
names are ambigious, provide GistID or it will return the contents
of recent ambigious gistname | [
"Doesn",
"t",
"require",
"manual",
"fetching",
"of",
"gistID",
"of",
"a",
"gist",
"passing",
"gistName",
"will",
"return",
"the",
"content",
"of",
"gist",
".",
"In",
"case",
"names",
"are",
"ambigious",
"provide",
"GistID",
"or",
"it",
"will",
"return",
"t... | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L78-L109 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.edit | def edit(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist
'''
self.gist_name = ''
if 'description' in args:
self.description = args['description']
else:
self.description = ''
if 'name' in args and 'id' in args:
self.gist_name = ... | python | def edit(self, **args):
'''
Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist
'''
self.gist_name = ''
if 'description' in args:
self.description = args['description']
else:
self.description = ''
if 'name' in args and 'id' in args:
self.gist_name = ... | [
"def",
"edit",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"self",
".",
"gist_name",
"=",
"''",
"if",
"'description'",
"in",
"args",
":",
"self",
".",
"description",
"=",
"args",
"[",
"'description'",
"]",
"else",
":",
"self",
".",
"description",
"... | Doesn't require manual fetching of gistID of a gist
passing gistName will return edit the gist | [
"Doesn",
"t",
"require",
"manual",
"fetching",
"of",
"gistID",
"of",
"a",
"gist",
"passing",
"gistName",
"will",
"return",
"edit",
"the",
"gist"
] | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L132-L195 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.delete | def delete(self, **args):
'''
Delete a gist by gistname/gistID
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Provide GistName to delete')
url = 'gists'
if self.gist_id:
... | python | def delete(self, **args):
'''
Delete a gist by gistname/gistID
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Provide GistName to delete')
url = 'gists'
if self.gist_id:
... | [
"def",
"delete",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
... | Delete a gist by gistname/gistID | [
"Delete",
"a",
"gist",
"by",
"gistname",
"/",
"gistID"
] | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L198-L223 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.starred | def starred(self, **args):
'''
List the authenticated user's starred gists
'''
ids =[]
r = requests.get(
'%s/gists/starred'%BASE_URL,
headers=self.gist.header
)
if 'limit' in args:
limit = args['limit']
else:
limit = len(r.json())
if (r.status_code == 200):
for g in range(0,limit ):
... | python | def starred(self, **args):
'''
List the authenticated user's starred gists
'''
ids =[]
r = requests.get(
'%s/gists/starred'%BASE_URL,
headers=self.gist.header
)
if 'limit' in args:
limit = args['limit']
else:
limit = len(r.json())
if (r.status_code == 200):
for g in range(0,limit ):
... | [
"def",
"starred",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"ids",
"=",
"[",
"]",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s/gists/starred'",
"%",
"BASE_URL",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"if",
"'limit'",
"in",... | List the authenticated user's starred gists | [
"List",
"the",
"authenticated",
"user",
"s",
"starred",
"gists"
] | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L226-L246 | train |
softvar/simplegist | simplegist/mygist.py | Mygist.links | def links(self,**args):
'''
Return Gist URL-Link, Clone-Link and Script-Link to embed
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Gist Name/ID must be provided')
if self.gis... | python | def links(self,**args):
'''
Return Gist URL-Link, Clone-Link and Script-Link to embed
'''
if 'name' in args:
self.gist_name = args['name']
self.gist_id = self.getMyID(self.gist_name)
elif 'id' in args:
self.gist_id = args['id']
else:
raise Exception('Gist Name/ID must be provided')
if self.gis... | [
"def",
"links",
"(",
"self",
",",
"*",
"*",
"args",
")",
":",
"if",
"'name'",
"in",
"args",
":",
"self",
".",
"gist_name",
"=",
"args",
"[",
"'name'",
"]",
"self",
".",
"gist_id",
"=",
"self",
".",
"getMyID",
"(",
"self",
".",
"gist_name",
")",
"... | Return Gist URL-Link, Clone-Link and Script-Link to embed | [
"Return",
"Gist",
"URL",
"-",
"Link",
"Clone",
"-",
"Link",
"and",
"Script",
"-",
"Link",
"to",
"embed"
] | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/mygist.py#L248-L275 | train |
djgagne/hagelslag | hagelslag/evaluation/NeighborEvaluator.py | NeighborEvaluator.load_forecasts | def load_forecasts(self):
"""
Load neighborhood probability forecasts.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
forecast_file = self.forecast_path + "{0}/{1}_{2}_{3}_consensus_{0}.nc".format(run_date_str,
... | python | def load_forecasts(self):
"""
Load neighborhood probability forecasts.
"""
run_date_str = self.run_date.strftime("%Y%m%d")
forecast_file = self.forecast_path + "{0}/{1}_{2}_{3}_consensus_{0}.nc".format(run_date_str,
... | [
"def",
"load_forecasts",
"(",
"self",
")",
":",
"run_date_str",
"=",
"self",
".",
"run_date",
".",
"strftime",
"(",
"\"%Y%m%d\"",
")",
"forecast_file",
"=",
"self",
".",
"forecast_path",
"+",
"\"{0}/{1}_{2}_{3}_consensus_{0}.nc\"",
".",
"format",
"(",
"run_date_st... | Load neighborhood probability forecasts. | [
"Load",
"neighborhood",
"probability",
"forecasts",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L62-L93 | train |
djgagne/hagelslag | hagelslag/evaluation/NeighborEvaluator.py | NeighborEvaluator.load_obs | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked.
"""
print("Loading obs ", self.run_date, self.model_name, self.forecast_variable)
... | python | def load_obs(self, mask_threshold=0.5):
"""
Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked.
"""
print("Loading obs ", self.run_date, self.model_name, self.forecast_variable)
... | [
"def",
"load_obs",
"(",
"self",
",",
"mask_threshold",
"=",
"0.5",
")",
":",
"print",
"(",
"\"Loading obs \"",
",",
"self",
".",
"run_date",
",",
"self",
".",
"model_name",
",",
"self",
".",
"forecast_variable",
")",
"start_date",
"=",
"self",
".",
"run_da... | Loads observations and masking grid (if needed).
Args:
mask_threshold: Values greater than the threshold are kept, others are masked. | [
"Loads",
"observations",
"and",
"masking",
"grid",
"(",
"if",
"needed",
")",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L95-L114 | train |
djgagne/hagelslag | hagelslag/evaluation/NeighborEvaluator.py | NeighborEvaluator.load_coordinates | def load_coordinates(self):
"""
Loads lat-lon coordinates from a netCDF file.
"""
coord_file = Dataset(self.coordinate_file)
if "lon" in coord_file.variables.keys():
self.coordinates["lon"] = coord_file.variables["lon"][:]
self.coordinates["lat"] = coord_f... | python | def load_coordinates(self):
"""
Loads lat-lon coordinates from a netCDF file.
"""
coord_file = Dataset(self.coordinate_file)
if "lon" in coord_file.variables.keys():
self.coordinates["lon"] = coord_file.variables["lon"][:]
self.coordinates["lat"] = coord_f... | [
"def",
"load_coordinates",
"(",
"self",
")",
":",
"coord_file",
"=",
"Dataset",
"(",
"self",
".",
"coordinate_file",
")",
"if",
"\"lon\"",
"in",
"coord_file",
".",
"variables",
".",
"keys",
"(",
")",
":",
"self",
".",
"coordinates",
"[",
"\"lon\"",
"]",
... | Loads lat-lon coordinates from a netCDF file. | [
"Loads",
"lat",
"-",
"lon",
"coordinates",
"from",
"a",
"netCDF",
"file",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L116-L127 | train |
djgagne/hagelslag | hagelslag/evaluation/NeighborEvaluator.py | NeighborEvaluator.evaluate_hourly_forecasts | def evaluate_hourly_forecasts(self):
"""
Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects.
"""
score_columns = ["Run_Date", "Forecast_Hour",... | python | def evaluate_hourly_forecasts(self):
"""
Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects.
"""
score_columns = ["Run_Date", "Forecast_Hour",... | [
"def",
"evaluate_hourly_forecasts",
"(",
"self",
")",
":",
"score_columns",
"=",
"[",
"\"Run_Date\"",
",",
"\"Forecast_Hour\"",
",",
"\"Ensemble Name\"",
",",
"\"Model_Name\"",
",",
"\"Forecast_Variable\"",
",",
"\"Neighbor_Radius\"",
",",
"\"Smoothing_Radius\"",
",",
"... | Calculates ROC curves and Reliability scores for each forecast hour.
Returns:
A pandas DataFrame containing forecast metadata as well as DistributedROC and Reliability objects. | [
"Calculates",
"ROC",
"curves",
"and",
"Reliability",
"scores",
"for",
"each",
"forecast",
"hour",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L129-L170 | train |
djgagne/hagelslag | hagelslag/evaluation/NeighborEvaluator.py | NeighborEvaluator.evaluate_period_forecasts | def evaluate_period_forecasts(self):
"""
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics
"""
score_columns = ["Run_Date", "Ensemble N... | python | def evaluate_period_forecasts(self):
"""
Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics
"""
score_columns = ["Run_Date", "Ensemble N... | [
"def",
"evaluate_period_forecasts",
"(",
"self",
")",
":",
"score_columns",
"=",
"[",
"\"Run_Date\"",
",",
"\"Ensemble Name\"",
",",
"\"Model_Name\"",
",",
"\"Forecast_Variable\"",
",",
"\"Neighbor_Radius\"",
",",
"\"Smoothing_Radius\"",
",",
"\"Size_Threshold\"",
",",
... | Evaluates ROC and Reliability scores for forecasts over the full period from start hour to end hour
Returns:
A pandas DataFrame with full-period metadata and verification statistics | [
"Evaluates",
"ROC",
"and",
"Reliability",
"scores",
"for",
"forecasts",
"over",
"the",
"full",
"period",
"from",
"start",
"hour",
"to",
"end",
"hour"
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/evaluation/NeighborEvaluator.py#L172-L227 | train |
nion-software/nionswift | nion/swift/command.py | bootstrap_main | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | python | def bootstrap_main(args):
"""
Main function explicitly called from the C++ code.
Return the main application object.
"""
version_info = sys.version_info
if version_info.major != 3 or version_info.minor < 6:
return None, "python36"
main_fn = load_module_as_package("nionui_app.nionswif... | [
"def",
"bootstrap_main",
"(",
"args",
")",
":",
"version_info",
"=",
"sys",
".",
"version_info",
"if",
"version_info",
".",
"major",
"!=",
"3",
"or",
"version_info",
".",
"minor",
"<",
"6",
":",
"return",
"None",
",",
"\"python36\"",
"main_fn",
"=",
"load_... | Main function explicitly called from the C++ code.
Return the main application object. | [
"Main",
"function",
"explicitly",
"called",
"from",
"the",
"C",
"++",
"code",
".",
"Return",
"the",
"main",
"application",
"object",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/command.py#L49-L60 | train |
nion-software/nionswift | nion/swift/model/Profile.py | _migrate_library | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | python | def _migrate_library(workspace_dir: pathlib.Path, do_logging: bool=True) -> pathlib.Path:
""" Migrate library to latest version. """
library_path_11 = workspace_dir / "Nion Swift Workspace.nslib"
library_path_12 = workspace_dir / "Nion Swift Library 12.nslib"
library_path_13 = workspace_dir / "Nion Swi... | [
"def",
"_migrate_library",
"(",
"workspace_dir",
":",
"pathlib",
".",
"Path",
",",
"do_logging",
":",
"bool",
"=",
"True",
")",
"->",
"pathlib",
".",
"Path",
":",
"library_path_11",
"=",
"workspace_dir",
"/",
"\"Nion Swift Workspace.nslib\"",
"library_path_12",
"=... | Migrate library to latest version. | [
"Migrate",
"library",
"to",
"latest",
"version",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/Profile.py#L99-L117 | train |
base4sistemas/satcfe | satcfe/resposta/consultarstatusoperacional.py | RespostaConsultarStatusOperacional.status | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | python | def status(self):
"""Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT".
"""
for valor, rotulo in ESTADOS_OPERACAO:
if self.ESTADO_OPERACAO == valor:
return rotulo
return u'(desconhecido: {})'.format(self.ES... | [
"def",
"status",
"(",
"self",
")",
":",
"for",
"valor",
",",
"rotulo",
"in",
"ESTADOS_OPERACAO",
":",
"if",
"self",
".",
"ESTADO_OPERACAO",
"==",
"valor",
":",
"return",
"rotulo",
"return",
"u'(desconhecido: {})'",
".",
"format",
"(",
"self",
".",
"ESTADO_OP... | Nome amigável do campo ``ESTADO_OPERACAO``, conforme a "Tabela de
Informações do Status do SAT". | [
"Nome",
"amigável",
"do",
"campo",
"ESTADO_OPERACAO",
"conforme",
"a",
"Tabela",
"de",
"Informações",
"do",
"Status",
"do",
"SAT",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L123-L130 | train |
base4sistemas/satcfe | satcfe/resposta/consultarstatusoperacional.py | RespostaConsultarStatusOperacional.analisar | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | python | def analisar(retorno):
"""Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``.
"""
resposta = analisar_retorno(forcar_unicode(retorno),
funcao='ConsultarS... | [
"def",
"analisar",
"(",
"retorno",
")",
":",
"resposta",
"=",
"analisar_retorno",
"(",
"forcar_unicode",
"(",
"retorno",
")",
",",
"funcao",
"=",
"'ConsultarStatusOperacional'",
",",
"classe_resposta",
"=",
"RespostaConsultarStatusOperacional",
",",
"campos",
"=",
"... | Constrói uma :class:`RespostaConsultarStatusOperacional` a partir do
retorno informado.
:param unicode retorno: Retorno da função ``ConsultarStatusOperacional``. | [
"Constrói",
"uma",
":",
"class",
":",
"RespostaConsultarStatusOperacional",
"a",
"partir",
"do",
"retorno",
"informado",
"."
] | cb8e8815f4133d3e3d94cf526fa86767b4521ed9 | https://github.com/base4sistemas/satcfe/blob/cb8e8815f4133d3e3d94cf526fa86767b4521ed9/satcfe/resposta/consultarstatusoperacional.py#L134-L175 | train |
djgagne/hagelslag | hagelslag/util/merge_forecast_data.py | merge_input_csv_forecast_json | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | python | def merge_input_csv_forecast_json(input_csv_file, forecast_json_path, condition_models, dist_models):
"""
Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Pa... | [
"def",
"merge_input_csv_forecast_json",
"(",
"input_csv_file",
",",
"forecast_json_path",
",",
"condition_models",
",",
"dist_models",
")",
":",
"try",
":",
"run_date",
"=",
"input_csv_file",
"[",
":",
"-",
"4",
"]",
".",
"split",
"(",
"\"_\"",
")",
"[",
"-",
... | Reads forecasts from json files and merges them with the input data from the step csv files.
Args:
input_csv_file: Name of the input data csv file being processed
forecast_json_path: Path to the forecast json files toplevel directory
condition_models: List of models used to forecast hail or... | [
"Reads",
"forecasts",
"from",
"json",
"files",
"and",
"merges",
"them",
"with",
"the",
"input",
"data",
"from",
"the",
"step",
"csv",
"files",
"."
] | 6fb6c3df90bf4867e13a97d3460b14471d107df1 | https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/util/merge_forecast_data.py#L53-L107 | train |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.mark_data_dirty | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | python | def mark_data_dirty(self):
""" Called from item to indicate its data or metadata has changed."""
self.__cache.set_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__initialize_cache()
self.__cached_value_dirty = True | [
"def",
"mark_data_dirty",
"(",
"self",
")",
":",
"self",
".",
"__cache",
".",
"set_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
".",
"__cache_property_name",
")",
"self",
".",
"__initialize_cache",
"(",
")",
"self",
".",
"__cached_value_... | Called from item to indicate its data or metadata has changed. | [
"Called",
"from",
"item",
"to",
"indicate",
"its",
"data",
"or",
"metadata",
"has",
"changed",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L56-L60 | train |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.__initialize_cache | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | python | def __initialize_cache(self):
"""Initialize the cache values (cache values are used for optimization)."""
if self.__cached_value_dirty is None:
self.__cached_value_dirty = self.__cache.is_cached_value_dirty(self.__display_item, self.__cache_property_name)
self.__cached_value = se... | [
"def",
"__initialize_cache",
"(",
"self",
")",
":",
"if",
"self",
".",
"__cached_value_dirty",
"is",
"None",
":",
"self",
".",
"__cached_value_dirty",
"=",
"self",
".",
"__cache",
".",
"is_cached_value_dirty",
"(",
"self",
".",
"__display_item",
",",
"self",
"... | Initialize the cache values (cache values are used for optimization). | [
"Initialize",
"the",
"cache",
"values",
"(",
"cache",
"values",
"are",
"used",
"for",
"optimization",
")",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L62-L66 | train |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.recompute_if_necessary | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | python | def recompute_if_necessary(self, ui):
"""Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing."""
self.__initialize_cache()
if self.__cached_val... | [
"def",
"recompute_if_necessary",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"if",
"self",
".",
"__cached_value_dirty",
":",
"with",
"self",
".",
"__is_recomputing_lock",
":",
"is_recomputing",
"=",
"self",
".",
"__is_recomputi... | Recompute the data on a thread, if necessary.
If the data has recently been computed, this call will be rescheduled for the future.
If the data is currently being computed, it do nothing. | [
"Recompute",
"the",
"data",
"on",
"a",
"thread",
"if",
"necessary",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L68-L100 | train |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailProcessor.recompute_data | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | python | def recompute_data(self, ui):
"""Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will no... | [
"def",
"recompute_data",
"(",
"self",
",",
"ui",
")",
":",
"self",
".",
"__initialize_cache",
"(",
")",
"with",
"self",
".",
"__recompute_lock",
":",
"if",
"self",
".",
"__cached_value_dirty",
":",
"try",
":",
"calculated_data",
"=",
"self",
".",
"get_calcul... | Compute the data associated with this processor.
This method is thread safe and may take a long time to return. It should not be called from
the UI thread. Upon return, the results will be calculated with the latest data available
and the cache will not be marked dirty. | [
"Compute",
"the",
"data",
"associated",
"with",
"this",
"processor",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L102-L142 | train |
nion-software/nionswift | nion/swift/Thumbnails.py | ThumbnailManager.thumbnail_source_for_display_item | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | python | def thumbnail_source_for_display_item(self, ui, display_item: DisplayItem.DisplayItem) -> ThumbnailSource:
"""Returned ThumbnailSource must be closed."""
with self.__lock:
thumbnail_source = self.__thumbnail_sources.get(display_item)
if not thumbnail_source:
thumb... | [
"def",
"thumbnail_source_for_display_item",
"(",
"self",
",",
"ui",
",",
"display_item",
":",
"DisplayItem",
".",
"DisplayItem",
")",
"->",
"ThumbnailSource",
":",
"with",
"self",
".",
"__lock",
":",
"thumbnail_source",
"=",
"self",
".",
"__thumbnail_sources",
"."... | Returned ThumbnailSource must be closed. | [
"Returned",
"ThumbnailSource",
"must",
"be",
"closed",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/Thumbnails.py#L242-L256 | train |
nion-software/nionswift | nion/swift/model/PlugInManager.py | load_plug_ins | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | python | def load_plug_ins(app, root_dir):
"""Load plug-ins."""
global extensions
ui = app.ui
# a list of directories in which sub-directories PlugIns will be searched.
subdirectories = []
# the default location is where the directory main packages are located.
if root_dir:
subdirectories.... | [
"def",
"load_plug_ins",
"(",
"app",
",",
"root_dir",
")",
":",
"global",
"extensions",
"ui",
"=",
"app",
".",
"ui",
"# a list of directories in which sub-directories PlugIns will be searched.",
"subdirectories",
"=",
"[",
"]",
"# the default location is where the directory ma... | Load plug-ins. | [
"Load",
"plug",
"-",
"ins",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/PlugInManager.py#L140-L283 | train |
softvar/simplegist | simplegist/comments.py | Comments.getMyID | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | python | def getMyID(self,gist_name):
'''
Getting gistID of a gist in order to make the workflow
easy and uninterrupted.
'''
r = requests.get(
'%s'%BASE_URL+'/users/%s/gists' % self.user,
headers=self.gist.header
)
if (r.status_code == 200):
r_text = json.loads(r.text)
limit = len(r.json())
for g,... | [
"def",
"getMyID",
"(",
"self",
",",
"gist_name",
")",
":",
"r",
"=",
"requests",
".",
"get",
"(",
"'%s'",
"%",
"BASE_URL",
"+",
"'/users/%s/gists'",
"%",
"self",
".",
"user",
",",
"headers",
"=",
"self",
".",
"gist",
".",
"header",
")",
"if",
"(",
... | Getting gistID of a gist in order to make the workflow
easy and uninterrupted. | [
"Getting",
"gistID",
"of",
"a",
"gist",
"in",
"order",
"to",
"make",
"the",
"workflow",
"easy",
"and",
"uninterrupted",
"."
] | 8d53edd15d76c7b10fb963a659c1cf9f46f5345d | https://github.com/softvar/simplegist/blob/8d53edd15d76c7b10fb963a659c1cf9f46f5345d/simplegist/comments.py#L10-L29 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.close | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | python | def close(self):
"""Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close ea... | [
"def",
"close",
"(",
"self",
")",
":",
"assert",
"self",
".",
"__closed",
"==",
"False",
"self",
".",
"__closed",
"=",
"True",
"self",
".",
"finish_periodic",
"(",
")",
"# required to finish periodic operations during tests",
"# dialogs",
"for",
"weak_dialog",
"in... | Close the document controller.
This method must be called to shut down the document controller. There are several
paths by which it can be called, though.
* User quits application via menu item. The menu item will call back to Application.exit which will close each
document con... | [
"Close",
"the",
"document",
"controller",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L130-L194 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.add_periodic | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | python | def add_periodic(self, interval: float, listener_fn):
"""Add a listener function and return listener token. Token can be closed or deleted to unlisten."""
class PeriodicListener:
def __init__(self, interval: float, listener_fn):
self.interval = interval
self._... | [
"def",
"add_periodic",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"class",
"PeriodicListener",
":",
"def",
"__init__",
"(",
"self",
",",
"interval",
":",
"float",
",",
"listener_fn",
")",
":",
"self",
".",
"interval",
"=",
... | Add a listener function and return listener token. Token can be closed or deleted to unlisten. | [
"Add",
"a",
"listener",
"function",
"and",
"return",
"listener",
"token",
".",
"Token",
"can",
"be",
"closed",
"or",
"deleted",
"to",
"unlisten",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L562-L589 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.__update_display_items_model | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | python | def __update_display_items_model(self, display_items_model: ListModel.FilteredListModel, data_group: typing.Optional[DataGroup.DataGroup], filter_id: typing.Optional[str]) -> None:
"""Update the data item model with a new container, filter, and sorting.
This is called when the data item model is create... | [
"def",
"__update_display_items_model",
"(",
"self",
",",
"display_items_model",
":",
"ListModel",
".",
"FilteredListModel",
",",
"data_group",
":",
"typing",
".",
"Optional",
"[",
"DataGroup",
".",
"DataGroup",
"]",
",",
"filter_id",
":",
"typing",
".",
"Optional"... | Update the data item model with a new container, filter, and sorting.
This is called when the data item model is created or when the user changes
the data group or sorting settings. | [
"Update",
"the",
"data",
"item",
"model",
"with",
"a",
"new",
"container",
"filter",
"and",
"sorting",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L658-L694 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.focused_data_item | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | python | def focused_data_item(self) -> typing.Optional[DataItem.DataItem]:
"""Return the data item with keyboard focus."""
return self.__focused_display_item.data_item if self.__focused_display_item else None | [
"def",
"focused_data_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DataItem",
".",
"DataItem",
"]",
":",
"return",
"self",
".",
"__focused_display_item",
".",
"data_item",
"if",
"self",
".",
"__focused_display_item",
"else",
"None"
] | Return the data item with keyboard focus. | [
"Return",
"the",
"data",
"item",
"with",
"keyboard",
"focus",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L772-L774 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController.selected_display_item | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | python | def selected_display_item(self) -> typing.Optional[DisplayItem.DisplayItem]:
"""Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel.
"""
# first check for the [focused] data browser
display_item =... | [
"def",
"selected_display_item",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"DisplayItem",
".",
"DisplayItem",
"]",
":",
"# first check for the [focused] data browser",
"display_item",
"=",
"self",
".",
"focused_display_item",
"if",
"not",
"display_item",
... | Return the selected display item.
The selected display is the display ite that has keyboard focus in the data panel or a display panel. | [
"Return",
"the",
"selected",
"display",
"item",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L795-L805 | train |
nion-software/nionswift | nion/swift/DocumentController.py | DocumentController._get_two_data_sources | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | python | def _get_two_data_sources(self):
"""Get two sensible data sources, which may be the same."""
selected_display_items = self.selected_display_items
if len(selected_display_items) < 2:
selected_display_items = list()
display_item = self.selected_display_item
if d... | [
"def",
"_get_two_data_sources",
"(",
"self",
")",
":",
"selected_display_items",
"=",
"self",
".",
"selected_display_items",
"if",
"len",
"(",
"selected_display_items",
")",
"<",
"2",
":",
"selected_display_items",
"=",
"list",
"(",
")",
"display_item",
"=",
"self... | Get two sensible data sources, which may be the same. | [
"Get",
"two",
"sensible",
"data",
"sources",
"which",
"may",
"be",
"the",
"same",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/DocumentController.py#L2053-L2092 | train |
nion-software/nionswift | nion/swift/ImageCanvasItem.py | calculate_origin_and_size | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | python | def calculate_origin_and_size(canvas_size, data_shape, image_canvas_mode, image_zoom, image_position) -> typing.Tuple[typing.Any, typing.Any]:
"""Calculate origin and size for canvas size, data shape, and image display parameters."""
if data_shape is None:
return None, None
if image_canvas_mode == "... | [
"def",
"calculate_origin_and_size",
"(",
"canvas_size",
",",
"data_shape",
",",
"image_canvas_mode",
",",
"image_zoom",
",",
"image_position",
")",
"->",
"typing",
".",
"Tuple",
"[",
"typing",
".",
"Any",
",",
"typing",
".",
"Any",
"]",
":",
"if",
"data_shape"... | Calculate origin and size for canvas size, data shape, and image display parameters. | [
"Calculate",
"origin",
"and",
"size",
"for",
"canvas",
"size",
"data",
"shape",
"and",
"image",
"display",
"parameters",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/ImageCanvasItem.py#L332-L360 | train |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | read_library | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | python | def read_library(persistent_storage_system, ignore_older_files) -> typing.Dict:
"""Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items.
"""
data_it... | [
"def",
"read_library",
"(",
"persistent_storage_system",
",",
"ignore_older_files",
")",
"->",
"typing",
".",
"Dict",
":",
"data_item_uuids",
"=",
"set",
"(",
")",
"utilized_deletions",
"=",
"set",
"(",
")",
"# the uuid's skipped due to being deleted",
"deletions",
"=... | Read data items from the data reference handler and return as a list.
Data items will have persistent_object_context set upon return, but caller will need to call finish_reading
on each of the data items. | [
"Read",
"data",
"items",
"from",
"the",
"data",
"reference",
"handler",
"and",
"return",
"as",
"a",
"list",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L419-L567 | train |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | auto_migrate_storage_system | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | python | def auto_migrate_storage_system(*, persistent_storage_system=None, new_persistent_storage_system=None, data_item_uuids=None, deletions: typing.List[uuid.UUID] = None, utilized_deletions: typing.Set[uuid.UUID] = None, ignore_older_files: bool = True):
"""Migrate items from the storage system to the object context.
... | [
"def",
"auto_migrate_storage_system",
"(",
"*",
",",
"persistent_storage_system",
"=",
"None",
",",
"new_persistent_storage_system",
"=",
"None",
",",
"data_item_uuids",
"=",
"None",
",",
"deletions",
":",
"typing",
".",
"List",
"[",
"uuid",
".",
"UUID",
"]",
"=... | Migrate items from the storage system to the object context.
Files in data_item_uuids have already been loaded and are ignored (not migrated).
Files in deletes have been deleted in object context and are ignored (not migrated) and then added
to the utilized deletions list.
Data items will have persis... | [
"Migrate",
"items",
"from",
"the",
"storage",
"system",
"to",
"the",
"object",
"context",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L601-L658 | train |
nion-software/nionswift | nion/swift/model/FileStorageSystem.py | FileStorageSystem.rewrite_properties | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | python | def rewrite_properties(self, properties):
"""Set the properties and write to disk."""
with self.__properties_lock:
self.__properties = properties
self.__write_properties(None) | [
"def",
"rewrite_properties",
"(",
"self",
",",
"properties",
")",
":",
"with",
"self",
".",
"__properties_lock",
":",
"self",
".",
"__properties",
"=",
"properties",
"self",
".",
"__write_properties",
"(",
"None",
")"
] | Set the properties and write to disk. | [
"Set",
"the",
"properties",
"and",
"write",
"to",
"disk",
"."
] | d43693eaf057b8683b9638e575000f055fede452 | https://github.com/nion-software/nionswift/blob/d43693eaf057b8683b9638e575000f055fede452/nion/swift/model/FileStorageSystem.py#L137-L141 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.