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 largest_negative_number(seq_seq): '\n Returns the largest NEGATIVE number in the given sequence of\n sequences of numbers. Returns None if there are no negative numbers\n in the sequence of sequences.\n\n For example, if the given argument is:\n [(30, -5, 8, -20),\n (100, -2.6, 88, -...
-3,513,091,658,034,349,600
Returns the largest NEGATIVE number in the given sequence of sequences of numbers. Returns None if there are no negative numbers in the sequence of sequences. For example, if the given argument is: [(30, -5, 8, -20), (100, -2.6, 88, -40, -5), (400, 500) ] then this function returns -2.6. As another...
src/m3_more_nested_loops_in_sequences.py
largest_negative_number
dalesil/19-MoreLoopsWithinLoops
python
def largest_negative_number(seq_seq): '\n Returns the largest NEGATIVE number in the given sequence of\n sequences of numbers. Returns None if there are no negative numbers\n in the sequence of sequences.\n\n For example, if the given argument is:\n [(30, -5, 8, -20),\n (100, -2.6, 88, -...
def run_test_first_is_elsewhere_too(): ' Tests the first_is_elsewhere_too function. ' print() print('-------------------------------------') print('Testing the FIRST_IS_ELSEWHERE_TOO function:') print('-------------------------------------') message = {True: 'Your code PASSED this test...
-4,606,426,094,174,220,000
Tests the first_is_elsewhere_too function.
src/m3_more_nested_loops_in_sequences.py
run_test_first_is_elsewhere_too
dalesil/19-MoreLoopsWithinLoops
python
def run_test_first_is_elsewhere_too(): ' ' print() print('-------------------------------------') print('Testing the FIRST_IS_ELSEWHERE_TOO function:') print('-------------------------------------') message = {True: 'Your code PASSED this test.\n', False: 'Your code FAILED this test.\n'} ...
def first_is_elsewhere_too(seq_seq): '\n Given a sequence of subsequences:\n -- Returns True if any element of the first (initial) subsequence\n appears in any of the other subsequences.\n -- Returns False otherwise.\n\n For example, if the given argument is:\n [(3, 1, 4),\n ...
5,612,261,895,344,195,000
Given a sequence of subsequences: -- Returns True if any element of the first (initial) subsequence appears in any of the other subsequences. -- Returns False otherwise. For example, if the given argument is: [(3, 1, 4), (13, 10, 11, 7, 10), [11, 12, 3, 10]] then this function returns True bec...
src/m3_more_nested_loops_in_sequences.py
first_is_elsewhere_too
dalesil/19-MoreLoopsWithinLoops
python
def first_is_elsewhere_too(seq_seq): '\n Given a sequence of subsequences:\n -- Returns True if any element of the first (initial) subsequence\n appears in any of the other subsequences.\n -- Returns False otherwise.\n\n For example, if the given argument is:\n [(3, 1, 4),\n ...
def _to_DataFrame(self): 'Returns all of the channels parsed from the file as a pandas DataFrame' import pandas as pd time_index = pd.to_timedelta([f[0] for f in self._motions], unit='s') frames = [f[1] for f in self._motions] channels = np.asarray([[channel[2] for channel in frame] for frame in fra...
1,907,929,460,344,979,500
Returns all of the channels parsed from the file as a pandas DataFrame
app/resources/pymo/pymo/parsers.py
_to_DataFrame
seanschneeweiss/RoSeMotion
python
def _to_DataFrame(self): import pandas as pd time_index = pd.to_timedelta([f[0] for f in self._motions], unit='s') frames = [f[1] for f in self._motions] channels = np.asarray([[channel[2] for channel in frame] for frame in frames]) column_names = [('%s_%s' % (c[0], c[1])) for c in self._motion...
def find_path(entityset, source_entity, target_entity): 'Find a path of the source entity to the target_entity.' nodes_pipe = [target_entity] parent_dict = {target_entity: None} while len(nodes_pipe): parent_node = nodes_pipe.pop() if (parent_node == source_entity): break ...
2,792,276,967,203,366,400
Find a path of the source entity to the target_entity.
vbridge/utils/entityset_helpers.py
find_path
sibyl-dev/VBridge
python
def find_path(entityset, source_entity, target_entity): nodes_pipe = [target_entity] parent_dict = {target_entity: None} while len(nodes_pipe): parent_node = nodes_pipe.pop() if (parent_node == source_entity): break child_nodes = ([e[0] for e in entityset.get_backwar...
def get_event_ids(storage): 'Get the highest event id from the entities and the eventid of the most recent event\n\n :param storage: GOB (events + entities)\n :return:highest entity eventid and last eventid\n ' with storage.get_session(): entity_max_eventid = storage.get_entity_max_eventid() ...
8,561,335,916,100,775,000
Get the highest event id from the entities and the eventid of the most recent event :param storage: GOB (events + entities) :return:highest entity eventid and last eventid
src/gobupload/utils.py
get_event_ids
Amsterdam/GOB-Upload
python
def get_event_ids(storage): 'Get the highest event id from the entities and the eventid of the most recent event\n\n :param storage: GOB (events + entities)\n :return:highest entity eventid and last eventid\n ' with storage.get_session(): entity_max_eventid = storage.get_entity_max_eventid() ...
def random_string(length): 'Returns a random string of length :length: consisting of lowercase characters and digits\n\n :param length:\n :return:\n ' assert (length > 0) characters = (string.ascii_lowercase + ''.join([str(i) for i in range(10)])) return ''.join([random.choice(characters) for _...
-2,064,968,224,007,040,000
Returns a random string of length :length: consisting of lowercase characters and digits :param length: :return:
src/gobupload/utils.py
random_string
Amsterdam/GOB-Upload
python
def random_string(length): 'Returns a random string of length :length: consisting of lowercase characters and digits\n\n :param length:\n :return:\n ' assert (length > 0) characters = (string.ascii_lowercase + .join([str(i) for i in range(10)])) return .join([random.choice(characters) for _ in ...
def evaluate_rnn(model, dataloader, print_every=5, init_dir=None, allow_gpu_mem_growth=True, gpu_memory_fraction=0.3): '\n This function initialized a model from the <init_from> directory and calculates\n probabilities, and confusion matrices based on all data stored in\n one epoch of dataloader (usually t...
2,253,965,908,330,062,300
This function initialized a model from the <init_from> directory and calculates probabilities, and confusion matrices based on all data stored in one epoch of dataloader (usually test data) :param model: rnn_model object containing tensorflow graph :param dataloader: DataLoader object f...
evaluate.py
evaluate_rnn
TUM-LMF/fieldRNN
python
def evaluate_rnn(model, dataloader, print_every=5, init_dir=None, allow_gpu_mem_growth=True, gpu_memory_fraction=0.3): '\n This function initialized a model from the <init_from> directory and calculates\n probabilities, and confusion matrices based on all data stored in\n one epoch of dataloader (usually t...
def evaluate_cnn(model, dataloader, print_every=5, init_dir=None, allow_gpu_mem_growth=True, gpu_memory_fraction=0.3): '\n This function initialized a model from the <init_from> directory and calculates\n probabilities, and confusion matrices based on all data stored in\n one epoch of dataloader (usually t...
-8,771,434,458,588,027,000
This function initialized a model from the <init_from> directory and calculates probabilities, and confusion matrices based on all data stored in one epoch of dataloader (usually test data) :param model: rnn_model object containing tensorflow graph :param dataloader: DataLoader object f...
evaluate.py
evaluate_cnn
TUM-LMF/fieldRNN
python
def evaluate_cnn(model, dataloader, print_every=5, init_dir=None, allow_gpu_mem_growth=True, gpu_memory_fraction=0.3): '\n This function initialized a model from the <init_from> directory and calculates\n probabilities, and confusion matrices based on all data stored in\n one epoch of dataloader (usually t...
def is_allowed_create(self, resource_type, context_id): 'Whether or not the user is allowed to create a resource of the specified\n type in the context.' return self._is_allowed(Permission('create', resource_type, context_id))
2,661,049,642,559,629,000
Whether or not the user is allowed to create a resource of the specified type in the context.
src/ggrc/rbac/permissions_provider.py
is_allowed_create
sriharshakappala/ggrc-core
python
def is_allowed_create(self, resource_type, context_id): 'Whether or not the user is allowed to create a resource of the specified\n type in the context.' return self._is_allowed(Permission('create', resource_type, context_id))
def is_allowed_read(self, resource_type, context_id): 'Whether or not the user is allowed to read a resource of the specified\n type in the context.' return self._is_allowed(Permission('read', resource_type, context_id))
7,899,654,231,519,762,000
Whether or not the user is allowed to read a resource of the specified type in the context.
src/ggrc/rbac/permissions_provider.py
is_allowed_read
sriharshakappala/ggrc-core
python
def is_allowed_read(self, resource_type, context_id): 'Whether or not the user is allowed to read a resource of the specified\n type in the context.' return self._is_allowed(Permission('read', resource_type, context_id))
def is_allowed_update(self, resource_type, context_id): 'Whether or not the user is allowed to update a resource of the specified\n type in the context.' return self._is_allowed(Permission('update', resource_type, context_id))
1,961,168,208,370,677,500
Whether or not the user is allowed to update a resource of the specified type in the context.
src/ggrc/rbac/permissions_provider.py
is_allowed_update
sriharshakappala/ggrc-core
python
def is_allowed_update(self, resource_type, context_id): 'Whether or not the user is allowed to update a resource of the specified\n type in the context.' return self._is_allowed(Permission('update', resource_type, context_id))
def is_allowed_delete(self, resource_type, context_id): 'Whether or not the user is allowed to delete a resource of the specified\n type in the context.' return self._is_allowed(Permission('delete', resource_type, context_id))
3,184,699,235,176,215,600
Whether or not the user is allowed to delete a resource of the specified type in the context.
src/ggrc/rbac/permissions_provider.py
is_allowed_delete
sriharshakappala/ggrc-core
python
def is_allowed_delete(self, resource_type, context_id): 'Whether or not the user is allowed to delete a resource of the specified\n type in the context.' return self._is_allowed(Permission('delete', resource_type, context_id))
def create_contexts_for(self, resource_type): 'All contexts in which the user has create permission.' return self._get_contexts_for('create', resource_type)
-6,525,482,749,111,687,000
All contexts in which the user has create permission.
src/ggrc/rbac/permissions_provider.py
create_contexts_for
sriharshakappala/ggrc-core
python
def create_contexts_for(self, resource_type): return self._get_contexts_for('create', resource_type)
def read_contexts_for(self, resource_type): 'All contexts in which the user has read permission.' return self._get_contexts_for('read', resource_type)
-775,641,103,843,699,100
All contexts in which the user has read permission.
src/ggrc/rbac/permissions_provider.py
read_contexts_for
sriharshakappala/ggrc-core
python
def read_contexts_for(self, resource_type): return self._get_contexts_for('read', resource_type)
def update_contexts_for(self, resource_type): 'All contexts in which the user has update permission.' return self._get_contexts_for('update', resource_type)
3,080,554,081,914,556,000
All contexts in which the user has update permission.
src/ggrc/rbac/permissions_provider.py
update_contexts_for
sriharshakappala/ggrc-core
python
def update_contexts_for(self, resource_type): return self._get_contexts_for('update', resource_type)
def delete_contexts_for(self, resource_type): 'All contexts in which the user has delete permission.' return self._get_contexts_for('delete', resource_type)
1,119,226,877,921,123,100
All contexts in which the user has delete permission.
src/ggrc/rbac/permissions_provider.py
delete_contexts_for
sriharshakappala/ggrc-core
python
def delete_contexts_for(self, resource_type): return self._get_contexts_for('delete', resource_type)
def fit(self, data): '\n Apply standard scale for input data\n Parameters\n ----------\n data: data_instance, input data\n\n Returns\n ----------\n data:data_instance, data after scale\n mean: list, each column mean value\n std: list, each colu...
-1,999,165,563,163,743,500
Apply standard scale for input data Parameters ---------- data: data_instance, input data Returns ---------- data:data_instance, data after scale mean: list, each column mean value std: list, each column standard deviation
federatedml/feature/feature_scale/standard_scale.py
fit
0xqq/FATE
python
def fit(self, data): '\n Apply standard scale for input data\n Parameters\n ----------\n data: data_instance, input data\n\n Returns\n ----------\n data:data_instance, data after scale\n mean: list, each column mean value\n std: list, each colu...
def transform(self, data): '\n Transform input data using standard scale with fit results\n Parameters\n ----------\n data: data_instance, input data\n\n Returns\n ----------\n transform_data:data_instance, data after transform\n ' f = functools.partial(se...
871,618,339,265,289,500
Transform input data using standard scale with fit results Parameters ---------- data: data_instance, input data Returns ---------- transform_data:data_instance, data after transform
federatedml/feature/feature_scale/standard_scale.py
transform
0xqq/FATE
python
def transform(self, data): '\n Transform input data using standard scale with fit results\n Parameters\n ----------\n data: data_instance, input data\n\n Returns\n ----------\n transform_data:data_instance, data after transform\n ' f = functools.partial(se...
def build_prep(model_path='.', server_config=None, server_port=9090): 'Prepares the model to be Dockerised by generating a dockerimage' model_path = osp.abspath(model_path) (model_tag, model_version) = get_model_tag_and_version(model_path) if (server_config is None): server_config = 'false' ...
-3,235,559,846,212,837,400
Prepares the model to be Dockerised by generating a dockerimage
catwalk/cicd/build_steps.py
build_prep
LeapBeyond/catwalk
python
def build_prep(model_path='.', server_config=None, server_port=9090): model_path = osp.abspath(model_path) (model_tag, model_version) = get_model_tag_and_version(model_path) if (server_config is None): server_config = 'false' kwargs = {'catwalk_version': catwalk_version, 'model_tag': model_...
def build(model_path='.', docker_registry=None, push=True, no_cache=False): 'Builds the model into a Dockerised model server image.' model_path = osp.abspath(model_path) (model_tag, model_version) = get_model_tag_and_version(model_path) model_path = osp.abspath(model_path) image_name_parts = [model_...
-7,023,126,925,768,950,000
Builds the model into a Dockerised model server image.
catwalk/cicd/build_steps.py
build
LeapBeyond/catwalk
python
def build(model_path='.', docker_registry=None, push=True, no_cache=False): model_path = osp.abspath(model_path) (model_tag, model_version) = get_model_tag_and_version(model_path) model_path = osp.abspath(model_path) image_name_parts = [model_tag] if (docker_registry is not None): image...
def from_dict(data, require=None): 'Validates a dictionary containing Google service account data.\n\n Creates and returns a :class:`google.auth.crypt.Signer` instance from the\n private key specified in the data.\n\n Args:\n data (Mapping[str, str]): The service account data\n require (Seque...
5,287,973,729,651,305,000
Validates a dictionary containing Google service account data. Creates and returns a :class:`google.auth.crypt.Signer` instance from the private key specified in the data. Args: data (Mapping[str, str]): The service account data require (Sequence[str]): List of keys required to be present in the info....
google/auth/_service_account_info.py
from_dict
CodingFanSteve/google-auth-library-python
python
def from_dict(data, require=None): 'Validates a dictionary containing Google service account data.\n\n Creates and returns a :class:`google.auth.crypt.Signer` instance from the\n private key specified in the data.\n\n Args:\n data (Mapping[str, str]): The service account data\n require (Seque...
def from_filename(filename, require=None): 'Reads a Google service account JSON file and returns its parsed info.\n\n Args:\n filename (str): The path to the service account .json file.\n require (Sequence[str]): List of keys required to be present in the\n info.\n\n Returns:\n ...
7,935,664,125,326,170,000
Reads a Google service account JSON file and returns its parsed info. Args: filename (str): The path to the service account .json file. require (Sequence[str]): List of keys required to be present in the info. Returns: Tuple[ Mapping[str, str], google.auth.crypt.Signer ]: The verified info...
google/auth/_service_account_info.py
from_filename
CodingFanSteve/google-auth-library-python
python
def from_filename(filename, require=None): 'Reads a Google service account JSON file and returns its parsed info.\n\n Args:\n filename (str): The path to the service account .json file.\n require (Sequence[str]): List of keys required to be present in the\n info.\n\n Returns:\n ...
def __init__(self, end_time_usecs=None, location=None, policy_id=None, protection_job_id=None, protection_job_name=None, retention_period=None, start_time_usecs=None, storage_domain=None, total_snapshots=None): 'Constructor for the ProtectionInfo class' self.end_time_usecs = end_time_usecs self.location = l...
-5,818,597,911,769,055,000
Constructor for the ProtectionInfo class
cohesity_management_sdk/models/protection_info.py
__init__
cohesity/management-sdk-python
python
def __init__(self, end_time_usecs=None, location=None, policy_id=None, protection_job_id=None, protection_job_name=None, retention_period=None, start_time_usecs=None, storage_domain=None, total_snapshots=None): self.end_time_usecs = end_time_usecs self.location = location self.policy_id = policy_id ...
@classmethod def from_dictionary(cls, dictionary): "Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match proper...
8,686,142,287,780,077,000
Creates an instance of this model from a dictionary Args: dictionary (dictionary): A dictionary representation of the object as obtained from the deserialization of the server's response. The keys MUST match property names in the API description. Returns: object: An instance of this structure class.
cohesity_management_sdk/models/protection_info.py
from_dictionary
cohesity/management-sdk-python
python
@classmethod def from_dictionary(cls, dictionary): "Creates an instance of this model from a dictionary\n\n Args:\n dictionary (dictionary): A dictionary representation of the object as\n obtained from the deserialization of the server's response. The keys\n MUST match proper...
def make_datetime(time_string, formats=None): 'Makes datetime from string based on one of the formats.\n\n :param string time_string: time in string\n :param list formats: list of accepted formats\n :return datetime.datetime: datetime or None if no format is matched\n ' if (formats is None): ...
912,480,247,123,594,900
Makes datetime from string based on one of the formats. :param string time_string: time in string :param list formats: list of accepted formats :return datetime.datetime: datetime or None if no format is matched
archdiffer/flask_frontend/request_parser.py
make_datetime
Kratochvilova/archdiffer
python
def make_datetime(time_string, formats=None): 'Makes datetime from string based on one of the formats.\n\n :param string time_string: time in string\n :param list formats: list of accepted formats\n :return datetime.datetime: datetime or None if no format is matched\n ' if (formats is None): ...
def before(column, name='before'): 'Make filter template for filtering column values less or equal to\n datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.le, make_datetime)}
3,500,485,523,387,236,000
Make filter template for filtering column values less or equal to datetime. :param column: database model :param string name: name used in the filter template :return dict: resulting template
archdiffer/flask_frontend/request_parser.py
before
Kratochvilova/archdiffer
python
def before(column, name='before'): 'Make filter template for filtering column values less or equal to\n datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.le, make_datetime)}
def after(column, name='after'): 'Make filter template for filtering column values greater or equal to\n datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.ge, make_datetime)}
484,768,844,085,137,860
Make filter template for filtering column values greater or equal to datetime. :param column: database model :param string name: name used in the filter template :return dict: resulting template
archdiffer/flask_frontend/request_parser.py
after
Kratochvilova/archdiffer
python
def after(column, name='after'): 'Make filter template for filtering column values greater or equal to\n datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.ge, make_datetime)}
def time(column, name='time'): 'Make filter template for filtering column values equal to datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.eq, make_datetime)}
-7,892,127,272,377,402,000
Make filter template for filtering column values equal to datetime. :param column: database model :param string name: name used in the filter template :return dict: resulting template
archdiffer/flask_frontend/request_parser.py
time
Kratochvilova/archdiffer
python
def time(column, name='time'): 'Make filter template for filtering column values equal to datetime.\n\n :param column: database model\n :param string name: name used in the filter template\n :return dict: resulting template\n ' return {name: (column, operator.eq, make_datetime)}
def equals(column, name='id', function=(lambda x: x)): 'Make filter template for filtering column values equal to value\n transformed by given function.\n\n :param column: database model\n :param string name: name used in the filter template\n :param callable function: function for transforming the valu...
3,664,609,797,446,414,000
Make filter template for filtering column values equal to value transformed by given function. :param column: database model :param string name: name used in the filter template :param callable function: function for transforming the value :return dict: resulting template
archdiffer/flask_frontend/request_parser.py
equals
Kratochvilova/archdiffer
python
def equals(column, name='id', function=(lambda x: x)): 'Make filter template for filtering column values equal to value\n transformed by given function.\n\n :param column: database model\n :param string name: name used in the filter template\n :param callable function: function for transforming the valu...
def parse_request(filters=None, defaults=None): 'Parse arguments in request according to the _TRANSFORMATIONS or given\n filters.\n Requests containing other keys are considered invalid.\n\n :param dict filters: dict of filter templates containing for each key\n (column, operator, function transform...
5,116,512,422,071,438,000
Parse arguments in request according to the _TRANSFORMATIONS or given filters. Requests containing other keys are considered invalid. :param dict filters: dict of filter templates containing for each key (column, operator, function transforming value from request argument) :param dict defaults: default values of m...
archdiffer/flask_frontend/request_parser.py
parse_request
Kratochvilova/archdiffer
python
def parse_request(filters=None, defaults=None): 'Parse arguments in request according to the _TRANSFORMATIONS or given\n filters.\n Requests containing other keys are considered invalid.\n\n :param dict filters: dict of filter templates containing for each key\n (column, operator, function transform...
def get_request_arguments(*names, args_dict=None, invert=False): 'Get arguments from args_dict or request if they match given names.\n\n :param *names: names of arguments\n :param dict args_dict: dict of arguments\n :param bool invert: True if names should be exclueded instead\n :return dict: dict of ar...
-4,561,038,898,568,742,400
Get arguments from args_dict or request if they match given names. :param *names: names of arguments :param dict args_dict: dict of arguments :param bool invert: True if names should be exclueded instead :return dict: dict of arguments
archdiffer/flask_frontend/request_parser.py
get_request_arguments
Kratochvilova/archdiffer
python
def get_request_arguments(*names, args_dict=None, invert=False): 'Get arguments from args_dict or request if they match given names.\n\n :param *names: names of arguments\n :param dict args_dict: dict of arguments\n :param bool invert: True if names should be exclueded instead\n :return dict: dict of ar...
def update_modifiers(old_modifiers, new_modifiers): 'Update modifiers.\n\n :param dict old_modifiers: old modifiers\n :param dict old_modifiers: new modifiers\n :return dict: resulting modifiers\n ' modifiers = old_modifiers.copy() for (key, value) in new_modifiers.items(): if (key in ol...
-3,875,344,573,319,031,000
Update modifiers. :param dict old_modifiers: old modifiers :param dict old_modifiers: new modifiers :return dict: resulting modifiers
archdiffer/flask_frontend/request_parser.py
update_modifiers
Kratochvilova/archdiffer
python
def update_modifiers(old_modifiers, new_modifiers): 'Update modifiers.\n\n :param dict old_modifiers: old modifiers\n :param dict old_modifiers: new modifiers\n :return dict: resulting modifiers\n ' modifiers = old_modifiers.copy() for (key, value) in new_modifiers.items(): if (key in ol...
def generate_models(x_shape, number_of_classes, number_of_models=5, metrics=['accuracy'], model_type=None, cnn_min_layers=5, cnn_max_layers=10, cnn_min_filters=25, cnn_max_filters=100, cnn_min_fc_nodes=500, cnn_max_fc_nodes=1000, deepconvlstm_min_conv_layers=3, deepconvlstm_max_conv_layers=7, deepconvlstm_min_conv_filt...
-7,336,653,422,567,980,000
Generate one or multiple untrained Keras models with random hyperparameters. Parameters ---------- x_shape : tuple Shape of the input dataset: (num_samples, num_timesteps, num_channels) number_of_classes : int Number of classes for classification task number_of_models : int Number of models to generate met...
mcfly/modelgen.py
generate_models
wadpac/mcfly
python
def generate_models(x_shape, number_of_classes, number_of_models=5, metrics=['accuracy'], model_type=None, cnn_min_layers=5, cnn_max_layers=10, cnn_min_filters=25, cnn_max_filters=100, cnn_min_fc_nodes=500, cnn_max_fc_nodes=1000, deepconvlstm_min_conv_layers=3, deepconvlstm_max_conv_layers=7, deepconvlstm_min_conv_filt...
def generate_DeepConvLSTM_model(x_shape, class_number, filters, lstm_dims, learning_rate=0.01, regularization_rate=0.01, metrics=['accuracy']): '\n Generate a model with convolution and LSTM layers.\n See Ordonez et al., 2016, http://dx.doi.org/10.3390/s16010115\n\n Parameters\n ----------\n x_shape ...
3,397,434,799,327,207,400
Generate a model with convolution and LSTM layers. See Ordonez et al., 2016, http://dx.doi.org/10.3390/s16010115 Parameters ---------- x_shape : tuple Shape of the input dataset: (num_samples, num_timesteps, num_channels) class_number : int Number of classes for classification task filters : list of ints n...
mcfly/modelgen.py
generate_DeepConvLSTM_model
wadpac/mcfly
python
def generate_DeepConvLSTM_model(x_shape, class_number, filters, lstm_dims, learning_rate=0.01, regularization_rate=0.01, metrics=['accuracy']): '\n Generate a model with convolution and LSTM layers.\n See Ordonez et al., 2016, http://dx.doi.org/10.3390/s16010115\n\n Parameters\n ----------\n x_shape ...
def generate_CNN_model(x_shape, class_number, filters, fc_hidden_nodes, learning_rate=0.01, regularization_rate=0.01, metrics=['accuracy']): '\n Generate a convolutional neural network (CNN) model.\n\n The compiled Keras model is returned.\n\n Parameters\n ----------\n x_shape : tuple\n Shape ...
-6,212,186,200,602,782,000
Generate a convolutional neural network (CNN) model. The compiled Keras model is returned. Parameters ---------- x_shape : tuple Shape of the input dataset: (num_samples, num_timesteps, num_channels) class_number : int Number of classes for classification task filters : list of ints number of filters for ...
mcfly/modelgen.py
generate_CNN_model
wadpac/mcfly
python
def generate_CNN_model(x_shape, class_number, filters, fc_hidden_nodes, learning_rate=0.01, regularization_rate=0.01, metrics=['accuracy']): '\n Generate a convolutional neural network (CNN) model.\n\n The compiled Keras model is returned.\n\n Parameters\n ----------\n x_shape : tuple\n Shape ...
def generate_CNN_hyperparameter_set(min_layers=1, max_layers=10, min_filters=10, max_filters=100, min_fc_nodes=10, max_fc_nodes=2000, low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a hyperparameter set that define a CNN model.\n\n Parameters\n ----------\n min_layers : int\n minimum of Conv...
-6,703,070,403,318,698,000
Generate a hyperparameter set that define a CNN model. Parameters ---------- min_layers : int minimum of Conv layers max_layers : int maximum of Conv layers min_filters : int minimum number of filters per Conv layer max_filters : int maximum number of filters per Conv layer min_fc_nodes : int minim...
mcfly/modelgen.py
generate_CNN_hyperparameter_set
wadpac/mcfly
python
def generate_CNN_hyperparameter_set(min_layers=1, max_layers=10, min_filters=10, max_filters=100, min_fc_nodes=10, max_fc_nodes=2000, low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a hyperparameter set that define a CNN model.\n\n Parameters\n ----------\n min_layers : int\n minimum of Conv...
def generate_DeepConvLSTM_hyperparameter_set(min_conv_layers=1, max_conv_layers=10, min_conv_filters=10, max_conv_filters=100, min_lstm_layers=1, max_lstm_layers=5, min_lstm_dims=10, max_lstm_dims=100, low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a hyperparameter set that defines a DeepConvLSTM model.\n\...
2,699,689,129,207,129,000
Generate a hyperparameter set that defines a DeepConvLSTM model. Parameters ---------- min_conv_layers : int minimum number of Conv layers in DeepConvLSTM model max_conv_layers : int maximum number of Conv layers in DeepConvLSTM model min_conv_filters : int minimum number of filters per Conv layer in DeepC...
mcfly/modelgen.py
generate_DeepConvLSTM_hyperparameter_set
wadpac/mcfly
python
def generate_DeepConvLSTM_hyperparameter_set(min_conv_layers=1, max_conv_layers=10, min_conv_filters=10, max_conv_filters=100, min_lstm_layers=1, max_lstm_layers=5, min_lstm_dims=10, max_lstm_dims=100, low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a hyperparameter set that defines a DeepConvLSTM model.\n\...
def generate_base_hyper_parameter_set(low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a base set of hyperparameters that are necessary for any\n model, but sufficient for none.\n\n Parameters\n ----------\n low_lr : float\n minimum of log range for learning rate: learning rate is sampled\...
5,598,553,892,270,986,000
Generate a base set of hyperparameters that are necessary for any model, but sufficient for none. Parameters ---------- low_lr : float minimum of log range for learning rate: learning rate is sampled between `10**(-low_reg)` and `10**(-high_reg)` high_lr : float maximum of log range for learning rate: lea...
mcfly/modelgen.py
generate_base_hyper_parameter_set
wadpac/mcfly
python
def generate_base_hyper_parameter_set(low_lr=1, high_lr=4, low_reg=1, high_reg=4): ' Generate a base set of hyperparameters that are necessary for any\n model, but sufficient for none.\n\n Parameters\n ----------\n low_lr : float\n minimum of log range for learning rate: learning rate is sampled\...
def get_learning_rate(low=1, high=4): ' Return random learning rate 10^-n where n is sampled uniformly between\n low and high bounds.\n\n Parameters\n ----------\n low : float\n low bound\n high : float\n high bound\n\n Returns\n -------\n learning_rate : float\n learnin...
1,192,930,097,796,020,000
Return random learning rate 10^-n where n is sampled uniformly between low and high bounds. Parameters ---------- low : float low bound high : float high bound Returns ------- learning_rate : float learning rate
mcfly/modelgen.py
get_learning_rate
wadpac/mcfly
python
def get_learning_rate(low=1, high=4): ' Return random learning rate 10^-n where n is sampled uniformly between\n low and high bounds.\n\n Parameters\n ----------\n low : float\n low bound\n high : float\n high bound\n\n Returns\n -------\n learning_rate : float\n learnin...
def get_regularization(low=1, high=4): ' Return random regularization rate 10^-n where n is sampled uniformly\n between low and high bounds.\n\n Parameters\n ----------\n low : float\n low bound\n high : float\n high bound\n\n Returns\n -------\n regularization_rate : float\n ...
-6,022,252,116,884,650,000
Return random regularization rate 10^-n where n is sampled uniformly between low and high bounds. Parameters ---------- low : float low bound high : float high bound Returns ------- regularization_rate : float regularization rate
mcfly/modelgen.py
get_regularization
wadpac/mcfly
python
def get_regularization(low=1, high=4): ' Return random regularization rate 10^-n where n is sampled uniformly\n between low and high bounds.\n\n Parameters\n ----------\n low : float\n low bound\n high : float\n high bound\n\n Returns\n -------\n regularization_rate : float\n ...
def drawSparseMatrix(ax, mat, **kwargs): "Draw a view of a matrix into the axes.\n\n Parameters\n ----------\n ax : mpl axis instance, optional\n Axis instance where the matrix will be plotted.\n\n mat: pg.matrix.SparseMatrix or pg.matrix.SparseMapMatrix\n\n Returns\n -------\n mpl.lines...
816,415,907,612,042,400
Draw a view of a matrix into the axes. Parameters ---------- ax : mpl axis instance, optional Axis instance where the matrix will be plotted. mat: pg.matrix.SparseMatrix or pg.matrix.SparseMapMatrix Returns ------- mpl.lines.line2d Examples -------- >>> import numpy as np >>> import pygimli as pg >>> from pygim...
pygimli/viewer/mpl/matrixview.py
drawSparseMatrix
JuliusHen/gimli
python
def drawSparseMatrix(ax, mat, **kwargs): "Draw a view of a matrix into the axes.\n\n Parameters\n ----------\n ax : mpl axis instance, optional\n Axis instance where the matrix will be plotted.\n\n mat: pg.matrix.SparseMatrix or pg.matrix.SparseMapMatrix\n\n Returns\n -------\n mpl.lines...
def drawBlockMatrix(ax, mat, **kwargs): 'Draw a view of a matrix into the axes.\n\n Arguments\n ---------\n\n ax : mpl axis instance, optional\n Axis instance where the matrix will be plotted.\n\n mat: pg.Matrix.BlockMatrix\n\n Keyword Arguments\n -----------------\n spy: bool [False]\n ...
7,353,387,242,353,312,000
Draw a view of a matrix into the axes. Arguments --------- ax : mpl axis instance, optional Axis instance where the matrix will be plotted. mat: pg.Matrix.BlockMatrix Keyword Arguments ----------------- spy: bool [False] Draw all matrix entries instead of colored blocks Returns ------- ax: Examples ------...
pygimli/viewer/mpl/matrixview.py
drawBlockMatrix
JuliusHen/gimli
python
def drawBlockMatrix(ax, mat, **kwargs): 'Draw a view of a matrix into the axes.\n\n Arguments\n ---------\n\n ax : mpl axis instance, optional\n Axis instance where the matrix will be plotted.\n\n mat: pg.Matrix.BlockMatrix\n\n Keyword Arguments\n -----------------\n spy: bool [False]\n ...
def sigma_pentagonal_numbers(limit): '\n >>> list(sigma_pentagonal_numbers(16))\n [1, 2, 5, 7, 12, 15]\n ' n = 1 p = 1 while (p <= limit): (yield p) if (n > 0): n = (- n) else: n = ((- n) + 1) p = ((((3 * n) * n) - n) // 2)
-6,706,061,342,674,910,000
>>> list(sigma_pentagonal_numbers(16)) [1, 2, 5, 7, 12, 15]
advent/year2015/day20.py
sigma_pentagonal_numbers
davweb/advent-of-code
python
def sigma_pentagonal_numbers(limit): '\n >>> list(sigma_pentagonal_numbers(16))\n [1, 2, 5, 7, 12, 15]\n ' n = 1 p = 1 while (p <= limit): (yield p) if (n > 0): n = (- n) else: n = ((- n) + 1) p = ((((3 * n) * n) - n) // 2)
@cache def presents_for_house(house): '\n https://math.stackexchange.com/a/22744\n\n >>> presents_for_house(1)\n 10\n >>> presents_for_house(2)\n 30\n >>> presents_for_house(3)\n 40\n >>> presents_for_house(8)\n 150\n >>> presents_for_house(9)\n 130\n ' if (house == 1): ...
-763,015,109,654,025,600
https://math.stackexchange.com/a/22744 >>> presents_for_house(1) 10 >>> presents_for_house(2) 30 >>> presents_for_house(3) 40 >>> presents_for_house(8) 150 >>> presents_for_house(9) 130
advent/year2015/day20.py
presents_for_house
davweb/advent-of-code
python
@cache def presents_for_house(house): '\n https://math.stackexchange.com/a/22744\n\n >>> presents_for_house(1)\n 10\n >>> presents_for_house(2)\n 30\n >>> presents_for_house(3)\n 40\n >>> presents_for_house(8)\n 150\n >>> presents_for_house(9)\n 130\n ' if (house == 1): ...
def part1(data): '\n #\xa0Takes too long so commented out\n # >>> part1(INPUT)\n # 776160\n ' house = 0 presents = 0 max = 0 while (presents < data): house += 1 presents = presents_for_house(house) if (presents > max): max = presents print(...
-2,077,811,953,429,830,100
#Β Takes too long so commented out # >>> part1(INPUT) # 776160
advent/year2015/day20.py
part1
davweb/advent-of-code
python
def part1(data): '\n #\xa0Takes too long so commented out\n # >>> part1(INPUT)\n # 776160\n ' house = 0 presents = 0 max = 0 while (presents < data): house += 1 presents = presents_for_house(house) if (presents > max): max = presents print(...
def part2(data): '\n >>> part2(INPUT)\n 786240\n ' upper_limit = INPUT house = ([0] * (upper_limit + 1)) elf = 1 while (elf <= upper_limit): elf_end = min((elf * 50), upper_limit) for number in range(elf, (elf_end + 1), elf): index = (number - 1) hous...
-7,750,473,585,390,069,000
>>> part2(INPUT) 786240
advent/year2015/day20.py
part2
davweb/advent-of-code
python
def part2(data): '\n >>> part2(INPUT)\n 786240\n ' upper_limit = INPUT house = ([0] * (upper_limit + 1)) elf = 1 while (elf <= upper_limit): elf_end = min((elf * 50), upper_limit) for number in range(elf, (elf_end + 1), elf): index = (number - 1) hous...
def get_version(version=None): 'Return a PEP 440-compliant version number from VERSION.' version = get_complete_version(version) main = get_main_version(version) sub = '' if ((version[3] == 'alpha') and (version[4] == 0)): git_changeset = get_git_changeset() if git_changeset: ...
4,286,137,061,568,923,600
Return a PEP 440-compliant version number from VERSION.
django-src/utils/version.py
get_version
ch1huizong/Scode
python
def get_version(version=None): version = get_complete_version(version) main = get_main_version(version) sub = if ((version[3] == 'alpha') and (version[4] == 0)): git_changeset = get_git_changeset() if git_changeset: sub = ('.dev%s' % git_changeset) elif (version[3] ...
def get_main_version(version=None): 'Return main version (X.Y[.Z]) from VERSION.' version = get_complete_version(version) parts = (2 if (version[2] == 0) else 3) return '.'.join((str(x) for x in version[:parts]))
9,013,525,789,992,150,000
Return main version (X.Y[.Z]) from VERSION.
django-src/utils/version.py
get_main_version
ch1huizong/Scode
python
def get_main_version(version=None): version = get_complete_version(version) parts = (2 if (version[2] == 0) else 3) return '.'.join((str(x) for x in version[:parts]))
def get_complete_version(version=None): '\n Return a tuple of the django version. If version argument is non-empty,\n check for correctness of the tuple provided.\n ' if (version is None): from django import VERSION as version else: assert (len(version) == 5) assert (version...
2,632,988,490,259,573,000
Return a tuple of the django version. If version argument is non-empty, check for correctness of the tuple provided.
django-src/utils/version.py
get_complete_version
ch1huizong/Scode
python
def get_complete_version(version=None): '\n Return a tuple of the django version. If version argument is non-empty,\n check for correctness of the tuple provided.\n ' if (version is None): from django import VERSION as version else: assert (len(version) == 5) assert (version...
@functools.lru_cache() def get_git_changeset(): "Return a numeric identifier of the latest git changeset.\n\n The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.\n This value isn't guaranteed to be unique, but collisions are very unlikely,\n so it's sufficient for generating the deve...
-4,377,290,538,242,741,000
Return a numeric identifier of the latest git changeset. The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format. This value isn't guaranteed to be unique, but collisions are very unlikely, so it's sufficient for generating the development version numbers.
django-src/utils/version.py
get_git_changeset
ch1huizong/Scode
python
@functools.lru_cache() def get_git_changeset(): "Return a numeric identifier of the latest git changeset.\n\n The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.\n This value isn't guaranteed to be unique, but collisions are very unlikely,\n so it's sufficient for generating the deve...
def findMedianSortedArrays(self, nums1, nums2): '\n :type nums1: List[int]\n :type nums2: List[int]\n :rtype: float\n ' odd = ((len(nums1) + len(nums2)) % 2) if odd: half = ((len(nums1) + len(nums2)) // 2) else: half = (((len(nums1) + len(nums2)) // 2) - 1) ...
-5,411,036,675,623,418,000
:type nums1: List[int] :type nums2: List[int] :rtype: float
4+Median+of+Two+Sorted+Arrays/alg.py
findMedianSortedArrays
xiaoh12/leetcode
python
def findMedianSortedArrays(self, nums1, nums2): '\n :type nums1: List[int]\n :type nums2: List[int]\n :rtype: float\n ' odd = ((len(nums1) + len(nums2)) % 2) if odd: half = ((len(nums1) + len(nums2)) // 2) else: half = (((len(nums1) + len(nums2)) // 2) - 1) ...
def get_port(self, context): 'Get available port for consoles.' return CONF.console_vmrc_port
2,535,733,782,578,544,000
Get available port for consoles.
nova/console/vmrc.py
get_port
ONOP/nova
python
def get_port(self, context): return CONF.console_vmrc_port
def setup_console(self, context, console): 'Sets up console.' pass
-4,836,120,128,759,881,000
Sets up console.
nova/console/vmrc.py
setup_console
ONOP/nova
python
def setup_console(self, context, console): pass
def teardown_console(self, context, console): 'Tears down console.' pass
-6,899,172,463,449,520,000
Tears down console.
nova/console/vmrc.py
teardown_console
ONOP/nova
python
def teardown_console(self, context, console): pass
def init_host(self): 'Perform console initialization.' pass
5,688,657,367,007,553,000
Perform console initialization.
nova/console/vmrc.py
init_host
ONOP/nova
python
def init_host(self): pass
def fix_pool_password(self, password): 'Encode password.' return password
1,070,836,154,636,971,800
Encode password.
nova/console/vmrc.py
fix_pool_password
ONOP/nova
python
def fix_pool_password(self, password): return password
def generate_password(self, vim_session, pool, instance_name): "Returns VMRC Connection credentials.\n\n Return string is of the form '<VM PATH>:<ESX Username>@<ESX Password>'.\n\n " (username, password) = (pool['username'], pool['password']) vms = vim_session._call_method(vim_util, 'get_objec...
-17,592,870,140,672,932
Returns VMRC Connection credentials. Return string is of the form '<VM PATH>:<ESX Username>@<ESX Password>'.
nova/console/vmrc.py
generate_password
ONOP/nova
python
def generate_password(self, vim_session, pool, instance_name): "Returns VMRC Connection credentials.\n\n Return string is of the form '<VM PATH>:<ESX Username>@<ESX Password>'.\n\n " (username, password) = (pool['username'], pool['password']) vms = vim_session._call_method(vim_util, 'get_objec...
def is_otp(self): 'Is one time password or not.' return False
-8,124,443,781,481,316,000
Is one time password or not.
nova/console/vmrc.py
is_otp
ONOP/nova
python
def is_otp(self): return False
def generate_password(self, vim_session, pool, instance_name): "Returns a VMRC Session.\n\n Return string is of the form '<VM MOID>:<VMRC Ticket>'.\n\n " vms = vim_session._call_method(vim_util, 'get_objects', 'VirtualMachine', ['name']) vm_ref = None for vm in vms: if (vm.propSet[...
6,486,637,346,679,642,000
Returns a VMRC Session. Return string is of the form '<VM MOID>:<VMRC Ticket>'.
nova/console/vmrc.py
generate_password
ONOP/nova
python
def generate_password(self, vim_session, pool, instance_name): "Returns a VMRC Session.\n\n Return string is of the form '<VM MOID>:<VMRC Ticket>'.\n\n " vms = vim_session._call_method(vim_util, 'get_objects', 'VirtualMachine', ['name']) vm_ref = None for vm in vms: if (vm.propSet[...
def is_otp(self): 'Is one time password or not.' return True
3,635,665,800,062,393,300
Is one time password or not.
nova/console/vmrc.py
is_otp
ONOP/nova
python
def is_otp(self): return True
def testInputOutput(self): '\n Test InputOutput\n ' model = ProcessMaker_PMIO.models.input_output.InputOutput()
-8,925,060,231,664,973,000
Test InputOutput
test/test_input_output.py
testInputOutput
ProcessMaker/pmio-sdk-python
python
def testInputOutput(self): '\n \n ' model = ProcessMaker_PMIO.models.input_output.InputOutput()
def get_correctness_test_inputs(use_numpy, with_distribution, x_train, y_train, x_predict): 'Generates the inputs for correctness check when enable Keras with DS.' global_batch_size = 64 batch_size = global_batch_size use_per_core_batch_size = (with_distribution and (with_distribution.__class__.__name__...
4,754,634,288,906,665,000
Generates the inputs for correctness check when enable Keras with DS.
tensorflow/contrib/distribute/python/keras_test.py
get_correctness_test_inputs
unnir/tensorflow
python
def get_correctness_test_inputs(use_numpy, with_distribution, x_train, y_train, x_predict): global_batch_size = 64 batch_size = global_batch_size use_per_core_batch_size = (with_distribution and (with_distribution.__class__.__name__ != 'TPUStrategy')) if use_per_core_batch_size: batch_size ...
def read_lexiconp(filename): "Reads the lexiconp.txt file in 'filename', with lines like 'word pron p1 p2 ...'.\n Returns a list of tuples (word, pron_prob, pron), where 'word' is a string,\n 'pron_prob', a float, is the pronunciation probability (which must be >0.0\n and would normally be <=1.0), and 'pro...
-5,861,199,520,399,420,000
Reads the lexiconp.txt file in 'filename', with lines like 'word pron p1 p2 ...'. Returns a list of tuples (word, pron_prob, pron), where 'word' is a string, 'pron_prob', a float, is the pronunciation probability (which must be >0.0 and would normally be <=1.0), and 'pron' is a list of strings representing phones. ...
egs/wsj/s5/utils/lang/make_lexicon_fst.py
read_lexiconp
Anusha-G-Rao/kaldi
python
def read_lexiconp(filename): "Reads the lexiconp.txt file in 'filename', with lines like 'word pron p1 p2 ...'.\n Returns a list of tuples (word, pron_prob, pron), where 'word' is a string,\n 'pron_prob', a float, is the pronunciation probability (which must be >0.0\n and would normally be <=1.0), and 'pro...
def write_nonterminal_arcs(start_state, loop_state, next_state, nonterminals, left_context_phones): 'This function relates to the grammar-decoding setup, see\n kaldi-asr.org/doc/grammar.html. It is called from write_fst_no_silence\n and write_fst_silence, and writes to the stdout some extra arcs\n in the ...
-8,162,289,252,516,565,000
This function relates to the grammar-decoding setup, see kaldi-asr.org/doc/grammar.html. It is called from write_fst_no_silence and write_fst_silence, and writes to the stdout some extra arcs in the lexicon FST that relate to nonterminal symbols. See the section "Special symbols in L.fst, kaldi-asr.org/doc/grammar.htm...
egs/wsj/s5/utils/lang/make_lexicon_fst.py
write_nonterminal_arcs
Anusha-G-Rao/kaldi
python
def write_nonterminal_arcs(start_state, loop_state, next_state, nonterminals, left_context_phones): 'This function relates to the grammar-decoding setup, see\n kaldi-asr.org/doc/grammar.html. It is called from write_fst_no_silence\n and write_fst_silence, and writes to the stdout some extra arcs\n in the ...
def write_fst_no_silence(lexicon, nonterminals=None, left_context_phones=None): "Writes the text format of L.fst to the standard output. This version is for\n when --sil-prob=0.0, meaning there is no optional silence allowed.\n\n 'lexicon' is a list of 3-tuples (word, pron-prob, prons) as returned by\n ...
-4,885,482,295,403,309,000
Writes the text format of L.fst to the standard output. This version is for when --sil-prob=0.0, meaning there is no optional silence allowed. 'lexicon' is a list of 3-tuples (word, pron-prob, prons) as returned by read_lexiconp(). 'nonterminals', which relates to grammar decoding (see kaldi-asr.org/doc/gramma...
egs/wsj/s5/utils/lang/make_lexicon_fst.py
write_fst_no_silence
Anusha-G-Rao/kaldi
python
def write_fst_no_silence(lexicon, nonterminals=None, left_context_phones=None): "Writes the text format of L.fst to the standard output. This version is for\n when --sil-prob=0.0, meaning there is no optional silence allowed.\n\n 'lexicon' is a list of 3-tuples (word, pron-prob, prons) as returned by\n ...
def write_fst_with_silence(lexicon, sil_prob, sil_phone, sil_disambig, nonterminals=None, left_context_phones=None): 'Writes the text format of L.fst to the standard output. This version is for\n when --sil-prob != 0.0, meaning there is optional silence\n \'lexicon\' is a list of 3-tuples (word, pron-pro...
1,575,721,830,482,665,700
Writes the text format of L.fst to the standard output. This version is for when --sil-prob != 0.0, meaning there is optional silence 'lexicon' is a list of 3-tuples (word, pron-prob, prons) as returned by read_lexiconp(). 'sil_prob', which is expected to be strictly between 0.. and 1.0, is the probability o...
egs/wsj/s5/utils/lang/make_lexicon_fst.py
write_fst_with_silence
Anusha-G-Rao/kaldi
python
def write_fst_with_silence(lexicon, sil_prob, sil_phone, sil_disambig, nonterminals=None, left_context_phones=None): 'Writes the text format of L.fst to the standard output. This version is for\n when --sil-prob != 0.0, meaning there is optional silence\n \'lexicon\' is a list of 3-tuples (word, pron-pro...
def write_words_txt(orig_lines, highest_numbered_symbol, nonterminals, filename): "Writes updated words.txt to 'filename'. 'orig_lines' is the original lines\n in the words.txt file as a list of strings (without the newlines);\n highest_numbered_symbol is the highest numbered symbol in the original\n ...
4,574,954,868,212,090,000
Writes updated words.txt to 'filename'. 'orig_lines' is the original lines in the words.txt file as a list of strings (without the newlines); highest_numbered_symbol is the highest numbered symbol in the original words.txt; nonterminals is a list of strings like '#nonterm:foo'.
egs/wsj/s5/utils/lang/make_lexicon_fst.py
write_words_txt
Anusha-G-Rao/kaldi
python
def write_words_txt(orig_lines, highest_numbered_symbol, nonterminals, filename): "Writes updated words.txt to 'filename'. 'orig_lines' is the original lines\n in the words.txt file as a list of strings (without the newlines);\n highest_numbered_symbol is the highest numbered symbol in the original\n ...
def read_nonterminals(filename): "Reads the user-defined nonterminal symbols in 'filename', checks that\n it has the expected format and has no duplicates, and returns the nonterminal\n symbols as a list of strings, e.g.\n ['#nonterm:contact_list', '#nonterm:phone_number', ... ]. " ans = [line...
-2,603,101,064,308,610,600
Reads the user-defined nonterminal symbols in 'filename', checks that it has the expected format and has no duplicates, and returns the nonterminal symbols as a list of strings, e.g. ['#nonterm:contact_list', '#nonterm:phone_number', ... ].
egs/wsj/s5/utils/lang/make_lexicon_fst.py
read_nonterminals
Anusha-G-Rao/kaldi
python
def read_nonterminals(filename): "Reads the user-defined nonterminal symbols in 'filename', checks that\n it has the expected format and has no duplicates, and returns the nonterminal\n symbols as a list of strings, e.g.\n ['#nonterm:contact_list', '#nonterm:phone_number', ... ]. " ans = [line...
def read_left_context_phones(filename): "Reads, checks, and returns a list of left-context phones, in text form, one\n per line. Returns a list of strings, e.g. ['a', 'ah', ..., '#nonterm_bos' ]" ans = [line.strip(' \t\r\n') for line in open(filename, 'r', encoding='latin-1')] if (len(ans) == 0): ...
-7,915,289,802,565,721,000
Reads, checks, and returns a list of left-context phones, in text form, one per line. Returns a list of strings, e.g. ['a', 'ah', ..., '#nonterm_bos' ]
egs/wsj/s5/utils/lang/make_lexicon_fst.py
read_left_context_phones
Anusha-G-Rao/kaldi
python
def read_left_context_phones(filename): "Reads, checks, and returns a list of left-context phones, in text form, one\n per line. Returns a list of strings, e.g. ['a', 'ah', ..., '#nonterm_bos' ]" ans = [line.strip(' \t\r\n') for line in open(filename, 'r', encoding='latin-1')] if (len(ans) == 0): ...
def is_token(s): 'Returns true if s is a string and is space-free.' if (not isinstance(s, str)): return False whitespace = re.compile('[ \t\r\n]+') split_str = whitespace.split(s) return ((len(split_str) == 1) and (s == split_str[0]))
5,402,618,036,967,467,000
Returns true if s is a string and is space-free.
egs/wsj/s5/utils/lang/make_lexicon_fst.py
is_token
Anusha-G-Rao/kaldi
python
def is_token(s): if (not isinstance(s, str)): return False whitespace = re.compile('[ \t\r\n]+') split_str = whitespace.split(s) return ((len(split_str) == 1) and (s == split_str[0]))
def inspect_app(app: App) -> 'AppInfo': 'Inspects an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n AppInfo: The information regarding the application. Call\n :meth:`~.App...
4,346,341,443,215,193,600
Inspects an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: AppInfo: The information regarding the application. Call :meth:`~.AppInfo.to_string` on the result to obtain a human-friendly representation.
falcon/inspect.py
inspect_app
hzdwang/falcon-1
python
def inspect_app(app: App) -> 'AppInfo': 'Inspects an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n AppInfo: The information regarding the application. Call\n :meth:`~.App...
def inspect_routes(app: App) -> 'List[RouteInfo]': 'Inspects the routes of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[RouteInfo]: A list of route descriptions for the...
9,208,210,767,539,110,000
Inspects the routes of an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: List[RouteInfo]: A list of route descriptions for the application.
falcon/inspect.py
inspect_routes
hzdwang/falcon-1
python
def inspect_routes(app: App) -> 'List[RouteInfo]': 'Inspects the routes of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[RouteInfo]: A list of route descriptions for the...
def register_router(router_class): "Register a function to inspect a particular router.\n\n This decorator registers a new function for a custom router\n class, so that it can be inspected with the function\n :func:`.inspect_routes`.\n An inspection function takes the router instance used by the\n ap...
5,343,638,293,906,582,000
Register a function to inspect a particular router. This decorator registers a new function for a custom router class, so that it can be inspected with the function :func:`.inspect_routes`. An inspection function takes the router instance used by the application and returns a list of :class:`.RouteInfo`. Eg:: @re...
falcon/inspect.py
register_router
hzdwang/falcon-1
python
def register_router(router_class): "Register a function to inspect a particular router.\n\n This decorator registers a new function for a custom router\n class, so that it can be inspected with the function\n :func:`.inspect_routes`.\n An inspection function takes the router instance used by the\n ap...
def inspect_static_routes(app: App) -> 'List[StaticRouteInfo]': 'Inspects the static routes of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[StaticRouteInfo]: A list of ...
-8,759,942,310,408,179,000
Inspects the static routes of an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: List[StaticRouteInfo]: A list of static routes that have been added to the application.
falcon/inspect.py
inspect_static_routes
hzdwang/falcon-1
python
def inspect_static_routes(app: App) -> 'List[StaticRouteInfo]': 'Inspects the static routes of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[StaticRouteInfo]: A list of ...
def inspect_sinks(app: App) -> 'List[SinkInfo]': 'Inspects the sinks of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[SinkInfo]: A list of sinks used by the application....
3,921,220,580,018,919,400
Inspects the sinks of an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: List[SinkInfo]: A list of sinks used by the application.
falcon/inspect.py
inspect_sinks
hzdwang/falcon-1
python
def inspect_sinks(app: App) -> 'List[SinkInfo]': 'Inspects the sinks of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[SinkInfo]: A list of sinks used by the application....
def inspect_error_handlers(app: App) -> 'List[ErrorHandlerInfo]': 'Inspects the error handlers of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[ErrorHandlerInfo]: A list...
-8,406,878,317,633,376,000
Inspects the error handlers of an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: List[ErrorHandlerInfo]: A list of error handlers used by the application.
falcon/inspect.py
inspect_error_handlers
hzdwang/falcon-1
python
def inspect_error_handlers(app: App) -> 'List[ErrorHandlerInfo]': 'Inspects the error handlers of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n List[ErrorHandlerInfo]: A list...
def inspect_middlewares(app: App) -> 'MiddlewareInfo': "Inspects the middleware components of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n MiddlewareInfo: Information about ...
1,525,322,864,409,902,300
Inspects the middleware components of an application. Args: app (falcon.App): The application to inspect. Works with both :class:`falcon.App` and :class:`falcon.asgi.App`. Returns: MiddlewareInfo: Information about the app's middleware components.
falcon/inspect.py
inspect_middlewares
hzdwang/falcon-1
python
def inspect_middlewares(app: App) -> 'MiddlewareInfo': "Inspects the middleware components of an application.\n\n Args:\n app (falcon.App): The application to inspect. Works with both\n :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n Returns:\n MiddlewareInfo: Information about ...
@register_router(CompiledRouter) def inspect_compiled_router(router: CompiledRouter) -> 'List[RouteInfo]': 'Walk an instance of :class:`~.CompiledRouter` to return a list of defined routes.\n\n Default route inspector for CompiledRouter.\n\n Args:\n router (CompiledRouter): The router to inspect.\n\n ...
2,829,765,905,918,934,000
Walk an instance of :class:`~.CompiledRouter` to return a list of defined routes. Default route inspector for CompiledRouter. Args: router (CompiledRouter): The router to inspect. Returns: List[RouteInfo]: A list of :class:`~.RouteInfo`.
falcon/inspect.py
inspect_compiled_router
hzdwang/falcon-1
python
@register_router(CompiledRouter) def inspect_compiled_router(router: CompiledRouter) -> 'List[RouteInfo]': 'Walk an instance of :class:`~.CompiledRouter` to return a list of defined routes.\n\n Default route inspector for CompiledRouter.\n\n Args:\n router (CompiledRouter): The router to inspect.\n\n ...
def _get_source_info(obj, default='[unknown file]'): 'Try to get the definition file and line of obj.\n\n Return default on error.\n ' try: source_file = inspect.getsourcefile(obj) source_lines = inspect.findsource(obj) source_info = '{}:{}'.format(source_file, source_lines[1]) ...
-391,650,700,617,766,000
Try to get the definition file and line of obj. Return default on error.
falcon/inspect.py
_get_source_info
hzdwang/falcon-1
python
def _get_source_info(obj, default='[unknown file]'): 'Try to get the definition file and line of obj.\n\n Return default on error.\n ' try: source_file = inspect.getsourcefile(obj) source_lines = inspect.findsource(obj) source_info = '{}:{}'.format(source_file, source_lines[1]) ...
def _get_source_info_and_name(obj): 'Attempt to get the definition file and line of obj and its name.' source_info = _get_source_info(obj, None) if (source_info is None): source_info = _get_source_info(type(obj)) name = getattr(obj, '__name__', None) if (name is None): name = getattr...
-3,760,626,473,023,653,000
Attempt to get the definition file and line of obj and its name.
falcon/inspect.py
_get_source_info_and_name
hzdwang/falcon-1
python
def _get_source_info_and_name(obj): source_info = _get_source_info(obj, None) if (source_info is None): source_info = _get_source_info(type(obj)) name = getattr(obj, '__name__', None) if (name is None): name = getattr(type(obj), '__name__', '[unknown]') return (source_info, name...
def _is_internal(obj): 'Check if the module of the object is a falcon module.' module = inspect.getmodule(obj) if module: return module.__name__.startswith('falcon.') return False
-9,039,669,792,405,178,000
Check if the module of the object is a falcon module.
falcon/inspect.py
_is_internal
hzdwang/falcon-1
python
def _is_internal(obj): module = inspect.getmodule(obj) if module: return module.__name__.startswith('falcon.') return False
def _filter_internal(iterable, return_internal): 'Filter the internal elements of an iterable.' if return_internal: return iterable return [el for el in iterable if (not el.internal)]
8,104,579,376,676,779,000
Filter the internal elements of an iterable.
falcon/inspect.py
_filter_internal
hzdwang/falcon-1
python
def _filter_internal(iterable, return_internal): if return_internal: return iterable return [el for el in iterable if (not el.internal)]
def to_string(self, verbose=False, internal=False) -> str: 'Return a string representation of this class.\n\n Args:\n verbose (bool, optional): Adds more information. Defaults to False.\n internal (bool, optional): Also include internal route methods\n and error handlers ...
357,918,309,221,823,740
Return a string representation of this class. Args: verbose (bool, optional): Adds more information. Defaults to False. internal (bool, optional): Also include internal route methods and error handlers added by the framework. Defaults to ``False``. Returns: str: string representation of th...
falcon/inspect.py
to_string
hzdwang/falcon-1
python
def to_string(self, verbose=False, internal=False) -> str: 'Return a string representation of this class.\n\n Args:\n verbose (bool, optional): Adds more information. Defaults to False.\n internal (bool, optional): Also include internal route methods\n and error handlers ...
def to_string(self, verbose=False, internal=False, name='') -> str: "Return a string representation of this class.\n\n Args:\n verbose (bool, optional): Adds more information. Defaults to False.\n internal (bool, optional): Also include internal falcon route methods\n and...
3,752,347,903,184,052,700
Return a string representation of this class. Args: verbose (bool, optional): Adds more information. Defaults to False. internal (bool, optional): Also include internal falcon route methods and error handlers. Defaults to ``False``. name (str, optional): The name of the application, to be output at...
falcon/inspect.py
to_string
hzdwang/falcon-1
python
def to_string(self, verbose=False, internal=False, name=) -> str: "Return a string representation of this class.\n\n Args:\n verbose (bool, optional): Adds more information. Defaults to False.\n internal (bool, optional): Also include internal falcon route methods\n and e...
def process(self, instance: _Traversable): 'Process the instance, by calling the appropriate visit method.\n\n Uses the `__visit_name__` attribute of the `instance` to obtain the method to use.\n\n Args:\n instance (_Traversable): The instance to process.\n ' try: return ...
4,237,623,031,210,916,400
Process the instance, by calling the appropriate visit method. Uses the `__visit_name__` attribute of the `instance` to obtain the method to use. Args: instance (_Traversable): The instance to process.
falcon/inspect.py
process
hzdwang/falcon-1
python
def process(self, instance: _Traversable): 'Process the instance, by calling the appropriate visit method.\n\n Uses the `__visit_name__` attribute of the `instance` to obtain the method to use.\n\n Args:\n instance (_Traversable): The instance to process.\n ' try: return ...
@property def tab(self): 'Get the current tabulation.' return (' ' * self.indent)
-6,399,728,926,710,062,000
Get the current tabulation.
falcon/inspect.py
tab
hzdwang/falcon-1
python
@property def tab(self): return (' ' * self.indent)
def visit_route_method(self, route_method: RouteMethodInfo) -> str: 'Visit a RouteMethodInfo instance. Usually called by `process`.' text = '{0.method} - {0.function_name}'.format(route_method) if self.verbose: text += ' ({0.source_info})'.format(route_method) return text
7,306,008,936,031,749,000
Visit a RouteMethodInfo instance. Usually called by `process`.
falcon/inspect.py
visit_route_method
hzdwang/falcon-1
python
def visit_route_method(self, route_method: RouteMethodInfo) -> str: text = '{0.method} - {0.function_name}'.format(route_method) if self.verbose: text += ' ({0.source_info})'.format(route_method) return text
def _methods_to_string(self, methods: List): 'Return a string from the list of methods.' tab = (self.tab + (' ' * 3)) methods = _filter_internal(methods, self.internal) if (not methods): return '' text_list = [self.process(m) for m in methods] method_text = ['{}β”œβ”€β”€ {}'.format(tab, m) for...
-4,648,375,267,960,320,000
Return a string from the list of methods.
falcon/inspect.py
_methods_to_string
hzdwang/falcon-1
python
def _methods_to_string(self, methods: List): tab = (self.tab + (' ' * 3)) methods = _filter_internal(methods, self.internal) if (not methods): return text_list = [self.process(m) for m in methods] method_text = ['{}β”œβ”€β”€ {}'.format(tab, m) for m in text_list[:(- 1)]] method_text += [...
def visit_route(self, route: RouteInfo) -> str: 'Visit a RouteInfo instance. Usually called by `process`.' text = '{0}β‡’ {1.path} - {1.class_name}'.format(self.tab, route) if self.verbose: text += ' ({0.source_info})'.format(route) method_text = self._methods_to_string(route.methods) if (not ...
2,163,025,547,150,710,300
Visit a RouteInfo instance. Usually called by `process`.
falcon/inspect.py
visit_route
hzdwang/falcon-1
python
def visit_route(self, route: RouteInfo) -> str: text = '{0}β‡’ {1.path} - {1.class_name}'.format(self.tab, route) if self.verbose: text += ' ({0.source_info})'.format(route) method_text = self._methods_to_string(route.methods) if (not method_text): return text return '{}:\n{}'.for...
def visit_static_route(self, static_route: StaticRouteInfo) -> str: 'Visit a StaticRouteInfo instance. Usually called by `process`.' text = '{0}↦ {1.prefix} {1.directory}'.format(self.tab, static_route) if static_route.fallback_filename: text += ' [{0.fallback_filename}]'.format(static_route) re...
7,074,009,647,409,785,000
Visit a StaticRouteInfo instance. Usually called by `process`.
falcon/inspect.py
visit_static_route
hzdwang/falcon-1
python
def visit_static_route(self, static_route: StaticRouteInfo) -> str: text = '{0}↦ {1.prefix} {1.directory}'.format(self.tab, static_route) if static_route.fallback_filename: text += ' [{0.fallback_filename}]'.format(static_route) return text
def visit_sink(self, sink: SinkInfo) -> str: 'Visit a SinkInfo instance. Usually called by `process`.' text = '{0}β‡₯ {1.prefix} {1.name}'.format(self.tab, sink) if self.verbose: text += ' ({0.source_info})'.format(sink) return text
3,417,290,023,421,739,000
Visit a SinkInfo instance. Usually called by `process`.
falcon/inspect.py
visit_sink
hzdwang/falcon-1
python
def visit_sink(self, sink: SinkInfo) -> str: text = '{0}β‡₯ {1.prefix} {1.name}'.format(self.tab, sink) if self.verbose: text += ' ({0.source_info})'.format(sink) return text
def visit_error_handler(self, error_handler: ErrorHandlerInfo) -> str: 'Visit a ErrorHandlerInfo instance. Usually called by `process`.' text = '{0}β‡œ {1.error} {1.name}'.format(self.tab, error_handler) if self.verbose: text += ' ({0.source_info})'.format(error_handler) return text
-205,411,815,747,033,000
Visit a ErrorHandlerInfo instance. Usually called by `process`.
falcon/inspect.py
visit_error_handler
hzdwang/falcon-1
python
def visit_error_handler(self, error_handler: ErrorHandlerInfo) -> str: text = '{0}β‡œ {1.error} {1.name}'.format(self.tab, error_handler) if self.verbose: text += ' ({0.source_info})'.format(error_handler) return text
def visit_middleware_method(self, middleware_method: MiddlewareMethodInfo) -> str: 'Visit a MiddlewareMethodInfo instance. Usually called by `process`.' text = '{0.function_name}'.format(middleware_method) if self.verbose: text += ' ({0.source_info})'.format(middleware_method) return text
7,950,787,544,159,926,000
Visit a MiddlewareMethodInfo instance. Usually called by `process`.
falcon/inspect.py
visit_middleware_method
hzdwang/falcon-1
python
def visit_middleware_method(self, middleware_method: MiddlewareMethodInfo) -> str: text = '{0.function_name}'.format(middleware_method) if self.verbose: text += ' ({0.source_info})'.format(middleware_method) return text
def visit_middleware_class(self, middleware_class: MiddlewareClassInfo) -> str: 'Visit a ErrorHandlerInfo instance. Usually called by `process`.' text = '{0}↣ {1.name}'.format(self.tab, middleware_class) if self.verbose: text += ' ({0.source_info})'.format(middleware_class) method_text = self._m...
737,925,779,832,650,900
Visit a ErrorHandlerInfo instance. Usually called by `process`.
falcon/inspect.py
visit_middleware_class
hzdwang/falcon-1
python
def visit_middleware_class(self, middleware_class: MiddlewareClassInfo) -> str: text = '{0}↣ {1.name}'.format(self.tab, middleware_class) if self.verbose: text += ' ({0.source_info})'.format(middleware_class) method_text = self._methods_to_string(middleware_class.methods) if (not method_tex...
def visit_middleware_tree_item(self, mti: MiddlewareTreeItemInfo) -> str: 'Visit a MiddlewareTreeItemInfo instance. Usually called by `process`.' symbol = mti._symbols.get(mti.name, 'β†’') return '{0}{1} {2.class_name}.{2.name}'.format(self.tab, symbol, mti)
1,270,719,916,785,987,300
Visit a MiddlewareTreeItemInfo instance. Usually called by `process`.
falcon/inspect.py
visit_middleware_tree_item
hzdwang/falcon-1
python
def visit_middleware_tree_item(self, mti: MiddlewareTreeItemInfo) -> str: symbol = mti._symbols.get(mti.name, 'β†’') return '{0}{1} {2.class_name}.{2.name}'.format(self.tab, symbol, mti)
def visit_middleware_tree(self, m_tree: MiddlewareTreeInfo) -> str: 'Visit a MiddlewareTreeInfo instance. Usually called by `process`.' before = (len(m_tree.request) + len(m_tree.resource)) after = len(m_tree.response) if ((before + after) == 0): return '' each = 2 initial = self.indent ...
-5,830,221,220,495,931,000
Visit a MiddlewareTreeInfo instance. Usually called by `process`.
falcon/inspect.py
visit_middleware_tree
hzdwang/falcon-1
python
def visit_middleware_tree(self, m_tree: MiddlewareTreeInfo) -> str: before = (len(m_tree.request) + len(m_tree.resource)) after = len(m_tree.response) if ((before + after) == 0): return each = 2 initial = self.indent if (after > before): self.indent += (each * (after - befo...
def visit_middleware(self, middleware: MiddlewareInfo) -> str: 'Visit a MiddlewareInfo instance. Usually called by `process`.' text = self.process(middleware.middleware_tree) if self.verbose: self.indent += 4 m_text = '\n'.join((self.process(m) for m in middleware.middleware_classes)) ...
-6,325,941,541,130,197,000
Visit a MiddlewareInfo instance. Usually called by `process`.
falcon/inspect.py
visit_middleware
hzdwang/falcon-1
python
def visit_middleware(self, middleware: MiddlewareInfo) -> str: text = self.process(middleware.middleware_tree) if self.verbose: self.indent += 4 m_text = '\n'.join((self.process(m) for m in middleware.middleware_classes)) self.indent -= 4 if m_text: text += '\n{}...
def visit_app(self, app: AppInfo) -> str: 'Visit a AppInfo instance. Usually called by `process`.' type_ = ('ASGI' if app.asgi else 'WSGI') self.indent = 4 text = '{} ({})'.format((self.name or 'Falcon App'), type_) if app.routes: routes = '\n'.join((self.process(r) for r in app.routes)) ...
6,827,144,084,587,439,000
Visit a AppInfo instance. Usually called by `process`.
falcon/inspect.py
visit_app
hzdwang/falcon-1
python
def visit_app(self, app: AppInfo) -> str: type_ = ('ASGI' if app.asgi else 'WSGI') self.indent = 4 text = '{} ({})'.format((self.name or 'Falcon App'), type_) if app.routes: routes = '\n'.join((self.process(r) for r in app.routes)) text += '\nβ€’ Routes:\n{}'.format(routes) middle...
def get_lbs_for_random_crop(crop_size, data_shape, margins): '\n :param crop_size:\n :param data_shape: (b,c,x,y(,z)) must be the whole thing!\n :param margins:\n :return:\n ' lbs = [] for i in range((len(data_shape) - 2)): if (((data_shape[(i + 2)] - crop_size[i]) - margins[i]) > mar...
293,492,568,942,654,500
:param crop_size: :param data_shape: (b,c,x,y(,z)) must be the whole thing! :param margins: :return:
data/crop_and_pad_augmentations.py
get_lbs_for_random_crop
bowang-lab/shape-attentive-unet
python
def get_lbs_for_random_crop(crop_size, data_shape, margins): '\n :param crop_size:\n :param data_shape: (b,c,x,y(,z)) must be the whole thing!\n :param margins:\n :return:\n ' lbs = [] for i in range((len(data_shape) - 2)): if (((data_shape[(i + 2)] - crop_size[i]) - margins[i]) > mar...