body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def load_command(self, command, flags, user_level, code, set=True): '\n Load a command in the runtime\n\n :param command: What is the command called\n :param flags: Command flags\n :param user_level: The minimum user level to run the command\n :param code: The Lua code for the cus...
-1,585,351,775,516,527,400
Load a command in the runtime :param command: What is the command called :param flags: Command flags :param user_level: The minimum user level to run the command :param code: The Lua code for the custom command :param set: Should the command be set on the bot via set_command, set this to False when loading...
bot/commandmanager.py
load_command
lietu/twitch-bot
python
def load_command(self, command, flags, user_level, code, set=True): '\n Load a command in the runtime\n\n :param command: What is the command called\n :param flags: Command flags\n :param user_level: The minimum user level to run the command\n :param code: The Lua code for the cus...
def run_command(self, nick, user_level, command, args=None, timestamp=None, threaded=True): "\n Handles running of custom commands from chat\n\n :param nick: The calling user\n :param user_level: The calling user's level\n :param command: The command triggered\n :param args: The w...
309,166,365,526,661,400
Handles running of custom commands from chat :param nick: The calling user :param user_level: The calling user's level :param command: The command triggered :param args: The words on the line after the command :param timestamp: The unixtime for when the event happened :return: Any return value from the custom Lua comm...
bot/commandmanager.py
run_command
lietu/twitch-bot
python
def run_command(self, nick, user_level, command, args=None, timestamp=None, threaded=True): "\n Handles running of custom commands from chat\n\n :param nick: The calling user\n :param user_level: The calling user's level\n :param command: The command triggered\n :param args: The w...
def load_lua(self, code): '\n Load Lua code in our runtime\n\n :param code: The Lua code\n :return: None\n ' self.lua.execute(code)
-9,147,439,341,931,043,000
Load Lua code in our runtime :param code: The Lua code :return: None
bot/commandmanager.py
load_lua
lietu/twitch-bot
python
def load_lua(self, code): '\n Load Lua code in our runtime\n\n :param code: The Lua code\n :return: None\n ' self.lua.execute(code)
def _parse_func(self, args): '\n Process the given arguments into a function definition\n\n :param args: List of the words after the "def" command\n :return: Function name, if it wants the caller\'s user name,\n the required user level, and the function\'s Lua code\n :rai...
-3,807,910,362,400,559,000
Process the given arguments into a function definition :param args: List of the words after the "def" command :return: Function name, if it wants the caller's user name, the required user level, and the function's Lua code :raise argparse.ArgumentError: There was something wrong with the args
bot/commandmanager.py
_parse_func
lietu/twitch-bot
python
def _parse_func(self, args): '\n Process the given arguments into a function definition\n\n :param args: List of the words after the "def" command\n :return: Function name, if it wants the caller\'s user name,\n the required user level, and the function\'s Lua code\n :rai...
def _parse_simple_func(self, args): '\n Process the given arguments into a simple function definition\n\n :param args: List of the words after the "com" command\n :return: Function name, if it wants the caller\'s user name,\n the required user level, and the function\'s Lua code...
-820,046,322,053,778,800
Process the given arguments into a simple function definition :param args: List of the words after the "com" command :return: Function name, if it wants the caller's user name, the required user level, and the function's Lua code :raise argparse.ArgumentError: There was something wrong with the args
bot/commandmanager.py
_parse_simple_func
lietu/twitch-bot
python
def _parse_simple_func(self, args): '\n Process the given arguments into a simple function definition\n\n :param args: List of the words after the "com" command\n :return: Function name, if it wants the caller\'s user name,\n the required user level, and the function\'s Lua code...
def _is_under_cooldown(self, command, timestamp): "\n Check if this command's cooldown period is in effect\n :param command: Which command\n :param timestamp: What is the timestamp it was issued on\n :return:\n " if (command in self.commands_last_executed): if ('cooldo...
962,702,915,414,738,800
Check if this command's cooldown period is in effect :param command: Which command :param timestamp: What is the timestamp it was issued on :return:
bot/commandmanager.py
_is_under_cooldown
lietu/twitch-bot
python
def _is_under_cooldown(self, command, timestamp): "\n Check if this command's cooldown period is in effect\n :param command: Which command\n :param timestamp: What is the timestamp it was issued on\n :return:\n " if (command in self.commands_last_executed): if ('cooldo...
def _set_last_executed_time(self, command, timestamp): '\n Save the last execution time of a command\n :param command: Which command\n :param timestamp: What is the timestamp it was issued on\n :return:\n ' self.commands_last_executed[command] = timestamp
-3,623,127,483,259,920,000
Save the last execution time of a command :param command: Which command :param timestamp: What is the timestamp it was issued on :return:
bot/commandmanager.py
_set_last_executed_time
lietu/twitch-bot
python
def _set_last_executed_time(self, command, timestamp): '\n Save the last execution time of a command\n :param command: Which command\n :param timestamp: What is the timestamp it was issued on\n :return:\n ' self.commands_last_executed[command] = timestamp
def _level_name_to_number(self, name): '\n Convert the given user level to a number\n\n :param name: Level name\n :return: A number between 0 and Infinity, higher number is higher\n user level\n :raise ValueError: In case of invalid user level\n ' levels = ['us...
-4,419,965,674,233,182,700
Convert the given user level to a number :param name: Level name :return: A number between 0 and Infinity, higher number is higher user level :raise ValueError: In case of invalid user level
bot/commandmanager.py
_level_name_to_number
lietu/twitch-bot
python
def _level_name_to_number(self, name): '\n Convert the given user level to a number\n\n :param name: Level name\n :return: A number between 0 and Infinity, higher number is higher\n user level\n :raise ValueError: In case of invalid user level\n ' levels = ['us...
def _can_run_command(self, user_level, command): "\n Check if this command can be run with the given user level\n\n :param user_level: The calling user's level\n :param command: The command being called\n :return: True of False\n " need_level = self._level_name_to_number(self....
-2,490,286,005,795,867,600
Check if this command can be run with the given user level :param user_level: The calling user's level :param command: The command being called :return: True of False
bot/commandmanager.py
_can_run_command
lietu/twitch-bot
python
def _can_run_command(self, user_level, command): "\n Check if this command can be run with the given user level\n\n :param user_level: The calling user's level\n :param command: The command being called\n :return: True of False\n " need_level = self._level_name_to_number(self....
def _inject_globals(self): '\n Inject some Python objects and functions into the Lua global scope _G\n\n :return: None\n ' injector = self.lua.eval('\n function (key, value)\n _G[key] = value\n end\n ') def log(message): '\n ...
-6,403,042,037,872,840,000
Inject some Python objects and functions into the Lua global scope _G :return: None
bot/commandmanager.py
_inject_globals
lietu/twitch-bot
python
def _inject_globals(self): '\n Inject some Python objects and functions into the Lua global scope _G\n\n :return: None\n ' injector = self.lua.eval('\n function (key, value)\n _G[key] = value\n end\n ') def log(message): '\n ...
def log(message): '\n Pass a message from Lua to the Python logger\n\n :param message: The message text\n :return: None\n ' self.logger.debug((u'Lua: ' + str(message)))
294,852,574,707,328,300
Pass a message from Lua to the Python logger :param message: The message text :return: None
bot/commandmanager.py
log
lietu/twitch-bot
python
def log(message): '\n Pass a message from Lua to the Python logger\n\n :param message: The message text\n :return: None\n ' self.logger.debug((u'Lua: ' + str(message)))
def test_basic_constants(self): '\n Check that the basic constants are imported and visible.\n ' self.assertIsNotNone(ck.SEEK_TO_BEGINNING) self.assertIsNotNone(ck.DONT_SEEK) self.assertIsNotNone(ck.SEEK_TO_END) self.assertIsNotNone(ck.ALL_PARTITIONS_SEEK_TO_BEGINNING) self.assertI...
-8,485,359,525,170,984,000
Check that the basic constants are imported and visible.
py/server/tests/test_kafka_consumer.py
test_basic_constants
lbooker42/deephaven-core
python
def test_basic_constants(self): '\n \n ' self.assertIsNotNone(ck.SEEK_TO_BEGINNING) self.assertIsNotNone(ck.DONT_SEEK) self.assertIsNotNone(ck.SEEK_TO_END) self.assertIsNotNone(ck.ALL_PARTITIONS_SEEK_TO_BEGINNING) self.assertIsNotNone(ck.ALL_PARTITIONS_SEEK_TO_END) self.assertI...
def test_simple_spec(self): '\n Check a simple Kafka subscription creates the right table.\n ' t = ck.consume({'bootstrap.servers': 'redpanda:29092'}, 'orders', key_spec=KeyValueSpec.IGNORE, value_spec=ck.simple_spec('Price', dtypes.double)) cols = t.columns self.assertEqual(4, len(cols)) ...
5,960,851,227,852,433,000
Check a simple Kafka subscription creates the right table.
py/server/tests/test_kafka_consumer.py
test_simple_spec
lbooker42/deephaven-core
python
def test_simple_spec(self): '\n \n ' t = ck.consume({'bootstrap.servers': 'redpanda:29092'}, 'orders', key_spec=KeyValueSpec.IGNORE, value_spec=ck.simple_spec('Price', dtypes.double)) cols = t.columns self.assertEqual(4, len(cols)) self._assert_common_cols(cols) self.assertEqual('P...
def test_json_spec(self): '\n Check a JSON Kafka subscription creates the right table.\n ' t = ck.consume({'bootstrap.servers': 'redpanda:29092'}, 'orders', key_spec=KeyValueSpec.IGNORE, value_spec=ck.json_spec([('Symbol', dtypes.string), ('Side', dtypes.string), ('Price', dtypes.double), ('Qty', ...
2,342,120,107,655,886,300
Check a JSON Kafka subscription creates the right table.
py/server/tests/test_kafka_consumer.py
test_json_spec
lbooker42/deephaven-core
python
def test_json_spec(self): '\n \n ' t = ck.consume({'bootstrap.servers': 'redpanda:29092'}, 'orders', key_spec=KeyValueSpec.IGNORE, value_spec=ck.json_spec([('Symbol', dtypes.string), ('Side', dtypes.string), ('Price', dtypes.double), ('Qty', dtypes.int_), ('Tstamp', dtypes.DateTime)], mapping={'js...
def test_avro_spec(self): '\n Check an Avro Kafka subscription creates the right table.\n ' schema = '\n { "type" : "record",\n "namespace" : "io.deephaven.examples",\n "name" : "share_price",\n "fields" : [\n { "name" : "Symbol", "t...
485,627,723,911,774,850
Check an Avro Kafka subscription creates the right table.
py/server/tests/test_kafka_consumer.py
test_avro_spec
lbooker42/deephaven-core
python
def test_avro_spec(self): '\n \n ' schema = '\n { "type" : "record",\n "namespace" : "io.deephaven.examples",\n "name" : "share_price",\n "fields" : [\n { "name" : "Symbol", "type" : "string" },\n { "name" : "Side", ...
@unittest.skip('https://github.com/deephaven/deephaven-core/pull/2277') def test_deprecated_table_types(self): '\n Tests to make sure deprecated TableTypes are equivalent\n ' self.assertEqual(TableType.append(), TableType.Append) self.assertEqual(TableType.stream(), TableType.Stream)
-4,242,480,715,210,158,600
Tests to make sure deprecated TableTypes are equivalent
py/server/tests/test_kafka_consumer.py
test_deprecated_table_types
lbooker42/deephaven-core
python
@unittest.skip('https://github.com/deephaven/deephaven-core/pull/2277') def test_deprecated_table_types(self): '\n \n ' self.assertEqual(TableType.append(), TableType.Append) self.assertEqual(TableType.stream(), TableType.Stream)
def test_table_types(self): '\n Tests TableType construction\n ' _ = TableType.append() _ = TableType.stream() _ = TableType.ring(4096)
2,499,055,364,101,107,700
Tests TableType construction
py/server/tests/test_kafka_consumer.py
test_table_types
lbooker42/deephaven-core
python
def test_table_types(self): '\n \n ' _ = TableType.append() _ = TableType.stream() _ = TableType.ring(4096)
@classmethod def from_dict(cls, dict_obj): ' Creates an Agent object from parameters stored in a dict. AgentSchema is used to validate inputs.' return cls(**cls.AgentSchema().load(dict_obj, partial=['paw']))
-4,173,985,643,143,858,000
Creates an Agent object from parameters stored in a dict. AgentSchema is used to validate inputs.
app/objects/c_agent.py
from_dict
zaphodef/caldera
python
@classmethod def from_dict(cls, dict_obj): ' ' return cls(**cls.AgentSchema().load(dict_obj, partial=['paw']))
def parse_duration(value: str) -> datetime.timedelta: "Parse a duration string and return a datetime.timedelta.\n\n Args:\n value (str): A time duration given as text. The preferred format for\n durations is '%d %H:%M:%S.%f'. This function also supports ISO 8601\n representation and ...
-5,307,280,787,856,276,000
Parse a duration string and return a datetime.timedelta. Args: value (str): A time duration given as text. The preferred format for durations is '%d %H:%M:%S.%f'. This function also supports ISO 8601 representation and PostgreSQL's day-time interval format. Returns: datetime.timedelta: An inst...
pde/tools/parse_duration.py
parse_duration
lmenou/py-pde
python
def parse_duration(value: str) -> datetime.timedelta: "Parse a duration string and return a datetime.timedelta.\n\n Args:\n value (str): A time duration given as text. The preferred format for\n durations is '%d %H:%M:%S.%f'. This function also supports ISO 8601\n representation and ...
@query_many_property def local_modules(self): 'Load local modules. Return SQLAlchemy query' return self.modules.filter(Module.m.path.like('%{}%'.format(persistence_config.base_path)))
34,532,395,116,731,730
Load local modules. Return SQLAlchemy query
capture/noworkflow/now/persistence/models/trial.py
local_modules
raffaelfoidl/noworkflow
python
@query_many_property def local_modules(self): return self.modules.filter(Module.m.path.like('%{}%'.format(persistence_config.base_path)))
@query_many_property def modules(self): 'Load modules. Return SQLAlchemy query' if self.inherited: return self.inherited.modules return self.dmodules
-2,528,479,259,529,810,400
Load modules. Return SQLAlchemy query
capture/noworkflow/now/persistence/models/trial.py
modules
raffaelfoidl/noworkflow
python
@query_many_property def modules(self): if self.inherited: return self.inherited.modules return self.dmodules
@query_many_property def dependencies(self): 'Load modules. Return SQLAlchemy query' if self.inherited: return self.inherited.dependencies return self.module_dependencies
-7,273,323,766,861,591,000
Load modules. Return SQLAlchemy query
capture/noworkflow/now/persistence/models/trial.py
dependencies
raffaelfoidl/noworkflow
python
@query_many_property def dependencies(self): if self.inherited: return self.inherited.dependencies return self.module_dependencies
@query_many_property def initial_activations(self): 'Return initial activation as a SQLAlchemy query' return self.activations.filter(is_none(Activation.m.caller_id))
-7,233,818,596,856,919,000
Return initial activation as a SQLAlchemy query
capture/noworkflow/now/persistence/models/trial.py
initial_activations
raffaelfoidl/noworkflow
python
@query_many_property def initial_activations(self): return self.activations.filter(is_none(Activation.m.caller_id))
@property def prolog_variables(self): 'Return filtered prolog variables' if (not self._prolog_visitor): self.dependency_filter.run() self._prolog_visitor = PrologVisitor(self.dependency_filter) self._prolog_visitor.visit(self.dependency_filter.main_cluster) return self._prolog_visito...
-397,316,024,569,532,600
Return filtered prolog variables
capture/noworkflow/now/persistence/models/trial.py
prolog_variables
raffaelfoidl/noworkflow
python
@property def prolog_variables(self): if (not self._prolog_visitor): self.dependency_filter.run() self._prolog_visitor = PrologVisitor(self.dependency_filter) self._prolog_visitor.visit(self.dependency_filter.main_cluster) return self._prolog_visitor
@property def script_content(self): 'Return the "main" script content of the trial' return PrettyLines(content.get(self.code_hash).decode('utf-8').split('/n'))
5,959,198,191,165,273,000
Return the "main" script content of the trial
capture/noworkflow/now/persistence/models/trial.py
script_content
raffaelfoidl/noworkflow
python
@property def script_content(self): return PrettyLines(content.get(self.code_hash).decode('utf-8').split('/n'))
@property def finished(self): 'Check if trial has finished' return bool(self.finish)
4,549,426,415,557,629,400
Check if trial has finished
capture/noworkflow/now/persistence/models/trial.py
finished
raffaelfoidl/noworkflow
python
@property def finished(self): return bool(self.finish)
@property def status(self): 'Check trial status\n Possible statuses: finished, unfinished, backup' if (not self.run): return 'backup' return ('finished' if self.finished else 'unfinished')
3,606,235,992,606,115,000
Check trial status Possible statuses: finished, unfinished, backup
capture/noworkflow/now/persistence/models/trial.py
status
raffaelfoidl/noworkflow
python
@property def status(self): 'Check trial status\n Possible statuses: finished, unfinished, backup' if (not self.run): return 'backup' return ('finished' if self.finished else 'unfinished')
@property def duration(self): 'Calculate trial duration. Return microseconds' if self.finish: return int(((self.finish - self.start).total_seconds() * 1000000)) return 0
-3,282,620,830,210,900,000
Calculate trial duration. Return microseconds
capture/noworkflow/now/persistence/models/trial.py
duration
raffaelfoidl/noworkflow
python
@property def duration(self): if self.finish: return int(((self.finish - self.start).total_seconds() * 1000000)) return 0
@property def duration_text(self): 'Calculate trial duration. Return formatted str' if self.finish: return str((self.finish - self.start)) return 'None'
-530,437,388,138,204,860
Calculate trial duration. Return formatted str
capture/noworkflow/now/persistence/models/trial.py
duration_text
raffaelfoidl/noworkflow
python
@property def duration_text(self): if self.finish: return str((self.finish - self.start)) return 'None'
@property def environment(self): 'Return dict: environment variables -> value' return {e.name: e.value for e in self.environment_attrs}
3,438,829,612,525,810,700
Return dict: environment variables -> value
capture/noworkflow/now/persistence/models/trial.py
environment
raffaelfoidl/noworkflow
python
@property def environment(self): return {e.name: e.value for e in self.environment_attrs}
def versioned_files(self, skip_script=False, skip_local=False, skip_access=False): 'Find first files accessed in a trial\n Return map with relative path -> (code_hash, type)\n\n Possible types: script, module, access\n ' files = {} def add(path, info): 'Add file to dict' ...
7,804,030,863,116,041,000
Find first files accessed in a trial Return map with relative path -> (code_hash, type) Possible types: script, module, access
capture/noworkflow/now/persistence/models/trial.py
versioned_files
raffaelfoidl/noworkflow
python
def versioned_files(self, skip_script=False, skip_local=False, skip_access=False): 'Find first files accessed in a trial\n Return map with relative path -> (code_hash, type)\n\n Possible types: script, module, access\n ' files = {} def add(path, info): 'Add file to dict' ...
def iterate_accesses(self, path=None): 'Iterate on all access to a path' if ((not path) or self.script.endswith(path)): (yield (self.script, {'code_hash': self.code_hash, 'type': 'script'})) for module in self.local_modules: if ((not path) or module.path.endswith(path)): (yield (...
5,028,473,455,695,651,000
Iterate on all access to a path
capture/noworkflow/now/persistence/models/trial.py
iterate_accesses
raffaelfoidl/noworkflow
python
def iterate_accesses(self, path=None): if ((not path) or self.script.endswith(path)): (yield (self.script, {'code_hash': self.code_hash, 'type': 'script'})) for module in self.local_modules: if ((not path) or module.path.endswith(path)): (yield (module.path, {'code_hash': module...
def create_head(self): 'Create head for this trial' session = relational.make_session() session.query(Head.m).filter((Head.m.script == self.script)).delete() session.add(Head.m(trial_id=self.id, script=self.script)) session.commit()
-2,086,893,957,433,139,000
Create head for this trial
capture/noworkflow/now/persistence/models/trial.py
create_head
raffaelfoidl/noworkflow
python
def create_head(self): session = relational.make_session() session.query(Head.m).filter((Head.m.script == self.script)).delete() session.add(Head.m(trial_id=self.id, script=self.script)) session.commit()
def query(self, query): 'Run prolog query' return self.prolog.query(query)
1,142,936,998,032,021,000
Run prolog query
capture/noworkflow/now/persistence/models/trial.py
query
raffaelfoidl/noworkflow
python
def query(self, query): return self.prolog.query(query)
def _ipython_display_(self): 'Display history graph' if hasattr(self, 'graph'): return self.graph._ipython_display_() from IPython.display import display display({'text/plain': 'Trial {}'.format(self.id)}, raw=True)
4,845,852,689,895,969,000
Display history graph
capture/noworkflow/now/persistence/models/trial.py
_ipython_display_
raffaelfoidl/noworkflow
python
def _ipython_display_(self): if hasattr(self, 'graph'): return self.graph._ipython_display_() from IPython.display import display display({'text/plain': 'Trial {}'.format(self.id)}, raw=True)
def show(self, _print=print): 'Print trial information' _print(' Id: {t.id}\n Inherited Id: {t.inherited_id}\n Script: {t.script}\n Code hash: {t.code_hash}\n Start: {t.start}\n Finish: {t.finish}\n Duration: {t.duration_text} ...
-3,123,170,109,015,617,500
Print trial information
capture/noworkflow/now/persistence/models/trial.py
show
raffaelfoidl/noworkflow
python
def show(self, _print=print): _print(' Id: {t.id}\n Inherited Id: {t.inherited_id}\n Script: {t.script}\n Code hash: {t.code_hash}\n Start: {t.start}\n Finish: {t.finish}\n Duration: {t.duration_text} '.format(t=self))
@classmethod def distinct_scripts(cls): 'Return a set with distinct scripts' return {s[0].rsplit('/', 1)[(- 1)] for s in relational.session.query(distinct(cls.m.script))}
-6,364,750,551,788,056,000
Return a set with distinct scripts
capture/noworkflow/now/persistence/models/trial.py
distinct_scripts
raffaelfoidl/noworkflow
python
@classmethod def distinct_scripts(cls): return {s[0].rsplit('/', 1)[(- 1)] for s in relational.session.query(distinct(cls.m.script))}
@classmethod def reverse_trials(cls, limit, session=None): 'Return a generator with <limit> trials ordered by start time desc' session = (session or relational.session) return proxy_gen(session.query(cls.m).order_by(cls.m.start.desc()).limit(limit))
-3,460,930,242,788,007,000
Return a generator with <limit> trials ordered by start time desc
capture/noworkflow/now/persistence/models/trial.py
reverse_trials
raffaelfoidl/noworkflow
python
@classmethod def reverse_trials(cls, limit, session=None): session = (session or relational.session) return proxy_gen(session.query(cls.m).order_by(cls.m.start.desc()).limit(limit))
@classmethod def last_trial(cls, script=None, parent_required=False, session=None): 'Return last trial according to start time\n\n Keyword arguments:\n script -- specify the desired script (default=None)\n parent_required -- valid only if script exists (default=False)\n ' model = cls...
5,395,468,279,525,787,000
Return last trial according to start time Keyword arguments: script -- specify the desired script (default=None) parent_required -- valid only if script exists (default=False)
capture/noworkflow/now/persistence/models/trial.py
last_trial
raffaelfoidl/noworkflow
python
@classmethod def last_trial(cls, script=None, parent_required=False, session=None): 'Return last trial according to start time\n\n Keyword arguments:\n script -- specify the desired script (default=None)\n parent_required -- valid only if script exists (default=False)\n ' model = cls...
@classmethod def find_by_name_and_time(cls, script, timestamp, trial=None, session=None): 'Return the first trial according to script and timestamp\n\n Arguments:\n script -- specify the desired script\n timestamp -- specify the start of finish time of trial\n\n Keyword Arguments:\n ...
-5,874,113,822,201,334,000
Return the first trial according to script and timestamp Arguments: script -- specify the desired script timestamp -- specify the start of finish time of trial Keyword Arguments: trial -- limit query to a specific trial
capture/noworkflow/now/persistence/models/trial.py
find_by_name_and_time
raffaelfoidl/noworkflow
python
@classmethod def find_by_name_and_time(cls, script, timestamp, trial=None, session=None): 'Return the first trial according to script and timestamp\n\n Arguments:\n script -- specify the desired script\n timestamp -- specify the start of finish time of trial\n\n Keyword Arguments:\n ...
@classmethod def load_trial(cls, trial_ref, session=None): 'Load trial by trial reference\n\n Find reference on trials id and tags name\n ' from .tag import Tag session = (session or relational.session) return session.query(cls.m).outerjoin(Tag.m).filter(((cls.m.id == trial_ref) | (Tag.m.n...
-3,829,412,513,214,292,000
Load trial by trial reference Find reference on trials id and tags name
capture/noworkflow/now/persistence/models/trial.py
load_trial
raffaelfoidl/noworkflow
python
@classmethod def load_trial(cls, trial_ref, session=None): 'Load trial by trial reference\n\n Find reference on trials id and tags name\n ' from .tag import Tag session = (session or relational.session) return session.query(cls.m).outerjoin(Tag.m).filter(((cls.m.id == trial_ref) | (Tag.m.n...
@classmethod def load_parent(cls, script, remove=True, parent_required=False, session=None): 'Load head trial by script\n\n\n Keyword arguments:\n remove -- remove from head, after loading (default=True)\n parent_required -- valid only if script exists (default=False)\n session -- specif...
-5,441,716,824,521,170,000
Load head trial by script Keyword arguments: remove -- remove from head, after loading (default=True) parent_required -- valid only if script exists (default=False) session -- specify session for loading (default=relational.session)
capture/noworkflow/now/persistence/models/trial.py
load_parent
raffaelfoidl/noworkflow
python
@classmethod def load_parent(cls, script, remove=True, parent_required=False, session=None): 'Load head trial by script\n\n\n Keyword arguments:\n remove -- remove from head, after loading (default=True)\n parent_required -- valid only if script exists (default=False)\n session -- specif...
@classmethod def fast_last_trial_id(cls, session=None): 'Load last trial id that did not bypass modules\n\n\n Compile SQLAlchemy core query into string for optimization\n\n Keyword arguments:\n session -- specify session for loading (default=relational.session)\n ' session = (session...
3,566,533,528,998,085,000
Load last trial id that did not bypass modules Compile SQLAlchemy core query into string for optimization Keyword arguments: session -- specify session for loading (default=relational.session)
capture/noworkflow/now/persistence/models/trial.py
fast_last_trial_id
raffaelfoidl/noworkflow
python
@classmethod def fast_last_trial_id(cls, session=None): 'Load last trial id that did not bypass modules\n\n\n Compile SQLAlchemy core query into string for optimization\n\n Keyword arguments:\n session -- specify session for loading (default=relational.session)\n ' session = (session...
@classmethod def fast_update(cls, trial_id, finish, docstring, session=None): 'Update finish time of trial\n\n Use core sqlalchemy\n\n Arguments:\n trial_id -- trial id\n finish -- finish time as a datetime object\n\n\n Keyword arguments:\n session -- specify session for lo...
7,144,367,229,818,227,000
Update finish time of trial Use core sqlalchemy Arguments: trial_id -- trial id finish -- finish time as a datetime object Keyword arguments: session -- specify session for loading (default=relational.session)
capture/noworkflow/now/persistence/models/trial.py
fast_update
raffaelfoidl/noworkflow
python
@classmethod def fast_update(cls, trial_id, finish, docstring, session=None): 'Update finish time of trial\n\n Use core sqlalchemy\n\n Arguments:\n trial_id -- trial id\n finish -- finish time as a datetime object\n\n\n Keyword arguments:\n session -- specify session for lo...
@classmethod def store(cls, start, script, code_hash, arguments, bypass_modules, command, run, docstring, session=None): 'Create trial and assign a new id to it\n\n Use core sqlalchemy\n\n Arguments:\n start -- trial start time\n script -- script name\n code_hash -- script hash co...
-5,175,056,888,793,935,000
Create trial and assign a new id to it Use core sqlalchemy Arguments: start -- trial start time script -- script name code_hash -- script hash code arguments -- trial arguments bypass_modules -- whether it captured modules or not command -- the full command line with noWorkflow parametes run -- trial created by the r...
capture/noworkflow/now/persistence/models/trial.py
store
raffaelfoidl/noworkflow
python
@classmethod def store(cls, start, script, code_hash, arguments, bypass_modules, command, run, docstring, session=None): 'Create trial and assign a new id to it\n\n Use core sqlalchemy\n\n Arguments:\n start -- trial start time\n script -- script name\n code_hash -- script hash co...
@classmethod def all(cls, session=None): 'Return all trials\n\n Keyword arguments:\n session -- specify session for loading (default=relational.session)\n ' session = (session or relational.session) return proxy_gen(session.query(cls.m))
-5,441,857,363,821,957,000
Return all trials Keyword arguments: session -- specify session for loading (default=relational.session)
capture/noworkflow/now/persistence/models/trial.py
all
raffaelfoidl/noworkflow
python
@classmethod def all(cls, session=None): 'Return all trials\n\n Keyword arguments:\n session -- specify session for loading (default=relational.session)\n ' session = (session or relational.session) return proxy_gen(session.query(cls.m))
def match_status(self, status): 'Check if trial statuses matches\n ' if (status == '*'): return True return (self.status == status)
3,859,083,279,929,322,000
Check if trial statuses matches
capture/noworkflow/now/persistence/models/trial.py
match_status
raffaelfoidl/noworkflow
python
def match_status(self, status): '\n ' if (status == '*'): return True return (self.status == status)
def match_script(self, script): 'Check if trial scripts matches\n ' if (script == '*'): return True return (self.script == script)
2,700,283,920,835,461,000
Check if trial scripts matches
capture/noworkflow/now/persistence/models/trial.py
match_script
raffaelfoidl/noworkflow
python
def match_script(self, script): '\n ' if (script == '*'): return True return (self.script == script)
@property def str_start(self): 'Return start date as string' return str(self.start)
6,990,337,085,220,348,000
Return start date as string
capture/noworkflow/now/persistence/models/trial.py
str_start
raffaelfoidl/noworkflow
python
@property def str_start(self): return str(self.start)
@property def str_finish(self): 'Return start date as string' return str(self.finish)
-4,390,467,911,824,953,000
Return start date as string
capture/noworkflow/now/persistence/models/trial.py
str_finish
raffaelfoidl/noworkflow
python
@property def str_finish(self): return str(self.finish)
@classmethod def count(cls, session=None): 'Count number of trials on database\n ' session = (session or relational.session) return session.query(cls.m).count()
-3,095,270,125,073,085,000
Count number of trials on database
capture/noworkflow/now/persistence/models/trial.py
count
raffaelfoidl/noworkflow
python
@classmethod def count(cls, session=None): '\n ' session = (session or relational.session) return session.query(cls.m).count()
def add(path, info): 'Add file to dict' if os.path.isabs(path): if (not (persistence_config.base_path in path)): return path = os.path.relpath(path, persistence_config.base_path) files[path] = info
1,143,074,063,093,067,000
Add file to dict
capture/noworkflow/now/persistence/models/trial.py
add
raffaelfoidl/noworkflow
python
def add(path, info): if os.path.isabs(path): if (not (persistence_config.base_path in path)): return path = os.path.relpath(path, persistence_config.base_path) files[path] = info
def __init__(self, init_state_idx=None, init_state_idx_type='obs', policy_array=None, policy_idx_type='obs', p_diabetes=0.2): '\n initialize the simulator\n ' assert ((p_diabetes >= 0) and (p_diabetes <= 1)), 'Invalid p_diabetes: {}'.format(p_diabetes) assert (policy_idx_type in ['obs', 'full'...
7,739,463,211,233,123,000
initialize the simulator
sepsisSimDiabetes/MDP.py
__init__
GuyLor/gumbel_max_causal_gadgets_part2
python
def __init__(self, init_state_idx=None, init_state_idx_type='obs', policy_array=None, policy_idx_type='obs', p_diabetes=0.2): '\n \n ' assert ((p_diabetes >= 0) and (p_diabetes <= 1)), 'Invalid p_diabetes: {}'.format(p_diabetes) assert (policy_idx_type in ['obs', 'full', 'proj_obs']) if (p...
def get_new_state(self, state_idx=None, idx_type='obs', diabetic_idx=None): "\n use to start MDP over. A few options:\n\n Full specification:\n 1. Provide state_idx with idx_type = 'obs' + diabetic_idx\n 2. Provide state_idx with idx_type = 'full', diabetic_idx is ignored\n 3. Pr...
5,995,413,871,458,844,000
use to start MDP over. A few options: Full specification: 1. Provide state_idx with idx_type = 'obs' + diabetic_idx 2. Provide state_idx with idx_type = 'full', diabetic_idx is ignored 3. Provide state_idx with idx_type = 'proj_obs' + diabetic_idx* * This option will set glucose to a normal level Random specificati...
sepsisSimDiabetes/MDP.py
get_new_state
GuyLor/gumbel_max_causal_gadgets_part2
python
def get_new_state(self, state_idx=None, idx_type='obs', diabetic_idx=None): "\n use to start MDP over. A few options:\n\n Full specification:\n 1. Provide state_idx with idx_type = 'obs' + diabetic_idx\n 2. Provide state_idx with idx_type = 'full', diabetic_idx is ignored\n 3. Pr...
def transition_antibiotics_on(self): '\n antibiotics state on\n heart rate, sys bp: hi -> normal w.p. .5\n ' self.state.antibiotic_state = 1 if ((self.state.hr_state == 2) and (np.random.uniform(0, 1) < 0.5)): self.state.hr_state = 1 if ((self.state.sysbp_state == 2) and (np...
8,961,013,802,412,358,000
antibiotics state on heart rate, sys bp: hi -> normal w.p. .5
sepsisSimDiabetes/MDP.py
transition_antibiotics_on
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_antibiotics_on(self): '\n antibiotics state on\n heart rate, sys bp: hi -> normal w.p. .5\n ' self.state.antibiotic_state = 1 if ((self.state.hr_state == 2) and (np.random.uniform(0, 1) < 0.5)): self.state.hr_state = 1 if ((self.state.sysbp_state == 2) and (np...
def transition_antibiotics_off(self): '\n antibiotics state off\n if antibiotics was on: heart rate, sys bp: normal -> hi w.p. .1\n ' if (self.state.antibiotic_state == 1): if ((self.state.hr_state == 1) and (np.random.uniform(0, 1) < 0.1)): self.state.hr_state = 2 ...
-558,963,829,897,848,400
antibiotics state off if antibiotics was on: heart rate, sys bp: normal -> hi w.p. .1
sepsisSimDiabetes/MDP.py
transition_antibiotics_off
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_antibiotics_off(self): '\n antibiotics state off\n if antibiotics was on: heart rate, sys bp: normal -> hi w.p. .1\n ' if (self.state.antibiotic_state == 1): if ((self.state.hr_state == 1) and (np.random.uniform(0, 1) < 0.1)): self.state.hr_state = 2 ...
def transition_vent_on(self): '\n ventilation state on\n percent oxygen: low -> normal w.p. .7\n ' self.state.vent_state = 1 if ((self.state.percoxyg_state == 0) and (np.random.uniform(0, 1) < 0.7)): self.state.percoxyg_state = 1
4,821,546,960,925,724,000
ventilation state on percent oxygen: low -> normal w.p. .7
sepsisSimDiabetes/MDP.py
transition_vent_on
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_vent_on(self): '\n ventilation state on\n percent oxygen: low -> normal w.p. .7\n ' self.state.vent_state = 1 if ((self.state.percoxyg_state == 0) and (np.random.uniform(0, 1) < 0.7)): self.state.percoxyg_state = 1
def transition_vent_off(self): '\n ventilation state off\n if ventilation was on: percent oxygen: normal -> lo w.p. .1\n ' if (self.state.vent_state == 1): if ((self.state.percoxyg_state == 1) and (np.random.uniform(0, 1) < 0.1)): self.state.percoxyg_state = 0 se...
5,563,056,253,617,258,000
ventilation state off if ventilation was on: percent oxygen: normal -> lo w.p. .1
sepsisSimDiabetes/MDP.py
transition_vent_off
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_vent_off(self): '\n ventilation state off\n if ventilation was on: percent oxygen: normal -> lo w.p. .1\n ' if (self.state.vent_state == 1): if ((self.state.percoxyg_state == 1) and (np.random.uniform(0, 1) < 0.1)): self.state.percoxyg_state = 0 se...
def transition_vaso_on(self): '\n vasopressor state on\n for non-diabetic:\n sys bp: low -> normal, normal -> hi w.p. .7\n for diabetic:\n raise blood pressure: normal -> hi w.p. .9,\n lo -> normal w.p. .5, lo -> hi w.p. .4\n raise blood glucose b...
-1,507,010,084,658,555,100
vasopressor state on for non-diabetic: sys bp: low -> normal, normal -> hi w.p. .7 for diabetic: raise blood pressure: normal -> hi w.p. .9, lo -> normal w.p. .5, lo -> hi w.p. .4 raise blood glucose by 1 w.p. .5
sepsisSimDiabetes/MDP.py
transition_vaso_on
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_vaso_on(self): '\n vasopressor state on\n for non-diabetic:\n sys bp: low -> normal, normal -> hi w.p. .7\n for diabetic:\n raise blood pressure: normal -> hi w.p. .9,\n lo -> normal w.p. .5, lo -> hi w.p. .4\n raise blood glucose b...
def transition_vaso_off(self): '\n vasopressor state off\n if vasopressor was on:\n for non-diabetics, sys bp: normal -> low, hi -> normal w.p. .1\n for diabetics, blood pressure falls by 1 w.p. .05 instead of .1\n ' if (self.state.vaso_state == 1): if (self.st...
4,314,229,342,329,886,000
vasopressor state off if vasopressor was on: for non-diabetics, sys bp: normal -> low, hi -> normal w.p. .1 for diabetics, blood pressure falls by 1 w.p. .05 instead of .1
sepsisSimDiabetes/MDP.py
transition_vaso_off
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_vaso_off(self): '\n vasopressor state off\n if vasopressor was on:\n for non-diabetics, sys bp: normal -> low, hi -> normal w.p. .1\n for diabetics, blood pressure falls by 1 w.p. .05 instead of .1\n ' if (self.state.vaso_state == 1): if (self.st...
def transition_fluctuate(self, hr_fluctuate, sysbp_fluctuate, percoxyg_fluctuate, glucose_fluctuate): '\n all (non-treatment) states fluctuate +/- 1 w.p. .1\n exception: glucose flucuates +/- 1 w.p. .3 if diabetic\n ' if hr_fluctuate: hr_prob = np.random.uniform(0, 1) if (hr...
1,336,593,036,583,505,400
all (non-treatment) states fluctuate +/- 1 w.p. .1 exception: glucose flucuates +/- 1 w.p. .3 if diabetic
sepsisSimDiabetes/MDP.py
transition_fluctuate
GuyLor/gumbel_max_causal_gadgets_part2
python
def transition_fluctuate(self, hr_fluctuate, sysbp_fluctuate, percoxyg_fluctuate, glucose_fluctuate): '\n all (non-treatment) states fluctuate +/- 1 w.p. .1\n exception: glucose flucuates +/- 1 w.p. .3 if diabetic\n ' if hr_fluctuate: hr_prob = np.random.uniform(0, 1) if (hr...
def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_enabled=False): '\n Arguments:\n score_thresh (float)\n nms (float)\n detections_per_img (int)\n box_coder (BoxCoder)\n ' super(P...
2,870,374,798,669,880,000
Arguments: score_thresh (float) nms (float) detections_per_img (int) box_coder (BoxCoder)
fcos_core/modeling/roi_heads/box_head/inference.py
__init__
qilei123/FCOS
python
def __init__(self, score_thresh=0.05, nms=0.5, detections_per_img=100, box_coder=None, cls_agnostic_bbox_reg=False, bbox_aug_enabled=False): '\n Arguments:\n score_thresh (float)\n nms (float)\n detections_per_img (int)\n box_coder (BoxCoder)\n ' super(P...
def forward(self, x, boxes): '\n Arguments:\n x (tuple[tensor, tensor]): x contains the class logits\n and the box_regression from the model.\n boxes (list[BoxList]): bounding boxes that are used as\n reference, one for ech image\n\n Returns:\n ...
-3,406,154,131,159,554,600
Arguments: x (tuple[tensor, tensor]): x contains the class logits and the box_regression from the model. boxes (list[BoxList]): bounding boxes that are used as reference, one for ech image Returns: results (list[BoxList]): one BoxList for each image, containing the extra fields labe...
fcos_core/modeling/roi_heads/box_head/inference.py
forward
qilei123/FCOS
python
def forward(self, x, boxes): '\n Arguments:\n x (tuple[tensor, tensor]): x contains the class logits\n and the box_regression from the model.\n boxes (list[BoxList]): bounding boxes that are used as\n reference, one for ech image\n\n Returns:\n ...
def prepare_boxlist(self, boxes, scores, image_shape): '\n Returns BoxList from `boxes` and adds probability scores information\n as an extra field\n `boxes` has shape (#detections, 4 * #classes), where each row represents\n a list of predicted bounding boxes for each of the object class...
6,100,855,235,390,330,000
Returns BoxList from `boxes` and adds probability scores information as an extra field `boxes` has shape (#detections, 4 * #classes), where each row represents a list of predicted bounding boxes for each of the object classes in the dataset (including the background class). The detections in each row originate from the...
fcos_core/modeling/roi_heads/box_head/inference.py
prepare_boxlist
qilei123/FCOS
python
def prepare_boxlist(self, boxes, scores, image_shape): '\n Returns BoxList from `boxes` and adds probability scores information\n as an extra field\n `boxes` has shape (#detections, 4 * #classes), where each row represents\n a list of predicted bounding boxes for each of the object class...
def filter_results(self, boxlist, num_classes): 'Returns bounding-box detection results by thresholding on scores and\n applying non-maximum suppression (NMS).\n ' boxes = boxlist.bbox.reshape((- 1), (num_classes * 4)) scores = boxlist.get_field('scores').reshape((- 1), num_classes) device...
3,938,484,773,227,017,700
Returns bounding-box detection results by thresholding on scores and applying non-maximum suppression (NMS).
fcos_core/modeling/roi_heads/box_head/inference.py
filter_results
qilei123/FCOS
python
def filter_results(self, boxlist, num_classes): 'Returns bounding-box detection results by thresholding on scores and\n applying non-maximum suppression (NMS).\n ' boxes = boxlist.bbox.reshape((- 1), (num_classes * 4)) scores = boxlist.get_field('scores').reshape((- 1), num_classes) device...
def _calculate_deltas(times: (((str | np.ndarray) | NDFrame) | None), halflife: ((float | TimedeltaConvertibleTypes) | None)) -> np.ndarray: '\n Return the diff of the times divided by the half-life. These values are used in\n the calculation of the ewm mean.\n\n Parameters\n ----------\n times : str...
-5,254,744,993,093,402,000
Return the diff of the times divided by the half-life. These values are used in the calculation of the ewm mean. Parameters ---------- times : str, np.ndarray, Series, default None Times corresponding to the observations. Must be monotonically increasing and ``datetime64[ns]`` dtype. halflife : float, str, tim...
pandas/core/window/ewm.py
_calculate_deltas
DrGFreeman/pandas
python
def _calculate_deltas(times: (((str | np.ndarray) | NDFrame) | None), halflife: ((float | TimedeltaConvertibleTypes) | None)) -> np.ndarray: '\n Return the diff of the times divided by the half-life. These values are used in\n the calculation of the ewm mean.\n\n Parameters\n ----------\n times : str...
def _get_window_indexer(self) -> BaseIndexer: '\n Return an indexer class that will compute the window start and end bounds\n ' return ExponentialMovingWindowIndexer()
6,524,741,404,708,218,000
Return an indexer class that will compute the window start and end bounds
pandas/core/window/ewm.py
_get_window_indexer
DrGFreeman/pandas
python
def _get_window_indexer(self) -> BaseIndexer: '\n \n ' return ExponentialMovingWindowIndexer()
def online(self, engine='numba', engine_kwargs=None): "\n Return an ``OnlineExponentialMovingWindow`` object to calculate\n exponentially moving window aggregations in an online method.\n\n .. versionadded:: 1.3.0\n\n Parameters\n ----------\n engine: str, default ``'numba'...
5,517,177,251,206,371,000
Return an ``OnlineExponentialMovingWindow`` object to calculate exponentially moving window aggregations in an online method. .. versionadded:: 1.3.0 Parameters ---------- engine: str, default ``'numba'`` Execution engine to calculate online aggregations. Applies to all supported aggregation methods. engine_...
pandas/core/window/ewm.py
online
DrGFreeman/pandas
python
def online(self, engine='numba', engine_kwargs=None): "\n Return an ``OnlineExponentialMovingWindow`` object to calculate\n exponentially moving window aggregations in an online method.\n\n .. versionadded:: 1.3.0\n\n Parameters\n ----------\n engine: str, default ``'numba'...
def _get_window_indexer(self) -> GroupbyIndexer: '\n Return an indexer class that will compute the window start and end bounds\n\n Returns\n -------\n GroupbyIndexer\n ' window_indexer = GroupbyIndexer(groupby_indicies=self._grouper.indices, window_indexer=ExponentialMovingWin...
4,688,982,227,691,670,000
Return an indexer class that will compute the window start and end bounds Returns ------- GroupbyIndexer
pandas/core/window/ewm.py
_get_window_indexer
DrGFreeman/pandas
python
def _get_window_indexer(self) -> GroupbyIndexer: '\n Return an indexer class that will compute the window start and end bounds\n\n Returns\n -------\n GroupbyIndexer\n ' window_indexer = GroupbyIndexer(groupby_indicies=self._grouper.indices, window_indexer=ExponentialMovingWin...
def reset(self): '\n Reset the state captured by `update` calls.\n ' self._mean.reset()
8,308,839,287,548,406,000
Reset the state captured by `update` calls.
pandas/core/window/ewm.py
reset
DrGFreeman/pandas
python
def reset(self): '\n \n ' self._mean.reset()
def mean(self, *args, update=None, update_times=None, **kwargs): '\n Calculate an online exponentially weighted mean.\n\n Parameters\n ----------\n update: DataFrame or Series, default None\n New values to continue calculating the\n exponentially weighted mean from ...
581,572,148,694,043,100
Calculate an online exponentially weighted mean. Parameters ---------- update: DataFrame or Series, default None New values to continue calculating the exponentially weighted mean from the last values and weights. Values should be float64 dtype. ``update`` needs to be ``None`` the first time the e...
pandas/core/window/ewm.py
mean
DrGFreeman/pandas
python
def mean(self, *args, update=None, update_times=None, **kwargs): '\n Calculate an online exponentially weighted mean.\n\n Parameters\n ----------\n update: DataFrame or Series, default None\n New values to continue calculating the\n exponentially weighted mean from ...
def forward(self, seed_points, seed_feats): 'forward.\n\n Args:\n seed_points (torch.Tensor): Coordinate of the seed\n points in shape (B, N, 3).\n seed_feats (torch.Tensor): Features of the seed points in shape\n (B, C, N).\n\n Returns:\n ...
6,924,099,449,724,303,000
forward. Args: seed_points (torch.Tensor): Coordinate of the seed points in shape (B, N, 3). seed_feats (torch.Tensor): Features of the seed points in shape (B, C, N). Returns: tuple[torch.Tensor]: - vote_points: Voted xyz based on the seed points with shape (B...
mmdet3d/models/model_utils/vote_module.py
forward
BOURSa/mmdetection3d
python
def forward(self, seed_points, seed_feats): 'forward.\n\n Args:\n seed_points (torch.Tensor): Coordinate of the seed\n points in shape (B, N, 3).\n seed_feats (torch.Tensor): Features of the seed points in shape\n (B, C, N).\n\n Returns:\n ...
def get_loss(self, seed_points, vote_points, seed_indices, vote_targets_mask, vote_targets): 'Calculate loss of voting module.\n\n Args:\n seed_points (torch.Tensor): Coordinate of the seed points.\n vote_points (torch.Tensor): Coordinate of the vote points.\n seed_indices (t...
1,211,448,506,085,380,000
Calculate loss of voting module. Args: seed_points (torch.Tensor): Coordinate of the seed points. vote_points (torch.Tensor): Coordinate of the vote points. seed_indices (torch.Tensor): Indices of seed points in raw points. vote_targets_mask (torch.Tensor): Mask of valid vote targets. vote_targets ...
mmdet3d/models/model_utils/vote_module.py
get_loss
BOURSa/mmdetection3d
python
def get_loss(self, seed_points, vote_points, seed_indices, vote_targets_mask, vote_targets): 'Calculate loss of voting module.\n\n Args:\n seed_points (torch.Tensor): Coordinate of the seed points.\n vote_points (torch.Tensor): Coordinate of the vote points.\n seed_indices (t...
def __get_mortality_pp_increase(self, temperature: float, fish_mass: float) -> float: 'Get the mortality percentage point difference increase.\n\n :param temperature: the temperature in Celsius\n :param fish_mass: the fish mass (in grams)\n :returns: Mortality percentage point difference increa...
-3,144,523,383,826,243,000
Get the mortality percentage point difference increase. :param temperature: the temperature in Celsius :param fish_mass: the fish mass (in grams) :returns: Mortality percentage point difference increase
slim/types/TreatmentTypes.py
__get_mortality_pp_increase
magicicada/slim
python
def __get_mortality_pp_increase(self, temperature: float, fish_mass: float) -> float: 'Get the mortality percentage point difference increase.\n\n :param temperature: the temperature in Celsius\n :param fish_mass: the fish mass (in grams)\n :returns: Mortality percentage point difference increa...
@abstractmethod def delay(self, average_temperature: float): '\n Delay before treatment should have a noticeable effect\n '
-2,254,910,768,644,339,700
Delay before treatment should have a noticeable effect
slim/types/TreatmentTypes.py
delay
magicicada/slim
python
@abstractmethod def delay(self, average_temperature: float): '\n \n '
@staticmethod def get_allele_heterozygous_trait(alleles: Alleles): '\n Get the allele heterozygous type\n ' if ('A' in alleles): if ('a' in alleles): trait = HeterozygousResistance.INCOMPLETELY_DOMINANT else: trait = HeterozygousResistance.DOMINANT else:...
-8,403,997,583,842,534,000
Get the allele heterozygous type
slim/types/TreatmentTypes.py
get_allele_heterozygous_trait
magicicada/slim
python
@staticmethod def get_allele_heterozygous_trait(alleles: Alleles): '\n \n ' if ('A' in alleles): if ('a' in alleles): trait = HeterozygousResistance.INCOMPLETELY_DOMINANT else: trait = HeterozygousResistance.DOMINANT else: trait = HeterozygousRes...
@abstractmethod def get_lice_treatment_mortality_rate(self, lice_population: LicePopulation, temperature: float) -> GenoTreatmentDistrib: '\n Calculate the mortality rates of this treatment\n '
-7,484,706,959,667,294,000
Calculate the mortality rates of this treatment
slim/types/TreatmentTypes.py
get_lice_treatment_mortality_rate
magicicada/slim
python
@abstractmethod def get_lice_treatment_mortality_rate(self, lice_population: LicePopulation, temperature: float) -> GenoTreatmentDistrib: '\n \n '
def get_fish_mortality_occurrences(self, temperature: float, fish_mass: float, num_fish: float, efficacy_window: float, mortality_events: int): 'Get the number of fish that die due to treatment\n\n :param temperature: the temperature of the cage\n :param num_fish: the number of fish\n :param fi...
220,058,123,522,875,100
Get the number of fish that die due to treatment :param temperature: the temperature of the cage :param num_fish: the number of fish :param fish_mass: the average fish mass (in grams) :param efficacy_window: the length of the efficacy window :param mortality_events: the number of fish mortality events to subtract from
slim/types/TreatmentTypes.py
get_fish_mortality_occurrences
magicicada/slim
python
def get_fish_mortality_occurrences(self, temperature: float, fish_mass: float, num_fish: float, efficacy_window: float, mortality_events: int): 'Get the number of fish that die due to treatment\n\n :param temperature: the temperature of the cage\n :param num_fish: the number of fish\n :param fi...
def savedJSONInvariants(testCase: TestCase, savedJSON: str) -> str: '\n Assert a few things about the result of L{eventAsJSON}, then return it.\n\n @param testCase: The L{TestCase} with which to perform the assertions.\n @param savedJSON: The result of L{eventAsJSON}.\n\n @return: C{savedJSON}\n\n @r...
-6,524,027,284,910,949,000
Assert a few things about the result of L{eventAsJSON}, then return it. @param testCase: The L{TestCase} with which to perform the assertions. @param savedJSON: The result of L{eventAsJSON}. @return: C{savedJSON} @raise AssertionError: If any of the preconditions fail.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
savedJSONInvariants
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def savedJSONInvariants(testCase: TestCase, savedJSON: str) -> str: '\n Assert a few things about the result of L{eventAsJSON}, then return it.\n\n @param testCase: The L{TestCase} with which to perform the assertions.\n @param savedJSON: The result of L{eventAsJSON}.\n\n @return: C{savedJSON}\n\n @r...
def savedEventJSON(self, event: LogEvent) -> str: '\n Serialize some an events, assert some things about it, and return the\n JSON.\n\n @param event: An event.\n\n @return: JSON.\n ' return savedJSONInvariants(self, eventAsJSON(event))
3,940,816,593,613,317,600
Serialize some an events, assert some things about it, and return the JSON. @param event: An event. @return: JSON.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
savedEventJSON
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def savedEventJSON(self, event: LogEvent) -> str: '\n Serialize some an events, assert some things about it, and return the\n JSON.\n\n @param event: An event.\n\n @return: JSON.\n ' return savedJSONInvariants(self, eventAsJSON(event))
def test_simpleSaveLoad(self) -> None: '\n Saving and loading an empty dictionary results in an empty dictionary.\n ' self.assertEqual(eventFromJSON(self.savedEventJSON({})), {})
158,441,858,065,887,970
Saving and loading an empty dictionary results in an empty dictionary.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_simpleSaveLoad
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_simpleSaveLoad(self) -> None: '\n \n ' self.assertEqual(eventFromJSON(self.savedEventJSON({})), {})
def test_saveLoad(self) -> None: "\n Saving and loading a dictionary with some simple values in it results\n in those same simple values in the output; according to JSON's rules,\n though, all dictionary keys must be L{str} and any non-L{str}\n keys will be converted.\n " self...
-5,613,583,833,805,194,000
Saving and loading a dictionary with some simple values in it results in those same simple values in the output; according to JSON's rules, though, all dictionary keys must be L{str} and any non-L{str} keys will be converted.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveLoad
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveLoad(self) -> None: "\n Saving and loading a dictionary with some simple values in it results\n in those same simple values in the output; according to JSON's rules,\n though, all dictionary keys must be L{str} and any non-L{str}\n keys will be converted.\n " self...
def test_saveUnPersistable(self) -> None: '\n Saving and loading an object which cannot be represented in JSON will\n result in a placeholder.\n ' self.assertEqual(eventFromJSON(self.savedEventJSON({'1': 2, '3': object()})), {'1': 2, '3': {'unpersistable': True}})
1,832,279,315,044,509,000
Saving and loading an object which cannot be represented in JSON will result in a placeholder.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveUnPersistable
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveUnPersistable(self) -> None: '\n Saving and loading an object which cannot be represented in JSON will\n result in a placeholder.\n ' self.assertEqual(eventFromJSON(self.savedEventJSON({'1': 2, '3': object()})), {'1': 2, '3': {'unpersistable': True}})
def test_saveNonASCII(self) -> None: '\n Non-ASCII keys and values can be saved and loaded.\n ' self.assertEqual(eventFromJSON(self.savedEventJSON({'ሴ': '䌡', '3': object()})), {'ሴ': '䌡', '3': {'unpersistable': True}})
2,038,994,471,241,656,300
Non-ASCII keys and values can be saved and loaded.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveNonASCII
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveNonASCII(self) -> None: '\n \n ' self.assertEqual(eventFromJSON(self.savedEventJSON({'ሴ': '䌡', '3': object()})), {'ሴ': '䌡', '3': {'unpersistable': True}})
def test_saveBytes(self) -> None: '\n Any L{bytes} objects will be saved as if they are latin-1 so they can\n be faithfully re-loaded.\n ' inputEvent = {'hello': bytes(range(255))} inputEvent.update({b'skipped': 'okay'}) self.assertEqual(eventFromJSON(self.savedEventJSON(inputEvent)...
536,017,709,974,603,460
Any L{bytes} objects will be saved as if they are latin-1 so they can be faithfully re-loaded.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveBytes
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveBytes(self) -> None: '\n Any L{bytes} objects will be saved as if they are latin-1 so they can\n be faithfully re-loaded.\n ' inputEvent = {'hello': bytes(range(255))} inputEvent.update({b'skipped': 'okay'}) self.assertEqual(eventFromJSON(self.savedEventJSON(inputEvent)...
def test_saveUnPersistableThenFormat(self) -> None: '\n Saving and loading an object which cannot be represented in JSON, but\n has a string representation which I{can} be saved as JSON, will result\n in the same string formatting; any extractable fields will retain their\n data types.\n...
-7,824,544,873,663,906,000
Saving and loading an object which cannot be represented in JSON, but has a string representation which I{can} be saved as JSON, will result in the same string formatting; any extractable fields will retain their data types.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveUnPersistableThenFormat
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveUnPersistableThenFormat(self) -> None: '\n Saving and loading an object which cannot be represented in JSON, but\n has a string representation which I{can} be saved as JSON, will result\n in the same string formatting; any extractable fields will retain their\n data types.\n...
def test_extractingFieldsPostLoad(self) -> None: "\n L{extractField} can extract fields from an object that's been saved and\n loaded from JSON.\n " class Obj(): def __init__(self) -> None: self.value = 345 inputEvent = dict(log_format='{object.value}', object=Obj(...
-2,728,139,371,617,195,000
L{extractField} can extract fields from an object that's been saved and loaded from JSON.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_extractingFieldsPostLoad
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_extractingFieldsPostLoad(self) -> None: "\n L{extractField} can extract fields from an object that's been saved and\n loaded from JSON.\n " class Obj(): def __init__(self) -> None: self.value = 345 inputEvent = dict(log_format='{object.value}', object=Obj(...
def test_failureStructurePreserved(self) -> None: '\n Round-tripping a failure through L{eventAsJSON} preserves its class and\n structure.\n ' events: List[LogEvent] = [] log = Logger(observer=cast(ILogObserver, events.append)) try: (1 / 0) except ZeroDivisionError: ...
5,266,929,867,749,554,000
Round-tripping a failure through L{eventAsJSON} preserves its class and structure.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_failureStructurePreserved
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_failureStructurePreserved(self) -> None: '\n Round-tripping a failure through L{eventAsJSON} preserves its class and\n structure.\n ' events: List[LogEvent] = [] log = Logger(observer=cast(ILogObserver, events.append)) try: (1 / 0) except ZeroDivisionError: ...
def test_saveLoadLevel(self) -> None: "\n It's important that the C{log_level} key remain a\n L{constantly.NamedConstant} object.\n " inputEvent = dict(log_level=LogLevel.warn) loadedEvent = eventFromJSON(self.savedEventJSON(inputEvent)) self.assertIs(loadedEvent['log_level'], LogLe...
2,264,376,178,710,008,000
It's important that the C{log_level} key remain a L{constantly.NamedConstant} object.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveLoadLevel
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveLoadLevel(self) -> None: "\n It's important that the C{log_level} key remain a\n L{constantly.NamedConstant} object.\n " inputEvent = dict(log_level=LogLevel.warn) loadedEvent = eventFromJSON(self.savedEventJSON(inputEvent)) self.assertIs(loadedEvent['log_level'], LogLe...
def test_saveLoadUnknownLevel(self) -> None: "\n If a saved bit of JSON (let's say, from a future version of Twisted)\n were to persist a different log_level, it will resolve as None.\n " loadedEvent = eventFromJSON('{"log_level": {"name": "other", "__class_uuid__": "02E59486-F24D-46AD-8224...
-8,522,714,585,909,203,000
If a saved bit of JSON (let's say, from a future version of Twisted) were to persist a different log_level, it will resolve as None.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_saveLoadUnknownLevel
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_saveLoadUnknownLevel(self) -> None: "\n If a saved bit of JSON (let's say, from a future version of Twisted)\n were to persist a different log_level, it will resolve as None.\n " loadedEvent = eventFromJSON('{"log_level": {"name": "other", "__class_uuid__": "02E59486-F24D-46AD-8224...
def test_interface(self) -> None: '\n A L{FileLogObserver} returned by L{jsonFileLogObserver} is an\n L{ILogObserver}.\n ' with StringIO() as fileHandle: observer = jsonFileLogObserver(fileHandle) try: verifyObject(ILogObserver, observer) except BrokenMet...
3,291,993,695,110,113,000
A L{FileLogObserver} returned by L{jsonFileLogObserver} is an L{ILogObserver}.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_interface
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_interface(self) -> None: '\n A L{FileLogObserver} returned by L{jsonFileLogObserver} is an\n L{ILogObserver}.\n ' with StringIO() as fileHandle: observer = jsonFileLogObserver(fileHandle) try: verifyObject(ILogObserver, observer) except BrokenMet...
def assertObserverWritesJSON(self, recordSeparator: str='\x1e') -> None: '\n Asserts that an observer created by L{jsonFileLogObserver} with the\n given arguments writes events serialized as JSON text, using the given\n record separator.\n\n @param recordSeparator: C{recordSeparator} arg...
-8,549,672,763,853,330,000
Asserts that an observer created by L{jsonFileLogObserver} with the given arguments writes events serialized as JSON text, using the given record separator. @param recordSeparator: C{recordSeparator} argument to L{jsonFileLogObserver}
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
assertObserverWritesJSON
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def assertObserverWritesJSON(self, recordSeparator: str='\x1e') -> None: '\n Asserts that an observer created by L{jsonFileLogObserver} with the\n given arguments writes events serialized as JSON text, using the given\n record separator.\n\n @param recordSeparator: C{recordSeparator} arg...
def test_observeWritesDefaultRecordSeparator(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes events\n serialzed as JSON text to a file when it observes events.\n By default, the record separator is C{"\\x1e"}.\n ' self.assertObserverWritesJSON()
747,158,194,430,973,300
A L{FileLogObserver} created by L{jsonFileLogObserver} writes events serialzed as JSON text to a file when it observes events. By default, the record separator is C{"\x1e"}.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_observeWritesDefaultRecordSeparator
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_observeWritesDefaultRecordSeparator(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes events\n serialzed as JSON text to a file when it observes events.\n By default, the record separator is C{"\\x1e"}.\n ' self.assertObserverWritesJSON()
def test_observeWritesEmptyRecordSeparator(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes events\n serialzed as JSON text to a file when it observes events.\n This test sets the record separator to C{""}.\n ' self.assertObserverWritesJSON(recordSepar...
5,725,957,345,564,703,000
A L{FileLogObserver} created by L{jsonFileLogObserver} writes events serialzed as JSON text to a file when it observes events. This test sets the record separator to C{""}.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_observeWritesEmptyRecordSeparator
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_observeWritesEmptyRecordSeparator(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes events\n serialzed as JSON text to a file when it observes events.\n This test sets the record separator to C{}.\n ' self.assertObserverWritesJSON(recordSeparat...
def test_failureFormatting(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes failures\n serialized as JSON text to a file when it observes events.\n ' io = StringIO() publisher = LogPublisher() logged: List[LogEvent] = [] publisher.addObserver(cast...
-7,563,002,394,003,736,000
A L{FileLogObserver} created by L{jsonFileLogObserver} writes failures serialized as JSON text to a file when it observes events.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_failureFormatting
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_failureFormatting(self) -> None: '\n A L{FileLogObserver} created by L{jsonFileLogObserver} writes failures\n serialized as JSON text to a file when it observes events.\n ' io = StringIO() publisher = LogPublisher() logged: List[LogEvent] = [] publisher.addObserver(cast...
def _readEvents(self, inFile: IO[Any], recordSeparator: Optional[str]=None, bufferSize: int=4096) -> None: '\n Test that L{eventsFromJSONLogFile} reads two pre-defined events from a\n file: C{{"x": 1}} and C{{"y": 2}}.\n\n @param inFile: C{inFile} argument to L{eventsFromJSONLogFile}\n @...
-2,322,267,403,128,152,600
Test that L{eventsFromJSONLogFile} reads two pre-defined events from a file: C{{"x": 1}} and C{{"y": 2}}. @param inFile: C{inFile} argument to L{eventsFromJSONLogFile} @param recordSeparator: C{recordSeparator} argument to L{eventsFromJSONLogFile} @param bufferSize: C{bufferSize} argument to L{eventsFromJSONLogFil...
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
_readEvents
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def _readEvents(self, inFile: IO[Any], recordSeparator: Optional[str]=None, bufferSize: int=4096) -> None: '\n Test that L{eventsFromJSONLogFile} reads two pre-defined events from a\n file: C{{"x": 1}} and C{{"y": 2}}.\n\n @param inFile: C{inFile} argument to L{eventsFromJSONLogFile}\n @...
def test_readEventsAutoWithRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and automatically\n detects use of C{"\\x1e"} as the record separator.\n ' with StringIO('\x1e{"x": 1}\n\x1e{"y": 2}\n') as fileHandle: self._readEvents(fileHandle) ...
1,436,743,086,405,439,500
L{eventsFromJSONLogFile} reads events from a file and automatically detects use of C{"\x1e"} as the record separator.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_readEventsAutoWithRecordSeparator
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_readEventsAutoWithRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and automatically\n detects use of C{"\\x1e"} as the record separator.\n ' with StringIO('\x1e{"x": 1}\n\x1e{"y": 2}\n') as fileHandle: self._readEvents(fileHandle) ...
def test_readEventsAutoEmptyRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and automatically\n detects use of C{""} as the record separator.\n ' with StringIO('{"x": 1}\n{"y": 2}\n') as fileHandle: self._readEvents(fileHandle) self.asser...
-5,958,368,649,329,142,000
L{eventsFromJSONLogFile} reads events from a file and automatically detects use of C{""} as the record separator.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_readEventsAutoEmptyRecordSeparator
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_readEventsAutoEmptyRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and automatically\n detects use of C{} as the record separator.\n ' with StringIO('{"x": 1}\n{"y": 2}\n') as fileHandle: self._readEvents(fileHandle) self.assertE...
def test_readEventsExplicitRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and is told to use\n a specific record separator.\n ' with StringIO('\x08{"x": 1}\n\x08{"y": 2}\n') as fileHandle: self._readEvents(fileHandle, recordSeparator='\x08') ...
4,865,284,781,638,233,000
L{eventsFromJSONLogFile} reads events from a file and is told to use a specific record separator.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_readEventsExplicitRecordSeparator
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_readEventsExplicitRecordSeparator(self) -> None: '\n L{eventsFromJSONLogFile} reads events from a file and is told to use\n a specific record separator.\n ' with StringIO('\x08{"x": 1}\n\x08{"y": 2}\n') as fileHandle: self._readEvents(fileHandle, recordSeparator='\x08') ...
def test_readEventsPartialBuffer(self) -> None: '\n L{eventsFromJSONLogFile} handles buffering a partial event.\n ' with StringIO('\x1e{"x": 1}\n\x1e{"y": 2}\n') as fileHandle: self._readEvents(fileHandle, bufferSize=1) self.assertEqual(len(self.errorEvents), 0)
19,513,616,301,660,430
L{eventsFromJSONLogFile} handles buffering a partial event.
SCRAPE/Lib/site-packages/twisted/logger/test/test_json.py
test_readEventsPartialBuffer
Chinmoy-Prasad-Dutta/scrapy_scraper
python
def test_readEventsPartialBuffer(self) -> None: '\n \n ' with StringIO('\x1e{"x": 1}\n\x1e{"y": 2}\n') as fileHandle: self._readEvents(fileHandle, bufferSize=1) self.assertEqual(len(self.errorEvents), 0)