hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | open_connection | null | def open_connection(self, **para):
"""Open the connection to the instr using the `connection_str`.
"""
super(LockInSR7265, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n' | Open the connection to the instr using the `connection_str`.
| Open the connection to the instr using the `connection_str`. | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`",
"."
] | def open_connection(self, **para):
super(LockInSR7265, self).open_connection(**para)
self.write_termination = '\n'
self.read_termination = '\n' | [
"def",
"open_connection",
"(",
"self",
",",
"**",
"para",
")",
":",
"super",
"(",
"LockInSR7265",
",",
"self",
")",
".",
"open_connection",
"(",
"**",
"para",
")",
"self",
".",
"write_termination",
"=",
"'\\n'",
"self",
".",
"read_termination",
"=",
"'\\n'... | Open the connection to the instr using the `connection_str`. | [
"Open",
"the",
"connection",
"to",
"the",
"instr",
"using",
"the",
"`",
"connection_str",
"`",
"."
] | [
"\"\"\"Open the connection to the instr using the `connection_str`.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_x | <not_specific> | def read_x(self):
"""
Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('X.')
status = self._check_status()
if... |
Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"x",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
"often",
"."
] | def read_x(self):
value = self.query('X.')
status = self._check_status()
if status != 'OK' or not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_x",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'X.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The command di... | Return the x quadrature measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"x",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the x quadrature measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_y | <not_specific> | def read_y(self):
"""
Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('Y.')
status = self._check_status()
if... |
Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"y",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
"often",
"."
] | def read_y(self):
value = self.query('Y.')
status = self._check_status()
if status != 'OK' or not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_y",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'Y.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The command di... | Return the y quadrature measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"y",
"quadrature",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the y quadrature measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_xy | <not_specific> | def read_xy(self):
"""
Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
values = self.query_ascii_values('XY.')
status = self._ch... |
Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"x",
"and",
"y",
"quadratures",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
... | def read_xy(self):
values = self.query_ascii_values('XY.')
status = self._check_status()
if status != 'OK' or not values:
raise InstrIOError('The command did not complete correctly')
else:
return values | [
"def",
"read_xy",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"query_ascii_values",
"(",
"'XY.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"values",
":",
"raise",
"InstrIOError",
"(",
... | Return the x and y quadratures measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"x",
"and",
"y",
"quadratures",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the x and y quadratures measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_amplitude | <not_specific> | def read_amplitude(self):
"""
Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('MAG.')
status = self._chec... |
Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"amplitude",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too... | def read_amplitude(self):
value = self.query('MAG.')
status = self._check_status()
if status != 'OK' or not value:
return InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_amplitude",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'MAG.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"value",
":",
"return",
"InstrIOError",
"(",
"'The... | Return the amplitude of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"amplitude",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the amplitude of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_phase | <not_specific> | def read_phase(self):
"""
Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
value = self.query('PHA.')
status = self._check_status... |
Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",
"queried",
"too",
... | def read_phase(self):
value = self.query('PHA.')
status = self._check_status()
if status != 'OK' or not value:
raise InstrIOError('The command did not complete correctly')
else:
return float(value) | [
"def",
"read_phase",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"query",
"(",
"'PHA.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"value",
":",
"raise",
"InstrIOError",
"(",
"'The comm... | Return the phase of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the phase of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | read_amp_and_phase | <not_specific> | def read_amp_and_phase(self):
"""
Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
"""
values = self.query_ascii_values('MP.')
... |
Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often.
| Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. Can return non
independent values if the instrument is queried too often. | [
"Return",
"the",
"amplitude",
"and",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
".",
"Can",
"return",
"non",
"independent",
"values",
"if",
"the",
"instrument",
"is",... | def read_amp_and_phase(self):
values = self.query_ascii_values('MP.')
status = self._check_status()
if status != 'OK' or not values:
raise InstrIOError('The command did not complete correctly')
else:
return values | [
"def",
"read_amp_and_phase",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"query_ascii_values",
"(",
"'MP.'",
")",
"status",
"=",
"self",
".",
"_check_status",
"(",
")",
"if",
"status",
"!=",
"'OK'",
"or",
"not",
"values",
":",
"raise",
"InstrIOError... | Return the amplitude and phase of the signal measured by the instrument
Perform a direct reading without any waiting. | [
"Return",
"the",
"amplitude",
"and",
"phase",
"of",
"the",
"signal",
"measured",
"by",
"the",
"instrument",
"Perform",
"a",
"direct",
"reading",
"without",
"any",
"waiting",
"."
] | [
"\"\"\"\n Return the amplitude and phase of the signal measured by the instrument\n\n Perform a direct reading without any waiting. Can return non\n independent values if the instrument is queried too often.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | _check_status | <not_specific> | def _check_status(self):
"""
Read the value of the status byte to determine if the last command
executed properly
"""
bites = self.query('ST')
status_byte = ('{0:08b}'.format(ord(bites[0])))[::-1]
if not status_byte[0]:
return 'Command went wrong'
... |
Read the value of the status byte to determine if the last command
executed properly
| Read the value of the status byte to determine if the last command
executed properly | [
"Read",
"the",
"value",
"of",
"the",
"status",
"byte",
"to",
"determine",
"if",
"the",
"last",
"command",
"executed",
"properly"
] | def _check_status(self):
bites = self.query('ST')
status_byte = ('{0:08b}'.format(ord(bites[0])))[::-1]
if not status_byte[0]:
return 'Command went wrong'
else:
return 'OK' | [
"def",
"_check_status",
"(",
"self",
")",
":",
"bites",
"=",
"self",
".",
"query",
"(",
"'ST'",
")",
"status_byte",
"=",
"(",
"'{0:08b}'",
".",
"format",
"(",
"ord",
"(",
"bites",
"[",
"0",
"]",
")",
")",
")",
"[",
":",
":",
"-",
"1",
"]",
"if"... | Read the value of the status byte to determine if the last command
executed properly | [
"Read",
"the",
"value",
"of",
"the",
"status",
"byte",
"to",
"determine",
"if",
"the",
"last",
"command",
"executed",
"properly"
] | [
"\"\"\"\n Read the value of the status byte to determine if the last command\n executed properly\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
860f720ffe7588385df94d8d59f987c0460f0c30 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/visa/lock_in_sr72_series.py | [
"BSD-3-Clause"
] | Python | _check_status | <not_specific> | def _check_status(self):
"""
Read the value of the status byte to determine if the last command
executed properly
"""
bites = self.read()
status_byte = ('{0:08b}'.format(ord(bites[0])))[::-1]
if not status_byte[0]:
return 'Command went wrong'
e... |
Read the value of the status byte to determine if the last command
executed properly
| Read the value of the status byte to determine if the last command
executed properly | [
"Read",
"the",
"value",
"of",
"the",
"status",
"byte",
"to",
"determine",
"if",
"the",
"last",
"command",
"executed",
"properly"
] | def _check_status(self):
bites = self.read()
status_byte = ('{0:08b}'.format(ord(bites[0])))[::-1]
if not status_byte[0]:
return 'Command went wrong'
else:
return 'OK' | [
"def",
"_check_status",
"(",
"self",
")",
":",
"bites",
"=",
"self",
".",
"read",
"(",
")",
"status_byte",
"=",
"(",
"'{0:08b}'",
".",
"format",
"(",
"ord",
"(",
"bites",
"[",
"0",
"]",
")",
")",
")",
"[",
":",
":",
"-",
"1",
"]",
"if",
"not",
... | Read the value of the status byte to determine if the last command
executed properly | [
"Read",
"the",
"value",
"of",
"the",
"status",
"byte",
"to",
"determine",
"if",
"the",
"last",
"command",
"executed",
"properly"
] | [
"\"\"\"\n Read the value of the status byte to determine if the last command\n executed properly\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6203b5e69f295d06716b2ba92b76be575881b2f8 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/__init__.py | [
"BSD-3-Clause"
] | Python | list_manifests | <not_specific> | def list_manifests():
"""List the manifest that should be regsitered when the main Exopy app is
started.
"""
import enaml
with enaml.imports():
from .manifest import HqcLegacyManifest
manifests = [HqcLegacyManifest]
try:
with enaml.imports():
from .pulses.mani... | List the manifest that should be regsitered when the main Exopy app is
started.
| List the manifest that should be regsitered when the main Exopy app is
started. | [
"List",
"the",
"manifest",
"that",
"should",
"be",
"regsitered",
"when",
"the",
"main",
"Exopy",
"app",
"is",
"started",
"."
] | def list_manifests():
import enaml
with enaml.imports():
from .manifest import HqcLegacyManifest
manifests = [HqcLegacyManifest]
try:
with enaml.imports():
from .pulses.manifest import HqcLegacyPulsesManifest
manifests.append(HqcLegacyPulsesManifest)
except Import... | [
"def",
"list_manifests",
"(",
")",
":",
"import",
"enaml",
"with",
"enaml",
".",
"imports",
"(",
")",
":",
"from",
".",
"manifest",
"import",
"HqcLegacyManifest",
"manifests",
"=",
"[",
"HqcLegacyManifest",
"]",
"try",
":",
"with",
"enaml",
".",
"imports",
... | List the manifest that should be regsitered when the main Exopy app is
started. | [
"List",
"the",
"manifest",
"that",
"should",
"be",
"regsitered",
"when",
"the",
"main",
"Exopy",
"app",
"is",
"started",
"."
] | [
"\"\"\"List the manifest that should be regsitered when the main Exopy app is\n started.\n\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
dc772471b02649e66d2ed9615958f4d9936ce4a3 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/starters/legacy_starter.py | [
"BSD-3-Clause"
] | Python | check_infos | <not_specific> | def check_infos(self, driver_cls, connection, settings):
"""Attempt to open the connection to the instrument.
"""
c = self.format_connection_infos(connection)
c.update(settings)
driver = None
try:
driver = driver_cls(c)
res = driver.connected
... | Attempt to open the connection to the instrument.
| Attempt to open the connection to the instrument. | [
"Attempt",
"to",
"open",
"the",
"connection",
"to",
"the",
"instrument",
"."
] | def check_infos(self, driver_cls, connection, settings):
c = self.format_connection_infos(connection)
c.update(settings)
driver = None
try:
driver = driver_cls(c)
res = driver.connected
except Exception:
return False, format_exc()
final... | [
"def",
"check_infos",
"(",
"self",
",",
"driver_cls",
",",
"connection",
",",
"settings",
")",
":",
"c",
"=",
"self",
".",
"format_connection_infos",
"(",
"connection",
")",
"c",
".",
"update",
"(",
"settings",
")",
"driver",
"=",
"None",
"try",
":",
"dr... | Attempt to open the connection to the instrument. | [
"Attempt",
"to",
"open",
"the",
"connection",
"to",
"the",
"instrument",
"."
] | [
"\"\"\"Attempt to open the connection to the instrument.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "driver_cls",
"type": null
},
{
"param": "connection",
"type": null
},
{
"param": "settings",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "driver_cls",
"type": null,
"docstring": null,
"docstring_toke... |
dc772471b02649e66d2ed9615958f4d9936ce4a3 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/starters/legacy_starter.py | [
"BSD-3-Clause"
] | Python | format_connection_infos | null | def format_connection_infos(self, infos):
"""Format the connection to match the expectancy of the driver.
"""
raise NotImplementedError() | Format the connection to match the expectancy of the driver.
| Format the connection to match the expectancy of the driver. | [
"Format",
"the",
"connection",
"to",
"match",
"the",
"expectancy",
"of",
"the",
"driver",
"."
] | def format_connection_infos(self, infos):
raise NotImplementedError() | [
"def",
"format_connection_infos",
"(",
"self",
",",
"infos",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | Format the connection to match the expectancy of the driver. | [
"Format",
"the",
"connection",
"to",
"match",
"the",
"expectancy",
"of",
"the",
"driver",
"."
] | [
"\"\"\"Format the connection to match the expectancy of the driver.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infos",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc772471b02649e66d2ed9615958f4d9936ce4a3 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/starters/legacy_starter.py | [
"BSD-3-Clause"
] | Python | format_connection_infos | <not_specific> | def format_connection_infos(self, infos):
"""Use pyvisa to build the canonical resource name.
"""
from pyvisa.rname import assemble_canonical_name
infos = {k: v for k, v in infos.items() if v}
if 'resource_name' in infos:
return {'resource_name': infos['resource_name... | Use pyvisa to build the canonical resource name.
| Use pyvisa to build the canonical resource name. | [
"Use",
"pyvisa",
"to",
"build",
"the",
"canonical",
"resource",
"name",
"."
] | def format_connection_infos(self, infos):
from pyvisa.rname import assemble_canonical_name
infos = {k: v for k, v in infos.items() if v}
if 'resource_name' in infos:
return {'resource_name': infos['resource_name']}
else:
return {'resource_name': assemble_canonical... | [
"def",
"format_connection_infos",
"(",
"self",
",",
"infos",
")",
":",
"from",
"pyvisa",
".",
"rname",
"import",
"assemble_canonical_name",
"infos",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"infos",
".",
"items",
"(",
")",
"if",
"v",
"}",
... | Use pyvisa to build the canonical resource name. | [
"Use",
"pyvisa",
"to",
"build",
"the",
"canonical",
"resource",
"name",
"."
] | [
"\"\"\"Use pyvisa to build the canonical resource name.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infos",
"type": null,
"docstring": null,
"docstring_tokens": ... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | load_library | null | def load_library():
"""Load the ATS library and register the c signatures.
"""
global ats
if os.name == 'nt':
ats = CDLL("ATSApi.dll")
elif os.name == 'posix':
ats = CDLL("libATSApi.so")
else:
raise Exception("Unsupported OS")
# Registering c signature for ctypes to... | Load the ATS library and register the c signatures.
| Load the ATS library and register the c signatures. | [
"Load",
"the",
"ATS",
"library",
"and",
"register",
"the",
"c",
"signatures",
"."
] | def load_library():
global ats
if os.name == 'nt':
ats = CDLL("ATSApi.dll")
elif os.name == 'posix':
ats = CDLL("libATSApi.so")
else:
raise Exception("Unsupported OS")
ats.AlazarErrorToText.restype = c_char_p
ats.AlazarErrorToText.argtypes = [U32]
ats.AlazarGetBoardBy... | [
"def",
"load_library",
"(",
")",
":",
"global",
"ats",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"ats",
"=",
"CDLL",
"(",
"\"ATSApi.dll\"",
")",
"elif",
"os",
".",
"name",
"==",
"'posix'",
":",
"ats",
"=",
"CDLL",
"(",
"\"libATSApi.so\"",
")",
"els... | Load the ATS library and register the c signatures. | [
"Load",
"the",
"ATS",
"library",
"and",
"register",
"the",
"c",
"signatures",
"."
] | [
"\"\"\"Load the ATS library and register the c signatures.\n\n \"\"\"",
"# Registering c signature for ctypes to perform automatic conversions"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | abortAsyncRead | null | def abortAsyncRead(self):
"""Cancels any asynchronous acquisition running on a board.
"""
ats.AlazarAbortAsyncRead(self.handle) | Cancels any asynchronous acquisition running on a board.
| Cancels any asynchronous acquisition running on a board. | [
"Cancels",
"any",
"asynchronous",
"acquisition",
"running",
"on",
"a",
"board",
"."
] | def abortAsyncRead(self):
ats.AlazarAbortAsyncRead(self.handle) | [
"def",
"abortAsyncRead",
"(",
"self",
")",
":",
"ats",
".",
"AlazarAbortAsyncRead",
"(",
"self",
".",
"handle",
")"
] | Cancels any asynchronous acquisition running on a board. | [
"Cancels",
"any",
"asynchronous",
"acquisition",
"running",
"on",
"a",
"board",
"."
] | [
"\"\"\"Cancels any asynchronous acquisition running on a board.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | abortCapture | null | def abortCapture(self):
"""Abort an acquisition to on-board memory.
"""
ats.AlazarAbortCapture(self.handle) | Abort an acquisition to on-board memory.
| Abort an acquisition to on-board memory. | [
"Abort",
"an",
"acquisition",
"to",
"on",
"-",
"board",
"memory",
"."
] | def abortCapture(self):
ats.AlazarAbortCapture(self.handle) | [
"def",
"abortCapture",
"(",
"self",
")",
":",
"ats",
".",
"AlazarAbortCapture",
"(",
"self",
".",
"handle",
")"
] | Abort an acquisition to on-board memory. | [
"Abort",
"an",
"acquisition",
"to",
"on",
"-",
"board",
"memory",
"."
] | [
"\"\"\"Abort an acquisition to on-board memory.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | beforeAsyncRead | null | def beforeAsyncRead(self, channels, transferOffset, samplesPerRecord,
recordsPerBuffer, recordsPerAcquisition, flags):
"""Prepares the board for an asynchronous acquisition.
"""
ats.AlazarBeforeAsyncRead(self.handle, channels, transferOffset,
... | Prepares the board for an asynchronous acquisition.
| Prepares the board for an asynchronous acquisition. | [
"Prepares",
"the",
"board",
"for",
"an",
"asynchronous",
"acquisition",
"."
] | def beforeAsyncRead(self, channels, transferOffset, samplesPerRecord,
recordsPerBuffer, recordsPerAcquisition, flags):
ats.AlazarBeforeAsyncRead(self.handle, channels, transferOffset,
samplesPerRecord, recordsPerBuffer,
... | [
"def",
"beforeAsyncRead",
"(",
"self",
",",
"channels",
",",
"transferOffset",
",",
"samplesPerRecord",
",",
"recordsPerBuffer",
",",
"recordsPerAcquisition",
",",
"flags",
")",
":",
"ats",
".",
"AlazarBeforeAsyncRead",
"(",
"self",
".",
"handle",
",",
"channels",... | Prepares the board for an asynchronous acquisition. | [
"Prepares",
"the",
"board",
"for",
"an",
"asynchronous",
"acquisition",
"."
] | [
"\"\"\"Prepares the board for an asynchronous acquisition.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "channels",
"type": null
},
{
"param": "transferOffset",
"type": null
},
{
"param": "samplesPerRecord",
"type": null
},
{
"param": "recordsPerBuffer",
"type": null
},
{
"param": "recordsPerAcquisition",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "channels",
"type": null,
"docstring": null,
"docstring_tokens... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | busy | <not_specific> | def busy(self):
"""Determine if an acquisition to on-board memory is in progress.
"""
return True if (ats.AlazarBusy(self.handle) > 0) else False | Determine if an acquisition to on-board memory is in progress.
| Determine if an acquisition to on-board memory is in progress. | [
"Determine",
"if",
"an",
"acquisition",
"to",
"on",
"-",
"board",
"memory",
"is",
"in",
"progress",
"."
] | def busy(self):
return True if (ats.AlazarBusy(self.handle) > 0) else False | [
"def",
"busy",
"(",
"self",
")",
":",
"return",
"True",
"if",
"(",
"ats",
".",
"AlazarBusy",
"(",
"self",
".",
"handle",
")",
">",
"0",
")",
"else",
"False"
] | Determine if an acquisition to on-board memory is in progress. | [
"Determine",
"if",
"an",
"acquisition",
"to",
"on",
"-",
"board",
"memory",
"is",
"in",
"progress",
"."
] | [
"\"\"\"Determine if an acquisition to on-board memory is in progress.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | forceTriggerEnable | null | def forceTriggerEnable(self):
"""Generate a software trigger enable event.
"""
ats.AlazarForceTriggerEnable(self.handle) | Generate a software trigger enable event.
| Generate a software trigger enable event. | [
"Generate",
"a",
"software",
"trigger",
"enable",
"event",
"."
] | def forceTriggerEnable(self):
ats.AlazarForceTriggerEnable(self.handle) | [
"def",
"forceTriggerEnable",
"(",
"self",
")",
":",
"ats",
".",
"AlazarForceTriggerEnable",
"(",
"self",
".",
"handle",
")"
] | Generate a software trigger enable event. | [
"Generate",
"a",
"software",
"trigger",
"enable",
"event",
"."
] | [
"\"\"\"Generate a software trigger enable event.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | inputControl | null | def inputControl(self, channel, coupling, inputRange, impedance):
"""Configures one input channel on a board.
"""
ats.AlazarInputControl(self.handle, channel, coupling, inputRange,
impedance) | Configures one input channel on a board.
| Configures one input channel on a board. | [
"Configures",
"one",
"input",
"channel",
"on",
"a",
"board",
"."
] | def inputControl(self, channel, coupling, inputRange, impedance):
ats.AlazarInputControl(self.handle, channel, coupling, inputRange,
impedance) | [
"def",
"inputControl",
"(",
"self",
",",
"channel",
",",
"coupling",
",",
"inputRange",
",",
"impedance",
")",
":",
"ats",
".",
"AlazarInputControl",
"(",
"self",
".",
"handle",
",",
"channel",
",",
"coupling",
",",
"inputRange",
",",
"impedance",
")"
] | Configures one input channel on a board. | [
"Configures",
"one",
"input",
"channel",
"on",
"a",
"board",
"."
] | [
"\"\"\"Configures one input channel on a board.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "channel",
"type": null
},
{
"param": "coupling",
"type": null
},
{
"param": "inputRange",
"type": null
},
{
"param": "impedance",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "channel",
"type": null,
"docstring": null,
"docstring_tokens"... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | numOfSystems | null | def numOfSystems():
"""Returns the number of board systems installed.
"""
ats.AlazarNumOfSystems() | Returns the number of board systems installed.
| Returns the number of board systems installed. | [
"Returns",
"the",
"number",
"of",
"board",
"systems",
"installed",
"."
] | def numOfSystems():
ats.AlazarNumOfSystems() | [
"def",
"numOfSystems",
"(",
")",
":",
"ats",
".",
"AlazarNumOfSystems",
"(",
")"
] | Returns the number of board systems installed. | [
"Returns",
"the",
"number",
"of",
"board",
"systems",
"installed",
"."
] | [
"\"\"\"Returns the number of board systems installed.\n\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | postAsyncBuffer | null | def postAsyncBuffer(self, buffer, bufferLength):
"""Posts a DMA buffer to a board.
"""
ats.AlazarPostAsyncBuffer(self.handle, buffer, bufferLength) | Posts a DMA buffer to a board.
| Posts a DMA buffer to a board. | [
"Posts",
"a",
"DMA",
"buffer",
"to",
"a",
"board",
"."
] | def postAsyncBuffer(self, buffer, bufferLength):
ats.AlazarPostAsyncBuffer(self.handle, buffer, bufferLength) | [
"def",
"postAsyncBuffer",
"(",
"self",
",",
"buffer",
",",
"bufferLength",
")",
":",
"ats",
".",
"AlazarPostAsyncBuffer",
"(",
"self",
".",
"handle",
",",
"buffer",
",",
"bufferLength",
")"
] | Posts a DMA buffer to a board. | [
"Posts",
"a",
"DMA",
"buffer",
"to",
"a",
"board",
"."
] | [
"\"\"\"Posts a DMA buffer to a board.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "buffer",
"type": null
},
{
"param": "bufferLength",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": null,
"docstring": null,
"docstring_tokens":... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | read | null | def read(self, channelId, buffer, elementSize, record, transferOffset,
transferLength):
"""Read all or part of a record from on-board memory.
"""
ats.AlazarReadEx(self.handle, channelId, buffer, elementSize, record,
transferOffset, transferLength) | Read all or part of a record from on-board memory.
| Read all or part of a record from on-board memory. | [
"Read",
"all",
"or",
"part",
"of",
"a",
"record",
"from",
"on",
"-",
"board",
"memory",
"."
] | def read(self, channelId, buffer, elementSize, record, transferOffset,
transferLength):
ats.AlazarReadEx(self.handle, channelId, buffer, elementSize, record,
transferOffset, transferLength) | [
"def",
"read",
"(",
"self",
",",
"channelId",
",",
"buffer",
",",
"elementSize",
",",
"record",
",",
"transferOffset",
",",
"transferLength",
")",
":",
"ats",
".",
"AlazarReadEx",
"(",
"self",
".",
"handle",
",",
"channelId",
",",
"buffer",
",",
"elementSi... | Read all or part of a record from on-board memory. | [
"Read",
"all",
"or",
"part",
"of",
"a",
"record",
"from",
"on",
"-",
"board",
"memory",
"."
] | [
"\"\"\"Read all or part of a record from on-board memory.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "channelId",
"type": null
},
{
"param": "buffer",
"type": null
},
{
"param": "elementSize",
"type": null
},
{
"param": "record",
"type": null
},
{
"param": "transferOffset",
"type": null
},
{
"p... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "channelId",
"type": null,
"docstring": null,
"docstring_token... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | resetTimeStamp | null | def resetTimeStamp(self, option):
"""Control record timestamp counter reset.
"""
ats.AlazarResetTimeStamp(self.handle, option) | Control record timestamp counter reset.
| Control record timestamp counter reset. | [
"Control",
"record",
"timestamp",
"counter",
"reset",
"."
] | def resetTimeStamp(self, option):
ats.AlazarResetTimeStamp(self.handle, option) | [
"def",
"resetTimeStamp",
"(",
"self",
",",
"option",
")",
":",
"ats",
".",
"AlazarResetTimeStamp",
"(",
"self",
".",
"handle",
",",
"option",
")"
] | Control record timestamp counter reset. | [
"Control",
"record",
"timestamp",
"counter",
"reset",
"."
] | [
"\"\"\"Control record timestamp counter reset.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "option",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "option",
"type": null,
"docstring": null,
"docstring_tokens":... |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | triggered | <not_specific> | def triggered(self):
"""Determine if a board has triggered during the current acquisition.
"""
return ats.AlazarTriggered(self.handle) | Determine if a board has triggered during the current acquisition.
| Determine if a board has triggered during the current acquisition. | [
"Determine",
"if",
"a",
"board",
"has",
"triggered",
"during",
"the",
"current",
"acquisition",
"."
] | def triggered(self):
return ats.AlazarTriggered(self.handle) | [
"def",
"triggered",
"(",
"self",
")",
":",
"return",
"ats",
".",
"AlazarTriggered",
"(",
"self",
".",
"handle",
")"
] | Determine if a board has triggered during the current acquisition. | [
"Determine",
"if",
"a",
"board",
"has",
"triggered",
"during",
"the",
"current",
"acquisition",
"."
] | [
"\"\"\"Determine if a board has triggered during the current acquisition.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
63337f52938b90bf27b5b71b59a144fe9a711557 | rassouly/exopy_hqc_legacy | exopy_hqc_legacy/instruments/drivers/dll/atsapi.py | [
"BSD-3-Clause"
] | Python | waitAsyncBufferComplete | null | def waitAsyncBufferComplete(self, buffer, timeout_ms):
"""Blocks until the board confirms that buffer is filled with data.
"""
ats.AlazarWaitAsyncBufferComplete(self.handle, buffer, timeout_ms) | Blocks until the board confirms that buffer is filled with data.
| Blocks until the board confirms that buffer is filled with data. | [
"Blocks",
"until",
"the",
"board",
"confirms",
"that",
"buffer",
"is",
"filled",
"with",
"data",
"."
] | def waitAsyncBufferComplete(self, buffer, timeout_ms):
ats.AlazarWaitAsyncBufferComplete(self.handle, buffer, timeout_ms) | [
"def",
"waitAsyncBufferComplete",
"(",
"self",
",",
"buffer",
",",
"timeout_ms",
")",
":",
"ats",
".",
"AlazarWaitAsyncBufferComplete",
"(",
"self",
".",
"handle",
",",
"buffer",
",",
"timeout_ms",
")"
] | Blocks until the board confirms that buffer is filled with data. | [
"Blocks",
"until",
"the",
"board",
"confirms",
"that",
"buffer",
"is",
"filled",
"with",
"data",
"."
] | [
"\"\"\"Blocks until the board confirms that buffer is filled with data.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "buffer",
"type": null
},
{
"param": "timeout_ms",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buffer",
"type": null,
"docstring": null,
"docstring_tokens":... |
038f9f5d38cb362a8b0ef8aca083bf2faebbdd04 | rassouly/exopy_hqc_legacy | tests/tasks/tasks/conftest.py | [
"BSD-3-Clause"
] | Python | task_workbench | null | def task_workbench(task_workbench):
"""Task workbench in which the HqcLegacyManifest has been registered.
"""
task_workbench.register(HqcLegacyManifest())
yield task_workbench
task_workbench.unregister('exopy_hqc_legacy') | Task workbench in which the HqcLegacyManifest has been registered.
| Task workbench in which the HqcLegacyManifest has been registered. | [
"Task",
"workbench",
"in",
"which",
"the",
"HqcLegacyManifest",
"has",
"been",
"registered",
"."
] | def task_workbench(task_workbench):
task_workbench.register(HqcLegacyManifest())
yield task_workbench
task_workbench.unregister('exopy_hqc_legacy') | [
"def",
"task_workbench",
"(",
"task_workbench",
")",
":",
"task_workbench",
".",
"register",
"(",
"HqcLegacyManifest",
"(",
")",
")",
"yield",
"task_workbench",
"task_workbench",
".",
"unregister",
"(",
"'exopy_hqc_legacy'",
")"
] | Task workbench in which the HqcLegacyManifest has been registered. | [
"Task",
"workbench",
"in",
"which",
"the",
"HqcLegacyManifest",
"has",
"been",
"registered",
"."
] | [
"\"\"\"Task workbench in which the HqcLegacyManifest has been registered.\n\n \"\"\""
] | [
{
"param": "task_workbench",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "task_workbench",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | list_item_info | <not_specific> | def list_item_info(self, truncate=True):
"""Returns a list of strings corresponding to the attributes of this QueueItem
instance. If `truncate=True` (the default), the `task_id` and `published` time
will be shortened.
"""
info = []
task_id_field = str(self.task_id)
... | Returns a list of strings corresponding to the attributes of this QueueItem
instance. If `truncate=True` (the default), the `task_id` and `published` time
will be shortened.
| Returns a list of strings corresponding to the attributes of this QueueItem
instance. | [
"Returns",
"a",
"list",
"of",
"strings",
"corresponding",
"to",
"the",
"attributes",
"of",
"this",
"QueueItem",
"instance",
"."
] | def list_item_info(self, truncate=True):
info = []
task_id_field = str(self.task_id)
if truncate:
task_id_field = task_id_field.split("-")[0] + "-"
info.append(task_id_field)
else:
info.append(task_id_field)
info.append(self.queue_name)
... | [
"def",
"list_item_info",
"(",
"self",
",",
"truncate",
"=",
"True",
")",
":",
"info",
"=",
"[",
"]",
"task_id_field",
"=",
"str",
"(",
"self",
".",
"task_id",
")",
"if",
"truncate",
":",
"task_id_field",
"=",
"task_id_field",
".",
"split",
"(",
"\"-\"",
... | Returns a list of strings corresponding to the attributes of this QueueItem
instance. | [
"Returns",
"a",
"list",
"of",
"strings",
"corresponding",
"to",
"the",
"attributes",
"of",
"this",
"QueueItem",
"instance",
"."
] | [
"\"\"\"Returns a list of strings corresponding to the attributes of this QueueItem\n instance. If `truncate=True` (the default), the `task_id` and `published` time\n will be shortened.\n \"\"\"",
"# Remove microseconds."
] | [
{
"param": "self",
"type": null
},
{
"param": "truncate",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "truncate",
"type": null,
"docstring": null,
"docstring_tokens... |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | clear_work | null | def clear_work():
"""Clear the table of work."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
"""
)
con.close()
echo("Cleared table of work.") | Clear the table of work. | Clear the table of work. | [
"Clear",
"the",
"table",
"of",
"work",
"."
] | def clear_work():
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
"""
)
con.close()
echo("Cleared table of work.") | [
"def",
"clear_work",
"(",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n DELETE FROM {WORK_TABLENAME}\n \"\"\"",
")",
"con",
".",
"close",
... | Clear the table of work. | [
"Clear",
"the",
"table",
"of",
"work",
"."
] | [
"\"\"\"Clear the table of work.\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | task_items | <not_specific> | def task_items(max_entries=None):
"""Information about the items in the task queue. Returns a
generator of QueueItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries.
"""
con = sqlite3.connect(str(DB_PATH))
... | Information about the items in the task queue. Returns a
generator of QueueItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries.
| Information about the items in the task queue. Returns a
generator of QueueItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries. | [
"Information",
"about",
"the",
"items",
"in",
"the",
"task",
"queue",
".",
"Returns",
"a",
"generator",
"of",
"QueueItems",
".",
"Keyword",
"arguments",
":",
"max_entries",
"-",
"(",
"int",
")",
"(",
"Default",
":",
"None",
")",
"Maximum",
"number",
"of",
... | def task_items(max_entries=None):
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT task_id, queue_name, position, published, args, kwargs
FROM {QUEUE_TABLENAME}
ORDER BY position DESC
"""
)
if max_entries:
... | [
"def",
"task_items",
"(",
"max_entries",
"=",
"None",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"c",
"=",
"con",
".",
"execute",
"(",
"f\"\"\"\n SELECT task_id, queue_name, position, p... | Information about the items in the task queue. | [
"Information",
"about",
"the",
"items",
"in",
"the",
"task",
"queue",
"."
] | [
"\"\"\"Information about the items in the task queue. Returns a\n generator of QueueItems.\n\n Keyword arguments:\n max_entries - (int) (Default: None) Maximum number of items to\n return. Default is to return all entries.\n \"\"\""
] | [
{
"param": "max_entries",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "max_entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | tabulate_task_items | <not_specific> | def tabulate_task_items(*args, truncate=True, **kwargs):
"""Return a string containing tabulated data about task items."""
tasks = task_items(*args, **kwargs)
data = [task.list_item_info(truncate=truncate) for task in tasks]
return tabulate_data(data, headers=QueueItem.fields()) | Return a string containing tabulated data about task items. | Return a string containing tabulated data about task items. | [
"Return",
"a",
"string",
"containing",
"tabulated",
"data",
"about",
"task",
"items",
"."
] | def tabulate_task_items(*args, truncate=True, **kwargs):
tasks = task_items(*args, **kwargs)
data = [task.list_item_info(truncate=truncate) for task in tasks]
return tabulate_data(data, headers=QueueItem.fields()) | [
"def",
"tabulate_task_items",
"(",
"*",
"args",
",",
"truncate",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"tasks",
"=",
"task_items",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
"data",
"=",
"[",
"task",
".",
"list_item_info",
"(",
"truncate",
"=",
... | Return a string containing tabulated data about task items. | [
"Return",
"a",
"string",
"containing",
"tabulated",
"data",
"about",
"task",
"items",
"."
] | [
"\"\"\"Return a string containing tabulated data about task items.\"\"\""
] | [
{
"param": "truncate",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "truncate",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | work_items | <not_specific> | def work_items(max_entries=None):
"""Information about the items in the work queue. Returns a
generator of WorkItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries.
"""
con = sqlite3.connect(str(DB_PATH))
w... | Information about the items in the work queue. Returns a
generator of WorkItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries.
| Information about the items in the work queue. Returns a
generator of WorkItems.
Keyword arguments:
max_entries - (int) (Default: None) Maximum number of items to
return. Default is to return all entries. | [
"Information",
"about",
"the",
"items",
"in",
"the",
"work",
"queue",
".",
"Returns",
"a",
"generator",
"of",
"WorkItems",
".",
"Keyword",
"arguments",
":",
"max_entries",
"-",
"(",
"int",
")",
"(",
"Default",
":",
"None",
")",
"Maximum",
"number",
"of",
... | def work_items(max_entries=None):
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT
task_id,
queue_name,
started,
status,
args,
kwargs,
err
... | [
"def",
"work_items",
"(",
"max_entries",
"=",
"None",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"c",
"=",
"con",
".",
"execute",
"(",
"f\"\"\"\n SELECT\n task_id,\n ... | Information about the items in the work queue. | [
"Information",
"about",
"the",
"items",
"in",
"the",
"work",
"queue",
"."
] | [
"\"\"\"Information about the items in the work queue. Returns a\n generator of WorkItems.\n\n Keyword arguments:\n max_entries - (int) (Default: None) Maximum number of items to\n return. Default is to return all entries.\n \"\"\""
] | [
{
"param": "max_entries",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "max_entries",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | remove_work | null | def remove_work(self, task):
"""Remove the given task from the work table."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
WHERE task_id = ?
""",
(task.task_id,),
)
con.close() | Remove the given task from the work table. | Remove the given task from the work table. | [
"Remove",
"the",
"given",
"task",
"from",
"the",
"work",
"table",
"."
] | def remove_work(self, task):
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
WHERE task_id = ?
""",
(task.task_id,),
)
con.close() | [
"def",
"remove_work",
"(",
"self",
",",
"task",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n DELETE FROM {WORK_TABLENAME}\n WHERE task_id = ?... | Remove the given task from the work table. | [
"Remove",
"the",
"given",
"task",
"from",
"the",
"work",
"table",
"."
] | [
"\"\"\"Remove the given task from the work table.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "task",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "task",
"type": null,
"docstring": null,
"docstring_tokens": [... |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | run_work | <not_specific> | def run_work(task_clsname, task_id):
"""Run the task in the work table with the given ID."""
# Get task from work table.
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT
task_id,
queue_name,
started... | Run the task in the work table with the given ID. | Run the task in the work table with the given ID. | [
"Run",
"the",
"task",
"in",
"the",
"work",
"table",
"with",
"the",
"given",
"ID",
"."
] | def run_work(task_clsname, task_id):
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT
task_id,
queue_name,
started,
status,
args,
kwargs,
err
... | [
"def",
"run_work",
"(",
"task_clsname",
",",
"task_id",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"c",
"=",
"con",
".",
"execute",
"(",
"f\"\"\"\n SELECT\n task_id,\n ... | Run the task in the work table with the given ID. | [
"Run",
"the",
"task",
"in",
"the",
"work",
"table",
"with",
"the",
"given",
"ID",
"."
] | [
"\"\"\"Run the task in the work table with the given ID.\"\"\"",
"# Get task from work table.",
"# Run task."
] | [
{
"param": "task_clsname",
"type": null
},
{
"param": "task_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "task_clsname",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "task_id",
"type": null,
"docstring": null,
"docstring... |
9d0877a910209ca208c472549b5b986dfafcf459 | n8jhj/SoonQ | soonq/commands/commands.py | [
"MIT"
] | Python | start_worker | null | def start_worker(queue_name):
"""Start a worker on the named queue in the current process."""
task_cls = get_taskclass(queue_name)
inst = task_cls()
worker = Worker(inst)
worker.start() | Start a worker on the named queue in the current process. | Start a worker on the named queue in the current process. | [
"Start",
"a",
"worker",
"on",
"the",
"named",
"queue",
"in",
"the",
"current",
"process",
"."
] | def start_worker(queue_name):
task_cls = get_taskclass(queue_name)
inst = task_cls()
worker = Worker(inst)
worker.start() | [
"def",
"start_worker",
"(",
"queue_name",
")",
":",
"task_cls",
"=",
"get_taskclass",
"(",
"queue_name",
")",
"inst",
"=",
"task_cls",
"(",
")",
"worker",
"=",
"Worker",
"(",
"inst",
")",
"worker",
".",
"start",
"(",
")"
] | Start a worker on the named queue in the current process. | [
"Start",
"a",
"worker",
"on",
"the",
"named",
"queue",
"in",
"the",
"current",
"process",
"."
] | [
"\"\"\"Start a worker on the named queue in the current process.\"\"\""
] | [
{
"param": "queue_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d13216c695829b16211eb08d2b62e0f054d734cd | n8jhj/SoonQ | soonq/task.py | [
"MIT"
] | Python | delay | null | def delay(self, *args, **kwargs):
"""Have the broker enqueue this task, thereby delaying its
execution until some future time.
"""
args, kwargs = self.scrub_inputs(args, kwargs)
try:
self.task_id = str(uuid.uuid4())
task = dict(
task_id=sel... | Have the broker enqueue this task, thereby delaying its
execution until some future time.
| Have the broker enqueue this task, thereby delaying its
execution until some future time. | [
"Have",
"the",
"broker",
"enqueue",
"this",
"task",
"thereby",
"delaying",
"its",
"execution",
"until",
"some",
"future",
"time",
"."
] | def delay(self, *args, **kwargs):
args, kwargs = self.scrub_inputs(args, kwargs)
try:
self.task_id = str(uuid.uuid4())
task = dict(
task_id=self.task_id,
args=args,
kwargs=kwargs,
)
self.broker.enqueue(item=t... | [
"def",
"delay",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"args",
",",
"kwargs",
"=",
"self",
".",
"scrub_inputs",
"(",
"args",
",",
"kwargs",
")",
"try",
":",
"self",
".",
"task_id",
"=",
"str",
"(",
"uuid",
".",
"uuid4",
"("... | Have the broker enqueue this task, thereby delaying its
execution until some future time. | [
"Have",
"the",
"broker",
"enqueue",
"this",
"task",
"thereby",
"delaying",
"its",
"execution",
"until",
"some",
"future",
"time",
"."
] | [
"\"\"\"Have the broker enqueue this task, thereby delaying its\n execution until some future time.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d13216c695829b16211eb08d2b62e0f054d734cd | n8jhj/SoonQ | soonq/task.py | [
"MIT"
] | Python | dequeue | <not_specific> | def dequeue(self):
"""Dequeue one task of this type."""
item = self.broker.dequeue(queue_name=self.task_name)
try:
self.task_id = item["task_id"]
except TypeError:
self.task_id = None
return item | Dequeue one task of this type. | Dequeue one task of this type. | [
"Dequeue",
"one",
"task",
"of",
"this",
"type",
"."
] | def dequeue(self):
item = self.broker.dequeue(queue_name=self.task_name)
try:
self.task_id = item["task_id"]
except TypeError:
self.task_id = None
return item | [
"def",
"dequeue",
"(",
"self",
")",
":",
"item",
"=",
"self",
".",
"broker",
".",
"dequeue",
"(",
"queue_name",
"=",
"self",
".",
"task_name",
")",
"try",
":",
"self",
".",
"task_id",
"=",
"item",
"[",
"\"task_id\"",
"]",
"except",
"TypeError",
":",
... | Dequeue one task of this type. | [
"Dequeue",
"one",
"task",
"of",
"this",
"type",
"."
] | [
"\"\"\"Dequeue one task of this type.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d13216c695829b16211eb08d2b62e0f054d734cd | n8jhj/SoonQ | soonq/task.py | [
"MIT"
] | Python | slate | null | def slate(self, args, kwargs):
"""Add this task to the work table with the given arguments and
keyword arguments.
"""
self.broker.add_work(self, "running", args, kwargs) | Add this task to the work table with the given arguments and
keyword arguments.
| Add this task to the work table with the given arguments and
keyword arguments. | [
"Add",
"this",
"task",
"to",
"the",
"work",
"table",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments",
"."
] | def slate(self, args, kwargs):
self.broker.add_work(self, "running", args, kwargs) | [
"def",
"slate",
"(",
"self",
",",
"args",
",",
"kwargs",
")",
":",
"self",
".",
"broker",
".",
"add_work",
"(",
"self",
",",
"\"running\"",
",",
"args",
",",
"kwargs",
")"
] | Add this task to the work table with the given arguments and
keyword arguments. | [
"Add",
"this",
"task",
"to",
"the",
"work",
"table",
"with",
"the",
"given",
"arguments",
"and",
"keyword",
"arguments",
"."
] | [
"\"\"\"Add this task to the work table with the given arguments and\n keyword arguments.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
},
{
"param": "kwargs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
6913eb4f403694a1bd71a584bb22c05cac78d420 | n8jhj/SoonQ | examples/timer_task.py | [
"MIT"
] | Python | run | null | def run(self, interval, n):
"""Count at the given interval the given number of times.
Positional arguments:
interval - (int) Interval, in seconds.
n - (int) Number of times to count the given interval.
"""
self.interval = interval
timer_sleep_all(interval, n)
... | Count at the given interval the given number of times.
Positional arguments:
interval - (int) Interval, in seconds.
n - (int) Number of times to count the given interval.
| Count at the given interval the given number of times.
Positional arguments:
interval - (int) Interval, in seconds.
n - (int) Number of times to count the given interval. | [
"Count",
"at",
"the",
"given",
"interval",
"the",
"given",
"number",
"of",
"times",
".",
"Positional",
"arguments",
":",
"interval",
"-",
"(",
"int",
")",
"Interval",
"in",
"seconds",
".",
"n",
"-",
"(",
"int",
")",
"Number",
"of",
"times",
"to",
"coun... | def run(self, interval, n):
self.interval = interval
timer_sleep_all(interval, n)
sq.echo(f"Slept {interval * n} seconds total.") | [
"def",
"run",
"(",
"self",
",",
"interval",
",",
"n",
")",
":",
"self",
".",
"interval",
"=",
"interval",
"timer_sleep_all",
"(",
"interval",
",",
"n",
")",
"sq",
".",
"echo",
"(",
"f\"Slept {interval * n} seconds total.\"",
")"
] | Count at the given interval the given number of times. | [
"Count",
"at",
"the",
"given",
"interval",
"the",
"given",
"number",
"of",
"times",
"."
] | [
"\"\"\"Count at the given interval the given number of times.\n\n Positional arguments:\n interval - (int) Interval, in seconds.\n n - (int) Number of times to count the given interval.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "interval",
"type": null
},
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "interval",
"type": null,
"docstring": null,
"docstring_tokens... |
2e2c6e93061acaaa4cf2b2124b7072135b1f4a38 | n8jhj/SoonQ | examples/error_task.py | [
"MIT"
] | Python | run | null | def run(self):
"""Wait a random number of seconds before raising a
RuntimeException.
"""
sq.echo("Doing something rash...")
time.sleep(random.choice([1, 2, 3]))
raise RuntimeError("Rash choices produced a consequence.") | Wait a random number of seconds before raising a
RuntimeException.
| Wait a random number of seconds before raising a
RuntimeException. | [
"Wait",
"a",
"random",
"number",
"of",
"seconds",
"before",
"raising",
"a",
"RuntimeException",
"."
] | def run(self):
sq.echo("Doing something rash...")
time.sleep(random.choice([1, 2, 3]))
raise RuntimeError("Rash choices produced a consequence.") | [
"def",
"run",
"(",
"self",
")",
":",
"sq",
".",
"echo",
"(",
"\"Doing something rash...\"",
")",
"time",
".",
"sleep",
"(",
"random",
".",
"choice",
"(",
"[",
"1",
",",
"2",
",",
"3",
"]",
")",
")",
"raise",
"RuntimeError",
"(",
"\"Rash choices produce... | Wait a random number of seconds before raising a
RuntimeException. | [
"Wait",
"a",
"random",
"number",
"of",
"seconds",
"before",
"raising",
"a",
"RuntimeException",
"."
] | [
"\"\"\"Wait a random number of seconds before raising a\n RuntimeException.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aaaffe8834f3b83ef65e6cf8c27f32e6fb573105 | n8jhj/SoonQ | soonq/worker.py | [
"MIT"
] | Python | start | null | def start(self):
"""Begin working on the assigned type of task."""
while self.alive and self.directive == self.DRV_WORK:
try:
# Read database.
dequeued_item = self.task.dequeue()
if not dequeued_item:
if not self.waiting:
... | Begin working on the assigned type of task. | Begin working on the assigned type of task. | [
"Begin",
"working",
"on",
"the",
"assigned",
"type",
"of",
"task",
"."
] | def start(self):
while self.alive and self.directive == self.DRV_WORK:
try:
dequeued_item = self.task.dequeue()
if not dequeued_item:
if not self.waiting:
self.waiting = True
echo(f"Waiting for next t... | [
"def",
"start",
"(",
"self",
")",
":",
"while",
"self",
".",
"alive",
"and",
"self",
".",
"directive",
"==",
"self",
".",
"DRV_WORK",
":",
"try",
":",
"dequeued_item",
"=",
"self",
".",
"task",
".",
"dequeue",
"(",
")",
"if",
"not",
"dequeued_item",
... | Begin working on the assigned type of task. | [
"Begin",
"working",
"on",
"the",
"assigned",
"type",
"of",
"task",
"."
] | [
"\"\"\"Begin working on the assigned type of task.\"\"\"",
"# Read database.",
"# Run.",
"# Pass off execution to subprocess."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aaaffe8834f3b83ef65e6cf8c27f32e6fb573105 | n8jhj/SoonQ | soonq/worker.py | [
"MIT"
] | Python | terminate | null | def terminate(self):
"""Terminate self and running task."""
echo("Terminating")
if self.task_subp:
self.task_subp.terminate()
self.cleanup() | Terminate self and running task. | Terminate self and running task. | [
"Terminate",
"self",
"and",
"running",
"task",
"."
] | def terminate(self):
echo("Terminating")
if self.task_subp:
self.task_subp.terminate()
self.cleanup() | [
"def",
"terminate",
"(",
"self",
")",
":",
"echo",
"(",
"\"Terminating\"",
")",
"if",
"self",
".",
"task_subp",
":",
"self",
".",
"task_subp",
".",
"terminate",
"(",
")",
"self",
".",
"cleanup",
"(",
")"
] | Terminate self and running task. | [
"Terminate",
"self",
"and",
"running",
"task",
"."
] | [
"\"\"\"Terminate self and running task.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aaaffe8834f3b83ef65e6cf8c27f32e6fb573105 | n8jhj/SoonQ | soonq/worker.py | [
"MIT"
] | Python | start_worker_process | null | def start_worker_process(queue_name):
"""Start a process with a Worker on the queue of the given name."""
popen_kwargs = dict(
args=[sys.executable, "-m", "soonq.commands.start_worker", queue_name],
)
if platform.system() == "Windows":
popen_kwargs["creationflags"] = CREATE_NEW_CONSOLE
... | Start a process with a Worker on the queue of the given name. | Start a process with a Worker on the queue of the given name. | [
"Start",
"a",
"process",
"with",
"a",
"Worker",
"on",
"the",
"queue",
"of",
"the",
"given",
"name",
"."
] | def start_worker_process(queue_name):
popen_kwargs = dict(
args=[sys.executable, "-m", "soonq.commands.start_worker", queue_name],
)
if platform.system() == "Windows":
popen_kwargs["creationflags"] = CREATE_NEW_CONSOLE
else:
popen_kwargs["args"] = " ".join(popen_kwargs["args"])
... | [
"def",
"start_worker_process",
"(",
"queue_name",
")",
":",
"popen_kwargs",
"=",
"dict",
"(",
"args",
"=",
"[",
"sys",
".",
"executable",
",",
"\"-m\"",
",",
"\"soonq.commands.start_worker\"",
",",
"queue_name",
"]",
",",
")",
"if",
"platform",
".",
"system",
... | Start a process with a Worker on the queue of the given name. | [
"Start",
"a",
"process",
"with",
"a",
"Worker",
"on",
"the",
"queue",
"of",
"the",
"given",
"name",
"."
] | [
"\"\"\"Start a process with a Worker on the queue of the given name.\"\"\"",
"# \"If shell is True, it is recommended to pass args as a",
"# string rather than as a sequence.\"",
"# https://docs.python.org/3/library/subprocess.html#subprocess.Popen",
"# Poll for task completion and further directives."
] | [
{
"param": "queue_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f2d0d1feaebd70cda54845c1f5f3386e3038f9ae | n8jhj/SoonQ | examples/sim_task.py | [
"MIT"
] | Python | run | null | def run(self, project):
"""Simulate subject to the parameters specified in the given
project.
"""
sq.echo(f"Running {project.name!r}...")
project.run()
sq.echo(f"Project {project.name!r} finished.") | Simulate subject to the parameters specified in the given
project.
| Simulate subject to the parameters specified in the given
project. | [
"Simulate",
"subject",
"to",
"the",
"parameters",
"specified",
"in",
"the",
"given",
"project",
"."
] | def run(self, project):
sq.echo(f"Running {project.name!r}...")
project.run()
sq.echo(f"Project {project.name!r} finished.") | [
"def",
"run",
"(",
"self",
",",
"project",
")",
":",
"sq",
".",
"echo",
"(",
"f\"Running {project.name!r}...\"",
")",
"project",
".",
"run",
"(",
")",
"sq",
".",
"echo",
"(",
"f\"Project {project.name!r} finished.\"",
")"
] | Simulate subject to the parameters specified in the given
project. | [
"Simulate",
"subject",
"to",
"the",
"parameters",
"specified",
"in",
"the",
"given",
"project",
"."
] | [
"\"\"\"Simulate subject to the parameters specified in the given\n project.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "project",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens"... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | enqueue | null | def enqueue(self, item, queue_name):
"""Enqueue the given item in the queue with the given name."""
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT position
FROM {QUEUE_TABLENAME}
ORDER BY posi... | Enqueue the given item in the queue with the given name. | Enqueue the given item in the queue with the given name. | [
"Enqueue",
"the",
"given",
"item",
"in",
"the",
"queue",
"with",
"the",
"given",
"name",
"."
] | def enqueue(self, item, queue_name):
con = sqlite3.connect(str(DB_PATH))
with con:
c = con.execute(
f"""
SELECT position
FROM {QUEUE_TABLENAME}
ORDER BY position DESC
"""
)
max_position = ... | [
"def",
"enqueue",
"(",
"self",
",",
"item",
",",
"queue_name",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"c",
"=",
"con",
".",
"execute",
"(",
"f\"\"\"\n SELECT position\n ... | Enqueue the given item in the queue with the given name. | [
"Enqueue",
"the",
"given",
"item",
"in",
"the",
"queue",
"with",
"the",
"given",
"name",
"."
] | [
"\"\"\"Enqueue the given item in the queue with the given name.\"\"\"",
"# Returns a tuple.",
"# Serialize objects to be stored as BLOB."
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "queue_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": null,
"docstring": null,
"docstring_tokens": [... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | dequeue | <not_specific> | def dequeue(self, queue_name):
"""Dequeue the next item (item with lowest position number) from
the queue with the given name and return it.
"""
con = sqlite3.connect(str(DB_PATH))
con.row_factory = sqlite3.Row
with con:
c = con.execute(
f"""
... | Dequeue the next item (item with lowest position number) from
the queue with the given name and return it.
| Dequeue the next item (item with lowest position number) from
the queue with the given name and return it. | [
"Dequeue",
"the",
"next",
"item",
"(",
"item",
"with",
"lowest",
"position",
"number",
")",
"from",
"the",
"queue",
"with",
"the",
"given",
"name",
"and",
"return",
"it",
"."
] | def dequeue(self, queue_name):
con = sqlite3.connect(str(DB_PATH))
con.row_factory = sqlite3.Row
with con:
c = con.execute(
f"""
SELECT
task_id,
queue_name,
position,
publi... | [
"def",
"dequeue",
"(",
"self",
",",
"queue_name",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"con",
".",
"row_factory",
"=",
"sqlite3",
".",
"Row",
"with",
"con",
":",
"c",
"=",
"con",
".",
"execute",
"("... | Dequeue the next item (item with lowest position number) from
the queue with the given name and return it. | [
"Dequeue",
"the",
"next",
"item",
"(",
"item",
"with",
"lowest",
"position",
"number",
")",
"from",
"the",
"queue",
"with",
"the",
"given",
"name",
"and",
"return",
"it",
"."
] | [
"\"\"\"Dequeue the next item (item with lowest position number) from\n the queue with the given name and return it.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "queue_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_toke... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | add_work | null | def add_work(self, item, status, iargs, ikwargs):
"""Add the given item to the work table."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
INSERT INTO {WORK_TABLENAME} (
task_id,
queue_name,
... | Add the given item to the work table. | Add the given item to the work table. | [
"Add",
"the",
"given",
"item",
"to",
"the",
"work",
"table",
"."
] | def add_work(self, item, status, iargs, ikwargs):
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
INSERT INTO {WORK_TABLENAME} (
task_id,
queue_name,
started,
statu... | [
"def",
"add_work",
"(",
"self",
",",
"item",
",",
"status",
",",
"iargs",
",",
"ikwargs",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n I... | Add the given item to the work table. | [
"Add",
"the",
"given",
"item",
"to",
"the",
"work",
"table",
"."
] | [
"\"\"\"Add the given item to the work table.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "status",
"type": null
},
{
"param": "iargs",
"type": null
},
{
"param": "ikwargs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": null,
"docstring": null,
"docstring_tokens": [... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | remove_work | null | def remove_work(self, item):
"""Remove the given item from the work table."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
WHERE task_id = ?
""",
(item.task... | Remove the given item from the work table. | Remove the given item from the work table. | [
"Remove",
"the",
"given",
"item",
"from",
"the",
"work",
"table",
"."
] | def remove_work(self, item):
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
DELETE FROM {WORK_TABLENAME}
WHERE task_id = ?
""",
(item.task_id,),
)
con.close() | [
"def",
"remove_work",
"(",
"self",
",",
"item",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n DELETE FROM {WORK_TABLENAME}\n WHERE tas... | Remove the given item from the work table. | [
"Remove",
"the",
"given",
"item",
"from",
"the",
"work",
"table",
"."
] | [
"\"\"\"Remove the given item from the work table.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": null,
"docstring": null,
"docstring_tokens": [... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | update_status | null | def update_status(self, item, status):
"""Update the status of the given item in the work table."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
UPDATE {WORK_TABLENAME}
SET status = ?
WHERE task_id = ?... | Update the status of the given item in the work table. | Update the status of the given item in the work table. | [
"Update",
"the",
"status",
"of",
"the",
"given",
"item",
"in",
"the",
"work",
"table",
"."
] | def update_status(self, item, status):
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
UPDATE {WORK_TABLENAME}
SET status = ?
WHERE task_id = ?
""",
(status, item.task_id),
... | [
"def",
"update_status",
"(",
"self",
",",
"item",
",",
"status",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n UPDATE {WORK_TABLENAME}\n ... | Update the status of the given item in the work table. | [
"Update",
"the",
"status",
"of",
"the",
"given",
"item",
"in",
"the",
"work",
"table",
"."
] | [
"\"\"\"Update the status of the given item in the work table.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "status",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": null,
"docstring": null,
"docstring_tokens": [... |
fd102c0e531c8af0ff9fba4425818a7a7b4db132 | n8jhj/SoonQ | soonq/broker.py | [
"MIT"
] | Python | update_exc_info | null | def update_exc_info(self, item, traceback):
"""Update exception info for the given item."""
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
UPDATE {WORK_TABLENAME}
SET err = ?
WHERE task_id = ?
... | Update exception info for the given item. | Update exception info for the given item. | [
"Update",
"exception",
"info",
"for",
"the",
"given",
"item",
"."
] | def update_exc_info(self, item, traceback):
con = sqlite3.connect(str(DB_PATH))
with con:
con.execute(
f"""
UPDATE {WORK_TABLENAME}
SET err = ?
WHERE task_id = ?
""",
(traceback, item.task_id),
... | [
"def",
"update_exc_info",
"(",
"self",
",",
"item",
",",
"traceback",
")",
":",
"con",
"=",
"sqlite3",
".",
"connect",
"(",
"str",
"(",
"DB_PATH",
")",
")",
"with",
"con",
":",
"con",
".",
"execute",
"(",
"f\"\"\"\n UPDATE {WORK_TABLENAME}\n ... | Update exception info for the given item. | [
"Update",
"exception",
"info",
"for",
"the",
"given",
"item",
"."
] | [
"\"\"\"Update exception info for the given item.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "item",
"type": null
},
{
"param": "traceback",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": null,
"docstring": null,
"docstring_tokens": [... |
806c6f984317c337136c1de65ab039b600acea74 | n8jhj/SoonQ | soonq/commands/cli.py | [
"MIT"
] | Python | enq | null | def enq(queue_name, args):
"""Enqueue a single task in the named queue."""
task_cls = get_taskclass(queue_name)
inst = task_cls()
inst.delay(*args) | Enqueue a single task in the named queue. | Enqueue a single task in the named queue. | [
"Enqueue",
"a",
"single",
"task",
"in",
"the",
"named",
"queue",
"."
] | def enq(queue_name, args):
task_cls = get_taskclass(queue_name)
inst = task_cls()
inst.delay(*args) | [
"def",
"enq",
"(",
"queue_name",
",",
"args",
")",
":",
"task_cls",
"=",
"get_taskclass",
"(",
"queue_name",
")",
"inst",
"=",
"task_cls",
"(",
")",
"inst",
".",
"delay",
"(",
"*",
"args",
")"
] | Enqueue a single task in the named queue. | [
"Enqueue",
"a",
"single",
"task",
"in",
"the",
"named",
"queue",
"."
] | [
"\"\"\"Enqueue a single task in the named queue.\"\"\""
] | [
{
"param": "queue_name",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "queue_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_toke... |
529245e97324cecf72c0b23bab45f1b556b9224c | 0x5eba/Dueling-DQN-SuperMarioBros | agent/agent.py | [
"MIT"
] | Python | _initial_state | np.ndarray | def _initial_state(self) -> np.ndarray:
"""
Reset the environment and return the initial state.
Returns:
the initial state of the game
"""
state = self.env.reset()
self.env.render(mode=self.render_mode)
return state |
Reset the environment and return the initial state.
Returns:
the initial state of the game
| Reset the environment and return the initial state. | [
"Reset",
"the",
"environment",
"and",
"return",
"the",
"initial",
"state",
"."
] | def _initial_state(self) -> np.ndarray:
state = self.env.reset()
self.env.render(mode=self.render_mode)
return state | [
"def",
"_initial_state",
"(",
"self",
")",
"->",
"np",
".",
"ndarray",
":",
"state",
"=",
"self",
".",
"env",
".",
"reset",
"(",
")",
"self",
".",
"env",
".",
"render",
"(",
"mode",
"=",
"self",
".",
"render_mode",
")",
"return",
"state"
] | Reset the environment and return the initial state. | [
"Reset",
"the",
"environment",
"and",
"return",
"the",
"initial",
"state",
"."
] | [
"\"\"\"\n Reset the environment and return the initial state.\n\n Returns:\n the initial state of the game\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "the initial state of the game",
"docstring_tokens": [
"the",
"initial",
"state",
"of",
"the",
"game"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,... |
529245e97324cecf72c0b23bab45f1b556b9224c | 0x5eba/Dueling-DQN-SuperMarioBros | agent/agent.py | [
"MIT"
] | Python | _next_state | tuple | def _next_state(self, action: int) -> tuple:
"""
Return the next state based on the given action.
Args:
action: the action to perform for some frames
Returns:
a tuple of:
- the next state
- the reward as a result of the action
... |
Return the next state based on the given action.
Args:
action: the action to perform for some frames
Returns:
a tuple of:
- the next state
- the reward as a result of the action
- a flag determining end of episode
... | Return the next state based on the given action. | [
"Return",
"the",
"next",
"state",
"based",
"on",
"the",
"given",
"action",
"."
] | def _next_state(self, action: int) -> tuple:
state, reward, done, _ = self.env.step(action=action)
self.env.render(mode=self.render_mode)
return state, reward, done | [
"def",
"_next_state",
"(",
"self",
",",
"action",
":",
"int",
")",
"->",
"tuple",
":",
"state",
",",
"reward",
",",
"done",
",",
"_",
"=",
"self",
".",
"env",
".",
"step",
"(",
"action",
"=",
"action",
")",
"self",
".",
"env",
".",
"render",
"(",... | Return the next state based on the given action. | [
"Return",
"the",
"next",
"state",
"based",
"on",
"the",
"given",
"action",
"."
] | [
"\"\"\"\n Return the next state based on the given action.\n\n Args:\n action: the action to perform for some frames\n\n Returns:\n a tuple of:\n - the next state\n - the reward as a result of the action\n - a flag determining e... | [
{
"param": "self",
"type": null
},
{
"param": "action",
"type": "int"
}
] | {
"returns": [
{
"docstring": "a tuple of:\nthe next state\nthe reward as a result of the action\na flag determining end of episode",
"docstring_tokens": [
"a",
"tuple",
"of",
":",
"the",
"next",
"state",
"the",
"reward",
... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | observe | None | def observe(self, replay_start_size: int=50000) -> None:
"""
Observe random moves to initialize the replay memory.
Args:
replay_start_size: the number of random observations to make
i.e. the size to fill the replay memory with to start
"""
progress = ... |
Observe random moves to initialize the replay memory.
Args:
replay_start_size: the number of random observations to make
i.e. the size to fill the replay memory with to start
| Observe random moves to initialize the replay memory. | [
"Observe",
"random",
"moves",
"to",
"initialize",
"the",
"replay",
"memory",
"."
] | def observe(self, replay_start_size: int=50000) -> None:
progress = tqdm(total=replay_start_size, unit='frame')
while replay_start_size > 0:
state = self._initial_state()
done = False
while not done:
action = self.env.action_space.sample()
... | [
"def",
"observe",
"(",
"self",
",",
"replay_start_size",
":",
"int",
"=",
"50000",
")",
"->",
"None",
":",
"progress",
"=",
"tqdm",
"(",
"total",
"=",
"replay_start_size",
",",
"unit",
"=",
"'frame'",
")",
"while",
"replay_start_size",
">",
"0",
":",
"st... | Observe random moves to initialize the replay memory. | [
"Observe",
"random",
"moves",
"to",
"initialize",
"the",
"replay",
"memory",
"."
] | [
"\"\"\"\n Observe random moves to initialize the replay memory.\n\n Args:\n replay_start_size: the number of random observations to make\n i.e. the size to fill the replay memory with to start\n \"\"\"",
"# loop indefinitely, the loop breaks when the number of",
"#... | [
{
"param": "self",
"type": null
},
{
"param": "replay_start_size",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "replay_start_size",
"type": "int",
"docstring": "the number of rand... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | _replay | float | def _replay(self,
s: np.ndarray,
a: np.ndarray,
r: np.ndarray,
d: np.ndarray,
s2: np.ndarray
) -> float:
"""
Train the network on a mini-batch of replay data.
Args:
s: a batch of current states
a: a batch of actions from each s... |
Train the network on a mini-batch of replay data.
Args:
s: a batch of current states
a: a batch of actions from each state in s
r: a batch of reward from each action in a
d: a batch of terminal flags after each action in a
s2: the next state ... | Train the network on a mini-batch of replay data. | [
"Train",
"the",
"network",
"on",
"a",
"mini",
"-",
"batch",
"of",
"replay",
"data",
"."
] | def _replay(self,
s: np.ndarray,
a: np.ndarray,
r: np.ndarray,
d: np.ndarray,
s2: np.ndarray
) -> float:
y = np.zeros((len(s), self.env.action_space.n))
all_mask = np.ones((len(s), self.env.action_space.n))
Q = np.max(self.target_model.predict_on_batch... | [
"def",
"_replay",
"(",
"self",
",",
"s",
":",
"np",
".",
"ndarray",
",",
"a",
":",
"np",
".",
"ndarray",
",",
"r",
":",
"np",
".",
"ndarray",
",",
"d",
":",
"np",
".",
"ndarray",
",",
"s2",
":",
"np",
".",
"ndarray",
")",
"->",
"float",
":",
... | Train the network on a mini-batch of replay data. | [
"Train",
"the",
"network",
"on",
"a",
"mini",
"-",
"batch",
"of",
"replay",
"data",
"."
] | [
"\"\"\"\n Train the network on a mini-batch of replay data.\n\n Args:\n s: a batch of current states\n a: a batch of actions from each state in s\n r: a batch of reward from each action in a\n d: a batch of terminal flags after each action in a\n ... | [
{
"param": "self",
"type": null
},
{
"param": "s",
"type": "np.ndarray"
},
{
"param": "a",
"type": "np.ndarray"
},
{
"param": "r",
"type": "np.ndarray"
},
{
"param": "d",
"type": "np.ndarray"
},
{
"param": "s2",
"type": "np.ndarray"
}
] | {
"returns": [
{
"docstring": "the loss as a result of the training",
"docstring_tokens": [
"the",
"loss",
"as",
"a",
"result",
"of",
"the",
"training"
],
"type": null
}
],
"raises": [],
"params": [
{
"iden... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | predict_action | int | def predict_action(self,
frames: np.ndarray,
exploration_rate: float
) -> int:
"""
Predict an action from a stack of frames.
Args:
frames: the stack of frames to predict Q values from
exploration_rate: the exploration rate for epsilon greedy selection... |
Predict an action from a stack of frames.
Args:
frames: the stack of frames to predict Q values from
exploration_rate: the exploration rate for epsilon greedy selection
Returns:
the predicted optimal action based on the frames
| Predict an action from a stack of frames. | [
"Predict",
"an",
"action",
"from",
"a",
"stack",
"of",
"frames",
"."
] | def predict_action(self,
frames: np.ndarray,
exploration_rate: float
) -> int:
if np.random.random() < exploration_rate:
return self.env.action_space.sample()
else:
frames = frames[np.newaxis, :, :, :]
actions = self.model.predict([frames, self.pre... | [
"def",
"predict_action",
"(",
"self",
",",
"frames",
":",
"np",
".",
"ndarray",
",",
"exploration_rate",
":",
"float",
")",
"->",
"int",
":",
"if",
"np",
".",
"random",
".",
"random",
"(",
")",
"<",
"exploration_rate",
":",
"return",
"self",
".",
"env"... | Predict an action from a stack of frames. | [
"Predict",
"an",
"action",
"from",
"a",
"stack",
"of",
"frames",
"."
] | [
"\"\"\"\n Predict an action from a stack of frames.\n\n Args:\n frames: the stack of frames to predict Q values from\n exploration_rate: the exploration rate for epsilon greedy selection\n\n Returns:\n the predicted optimal action based on the frames\n \"... | [
{
"param": "self",
"type": null
},
{
"param": "frames",
"type": "np.ndarray"
},
{
"param": "exploration_rate",
"type": "float"
}
] | {
"returns": [
{
"docstring": "the predicted optimal action based on the frames",
"docstring_tokens": [
"the",
"predicted",
"optimal",
"action",
"based",
"on",
"the",
"frames"
],
"type": null
}
],
"raises": [],
"para... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | train | None | def train(self,
frames_to_play: int=25000000,
batch_size: int=32,
callback: Callable=None,
) -> None:
"""
Train the network for a number of episodes (games).
Args:
frames_to_play: the number of frames to play the game for
batch_size: the size ... |
Train the network for a number of episodes (games).
Args:
frames_to_play: the number of frames to play the game for
batch_size: the size of the replay history batches
callback: an optional callback to get updates about the score,
loss, discount... | Train the network for a number of episodes (games). | [
"Train",
"the",
"network",
"for",
"a",
"number",
"of",
"episodes",
"(",
"games",
")",
"."
] | def train(self,
frames_to_play: int=25000000,
batch_size: int=32,
callback: Callable=None,
) -> None:
progress = tqdm(total=frames_to_play, unit='frame')
progress.set_postfix(score='?', loss='?')
while frames_to_play > 0:
done = False
score = 0... | [
"def",
"train",
"(",
"self",
",",
"frames_to_play",
":",
"int",
"=",
"25000000",
",",
"batch_size",
":",
"int",
"=",
"32",
",",
"callback",
":",
"Callable",
"=",
"None",
",",
")",
"->",
"None",
":",
"progress",
"=",
"tqdm",
"(",
"total",
"=",
"frames... | Train the network for a number of episodes (games). | [
"Train",
"the",
"network",
"for",
"a",
"number",
"of",
"episodes",
"(",
"games",
")",
"."
] | [
"\"\"\"\n Train the network for a number of episodes (games).\n\n Args:\n frames_to_play: the number of frames to play the game for\n batch_size: the size of the replay history batches\n callback: an optional callback to get updates about the score,\n ... | [
{
"param": "self",
"type": null
},
{
"param": "frames_to_play",
"type": "int"
},
{
"param": "batch_size",
"type": "int"
},
{
"param": "callback",
"type": "Callable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frames_to_play",
"type": "int",
"docstring": "the number of frames ... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | play | np.ndarray | def play(self, games: int=100, exploration_rate: float=0.05) -> np.ndarray:
"""
Run the agent without training for a number of games.
Args:
games: the number of games to play
exploration_rate: the epsilon for epsilon greedy exploration
Returns:
an ar... |
Run the agent without training for a number of games.
Args:
games: the number of games to play
exploration_rate: the epsilon for epsilon greedy exploration
Returns:
an array of scores, one for each game
| Run the agent without training for a number of games. | [
"Run",
"the",
"agent",
"without",
"training",
"for",
"a",
"number",
"of",
"games",
"."
] | def play(self, games: int=100, exploration_rate: float=0.05) -> np.ndarray:
scores = np.zeros(games)
for game in tqdm(range(games), unit='game'):
done = False
score = 0
state = self._initial_state()
while not done:
action = self.predict_act... | [
"def",
"play",
"(",
"self",
",",
"games",
":",
"int",
"=",
"100",
",",
"exploration_rate",
":",
"float",
"=",
"0.05",
")",
"->",
"np",
".",
"ndarray",
":",
"scores",
"=",
"np",
".",
"zeros",
"(",
"games",
")",
"for",
"game",
"in",
"tqdm",
"(",
"r... | Run the agent without training for a number of games. | [
"Run",
"the",
"agent",
"without",
"training",
"for",
"a",
"number",
"of",
"games",
"."
] | [
"\"\"\"\n Run the agent without training for a number of games.\n\n Args:\n games: the number of games to play\n exploration_rate: the epsilon for epsilon greedy exploration\n\n Returns:\n an array of scores, one for each game\n \"\"\"",
"# a list to ke... | [
{
"param": "self",
"type": null
},
{
"param": "games",
"type": "int"
},
{
"param": "exploration_rate",
"type": "float"
}
] | {
"returns": [
{
"docstring": "an array of scores, one for each game",
"docstring_tokens": [
"an",
"array",
"of",
"scores",
"one",
"for",
"each",
"game"
],
"type": null
}
],
"raises": [],
"params": [
{
"ide... |
ff5bf093e9e7d4955c93e9523ecdf866f2810dab | 0x5eba/Dueling-DQN-SuperMarioBros | agent/DQ_agent.py | [
"MIT"
] | Python | load | None | def load(self, dir_output: None, replay_size: int=50000, batch_size: int=32, callback: Callable=None) -> None:
"""
Get the data from the human gameplay, created by play_human.py
Args:
dir_output: the directory where the data has been outputed
replay_size: the number of r... |
Get the data from the human gameplay, created by play_human.py
Args:
dir_output: the directory where the data has been outputed
replay_size: the number of random observations to make in case of no dir_output
batch_size: the size of the replay history batches
... | Get the data from the human gameplay, created by play_human.py | [
"Get",
"the",
"data",
"from",
"the",
"human",
"gameplay",
"created",
"by",
"play_human",
".",
"py"
] | def load(self, dir_output: None, replay_size: int=50000, batch_size: int=32, callback: Callable=None) -> None:
if dir_output is None:
self.observe(replay_size)
else:
frame_played = 0
for game in sorted(listdir(dir_output)):
state_path = dir_output + "/... | [
"def",
"load",
"(",
"self",
",",
"dir_output",
":",
"None",
",",
"replay_size",
":",
"int",
"=",
"50000",
",",
"batch_size",
":",
"int",
"=",
"32",
",",
"callback",
":",
"Callable",
"=",
"None",
")",
"->",
"None",
":",
"if",
"dir_output",
"is",
"None... | Get the data from the human gameplay, created by play_human.py | [
"Get",
"the",
"data",
"from",
"the",
"human",
"gameplay",
"created",
"by",
"play_human",
".",
"py"
] | [
"\"\"\"\n Get the data from the human gameplay, created by play_human.py\n\n Args:\n dir_output: the directory where the data has been outputed\n replay_size: the number of random observations to make in case of no dir_output\n batch_size: the size of the replay histor... | [
{
"param": "self",
"type": null
},
{
"param": "dir_output",
"type": "None"
},
{
"param": "replay_size",
"type": "int"
},
{
"param": "batch_size",
"type": "int"
},
{
"param": "callback",
"type": "Callable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dir_output",
"type": "None",
"docstring": "the directory where the ... |
aadc5f5976af4d2de5afb31da96858cb27d011ac | 0x5eba/Dueling-DQN-SuperMarioBros | environment/build.py | [
"MIT"
] | Python | build_nes_environment | <not_specific> | def build_nes_environment(
image_size: tuple=(84, 84),
clip_rewards: bool=True, # sigmoid
agent_history_length: int=4,
monitor_dir: str=None
):
"""
Build and return a configured NES environment.
Args:
image_size: the size to down-sample images to
clip_rewards: whether to cli... |
Build and return a configured NES environment.
Args:
image_size: the size to down-sample images to
clip_rewards: whether to clip rewards in {-1, 0, +1}
agent_history_length: the size of the frame buffer for the agent
monitor_dir: the directory to save monitor info to if any
... | Build and return a configured NES environment. | [
"Build",
"and",
"return",
"a",
"configured",
"NES",
"environment",
"."
] | def build_nes_environment(
image_size: tuple=(84, 84),
clip_rewards: bool=True,
agent_history_length: int=4,
monitor_dir: str=None
):
env = gym_super_mario_bros.make('SuperMarioBros-v0')
env = RewardChace(env)
env = DownsampleEnv(env, image_size)
if clip_rewards:
env = ClipRewar... | [
"def",
"build_nes_environment",
"(",
"image_size",
":",
"tuple",
"=",
"(",
"84",
",",
"84",
")",
",",
"clip_rewards",
":",
"bool",
"=",
"True",
",",
"agent_history_length",
":",
"int",
"=",
"4",
",",
"monitor_dir",
":",
"str",
"=",
"None",
")",
":",
"e... | Build and return a configured NES environment. | [
"Build",
"and",
"return",
"a",
"configured",
"NES",
"environment",
"."
] | [
"# sigmoid",
"\"\"\"\n Build and return a configured NES environment.\n\n Args:\n image_size: the size to down-sample images to\n clip_rewards: whether to clip rewards in {-1, 0, +1}\n agent_history_length: the size of the frame buffer for the agent\n monitor_dir: the directory t... | [
{
"param": "image_size",
"type": "tuple"
},
{
"param": "clip_rewards",
"type": "bool"
},
{
"param": "agent_history_length",
"type": "int"
},
{
"param": "monitor_dir",
"type": "str"
}
] | {
"returns": [
{
"docstring": "a gym environment configured for this experiment",
"docstring_tokens": [
"a",
"gym",
"environment",
"configured",
"for",
"this",
"experiment"
],
"type": null
}
],
"raises": [],
"params": [
... |
34478f1222943641214d9b61e7b964f9f7642bcc | 0x5eba/Dueling-DQN-SuperMarioBros | play_human.py | [
"MIT"
] | Python | callback | None | def callback(s, s2, a, r, d, i) -> None:
"""
Respond to the step callback in the play method.
Args:
s: the state before the action was fired
s2: the state after the action was fired
a: the action to fire
r: the reward observed as a result of the action
d: a flag deno... |
Respond to the step callback in the play method.
Args:
s: the state before the action was fired
s2: the state after the action was fired
a: the action to fire
r: the reward observed as a result of the action
d: a flag denoting if the episode is over
i: the infor... | Respond to the step callback in the play method. | [
"Respond",
"to",
"the",
"step",
"callback",
"in",
"the",
"play",
"method",
"."
] | def callback(s, s2, a, r, d, i) -> None:
global counter, game_played
if counter % 4 == 0:
dir_numpydata = '{}/{}/{}/'.format(output_dir,"game_"+str(game_played), "episode_"+str(counter))
os.makedirs(dir_numpydata)
with open(dir_numpydata + "state2.npy", "w") as f:
np.save(dir... | [
"def",
"callback",
"(",
"s",
",",
"s2",
",",
"a",
",",
"r",
",",
"d",
",",
"i",
")",
"->",
"None",
":",
"global",
"counter",
",",
"game_played",
"if",
"counter",
"%",
"4",
"==",
"0",
":",
"dir_numpydata",
"=",
"'{}/{}/{}/'",
".",
"format",
"(",
"... | Respond to the step callback in the play method. | [
"Respond",
"to",
"the",
"step",
"callback",
"in",
"the",
"play",
"method",
"."
] | [
"\"\"\"\n Respond to the step callback in the play method.\n\n Args:\n s: the state before the action was fired\n s2: the state after the action was fired\n a: the action to fire\n r: the reward observed as a result of the action\n d: a flag denoting if the episode is over\n... | [
{
"param": "s",
"type": null
},
{
"param": "s2",
"type": null
},
{
"param": "a",
"type": null
},
{
"param": "r",
"type": null
},
{
"param": "d",
"type": null
},
{
"param": "i",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": "the state before the action was fired",
"docstring_tokens": [
"the",
... |
0b50758bae769f11392f4da52b9694be1bf46a95 | 0x5eba/Dueling-DQN-SuperMarioBros | agent/replay/replay_queue.py | [
"MIT"
] | Python | push | None | def push(self, *args) -> None:
"""
Push a new experience onto the queue.
Args:
*args: the experience s, a, r, d, s2
"""
# push the variables onto the queue
self.queue[self.index] = args
# increment the index
self.index = (self.index + 1) % sel... |
Push a new experience onto the queue.
Args:
*args: the experience s, a, r, d, s2
| Push a new experience onto the queue. | [
"Push",
"a",
"new",
"experience",
"onto",
"the",
"queue",
"."
] | def push(self, *args) -> None:
self.queue[self.index] = args
self.index = (self.index + 1) % self.size
if self.top < self.size:
self.top += 1 | [
"def",
"push",
"(",
"self",
",",
"*",
"args",
")",
"->",
"None",
":",
"self",
".",
"queue",
"[",
"self",
".",
"index",
"]",
"=",
"args",
"self",
".",
"index",
"=",
"(",
"self",
".",
"index",
"+",
"1",
")",
"%",
"self",
".",
"size",
"if",
"sel... | Push a new experience onto the queue. | [
"Push",
"a",
"new",
"experience",
"onto",
"the",
"queue",
"."
] | [
"\"\"\"\n Push a new experience onto the queue.\n\n Args:\n *args: the experience s, a, r, d, s2\n \"\"\"",
"# push the variables onto the queue",
"# increment the index",
"# increment the top pointer"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [
{
"identifier": "*args",
"type": null,
"docstring": "the e... |
0b50758bae769f11392f4da52b9694be1bf46a95 | 0x5eba/Dueling-DQN-SuperMarioBros | agent/replay/replay_queue.py | [
"MIT"
] | Python | sample | bool | def sample(self, size: int=32) -> bool:
"""
Return a random sample of items from the queue.
Args:
size: the number of items to sample and return
Returns:
A random sample from the queue sampled uniformly
"""
# initialize lists for each component of ... |
Return a random sample of items from the queue.
Args:
size: the number of items to sample and return
Returns:
A random sample from the queue sampled uniformly
| Return a random sample of items from the queue. | [
"Return",
"a",
"random",
"sample",
"of",
"items",
"from",
"the",
"queue",
"."
] | def sample(self, size: int=32) -> bool:
s = [None] * size
a = [None] * size
r = [None] * size
d = [None] * size
s2 = [None] * size
for batch, sample in enumerate(np.random.randint(0, self.top, size)):
_s, _a, _r, _d, _s2 = self.queue[sample]
s[... | [
"def",
"sample",
"(",
"self",
",",
"size",
":",
"int",
"=",
"32",
")",
"->",
"bool",
":",
"s",
"=",
"[",
"None",
"]",
"*",
"size",
"a",
"=",
"[",
"None",
"]",
"*",
"size",
"r",
"=",
"[",
"None",
"]",
"*",
"size",
"d",
"=",
"[",
"None",
"]... | Return a random sample of items from the queue. | [
"Return",
"a",
"random",
"sample",
"of",
"items",
"from",
"the",
"queue",
"."
] | [
"\"\"\"\n Return a random sample of items from the queue.\n Args:\n size: the number of items to sample and return\n Returns:\n A random sample from the queue sampled uniformly\n \"\"\"",
"# initialize lists for each component of the batch",
"# iterate over the ... | [
{
"param": "self",
"type": null
},
{
"param": "size",
"type": "int"
}
] | {
"returns": [
{
"docstring": "A random sample from the queue sampled uniformly",
"docstring_tokens": [
"A",
"random",
"sample",
"from",
"the",
"queue",
"sampled",
"uniformly"
],
"type": null
}
],
"raises": [],
"para... |
75796ddee586caadcc14825d5a125c91fa9655ec | 0x5eba/Dueling-DQN-SuperMarioBros | agent/model/dueling_DQ_agent.py | [
"MIT"
] | Python | build_dueling_deep_q_model | Model | def build_dueling_deep_q_model(
image_size: tuple=(84, 84),
num_frames: int=4,
num_actions: int=6,
loss=huber_loss,
optimizer=RMSprop(lr=0.00025, rho=0.95, epsilon=0.01)
) -> Model:
"""
Build and return the Deep Mind model for the given domain parameters.
Notes:
Color Space: thi... |
Build and return the Deep Mind model for the given domain parameters.
Notes:
Color Space: this CNN expects single channel images (B&W)
Args:
image_size: the shape of the image states for the model
Atari games are (192, 160), but DeepMind reduced the
... | Build and return the Deep Mind model for the given domain parameters.
Notes:
Color Space: this CNN expects single channel images (B&W) | [
"Build",
"and",
"return",
"the",
"Deep",
"Mind",
"model",
"for",
"the",
"given",
"domain",
"parameters",
".",
"Notes",
":",
"Color",
"Space",
":",
"this",
"CNN",
"expects",
"single",
"channel",
"images",
"(",
"B&W",
")"
] | def build_dueling_deep_q_model(
image_size: tuple=(84, 84),
num_frames: int=4,
num_actions: int=6,
loss=huber_loss,
optimizer=RMSprop(lr=0.00025, rho=0.95, epsilon=0.01)
) -> Model:
cnn_input = Input((*image_size, num_frames), name='cnn')
cnn = Lambda(lambda x: x / 255.0)(cnn_input)
cnn ... | [
"def",
"build_dueling_deep_q_model",
"(",
"image_size",
":",
"tuple",
"=",
"(",
"84",
",",
"84",
")",
",",
"num_frames",
":",
"int",
"=",
"4",
",",
"num_actions",
":",
"int",
"=",
"6",
",",
"loss",
"=",
"huber_loss",
",",
"optimizer",
"=",
"RMSprop",
"... | Build and return the Deep Mind model for the given domain parameters. | [
"Build",
"and",
"return",
"the",
"Deep",
"Mind",
"model",
"for",
"the",
"given",
"domain",
"parameters",
"."
] | [
"\"\"\"\n Build and return the Deep Mind model for the given domain parameters.\n\n Notes:\n Color Space: this CNN expects single channel images (B&W)\n\n Args:\n image_size: the shape of the image states for the model\n Atari games are (192, 160), but DeepMind reduced the... | [
{
"param": "image_size",
"type": "tuple"
},
{
"param": "num_frames",
"type": "int"
},
{
"param": "num_actions",
"type": "int"
},
{
"param": "loss",
"type": null
},
{
"param": "optimizer",
"type": null
}
] | {
"returns": [
{
"docstring": "a blank DeepMind CNN for image classification in a reinforcement agent",
"docstring_tokens": [
"a",
"blank",
"DeepMind",
"CNN",
"for",
"image",
"classification",
"in",
"a",
"reinforcement",
... |
aae6ad96f5f504ee5c06f65e619a5ab94c7577a4 | Syedkaja/Google-python-execise | logpuzzle/logpuzzle.py | [
"Apache-2.0"
] | Python | read_urls | <not_specific> | def read_urls(filename):
"""Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order."""
# +++your code here+++ [\w.-]+@[\w.-]+ alice-b@google.com
underbar = filename.index('_')
... | Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order. | Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself.
Screens out duplicate urls and returns the urls sorted into
increasing order. | [
"Returns",
"a",
"list",
"of",
"the",
"puzzle",
"urls",
"from",
"the",
"given",
"log",
"file",
"extracting",
"the",
"hostname",
"from",
"the",
"filename",
"itself",
".",
"Screens",
"out",
"duplicate",
"urls",
"and",
"returns",
"the",
"urls",
"sorted",
"into",... | def read_urls(filename):
underbar = filename.index('_')
host = filename[underbar + 1:]
urllist = []
f = open(filename)
for line in f:
match = re.search(r'"GET (\S+)', line)
if match:
path = match.group(1)
if 'puzzle' in path:
urllist.append("http://"+host+path)
... | [
"def",
"read_urls",
"(",
"filename",
")",
":",
"underbar",
"=",
"filename",
".",
"index",
"(",
"'_'",
")",
"host",
"=",
"filename",
"[",
"underbar",
"+",
"1",
":",
"]",
"urllist",
"=",
"[",
"]",
"f",
"=",
"open",
"(",
"filename",
")",
"for",
"line"... | Returns a list of the puzzle urls from the given log file,
extracting the hostname from the filename itself. | [
"Returns",
"a",
"list",
"of",
"the",
"puzzle",
"urls",
"from",
"the",
"given",
"log",
"file",
"extracting",
"the",
"hostname",
"from",
"the",
"filename",
"itself",
"."
] | [
"\"\"\"Returns a list of the puzzle urls from the given log file,\n extracting the hostname from the filename itself.\n Screens out duplicate urls and returns the urls sorted into\n increasing order.\"\"\"",
"# +++your code here+++ [\\w.-]+@[\\w.-]+ alice-b@google.com"
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aae6ad96f5f504ee5c06f65e619a5ab94c7577a4 | Syedkaja/Google-python-execise | logpuzzle/logpuzzle.py | [
"Apache-2.0"
] | Python | download_images | null | def download_images(img_urls, dest_dir):
"""Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if neces... | Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary.
| Given the urls already in the correct order, downloads
each image into the given directory.
Gives the images local filenames img0, img1, and so on.
Creates an index.html in the directory
with an img tag to show each local image file.
Creates the directory if necessary. | [
"Given",
"the",
"urls",
"already",
"in",
"the",
"correct",
"order",
"downloads",
"each",
"image",
"into",
"the",
"given",
"directory",
".",
"Gives",
"the",
"images",
"local",
"filenames",
"img0",
"img1",
"and",
"so",
"on",
".",
"Creates",
"an",
"index",
".... | def download_images(img_urls, dest_dir):
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
index = file(os.path.join(dest_dir, 'index.html'), 'w')
index.write('<html><body>\n')
i = 0
for url in img_urls:
fname = 'img%d' % i + '.jpg'
urllib.urlretrieve(url, os.path.join(dest_dir, fname))... | [
"def",
"download_images",
"(",
"img_urls",
",",
"dest_dir",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest_dir",
")",
":",
"os",
".",
"makedirs",
"(",
"dest_dir",
")",
"index",
"=",
"file",
"(",
"os",
".",
"path",
".",
"join",
... | Given the urls already in the correct order, downloads
each image into the given directory. | [
"Given",
"the",
"urls",
"already",
"in",
"the",
"correct",
"order",
"downloads",
"each",
"image",
"into",
"the",
"given",
"directory",
"."
] | [
"\"\"\"Given the urls already in the correct order, downloads\n each image into the given directory.\n Gives the images local filenames img0, img1, and so on.\n Creates an index.html in the directory\n with an img tag to show each local image file.\n Creates the directory if necessary.\n \"\"\"",
"# print(i... | [
{
"param": "img_urls",
"type": null
},
{
"param": "dest_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img_urls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dest_dir",
"type": null,
"docstring": null,
"docstring_to... |
e8dcded0478cbed59b63de6a851a2a2088c02d4f | nlahaye/learnergy | learnergy/math/metrics.py | [
"Apache-2.0"
] | Python | calculate_ssim | <not_specific> | def calculate_ssim(v, x):
"""Calculates the structural similarity of images.
Args:
v (torch.Tensor): Reconstructed images.
x (torch.Tensor): Original images.
Returns:
The structural similarity between input images.
"""
# Defines the total structural similarity
total_s... | Calculates the structural similarity of images.
Args:
v (torch.Tensor): Reconstructed images.
x (torch.Tensor): Original images.
Returns:
The structural similarity between input images.
| Calculates the structural similarity of images. | [
"Calculates",
"the",
"structural",
"similarity",
"of",
"images",
"."
] | def calculate_ssim(v, x):
total_ssim = 0.0
v = v.cpu().detach().numpy()
x = x.cpu().detach().numpy()
width = x.shape[1]
height = x.shape[2]
for z in range(v.shape[0]):
x_indexed = x[z]
v_indexed = v[z, :].reshape((width, height))
total_ssim += ssim(x_indexed, v_indexed,
... | [
"def",
"calculate_ssim",
"(",
"v",
",",
"x",
")",
":",
"total_ssim",
"=",
"0.0",
"v",
"=",
"v",
".",
"cpu",
"(",
")",
".",
"detach",
"(",
")",
".",
"numpy",
"(",
")",
"x",
"=",
"x",
".",
"cpu",
"(",
")",
".",
"detach",
"(",
")",
".",
"numpy... | Calculates the structural similarity of images. | [
"Calculates",
"the",
"structural",
"similarity",
"of",
"images",
"."
] | [
"\"\"\"Calculates the structural similarity of images.\n\n Args:\n v (torch.Tensor): Reconstructed images.\n x (torch.Tensor): Original images.\n\n Returns:\n The structural similarity between input images.\n\n \"\"\"",
"# Defines the total structural similarity",
"# Detaches and s... | [
{
"param": "v",
"type": null
},
{
"param": "x",
"type": null
}
] | {
"returns": [
{
"docstring": "The structural similarity between input images.",
"docstring_tokens": [
"The",
"structural",
"similarity",
"between",
"input",
"images",
"."
],
"type": null
}
],
"raises": [],
"params": [
{... |
c94290e36ef771e3272c00fbb8b9151bc769e3be | nlahaye/learnergy | learnergy/math/scale.py | [
"Apache-2.0"
] | Python | unitary_scale | <not_specific> | def unitary_scale(x):
"""Scales an array between 0 and 1.
Args:
x (array): A numpy array to be scaled.
Returns:
The scaled array.
"""
# Makes sure the array is float typed
x = x.astype('float32')
# Gathers array minimum and subtract
x -= x.min()
# Normalizes the... | Scales an array between 0 and 1.
Args:
x (array): A numpy array to be scaled.
Returns:
The scaled array.
| Scales an array between 0 and 1. | [
"Scales",
"an",
"array",
"between",
"0",
"and",
"1",
"."
] | def unitary_scale(x):
x = x.astype('float32')
x -= x.min()
x *= 1.0 / (x.max() + c.EPSILON)
return x | [
"def",
"unitary_scale",
"(",
"x",
")",
":",
"x",
"=",
"x",
".",
"astype",
"(",
"'float32'",
")",
"x",
"-=",
"x",
".",
"min",
"(",
")",
"x",
"*=",
"1.0",
"/",
"(",
"x",
".",
"max",
"(",
")",
"+",
"c",
".",
"EPSILON",
")",
"return",
"x"
] | Scales an array between 0 and 1. | [
"Scales",
"an",
"array",
"between",
"0",
"and",
"1",
"."
] | [
"\"\"\"Scales an array between 0 and 1.\n\n Args:\n x (array): A numpy array to be scaled.\n\n Returns:\n The scaled array.\n\n \"\"\"",
"# Makes sure the array is float typed",
"# Gathers array minimum and subtract",
"# Normalizes the array using its maximum"
] | [
{
"param": "x",
"type": null
}
] | {
"returns": [
{
"docstring": "The scaled array.",
"docstring_tokens": [
"The",
"scaled",
"array",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": "A numpy array to be scaled.... |
25d040b094d2574dbb9f4b278025ab7a92551fcf | nlahaye/learnergy | learnergy/visual/image.py | [
"Apache-2.0"
] | Python | _rasterize | <not_specific> | def _rasterize(x, img_shape, tile_shape, tile_spacing=(0, 0), scale=True, output=True):
"""Rasterizes and prepares an image to be outputted as a mosaic.
Args:
x (array): An input array to be rasterized.
img_shape (tuple): A tuple for the image shape.
tile_shape (tuple): A tuple holding ... | Rasterizes and prepares an image to be outputted as a mosaic.
Args:
x (array): An input array to be rasterized.
img_shape (tuple): A tuple for the image shape.
tile_shape (tuple): A tuple holding the shape of each tile.
tile_spacing (tuple): A tuple containing the spacing between ti... | Rasterizes and prepares an image to be outputted as a mosaic. | [
"Rasterizes",
"and",
"prepares",
"an",
"image",
"to",
"be",
"outputted",
"as",
"a",
"mosaic",
"."
] | def _rasterize(x, img_shape, tile_shape, tile_spacing=(0, 0), scale=True, output=True):
assert len(img_shape) == 2
assert len(tile_shape) == 2
assert len(tile_spacing) == 2
out_shape = [(ishp + tsp) * tshp - tsp for ishp, tshp,
tsp in zip(img_shape, tile_shape, tile_spacing)]
if isi... | [
"def",
"_rasterize",
"(",
"x",
",",
"img_shape",
",",
"tile_shape",
",",
"tile_spacing",
"=",
"(",
"0",
",",
"0",
")",
",",
"scale",
"=",
"True",
",",
"output",
"=",
"True",
")",
":",
"assert",
"len",
"(",
"img_shape",
")",
"==",
"2",
"assert",
"le... | Rasterizes and prepares an image to be outputted as a mosaic. | [
"Rasterizes",
"and",
"prepares",
"an",
"image",
"to",
"be",
"outputted",
"as",
"a",
"mosaic",
"."
] | [
"\"\"\"Rasterizes and prepares an image to be outputted as a mosaic.\n\n Args:\n x (array): An input array to be rasterized.\n img_shape (tuple): A tuple for the image shape.\n tile_shape (tuple): A tuple holding the shape of each tile.\n tile_spacing (tuple): A tuple containing the s... | [
{
"param": "x",
"type": null
},
{
"param": "img_shape",
"type": null
},
{
"param": "tile_shape",
"type": null
},
{
"param": "tile_spacing",
"type": null
},
{
"param": "scale",
"type": null
},
{
"param": "output",
"type": null
}
] | {
"returns": [
{
"docstring": "An output array containing the rasterized version of input array.",
"docstring_tokens": [
"An",
"output",
"array",
"containing",
"the",
"rasterized",
"version",
"of",
"input",
"array",
... |
25d040b094d2574dbb9f4b278025ab7a92551fcf | nlahaye/learnergy | learnergy/visual/image.py | [
"Apache-2.0"
] | Python | create_mosaic | null | def create_mosaic(tensor):
"""Creates a mosaic from a tensor using Pillow.
Args:
tensor (Tensor): An input tensor to have its mosaic created.
"""
# Gets the numpy array from the tensor
array = tensor.detach().numpy()
# Calculate their maximum possible squared dimension
d = int(np... | Creates a mosaic from a tensor using Pillow.
Args:
tensor (Tensor): An input tensor to have its mosaic created.
| Creates a mosaic from a tensor using Pillow. | [
"Creates",
"a",
"mosaic",
"from",
"a",
"tensor",
"using",
"Pillow",
"."
] | def create_mosaic(tensor):
array = tensor.detach().numpy()
d = int(np.sqrt(array.shape[0]))
s = int(np.sqrt(array.shape[1]))
img = Image.fromarray(_rasterize(array.T, img_shape=(
d, d), tile_shape=(s, s), tile_spacing=(1, 1)))
img.show() | [
"def",
"create_mosaic",
"(",
"tensor",
")",
":",
"array",
"=",
"tensor",
".",
"detach",
"(",
")",
".",
"numpy",
"(",
")",
"d",
"=",
"int",
"(",
"np",
".",
"sqrt",
"(",
"array",
".",
"shape",
"[",
"0",
"]",
")",
")",
"s",
"=",
"int",
"(",
"np"... | Creates a mosaic from a tensor using Pillow. | [
"Creates",
"a",
"mosaic",
"from",
"a",
"tensor",
"using",
"Pillow",
"."
] | [
"\"\"\"Creates a mosaic from a tensor using Pillow.\n\n Args:\n tensor (Tensor): An input tensor to have its mosaic created.\n\n \"\"\"",
"# Gets the numpy array from the tensor",
"# Calculate their maximum possible squared dimension",
"# Creates a Pillow image from the array's rasterized version... | [
{
"param": "tensor",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tensor",
"type": null,
"docstring": "An input tensor to have its mosaic created.",
"docstring_tokens": [
"An",
"input",
"tensor",
"to",
"have",
"its",
"mosaic",
"... |
25d040b094d2574dbb9f4b278025ab7a92551fcf | nlahaye/learnergy | learnergy/visual/image.py | [
"Apache-2.0"
] | Python | create_rgb_mosaic | null | def create_rgb_mosaic(tensor, n_samples=1):
"""Creates a squared mosaic for RGB images.
Args:
tensor (Tensor): An input tensor to have its mosaic created.
n_samples (int): The amount of samples to be plotted (width or height).
"""
# Permutes the tensor and transforms into numpy-based ... | Creates a squared mosaic for RGB images.
Args:
tensor (Tensor): An input tensor to have its mosaic created.
n_samples (int): The amount of samples to be plotted (width or height).
| Creates a squared mosaic for RGB images. | [
"Creates",
"a",
"squared",
"mosaic",
"for",
"RGB",
"images",
"."
] | def create_rgb_mosaic(tensor, n_samples=1):
array = tensor.detach().permute(0, 2, 3, 1).numpy()
for i in range(n_samples * n_samples):
plt.subplot(n_samples, n_samples, 1 + i)
plt.axis('off')
plt.imshow(array[i])
plt.show() | [
"def",
"create_rgb_mosaic",
"(",
"tensor",
",",
"n_samples",
"=",
"1",
")",
":",
"array",
"=",
"tensor",
".",
"detach",
"(",
")",
".",
"permute",
"(",
"0",
",",
"2",
",",
"3",
",",
"1",
")",
".",
"numpy",
"(",
")",
"for",
"i",
"in",
"range",
"(... | Creates a squared mosaic for RGB images. | [
"Creates",
"a",
"squared",
"mosaic",
"for",
"RGB",
"images",
"."
] | [
"\"\"\"Creates a squared mosaic for RGB images.\n\n Args:\n tensor (Tensor): An input tensor to have its mosaic created.\n n_samples (int): The amount of samples to be plotted (width or height).\n\n \"\"\"",
"# Permutes the tensor and transforms into numpy-based array",
"# plot images from t... | [
{
"param": "tensor",
"type": null
},
{
"param": "n_samples",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tensor",
"type": null,
"docstring": "An input tensor to have its mosaic created.",
"docstring_tokens": [
"An",
"input",
"tensor",
"to",
"have",
"its",
"mosaic",
"... |
6350bc635c4a4fbdfa7ec1175a6852181a62b881 | nlahaye/learnergy | learnergy/visual/tensor.py | [
"Apache-2.0"
] | Python | save_tensor | null | def save_tensor(tensor, output_path):
"""Saves a tensor in grayscale mode using Matplotlib.
Args:
tensor (Tensor): An input tensor to be saved.
output_path (str): An outputh path to save the tensor.
"""
# Creates a matplotlib figure
plt.figure()
# Checks if tensor has 3 chann... | Saves a tensor in grayscale mode using Matplotlib.
Args:
tensor (Tensor): An input tensor to be saved.
output_path (str): An outputh path to save the tensor.
| Saves a tensor in grayscale mode using Matplotlib. | [
"Saves",
"a",
"tensor",
"in",
"grayscale",
"mode",
"using",
"Matplotlib",
"."
] | def save_tensor(tensor, output_path):
plt.figure()
if tensor.size(0) == 3:
tensor = tensor.permute(1, 2, 0)
plt.imshow(tensor.cpu().detach().numpy())
else:
plt.imshow(tensor.cpu().detach().numpy(), cmap=plt.cm.get_cmap('gray'))
plt.xticks([])
plt.yticks([])
plt.savefig(ou... | [
"def",
"save_tensor",
"(",
"tensor",
",",
"output_path",
")",
":",
"plt",
".",
"figure",
"(",
")",
"if",
"tensor",
".",
"size",
"(",
"0",
")",
"==",
"3",
":",
"tensor",
"=",
"tensor",
".",
"permute",
"(",
"1",
",",
"2",
",",
"0",
")",
"plt",
".... | Saves a tensor in grayscale mode using Matplotlib. | [
"Saves",
"a",
"tensor",
"in",
"grayscale",
"mode",
"using",
"Matplotlib",
"."
] | [
"\"\"\"Saves a tensor in grayscale mode using Matplotlib.\n\n Args:\n tensor (Tensor): An input tensor to be saved.\n output_path (str): An outputh path to save the tensor.\n\n \"\"\"",
"# Creates a matplotlib figure",
"# Checks if tensor has 3 channels",
"# If yes, permutes the tensor",
... | [
{
"param": "tensor",
"type": null
},
{
"param": "output_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tensor",
"type": null,
"docstring": "An input tensor to be saved.",
"docstring_tokens": [
"An",
"input",
"tensor",
"to",
"be",
"saved",
"."
],
"default": null... |
6350bc635c4a4fbdfa7ec1175a6852181a62b881 | nlahaye/learnergy | learnergy/visual/tensor.py | [
"Apache-2.0"
] | Python | show_tensor | null | def show_tensor(tensor):
"""Plots a tensor in grayscale mode using Matplotlib.
Args:
tensor (Tensor): An input tensor to be plotted.
"""
# Creates a matplotlib figure
plt.figure()
# Checks if tensor has 3 channels
if tensor.size(0) == 3:
# If yes, permutes the tensor
... | Plots a tensor in grayscale mode using Matplotlib.
Args:
tensor (Tensor): An input tensor to be plotted.
| Plots a tensor in grayscale mode using Matplotlib. | [
"Plots",
"a",
"tensor",
"in",
"grayscale",
"mode",
"using",
"Matplotlib",
"."
] | def show_tensor(tensor):
plt.figure()
if tensor.size(0) == 3:
tensor = tensor.permute(1, 2, 0)
plt.imshow(tensor.cpu().detach().numpy())
else:
plt.imshow(tensor.cpu().detach().numpy(), cmap=plt.cm.get_cmap('gray'))
plt.xticks([])
plt.yticks([])
plt.show() | [
"def",
"show_tensor",
"(",
"tensor",
")",
":",
"plt",
".",
"figure",
"(",
")",
"if",
"tensor",
".",
"size",
"(",
"0",
")",
"==",
"3",
":",
"tensor",
"=",
"tensor",
".",
"permute",
"(",
"1",
",",
"2",
",",
"0",
")",
"plt",
".",
"imshow",
"(",
... | Plots a tensor in grayscale mode using Matplotlib. | [
"Plots",
"a",
"tensor",
"in",
"grayscale",
"mode",
"using",
"Matplotlib",
"."
] | [
"\"\"\"Plots a tensor in grayscale mode using Matplotlib.\n\n Args:\n tensor (Tensor): An input tensor to be plotted.\n\n \"\"\"",
"# Creates a matplotlib figure",
"# Checks if tensor has 3 channels",
"# If yes, permutes the tensor",
"# Plots without a color map",
"# If the tensor is grayscal... | [
{
"param": "tensor",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tensor",
"type": null,
"docstring": "An input tensor to be plotted.",
"docstring_tokens": [
"An",
"input",
"tensor",
"to",
"be",
"plotted",
"."
],
"default": ... |
651f5aaa2799f88600c53702e79ce05ac17da59e | NSLS-II-ESM-2/profile_collection | startup/42-ESM_monochromator.py | [
"BSD-3-Clause"
] | Python | change_offsets | <not_specific> | def change_offsets(self, grating, branch):
'''
This routine is used to change the grating and M2 mirror offsets using set.
Given a set of grating offset,mirror offset and the number of line per mm used by the PGM software
this routine updates the offset PV's but first setting the calibr... |
This routine is used to change the grating and M2 mirror offsets using set.
Given a set of grating offset,mirror offset and the number of line per mm used by the PGM software
this routine updates the offset PV's but first setting the calibration PV to "set" then returning
it to 'use' a... | This routine is used to change the grating and M2 mirror offsets using set.
Given a set of grating offset,mirror offset and the number of line per mm used by the PGM software
this routine updates the offset PV's but first setting the calibration PV to "set" then returning
it to 'use' afterwards.
PARAMETERS
branch :... | [
"This",
"routine",
"is",
"used",
"to",
"change",
"the",
"grating",
"and",
"M2",
"mirror",
"offsets",
"using",
"set",
".",
"Given",
"a",
"set",
"of",
"grating",
"offset",
"mirror",
"offset",
"and",
"the",
"number",
"of",
"line",
"per",
"mm",
"used",
"by",... | def change_offsets(self, grating, branch):
yield from mv(PGM.Mirror_Pitch_set, 1 , PGM.Grating_Pitch_set, 1)
yield from mv(PGM.Mirror_Pitch_off, float(self.M2_Offset[branch][grating]) ,
PGM.Grating_Pitch_off, float(self.Grt_Offset[branch][grating]),
PGM.Gratin... | [
"def",
"change_offsets",
"(",
"self",
",",
"grating",
",",
"branch",
")",
":",
"yield",
"from",
"mv",
"(",
"PGM",
".",
"Mirror_Pitch_set",
",",
"1",
",",
"PGM",
".",
"Grating_Pitch_set",
",",
"1",
")",
"yield",
"from",
"mv",
"(",
"PGM",
".",
"Mirror_Pi... | This routine is used to change the grating and M2 mirror offsets using set. | [
"This",
"routine",
"is",
"used",
"to",
"change",
"the",
"grating",
"and",
"M2",
"mirror",
"offsets",
"using",
"set",
"."
] | [
"'''\n This routine is used to change the grating and M2 mirror offsets using set.\n\n Given a set of grating offset,mirror offset and the number of line per mm used by the PGM software\n this routine updates the offset PV's but first setting the calibration PV to \"set\" then returning\n ... | [
{
"param": "self",
"type": null
},
{
"param": "grating",
"type": null
},
{
"param": "branch",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "grating",
"type": null,
"docstring": null,
"docstring_tokens"... |
651f5aaa2799f88600c53702e79ce05ac17da59e | NSLS-II-ESM-2/profile_collection | startup/42-ESM_monochromator.py | [
"BSD-3-Clause"
] | Python | move_to | <not_specific> | def move_to(self,photon_energy,grating='800',branch='A',EPU='57',LP='LH', c='constant',shutter='close'):
'''
Sets the monochromator and undulator to the correct values for the given photon energy
This function reads the definition .csv file and writes the information to data_dict in order to
... |
Sets the monochromator and undulator to the correct values for the given photon energy
This function reads the definition .csv file and writes the information to data_dict in order to
be used in the future motion.
PARAMETERS
----------
photon_energy : float
... | Sets the monochromator and undulator to the correct values for the given photon energy
This function reads the definition .csv file and writes the information to data_dict in order to
be used in the future motion.
PARAMETERS
photon_energy : float
The photon energy value to be set.
branch : str
The beamline branch w... | [
"Sets",
"the",
"monochromator",
"and",
"undulator",
"to",
"the",
"correct",
"values",
"for",
"the",
"given",
"photon",
"energy",
"This",
"function",
"reads",
"the",
"definition",
".",
"csv",
"file",
"and",
"writes",
"the",
"information",
"to",
"data_dict",
"in... | def move_to(self,photon_energy,grating='800',branch='A',EPU='57',LP='LH', c='constant',shutter='close'):
if (self.Range[grating][0]> photon_energy) or (self.Range[grating][1]< photon_energy):
raise RuntimeError('photon energy out of range for grating,'+
'use Eph.Range ... | [
"def",
"move_to",
"(",
"self",
",",
"photon_energy",
",",
"grating",
"=",
"'800'",
",",
"branch",
"=",
"'A'",
",",
"EPU",
"=",
"'57'",
",",
"LP",
"=",
"'LH'",
",",
"c",
"=",
"'constant'",
",",
"shutter",
"=",
"'close'",
")",
":",
"if",
"(",
"self",... | Sets the monochromator and undulator to the correct values for the given photon energy
This function reads the definition .csv file and writes the information to data_dict in order to
be used in the future motion. | [
"Sets",
"the",
"monochromator",
"and",
"undulator",
"to",
"the",
"correct",
"values",
"for",
"the",
"given",
"photon",
"energy",
"This",
"function",
"reads",
"the",
"definition",
".",
"csv",
"file",
"and",
"writes",
"the",
"information",
"to",
"data_dict",
"in... | [
"'''\n Sets the monochromator and undulator to the correct values for the given photon energy\n\n This function reads the definition .csv file and writes the information to data_dict in order to\n be used in the future motion.\n PARAMETERS\n ----------\n\n photon_energy : f... | [
{
"param": "self",
"type": null
},
{
"param": "photon_energy",
"type": null
},
{
"param": "grating",
"type": null
},
{
"param": "branch",
"type": null
},
{
"param": "EPU",
"type": null
},
{
"param": "LP",
"type": null
},
{
"param": "c",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "photon_energy",
"type": null,
"docstring": null,
"docstring_t... |
b63b73ff1a3869eedca88ffe0eb09206508f4880 | jbalooka/falcon-rest | rest/middleware/database.py | [
"Apache-2.0"
] | Python | process_request | null | def process_request(self, req, resp):
"""Process the request before routing it.
Args:
req: Request object that will eventually be
routed to an on_* responder method.
resp: Response object that will be routed to
the on_* responder.
"""
... | Process the request before routing it.
Args:
req: Request object that will eventually be
routed to an on_* responder method.
resp: Response object that will be routed to
the on_* responder.
| Process the request before routing it. | [
"Process",
"the",
"request",
"before",
"routing",
"it",
"."
] | def process_request(self, req, resp):
pass | [
"def",
"process_request",
"(",
"self",
",",
"req",
",",
"resp",
")",
":",
"pass"
] | Process the request before routing it. | [
"Process",
"the",
"request",
"before",
"routing",
"it",
"."
] | [
"\"\"\"Process the request before routing it.\n\n Args:\n req: Request object that will eventually be\n routed to an on_* responder method.\n resp: Response object that will be routed to\n the on_* responder.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "req",
"type": null
},
{
"param": "resp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "req",
"type": null,
"docstring": "Request object that will eventual... |
b63b73ff1a3869eedca88ffe0eb09206508f4880 | jbalooka/falcon-rest | rest/middleware/database.py | [
"Apache-2.0"
] | Python | process_resource | null | def process_resource(self, req, resp, resource, params):
"""Process the request after routing.
Note:
This method is only called when the request matches
a route to a resource.
Args:
req: Request object that will be passed to the
routed respon... | Process the request after routing.
Note:
This method is only called when the request matches
a route to a resource.
Args:
req: Request object that will be passed to the
routed responder.
resp: Response object that will be passed to the
... | Process the request after routing.
Note:
This method is only called when the request matches
a route to a resource. | [
"Process",
"the",
"request",
"after",
"routing",
".",
"Note",
":",
"This",
"method",
"is",
"only",
"called",
"when",
"the",
"request",
"matches",
"a",
"route",
"to",
"a",
"resource",
"."
] | def process_resource(self, req, resp, resource, params):
if(db.is_closed):
db.get_conn() | [
"def",
"process_resource",
"(",
"self",
",",
"req",
",",
"resp",
",",
"resource",
",",
"params",
")",
":",
"if",
"(",
"db",
".",
"is_closed",
")",
":",
"db",
".",
"get_conn",
"(",
")"
] | Process the request after routing. | [
"Process",
"the",
"request",
"after",
"routing",
"."
] | [
"\"\"\"Process the request after routing.\n\n Note:\n This method is only called when the request matches\n a route to a resource.\n\n Args:\n req: Request object that will be passed to the\n routed responder.\n resp: Response object that will... | [
{
"param": "self",
"type": null
},
{
"param": "req",
"type": null
},
{
"param": "resp",
"type": null
},
{
"param": "resource",
"type": null
},
{
"param": "params",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "req",
"type": null,
"docstring": "Request object that will be passe... |
b63b73ff1a3869eedca88ffe0eb09206508f4880 | jbalooka/falcon-rest | rest/middleware/database.py | [
"Apache-2.0"
] | Python | process_response | null | def process_response(self, req, resp, resource, req_succeeded):
"""Post-processing of the response (after routing).
Args:
req: Request object.
resp: Response object.
resource: Resource object to which the request was
routed. May be None if no route wa... | Post-processing of the response (after routing).
Args:
req: Request object.
resp: Response object.
resource: Resource object to which the request was
routed. May be None if no route was found
for the request.
req_succeeded: True if... | Post-processing of the response (after routing). | [
"Post",
"-",
"processing",
"of",
"the",
"response",
"(",
"after",
"routing",
")",
"."
] | def process_response(self, req, resp, resource, req_succeeded):
if req_succeeded and not db.is_closed:
db.close() | [
"def",
"process_response",
"(",
"self",
",",
"req",
",",
"resp",
",",
"resource",
",",
"req_succeeded",
")",
":",
"if",
"req_succeeded",
"and",
"not",
"db",
".",
"is_closed",
":",
"db",
".",
"close",
"(",
")"
] | Post-processing of the response (after routing). | [
"Post",
"-",
"processing",
"of",
"the",
"response",
"(",
"after",
"routing",
")",
"."
] | [
"\"\"\"Post-processing of the response (after routing).\n\n Args:\n req: Request object.\n resp: Response object.\n resource: Resource object to which the request was\n routed. May be None if no route was found\n for the request.\n req... | [
{
"param": "self",
"type": null
},
{
"param": "req",
"type": null
},
{
"param": "resp",
"type": null
},
{
"param": "resource",
"type": null
},
{
"param": "req_succeeded",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "req",
"type": null,
"docstring": null,
"docstring_tokens": [
... |
440a5ec984e6ed9f08e7a90152b4fc54aeac0edb | roebel/sigsep-mus-db | musdb/__init__.py | [
"MIT"
] | Python | test | <not_specific> | def test(self, user_function):
"""Test the musdb user_function output
Parameters
----------
user_function : callable, optional
function which separates the mixture into estimates.
Raises
------
TypeError
If the provided function handle is... | Test the musdb user_function output
Parameters
----------
user_function : callable, optional
function which separates the mixture into estimates.
Raises
------
TypeError
If the provided function handle is not callable.
ValueError
... | Test the musdb user_function output
Parameters
user_function : callable, optional
function which separates the mixture into estimates.
Raises
TypeError
If the provided function handle is not callable.
ValueError
If the output is not compliant to the bsseval methods
See Also
run : Process the musdb | [
"Test",
"the",
"musdb",
"user_function",
"output",
"Parameters",
"user_function",
":",
"callable",
"optional",
"function",
"which",
"separates",
"the",
"mixture",
"into",
"estimates",
".",
"Raises",
"TypeError",
"If",
"the",
"provided",
"function",
"handle",
"is",
... | def test(self, user_function):
if not hasattr(user_function, '__call__'):
raise TypeError("Please provide a function.")
test_track = Track(name="test - test")
signal = np.random.random((66000, 2))
test_track.audio = signal
test_track.rate = 44100
test_track.su... | [
"def",
"test",
"(",
"self",
",",
"user_function",
")",
":",
"if",
"not",
"hasattr",
"(",
"user_function",
",",
"'__call__'",
")",
":",
"raise",
"TypeError",
"(",
"\"Please provide a function.\"",
")",
"test_track",
"=",
"Track",
"(",
"name",
"=",
"\"test - tes... | Test the musdb user_function output
Parameters | [
"Test",
"the",
"musdb",
"user_function",
"output",
"Parameters"
] | [
"\"\"\"Test the musdb user_function output\n\n Parameters\n ----------\n user_function : callable, optional\n function which separates the mixture into estimates.\n\n Raises\n ------\n TypeError\n If the provided function handle is not callable.\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "user_function",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_function",
"type": null,
"docstring": null,
"docstring_t... |
e888085bee7eb68ba614899b9b758490794d18c9 | roebel/sigsep-mus-db | musdb/img.py | [
"MIT"
] | Python | download | <not_specific> | def download(self):
"""Download the MUSMAG data if it doesn't exist in processed_folder."""
from six.moves import urllib
import zipfile
if self._check_exists():
return
# download files
try:
os.makedirs(os.path.join(self.root_dir))
except ... | Download the MUSMAG data if it doesn't exist in processed_folder. | Download the MUSMAG data if it doesn't exist in processed_folder. | [
"Download",
"the",
"MUSMAG",
"data",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"in",
"processed_folder",
"."
] | def download(self):
from six.moves import urllib
import zipfile
if self._check_exists():
return
try:
os.makedirs(os.path.join(self.root_dir))
except OSError as e:
if e.errno == errno.EEXIST:
pass
else:
... | [
"def",
"download",
"(",
"self",
")",
":",
"from",
"six",
".",
"moves",
"import",
"urllib",
"import",
"zipfile",
"if",
"self",
".",
"_check_exists",
"(",
")",
":",
"return",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | Download the MUSMAG data if it doesn't exist in processed_folder. | [
"Download",
"the",
"MUSMAG",
"data",
"if",
"it",
"doesn",
"'",
"t",
"exist",
"in",
"processed_folder",
"."
] | [
"\"\"\"Download the MUSMAG data if it doesn't exist in processed_folder.\"\"\"",
"# download files"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0fc04def673b92d868695557fe73ca66c3b4e7d0 | shuns0314/yaml2instance | yaml2instance/main.py | [
"MIT"
] | Python | call_single | Any | def call_single(loading_data: dict, search_modules: List[ModuleType], **kwargs) -> Any:
"""From the list of modules, find the class written in yaml and instantiate it."""
assert len(loading_data.keys()) == 1, "len(loading_data.keys()) != 1"
if isinstance(loading_data, dict):
for instance_or_function... | From the list of modules, find the class written in yaml and instantiate it. | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | def call_single(loading_data: dict, search_modules: List[ModuleType], **kwargs) -> Any:
assert len(loading_data.keys()) == 1, "len(loading_data.keys()) != 1"
if isinstance(loading_data, dict):
for instance_or_function in _call_instance_or_function(
loading_data, search_modules, **kwargs
... | [
"def",
"call_single",
"(",
"loading_data",
":",
"dict",
",",
"search_modules",
":",
"List",
"[",
"ModuleType",
"]",
",",
"**",
"kwargs",
")",
"->",
"Any",
":",
"assert",
"len",
"(",
"loading_data",
".",
"keys",
"(",
")",
")",
"==",
"1",
",",
"\"len(loa... | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | [
"\"\"\"From the list of modules, find the class written in yaml and instantiate it.\"\"\""
] | [
{
"param": "loading_data",
"type": "dict"
},
{
"param": "search_modules",
"type": "List[ModuleType]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loading_data",
"type": "dict",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_modules",
"type": "List[ModuleType]",
"docstring":... |
0fc04def673b92d868695557fe73ca66c3b4e7d0 | shuns0314/yaml2instance | yaml2instance/main.py | [
"MIT"
] | Python | call_multiple | list | def call_multiple(
loading_data: Union[dict, List[dict]], search_modules: List[ModuleType], **kwargs
) -> list:
"""From the list of modules, find the class written in yaml and instantiate it."""
instance_list = []
if isinstance(loading_data, list):
for conf in loading_data:
for insta... | From the list of modules, find the class written in yaml and instantiate it. | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | def call_multiple(
loading_data: Union[dict, List[dict]], search_modules: List[ModuleType], **kwargs
) -> list:
instance_list = []
if isinstance(loading_data, list):
for conf in loading_data:
for instance in _call_instance_or_function(conf, search_modules, **kwargs):
inst... | [
"def",
"call_multiple",
"(",
"loading_data",
":",
"Union",
"[",
"dict",
",",
"List",
"[",
"dict",
"]",
"]",
",",
"search_modules",
":",
"List",
"[",
"ModuleType",
"]",
",",
"**",
"kwargs",
")",
"->",
"list",
":",
"instance_list",
"=",
"[",
"]",
"if",
... | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | [
"\"\"\"From the list of modules, find the class written in yaml and instantiate it.\"\"\""
] | [
{
"param": "loading_data",
"type": "Union[dict, List[dict]]"
},
{
"param": "search_modules",
"type": "List[ModuleType]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loading_data",
"type": "Union[dict, List[dict]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_modules",
"type": "List[ModuleType]",... |
0fc04def673b92d868695557fe73ca66c3b4e7d0 | shuns0314/yaml2instance | yaml2instance/main.py | [
"MIT"
] | Python | yaml2instances | list | def yaml2instances(
loading_data: Union[dict, List[dict]], search_modules: List[ModuleType], **kwargs
) -> list:
"""From the list of modules, find the class written in yaml and instantiate it."""
warnings.warn("yaml2instances is deprecated. Use call_multiple_process.")
instance_list = []
if isinstan... | From the list of modules, find the class written in yaml and instantiate it. | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | def yaml2instances(
loading_data: Union[dict, List[dict]], search_modules: List[ModuleType], **kwargs
) -> list:
warnings.warn("yaml2instances is deprecated. Use call_multiple_process.")
instance_list = []
if isinstance(loading_data, list):
for conf in loading_data:
for instance in _... | [
"def",
"yaml2instances",
"(",
"loading_data",
":",
"Union",
"[",
"dict",
",",
"List",
"[",
"dict",
"]",
"]",
",",
"search_modules",
":",
"List",
"[",
"ModuleType",
"]",
",",
"**",
"kwargs",
")",
"->",
"list",
":",
"warnings",
".",
"warn",
"(",
"\"yaml2... | From the list of modules, find the class written in yaml and instantiate it. | [
"From",
"the",
"list",
"of",
"modules",
"find",
"the",
"class",
"written",
"in",
"yaml",
"and",
"instantiate",
"it",
"."
] | [
"\"\"\"From the list of modules, find the class written in yaml and instantiate it.\"\"\""
] | [
{
"param": "loading_data",
"type": "Union[dict, List[dict]]"
},
{
"param": "search_modules",
"type": "List[ModuleType]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loading_data",
"type": "Union[dict, List[dict]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "search_modules",
"type": "List[ModuleType]",... |
768e8a7d4d69b05a44d951a0095fd6323ace566e | Squalex/LinkedinMiddleware | django_linkedin_middleware/middleware.py | [
"Apache-2.0"
] | Python | is_authorized_page | <not_specific> | def is_authorized_page(url_name):
"""
Validate if the request page need an authentication
Check if the page match the correct path to force a ask for a linkedin authentication
The pattern '*' can be use to force every request to redirect to linkedin for an authentication.
This b... |
Validate if the request page need an authentication
Check if the page match the correct path to force a ask for a linkedin authentication
The pattern '*' can be use to force every request to redirect to linkedin for an authentication.
This behavior can be disable for specific pages by ... | Validate if the request page need an authentication
Check if the page match the correct path to force a ask for a linkedin authentication
The pattern '*' can be use to force every request to redirect to linkedin for an authentication.
This behavior can be disable for specific pages by adding the pages to
the global var... | [
"Validate",
"if",
"the",
"request",
"page",
"need",
"an",
"authentication",
"Check",
"if",
"the",
"page",
"match",
"the",
"correct",
"path",
"to",
"force",
"a",
"ask",
"for",
"a",
"linkedin",
"authentication",
"The",
"pattern",
"'",
"*",
"'",
"can",
"be",
... | def is_authorized_page(url_name):
return url_name not in settings.PAGES_WITHOUT_LINKEDIN_AUTH_REQUIRED and (any(
pattern == '*' for pattern in settings.PAGES_WITH_LINKEDIN_AUTH_REQUIRED) or
url_name in settings.PAGES_WITH_LINKEDIN_AUTH_REQUIRED) | [
"def",
"is_authorized_page",
"(",
"url_name",
")",
":",
"return",
"url_name",
"not",
"in",
"settings",
".",
"PAGES_WITHOUT_LINKEDIN_AUTH_REQUIRED",
"and",
"(",
"any",
"(",
"pattern",
"==",
"'*'",
"for",
"pattern",
"in",
"settings",
".",
"PAGES_WITH_LINKEDIN_AUTH_REQ... | Validate if the request page need an authentication
Check if the page match the correct path to force a ask for a linkedin authentication
The pattern '*' can be use to force every request to redirect to linkedin for an authentication. | [
"Validate",
"if",
"the",
"request",
"page",
"need",
"an",
"authentication",
"Check",
"if",
"the",
"page",
"match",
"the",
"correct",
"path",
"to",
"force",
"a",
"ask",
"for",
"a",
"linkedin",
"authentication",
"The",
"pattern",
"'",
"*",
"'",
"can",
"be",
... | [
"\"\"\"\n Validate if the request page need an authentication\n\n Check if the page match the correct path to force a ask for a linkedin authentication\n The pattern '*' can be use to force every request to redirect to linkedin for an authentication.\n This behavior can be disable for sp... | [
{
"param": "url_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url_name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6041986b10251d2afd99d16556549b9a7c5cf34b | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/resources/v20160201/resource_group.py | [
"Apache-2.0"
] | Python | name | pulumi.Output[Optional[str]] | def name(self) -> pulumi.Output[Optional[str]]:
"""
The Name of the resource group.
"""
return pulumi.get(self, "name") |
The Name of the resource group.
| The Name of the resource group. | [
"The",
"Name",
"of",
"the",
"resource",
"group",
"."
] | def name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "name") | [
"def",
"name",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"str",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"name\"",
")"
] | The Name of the resource group. | [
"The",
"Name",
"of",
"the",
"resource",
"group",
"."
] | [
"\"\"\"\n The Name of the resource group.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6041a5cc9a72be86caddb603d11e15d9d92158a5 | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/datashare/v20191101/list_share_synchronizations.py | [
"Apache-2.0"
] | Python | next_link | Optional[str] | def next_link(self) -> Optional[str]:
"""
The Url of next result page.
"""
return pulumi.get(self, "next_link") |
The Url of next result page.
| The Url of next result page. | [
"The",
"Url",
"of",
"next",
"result",
"page",
"."
] | def next_link(self) -> Optional[str]:
return pulumi.get(self, "next_link") | [
"def",
"next_link",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"next_link\"",
")"
] | The Url of next result page. | [
"The",
"Url",
"of",
"next",
"result",
"page",
"."
] | [
"\"\"\"\n The Url of next result page.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6041a5cc9a72be86caddb603d11e15d9d92158a5 | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/datashare/v20191101/list_share_synchronizations.py | [
"Apache-2.0"
] | Python | list_share_synchronizations | AwaitableListShareSynchronizationsResult | def list_share_synchronizations(account_name: Optional[str] = None,
filter: Optional[str] = None,
orderby: Optional[str] = None,
resource_group_name: Optional[str] = None,
share_name: Optional... |
List response for get ShareSynchronization.
:param str account_name: The name of the share account.
:param str filter: Filters the results using OData syntax.
:param str orderby: Sorts the results using OData syntax.
:param str resource_group_name: The resource group name.
:param str share_na... | List response for get ShareSynchronization. | [
"List",
"response",
"for",
"get",
"ShareSynchronization",
"."
] | def list_share_synchronizations(account_name: Optional[str] = None,
filter: Optional[str] = None,
orderby: Optional[str] = None,
resource_group_name: Optional[str] = None,
share_name: Optional... | [
"def",
"list_share_synchronizations",
"(",
"account_name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"filter",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"orderby",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"resource_group_name... | List response for get ShareSynchronization. | [
"List",
"response",
"for",
"get",
"ShareSynchronization",
"."
] | [
"\"\"\"\n List response for get ShareSynchronization.\n\n\n :param str account_name: The name of the share account.\n :param str filter: Filters the results using OData syntax.\n :param str orderby: Sorts the results using OData syntax.\n :param str resource_group_name: The resource group name.\n ... | [
{
"param": "account_name",
"type": "Optional[str]"
},
{
"param": "filter",
"type": "Optional[str]"
},
{
"param": "orderby",
"type": "Optional[str]"
},
{
"param": "resource_group_name",
"type": "Optional[str]"
},
{
"param": "share_name",
"type": "Optional[str]"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "account_name",
"type": "Optional[str]",
"docstring": "The name of the share account.",
"docstring_tokens": [
"The",
"name",
"of",
"the",
"share",
"account",
"."
],
... |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | archive_window_length | pulumi.Output[str] | def archive_window_length(self) -> pulumi.Output[str]:
"""
ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. This also sets the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hou... |
ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. This also sets the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour and 30 minutes of archive window.
| ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. This also sets the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour and 30 minutes of archive window. | [
"ISO",
"8601",
"time",
"between",
"1",
"minute",
"to",
"25",
"hours",
"to",
"indicate",
"the",
"maximum",
"content",
"length",
"that",
"can",
"be",
"archived",
"in",
"the",
"asset",
"for",
"this",
"live",
"output",
".",
"This",
"also",
"sets",
"the",
"ma... | def archive_window_length(self) -> pulumi.Output[str]:
return pulumi.get(self, "archive_window_length") | [
"def",
"archive_window_length",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"archive_window_length\"",
")"
] | ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. | [
"ISO",
"8601",
"time",
"between",
"1",
"minute",
"to",
"25",
"hours",
"to",
"indicate",
"the",
"maximum",
"content",
"length",
"that",
"can",
"be",
"archived",
"in",
"the",
"asset",
"for",
"this",
"live",
"output",
"."
] | [
"\"\"\"\n ISO 8601 time between 1 minute to 25 hours to indicate the maximum content length that can be archived in the asset for this live output. This also sets the maximum content length for the rewind window. For example, use PT1H30M to indicate 1 hour and 30 minutes of archive window.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | asset_name | pulumi.Output[str] | def asset_name(self) -> pulumi.Output[str]:
"""
The asset that the live output will write to.
"""
return pulumi.get(self, "asset_name") |
The asset that the live output will write to.
| The asset that the live output will write to. | [
"The",
"asset",
"that",
"the",
"live",
"output",
"will",
"write",
"to",
"."
] | def asset_name(self) -> pulumi.Output[str]:
return pulumi.get(self, "asset_name") | [
"def",
"asset_name",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"asset_name\"",
")"
] | The asset that the live output will write to. | [
"The",
"asset",
"that",
"the",
"live",
"output",
"will",
"write",
"to",
"."
] | [
"\"\"\"\n The asset that the live output will write to.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | created | pulumi.Output[str] | def created(self) -> pulumi.Output[str]:
"""
The creation time the live output.
"""
return pulumi.get(self, "created") |
The creation time the live output.
| The creation time the live output. | [
"The",
"creation",
"time",
"the",
"live",
"output",
"."
] | def created(self) -> pulumi.Output[str]:
return pulumi.get(self, "created") | [
"def",
"created",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"created\"",
")"
] | The creation time the live output. | [
"The",
"creation",
"time",
"the",
"live",
"output",
"."
] | [
"\"\"\"\n The creation time the live output.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | hls | pulumi.Output[Optional['outputs.HlsResponse']] | def hls(self) -> pulumi.Output[Optional['outputs.HlsResponse']]:
"""
HTTP Live Streaming (HLS) packing setting for the live output.
"""
return pulumi.get(self, "hls") |
HTTP Live Streaming (HLS) packing setting for the live output.
| HTTP Live Streaming (HLS) packing setting for the live output. | [
"HTTP",
"Live",
"Streaming",
"(",
"HLS",
")",
"packing",
"setting",
"for",
"the",
"live",
"output",
"."
] | def hls(self) -> pulumi.Output[Optional['outputs.HlsResponse']]:
return pulumi.get(self, "hls") | [
"def",
"hls",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"'outputs.HlsResponse'",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"hls\"",
")"
] | HTTP Live Streaming (HLS) packing setting for the live output. | [
"HTTP",
"Live",
"Streaming",
"(",
"HLS",
")",
"packing",
"setting",
"for",
"the",
"live",
"output",
"."
] | [
"\"\"\"\n HTTP Live Streaming (HLS) packing setting for the live output.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | last_modified | pulumi.Output[str] | def last_modified(self) -> pulumi.Output[str]:
"""
The time the live output was last modified.
"""
return pulumi.get(self, "last_modified") |
The time the live output was last modified.
| The time the live output was last modified. | [
"The",
"time",
"the",
"live",
"output",
"was",
"last",
"modified",
"."
] | def last_modified(self) -> pulumi.Output[str]:
return pulumi.get(self, "last_modified") | [
"def",
"last_modified",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"last_modified\"",
")"
] | The time the live output was last modified. | [
"The",
"time",
"the",
"live",
"output",
"was",
"last",
"modified",
"."
] | [
"\"\"\"\n The time the live output was last modified.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | manifest_name | pulumi.Output[Optional[str]] | def manifest_name(self) -> pulumi.Output[Optional[str]]:
"""
The manifest file name. If not provided, the service will generate one automatically.
"""
return pulumi.get(self, "manifest_name") |
The manifest file name. If not provided, the service will generate one automatically.
| The manifest file name. If not provided, the service will generate one automatically. | [
"The",
"manifest",
"file",
"name",
".",
"If",
"not",
"provided",
"the",
"service",
"will",
"generate",
"one",
"automatically",
"."
] | def manifest_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "manifest_name") | [
"def",
"manifest_name",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"str",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"manifest_name\"",
")"
] | The manifest file name. | [
"The",
"manifest",
"file",
"name",
"."
] | [
"\"\"\"\n The manifest file name. If not provided, the service will generate one automatically.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | output_snap_time | pulumi.Output[Optional[float]] | def output_snap_time(self) -> pulumi.Output[Optional[float]]:
"""
The initial timestamp that the live output will start at, any content before this value will not be archived.
"""
return pulumi.get(self, "output_snap_time") |
The initial timestamp that the live output will start at, any content before this value will not be archived.
| The initial timestamp that the live output will start at, any content before this value will not be archived. | [
"The",
"initial",
"timestamp",
"that",
"the",
"live",
"output",
"will",
"start",
"at",
"any",
"content",
"before",
"this",
"value",
"will",
"not",
"be",
"archived",
"."
] | def output_snap_time(self) -> pulumi.Output[Optional[float]]:
return pulumi.get(self, "output_snap_time") | [
"def",
"output_snap_time",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"float",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"output_snap_time\"",
")"
] | The initial timestamp that the live output will start at, any content before this value will not be archived. | [
"The",
"initial",
"timestamp",
"that",
"the",
"live",
"output",
"will",
"start",
"at",
"any",
"content",
"before",
"this",
"value",
"will",
"not",
"be",
"archived",
"."
] | [
"\"\"\"\n The initial timestamp that the live output will start at, any content before this value will not be archived.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6042f51a9bfe0734cdb4e79b4f660200e4bd982f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/media/v20200501/live_output.py | [
"Apache-2.0"
] | Python | resource_state | pulumi.Output[str] | def resource_state(self) -> pulumi.Output[str]:
"""
The resource state of the live output.
"""
return pulumi.get(self, "resource_state") |
The resource state of the live output.
| The resource state of the live output. | [
"The",
"resource",
"state",
"of",
"the",
"live",
"output",
"."
] | def resource_state(self) -> pulumi.Output[str]:
return pulumi.get(self, "resource_state") | [
"def",
"resource_state",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"resource_state\"",
")"
] | The resource state of the live output. | [
"The",
"resource",
"state",
"of",
"the",
"live",
"output",
"."
] | [
"\"\"\"\n The resource state of the live output.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
60452a33b911819b3acf80fa0ad6feeb3f6de03d | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/machinelearningservices/v20190501/get_machine_learning_compute.py | [
"Apache-2.0"
] | Python | identity | Optional['outputs.IdentityResponse'] | def identity(self) -> Optional['outputs.IdentityResponse']:
"""
The identity of the resource.
"""
return pulumi.get(self, "identity") |
The identity of the resource.
| The identity of the resource. | [
"The",
"identity",
"of",
"the",
"resource",
"."
] | def identity(self) -> Optional['outputs.IdentityResponse']:
return pulumi.get(self, "identity") | [
"def",
"identity",
"(",
"self",
")",
"->",
"Optional",
"[",
"'outputs.IdentityResponse'",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"identity\"",
")"
] | The identity of the resource. | [
"The",
"identity",
"of",
"the",
"resource",
"."
] | [
"\"\"\"\n The identity of the resource.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
60452a33b911819b3acf80fa0ad6feeb3f6de03d | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/machinelearningservices/v20190501/get_machine_learning_compute.py | [
"Apache-2.0"
] | Python | tags | Optional[Mapping[str, str]] | def tags(self) -> Optional[Mapping[str, str]]:
"""
Contains resource tags defined as key/value pairs.
"""
return pulumi.get(self, "tags") |
Contains resource tags defined as key/value pairs.
| Contains resource tags defined as key/value pairs. | [
"Contains",
"resource",
"tags",
"defined",
"as",
"key",
"/",
"value",
"pairs",
"."
] | def tags(self) -> Optional[Mapping[str, str]]:
return pulumi.get(self, "tags") | [
"def",
"tags",
"(",
"self",
")",
"->",
"Optional",
"[",
"Mapping",
"[",
"str",
",",
"str",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"tags\"",
")"
] | Contains resource tags defined as key/value pairs. | [
"Contains",
"resource",
"tags",
"defined",
"as",
"key",
"/",
"value",
"pairs",
"."
] | [
"\"\"\"\n Contains resource tags defined as key/value pairs.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6048854f1dcc10084e722750454f02e06114cc1f | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/documentdb/v20160319/database_account_table.py | [
"Apache-2.0"
] | Python | location | pulumi.Output[Optional[str]] | def location(self) -> pulumi.Output[Optional[str]]:
"""
The location of the resource group to which the resource belongs.
"""
return pulumi.get(self, "location") |
The location of the resource group to which the resource belongs.
| The location of the resource group to which the resource belongs. | [
"The",
"location",
"of",
"the",
"resource",
"group",
"to",
"which",
"the",
"resource",
"belongs",
"."
] | def location(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "location") | [
"def",
"location",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"str",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"location\"",
")"
] | The location of the resource group to which the resource belongs. | [
"The",
"location",
"of",
"the",
"resource",
"group",
"to",
"which",
"the",
"resource",
"belongs",
"."
] | [
"\"\"\"\n The location of the resource group to which the resource belongs.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
604b6c22a11d8bc462e7a3caf4ec652d57cc442a | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/web/v20160901/app_service_plan.py | [
"Apache-2.0"
] | Python | admin_site_name | pulumi.Output[Optional[str]] | def admin_site_name(self) -> pulumi.Output[Optional[str]]:
"""
App Service plan administration site.
"""
return pulumi.get(self, "admin_site_name") |
App Service plan administration site.
| App Service plan administration site. | [
"App",
"Service",
"plan",
"administration",
"site",
"."
] | def admin_site_name(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "admin_site_name") | [
"def",
"admin_site_name",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"Optional",
"[",
"str",
"]",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"admin_site_name\"",
")"
] | App Service plan administration site. | [
"App",
"Service",
"plan",
"administration",
"site",
"."
] | [
"\"\"\"\n App Service plan administration site.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
604b6c22a11d8bc462e7a3caf4ec652d57cc442a | pulumi/pulumi-azure-nextgen | sdk/python/pulumi_azure_nextgen/web/v20160901/app_service_plan.py | [
"Apache-2.0"
] | Python | geo_region | pulumi.Output[str] | def geo_region(self) -> pulumi.Output[str]:
"""
Geographical location for the App Service plan.
"""
return pulumi.get(self, "geo_region") |
Geographical location for the App Service plan.
| Geographical location for the App Service plan. | [
"Geographical",
"location",
"for",
"the",
"App",
"Service",
"plan",
"."
] | def geo_region(self) -> pulumi.Output[str]:
return pulumi.get(self, "geo_region") | [
"def",
"geo_region",
"(",
"self",
")",
"->",
"pulumi",
".",
"Output",
"[",
"str",
"]",
":",
"return",
"pulumi",
".",
"get",
"(",
"self",
",",
"\"geo_region\"",
")"
] | Geographical location for the App Service plan. | [
"Geographical",
"location",
"for",
"the",
"App",
"Service",
"plan",
"."
] | [
"\"\"\"\n Geographical location for the App Service plan.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.