nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
Yonv1943/Python
ecce2153892093d7a13686e4cbfd6b323cb59de8
ElegantRL/Beta/elegantrl/AgentZoo/ElegantRL-PER/net.py
python
CriticTwin.__init__
(self, mid_dim, state_dim, action_dim, if_use_dn=False)
Not need to use both SpectralNorm and TwinCritic I choose TwinCritc instead of SpectralNorm, because SpectralNorm is conflict with soft target update, if is_spectral_norm: self.net1[1] = nn.utils.spectral_norm(self.dec_q1[1]) self.net2[1] = nn.utils.spectral_norm(self.d...
Not need to use both SpectralNorm and TwinCritic I choose TwinCritc instead of SpectralNorm, because SpectralNorm is conflict with soft target update,
[ "Not", "need", "to", "use", "both", "SpectralNorm", "and", "TwinCritic", "I", "choose", "TwinCritc", "instead", "of", "SpectralNorm", "because", "SpectralNorm", "is", "conflict", "with", "soft", "target", "update" ]
def __init__(self, mid_dim, state_dim, action_dim, if_use_dn=False): super().__init__() if if_use_dn: # use DenseNet (DenseNet has both shallow and deep linear layer) nn_dense = DenseNet(mid_dim) lay_dim = nn_dense.out_dim self.net_sa = nn.Sequential(nn.Linear(state...
[ "def", "__init__", "(", "self", ",", "mid_dim", ",", "state_dim", ",", "action_dim", ",", "if_use_dn", "=", "False", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "if", "if_use_dn", ":", "# use DenseNet (DenseNet has both shallow and deep linear layer)",...
https://github.com/Yonv1943/Python/blob/ecce2153892093d7a13686e4cbfd6b323cb59de8/ElegantRL/Beta/elegantrl/AgentZoo/ElegantRL-PER/net.py#L267-L293
martsberger/django-pivot
be6efdea5bb009d6ccc697b3c62d7e539e9fee7f
django_pivot/histogram.py
python
multi_histogram
(queryset, column, bins, slice_on, choices)
return _zero_fill(qs, bins, field_values)
Returns a table of histograms, one for each unique value of field in queryset. :param queryset: A Queryet, Model, or Manager :param column: The column we are aggregating into a histogram :param bins: An ordered iterable of left endpoints of the bins. Must have at least two elements. The endpoints must...
Returns a table of histograms, one for each unique value of field in queryset.
[ "Returns", "a", "table", "of", "histograms", "one", "for", "each", "unique", "value", "of", "field", "in", "queryset", "." ]
def multi_histogram(queryset, column, bins, slice_on, choices): """ Returns a table of histograms, one for each unique value of field in queryset. :param queryset: A Queryet, Model, or Manager :param column: The column we are aggregating into a histogram :param bins: An ordered iterable of left en...
[ "def", "multi_histogram", "(", "queryset", ",", "column", ",", "bins", ",", "slice_on", ",", "choices", ")", ":", "queryset", "=", "_get_queryset", "(", "queryset", ")", "field_values", "=", "get_column_values", "(", "queryset", ",", "slice_on", ",", "choices"...
https://github.com/martsberger/django-pivot/blob/be6efdea5bb009d6ccc697b3c62d7e539e9fee7f/django_pivot/histogram.py#L37-L80
deepdrive/deepdrive
11adb9480ffeba832231e15eb545ec9aba1f7d65
vendor/openai/baselines/common/math_util.py
python
explained_variance
(ypred,y)
return np.nan if vary==0 else 1 - np.var(y-ypred)/vary
Computes fraction of variance that ypred explains about y. Returns 1 - Var[y-ypred] / Var[y] interpretation: ev=0 => might as well have predicted zero ev=1 => perfect prediction ev<0 => worse than just predicting zero
Computes fraction of variance that ypred explains about y. Returns 1 - Var[y-ypred] / Var[y]
[ "Computes", "fraction", "of", "variance", "that", "ypred", "explains", "about", "y", ".", "Returns", "1", "-", "Var", "[", "y", "-", "ypred", "]", "/", "Var", "[", "y", "]" ]
def explained_variance(ypred,y): """ Computes fraction of variance that ypred explains about y. Returns 1 - Var[y-ypred] / Var[y] interpretation: ev=0 => might as well have predicted zero ev=1 => perfect prediction ev<0 => worse than just predicting zero """ asser...
[ "def", "explained_variance", "(", "ypred", ",", "y", ")", ":", "assert", "y", ".", "ndim", "==", "1", "and", "ypred", ".", "ndim", "==", "1", "vary", "=", "np", ".", "var", "(", "y", ")", "return", "np", ".", "nan", "if", "vary", "==", "0", "el...
https://github.com/deepdrive/deepdrive/blob/11adb9480ffeba832231e15eb545ec9aba1f7d65/vendor/openai/baselines/common/math_util.py#L25-L38
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/aemet/sensor.py
python
AemetForecastSensor.__init__
( self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator, forecast_mode, description: SensorEntityDescription, )
Initialize the sensor.
Initialize the sensor.
[ "Initialize", "the", "sensor", "." ]
def __init__( self, name, unique_id, weather_coordinator: WeatherUpdateCoordinator, forecast_mode, description: SensorEntityDescription, ): """Initialize the sensor.""" super().__init__( name=name, unique_id=f"{unique_id}-{descr...
[ "def", "__init__", "(", "self", ",", "name", ",", "unique_id", ",", "weather_coordinator", ":", "WeatherUpdateCoordinator", ",", "forecast_mode", ",", "description", ":", "SensorEntityDescription", ",", ")", ":", "super", "(", ")", ".", "__init__", "(", "name", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/aemet/sensor.py#L113-L131
yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification
2a6d2f9c732a362458030643e131540e7d1cdcca
bert/run_squad.py
python
model_fn_builder
(bert_config, init_checkpoint, learning_rate, num_train_steps, num_warmup_steps, use_tpu, use_one_hot_embeddings)
return model_fn
Returns `model_fn` closure for TPUEstimator.
Returns `model_fn` closure for TPUEstimator.
[ "Returns", "model_fn", "closure", "for", "TPUEstimator", "." ]
def model_fn_builder(bert_config, init_checkpoint, learning_rate, num_train_steps, num_warmup_steps, use_tpu, use_one_hot_embeddings): """Returns `model_fn` closure for TPUEstimator.""" def model_fn(features, labels, mode, params): # pylint: disable=unused-argument ""...
[ "def", "model_fn_builder", "(", "bert_config", ",", "init_checkpoint", ",", "learning_rate", ",", "num_train_steps", ",", "num_warmup_steps", ",", "use_tpu", ",", "use_one_hot_embeddings", ")", ":", "def", "model_fn", "(", "features", ",", "labels", ",", "mode", "...
https://github.com/yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification/blob/2a6d2f9c732a362458030643e131540e7d1cdcca/bert/run_squad.py#L590-L684
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/jax/optimizers.py
python
sharded_sgd
(learning_rate_fn: optax.Schedule, momentum: Optional[float], nesterov: bool)
return ShardedGradientTransformation( init=count_init_fn, update=update_fn, init_partition_spec=count_init_partition_spec_fn)
A canonical Stochastic Gradient Descent optimiser that supports spmd ... sharding. This implements stochastic gradient descent. It also includes support for momentum, and nesterov acceleration, as these are standard practice when using stochastic gradient descent to train deep neural networks. References: ...
A canonical Stochastic Gradient Descent optimiser that supports spmd ...
[ "A", "canonical", "Stochastic", "Gradient", "Descent", "optimiser", "that", "supports", "spmd", "..." ]
def sharded_sgd(learning_rate_fn: optax.Schedule, momentum: Optional[float], nesterov: bool) -> ShardedGradientTransformation: """A canonical Stochastic Gradient Descent optimiser that supports spmd ... sharding. This implements stochastic gradient descent. It also includes support for momentu...
[ "def", "sharded_sgd", "(", "learning_rate_fn", ":", "optax", ".", "Schedule", ",", "momentum", ":", "Optional", "[", "float", "]", ",", "nesterov", ":", "bool", ")", "->", "ShardedGradientTransformation", ":", "# TODO(yonghui): support momentum.", "assert", "momentu...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/jax/optimizers.py#L88-L126
duo-labs/py_webauthn
fe97b9841328aa84559bd2a282c07d20145845c1
webauthn/helpers/decode_credential_public_key.py
python
decode_credential_public_key
( key: bytes, )
Decode a CBOR-encoded public key and turn it into a data structure. Supports OKP, EC2, and RSA public keys
Decode a CBOR-encoded public key and turn it into a data structure.
[ "Decode", "a", "CBOR", "-", "encoded", "public", "key", "and", "turn", "it", "into", "a", "data", "structure", "." ]
def decode_credential_public_key( key: bytes, ) -> Union[DecodedOKPPublicKey, DecodedEC2PublicKey, DecodedRSAPublicKey]: """ Decode a CBOR-encoded public key and turn it into a data structure. Supports OKP, EC2, and RSA public keys """ # Occassionally we might be given a public key in an "uncom...
[ "def", "decode_credential_public_key", "(", "key", ":", "bytes", ",", ")", "->", "Union", "[", "DecodedOKPPublicKey", ",", "DecodedEC2PublicKey", ",", "DecodedRSAPublicKey", "]", ":", "# Occassionally we might be given a public key in an \"uncompressed\" format,", "# typically ...
https://github.com/duo-labs/py_webauthn/blob/fe97b9841328aa84559bd2a282c07d20145845c1/webauthn/helpers/decode_credential_public_key.py#L35-L119
IJDykeman/wangTiles
7c1ee2095ebdf7f72bce07d94c6484915d5cae8b
experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/req.py
python
parse_editable
(editable_req, default_vcs=None)
return package, url, options
Parses svn+http://blahblah@rev#egg=Foobar into a requirement (Foobar) and a URL
Parses svn+http://blahblah
[ "Parses", "svn", "+", "http", ":", "//", "blahblah" ]
def parse_editable(editable_req, default_vcs=None): """Parses svn+http://blahblah@rev#egg=Foobar into a requirement (Foobar) and a URL""" url = editable_req extras = None # If a file path is specified with extras, strip off the extras. m = re.match(r'^(.+)(\[[^\]]+\])$', url) if m: ...
[ "def", "parse_editable", "(", "editable_req", ",", "default_vcs", "=", "None", ")", ":", "url", "=", "editable_req", "extras", "=", "None", "# If a file path is specified with extras, strip off the extras.", "m", "=", "re", ".", "match", "(", "r'^(.+)(\\[[^\\]]+\\])$'",...
https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/req.py#L1676-L1738
yangxue0827/R-DFPN_FPN_Tensorflow
fa69b1c176fc5eb9835e9ac46663c81a4bf7e6ce
libs/rotation/r_minibatch.py
python
r_get_minibatch
(roidb, num_classes)
return blobs
Given a roidb, construct a minibatch sampled from it.
Given a roidb, construct a minibatch sampled from it.
[ "Given", "a", "roidb", "construct", "a", "minibatch", "sampled", "from", "it", "." ]
def r_get_minibatch(roidb, num_classes): bbox_para_num = 5 """Given a roidb, construct a minibatch sampled from it.""" num_images = len(roidb) # Sample random scales to use for each image in this batch random_scale_inds = npr.randint(0, high=len(cfg.TRAIN.SCALES), ...
[ "def", "r_get_minibatch", "(", "roidb", ",", "num_classes", ")", ":", "bbox_para_num", "=", "5", "num_images", "=", "len", "(", "roidb", ")", "# Sample random scales to use for each image in this batch", "random_scale_inds", "=", "npr", ".", "randint", "(", "0", ","...
https://github.com/yangxue0827/R-DFPN_FPN_Tensorflow/blob/fa69b1c176fc5eb9835e9ac46663c81a4bf7e6ce/libs/rotation/r_minibatch.py#L188-L268
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/_pyio.py
python
BufferedRWPair.readinto
(self, b)
return self.reader.readinto(b)
[]
def readinto(self, b): return self.reader.readinto(b)
[ "def", "readinto", "(", "self", ",", "b", ")", ":", "return", "self", ".", "reader", ".", "readinto", "(", "b", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/_pyio.py#L1388-L1389
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/analysis/structure_matcher.py
python
OccupancyComparator.are_equal
(self, sp1, sp2)
return set(sp1.element_composition.values()) == set(sp2.element_composition.values())
Args: sp1: First species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite. sp2: Second species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite. Returns: True if sets of occupancies...
Args: sp1: First species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite. sp2: Second species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite.
[ "Args", ":", "sp1", ":", "First", "species", ".", "A", "dict", "of", "{", "specie", "/", "element", ":", "amt", "}", "as", "per", "the", "definition", "in", "Site", "and", "PeriodicSite", ".", "sp2", ":", "Second", "species", ".", "A", "dict", "of", ...
def are_equal(self, sp1, sp2): """ Args: sp1: First species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite. sp2: Second species. A dict of {specie/element: amt} as per the definition in Site and PeriodicSite. ...
[ "def", "are_equal", "(", "self", ",", "sp1", ",", "sp2", ")", ":", "return", "set", "(", "sp1", ".", "element_composition", ".", "values", "(", ")", ")", "==", "set", "(", "sp2", ".", "element_composition", ".", "values", "(", ")", ")" ]
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/structure_matcher.py#L277-L288
snuspl/parallax
83791254ccd5d7a55213687a8dff4c2e04372694
parallax/parallax/examples/nmt/scripts/rouge.py
python
_split_into_words
(sentences)
return list(itertools.chain(*[_.split(" ") for _ in sentences]))
Splits multiple sentences into words and flattens the result
Splits multiple sentences into words and flattens the result
[ "Splits", "multiple", "sentences", "into", "words", "and", "flattens", "the", "result" ]
def _split_into_words(sentences): """Splits multiple sentences into words and flattens the result""" return list(itertools.chain(*[_.split(" ") for _ in sentences]))
[ "def", "_split_into_words", "(", "sentences", ")", ":", "return", "list", "(", "itertools", ".", "chain", "(", "*", "[", "_", ".", "split", "(", "\" \"", ")", "for", "_", "in", "sentences", "]", ")", ")" ]
https://github.com/snuspl/parallax/blob/83791254ccd5d7a55213687a8dff4c2e04372694/parallax/parallax/examples/nmt/scripts/rouge.py#L37-L39
vim-scripts/UltiSnips
5f88199e373a7eea4644b8dc1ff433688e8f2ebd
pythonx/UltiSnips/snippet/source/file/_base.py
python
SnippetFileSource._parse_snippets
(self, ft, filename)
Parse the 'filename' for the given 'ft' and watch it for changes in the future.
Parse the 'filename' for the given 'ft' and watch it for changes in the future.
[ "Parse", "the", "filename", "for", "the", "given", "ft", "and", "watch", "it", "for", "changes", "in", "the", "future", "." ]
def _parse_snippets(self, ft, filename): """Parse the 'filename' for the given 'ft' and watch it for changes in the future.""" self._file_hashes[filename] = _hash_file(filename) file_data = compatibility.open_ascii_file(filename, 'r').read() for event, data in self._parse_snippet...
[ "def", "_parse_snippets", "(", "self", ",", "ft", ",", "filename", ")", ":", "self", ".", "_file_hashes", "[", "filename", "]", "=", "_hash_file", "(", "filename", ")", "file_data", "=", "compatibility", ".", "open_ascii_file", "(", "filename", ",", "'r'", ...
https://github.com/vim-scripts/UltiSnips/blob/5f88199e373a7eea4644b8dc1ff433688e8f2ebd/pythonx/UltiSnips/snippet/source/file/_base.py#L89-L112
ntalekt/homeassistant
8fb6da881564430a3324125ddc2bd43cb7c8680f
custom_components/hacs/api/hacs_config.py
python
hacs_config
(_hass, connection, msg)
Handle get media player cover command.
Handle get media player cover command.
[ "Handle", "get", "media", "player", "cover", "command", "." ]
async def hacs_config(_hass, connection, msg): """Handle get media player cover command.""" hacs = get_hacs() config = hacs.configuration content = {} content["frontend_mode"] = config.frontend_mode content["frontend_compact"] = config.frontend_compact content["onboarding_done"] = config.on...
[ "async", "def", "hacs_config", "(", "_hass", ",", "connection", ",", "msg", ")", ":", "hacs", "=", "get_hacs", "(", ")", "config", "=", "hacs", ".", "configuration", "content", "=", "{", "}", "content", "[", "\"frontend_mode\"", "]", "=", "config", ".", ...
https://github.com/ntalekt/homeassistant/blob/8fb6da881564430a3324125ddc2bd43cb7c8680f/custom_components/hacs/api/hacs_config.py#L10-L28
InsaneLife/dssm
1d32e137654e03994f7ba6cfde52e1d47601027c
model/bert/modeling.py
python
BertModel.get_sequence_output
(self)
return self.sequence_output
Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder.
Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder.
[ "Gets", "final", "hidden", "layer", "of", "encoder", ".", "Returns", ":", "float", "Tensor", "of", "shape", "[", "batch_size", "seq_length", "hidden_size", "]", "corresponding", "to", "the", "final", "hidden", "of", "the", "transformer", "encoder", "." ]
def get_sequence_output(self): """Gets final hidden layer of encoder. Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the final hidden of the transformer encoder. """ return self.sequence_output
[ "def", "get_sequence_output", "(", "self", ")", ":", "return", "self", ".", "sequence_output" ]
https://github.com/InsaneLife/dssm/blob/1d32e137654e03994f7ba6cfde52e1d47601027c/model/bert/modeling.py#L230-L236
flipkart-incubator/RTA
1559ae0f0087ec2371264ed6dd562c17dabebb84
rta.py
python
Scan.wp_scan
(self, parent)
Launch WpScan if the techstack used is wordpress.
Launch WpScan if the techstack used is wordpress.
[ "Launch", "WpScan", "if", "the", "techstack", "used", "is", "wordpress", "." ]
def wp_scan(self, parent): """ Launch WpScan if the techstack used is wordpress. """ collection = self.dbname['wpscan'] collection_tech = self.dbname['tech_stack'] count = self.dbname.collection.count() # collection.create_index('domain', unique=True) ...
[ "def", "wp_scan", "(", "self", ",", "parent", ")", ":", "collection", "=", "self", ".", "dbname", "[", "'wpscan'", "]", "collection_tech", "=", "self", ".", "dbname", "[", "'tech_stack'", "]", "count", "=", "self", ".", "dbname", ".", "collection", ".", ...
https://github.com/flipkart-incubator/RTA/blob/1559ae0f0087ec2371264ed6dd562c17dabebb84/rta.py#L309-L362
Supervisor/supervisor
7de6215c9677d1418e7f0a72e7065c1fa69174d4
supervisor/rpcinterface.py
python
SupervisorNamespaceRPCInterface.addProcessGroup
(self, name)
Update the config for a running process from config file. @param string name name of process group to add @return boolean result true if successful
Update the config for a running process from config file.
[ "Update", "the", "config", "for", "a", "running", "process", "from", "config", "file", "." ]
def addProcessGroup(self, name): """ Update the config for a running process from config file. @param string name name of process group to add @return boolean result true if successful """ self._update('addProcessGroup') for config in self.supervisord.option...
[ "def", "addProcessGroup", "(", "self", ",", "name", ")", ":", "self", ".", "_update", "(", "'addProcessGroup'", ")", "for", "config", "in", "self", ".", "supervisord", ".", "options", ".", "process_group_configs", ":", "if", "config", ".", "name", "==", "n...
https://github.com/Supervisor/supervisor/blob/7de6215c9677d1418e7f0a72e7065c1fa69174d4/supervisor/rpcinterface.py#L201-L215
perone/Pyevolve
589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0
pyevolve/GTree.py
python
buildGTreeGrow
(depth, value_callback, max_siblings, max_depth)
return n
Random generates a Tree structure using the value_callback for data generation and the method "Grow" :param depth: the initial depth, zero :param value_callback: the function which generates the random values for nodes :param max_siblings: the maximum number of sisters of a n...
Random generates a Tree structure using the value_callback for data generation and the method "Grow"
[ "Random", "generates", "a", "Tree", "structure", "using", "the", "value_callback", "for", "data", "generation", "and", "the", "method", "Grow" ]
def buildGTreeGrow(depth, value_callback, max_siblings, max_depth): """ Random generates a Tree structure using the value_callback for data generation and the method "Grow" :param depth: the initial depth, zero :param value_callback: the function which generates the random va...
[ "def", "buildGTreeGrow", "(", "depth", ",", "value_callback", ",", "max_siblings", ",", "max_depth", ")", ":", "random_value", "=", "value_callback", "(", ")", "n", "=", "GTreeNode", "(", "random_value", ")", "if", "depth", "==", "max_depth", ":", "return", ...
https://github.com/perone/Pyevolve/blob/589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0/pyevolve/GTree.py#L169-L192
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
chap19/monitor/monitor/monitor/openstack/common/timeutils.py
python
normalize_time
(timestamp)
return timestamp.replace(tzinfo=None) - offset
Normalize time in arbitrary timezone to UTC naive object
Normalize time in arbitrary timezone to UTC naive object
[ "Normalize", "time", "in", "arbitrary", "timezone", "to", "UTC", "naive", "object" ]
def normalize_time(timestamp): """Normalize time in arbitrary timezone to UTC naive object""" offset = timestamp.utcoffset() if offset is None: return timestamp return timestamp.replace(tzinfo=None) - offset
[ "def", "normalize_time", "(", "timestamp", ")", ":", "offset", "=", "timestamp", ".", "utcoffset", "(", ")", "if", "offset", "is", "None", ":", "return", "timestamp", "return", "timestamp", ".", "replace", "(", "tzinfo", "=", "None", ")", "-", "offset" ]
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/monitor/openstack/common/timeutils.py#L68-L73
pytroll/satpy
09e51f932048f98cce7919a4ff8bd2ec01e1ae98
satpy/readers/mviri_l1b_fiduceo_nc.py
python
DatasetWrapper.__getitem__
(self, item)
return ds
Get a variable from the dataset.
Get a variable from the dataset.
[ "Get", "a", "variable", "from", "the", "dataset", "." ]
def __getitem__(self, item): """Get a variable from the dataset.""" ds = self.nc[item] if self._should_dims_be_renamed(ds): ds = self._rename_dims(ds) elif self._coordinates_not_assigned(ds): ds = self._reassign_coords(ds) self._cleanup_attrs(ds) r...
[ "def", "__getitem__", "(", "self", ",", "item", ")", ":", "ds", "=", "self", ".", "nc", "[", "item", "]", "if", "self", ".", "_should_dims_be_renamed", "(", "ds", ")", ":", "ds", "=", "self", ".", "_rename_dims", "(", "ds", ")", "elif", "self", "."...
https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/mviri_l1b_fiduceo_nc.py#L465-L473
NervanaSystems/ngraph-python
ac032c83c7152b615a9ad129d54d350f9d6a2986
ngraph/op_graph/comm_nodes.py
python
GatherRecvOp.hetr_axes
(self, axes, parallel_axis)
return arg_axes
Override hetr_axes function to ensure GatherRecvOp has the full length of the parallel_axis rather that parallel_axis.length//num_devices.
Override hetr_axes function to ensure GatherRecvOp has the full length of the parallel_axis rather that parallel_axis.length//num_devices.
[ "Override", "hetr_axes", "function", "to", "ensure", "GatherRecvOp", "has", "the", "full", "length", "of", "the", "parallel_axis", "rather", "that", "parallel_axis", ".", "length", "//", "num_devices", "." ]
def hetr_axes(self, axes, parallel_axis): """ Override hetr_axes function to ensure GatherRecvOp has the full length of the parallel_axis rather that parallel_axis.length//num_devices. """ arg_axes = super(GatherRecvOp, self).hetr_axes(axes, parallel_axis) if parallel_axi...
[ "def", "hetr_axes", "(", "self", ",", "axes", ",", "parallel_axis", ")", ":", "arg_axes", "=", "super", "(", "GatherRecvOp", ",", "self", ")", ".", "hetr_axes", "(", "axes", ",", "parallel_axis", ")", "if", "parallel_axis", "in", "axes", "and", "arg_axes",...
https://github.com/NervanaSystems/ngraph-python/blob/ac032c83c7152b615a9ad129d54d350f9d6a2986/ngraph/op_graph/comm_nodes.py#L279-L288
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/utils/parsers/robots/data_structures.py
python
Light.specular
(self)
return self.material.specular
Return the light specular color.
Return the light specular color.
[ "Return", "the", "light", "specular", "color", "." ]
def specular(self): """Return the light specular color.""" return self.material.specular
[ "def", "specular", "(", "self", ")", ":", "return", "self", ".", "material", ".", "specular" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/utils/parsers/robots/data_structures.py#L677-L679
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/ntheory/modular.py
python
solve_congruence
(*remainder_modulus_pairs, **hint)
Compute the integer ``n`` that has the residual ``ai`` when it is divided by ``mi`` where the ``ai`` and ``mi`` are given as pairs to this function: ((a1, m1), (a2, m2), ...). If there is no solution, return None. Otherwise return ``n`` and its modulus. The ``mi`` values need not be co-prime. If it is ...
Compute the integer ``n`` that has the residual ``ai`` when it is divided by ``mi`` where the ``ai`` and ``mi`` are given as pairs to this function: ((a1, m1), (a2, m2), ...). If there is no solution, return None. Otherwise return ``n`` and its modulus.
[ "Compute", "the", "integer", "n", "that", "has", "the", "residual", "ai", "when", "it", "is", "divided", "by", "mi", "where", "the", "ai", "and", "mi", "are", "given", "as", "pairs", "to", "this", "function", ":", "((", "a1", "m1", ")", "(", "a2", ...
def solve_congruence(*remainder_modulus_pairs, **hint): """Compute the integer ``n`` that has the residual ``ai`` when it is divided by ``mi`` where the ``ai`` and ``mi`` are given as pairs to this function: ((a1, m1), (a2, m2), ...). If there is no solution, return None. Otherwise return ``n`` and its ...
[ "def", "solve_congruence", "(", "*", "remainder_modulus_pairs", ",", "*", "*", "hint", ")", ":", "def", "combine", "(", "c1", ",", "c2", ")", ":", "\"\"\"Return the tuple (a, m) which satisfies the requirement\n that n = a + i*m satisfy n = a1 + j*m1 and n = a2 = k*m2.\n...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/ntheory/modular.py#L133-L252
shadowmoose/RedditDownloader
ffe38afbee64e094fe80de2267ea049401bfb2f2
redditdownloader/static/settings.py
python
remove_source
(source, save_after=True)
Removes the given Source from the list of sources, and resaves (if set).
Removes the given Source from the list of sources, and resaves (if set).
[ "Removes", "the", "given", "Source", "from", "the", "list", "of", "sources", "and", "resaves", "(", "if", "set", ")", "." ]
def remove_source(source, save_after=True): """ Removes the given Source from the list of sources, and resaves (if set). """ new_sources = [s for s in get_sources() if s.get_alias() != source.get_alias()] put('sources', [s.to_obj() for s in new_sources], save_after=save_after)
[ "def", "remove_source", "(", "source", ",", "save_after", "=", "True", ")", ":", "new_sources", "=", "[", "s", "for", "s", "in", "get_sources", "(", ")", "if", "s", ".", "get_alias", "(", ")", "!=", "source", ".", "get_alias", "(", ")", "]", "put", ...
https://github.com/shadowmoose/RedditDownloader/blob/ffe38afbee64e094fe80de2267ea049401bfb2f2/redditdownloader/static/settings.py#L143-L146
Arachnid/bloggart
ba2b60417102fe14a77b1bcd809b9b801d3a96e2
lib/xsrfutil.py
python
generate_token
(key, user_id, path="", when=None)
return token
Generates a URL-safe token for the given user, action, time tuple. Args: key: secret key to use. user_id: the user ID of the authenticated user. path: The path the token should be valid for. when: the time in seconds since the epoch at which the user was authorized for this action. If not set t...
Generates a URL-safe token for the given user, action, time tuple.
[ "Generates", "a", "URL", "-", "safe", "token", "for", "the", "given", "user", "action", "time", "tuple", "." ]
def generate_token(key, user_id, path="", when=None): """Generates a URL-safe token for the given user, action, time tuple. Args: key: secret key to use. user_id: the user ID of the authenticated user. path: The path the token should be valid for. when: the time in seconds since the epoch at which ...
[ "def", "generate_token", "(", "key", ",", "user_id", ",", "path", "=", "\"\"", ",", "when", "=", "None", ")", ":", "when", "=", "when", "or", "int", "(", "time", ".", "time", "(", ")", ")", "digester", "=", "hmac", ".", "new", "(", "str", "(", ...
https://github.com/Arachnid/bloggart/blob/ba2b60417102fe14a77b1bcd809b9b801d3a96e2/lib/xsrfutil.py#L46-L71
deanishe/alfred-vpn-manager
f5d0dd1433ea69b1517d4866a12b1118097057b9
src/workflow/web.py
python
Response.save_to_path
(self, filepath)
Save retrieved data to file at ``filepath``. .. versionadded: 1.9.6 :param filepath: Path to save retrieved data.
Save retrieved data to file at ``filepath``.
[ "Save", "retrieved", "data", "to", "file", "at", "filepath", "." ]
def save_to_path(self, filepath): """Save retrieved data to file at ``filepath``. .. versionadded: 1.9.6 :param filepath: Path to save retrieved data. """ filepath = os.path.abspath(filepath) dirname = os.path.dirname(filepath) if not os.path.exists(dirname): ...
[ "def", "save_to_path", "(", "self", ",", "filepath", ")", ":", "filepath", "=", "os", ".", "path", ".", "abspath", "(", "filepath", ")", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "filepath", ")", "if", "not", "os", ".", "path", ".", "...
https://github.com/deanishe/alfred-vpn-manager/blob/f5d0dd1433ea69b1517d4866a12b1118097057b9/src/workflow/web.py#L388-L405
pymeasure/pymeasure
b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e
pymeasure/instruments/keithley/keithley2400.py
python
Keithley2400.auto_range_source
(self)
Configures the source to use an automatic range.
Configures the source to use an automatic range.
[ "Configures", "the", "source", "to", "use", "an", "automatic", "range", "." ]
def auto_range_source(self): """ Configures the source to use an automatic range. """ if self.source_mode == 'current': self.write(":SOUR:CURR:RANG:AUTO 1") else: self.write(":SOUR:VOLT:RANG:AUTO 1")
[ "def", "auto_range_source", "(", "self", ")", ":", "if", "self", ".", "source_mode", "==", "'current'", ":", "self", ".", "write", "(", "\":SOUR:CURR:RANG:AUTO 1\"", ")", "else", ":", "self", ".", "write", "(", "\":SOUR:VOLT:RANG:AUTO 1\"", ")" ]
https://github.com/pymeasure/pymeasure/blob/b4d888e9ead85ef7f7af0031f2dbb44c9ce1825e/pymeasure/instruments/keithley/keithley2400.py#L436-L442
ym2011/POC-EXP
206b22d3a6b2a172359678df33bbc5b2ad04b6c3
windows/SYNfulKnock/scapy-2.3.1/scapy/contrib/gsm_um.py
python
systemInformationType5
()
return packet
SYSTEM INFORMATION TYPE 5 Section 9.1.37
SYSTEM INFORMATION TYPE 5 Section 9.1.37
[ "SYSTEM", "INFORMATION", "TYPE", "5", "Section", "9", ".", "1", ".", "37" ]
def systemInformationType5(): """SYSTEM INFORMATION TYPE 5 Section 9.1.37""" a = L2PseudoLength(l2pLength=0x12) b = TpPd(pd=0x6) c = MessageType(mesType=0x35) # 000110101 d = NeighbourCellsDescription() packet = a / b / c / d return packet
[ "def", "systemInformationType5", "(", ")", ":", "a", "=", "L2PseudoLength", "(", "l2pLength", "=", "0x12", ")", "b", "=", "TpPd", "(", "pd", "=", "0x6", ")", "c", "=", "MessageType", "(", "mesType", "=", "0x35", ")", "# 000110101", "d", "=", "Neighbour...
https://github.com/ym2011/POC-EXP/blob/206b22d3a6b2a172359678df33bbc5b2ad04b6c3/windows/SYNfulKnock/scapy-2.3.1/scapy/contrib/gsm_um.py#L1081-L1088
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/storage/in_memory.py
python
InMemoryStorage.find_all_records
( self, type_filter: str, tag_query: Mapping = None, options: Mapping = None, )
return results
Retrieve all records matching a particular type filter and tag query.
Retrieve all records matching a particular type filter and tag query.
[ "Retrieve", "all", "records", "matching", "a", "particular", "type", "filter", "and", "tag", "query", "." ]
async def find_all_records( self, type_filter: str, tag_query: Mapping = None, options: Mapping = None, ): """Retrieve all records matching a particular type filter and tag query.""" results = [] for record in self.profile.records.values(): if reco...
[ "async", "def", "find_all_records", "(", "self", ",", "type_filter", ":", "str", ",", "tag_query", ":", "Mapping", "=", "None", ",", "options", ":", "Mapping", "=", "None", ",", ")", ":", "results", "=", "[", "]", "for", "record", "in", "self", ".", ...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/storage/in_memory.py#L111-L122
rytilahti/python-miio
b6e53dd16fac77915426e7592e2528b78ef65190
miio/airhumidifier.py
python
AirHumidifierStatus.child_lock
(self)
return self.data["child_lock"] == "on"
Return True if child lock is on.
Return True if child lock is on.
[ "Return", "True", "if", "child", "lock", "is", "on", "." ]
def child_lock(self) -> bool: """Return True if child lock is on.""" return self.data["child_lock"] == "on"
[ "def", "child_lock", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "data", "[", "\"child_lock\"", "]", "==", "\"on\"" ]
https://github.com/rytilahti/python-miio/blob/b6e53dd16fac77915426e7592e2528b78ef65190/miio/airhumidifier.py#L130-L132
miracle2k/k8s-snapshots
9dbb5fc3a99c847f696d35549ff751f994585012
k8s_snapshots/backends/google.py
python
get_gcloud
(ctx, version: str= 'v1')
return compute
Get a configured Google Compute API Client instance. Note that the Google API Client is not threadsafe. Cache the instance locally if you want to avoid OAuth overhead between calls. Parameters ---------- version Compute API version
Get a configured Google Compute API Client instance.
[ "Get", "a", "configured", "Google", "Compute", "API", "Client", "instance", "." ]
def get_gcloud(ctx, version: str= 'v1'): """ Get a configured Google Compute API Client instance. Note that the Google API Client is not threadsafe. Cache the instance locally if you want to avoid OAuth overhead between calls. Parameters ---------- version Compute API version "...
[ "def", "get_gcloud", "(", "ctx", ",", "version", ":", "str", "=", "'v1'", ")", ":", "SCOPES", "=", "'https://www.googleapis.com/auth/compute'", "credentials", "=", "None", "if", "ctx", ".", "config", ".", "get", "(", "'gcloud_credentials_file'", ")", ":", "cre...
https://github.com/miracle2k/k8s-snapshots/blob/9dbb5fc3a99c847f696d35549ff751f994585012/k8s_snapshots/backends/google.py#L354-L392
fwenzel/django-sha2
f4519bf0cc9b1dd7a7d78394fa4aec4504bc86e9
django_sha2/hashers.py
python
BcryptHMACCombinedPasswordVerifier._hmac_create
(self, password, shared_key)
return hmac_value
Create HMAC value based on pwd
Create HMAC value based on pwd
[ "Create", "HMAC", "value", "based", "on", "pwd" ]
def _hmac_create(self, password, shared_key): """Create HMAC value based on pwd""" hmac_value = base64.b64encode(hmac.new( smart_str(shared_key), smart_str(password), hashlib.sha512).digest()) return hmac_value
[ "def", "_hmac_create", "(", "self", ",", "password", ",", "shared_key", ")", ":", "hmac_value", "=", "base64", ".", "b64encode", "(", "hmac", ".", "new", "(", "smart_str", "(", "shared_key", ")", ",", "smart_str", "(", "password", ")", ",", "hashlib", "....
https://github.com/fwenzel/django-sha2/blob/f4519bf0cc9b1dd7a7d78394fa4aec4504bc86e9/django_sha2/hashers.py#L104-L110
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/aiohttp_lib/aiohttp/web_urldispatcher.py
python
UrlDispatcher.add_post
(self, path: str, handler: _WebHandler, **kwargs: Any)
return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
Shortcut for add_route with method POST
Shortcut for add_route with method POST
[ "Shortcut", "for", "add_route", "with", "method", "POST" ]
def add_post(self, path: str, handler: _WebHandler, **kwargs: Any) -> AbstractRoute: """ Shortcut for add_route with method POST """ return self.add_route(hdrs.METH_POST, path, handler, **kwargs)
[ "def", "add_post", "(", "self", ",", "path", ":", "str", ",", "handler", ":", "_WebHandler", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "AbstractRoute", ":", "return", "self", ".", "add_route", "(", "hdrs", ".", "METH_POST", ",", "path", ",", "h...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/aiohttp_lib/aiohttp/web_urldispatcher.py#L1067-L1072
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/urllib3/contrib/pyopenssl.py
python
_verify_callback
(cnx, x509, err_no, err_depth, return_code)
return err_no == 0
[]
def _verify_callback(cnx, x509, err_no, err_depth, return_code): return err_no == 0
[ "def", "_verify_callback", "(", "cnx", ",", "x509", ",", "err_no", ",", "err_depth", ",", "return_code", ")", ":", "return", "err_no", "==", "0" ]
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/urllib3/contrib/pyopenssl.py#L510-L511
NordicSemiconductor/pc-nrfutil
d08e742128f2a3dac522601bc6b9f9b2b63952df
nordicsemi/thread/ncp_flasher.py
python
NCPFlasher.verify
(self, path)
return self.call_cmd(args)
[]
def verify(self, path): args = ['--verify', path] return self.call_cmd(args)
[ "def", "verify", "(", "self", ",", "path", ")", ":", "args", "=", "[", "'--verify'", ",", "path", "]", "return", "self", ".", "call_cmd", "(", "args", ")" ]
https://github.com/NordicSemiconductor/pc-nrfutil/blob/d08e742128f2a3dac522601bc6b9f9b2b63952df/nordicsemi/thread/ncp_flasher.py#L50-L52
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/research_projects/longform-qa/eli5_utils.py
python
embed_passages_for_retrieval
(passages, tokenizer, qa_embedder, max_length=128, device="cuda:0")
return a_reps.numpy()
[]
def embed_passages_for_retrieval(passages, tokenizer, qa_embedder, max_length=128, device="cuda:0"): a_toks = tokenizer(passages, max_length=max_length, padding="max_length", truncation=True) a_ids, a_mask = ( torch.LongTensor(a_toks["input_ids"]).to(device), torch.LongTensor(a_toks["attention_m...
[ "def", "embed_passages_for_retrieval", "(", "passages", ",", "tokenizer", ",", "qa_embedder", ",", "max_length", "=", "128", ",", "device", "=", "\"cuda:0\"", ")", ":", "a_toks", "=", "tokenizer", "(", "passages", ",", "max_length", "=", "max_length", ",", "pa...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/longform-qa/eli5_utils.py#L568-L576
CGATOxford/cgat
326aad4694bdfae8ddc194171bb5d73911243947
obsolete/pipeline_vitaminD.py
python
runBioProspector
( infiles, outfile )
run bioprospector for motif discovery. Bioprospector is run on only the top 10% of peaks.
run bioprospector for motif discovery.
[ "run", "bioprospector", "for", "motif", "discovery", "." ]
def runBioProspector( infiles, outfile ): '''run bioprospector for motif discovery. Bioprospector is run on only the top 10% of peaks. ''' to_cluster = True # only use new nodes, as /bin/csh is not installed # on the old ones. job_options = "-l mem_free=8000M" tmpfasta = P.getTempFile...
[ "def", "runBioProspector", "(", "infiles", ",", "outfile", ")", ":", "to_cluster", "=", "True", "# only use new nodes, as /bin/csh is not installed", "# on the old ones.", "job_options", "=", "\"-l mem_free=8000M\"", "tmpfasta", "=", "P", ".", "getTempFilename", "(", "\"....
https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/obsolete/pipeline_vitaminD.py#L3724-L3748
dib-lab/khmer
fb65d21eaedf0d397d49ae3debc578897f9d6eb4
khmer/_version.py
python
git_get_keywords
(versionfile_abs)
return keywords
Extract version information from the given file.
Extract version information from the given file.
[ "Extract", "version", "information", "from", "the", "given", "file", "." ]
def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from...
[ "def", "git_get_keywords", "(", "versionfile_abs", ")", ":", "# the code embedded in _version.py can just fetch the value of these", "# keywords. When used from setup.py, we don't want to import _version.py,", "# so we do it with a regexp instead. This function is not used from", "# _version.py.",...
https://github.com/dib-lab/khmer/blob/fb65d21eaedf0d397d49ae3debc578897f9d6eb4/khmer/_version.py#L133-L158
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractSkinnarviksbergetWordpressCom.py
python
extractSkinnarviksbergetWordpressCom
(item)
return False
Parser for 'skinnarviksberget.wordpress.com'
Parser for 'skinnarviksberget.wordpress.com'
[ "Parser", "for", "skinnarviksberget", ".", "wordpress", ".", "com" ]
def extractSkinnarviksbergetWordpressCom(item): ''' Parser for 'skinnarviksberget.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None if item['tags'] == ['未分类']: titlemap = [ ('Sinister Ex-Girl...
[ "def", "extractSkinnarviksbergetWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractSkinnarviksbergetWordpressCom.py#L1-L38
ArunMichaelDsouza/tensorflow-image-detection
cbc4afd9bb9dfe26e6a2a6fa8a823bf556aa2367
retrain.py
python
add_input_distortions
(flip_left_right, random_crop, random_scale, random_brightness)
return jpeg_data, distort_result
Creates the operations to apply the specified distortions. During training it can help to improve the results if we run the images through simple distortions like crops, scales, and flips. These reflect the kind of variations we expect in the real world, and so can help train the model to cope with natural dat...
Creates the operations to apply the specified distortions.
[ "Creates", "the", "operations", "to", "apply", "the", "specified", "distortions", "." ]
def add_input_distortions(flip_left_right, random_crop, random_scale, random_brightness): """Creates the operations to apply the specified distortions. During training it can help to improve the results if we run the images through simple distortions like crops, scales, and flips. These...
[ "def", "add_input_distortions", "(", "flip_left_right", ",", "random_crop", ",", "random_scale", ",", "random_brightness", ")", ":", "jpeg_data", "=", "tf", ".", "placeholder", "(", "tf", ".", "string", ",", "name", "=", "'DistortJPGInput'", ")", "decoded_image", ...
https://github.com/ArunMichaelDsouza/tensorflow-image-detection/blob/cbc4afd9bb9dfe26e6a2a6fa8a823bf556aa2367/retrain.py#L614-L700
yahoo/open_nsfw
a4e13931465f4380742545932657eeea0a10aa48
classify_nsfw.py
python
caffe_preprocess_and_compute
(pimg, caffe_transformer=None, caffe_net=None, output_layers=None)
Run a Caffe network on an input image after preprocessing it to prepare it for Caffe. :param PIL.Image pimg: PIL image to be input into Caffe. :param caffe.Net caffe_net: A Caffe network with which to process pimg afrer preprocessing. :param list output_layers: A list of the name...
Run a Caffe network on an input image after preprocessing it to prepare it for Caffe. :param PIL.Image pimg: PIL image to be input into Caffe. :param caffe.Net caffe_net: A Caffe network with which to process pimg afrer preprocessing. :param list output_layers: A list of the name...
[ "Run", "a", "Caffe", "network", "on", "an", "input", "image", "after", "preprocessing", "it", "to", "prepare", "it", "for", "Caffe", ".", ":", "param", "PIL", ".", "Image", "pimg", ":", "PIL", "image", "to", "be", "input", "into", "Caffe", ".", ":", ...
def caffe_preprocess_and_compute(pimg, caffe_transformer=None, caffe_net=None, output_layers=None): """ Run a Caffe network on an input image after preprocessing it to prepare it for Caffe. :param PIL.Image pimg: PIL image to be input into Caffe. :param caffe.Net caffe_net: A Caf...
[ "def", "caffe_preprocess_and_compute", "(", "pimg", ",", "caffe_transformer", "=", "None", ",", "caffe_net", "=", "None", ",", "output_layers", "=", "None", ")", ":", "if", "caffe_net", "is", "not", "None", ":", "# Grab the default output names if none were requested ...
https://github.com/yahoo/open_nsfw/blob/a4e13931465f4380742545932657eeea0a10aa48/classify_nsfw.py#L40-L80
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/functions/other.py
python
Function_cases._print_latex_
(self, l, **kwargs)
return str[:-2] + r"\end{cases}"
r""" EXAMPLES:: sage: ex = cases([(x==0, pi), (True, 0)]); ex cases(((x == 0, pi), (1, 0))) sage: latex(ex) \begin{cases}{\pi} & {x = 0}\\{0} & {1}\end{cases} TESTS: Verify that :trac:`25624` is fixed:: sage: L = latex(cases([(x == ...
r""" EXAMPLES::
[ "r", "EXAMPLES", "::" ]
def _print_latex_(self, l, **kwargs): r""" EXAMPLES:: sage: ex = cases([(x==0, pi), (True, 0)]); ex cases(((x == 0, pi), (1, 0))) sage: latex(ex) \begin{cases}{\pi} & {x = 0}\\{0} & {1}\end{cases} TESTS: Verify that :trac:`25624` is fixe...
[ "def", "_print_latex_", "(", "self", ",", "l", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "l", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "ValueError", "(", "\"cases() argument must be a list\"", ")", "str", "=", "r...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/functions/other.py#L2007-L2034
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/xpath.py
python
IsErrorResponse.__reduce__
(self)
return self.__class__, (self.vuln_obj, None, self.use_difflib)
@see: Shell.__reduce__ to understand why this is required.
[]
def __reduce__(self): """ @see: Shell.__reduce__ to understand why this is required. """ return self.__class__, (self.vuln_obj, None, self.use_difflib)
[ "def", "__reduce__", "(", "self", ")", ":", "return", "self", ".", "__class__", ",", "(", "self", ".", "vuln_obj", ",", "None", ",", "self", ".", "use_difflib", ")" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/xpath.py#L476-L480
log2timeline/plaso
fe2e316b8c76a0141760c0f2f181d84acb83abc2
plaso/formatters/interface.py
python
ConditionalEventFormatter.GetMessageShort
(self, event_values)
return short_message_string
Determines the short message. Args: event_values (dict[str, object]): event values. Returns: str: short message.
Determines the short message.
[ "Determines", "the", "short", "message", "." ]
def GetMessageShort(self, event_values): """Determines the short message. Args: event_values (dict[str, object]): event values. Returns: str: short message. """ if not self._format_string_pieces_map: self._CreateFormatStringMaps() if (self._format_string_short_pieces and ...
[ "def", "GetMessageShort", "(", "self", ",", "event_values", ")", ":", "if", "not", "self", ".", "_format_string_pieces_map", ":", "self", ".", "_CreateFormatStringMaps", "(", ")", "if", "(", "self", ".", "_format_string_short_pieces", "and", "self", ".", "_forma...
https://github.com/log2timeline/plaso/blob/fe2e316b8c76a0141760c0f2f181d84acb83abc2/plaso/formatters/interface.py#L558-L585
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/html2text.py
python
google_list_style
(style)
return 'ol'
finds out whether this is an ordered or unordered list
finds out whether this is an ordered or unordered list
[ "finds", "out", "whether", "this", "is", "an", "ordered", "or", "unordered", "list" ]
def google_list_style(style): """finds out whether this is an ordered or unordered list""" if 'list-style-type' in style: list_style = style['list-style-type'] if list_style in ['disc', 'circle', 'square', 'none']: return 'ul' return 'ol'
[ "def", "google_list_style", "(", "style", ")", ":", "if", "'list-style-type'", "in", "style", ":", "list_style", "=", "style", "[", "'list-style-type'", "]", "if", "list_style", "in", "[", "'disc'", ",", "'circle'", ",", "'square'", ",", "'none'", "]", ":", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/html2text.py#L150-L156
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/matrices/common.py
python
MatrixProperties.is_symbolic
(self)
return self._eval_is_symbolic()
Checks if any elements contain Symbols. Examples ======== >>> from sympy.matrices import Matrix >>> from sympy.abc import x, y >>> M = Matrix([[x, y], [1, 0]]) >>> M.is_symbolic() True
Checks if any elements contain Symbols.
[ "Checks", "if", "any", "elements", "contain", "Symbols", "." ]
def is_symbolic(self): """Checks if any elements contain Symbols. Examples ======== >>> from sympy.matrices import Matrix >>> from sympy.abc import x, y >>> M = Matrix([[x, y], [1, 0]]) >>> M.is_symbolic() True """ return self._eval_is_s...
[ "def", "is_symbolic", "(", "self", ")", ":", "return", "self", ".", "_eval_is_symbolic", "(", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/matrices/common.py#L1467-L1480
tribe29/checkmk
6260f2512e159e311f426e16b84b19d0b8e9ad0c
cmk/gui/plugins/openapi/restful_objects/decorators.py
python
_verify_parameters
( path: str, path_schema: Optional[Type[Schema]], )
Verifies matching of parameters to the placeholders used in an URL-Template This works both ways, ensuring that no parameter is supplied which is then not used and that each template-variable in the URL-template has a corresponding parameter supplied, either globally or locally. Args: path: ...
Verifies matching of parameters to the placeholders used in an URL-Template
[ "Verifies", "matching", "of", "parameters", "to", "the", "placeholders", "used", "in", "an", "URL", "-", "Template" ]
def _verify_parameters( path: str, path_schema: Optional[Type[Schema]], ): """Verifies matching of parameters to the placeholders used in an URL-Template This works both ways, ensuring that no parameter is supplied which is then not used and that each template-variable in the URL-template has a cor...
[ "def", "_verify_parameters", "(", "path", ":", "str", ",", "path_schema", ":", "Optional", "[", "Type", "[", "Schema", "]", "]", ",", ")", ":", "if", "path_schema", "is", "None", ":", "schema_params", "=", "set", "(", ")", "else", ":", "schema", "=", ...
https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/plugins/openapi/restful_objects/decorators.py#L900-L965
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
telegram/ext/picklepersistence.py
python
PicklePersistence.update_chat_data
(self, chat_id: int, data: CD)
Will update the chat_data and depending on :attr:`on_flush` save the pickle file. Args: chat_id (:obj:`int`): The chat the data might have been changed for. data (:class:`telegram.ext.utils.types.CD`): The :attr:`telegram.ext.Dispatcher.chat_data` ``[chat_id]``.
Will update the chat_data and depending on :attr:`on_flush` save the pickle file.
[ "Will", "update", "the", "chat_data", "and", "depending", "on", ":", "attr", ":", "on_flush", "save", "the", "pickle", "file", "." ]
def update_chat_data(self, chat_id: int, data: CD) -> None: """Will update the chat_data and depending on :attr:`on_flush` save the pickle file. Args: chat_id (:obj:`int`): The chat the data might have been changed for. data (:class:`telegram.ext.utils.types.CD`): The ...
[ "def", "update_chat_data", "(", "self", ",", "chat_id", ":", "int", ",", "data", ":", "CD", ")", "->", "None", ":", "if", "self", ".", "chat_data", "is", "None", ":", "self", ".", "chat_data", "=", "defaultdict", "(", "self", ".", "context_types", ".",...
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/ext/picklepersistence.py#L364-L382
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/pip/baseparser.py
python
ConfigOptionParser._update_defaults
(self, defaults)
return defaults
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).
[ "Updates", "the", "given", "defaults", "with", "values", "from", "the", "config", "files", "and", "the", "environ", ".", "Does", "a", "little", "special", "handling", "for", "certain", "types", "of", "options", "(", "lists", ")", "." ]
def _update_defaults(self, defaults): """Updates the given defaults with values from the config files and the environ. Does a little special handling for certain types of options (lists).""" # Then go and look for the other sources of configuration: config = {} # 1. confi...
[ "def", "_update_defaults", "(", "self", ",", "defaults", ")", ":", "# Then go and look for the other sources of configuration:", "config", "=", "{", "}", "# 1. config files", "for", "section", "in", "(", "'global'", ",", "self", ".", "name", ")", ":", "config", "....
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/baseparser.py#L198-L249
simetenn/uncertainpy
ffb2400289743066265b9a8561cdf3b72e478a28
src/uncertainpy/plotting/plot_uncertainty.py
python
PlotUncertainty.plot_all_sensitivities
(self)
Plot the results for all model/features, with all sensitivities. Raises ------ ValueError If a Datafile is not loaded.
Plot the results for all model/features, with all sensitivities.
[ "Plot", "the", "results", "for", "all", "model", "/", "features", "with", "all", "sensitivities", "." ]
def plot_all_sensitivities(self): """ Plot the results for all model/features, with all sensitivities. Raises ------ ValueError If a Datafile is not loaded. """ if self.data is None: raise ValueError("Datafile must be loaded.") se...
[ "def", "plot_all_sensitivities", "(", "self", ")", ":", "if", "self", ".", "data", "is", "None", ":", "raise", "ValueError", "(", "\"Datafile must be loaded.\"", ")", "self", ".", "plot_all", "(", "sensitivity", "=", "\"first\"", ")", "for", "feature", "in", ...
https://github.com/simetenn/uncertainpy/blob/ffb2400289743066265b9a8561cdf3b72e478a28/src/uncertainpy/plotting/plot_uncertainty.py#L1722-L1745
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py
python
MacroFunction.completemacro
(self, macro)
Complete the macro with the parameters read.
Complete the macro with the parameters read.
[ "Complete", "the", "macro", "with", "the", "parameters", "read", "." ]
def completemacro(self, macro): "Complete the macro with the parameters read." self.contents = [macro.instantiate()] replaced = [False] * len(self.values) for parameter in self.searchall(MacroParameter): index = parameter.number - 1 if index >= len(self.values): Trace.error('Macro pa...
[ "def", "completemacro", "(", "self", ",", "macro", ")", ":", "self", ".", "contents", "=", "[", "macro", ".", "instantiate", "(", ")", "]", "replaced", "=", "[", "False", "]", "*", "len", "(", "self", ".", "values", ")", "for", "parameter", "in", "...
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/docutils/utils/math/math2html.py#L5189-L5202
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py
python
isSharpCorner
( beginComplex, centerComplex, endComplex )
return euclidean.getDotProduct( centerBeginComplex, centerEndComplex ) > 0.9
Determine if the three complex points form a sharp corner.
Determine if the three complex points form a sharp corner.
[ "Determine", "if", "the", "three", "complex", "points", "form", "a", "sharp", "corner", "." ]
def isSharpCorner( beginComplex, centerComplex, endComplex ): 'Determine if the three complex points form a sharp corner.' centerBeginComplex = beginComplex - centerComplex centerEndComplex = endComplex - centerComplex centerBeginLength = abs( centerBeginComplex ) centerEndLength = abs( centerEndComplex ) if cent...
[ "def", "isSharpCorner", "(", "beginComplex", ",", "centerComplex", ",", "endComplex", ")", ":", "centerBeginComplex", "=", "beginComplex", "-", "centerComplex", "centerEndComplex", "=", "endComplex", "-", "centerComplex", "centerBeginLength", "=", "abs", "(", "centerB...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L674-L684
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
xtune/src/transformers/data/processors/xglue.py
python
NcProcessor.get_labels
(self)
return ['foodanddrink', 'sports', 'news', 'entertainment', 'health', 'video', 'finance', 'travel', 'lifestyle', 'autos']
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_labels(self): """See base class.""" return ['foodanddrink', 'sports', 'news', 'entertainment', 'health', 'video', 'finance', 'travel', 'lifestyle', 'autos']
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "'foodanddrink'", ",", "'sports'", ",", "'news'", ",", "'entertainment'", ",", "'health'", ",", "'video'", ",", "'finance'", ",", "'travel'", ",", "'lifestyle'", ",", "'autos'", "]" ]
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/data/processors/xglue.py#L850-L853
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/downloader.py
python
downloader.down
(self)
[]
def down(self): if os.path.exists(self.dir+"/"+self.filename): pass else: try: urllib.urlretrieve(self.url,self.dir+"/"+self.filename) except: print "Error downloading " + self.url self.filename=""
[ "def", "down", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "dir", "+", "\"/\"", "+", "self", ".", "filename", ")", ":", "pass", "else", ":", "try", ":", "urllib", ".", "urlretrieve", "(", "self", ".", "url", ...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/downloader.py#L9-L17
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/mailbox.py
python
Mailbox.__delitem__
(self, key)
[]
def __delitem__(self, key): self.remove(key)
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "self", ".", "remove", "(", "key", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/mailbox.py#L48-L49
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexing.py
python
_iLocIndexer._validate_integer
(self, key, axis)
Check that 'key' is a valid position in the desired axis. Parameters ---------- key : int Requested position axis : int Desired axis Returns ------- None Raises ------ IndexError If 'key' is not a vali...
Check that 'key' is a valid position in the desired axis.
[ "Check", "that", "key", "is", "a", "valid", "position", "in", "the", "desired", "axis", "." ]
def _validate_integer(self, key, axis): """ Check that 'key' is a valid position in the desired axis. Parameters ---------- key : int Requested position axis : int Desired axis Returns ------- None Raises ...
[ "def", "_validate_integer", "(", "self", ",", "key", ",", "axis", ")", ":", "len_axis", "=", "len", "(", "self", ".", "obj", ".", "_get_axis", "(", "axis", ")", ")", "if", "key", ">=", "len_axis", "or", "key", "<", "-", "len_axis", ":", "raise", "I...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/indexing.py#L2116-L2139
svpcom/wifibroadcast
51251b8c484b8c4f548aa3bbb1633e0edbb605dc
telemetry/mavlink.py
python
MAVLink.orbit_execution_status_send
(self, time_usec, radius, frame, x, y, z, force_mavlink1=False)
return self.send(self.orbit_execution_status_encode(time_usec, radius, frame, x, y, z), force_mavlink1=force_mavlink1)
Vehicle status report that is sent out while orbit execution is in progress (see MAV_CMD_DO_ORBIT). time_usec : Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the m...
Vehicle status report that is sent out while orbit execution is in progress (see MAV_CMD_DO_ORBIT).
[ "Vehicle", "status", "report", "that", "is", "sent", "out", "while", "orbit", "execution", "is", "in", "progress", "(", "see", "MAV_CMD_DO_ORBIT", ")", "." ]
def orbit_execution_status_send(self, time_usec, radius, frame, x, y, z, force_mavlink1=False): ''' Vehicle status report that is sent out while orbit execution is in progress (see MAV_CMD_DO_ORBIT). time_usec : Timestamp (UNIX Epoch time ...
[ "def", "orbit_execution_status_send", "(", "self", ",", "time_usec", ",", "radius", ",", "frame", ",", "x", ",", "y", ",", "z", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "orbit_execution_status_encode", ...
https://github.com/svpcom/wifibroadcast/blob/51251b8c484b8c4f548aa3bbb1633e0edbb605dc/telemetry/mavlink.py#L29124-L29137
RaRe-Technologies/gensim
8b8203d8df354673732dff635283494a33d0d422
gensim/similarities/termsim.py
python
_normalize_sparse_corpus
(corpus, matrix, normalization)
return normalized_corpus
Normalize a sparse corpus after a change of basis. Parameters ---------- corpus : MxN :class:`scipy.sparse.csc_matrix` A sparse corpus. matrix : NxN :class:`scipy.sparse.csc_matrix` A change-of-basis matrix. normalization : {True, False, 'maintain'} Whether the vector will b...
Normalize a sparse corpus after a change of basis.
[ "Normalize", "a", "sparse", "corpus", "after", "a", "change", "of", "basis", "." ]
def _normalize_sparse_corpus(corpus, matrix, normalization): """Normalize a sparse corpus after a change of basis. Parameters ---------- corpus : MxN :class:`scipy.sparse.csc_matrix` A sparse corpus. matrix : NxN :class:`scipy.sparse.csc_matrix` A change-of-basis matrix. normali...
[ "def", "_normalize_sparse_corpus", "(", "corpus", ",", "matrix", ",", "normalization", ")", ":", "if", "not", "normalization", ":", "return", "corpus", "# use the following equality: np.diag(A.T.dot(B).dot(A)) == A.T.dot(B).multiply(A.T).sum(axis=1).T", "corpus_norm", "=", "cor...
https://github.com/RaRe-Technologies/gensim/blob/8b8203d8df354673732dff635283494a33d0d422/gensim/similarities/termsim.py#L387-L420
paramiko/paramiko
88f35a537428e430f7f26eee8026715e357b55d6
paramiko/util.py
python
lookup_ssh_host_config
(hostname, config)
return config.lookup(hostname)
Provided only as a backward-compatible wrapper around `.SSHConfig`.
Provided only as a backward-compatible wrapper around `.SSHConfig`.
[ "Provided", "only", "as", "a", "backward", "-", "compatible", "wrapper", "around", ".", "SSHConfig", "." ]
def lookup_ssh_host_config(hostname, config): """ Provided only as a backward-compatible wrapper around `.SSHConfig`. """ return config.lookup(hostname)
[ "def", "lookup_ssh_host_config", "(", "hostname", ",", "config", ")", ":", "return", "config", ".", "lookup", "(", "hostname", ")" ]
https://github.com/paramiko/paramiko/blob/88f35a537428e430f7f26eee8026715e357b55d6/paramiko/util.py#L206-L210
haiwen/seafile-docker
2d2461d4c8cab3458ec9832611c419d47506c300
scripts_8.0/setup-seafile-mysql.py
python
InvalidParams.__init__
(self, msg)
[]
def __init__(self, msg): Exception.__init__(self) self.msg = msg
[ "def", "__init__", "(", "self", ",", "msg", ")", ":", "Exception", ".", "__init__", "(", "self", ")", "self", ".", "msg", "=", "msg" ]
https://github.com/haiwen/seafile-docker/blob/2d2461d4c8cab3458ec9832611c419d47506c300/scripts_8.0/setup-seafile-mysql.py#L289-L291
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_pod_list.py
python
V1PodList.to_str
(self)
return pprint.pformat(self.to_dict())
Returns the string representation of the model
Returns the string representation of the model
[ "Returns", "the", "string", "representation", "of", "the", "model" ]
def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict())
[ "def", "to_str", "(", "self", ")", ":", "return", "pprint", ".", "pformat", "(", "self", ".", "to_dict", "(", ")", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_pod_list.py#L185-L187
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/objc/_properties.py
python
set_proxy.symmetric_difference_update
(self, other)
[]
def symmetric_difference_update(self, other): # NOTE: This method does not call the corresponding method # of the wrapped set to ensure that we generate the right # notifications. if self._ro: raise ValueError("Property '%s' is read-only"%(self._name,)) other = set(o...
[ "def", "symmetric_difference_update", "(", "self", ",", "other", ")", ":", "# NOTE: This method does not call the corresponding method", "# of the wrapped set to ensure that we generate the right", "# notifications.", "if", "self", ".", "_ro", ":", "raise", "ValueError", "(", "...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/objc/_properties.py#L919-L964
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pillow/PIL/Image.py
python
Image.rotate
(self, angle, resample=NEAREST, expand=0)
return self._new(self.im.rotate(angle, resample))
Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter clockwise around its centre. :param angle: In degrees counter clockwise. :param resample: An optional resampling filter. This can be one of :py:attr:`...
Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter clockwise around its centre.
[ "Returns", "a", "rotated", "copy", "of", "this", "image", ".", "This", "method", "returns", "a", "copy", "of", "this", "image", "rotated", "the", "given", "number", "of", "degrees", "counter", "clockwise", "around", "its", "centre", "." ]
def rotate(self, angle, resample=NEAREST, expand=0): """ Returns a rotated copy of this image. This method returns a copy of this image, rotated the given number of degrees counter clockwise around its centre. :param angle: In degrees counter clockwise. :param resample:...
[ "def", "rotate", "(", "self", ",", "angle", ",", "resample", "=", "NEAREST", ",", "expand", "=", "0", ")", ":", "if", "expand", ":", "import", "math", "angle", "=", "-", "angle", "*", "math", ".", "pi", "/", "180", "matrix", "=", "[", "math", "."...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pillow/PIL/Image.py#L1571-L1630
django/channels
6af1bc3ab45f55e3f47d0d1d059d5db0a18a9581
channels/generic/websocket.py
python
AsyncWebsocketConsumer.websocket_receive
(self, message)
Called when a WebSocket frame is received. Decodes it and passes it to receive().
Called when a WebSocket frame is received. Decodes it and passes it to receive().
[ "Called", "when", "a", "WebSocket", "frame", "is", "received", ".", "Decodes", "it", "and", "passes", "it", "to", "receive", "()", "." ]
async def websocket_receive(self, message): """ Called when a WebSocket frame is received. Decodes it and passes it to receive(). """ if "text" in message: await self.receive(text_data=message["text"]) else: await self.receive(bytes_data=message["b...
[ "async", "def", "websocket_receive", "(", "self", ",", "message", ")", ":", "if", "\"text\"", "in", "message", ":", "await", "self", ".", "receive", "(", "text_data", "=", "message", "[", "\"text\"", "]", ")", "else", ":", "await", "self", ".", "receive"...
https://github.com/django/channels/blob/6af1bc3ab45f55e3f47d0d1d059d5db0a18a9581/channels/generic/websocket.py#L188-L196
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractImemotranslationsCom.py
python
extractImemotranslationsCom
(item)
return False
Parser for 'imemotranslations.com'
Parser for 'imemotranslations.com'
[ "Parser", "for", "imemotranslations", ".", "com" ]
def extractImemotranslationsCom(item): ''' Parser for 'imemotranslations.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Hone to Issho', 'Hone to Issho no Isekai Seikatsu', ...
[ "def", "extractImemotranslationsCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"", "in...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractImemotranslationsCom.py#L1-L21
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pandas/core/groupby.py
python
Grouper._get_grouper
(self, obj)
return self.binner, self.grouper, self.obj
Parameters ---------- obj : the subject object Returns ------- a tuple of binner, grouper, obj (possibly sorted)
Parameters ---------- obj : the subject object
[ "Parameters", "----------", "obj", ":", "the", "subject", "object" ]
def _get_grouper(self, obj): """ Parameters ---------- obj : the subject object Returns ------- a tuple of binner, grouper, obj (possibly sorted) """ self._set_grouper(obj) self.grouper, exclusions, self.obj = _get_grouper(self.obj, [self...
[ "def", "_get_grouper", "(", "self", ",", "obj", ")", ":", "self", ".", "_set_grouper", "(", "obj", ")", "self", ".", "grouper", ",", "exclusions", ",", "self", ".", "obj", "=", "_get_grouper", "(", "self", ".", "obj", ",", "[", "self", ".", "key", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/core/groupby.py#L234-L250
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/helpers/entity_registry.py
python
EntityRegistry.async_clear_area_id
(self, area_id: str)
Clear area id from registry entries.
Clear area id from registry entries.
[ "Clear", "area", "id", "from", "registry", "entries", "." ]
def async_clear_area_id(self, area_id: str) -> None: """Clear area id from registry entries.""" for entity_id, entry in self.entities.items(): if area_id == entry.area_id: self.async_update_entity(entity_id, area_id=None)
[ "def", "async_clear_area_id", "(", "self", ",", "area_id", ":", "str", ")", "->", "None", ":", "for", "entity_id", ",", "entry", "in", "self", ".", "entities", ".", "items", "(", ")", ":", "if", "area_id", "==", "entry", ".", "area_id", ":", "self", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/helpers/entity_registry.py#L656-L660
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/wireless/rate_plan.py
python
RatePlanPage.get_instance
(self, payload)
return RatePlanInstance(self._version, payload, )
Build an instance of RatePlanInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance
Build an instance of RatePlanInstance
[ "Build", "an", "instance", "of", "RatePlanInstance" ]
def get_instance(self, payload): """ Build an instance of RatePlanInstance :param dict payload: Payload response from the API :returns: twilio.rest.preview.wireless.rate_plan.RatePlanInstance :rtype: twilio.rest.preview.wireless.rate_plan.RatePlanInstance """ re...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "RatePlanInstance", "(", "self", ".", "_version", ",", "payload", ",", ")" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/wireless/rate_plan.py#L207-L216
adobe/ops-cli
2384257c4199b3ff37e366f48b4dfce3ac282524
src/ops/terraform/terraform_cmd_generator.py
python
TerraformCommandGenerator.set_current_working_dir
(self)
[]
def set_current_working_dir(self): os.chdir(self.root_dir)
[ "def", "set_current_working_dir", "(", "self", ")", ":", "os", ".", "chdir", "(", "self", ".", "root_dir", ")" ]
https://github.com/adobe/ops-cli/blob/2384257c4199b3ff37e366f48b4dfce3ac282524/src/ops/terraform/terraform_cmd_generator.py#L501-L502
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/feedparser.py
python
_MicroformatsParser.normalize
(self, s)
return re.sub(r'\s+', ' ', s).strip()
[]
def normalize(self, s): return re.sub(r'\s+', ' ', s).strip()
[ "def", "normalize", "(", "self", ",", "s", ")", ":", "return", "re", ".", "sub", "(", "r'\\s+'", ",", "' '", ",", "s", ")", ".", "strip", "(", ")" ]
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/feedparser.py#L2052-L2053
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python3-alpha/python-libs/gdata/apps/emailsettings/data.py
python
EmailSettingsSendAsAlias.__init__
(self, uri=None, name=None, address=None, reply_to=None, make_default=None, *args, **kwargs)
Constructs a new EmailSettingsSendAsAlias object with the given arguments. Args: uri: string (optional) The uri f this object for HTTP requests. name: string (optional) The name that will appear in the "From" field for this user. address: string (optional) The email address tha...
Constructs a new EmailSettingsSendAsAlias object with the given arguments.
[ "Constructs", "a", "new", "EmailSettingsSendAsAlias", "object", "with", "the", "given", "arguments", "." ]
def __init__(self, uri=None, name=None, address=None, reply_to=None, make_default=None, *args, **kwargs): """Constructs a new EmailSettingsSendAsAlias object with the given arguments. Args: uri: string (optional) The uri f this object for HTTP requests. name: string (optional) The name t...
[ "def", "__init__", "(", "self", ",", "uri", "=", "None", ",", "name", "=", "None", ",", "address", "=", "None", ",", "reply_to", "=", "None", ",", "make_default", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Em...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/gdata/apps/emailsettings/data.py#L529-L557
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/chat/v2/credential.py
python
CredentialInstance.update
(self, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset)
return self._proxy.update( friendly_name=friendly_name, certificate=certificate, private_key=private_key, sandbox=sandbox, api_key=api_key, secret=secret, )
Update the CredentialInstance :param unicode friendly_name: A string to describe the resource :param unicode certificate: [APN only] The URL encoded representation of the certificate :param unicode private_key: [APN only] The URL encoded representation of the private key :param bool san...
Update the CredentialInstance
[ "Update", "the", "CredentialInstance" ]
def update(self, friendly_name=values.unset, certificate=values.unset, private_key=values.unset, sandbox=values.unset, api_key=values.unset, secret=values.unset): """ Update the CredentialInstance :param unicode friendly_name: A string to describe the resource ...
[ "def", "update", "(", "self", ",", "friendly_name", "=", "values", ".", "unset", ",", "certificate", "=", "values", ".", "unset", ",", "private_key", "=", "values", ".", "unset", ",", "sandbox", "=", "values", ".", "unset", ",", "api_key", "=", "values",...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/chat/v2/credential.py#L408-L431
cylc/cylc-flow
5ec221143476c7c616c156b74158edfbcd83794a
cylc/flow/network/publisher.py
python
WorkflowPublisher.__init__
(self, workflow, context=None, barrier=None, threaded=True, daemon=False)
[]
def __init__(self, workflow, context=None, barrier=None, threaded=True, daemon=False): super().__init__(zmq.PUB, bind=True, context=context, barrier=barrier, threaded=threaded, daemon=daemon) self.workflow = workflow self.topics = set()
[ "def", "__init__", "(", "self", ",", "workflow", ",", "context", "=", "None", ",", "barrier", "=", "None", ",", "threaded", "=", "True", ",", "daemon", "=", "False", ")", ":", "super", "(", ")", ".", "__init__", "(", "zmq", ".", "PUB", ",", "bind",...
https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/network/publisher.py#L53-L58
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/scipy/optimize/nonlin.py
python
LowRankMatrix.restart_reduce
(self, rank)
Reduce the rank of the matrix by dropping all vectors.
Reduce the rank of the matrix by dropping all vectors.
[ "Reduce", "the", "rank", "of", "the", "matrix", "by", "dropping", "all", "vectors", "." ]
def restart_reduce(self, rank): """ Reduce the rank of the matrix by dropping all vectors. """ if self.collapsed is not None: return assert rank > 0 if len(self.cs) > rank: del self.cs[:] del self.ds[:]
[ "def", "restart_reduce", "(", "self", ",", "rank", ")", ":", "if", "self", ".", "collapsed", "is", "not", "None", ":", "return", "assert", "rank", ">", "0", "if", "len", "(", "self", ".", "cs", ")", ">", "rank", ":", "del", "self", ".", "cs", "["...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/optimize/nonlin.py#L798-L807
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/sqlalchemy/sql/expression.py
python
extract
(field, expr)
return _Extract(field, expr)
Return the clause ``extract(field FROM expr)``.
Return the clause ``extract(field FROM expr)``.
[ "Return", "the", "clause", "extract", "(", "field", "FROM", "expr", ")", "." ]
def extract(field, expr): """Return the clause ``extract(field FROM expr)``.""" return _Extract(field, expr)
[ "def", "extract", "(", "field", ",", "expr", ")", ":", "return", "_Extract", "(", "field", ",", "expr", ")" ]
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/sql/expression.py#L623-L626
buildbot/buildbot
b9c558217c72e4c2463eedc7ec6d56736f7b01a8
master/buildbot/util/__init__.py
python
flattened_iterator
(l, types=(list, tuple))
Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting that returns every individual non-list/tuple element. In other words, # [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]] will yield 5, 6, 8, 3, 2, 2, 1, 3, 4 This is safe to call on something not a list/tuple - the original i...
Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting that returns every individual non-list/tuple element. In other words, # [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]] will yield 5, 6, 8, 3, 2, 2, 1, 3, 4
[ "Generator", "for", "a", "list", "/", "tuple", "that", "potentially", "contains", "nested", "/", "lists", "/", "tuples", "of", "arbitrary", "nesting", "that", "returns", "every", "individual", "non", "-", "list", "/", "tuple", "element", ".", "In", "other", ...
def flattened_iterator(l, types=(list, tuple)): """ Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting that returns every individual non-list/tuple element. In other words, # [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]] will yield 5, 6, 8, 3, 2, 2, 1, 3, 4 This is...
[ "def", "flattened_iterator", "(", "l", ",", "types", "=", "(", "list", ",", "tuple", ")", ")", ":", "if", "not", "isinstance", "(", "l", ",", "types", ")", ":", "yield", "l", "return", "for", "element", "in", "l", ":", "for", "sub_element", "in", "...
https://github.com/buildbot/buildbot/blob/b9c558217c72e4c2463eedc7ec6d56736f7b01a8/master/buildbot/util/__init__.py#L60-L74
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/workingdirectory/plugin.py
python
WorkingDirectory.load_history
(self, workdir=None)
return history
Load history from a text file located in Spyder configuration folder or use `workdir` if there are no directories saved yet. Parameters ---------- workdir: str The working directory to return. Default is None.
Load history from a text file located in Spyder configuration folder or use `workdir` if there are no directories saved yet.
[ "Load", "history", "from", "a", "text", "file", "located", "in", "Spyder", "configuration", "folder", "or", "use", "workdir", "if", "there", "are", "no", "directories", "saved", "yet", "." ]
def load_history(self, workdir=None): """ Load history from a text file located in Spyder configuration folder or use `workdir` if there are no directories saved yet. Parameters ---------- workdir: str The working directory to return. Default is None. ...
[ "def", "load_history", "(", "self", ",", "workdir", "=", "None", ")", ":", "if", "osp", ".", "isfile", "(", "self", ".", "LOG_PATH", ")", ":", "history", ",", "_", "=", "encoding", ".", "readlines", "(", "self", ".", "LOG_PATH", ")", "history", "=", ...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/workingdirectory/plugin.py#L190-L209
mystor/git-revise
c06c8003870c776376e5f7bc4dd9f4dc97714b7c
gitrevise/odb.py
python
Signature.signing_key
(self)
return match.group("signing_key").strip()
user name <email>
user name <email>
[ "user", "name", "<email", ">" ]
def signing_key(self) -> bytes: """user name <email>""" match = self.sig_re.fullmatch(self) assert match, "invalid signature" return match.group("signing_key").strip()
[ "def", "signing_key", "(", "self", ")", "->", "bytes", ":", "match", "=", "self", ".", "sig_re", ".", "fullmatch", "(", "self", ")", "assert", "match", ",", "\"invalid signature\"", "return", "match", ".", "group", "(", "\"signing_key\"", ")", ".", "strip"...
https://github.com/mystor/git-revise/blob/c06c8003870c776376e5f7bc4dd9f4dc97714b7c/gitrevise/odb.py#L118-L122
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/threading.py
python
_BoundedSemaphore.release
(self)
Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. If the number of releases exceeds the number of acquires, raise a ValueError.
Release a semaphore, incrementing the internal counter by one.
[ "Release", "a", "semaphore", "incrementing", "the", "internal", "counter", "by", "one", "." ]
def release(self): """Release a semaphore, incrementing the internal counter by one. When the counter is zero on entry and another thread is waiting for it to become larger than zero again, wake up that thread. If the number of releases exceeds the number of acquires, raise a V...
[ "def", "release", "(", "self", ")", ":", "with", "self", ".", "_Semaphore__cond", ":", "if", "self", ".", "_Semaphore__value", ">=", "self", ".", "_initial_value", ":", "raise", "ValueError", "(", "\"Semaphore released too many times\"", ")", "self", ".", "_Sema...
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/threading.py#L525-L539
tensorflow/lingvo
ce10019243d954c3c3ebe739f7589b5eebfdf907
lingvo/jax/optimizers.py
python
_ShardedAdamHelper.bias_corrected_decay
(self, step: JTensor, decay: float)
return decay * (1. - jnp.power(decay, t - 1.)) / (1. - jnp.power(decay, t))
Incorporates bias correction into decay. Please see section 7.1 in https://arxiv.org/pdf/1804.04235.pdf for the derivation of the formulas below. With bias-corrected decay, we can simply do m_{t} = decay1 * m_{t-1} + (1 - decay1) * g v_{t} = decay2 * v_{t-1} + (1 - decay2) * g ^ 2 without fur...
Incorporates bias correction into decay.
[ "Incorporates", "bias", "correction", "into", "decay", "." ]
def bias_corrected_decay(self, step: JTensor, decay: float) -> JTensor: """Incorporates bias correction into decay. Please see section 7.1 in https://arxiv.org/pdf/1804.04235.pdf for the derivation of the formulas below. With bias-corrected decay, we can simply do m_{t} = decay1 * m_{t-1} + (1 - d...
[ "def", "bias_corrected_decay", "(", "self", ",", "step", ":", "JTensor", ",", "decay", ":", "float", ")", "->", "JTensor", ":", "t", "=", "step", ".", "astype", "(", "jnp", ".", "float32", ")", "+", "1.", "return", "decay", "*", "(", "1.", "-", "jn...
https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/jax/optimizers.py#L159-L180
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/route53/zone.py
python
Zone.add_a
(self, name, value, ttl=None, identifier=None, comment="")
return self.add_record(resource_type='A', name=name, value=value, ttl=ttl, identifier=identifier, comment=comment)
Add a new A record to this Zone. See _new_record for parameter documentation. Returns a Status object.
Add a new A record to this Zone. See _new_record for parameter documentation. Returns a Status object.
[ "Add", "a", "new", "A", "record", "to", "this", "Zone", ".", "See", "_new_record", "for", "parameter", "documentation", ".", "Returns", "a", "Status", "object", "." ]
def add_a(self, name, value, ttl=None, identifier=None, comment=""): """ Add a new A record to this Zone. See _new_record for parameter documentation. Returns a Status object. """ ttl = ttl or default_ttl name = self.route53connection._make_qualified(name) retur...
[ "def", "add_a", "(", "self", ",", "name", ",", "value", ",", "ttl", "=", "None", ",", "identifier", "=", "None", ",", "comment", "=", "\"\"", ")", ":", "ttl", "=", "ttl", "or", "default_ttl", "name", "=", "self", ".", "route53connection", ".", "_make...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/route53/zone.py#L173-L185
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v1_delete_options.py
python
V1DeleteOptions.api_version
(self)
return self._api_version
Gets the api_version of this V1DeleteOptions. # noqa: E501 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/sig-arc...
Gets the api_version of this V1DeleteOptions. # noqa: E501
[ "Gets", "the", "api_version", "of", "this", "V1DeleteOptions", ".", "#", "noqa", ":", "E501" ]
def api_version(self): """Gets the api_version of this V1DeleteOptions. # noqa: E501 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/co...
[ "def", "api_version", "(", "self", ")", ":", "return", "self", ".", "_api_version" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_delete_options.py#L86-L94
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/bdf/cards/aero/aero.py
python
AELINK.cross_reference
(self, model: BDF)
We're simply going to validate the labels
We're simply going to validate the labels
[ "We", "re", "simply", "going", "to", "validate", "the", "labels" ]
def cross_reference(self, model: BDF) -> None: """We're simply going to validate the labels""" sid_ref = model.trims[self.aelink_id] independent_label_ref = model.AESurf(self.label, msg=f'which is required by {str(self)}')
[ "def", "cross_reference", "(", "self", ",", "model", ":", "BDF", ")", "->", "None", ":", "sid_ref", "=", "model", ".", "trims", "[", "self", ".", "aelink_id", "]", "independent_label_ref", "=", "model", ".", "AESurf", "(", "self", ".", "label", ",", "m...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/aero/aero.py#L554-L557
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py
python
Yedit.get_curr_value
(invalue, val_type)
return curr_value
return the current value
return the current value
[ "return", "the", "current", "value" ]
def get_curr_value(invalue, val_type): '''return the current value''' if invalue is None: return None curr_value = invalue if val_type == 'yaml': try: # AUDIT:maybe-no-member makes sense due to different yaml libraries # pylint: di...
[ "def", "get_curr_value", "(", "invalue", ",", "val_type", ")", ":", "if", "invalue", "is", "None", ":", "return", "None", "curr_value", "=", "invalue", "if", "val_type", "==", "'yaml'", ":", "try", ":", "# AUDIT:maybe-no-member makes sense due to different yaml libr...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_pvc.py#L671-L687
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/matlib.py
python
empty
(shape, dtype=None, order='C')
return ndarray.__new__(matrix, shape, dtype, order=order)
Return a new matrix of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int Shape of the empty matrix. dtype : data-type, optional Desired output data-type. order : {'C', 'F'}, optional Whether to store multi-dimensional data ...
Return a new matrix of given shape and type, without initializing entries.
[ "Return", "a", "new", "matrix", "of", "given", "shape", "and", "type", "without", "initializing", "entries", "." ]
def empty(shape, dtype=None, order='C'): """ Return a new matrix of given shape and type, without initializing entries. Parameters ---------- shape : int or tuple of int Shape of the empty matrix. dtype : data-type, optional Desired output data-type. order : {'C', 'F'}, opti...
[ "def", "empty", "(", "shape", ",", "dtype", "=", "None", ",", "order", "=", "'C'", ")", ":", "return", "ndarray", ".", "__new__", "(", "matrix", ",", "shape", ",", "dtype", ",", "order", "=", "order", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/numpy/matlib.py#L13-L49
llSourcell/AI_Artist
3038c06c2e389b9c919c881c9a169efe2fd7810e
lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py
python
_macosx_arch
(machine)
return {'PowerPC': 'ppc', 'Power_Macintosh': 'ppc'}.get(machine, machine)
[]
def _macosx_arch(machine): return {'PowerPC': 'ppc', 'Power_Macintosh': 'ppc'}.get(machine, machine)
[ "def", "_macosx_arch", "(", "machine", ")", ":", "return", "{", "'PowerPC'", ":", "'ppc'", ",", "'Power_Macintosh'", ":", "'ppc'", "}", ".", "get", "(", "machine", ",", "machine", ")" ]
https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L439-L440
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/item_get_request.py
python
ItemGetRequest.openapi_types
()
return { 'access_token': (str,), # noqa: E501 'client_id': (str,), # noqa: E501 'secret': (str,), # noqa: E501 }
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
[ "This", "must", "be", "a", "method", "because", "a", "model", "may", "have", "properties", "that", "are", "of", "type", "self", "this", "must", "run", "after", "the", "class", "is", "loaded" ]
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ retu...
[ "def", "openapi_types", "(", ")", ":", "return", "{", "'access_token'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'client_id'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'secret'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "}" ]
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/item_get_request.py#L63-L76
wanggrun/Adaptively-Connected-Neural-Networks
e27066ef52301bdafa5932f43af8feeb23647edb
tensorpack-installed/tensorpack/utils/timer.py
python
print_total_timer
()
Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits.
Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits.
[ "Print", "the", "content", "of", "the", "TotalTimer", "if", "it", "s", "not", "empty", ".", "This", "function", "will", "automatically", "get", "called", "when", "program", "exits", "." ]
def print_total_timer(): """ Print the content of the TotalTimer, if it's not empty. This function will automatically get called when program exits. """ if len(_TOTAL_TIMER_DATA) == 0: return for k, v in six.iteritems(_TOTAL_TIMER_DATA): logger.info("Total Time: {} -> {:.2f} sec,...
[ "def", "print_total_timer", "(", ")", ":", "if", "len", "(", "_TOTAL_TIMER_DATA", ")", "==", "0", ":", "return", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "_TOTAL_TIMER_DATA", ")", ":", "logger", ".", "info", "(", "\"Total Time: {} -> {:.2f...
https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/tensorpack-installed/tensorpack/utils/timer.py#L60-L69
redis/redis-py
0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7
redis/cluster.py
python
ClusterPipeline.pipeline_execute_command
(self, *args, **options)
return self
Appends the executed command to the pipeline's command stack
Appends the executed command to the pipeline's command stack
[ "Appends", "the", "executed", "command", "to", "the", "pipeline", "s", "command", "stack" ]
def pipeline_execute_command(self, *args, **options): """ Appends the executed command to the pipeline's command stack """ self.command_stack.append( PipelineCommand(args, options, len(self.command_stack)) ) return self
[ "def", "pipeline_execute_command", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "self", ".", "command_stack", ".", "append", "(", "PipelineCommand", "(", "args", ",", "options", ",", "len", "(", "self", ".", "command_stack", ")", ")...
https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/cluster.py#L1665-L1672
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/crawl/oracle_discovery.py
python
oracle_discovery.send_and_check
(self, url)
[]
def send_and_check(self, url): response = self.http_get_and_parse(url) for regex in self.ORACLE_RE: # pylint: disable=E1101 mo = regex.search(response.get_body(), re.DOTALL) # pylint: enable=E1101 if mo: desc = '"%s" version "%s" was det...
[ "def", "send_and_check", "(", "self", ",", "url", ")", ":", "response", "=", "self", ".", "http_get_and_parse", "(", "url", ")", "for", "regex", "in", "self", ".", "ORACLE_RE", ":", "# pylint: disable=E1101", "mo", "=", "regex", ".", "search", "(", "respon...
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/crawl/oracle_discovery.py#L75-L104
PolyAI-LDN/conversational-datasets
50f626ad0d0e825835bd054f6a58006afa95a8e5
baselines/vector_based.py
python
VectorMappingMethod._create_train_and_dev
(self, contexts, responses)
return train_test_split( context_encodings, response_encodings, test_size=0.2)
Create a train and dev set of context and response vectors.
Create a train and dev set of context and response vectors.
[ "Create", "a", "train", "and", "dev", "set", "of", "context", "and", "response", "vectors", "." ]
def _create_train_and_dev(self, contexts, responses): """Create a train and dev set of context and response vectors.""" glog.info("Encoding the train set.") context_encodings = [] response_encodings = [] for i in tqdm(range(0, len(contexts), self._ENCODING_BATCH_SIZE)): ...
[ "def", "_create_train_and_dev", "(", "self", ",", "contexts", ",", "responses", ")", ":", "glog", ".", "info", "(", "\"Encoding the train set.\"", ")", "context_encodings", "=", "[", "]", "response_encodings", "=", "[", "]", "for", "i", "in", "tqdm", "(", "r...
https://github.com/PolyAI-LDN/conversational-datasets/blob/50f626ad0d0e825835bd054f6a58006afa95a8e5/baselines/vector_based.py#L329-L350
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
scripts/monitoring/cron-send-docker-grpc.py
python
parse_args
()
return arg
parse the args from the cli
parse the args from the cli
[ "parse", "the", "args", "from", "the", "cli" ]
def parse_args(): """ parse the args from the cli """ parser = argparse.ArgumentParser(description='docker grpc error check') parser.add_argument('-v', '--verbose', action='store_true', default=None, help='Verbose?') parser.add_argument('--debug', action='store_true', default=None, help='Debug?') ...
[ "def", "parse_args", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'docker grpc error check'", ")", "parser", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "action", "=", "'store_true'", ",", "default", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/scripts/monitoring/cron-send-docker-grpc.py#L31-L45
cournape/Bento
37de23d784407a7c98a4a15770ffc570d5f32d70
bento/private/_yaku/yaku/context.py
python
ConfigureContext.start_message
(self, msg)
[]
def start_message(self, msg): _OUTPUT.write(msg + "... ") self.log.write("=" * 79 + "\n") self.log.write("%s\n" % msg)
[ "def", "start_message", "(", "self", ",", "msg", ")", ":", "_OUTPUT", ".", "write", "(", "msg", "+", "\"... \"", ")", "self", ".", "log", ".", "write", "(", "\"=\"", "*", "79", "+", "\"\\n\"", ")", "self", ".", "log", ".", "write", "(", "\"%s\\n\""...
https://github.com/cournape/Bento/blob/37de23d784407a7c98a4a15770ffc570d5f32d70/bento/private/_yaku/yaku/context.py#L129-L132
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/utils/memcached.py
python
_check_stats
(conn)
return stats
Helper function to check the stats data passed into it, and raise an exception if none are returned. Otherwise, the stats are returned.
Helper function to check the stats data passed into it, and raise an exception if none are returned. Otherwise, the stats are returned.
[ "Helper", "function", "to", "check", "the", "stats", "data", "passed", "into", "it", "and", "raise", "an", "exception", "if", "none", "are", "returned", ".", "Otherwise", "the", "stats", "are", "returned", "." ]
def _check_stats(conn): """ Helper function to check the stats data passed into it, and raise an exception if none are returned. Otherwise, the stats are returned. """ stats = conn.get_stats() if not stats: raise CommandExecutionError("memcached server is down or does not exist") ret...
[ "def", "_check_stats", "(", "conn", ")", ":", "stats", "=", "conn", ".", "get_stats", "(", ")", "if", "not", "stats", ":", "raise", "CommandExecutionError", "(", "\"memcached server is down or does not exist\"", ")", "return", "stats" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/utils/memcached.py#L102-L110
mayank93/Twitter-Sentiment-Analysis
f095c6ca6bf69787582b5dabb140fefaf278eb37
front-end/web2py/gluon/contrib/gateways/fcgi.py
python
Connection._do_stdin
(self, inrec)
Handle the FCGI_STDIN stream.
Handle the FCGI_STDIN stream.
[ "Handle", "the", "FCGI_STDIN", "stream", "." ]
def _do_stdin(self, inrec): """Handle the FCGI_STDIN stream.""" req = self._requests.get(inrec.requestId) if req is not None: req.stdin.add_data(inrec.contentData)
[ "def", "_do_stdin", "(", "self", ",", "inrec", ")", ":", "req", "=", "self", ".", "_requests", ".", "get", "(", "inrec", ".", "requestId", ")", "if", "req", "is", "not", "None", ":", "req", ".", "stdin", ".", "add_data", "(", "inrec", ".", "content...
https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/gluon/contrib/gateways/fcgi.py#L801-L805
Fantomas42/django-blog-zinnia
881101a9d1d455b2fc581d6f4ae0947cdd8126c6
zinnia/preview.py
python
HTMLPreview.has_more
(self)
return bool(self.content and self.preview != self.content)
Boolean telling if the preview has hidden content.
Boolean telling if the preview has hidden content.
[ "Boolean", "telling", "if", "the", "preview", "has", "hidden", "content", "." ]
def has_more(self): """ Boolean telling if the preview has hidden content. """ return bool(self.content and self.preview != self.content)
[ "def", "has_more", "(", "self", ")", ":", "return", "bool", "(", "self", ".", "content", "and", "self", ".", "preview", "!=", "self", ".", "content", ")" ]
https://github.com/Fantomas42/django-blog-zinnia/blob/881101a9d1d455b2fc581d6f4ae0947cdd8126c6/zinnia/preview.py#L42-L46
vulscanteam/vulscan
787397e267c4e6469522ee0abe55b3e98f968d4a
pocsuite/thirdparty/requests/sessions.py
python
Session.mount
(self, prefix, adapter)
Registers a connection adapter to a prefix. Adapters are sorted in descending order by key length.
Registers a connection adapter to a prefix.
[ "Registers", "a", "connection", "adapter", "to", "a", "prefix", "." ]
def mount(self, prefix, adapter): """Registers a connection adapter to a prefix. Adapters are sorted in descending order by key length.""" self.adapters[prefix] = adapter keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] for key in keys_to_move: sel...
[ "def", "mount", "(", "self", ",", "prefix", ",", "adapter", ")", ":", "self", ".", "adapters", "[", "prefix", "]", "=", "adapter", "keys_to_move", "=", "[", "k", "for", "k", "in", "self", ".", "adapters", "if", "len", "(", "k", ")", "<", "len", "...
https://github.com/vulscanteam/vulscan/blob/787397e267c4e6469522ee0abe55b3e98f968d4a/pocsuite/thirdparty/requests/sessions.py#L648-L657
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/core/torch_agent.py
python
TorchAgent._get_init_model
(self, opt, shared)
return init_model, is_finetune
Get model file to initialize with. If `init_model` exits, we will return the path to that file and maybe load dict file from that path. Otherwise, use `model_file.` :return: path to load model from, whether we loaded from `init_model` or not
Get model file to initialize with.
[ "Get", "model", "file", "to", "initialize", "with", "." ]
def _get_init_model(self, opt, shared): """ Get model file to initialize with. If `init_model` exits, we will return the path to that file and maybe load dict file from that path. Otherwise, use `model_file.` :return: path to load model from, whether we loaded from `init_model...
[ "def", "_get_init_model", "(", "self", ",", "opt", ",", "shared", ")", ":", "init_model", "=", "None", "is_finetune", "=", "False", "if", "not", "shared", ":", "# only do this on first setup", "# first check load path in case we need to override paths", "if", "opt", "...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/core/torch_agent.py#L759-L796
awslabs/deeplearning-benchmark
3e9a906422b402869537f91056ae771b66487a8e
tensorflow_benchmark/tf_cnn_benchmarks/cnn_util.py
python
ImageProducer.start
(self)
Start the image producer.
Start the image producer.
[ "Start", "the", "image", "producer", "." ]
def start(self): """Start the image producer.""" self.thread = threading.Thread(target=self._loop_producer) # Set daemon to true to allow Ctrl + C to terminate all threads. self.thread.daemon = True self.thread.start()
[ "def", "start", "(", "self", ")", ":", "self", ".", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_loop_producer", ")", "# Set daemon to true to allow Ctrl + C to terminate all threads.", "self", ".", "thread", ".", "daemon", "=", ...
https://github.com/awslabs/deeplearning-benchmark/blob/3e9a906422b402869537f91056ae771b66487a8e/tensorflow_benchmark/tf_cnn_benchmarks/cnn_util.py#L141-L146
neulab/xnmt
d93f8f3710f986f36eb54e9ff3976a6b683da2a4
xnmt/thirdparty/charcut/charcut.py
python
read_gz8
(filename)
Read a utf8, possibly gzipped, file into memory, as a list of lines.
Read a utf8, possibly gzipped, file into memory, as a list of lines.
[ "Read", "a", "utf8", "possibly", "gzipped", "file", "into", "memory", "as", "a", "list", "of", "lines", "." ]
def read_gz8(filename): """Read a utf8, possibly gzipped, file into memory, as a list of lines.""" with open(filename, 'r', encoding='utf-8') as f: return [line for line in f]
[ "def", "read_gz8", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "f", ":", "return", "[", "line", "for", "line", "in", "f", "]" ]
https://github.com/neulab/xnmt/blob/d93f8f3710f986f36eb54e9ff3976a6b683da2a4/xnmt/thirdparty/charcut/charcut.py#L66-L69