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 |
|---|---|---|---|---|---|---|---|
@pytest.fixture
def replacer(self, how, from_key, to_key):
'\n Object we will pass to `Series.replace`\n '
if (how == 'dict'):
replacer = dict(zip(self.rep[from_key], self.rep[to_key]))
elif (how == 'series'):
replacer = pd.Series(self.rep[to_key], index=self.rep[from_key])
... | -4,725,402,741,145,762,000 | Object we will pass to `Series.replace` | pandas/tests/indexing/test_coercion.py | replacer | 701KHK1915/8-PANDAS | python | @pytest.fixture
def replacer(self, how, from_key, to_key):
'\n \n '
if (how == 'dict'):
replacer = dict(zip(self.rep[from_key], self.rep[to_key]))
elif (how == 'series'):
replacer = pd.Series(self.rep[to_key], index=self.rep[from_key])
else:
raise ValueError
ret... |
@root_validator(pre=True, allow_reuse=True)
def validate_required_primitive_elements_594(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/extensibility.html#Special-Case\n In some cases, implementers might find that they do not have appropriate data fo... | -6,753,809,868,066,772,000 | https://www.hl7.org/fhir/extensibility.html#Special-Case
In some cases, implementers might find that they do not have appropriate data for
an element with minimum cardinality = 1. In this case, the element must be present,
but unless the resource or a profile on it has made the actual value of the primitive
data type m... | fhir/resources/task.py | validate_required_primitive_elements_594 | chgl/fhir.resources | python | @root_validator(pre=True, allow_reuse=True)
def validate_required_primitive_elements_594(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/extensibility.html#Special-Case\n In some cases, implementers might find that they do not have appropriate data fo... |
@root_validator(pre=True, allow_reuse=True)
def validate_one_of_many_1131(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/formats.html#choice\n A few elements have a choice of more than one data type for their content.\n All such elements have ... | 1,223,021,297,998,806,000 | https://www.hl7.org/fhir/formats.html#choice
A few elements have a choice of more than one data type for their content.
All such elements have a name that takes the form nnn[x].
The "nnn" part of the name is constant, and the "[x]" is replaced with
the title-cased name of the type that is actually used.
The table view ... | fhir/resources/task.py | validate_one_of_many_1131 | chgl/fhir.resources | python | @root_validator(pre=True, allow_reuse=True)
def validate_one_of_many_1131(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/formats.html#choice\n A few elements have a choice of more than one data type for their content.\n All such elements have ... |
@root_validator(pre=True, allow_reuse=True)
def validate_one_of_many_1260(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/formats.html#choice\n A few elements have a choice of more than one data type for their content.\n All such elements have ... | 5,434,378,056,132,148,000 | https://www.hl7.org/fhir/formats.html#choice
A few elements have a choice of more than one data type for their content.
All such elements have a name that takes the form nnn[x].
The "nnn" part of the name is constant, and the "[x]" is replaced with
the title-cased name of the type that is actually used.
The table view ... | fhir/resources/task.py | validate_one_of_many_1260 | chgl/fhir.resources | python | @root_validator(pre=True, allow_reuse=True)
def validate_one_of_many_1260(cls, values: typing.Dict[(str, typing.Any)]) -> typing.Dict[(str, typing.Any)]:
'https://www.hl7.org/fhir/formats.html#choice\n A few elements have a choice of more than one data type for their content.\n All such elements have ... |
def safe_name(name):
'Make name safe for use in XML output.'
return XML_SAFE_TAGS.get(name, name) | -5,112,435,986,885,607,000 | Make name safe for use in XML output. | chemdataextractor_batteries/chemdataextractor/parse/elements.py | safe_name | ShuHuang/batterydatabase | python | def safe_name(name):
return XML_SAFE_TAGS.get(name, name) |
def with_condition(self, condition):
'\n Add a condition to the parser element. The condition must be a function that takes\n a match and return True or False, i.e. a function which takes tuple(list(Element), int)\n and returns bool. If the function evaluates True, the match is kept, while if t... | 7,868,131,931,379,119,000 | Add a condition to the parser element. The condition must be a function that takes
a match and return True or False, i.e. a function which takes tuple(list(Element), int)
and returns bool. If the function evaluates True, the match is kept, while if the function
evaluates False, the match is discarded. The condition is ... | chemdataextractor_batteries/chemdataextractor/parse/elements.py | with_condition | ShuHuang/batterydatabase | python | def with_condition(self, condition):
'\n Add a condition to the parser element. The condition must be a function that takes\n a match and return True or False, i.e. a function which takes tuple(list(Element), int)\n and returns bool. If the function evaluates True, the match is kept, while if t... |
def scan(self, tokens, max_matches=six.MAXSIZE, overlap=False):
'\n Scans for matches in given tokens.\n\n :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of spe... | 4,403,405,174,798,983,700 | Scans for matches in given tokens.
:param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.
:param int max_matches: The maximum number of matches to look for. Default is th... | chemdataextractor_batteries/chemdataextractor/parse/elements.py | scan | ShuHuang/batterydatabase | python | def scan(self, tokens, max_matches=six.MAXSIZE, overlap=False):
'\n Scans for matches in given tokens.\n\n :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of spe... |
def parse(self, tokens, i, actions=True):
'\n Parse given tokens and return results\n\n :param tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.\n :type tokens: list(tuple(stri... | -8,761,858,440,767,062,000 | Parse given tokens and return results
:param tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.
:type tokens: list(tuple(string, string))
:param int i: The index at which to start scanning from
:param ... | chemdataextractor_batteries/chemdataextractor/parse/elements.py | parse | ShuHuang/batterydatabase | python | def parse(self, tokens, i, actions=True):
'\n Parse given tokens and return results\n\n :param tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.\n :type tokens: list(tuple(stri... |
def _parse_tokens(self, tokens, i, actions=True):
'\n Implemented by subclasses, parses given tokens and returns the results\n\n :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second str... | -5,887,532,987,363,269,000 | Implemented by subclasses, parses given tokens and returns the results
:param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second string is the part of speech tag.
:param int i: The index at which to start sc... | chemdataextractor_batteries/chemdataextractor/parse/elements.py | _parse_tokens | ShuHuang/batterydatabase | python | def _parse_tokens(self, tokens, i, actions=True):
'\n Implemented by subclasses, parses given tokens and returns the results\n\n :param list(tuple(string, string)) tokens: A tokenized representation of the text to scan. The first string in the tuple is the content, typically a word, and the second str... |
def streamline(self):
'\n Streamlines internal representations. e.g., if we have something like And(And(And(And(a), b), c), d), streamline this to And(a, b, c, d)\n '
self.streamlined = True
return self | 7,808,405,897,570,630,000 | Streamlines internal representations. e.g., if we have something like And(And(And(And(a), b), c), d), streamline this to And(a, b, c, d) | chemdataextractor_batteries/chemdataextractor/parse/elements.py | streamline | ShuHuang/batterydatabase | python | def streamline(self):
'\n \n '
self.streamlined = True
return self |
def __call__(self, name):
'\n If a BaseParserElement is called, returns the BaseParserElement with its name set to the argument. The name is used to identify the results parsed by this element.\n\n :param str name: Name to give BaseParserElement\n :returns: A BaseParserElement with the given na... | -1,587,400,351,974,764,300 | If a BaseParserElement is called, returns the BaseParserElement with its name set to the argument. The name is used to identify the results parsed by this element.
:param str name: Name to give BaseParserElement
:returns: A BaseParserElement with the given name
:rtype: BaseParserElement | chemdataextractor_batteries/chemdataextractor/parse/elements.py | __call__ | ShuHuang/batterydatabase | python | def __call__(self, name):
'\n If a BaseParserElement is called, returns the BaseParserElement with its name set to the argument. The name is used to identify the results parsed by this element.\n\n :param str name: Name to give BaseParserElement\n :returns: A BaseParserElement with the given na... |
def trace_helper(x: List[List[List[int]]], y: List[List[List[float]]], labels: List[str]) -> Tuple[(List[go.Scatter], List[str])]:
'\n this function gets results prepared by a plot-related function and\n outputs a tuple including plotly object and its corresponding legend.\n '
all_traces = []
num_c... | -2,237,043,114,065,933,000 | this function gets results prepared by a plot-related function and
outputs a tuple including plotly object and its corresponding legend. | src/beanmachine/ppl/diagnostics/common_plots.py | trace_helper | facebookresearch/beanmachine | python | def trace_helper(x: List[List[List[int]]], y: List[List[List[float]]], labels: List[str]) -> Tuple[(List[go.Scatter], List[str])]:
'\n this function gets results prepared by a plot-related function and\n outputs a tuple including plotly object and its corresponding legend.\n '
all_traces = []
num_c... |
def plot_helper(query_samples: Tensor, func: Callable) -> Tuple[(List[go.Scatter], List[str])]:
'\n this function executes a plot-related function, passed as input parameter func, and\n outputs a tuple including plotly object and its corresponding legend.\n '
(num_chain, num_samples, single_sample_sz) ... | -1,935,371,377,583,544,300 | this function executes a plot-related function, passed as input parameter func, and
outputs a tuple including plotly object and its corresponding legend. | src/beanmachine/ppl/diagnostics/common_plots.py | plot_helper | facebookresearch/beanmachine | python | def plot_helper(query_samples: Tensor, func: Callable) -> Tuple[(List[go.Scatter], List[str])]:
'\n this function executes a plot-related function, passed as input parameter func, and\n outputs a tuple including plotly object and its corresponding legend.\n '
(num_chain, num_samples, single_sample_sz) ... |
def run(self):
' This defines the sequence of actions that are taken when the barrier concurrency state is executed\n\n :return:\n '
logger.debug('Starting execution of {0}{1}'.format(self, (' (backwards)' if self.backward_execution else '')))
self.setup_run()
child_errors = {}
final_o... | 4,579,615,161,753,706,000 | This defines the sequence of actions that are taken when the barrier concurrency state is executed
:return: | source/rafcon/core/states/barrier_concurrency_state.py | run | LJMP/RAFCON | python | def run(self):
' This defines the sequence of actions that are taken when the barrier concurrency state is executed\n\n :return:\n '
logger.debug('Starting execution of {0}{1}'.format(self, (' (backwards)' if self.backward_execution else )))
self.setup_run()
child_errors = {}
final_out... |
def run_decider_state(self, decider_state, child_errors, final_outcomes_dict):
' Runs the decider state of the barrier concurrency state. The decider state decides on which outcome the\n barrier concurrency is left.\n\n :param decider_state: the decider state of the barrier concurrency state\n ... | -2,190,052,636,126,749,700 | Runs the decider state of the barrier concurrency state. The decider state decides on which outcome the
barrier concurrency is left.
:param decider_state: the decider state of the barrier concurrency state
:param child_errors: error of the concurrent branches
:param final_outcomes_dict: dictionary of all outcomes of t... | source/rafcon/core/states/barrier_concurrency_state.py | run_decider_state | LJMP/RAFCON | python | def run_decider_state(self, decider_state, child_errors, final_outcomes_dict):
' Runs the decider state of the barrier concurrency state. The decider state decides on which outcome the\n barrier concurrency is left.\n\n :param decider_state: the decider state of the barrier concurrency state\n ... |
def _check_transition_validity(self, check_transition):
' Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.\n Start transitions are forbidden in the ConcurrencyState.\n\n :param check_transition: the transition to check for validity\n :return:\n ... | -2,787,156,011,743,365,000 | Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.
Start transitions are forbidden in the ConcurrencyState.
:param check_transition: the transition to check for validity
:return: | source/rafcon/core/states/barrier_concurrency_state.py | _check_transition_validity | LJMP/RAFCON | python | def _check_transition_validity(self, check_transition):
' Transition of BarrierConcurrencyStates must least fulfill the condition of a ContainerState.\n Start transitions are forbidden in the ConcurrencyState.\n\n :param check_transition: the transition to check for validity\n :return:\n ... |
@lock_state_machine
def add_state(self, state, storage_load=False):
'Overwrite the parent class add_state method\n\n Add automatic transition generation for the decider_state.\n\n :param state: The state to be added\n :return:\n '
state_id = super(BarrierConcurrencyState, self).add_... | 450,937,260,812,671,040 | Overwrite the parent class add_state method
Add automatic transition generation for the decider_state.
:param state: The state to be added
:return: | source/rafcon/core/states/barrier_concurrency_state.py | add_state | LJMP/RAFCON | python | @lock_state_machine
def add_state(self, state, storage_load=False):
'Overwrite the parent class add_state method\n\n Add automatic transition generation for the decider_state.\n\n :param state: The state to be added\n :return:\n '
state_id = super(BarrierConcurrencyState, self).add_... |
@ContainerState.states.setter
@lock_state_machine
@Observable.observed
def states(self, states):
' Overwrite the setter of the container state base class as special handling for the decider state is needed.\n\n :param states: the dictionary of new states\n :raises exceptions.TypeError: if the states p... | 412,972,436,944,697,600 | Overwrite the setter of the container state base class as special handling for the decider state is needed.
:param states: the dictionary of new states
:raises exceptions.TypeError: if the states parameter is not of type dict | source/rafcon/core/states/barrier_concurrency_state.py | states | LJMP/RAFCON | python | @ContainerState.states.setter
@lock_state_machine
@Observable.observed
def states(self, states):
' Overwrite the setter of the container state base class as special handling for the decider state is needed.\n\n :param states: the dictionary of new states\n :raises exceptions.TypeError: if the states p... |
def remove_state(self, state_id, recursive=True, force=False, destroy=True):
' Overwrite the parent class remove state method by checking if the user tries to delete the decider state\n\n :param state_id: the id of the state to remove\n :param recursive: a flag to indicate a recursive disassembling of... | 884,845,709,618,582,000 | Overwrite the parent class remove state method by checking if the user tries to delete the decider state
:param state_id: the id of the state to remove
:param recursive: a flag to indicate a recursive disassembling of all substates
:param force: a flag to indicate forcefully deletion of all states (important of the de... | source/rafcon/core/states/barrier_concurrency_state.py | remove_state | LJMP/RAFCON | python | def remove_state(self, state_id, recursive=True, force=False, destroy=True):
' Overwrite the parent class remove state method by checking if the user tries to delete the decider state\n\n :param state_id: the id of the state to remove\n :param recursive: a flag to indicate a recursive disassembling of... |
def get_outcome_for_state_name(self, name):
' Returns the final outcome of the child state specified by name.\n\n Note: This is utility function that is used by the programmer to make a decision based on the final outcome\n of its child states. A state is not uniquely specified by the name, but as the... | 5,817,289,023,625,837,000 | Returns the final outcome of the child state specified by name.
Note: This is utility function that is used by the programmer to make a decision based on the final outcome
of its child states. A state is not uniquely specified by the name, but as the programmer normally does not want
to use state-ids in his code this ... | source/rafcon/core/states/barrier_concurrency_state.py | get_outcome_for_state_name | LJMP/RAFCON | python | def get_outcome_for_state_name(self, name):
' Returns the final outcome of the child state specified by name.\n\n Note: This is utility function that is used by the programmer to make a decision based on the final outcome\n of its child states. A state is not uniquely specified by the name, but as the... |
def get_outcome_for_state_id(self, state_id):
' Returns the final outcome of the child state specified by the state_id.\n\n :param state_id: The id of the state to get the final outcome for.\n :return:\n '
return_value = None
for (s_id, name_outcome_tuple) in self.final_outcomes_dict.it... | 4,762,681,882,078,964,000 | Returns the final outcome of the child state specified by the state_id.
:param state_id: The id of the state to get the final outcome for.
:return: | source/rafcon/core/states/barrier_concurrency_state.py | get_outcome_for_state_id | LJMP/RAFCON | python | def get_outcome_for_state_id(self, state_id):
' Returns the final outcome of the child state specified by the state_id.\n\n :param state_id: The id of the state to get the final outcome for.\n :return:\n '
return_value = None
for (s_id, name_outcome_tuple) in self.final_outcomes_dict.it... |
def get_errors_for_state_name(self, name):
' Returns the error message of the child state specified by name.\n\n Note: This is utility function that is used by the programmer to make a decision based on the final outcome\n of its child states. A state is not uniquely specified by the name, but as the ... | -4,617,795,323,207,786,000 | Returns the error message of the child state specified by name.
Note: This is utility function that is used by the programmer to make a decision based on the final outcome
of its child states. A state is not uniquely specified by the name, but as the programmer normally does not want
to use state-ids in his code this ... | source/rafcon/core/states/barrier_concurrency_state.py | get_errors_for_state_name | LJMP/RAFCON | python | def get_errors_for_state_name(self, name):
' Returns the error message of the child state specified by name.\n\n Note: This is utility function that is used by the programmer to make a decision based on the final outcome\n of its child states. A state is not uniquely specified by the name, but as the ... |
def wait_for_complete(queue_name, job_list=None, job_name_prefix=None, poll_interval=10, idle_log_timeout=None, kill_on_log_timeout=False, stash_log_method=None, tag_instances=False, result_record=None):
"Return when all jobs in the given list finished.\n\n If not job list is given, return when all jobs in queue... | -1,837,903,769,100,694,800 | Return when all jobs in the given list finished.
If not job list is given, return when all jobs in queue finished.
Parameters
----------
queue_name : str
The name of the queue to wait for completion.
job_list : Optional[list(dict)]
A list of jobID-s in a dict, as returned by the submit function.
Example: ... | indra/tools/reading/submit_reading_pipeline.py | wait_for_complete | budakn/INDRA | python | def wait_for_complete(queue_name, job_list=None, job_name_prefix=None, poll_interval=10, idle_log_timeout=None, kill_on_log_timeout=False, stash_log_method=None, tag_instances=False, result_record=None):
"Return when all jobs in the given list finished.\n\n If not job list is given, return when all jobs in queue... |
def get_ecs_cluster_for_queue(queue_name, batch_client=None):
'Get the name of the ecs cluster using the batch client.'
if (batch_client is None):
batch_client = boto3.client('batch')
queue_resp = batch_client.describe_job_queues(jobQueues=[queue_name])
if (len(queue_resp['jobQueues']) == 1):
... | 3,727,563,321,851,856,400 | Get the name of the ecs cluster using the batch client. | indra/tools/reading/submit_reading_pipeline.py | get_ecs_cluster_for_queue | budakn/INDRA | python | def get_ecs_cluster_for_queue(queue_name, batch_client=None):
if (batch_client is None):
batch_client = boto3.client('batch')
queue_resp = batch_client.describe_job_queues(jobQueues=[queue_name])
if (len(queue_resp['jobQueues']) == 1):
queue = queue_resp['jobQueues'][0]
else:
... |
def tag_instances_on_cluster(cluster_name, project='cwc'):
'Adds project tag to untagged instances in a given cluster.\n\n Parameters\n ----------\n cluster_name : str\n The name of the AWS ECS cluster in which running instances\n should be tagged.\n project : str\n The name of the ... | 2,285,739,003,705,012,000 | Adds project tag to untagged instances in a given cluster.
Parameters
----------
cluster_name : str
The name of the AWS ECS cluster in which running instances
should be tagged.
project : str
The name of the project to tag instances with. | indra/tools/reading/submit_reading_pipeline.py | tag_instances_on_cluster | budakn/INDRA | python | def tag_instances_on_cluster(cluster_name, project='cwc'):
'Adds project tag to untagged instances in a given cluster.\n\n Parameters\n ----------\n cluster_name : str\n The name of the AWS ECS cluster in which running instances\n should be tagged.\n project : str\n The name of the ... |
def submit_reading(basename, pmid_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, project_name=None):
'Submit an old-style pmid-centered no-database s3 only reading job.\n\n This function is provided for the sake of backward compatibili... | -9,154,570,921,491,134,000 | Submit an old-style pmid-centered no-database s3 only reading job.
This function is provided for the sake of backward compatibility. It is
preferred that you use the object-oriented PmidSubmitter and the
submit_reading job going forward. | indra/tools/reading/submit_reading_pipeline.py | submit_reading | budakn/INDRA | python | def submit_reading(basename, pmid_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, project_name=None):
'Submit an old-style pmid-centered no-database s3 only reading job.\n\n This function is provided for the sake of backward compatibili... |
def submit_combine(basename, readers, job_ids=None, project_name=None):
'Submit a batch job to combine the outputs of a reading job.\n\n This function is provided for backwards compatibility. You should use the\n PmidSubmitter and submit_combine methods.\n '
sub = PmidSubmitter(basename, readers, proje... | 9,031,977,390,302,815,000 | Submit a batch job to combine the outputs of a reading job.
This function is provided for backwards compatibility. You should use the
PmidSubmitter and submit_combine methods. | indra/tools/reading/submit_reading_pipeline.py | submit_combine | budakn/INDRA | python | def submit_combine(basename, readers, job_ids=None, project_name=None):
'Submit a batch job to combine the outputs of a reading job.\n\n This function is provided for backwards compatibility. You should use the\n PmidSubmitter and submit_combine methods.\n '
sub = PmidSubmitter(basename, readers, proje... |
def submit_db_reading(basename, id_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, read_all_fulltext=False, project_name=None, max_reach_input_len=None, max_reach_space_ratio=None, no_stmts=False):
'Submit batch reading jobs that uses the ... | -3,004,520,482,277,667,300 | Submit batch reading jobs that uses the database for content and results.
This function is provided for backwards compatibility, use DbReadingSubmitter
and its submit_reading method instead. | indra/tools/reading/submit_reading_pipeline.py | submit_db_reading | budakn/INDRA | python | def submit_db_reading(basename, id_list_filename, readers, start_ix=None, end_ix=None, pmids_per_job=3000, num_tries=2, force_read=False, force_fulltext=False, read_all_fulltext=False, project_name=None, max_reach_input_len=None, max_reach_space_ratio=None, no_stmts=False):
'Submit batch reading jobs that uses the ... |
def check_logs(job_defs):
'Updates teh job_log_dict.'
stalled_jobs = set()
for job_def in job_defs:
try:
log_lines = get_job_log(job_def, write_file=False)
jid = job_def['jobId']
now = datetime.now()
if (jid not in job_log_dict.keys()):
... | 6,554,997,909,822,204,000 | Updates teh job_log_dict. | indra/tools/reading/submit_reading_pipeline.py | check_logs | budakn/INDRA | python | def check_logs(job_defs):
stalled_jobs = set()
for job_def in job_defs:
try:
log_lines = get_job_log(job_def, write_file=False)
jid = job_def['jobId']
now = datetime.now()
if (jid not in job_log_dict.keys()):
logger.info(('Adding job %... |
def set_options(self, **kwargs):
'Set the options of reading job.'
self.options = kwargs
return | -7,237,647,657,749,120,000 | Set the options of reading job. | indra/tools/reading/submit_reading_pipeline.py | set_options | budakn/INDRA | python | def set_options(self, **kwargs):
self.options = kwargs
return |
def watch_and_wait(self, poll_interval=10, idle_log_timeout=None, kill_on_timeout=False, stash_log_method=None, tag_instances=False, **kwargs):
'This provides shortcut access to the wait_for_complete_function.'
return wait_for_complete(self._job_queue, job_list=self.job_list, job_name_prefix=self.basename, poll... | 1,382,470,957,625,140,000 | This provides shortcut access to the wait_for_complete_function. | indra/tools/reading/submit_reading_pipeline.py | watch_and_wait | budakn/INDRA | python | def watch_and_wait(self, poll_interval=10, idle_log_timeout=None, kill_on_timeout=False, stash_log_method=None, tag_instances=False, **kwargs):
return wait_for_complete(self._job_queue, job_list=self.job_list, job_name_prefix=self.basename, poll_interval=poll_interval, idle_log_timeout=idle_log_timeout, kill_o... |
def set_options(self, force_read=False, force_fulltext=False):
'Set the options for this run.'
self.options['force_read'] = force_read
self.options['force_fulltext'] = force_fulltext
return | -2,327,768,471,245,930,500 | Set the options for this run. | indra/tools/reading/submit_reading_pipeline.py | set_options | budakn/INDRA | python | def set_options(self, force_read=False, force_fulltext=False):
self.options['force_read'] = force_read
self.options['force_fulltext'] = force_fulltext
return |
@staticmethod
def _parse_time(time_str):
'Create a timedelta or datetime object from default string reprs.'
try:
if ('-' in time_str):
time_fmt = '%Y-%m-%d %H:%M:%S'
if ('.' in time_str):
(pre_dec, post_dec) = time_str.split('.')
dt = datetime.strp... | 1,290,442,873,732,414,500 | Create a timedelta or datetime object from default string reprs. | indra/tools/reading/submit_reading_pipeline.py | _parse_time | budakn/INDRA | python | @staticmethod
def _parse_time(time_str):
try:
if ('-' in time_str):
time_fmt = '%Y-%m-%d %H:%M:%S'
if ('.' in time_str):
(pre_dec, post_dec) = time_str.split('.')
dt = datetime.strptime(pre_dec, time_fmt)
dt.replace(microsecond=int... |
def produce_report(self):
'Produce a report of the batch jobs.'
s3_prefix = ('reading_results/%s/logs/%s/' % (self.basename, self._job_queue))
logger.info(('Producing batch report for %s, from prefix %s.' % (self.basename, s3_prefix)))
s3 = boto3.client('s3')
file_tree = self._get_results_file_tree(... | -5,124,152,994,296,084,000 | Produce a report of the batch jobs. | indra/tools/reading/submit_reading_pipeline.py | produce_report | budakn/INDRA | python | def produce_report(self):
s3_prefix = ('reading_results/%s/logs/%s/' % (self.basename, self._job_queue))
logger.info(('Producing batch report for %s, from prefix %s.' % (self.basename, s3_prefix)))
s3 = boto3.client('s3')
file_tree = self._get_results_file_tree(s3, s3_prefix)
logger.info(('Foun... |
@api.multi
@api.depends('seats_max', 'registration_ids.state')
def _compute_seats(self):
' Determine reserved, available, reserved but unconfirmed and used seats. '
for ticket in self:
ticket.seats_availability = ('unlimited' if (ticket.seats_max == 0) else 'limited')
ticket.seats_unconfirmed = ... | -2,804,826,914,822,728,000 | Determine reserved, available, reserved but unconfirmed and used seats. | addons/event_sale/models/event.py | _compute_seats | jjiege/odoo | python | @api.multi
@api.depends('seats_max', 'registration_ids.state')
def _compute_seats(self):
' '
for ticket in self:
ticket.seats_availability = ('unlimited' if (ticket.seats_max == 0) else 'limited')
ticket.seats_unconfirmed = ticket.seats_reserved = ticket.seats_used = ticket.seats_available = 0
... |
def get_ticket_multiline_description_sale(self):
' Compute a multiline description of this ticket, in the context of sales.\n It will often be used as the default description of a sales order line referencing this ticket.\n\n 1. the first line is the ticket name\n 2. the second line is the ... | -3,671,193,765,973,056,000 | Compute a multiline description of this ticket, in the context of sales.
It will often be used as the default description of a sales order line referencing this ticket.
1. the first line is the ticket name
2. the second line is the event name (if it exists, which should be the case with a normal workflow) or the p... | addons/event_sale/models/event.py | get_ticket_multiline_description_sale | jjiege/odoo | python | def get_ticket_multiline_description_sale(self):
' Compute a multiline description of this ticket, in the context of sales.\n It will often be used as the default description of a sales order line referencing this ticket.\n\n 1. the first line is the ticket name\n 2. the second line is the ... |
@api.model
def _prepare_attendee_values(self, registration):
' Override to add sale related stuff '
line_id = registration.get('sale_order_line_id')
if line_id:
registration.setdefault('partner_id', line_id.order_id.partner_id)
att_data = super(EventRegistration, self)._prepare_attendee_values(r... | 8,489,737,217,404,569,000 | Override to add sale related stuff | addons/event_sale/models/event.py | _prepare_attendee_values | jjiege/odoo | python | @api.model
def _prepare_attendee_values(self, registration):
' '
line_id = registration.get('sale_order_line_id')
if line_id:
registration.setdefault('partner_id', line_id.order_id.partner_id)
att_data = super(EventRegistration, self)._prepare_attendee_values(registration)
if line_id:
... |
def __init__(self, **kwargs):
'CreateEntityResponse - a model defined in Swagger'
self.compute_parent_updates()
for k in kwargs:
if (k not in self.swagger_types):
raise ValueError(("CreateEntityResponse got unexpected argument '%s'" % k))
get_parent().__init__(self, **kwargs)
sel... | 6,175,245,595,622,558,000 | CreateEntityResponse - a model defined in Swagger | factern_client/com/factern/model/create_entity_response.py | __init__ | Factern/factern-client-python | python | def __init__(self, **kwargs):
self.compute_parent_updates()
for k in kwargs:
if (k not in self.swagger_types):
raise ValueError(("CreateEntityResponse got unexpected argument '%s'" % k))
get_parent().__init__(self, **kwargs)
self._description = None
self._name = None
if ... |
@property
def description(self):
'Gets the description of this CreateEntityResponse. # noqa: E501\n\n\n :return: The description of this CreateEntityResponse. # noqa: E501\n :rtype: str\n '
return self._description | -6,438,640,782,097,517,000 | Gets the description of this CreateEntityResponse. # noqa: E501
:return: The description of this CreateEntityResponse. # noqa: E501
:rtype: str | factern_client/com/factern/model/create_entity_response.py | description | Factern/factern-client-python | python | @property
def description(self):
'Gets the description of this CreateEntityResponse. # noqa: E501\n\n\n :return: The description of this CreateEntityResponse. # noqa: E501\n :rtype: str\n '
return self._description |
@description.setter
def description(self, description):
'Sets the description of this CreateEntityResponse.\n\n\n :param description: The description of this CreateEntityResponse. # noqa: E501\n :type: str\n '
self._description = description | -6,894,999,339,211,008,000 | Sets the description of this CreateEntityResponse.
:param description: The description of this CreateEntityResponse. # noqa: E501
:type: str | factern_client/com/factern/model/create_entity_response.py | description | Factern/factern-client-python | python | @description.setter
def description(self, description):
'Sets the description of this CreateEntityResponse.\n\n\n :param description: The description of this CreateEntityResponse. # noqa: E501\n :type: str\n '
self._description = description |
@property
def name(self):
'Gets the name of this CreateEntityResponse. # noqa: E501\n\n\n :return: The name of this CreateEntityResponse. # noqa: E501\n :rtype: str\n '
return self._name | -3,667,751,320,017,525,000 | Gets the name of this CreateEntityResponse. # noqa: E501
:return: The name of this CreateEntityResponse. # noqa: E501
:rtype: str | factern_client/com/factern/model/create_entity_response.py | name | Factern/factern-client-python | python | @property
def name(self):
'Gets the name of this CreateEntityResponse. # noqa: E501\n\n\n :return: The name of this CreateEntityResponse. # noqa: E501\n :rtype: str\n '
return self._name |
@name.setter
def name(self, name):
'Sets the name of this CreateEntityResponse.\n\n\n :param name: The name of this CreateEntityResponse. # noqa: E501\n :type: str\n '
self._name = name | 8,633,343,821,934,959,000 | Sets the name of this CreateEntityResponse.
:param name: The name of this CreateEntityResponse. # noqa: E501
:type: str | factern_client/com/factern/model/create_entity_response.py | name | Factern/factern-client-python | python | @name.setter
def name(self, name):
'Sets the name of this CreateEntityResponse.\n\n\n :param name: The name of this CreateEntityResponse. # noqa: E501\n :type: str\n '
self._name = name |
def to_dict(self):
'Returns the model properties as a dict'
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
e... | -2,772,352,302,133,010,000 | Returns the model properties as a dict | factern_client/com/factern/model/create_entity_response.py | to_dict | Factern/factern-client-python | python | def to_dict(self):
result = {}
for (attr, _) in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to_dict'):
... |
def to_str(self):
'Returns the string representation of the model'
return pprint.pformat(self.to_dict()) | 5,849,158,643,760,736,000 | Returns the string representation of the model | factern_client/com/factern/model/create_entity_response.py | to_str | Factern/factern-client-python | python | def to_str(self):
return pprint.pformat(self.to_dict()) |
def __repr__(self):
'For `print` and `pprint`'
return self.to_str() | -8,960,031,694,814,905,000 | For `print` and `pprint` | factern_client/com/factern/model/create_entity_response.py | __repr__ | Factern/factern-client-python | python | def __repr__(self):
return self.to_str() |
def __eq__(self, other):
'Returns true if both objects are equal'
if (not isinstance(other, CreateEntityResponse)):
return False
return (self.__dict__ == other.__dict__) | -8,022,951,761,105,448,000 | Returns true if both objects are equal | factern_client/com/factern/model/create_entity_response.py | __eq__ | Factern/factern-client-python | python | def __eq__(self, other):
if (not isinstance(other, CreateEntityResponse)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'Returns true if both objects are not equal'
return (not (self == other)) | 7,764,124,047,908,058,000 | Returns true if both objects are not equal | factern_client/com/factern/model/create_entity_response.py | __ne__ | Factern/factern-client-python | python | def __ne__(self, other):
return (not (self == other)) |
async def renew_expired_facts(self) -> None:
'\n Send out requests to renew expired facts\n '
LOGGER.info('Renewing expired parameters')
updated_before = (datetime.datetime.now().astimezone() - datetime.timedelta(0, (self._fact_expire - self._fact_renew)))
expired_params = (await data.Para... | 3,964,860,801,135,793,700 | Send out requests to renew expired facts | src/inmanta/server/services/paramservice.py | renew_expired_facts | inmanta/inmanta-core | python | async def renew_expired_facts(self) -> None:
'\n \n '
LOGGER.info('Renewing expired parameters')
updated_before = (datetime.datetime.now().astimezone() - datetime.timedelta(0, (self._fact_expire - self._fact_renew)))
expired_params = (await data.Parameter.get_updated_before(updated_before)... |
async def _update_param(self, env: data.Environment, name: str, value: str, source: str, resource_id: str, metadata: JsonType, recompile: bool=False) -> bool:
'\n Update or set a parameter.\n\n This method returns true if:\n - this update resolves an unknown\n - recompile is true and the... | 2,212,729,937,336,484,600 | Update or set a parameter.
This method returns true if:
- this update resolves an unknown
- recompile is true and the parameter updates an existing parameter to a new value | src/inmanta/server/services/paramservice.py | _update_param | inmanta/inmanta-core | python | async def _update_param(self, env: data.Environment, name: str, value: str, source: str, resource_id: str, metadata: JsonType, recompile: bool=False) -> bool:
'\n Update or set a parameter.\n\n This method returns true if:\n - this update resolves an unknown\n - recompile is true and the... |
def get_queryset(self):
"\n Annotate queryset with an alias field 'name'.\n\n We want to test whether this annotation has been run after\n calling `baker.make()`.\n "
return super(MovieManager, self).get_queryset().annotate(name=models.F('title')) | 1,360,840,873,464,003,300 | Annotate queryset with an alias field 'name'.
We want to test whether this annotation has been run after
calling `baker.make()`. | tests/generic/models.py | get_queryset | atimilson/model_bakery | python | def get_queryset(self):
"\n Annotate queryset with an alias field 'name'.\n\n We want to test whether this annotation has been run after\n calling `baker.make()`.\n "
return super(MovieManager, self).get_queryset().annotate(name=models.F('title')) |
def start(self) -> None:
'Starts the pushers off in a background process.'
if (not self._should_start_pushers):
logger.info('Not starting pushers because they are disabled in the config')
return
run_as_background_process('start_pushers', self._start_pushers) | -2,023,674,344,118,949,400 | Starts the pushers off in a background process. | synapse/push/pusherpool.py | start | 3ayazaya/synapse | python | def start(self) -> None:
if (not self._should_start_pushers):
logger.info('Not starting pushers because they are disabled in the config')
return
run_as_background_process('start_pushers', self._start_pushers) |
async def add_pusher(self, user_id: str, access_token: Optional[int], kind: str, app_id: str, app_display_name: str, device_display_name: str, pushkey: str, lang: Optional[str], data: JsonDict, profile_tag: str='') -> Optional[Pusher]:
'Creates a new pusher and adds it to the pool\n\n Returns:\n T... | -4,144,691,672,634,155,500 | Creates a new pusher and adds it to the pool
Returns:
The newly created pusher. | synapse/push/pusherpool.py | add_pusher | 3ayazaya/synapse | python | async def add_pusher(self, user_id: str, access_token: Optional[int], kind: str, app_id: str, app_display_name: str, device_display_name: str, pushkey: str, lang: Optional[str], data: JsonDict, profile_tag: str=) -> Optional[Pusher]:
'Creates a new pusher and adds it to the pool\n\n Returns:\n The... |
async def remove_pushers_by_access_token(self, user_id: str, access_tokens: Iterable[int]) -> None:
'Remove the pushers for a given user corresponding to a set of\n access_tokens.\n\n Args:\n user_id: user to remove pushers for\n access_tokens: access token *ids* to remove pusher... | 8,722,035,526,725,559,000 | Remove the pushers for a given user corresponding to a set of
access_tokens.
Args:
user_id: user to remove pushers for
access_tokens: access token *ids* to remove pushers for | synapse/push/pusherpool.py | remove_pushers_by_access_token | 3ayazaya/synapse | python | async def remove_pushers_by_access_token(self, user_id: str, access_tokens: Iterable[int]) -> None:
'Remove the pushers for a given user corresponding to a set of\n access_tokens.\n\n Args:\n user_id: user to remove pushers for\n access_tokens: access token *ids* to remove pusher... |
async def start_pusher_by_id(self, app_id: str, pushkey: str, user_id: str) -> Optional[Pusher]:
'Look up the details for the given pusher, and start it\n\n Returns:\n The pusher started, if any\n '
if (not self._should_start_pushers):
return None
if (not self._pusher_shard_... | 5,989,586,175,201,948,000 | Look up the details for the given pusher, and start it
Returns:
The pusher started, if any | synapse/push/pusherpool.py | start_pusher_by_id | 3ayazaya/synapse | python | async def start_pusher_by_id(self, app_id: str, pushkey: str, user_id: str) -> Optional[Pusher]:
'Look up the details for the given pusher, and start it\n\n Returns:\n The pusher started, if any\n '
if (not self._should_start_pushers):
return None
if (not self._pusher_shard_... |
async def _start_pushers(self) -> None:
'Start all the pushers'
pushers = (await self.store.get_all_pushers())
(await concurrently_execute(self._start_pusher, pushers, 10))
logger.info('Started pushers') | -6,608,109,463,484,806,000 | Start all the pushers | synapse/push/pusherpool.py | _start_pushers | 3ayazaya/synapse | python | async def _start_pushers(self) -> None:
pushers = (await self.store.get_all_pushers())
(await concurrently_execute(self._start_pusher, pushers, 10))
logger.info('Started pushers') |
async def _start_pusher(self, pusher_config: PusherConfig) -> Optional[Pusher]:
'Start the given pusher\n\n Args:\n pusher_config: The pusher configuration with the values pulled from the db table\n\n Returns:\n The newly created pusher or None.\n '
if (not self._pushe... | -4,503,619,665,891,171,300 | Start the given pusher
Args:
pusher_config: The pusher configuration with the values pulled from the db table
Returns:
The newly created pusher or None. | synapse/push/pusherpool.py | _start_pusher | 3ayazaya/synapse | python | async def _start_pusher(self, pusher_config: PusherConfig) -> Optional[Pusher]:
'Start the given pusher\n\n Args:\n pusher_config: The pusher configuration with the values pulled from the db table\n\n Returns:\n The newly created pusher or None.\n '
if (not self._pushe... |
def get(self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config):
"Get a SQL pool's blob auditing policy.\n\n Get a SQL pool's blob auditing policy.\n\n :param resource_group_name: The name of the resource group. The name\n is case insensiti... | -6,123,978,912,562,874,000 | Get a SQL pool's blob auditing policy.
Get a SQL pool's blob auditing policy.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param workspace_name: The name of the workspace
:type workspace_name: str
:param sql_pool_name: SQL pool name
:type s... | venv/lib/python3.8/site-packages/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py | get | amcclead7336/Enterprise_Data_Science_Final | python | def get(self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config):
"Get a SQL pool's blob auditing policy.\n\n Get a SQL pool's blob auditing policy.\n\n :param resource_group_name: The name of the resource group. The name\n is case insensiti... |
def create_or_update(self, resource_group_name, workspace_name, sql_pool_name, parameters, custom_headers=None, raw=False, **operation_config):
"Creates or updates a SQL pool's blob auditing policy.\n\n Creates or updates a SQL pool's blob auditing policy.\n\n :param resource_group_name: The name of t... | 4,094,808,656,080,038,400 | Creates or updates a SQL pool's blob auditing policy.
Creates or updates a SQL pool's blob auditing policy.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param workspace_name: The name of the workspace
:type workspace_name: str
:param sql_po... | venv/lib/python3.8/site-packages/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py | create_or_update | amcclead7336/Enterprise_Data_Science_Final | python | def create_or_update(self, resource_group_name, workspace_name, sql_pool_name, parameters, custom_headers=None, raw=False, **operation_config):
"Creates or updates a SQL pool's blob auditing policy.\n\n Creates or updates a SQL pool's blob auditing policy.\n\n :param resource_group_name: The name of t... |
def list_by_sql_pool(self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config):
'Lists auditing settings of a Sql pool.\n\n :param resource_group_name: The name of the resource group. The name\n is case insensitive.\n :type resource_group_nam... | 7,417,312,686,727,259,000 | Lists auditing settings of a Sql pool.
:param resource_group_name: The name of the resource group. The name
is case insensitive.
:type resource_group_name: str
:param workspace_name: The name of the workspace
:type workspace_name: str
:param sql_pool_name: SQL pool name
:type sql_pool_name: str
:param dict custom_hea... | venv/lib/python3.8/site-packages/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py | list_by_sql_pool | amcclead7336/Enterprise_Data_Science_Final | python | def list_by_sql_pool(self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config):
'Lists auditing settings of a Sql pool.\n\n :param resource_group_name: The name of the resource group. The name\n is case insensitive.\n :type resource_group_nam... |
def choice(a, size=None, replace=True, p=None, random_state=None):
"\n choice(a, size=None, replace=True, p=None)\n\n Generates a random sample from a given 1-D array\n\n .. versionadded:: 1.7.0\n\n Parameters\n -----------\n a : 1-D array-like or int\n If an ndarray, a random sample is gen... | 1,923,530,375,439,504,600 | choice(a, size=None, replace=True, p=None)
Generates a random sample from a given 1-D array
.. versionadded:: 1.7.0
Parameters
-----------
a : 1-D array-like or int
If an ndarray, a random sample is generated from its elements.
If an int, the random sample is generated as if a was np.arange(n)
size : int or... | venv/lib/python2.7/site-packages/sklearn/utils/random.py | choice | bopopescu/fbserver | python | def choice(a, size=None, replace=True, p=None, random_state=None):
"\n choice(a, size=None, replace=True, p=None)\n\n Generates a random sample from a given 1-D array\n\n .. versionadded:: 1.7.0\n\n Parameters\n -----------\n a : 1-D array-like or int\n If an ndarray, a random sample is gen... |
def test_equality(self):
' Tests the equality operator.\n '
self.assertNotEqual(self.v1, self.v2)
expected_result = Vector2D((- 1), 1)
self.assertEqual(self.v2, expected_result) | 5,486,552,652,260,747,000 | Tests the equality operator. | Chapter3_CodeTesting/UnitTesting/test_vector.py | test_equality | franneck94/UdemyPythonProEng | python | def test_equality(self):
' \n '
self.assertNotEqual(self.v1, self.v2)
expected_result = Vector2D((- 1), 1)
self.assertEqual(self.v2, expected_result) |
def test_add(self):
' Tests the addition operator.\n '
result = (self.v1 + self.v2)
expected_result = Vector2D((- 1), 1)
self.assertEqual(result, expected_result) | -8,180,965,754,012,174,000 | Tests the addition operator. | Chapter3_CodeTesting/UnitTesting/test_vector.py | test_add | franneck94/UdemyPythonProEng | python | def test_add(self):
' \n '
result = (self.v1 + self.v2)
expected_result = Vector2D((- 1), 1)
self.assertEqual(result, expected_result) |
def test_sub(self):
' Tests the subtraction operator.\n '
result = (self.v2 - self.v3)
expected_result = Vector2D((- 3.5), 3.5)
self.assertEqual(result, expected_result) | -3,483,669,794,062,639,600 | Tests the subtraction operator. | Chapter3_CodeTesting/UnitTesting/test_vector.py | test_sub | franneck94/UdemyPythonProEng | python | def test_sub(self):
' \n '
result = (self.v2 - self.v3)
expected_result = Vector2D((- 3.5), 3.5)
self.assertEqual(result, expected_result) |
def test_mul(self):
' Tests the multiplication operator.\n '
result1 = (self.v1 * 5)
expected_result1 = Vector2D(0.0, 0.0)
self.assertEqual(result1, expected_result1)
result2 = (self.v1 * self.v2)
expected_result2 = 0.0
self.assertEqual(result2, expected_result2) | -6,555,608,015,718,426,000 | Tests the multiplication operator. | Chapter3_CodeTesting/UnitTesting/test_vector.py | test_mul | franneck94/UdemyPythonProEng | python | def test_mul(self):
' \n '
result1 = (self.v1 * 5)
expected_result1 = Vector2D(0.0, 0.0)
self.assertEqual(result1, expected_result1)
result2 = (self.v1 * self.v2)
expected_result2 = 0.0
self.assertEqual(result2, expected_result2) |
def test_div(self):
' Tests the multiplication operator.\n '
result = (self.v3 / 5)
expected_result = Vector2D(0.5, (- 0.5))
self.assertEqual(result, expected_result) | 297,827,253,147,501,300 | Tests the multiplication operator. | Chapter3_CodeTesting/UnitTesting/test_vector.py | test_div | franneck94/UdemyPythonProEng | python | def test_div(self):
' \n '
result = (self.v3 / 5)
expected_result = Vector2D(0.5, (- 0.5))
self.assertEqual(result, expected_result) |
def __init__(self, api_version=None, kind=None, name=None, preferred_version=None, server_address_by_client_cid_rs=None, versions=None):
'\n V1APIGroup - a model defined in Swagger\n '
self._api_version = None
self._kind = None
self._name = None
self._preferred_version = None
self.... | -3,529,317,202,730,752,000 | V1APIGroup - a model defined in Swagger | kubernetes/client/models/v1_api_group.py | __init__ | Jamim/kubernetes-client-python | python | def __init__(self, api_version=None, kind=None, name=None, preferred_version=None, server_address_by_client_cid_rs=None, versions=None):
'\n \n '
self._api_version = None
self._kind = None
self._name = None
self._preferred_version = None
self._server_address_by_client_cid_rs = None... |
@property
def api_version(self):
'\n Gets the api_version of this V1APIGroup.\n APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/communi... | -677,712,337,667,077,900 | Gets the api_version of this V1APIGroup.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
:retu... | kubernetes/client/models/v1_api_group.py | api_version | Jamim/kubernetes-client-python | python | @property
def api_version(self):
'\n Gets the api_version of this V1APIGroup.\n APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/communi... |
@api_version.setter
def api_version(self, api_version):
'\n Sets the api_version of this V1APIGroup.\n APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: htt... | -7,464,931,077,191,557,000 | Sets the api_version of this V1APIGroup.
APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources
:para... | kubernetes/client/models/v1_api_group.py | api_version | Jamim/kubernetes-client-python | python | @api_version.setter
def api_version(self, api_version):
'\n Sets the api_version of this V1APIGroup.\n APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: htt... |
@property
def kind(self):
'\n Gets the kind of this V1APIGroup.\n Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors... | -5,332,471,152,682,945,000 | Gets the kind of this V1APIGroup.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
:return: Th... | kubernetes/client/models/v1_api_group.py | kind | Jamim/kubernetes-client-python | python | @property
def kind(self):
'\n Gets the kind of this V1APIGroup.\n Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors... |
@kind.setter
def kind(self, kind):
'\n Sets the kind of this V1APIGroup.\n Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/con... | 3,370,698,044,492,508,700 | Sets the kind of this V1APIGroup.
Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
:param kind... | kubernetes/client/models/v1_api_group.py | kind | Jamim/kubernetes-client-python | python | @kind.setter
def kind(self, kind):
'\n Sets the kind of this V1APIGroup.\n Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/con... |
@property
def name(self):
'\n Gets the name of this V1APIGroup.\n name is the name of the group.\n\n :return: The name of this V1APIGroup.\n :rtype: str\n '
return self._name | -7,469,766,574,270,034,000 | Gets the name of this V1APIGroup.
name is the name of the group.
:return: The name of this V1APIGroup.
:rtype: str | kubernetes/client/models/v1_api_group.py | name | Jamim/kubernetes-client-python | python | @property
def name(self):
'\n Gets the name of this V1APIGroup.\n name is the name of the group.\n\n :return: The name of this V1APIGroup.\n :rtype: str\n '
return self._name |
@name.setter
def name(self, name):
'\n Sets the name of this V1APIGroup.\n name is the name of the group.\n\n :param name: The name of this V1APIGroup.\n :type: str\n '
if (name is None):
raise ValueError('Invalid value for `name`, must not be `None`')
self._name =... | -5,055,398,109,243,604,000 | Sets the name of this V1APIGroup.
name is the name of the group.
:param name: The name of this V1APIGroup.
:type: str | kubernetes/client/models/v1_api_group.py | name | Jamim/kubernetes-client-python | python | @name.setter
def name(self, name):
'\n Sets the name of this V1APIGroup.\n name is the name of the group.\n\n :param name: The name of this V1APIGroup.\n :type: str\n '
if (name is None):
raise ValueError('Invalid value for `name`, must not be `None`')
self._name =... |
@property
def preferred_version(self):
'\n Gets the preferred_version of this V1APIGroup.\n preferredVersion is the version preferred by the API server, which probably is the storage version.\n\n :return: The preferred_version of this V1APIGroup.\n :rtype: V1GroupVersionForDiscovery\n ... | -1,632,329,830,477,617,700 | Gets the preferred_version of this V1APIGroup.
preferredVersion is the version preferred by the API server, which probably is the storage version.
:return: The preferred_version of this V1APIGroup.
:rtype: V1GroupVersionForDiscovery | kubernetes/client/models/v1_api_group.py | preferred_version | Jamim/kubernetes-client-python | python | @property
def preferred_version(self):
'\n Gets the preferred_version of this V1APIGroup.\n preferredVersion is the version preferred by the API server, which probably is the storage version.\n\n :return: The preferred_version of this V1APIGroup.\n :rtype: V1GroupVersionForDiscovery\n ... |
@preferred_version.setter
def preferred_version(self, preferred_version):
'\n Sets the preferred_version of this V1APIGroup.\n preferredVersion is the version preferred by the API server, which probably is the storage version.\n\n :param preferred_version: The preferred_version of this V1APIGro... | 1,623,455,171,021,236,000 | Sets the preferred_version of this V1APIGroup.
preferredVersion is the version preferred by the API server, which probably is the storage version.
:param preferred_version: The preferred_version of this V1APIGroup.
:type: V1GroupVersionForDiscovery | kubernetes/client/models/v1_api_group.py | preferred_version | Jamim/kubernetes-client-python | python | @preferred_version.setter
def preferred_version(self, preferred_version):
'\n Sets the preferred_version of this V1APIGroup.\n preferredVersion is the version preferred by the API server, which probably is the storage version.\n\n :param preferred_version: The preferred_version of this V1APIGro... |
@property
def server_address_by_client_cid_rs(self):
'\n Gets the server_address_by_client_cid_rs of this V1APIGroup.\n a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate s... | -4,830,230,150,165,324,000 | Gets the server_address_by_client_cid_rs of this V1APIGroup.
a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, c... | kubernetes/client/models/v1_api_group.py | server_address_by_client_cid_rs | Jamim/kubernetes-client-python | python | @property
def server_address_by_client_cid_rs(self):
'\n Gets the server_address_by_client_cid_rs of this V1APIGroup.\n a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate s... |
@server_address_by_client_cid_rs.setter
def server_address_by_client_cid_rs(self, server_address_by_client_cid_rs):
'\n Sets the server_address_by_client_cid_rs of this V1APIGroup.\n a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most ne... | -4,706,609,688,793,086,000 | Sets the server_address_by_client_cid_rs of this V1APIGroup.
a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, c... | kubernetes/client/models/v1_api_group.py | server_address_by_client_cid_rs | Jamim/kubernetes-client-python | python | @server_address_by_client_cid_rs.setter
def server_address_by_client_cid_rs(self, server_address_by_client_cid_rs):
'\n Sets the server_address_by_client_cid_rs of this V1APIGroup.\n a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most ne... |
@property
def versions(self):
'\n Gets the versions of this V1APIGroup.\n versions are the versions supported in this group.\n\n :return: The versions of this V1APIGroup.\n :rtype: list[V1GroupVersionForDiscovery]\n '
return self._versions | 5,117,786,574,111,289,000 | Gets the versions of this V1APIGroup.
versions are the versions supported in this group.
:return: The versions of this V1APIGroup.
:rtype: list[V1GroupVersionForDiscovery] | kubernetes/client/models/v1_api_group.py | versions | Jamim/kubernetes-client-python | python | @property
def versions(self):
'\n Gets the versions of this V1APIGroup.\n versions are the versions supported in this group.\n\n :return: The versions of this V1APIGroup.\n :rtype: list[V1GroupVersionForDiscovery]\n '
return self._versions |
@versions.setter
def versions(self, versions):
'\n Sets the versions of this V1APIGroup.\n versions are the versions supported in this group.\n\n :param versions: The versions of this V1APIGroup.\n :type: list[V1GroupVersionForDiscovery]\n '
if (versions is None):
rais... | 3,347,067,186,250,300,000 | Sets the versions of this V1APIGroup.
versions are the versions supported in this group.
:param versions: The versions of this V1APIGroup.
:type: list[V1GroupVersionForDiscovery] | kubernetes/client/models/v1_api_group.py | versions | Jamim/kubernetes-client-python | python | @versions.setter
def versions(self, versions):
'\n Sets the versions of this V1APIGroup.\n versions are the versions supported in this group.\n\n :param versions: The versions of this V1APIGroup.\n :type: list[V1GroupVersionForDiscovery]\n '
if (versions is None):
rais... |
def to_dict(self):
'\n Returns the model properties as a dict\n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), v... | 2,191,974,537,531,847,000 | Returns the model properties as a dict | kubernetes/client/models/v1_api_group.py | to_dict | Jamim/kubernetes-client-python | python | def to_dict(self):
'\n \n '
result = {}
for (attr, _) in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value))
elif hasattr(value, 'to... |
def to_str(self):
'\n Returns the string representation of the model\n '
return pformat(self.to_dict()) | -3,531,024,894,346,511,000 | Returns the string representation of the model | kubernetes/client/models/v1_api_group.py | to_str | Jamim/kubernetes-client-python | python | def to_str(self):
'\n \n '
return pformat(self.to_dict()) |
def __repr__(self):
'\n For `print` and `pprint`\n '
return self.to_str() | 5,853,962,500,611,353,000 | For `print` and `pprint` | kubernetes/client/models/v1_api_group.py | __repr__ | Jamim/kubernetes-client-python | python | def __repr__(self):
'\n \n '
return self.to_str() |
def __eq__(self, other):
'\n Returns true if both objects are equal\n '
if (not isinstance(other, V1APIGroup)):
return False
return (self.__dict__ == other.__dict__) | 2,386,882,772,361,960,400 | Returns true if both objects are equal | kubernetes/client/models/v1_api_group.py | __eq__ | Jamim/kubernetes-client-python | python | def __eq__(self, other):
'\n \n '
if (not isinstance(other, V1APIGroup)):
return False
return (self.__dict__ == other.__dict__) |
def __ne__(self, other):
'\n Returns true if both objects are not equal\n '
return (not (self == other)) | 3,600,423,175,817,510,400 | Returns true if both objects are not equal | kubernetes/client/models/v1_api_group.py | __ne__ | Jamim/kubernetes-client-python | python | def __ne__(self, other):
'\n \n '
return (not (self == other)) |
def __init__(self, seed: int, brain: BrainParameters, trainer_params: Dict[(str, Any)], is_training: bool, load: bool):
'\n Policy for Proximal Policy Optimization Networks.\n :param seed: Random seed.\n :param brain: Assigned Brain object.\n :param trainer_params: Defined training param... | 3,863,017,292,052,306,000 | Policy for Proximal Policy Optimization Networks.
:param seed: Random seed.
:param brain: Assigned Brain object.
:param trainer_params: Defined training parameters.
:param is_training: Whether the model should be trained.
:param load: Whether a pre-trained model will be loaded or a new one created. | ml-agents/mlagents/trainers/ppo/policy.py | __init__ | DdATM/ML-FlappyBird | python | def __init__(self, seed: int, brain: BrainParameters, trainer_params: Dict[(str, Any)], is_training: bool, load: bool):
'\n Policy for Proximal Policy Optimization Networks.\n :param seed: Random seed.\n :param brain: Assigned Brain object.\n :param trainer_params: Defined training param... |
def create_model(self, brain, trainer_params, reward_signal_configs, is_training, load, seed):
'\n Create PPO model\n :param brain: Assigned Brain object.\n :param trainer_params: Defined training parameters.\n :param reward_signal_configs: Reward signal config\n :param seed: Rand... | -7,139,445,690,236,091,000 | Create PPO model
:param brain: Assigned Brain object.
:param trainer_params: Defined training parameters.
:param reward_signal_configs: Reward signal config
:param seed: Random seed. | ml-agents/mlagents/trainers/ppo/policy.py | create_model | DdATM/ML-FlappyBird | python | def create_model(self, brain, trainer_params, reward_signal_configs, is_training, load, seed):
'\n Create PPO model\n :param brain: Assigned Brain object.\n :param trainer_params: Defined training parameters.\n :param reward_signal_configs: Reward signal config\n :param seed: Rand... |
def create_reward_signals(self, reward_signal_configs):
'\n Create reward signals\n :param reward_signal_configs: Reward signal config.\n '
self.reward_signals = {}
with self.graph.as_default():
for (reward_signal, config) in reward_signal_configs.items():
self.rewar... | -167,883,442,589,641,500 | Create reward signals
:param reward_signal_configs: Reward signal config. | ml-agents/mlagents/trainers/ppo/policy.py | create_reward_signals | DdATM/ML-FlappyBird | python | def create_reward_signals(self, reward_signal_configs):
'\n Create reward signals\n :param reward_signal_configs: Reward signal config.\n '
self.reward_signals = {}
with self.graph.as_default():
for (reward_signal, config) in reward_signal_configs.items():
self.rewar... |
@timed
def evaluate(self, brain_info):
'\n Evaluates policy for the agent experiences provided.\n :param brain_info: BrainInfo object containing inputs.\n :return: Outputs from network as defined by self.inference_dict.\n '
feed_dict = {self.model.batch_size: len(brain_info.vector_ob... | 3,825,865,838,681,638,000 | Evaluates policy for the agent experiences provided.
:param brain_info: BrainInfo object containing inputs.
:return: Outputs from network as defined by self.inference_dict. | ml-agents/mlagents/trainers/ppo/policy.py | evaluate | DdATM/ML-FlappyBird | python | @timed
def evaluate(self, brain_info):
'\n Evaluates policy for the agent experiences provided.\n :param brain_info: BrainInfo object containing inputs.\n :return: Outputs from network as defined by self.inference_dict.\n '
feed_dict = {self.model.batch_size: len(brain_info.vector_ob... |
@timed
def update(self, mini_batch, num_sequences):
'\n Performs update on model.\n :param mini_batch: Batch of experiences.\n :param num_sequences: Number of sequences to process.\n :return: Results of update.\n '
feed_dict = self.construct_feed_dict(self.model, mini_batch, n... | -1,626,452,048,094,340,600 | Performs update on model.
:param mini_batch: Batch of experiences.
:param num_sequences: Number of sequences to process.
:return: Results of update. | ml-agents/mlagents/trainers/ppo/policy.py | update | DdATM/ML-FlappyBird | python | @timed
def update(self, mini_batch, num_sequences):
'\n Performs update on model.\n :param mini_batch: Batch of experiences.\n :param num_sequences: Number of sequences to process.\n :return: Results of update.\n '
feed_dict = self.construct_feed_dict(self.model, mini_batch, n... |
def get_value_estimates(self, brain_info: BrainInfo, idx: int, done: bool) -> Dict[(str, float)]:
'\n Generates value estimates for bootstrapping.\n :param brain_info: BrainInfo to be used for bootstrapping.\n :param idx: Index in BrainInfo of agent.\n :param done: Whether or not this is... | -2,508,050,501,292,764,700 | Generates value estimates for bootstrapping.
:param brain_info: BrainInfo to be used for bootstrapping.
:param idx: Index in BrainInfo of agent.
:param done: Whether or not this is the last element of the episode, in which case the value estimate will be 0.
:return: The value estimate dictionary with key being the name... | ml-agents/mlagents/trainers/ppo/policy.py | get_value_estimates | DdATM/ML-FlappyBird | python | def get_value_estimates(self, brain_info: BrainInfo, idx: int, done: bool) -> Dict[(str, float)]:
'\n Generates value estimates for bootstrapping.\n :param brain_info: BrainInfo to be used for bootstrapping.\n :param idx: Index in BrainInfo of agent.\n :param done: Whether or not this is... |
def mpi_split_evaluator_run(target_evaluator, termination_params=None, core_params=None, exception_handling_params=None, log=None, gradient_only=False, line_search=True):
'The supported scenario is that each MPI worker rank has a target evaluator\n that has part of the data. Each rank calculates a bit of the func... | 2,306,094,089,549,778,000 | The supported scenario is that each MPI worker rank has a target evaluator
that has part of the data. Each rank calculates a bit of the functional and
gradients, but then mpi reduce is used to sum them all up. There has been
no low-level redesign to support MPI. In particular, the ext.minimizer is
run (wastefully) b... | modules/cctbx_project/scitbx/lbfgs/tst_mpi_split_evaluator.py | mpi_split_evaluator_run | jorgediazjr/dials-dev20191018 | python | def mpi_split_evaluator_run(target_evaluator, termination_params=None, core_params=None, exception_handling_params=None, log=None, gradient_only=False, line_search=True):
'The supported scenario is that each MPI worker rank has a target evaluator\n that has part of the data. Each rank calculates a bit of the func... |
def patient_shutdown(self):
'\n Stops the serve_forever loop.\n\n Blocks until the loop has finished. This must be called while\n serve_forever() is running in another thread, or it will\n deadlock.\n '
self._StoppableWSGIServer__serving = False
if (not self._StoppableWSGI... | -3,871,733,391,667,745,300 | Stops the serve_forever loop.
Blocks until the loop has finished. This must be called while
serve_forever() is running in another thread, or it will
deadlock. | autocomplete_light/tests/test_widget.py | patient_shutdown | kimetrica/django-autocomplete-light | python | def patient_shutdown(self):
'\n Stops the serve_forever loop.\n\n Blocks until the loop has finished. This must be called while\n serve_forever() is running in another thread, or it will\n deadlock.\n '
self._StoppableWSGIServer__serving = False
if (not self._StoppableWSGI... |
def testDecompressLimited(self):
'Decompressed data buffering should be limited'
bomb = bz2.compress((b'\x00' * int(2000000.0)), compresslevel=9)
self.assertLess(len(bomb), _compression.BUFFER_SIZE)
decomp = BZ2File(BytesIO(bomb))
self.assertEqual(decomp.read(1), b'\x00')
max_decomp = (1 + DEFAU... | -5,949,346,707,476,452,000 | Decompressed data buffering should be limited | www/src/Lib/test/test_bz2.py | testDecompressLimited | Froggo8311/brython | python | def testDecompressLimited(self):
bomb = bz2.compress((b'\x00' * int(2000000.0)), compresslevel=9)
self.assertLess(len(bomb), _compression.BUFFER_SIZE)
decomp = BZ2File(BytesIO(bomb))
self.assertEqual(decomp.read(1), b'\x00')
max_decomp = (1 + DEFAULT_BUFFER_SIZE)
self.assertLessEqual(decomp... |
def message(err_number):
'Return the error message associated with the error code. Positive\n error codes are interpreted as system error numbers, and\n negative error codes are interpreted as GEOPM error numbers.\n\n Args:\n err_number (int): Error code to be interpreted.\n\n Returns:\n ... | 534,698,338,327,494,500 | Return the error message associated with the error code. Positive
error codes are interpreted as system error numbers, and
negative error codes are interpreted as GEOPM error numbers.
Args:
err_number (int): Error code to be interpreted.
Returns:
str: Error message associated with error code. | scripts/geopmpy/error.py | message | RyoTTa/geopm | python | def message(err_number):
'Return the error message associated with the error code. Positive\n error codes are interpreted as system error numbers, and\n negative error codes are interpreted as GEOPM error numbers.\n\n Args:\n err_number (int): Error code to be interpreted.\n\n Returns:\n ... |
def get_samples_from_trace(trace, with_intermediates=False):
' Extracts all sample values from a numpyro trace.\n\n :param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`\n :param with_intermediates: If True, intermediate(/latent) samples from\n sample site distributions are in... | 2,113,946,218,417,119,200 | Extracts all sample values from a numpyro trace.
:param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`
:param with_intermediates: If True, intermediate(/latent) samples from
sample site distributions are included in the result.
:return: Dictionary of sampled values associated with the nam... | d3p/modelling.py | get_samples_from_trace | DPBayes/d3p | python | def get_samples_from_trace(trace, with_intermediates=False):
' Extracts all sample values from a numpyro trace.\n\n :param trace: trace object obtained from `numpyro.handlers.trace().get_trace()`\n :param with_intermediates: If True, intermediate(/latent) samples from\n sample site distributions are in... |
def sample_prior_predictive(rng_key, model, model_args, substitutes=None, with_intermediates=False, **kwargs):
' Samples once from the prior predictive distribution.\n\n Individual sample sites, as designated by `sample`, can be frozen to\n pre-determined values given in `substitutes`. In that case, values fo... | 4,661,393,722,677,076,000 | Samples once from the prior predictive distribution.
Individual sample sites, as designated by `sample`, can be frozen to
pre-determined values given in `substitutes`. In that case, values for these
sites are not actually sampled but the value provided in `substitutes` is
returned as the sample. This facilitates condi... | d3p/modelling.py | sample_prior_predictive | DPBayes/d3p | python | def sample_prior_predictive(rng_key, model, model_args, substitutes=None, with_intermediates=False, **kwargs):
' Samples once from the prior predictive distribution.\n\n Individual sample sites, as designated by `sample`, can be frozen to\n pre-determined values given in `substitutes`. In that case, values fo... |
def sample_posterior_predictive(rng_key, model, model_args, guide, guide_args, params, with_intermediates=False, **kwargs):
' Samples once from the posterior predictive distribution.\n\n Note that if the model function is written in such a way that it returns, e.g.,\n multiple observations from a single poste... | -7,343,252,411,584,260,000 | Samples once from the posterior predictive distribution.
Note that if the model function is written in such a way that it returns, e.g.,
multiple observations from a single posterior draw, the same is true for the
values returned by this function.
:param rng_key: Jax PRNG key
:param model: Function representing the m... | d3p/modelling.py | sample_posterior_predictive | DPBayes/d3p | python | def sample_posterior_predictive(rng_key, model, model_args, guide, guide_args, params, with_intermediates=False, **kwargs):
' Samples once from the posterior predictive distribution.\n\n Note that if the model function is written in such a way that it returns, e.g.,\n multiple observations from a single poste... |
def sample_multi_prior_predictive(rng_key, n, model, model_args, substitutes=None, with_intermediates=False, **kwargs):
' Samples n times from the prior predictive distribution.\n\n Individual sample sites, as designated by `sample`, can be frozen to\n pre-determined values given in `substitutes`. In that cas... | 2,363,878,908,160,044,500 | Samples n times from the prior predictive distribution.
Individual sample sites, as designated by `sample`, can be frozen to
pre-determined values given in `substitutes`. In that case, values for these
sites are not actually sampled but the value provided in `substitutes` is
returned as the sample. This facilitates co... | d3p/modelling.py | sample_multi_prior_predictive | DPBayes/d3p | python | def sample_multi_prior_predictive(rng_key, n, model, model_args, substitutes=None, with_intermediates=False, **kwargs):
' Samples n times from the prior predictive distribution.\n\n Individual sample sites, as designated by `sample`, can be frozen to\n pre-determined values given in `substitutes`. In that cas... |
def sample_multi_posterior_predictive(rng_key, n, model, model_args, guide, guide_args, params, with_intermediates=False, **kwargs):
' Samples n times from the posterior predictive distribution.\n\n Note that if the model function is written in such a way that it returns, e.g.,\n multiple observations, say n_... | -2,692,090,732,426,950,000 | Samples n times from the posterior predictive distribution.
Note that if the model function is written in such a way that it returns, e.g.,
multiple observations, say n_model many, from a single posterior draw, the same is
true for the values returned by this function, i.e., this function will
output n x n_model obser... | d3p/modelling.py | sample_multi_posterior_predictive | DPBayes/d3p | python | def sample_multi_posterior_predictive(rng_key, n, model, model_args, guide, guide_args, params, with_intermediates=False, **kwargs):
' Samples n times from the posterior predictive distribution.\n\n Note that if the model function is written in such a way that it returns, e.g.,\n multiple observations, say n_... |
def make_observed_model(model, obs_to_model_args_fn):
' Transforms a generative model function into one with fixed observations\n for likelihood evaluation in the SVI algorithm.\n\n :param model: Any generative model function using the numpyro `sample`\n primitive.\n :param obs_to_model_args_fn: A f... | 3,910,599,582,833,376,000 | Transforms a generative model function into one with fixed observations
for likelihood evaluation in the SVI algorithm.
:param model: Any generative model function using the numpyro `sample`
primitive.
:param obs_to_model_args_fn: A function mapping from an argument list compatible
with SVI (i.e., accepting a ... | d3p/modelling.py | make_observed_model | DPBayes/d3p | python | def make_observed_model(model, obs_to_model_args_fn):
' Transforms a generative model function into one with fixed observations\n for likelihood evaluation in the SVI algorithm.\n\n :param model: Any generative model function using the numpyro `sample`\n primitive.\n :param obs_to_model_args_fn: A f... |
def filter_detections(boxes, scores, is_training, gpu_id):
'\n :param boxes: [-1, 4]\n :param scores: [-1, ]\n :param labels: [-1, ]\n :return:\n '
if is_training:
indices = tf.reshape(tf.where(tf.greater(scores, cfgs.VIS_SCORE)), [(- 1)])
else:
indices = tf.reshape(tf.where(t... | 4,244,747,397,604,209,000 | :param boxes: [-1, 4]
:param scores: [-1, ]
:param labels: [-1, ]
:return: | libs/detection_oprations/refine_proposal_opr_csl.py | filter_detections | DLPerf/R3Det_Tensorflow | python | def filter_detections(boxes, scores, is_training, gpu_id):
'\n :param boxes: [-1, 4]\n :param scores: [-1, ]\n :param labels: [-1, ]\n :return:\n '
if is_training:
indices = tf.reshape(tf.where(tf.greater(scores, cfgs.VIS_SCORE)), [(- 1)])
else:
indices = tf.reshape(tf.where(t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.