repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
rwl/pylon
pyreto/continuous/task.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pyreto/continuous/task.py#L87-L104
def _getActorLimits(self): """ Returns a list of 2-tuples, e.g. [(-3.14, 3.14), (-0.001, 0.001)], one tuple per parameter, giving min and max for that parameter. """ actorLimits = [] for _ in range(self.env.numOffbids): for _ in self.env.generators: ...
[ "def", "_getActorLimits", "(", "self", ")", ":", "actorLimits", "=", "[", "]", "for", "_", "in", "range", "(", "self", ".", "env", ".", "numOffbids", ")", ":", "for", "_", "in", "self", ".", "env", ".", "generators", ":", "actorLimits", ".", "append"...
Returns a list of 2-tuples, e.g. [(-3.14, 3.14), (-0.001, 0.001)], one tuple per parameter, giving min and max for that parameter.
[ "Returns", "a", "list", "of", "2", "-", "tuples", "e", ".", "g", ".", "[", "(", "-", "3", ".", "14", "3", ".", "14", ")", "(", "-", "0", ".", "001", "0", ".", "001", ")", "]", "one", "tuple", "per", "parameter", "giving", "min", "and", "max...
python
train
chainer/chainerui
chainerui/models/result.py
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/models/result.py#L48-L58
def create(cls, path_name=None, name=None, project_id=None, log_modified_at=None, crawlable=True): """Initialize an instance and save it to db.""" result = cls(path_name, name, project_id, log_modified_at, crawlable) db.session.add(result) db.session.commit() cra...
[ "def", "create", "(", "cls", ",", "path_name", "=", "None", ",", "name", "=", "None", ",", "project_id", "=", "None", ",", "log_modified_at", "=", "None", ",", "crawlable", "=", "True", ")", ":", "result", "=", "cls", "(", "path_name", ",", "name", "...
Initialize an instance and save it to db.
[ "Initialize", "an", "instance", "and", "save", "it", "to", "db", "." ]
python
train
secdev/scapy
scapy/contrib/automotive/someip.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/contrib/automotive/someip.py#L190-L216
def fragment(self, fragsize=1392): """Fragment SOME/IP-TP""" fnb = 0 fl = self lst = list() while fl.underlayer is not None: fnb += 1 fl = fl.underlayer for p in fl: s = raw(p[fnb].payload) nb = (len(s) + fragsize) // frags...
[ "def", "fragment", "(", "self", ",", "fragsize", "=", "1392", ")", ":", "fnb", "=", "0", "fl", "=", "self", "lst", "=", "list", "(", ")", "while", "fl", ".", "underlayer", "is", "not", "None", ":", "fnb", "+=", "1", "fl", "=", "fl", ".", "under...
Fragment SOME/IP-TP
[ "Fragment", "SOME", "/", "IP", "-", "TP" ]
python
train
aws/sagemaker-python-sdk
src/sagemaker/chainer/estimator.py
https://github.com/aws/sagemaker-python-sdk/blob/a9e724c7d3f5572b68c3903548c792a59d99799a/src/sagemaker/chainer/estimator.py#L99-L111
def hyperparameters(self): """Return hyperparameters used by your custom Chainer code during training.""" hyperparameters = super(Chainer, self).hyperparameters() additional_hyperparameters = {Chainer._use_mpi: self.use_mpi, Chainer._num_processes: self.num...
[ "def", "hyperparameters", "(", "self", ")", ":", "hyperparameters", "=", "super", "(", "Chainer", ",", "self", ")", ".", "hyperparameters", "(", ")", "additional_hyperparameters", "=", "{", "Chainer", ".", "_use_mpi", ":", "self", ".", "use_mpi", ",", "Chain...
Return hyperparameters used by your custom Chainer code during training.
[ "Return", "hyperparameters", "used", "by", "your", "custom", "Chainer", "code", "during", "training", "." ]
python
train
crgwbr/asymmetric-jwt-auth
src/asymmetric_jwt_auth/__init__.py
https://github.com/crgwbr/asymmetric-jwt-auth/blob/eae1a6474b6141edce4d6be2dc1746e18bbf5318/src/asymmetric_jwt_auth/__init__.py#L21-L49
def generate_key_pair(size=2048, public_exponent=65537, as_string=True): """ Generate a public/private key pair. :param size: Optional. Describes how many bits long the key should be, larger keys provide more security, currently 1024 and below are considered breakable, and 2048 or 4096 are reasonab...
[ "def", "generate_key_pair", "(", "size", "=", "2048", ",", "public_exponent", "=", "65537", ",", "as_string", "=", "True", ")", ":", "private", "=", "rsa", ".", "generate_private_key", "(", "public_exponent", "=", "public_exponent", ",", "key_size", "=", "size...
Generate a public/private key pair. :param size: Optional. Describes how many bits long the key should be, larger keys provide more security, currently 1024 and below are considered breakable, and 2048 or 4096 are reasonable default key sizes for new keys. Defaults to 2048. :param public_expone...
[ "Generate", "a", "public", "/", "private", "key", "pair", "." ]
python
train
maljovec/topopy
topopy/MergeTree.py
https://github.com/maljovec/topopy/blob/4be598d51c4e4043b73d4ad44beed6d289e2f088/topopy/MergeTree.py#L103-L133
def build(self, X, Y, w=None, edges=None): """ Assigns data to this object and builds the Merge Tree @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples ...
[ "def", "build", "(", "self", ",", "X", ",", "Y", ",", "w", "=", "None", ",", "edges", "=", "None", ")", ":", "super", "(", "MergeTree", ",", "self", ")", ".", "build", "(", "X", ",", "Y", ",", "w", ",", "edges", ")", "if", "self", ".", "deb...
Assigns data to this object and builds the Merge Tree @ In, X, an m-by-n array of values specifying m n-dimensional samples @ In, Y, a m vector of values specifying the output responses corresponding to the m samples specified by X @ In, w, an optional m vecto...
[ "Assigns", "data", "to", "this", "object", "and", "builds", "the", "Merge", "Tree" ]
python
train
Azure/msrestazure-for-python
msrestazure/tools.py
https://github.com/Azure/msrestazure-for-python/blob/5f99262305692525d03ca87d2c5356b05c5aa874/msrestazure/tools.py#L149-L162
def _populate_alternate_kwargs(kwargs): """ Translates the parsed arguments into a format used by generic ARM commands such as the resource and lock commands. """ resource_namespace = kwargs['namespace'] resource_type = kwargs.get('child_type_{}'.format(kwargs['last_child_num'])) or kwargs['type'] ...
[ "def", "_populate_alternate_kwargs", "(", "kwargs", ")", ":", "resource_namespace", "=", "kwargs", "[", "'namespace'", "]", "resource_type", "=", "kwargs", ".", "get", "(", "'child_type_{}'", ".", "format", "(", "kwargs", "[", "'last_child_num'", "]", ")", ")", ...
Translates the parsed arguments into a format used by generic ARM commands such as the resource and lock commands.
[ "Translates", "the", "parsed", "arguments", "into", "a", "format", "used", "by", "generic", "ARM", "commands", "such", "as", "the", "resource", "and", "lock", "commands", "." ]
python
train
Yipit/eventlib
eventlib/core.py
https://github.com/Yipit/eventlib/blob/0cf29e5251a59fcbfc727af5f5157a3bb03832e2/eventlib/core.py#L124-L155
def process(event_name, data): """Iterates over the event handler registry and execute each found handler. It takes the event name and its its `data`, passing the return of `ejson.loads(data)` to the found handlers. """ deserialized = loads(data) event_cls = find_event(event_name) event...
[ "def", "process", "(", "event_name", ",", "data", ")", ":", "deserialized", "=", "loads", "(", "data", ")", "event_cls", "=", "find_event", "(", "event_name", ")", "event", "=", "event_cls", "(", "event_name", ",", "deserialized", ")", "try", ":", "event",...
Iterates over the event handler registry and execute each found handler. It takes the event name and its its `data`, passing the return of `ejson.loads(data)` to the found handlers.
[ "Iterates", "over", "the", "event", "handler", "registry", "and", "execute", "each", "found", "handler", "." ]
python
train
Erotemic/utool
utool/util_dict.py
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_dict.py#L1060-L1064
def dict_assign(dict_, keys, vals): """ simple method for assigning or setting values with a similar interface to dict_take """ for key, val in zip(keys, vals): dict_[key] = val
[ "def", "dict_assign", "(", "dict_", ",", "keys", ",", "vals", ")", ":", "for", "key", ",", "val", "in", "zip", "(", "keys", ",", "vals", ")", ":", "dict_", "[", "key", "]", "=", "val" ]
simple method for assigning or setting values with a similar interface to dict_take
[ "simple", "method", "for", "assigning", "or", "setting", "values", "with", "a", "similar", "interface", "to", "dict_take" ]
python
train
RudolfCardinal/pythonlib
cardinal_pythonlib/django/fields/helpers.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/django/fields/helpers.py#L36-L53
def valid_choice(strvalue: str, choices: Iterable[Tuple[str, str]]) -> bool: """ Checks that value is one of the valid option in choices, where choices is a list/tuple of 2-tuples (option, description). Note that parameters sent by URLconf are always strings (https://docs.djangoproject.com/en/1.8/t...
[ "def", "valid_choice", "(", "strvalue", ":", "str", ",", "choices", ":", "Iterable", "[", "Tuple", "[", "str", ",", "str", "]", "]", ")", "->", "bool", ":", "return", "strvalue", "in", "[", "str", "(", "x", "[", "0", "]", ")", "for", "x", "in", ...
Checks that value is one of the valid option in choices, where choices is a list/tuple of 2-tuples (option, description). Note that parameters sent by URLconf are always strings (https://docs.djangoproject.com/en/1.8/topics/http/urls/) but Python is happy with a string-to-integer-PK lookup, e.g. ....
[ "Checks", "that", "value", "is", "one", "of", "the", "valid", "option", "in", "choices", "where", "choices", "is", "a", "list", "/", "tuple", "of", "2", "-", "tuples", "(", "option", "description", ")", "." ]
python
train
tonioo/sievelib
sievelib/managesieve.py
https://github.com/tonioo/sievelib/blob/88822d1f1daf30ef3dd9ac74911301b0773ef3c8/sievelib/managesieve.py#L183-L217
def __read_response(self, nblines=-1): """Read a response from the server. In the usual case, we read lines until we find one that looks like a response (OK|NO|BYE\s*(.+)?). If *nblines* > 0, we read excactly nblines before returning. :param nblines: number of lines to read (d...
[ "def", "__read_response", "(", "self", ",", "nblines", "=", "-", "1", ")", ":", "resp", ",", "code", ",", "data", "=", "(", "b\"\"", ",", "None", ",", "None", ")", "cpt", "=", "0", "while", "True", ":", "try", ":", "line", "=", "self", ".", "__...
Read a response from the server. In the usual case, we read lines until we find one that looks like a response (OK|NO|BYE\s*(.+)?). If *nblines* > 0, we read excactly nblines before returning. :param nblines: number of lines to read (default : -1) :rtype: tuple :return...
[ "Read", "a", "response", "from", "the", "server", "." ]
python
train
fastai/fastai
fastai/vision/learner.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/learner.py#L53-L62
def create_body(arch:Callable, pretrained:bool=True, cut:Optional[Union[int, Callable]]=None): "Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function)." model = arch(pretrained) cut = ifnone(cut, cnn_config(arch)['cut']) if cut is None:...
[ "def", "create_body", "(", "arch", ":", "Callable", ",", "pretrained", ":", "bool", "=", "True", ",", "cut", ":", "Optional", "[", "Union", "[", "int", ",", "Callable", "]", "]", "=", "None", ")", ":", "model", "=", "arch", "(", "pretrained", ")", ...
Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function).
[ "Cut", "off", "the", "body", "of", "a", "typically", "pretrained", "model", "at", "cut", "(", "int", ")", "or", "cut", "the", "model", "as", "specified", "by", "cut", "(", "model", ")", "(", "function", ")", "." ]
python
train
J535D165/recordlinkage
recordlinkage/algorithms/nb_sklearn.py
https://github.com/J535D165/recordlinkage/blob/87a5f4af904e0834047cd07ff1c70146b1e6d693/recordlinkage/algorithms/nb_sklearn.py#L298-L302
def _count(self, X, Y): """Count and smooth feature occurrences.""" self.feature_count_ += safe_sparse_dot(Y.T, X) self.class_count_ += Y.sum(axis=0)
[ "def", "_count", "(", "self", ",", "X", ",", "Y", ")", ":", "self", ".", "feature_count_", "+=", "safe_sparse_dot", "(", "Y", ".", "T", ",", "X", ")", "self", ".", "class_count_", "+=", "Y", ".", "sum", "(", "axis", "=", "0", ")" ]
Count and smooth feature occurrences.
[ "Count", "and", "smooth", "feature", "occurrences", "." ]
python
train
jaraco/jaraco.util
jaraco/util/numbers.py
https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/numbers.py#L10-L37
def coerce(value): """ coerce takes a value and attempts to convert it to a float, or int. If none of the conversions are successful, the original value is returned. >>> coerce('3') 3 >>> coerce('3.0') 3.0 >>> coerce('foo') 'foo' >>> coerce({}) {} >>> coerce('{}') '{}' """ with contextlib2.suppre...
[ "def", "coerce", "(", "value", ")", ":", "with", "contextlib2", ".", "suppress", "(", "Exception", ")", ":", "loaded", "=", "json", ".", "loads", "(", "value", ")", "assert", "isinstance", "(", "loaded", ",", "numbers", ".", "Number", ")", "return", "l...
coerce takes a value and attempts to convert it to a float, or int. If none of the conversions are successful, the original value is returned. >>> coerce('3') 3 >>> coerce('3.0') 3.0 >>> coerce('foo') 'foo' >>> coerce({}) {} >>> coerce('{}') '{}'
[ "coerce", "takes", "a", "value", "and", "attempts", "to", "convert", "it", "to", "a", "float", "or", "int", "." ]
python
test
CodyKochmann/strict_functions
strict_functions/trace3.py
https://github.com/CodyKochmann/strict_functions/blob/adaf78084c66929552d80c95f980e7e0c4331478/strict_functions/trace3.py#L42-L44
def get_locals(f:Frame) -> str: ''' returns a formatted view of the local variables in a frame ''' return pformat({i:f.f_locals[i] for i in f.f_locals if not i.startswith('__')})
[ "def", "get_locals", "(", "f", ":", "Frame", ")", "->", "str", ":", "return", "pformat", "(", "{", "i", ":", "f", ".", "f_locals", "[", "i", "]", "for", "i", "in", "f", ".", "f_locals", "if", "not", "i", ".", "startswith", "(", "'__'", ")", "}"...
returns a formatted view of the local variables in a frame
[ "returns", "a", "formatted", "view", "of", "the", "local", "variables", "in", "a", "frame" ]
python
train
numenta/htmresearch
htmresearch/frameworks/layers/sequence_object_machine.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/layers/sequence_object_machine.py#L199-L239
def _getSDRPairs(self, pairs, noise=None, includeRandomLocation=False): """ This method takes a list of (location, feature) index pairs (one pair per cortical column), and returns a sensation dict in the correct format, adding noise if necessary. """ sensations = {} for col in xrange(self.nu...
[ "def", "_getSDRPairs", "(", "self", ",", "pairs", ",", "noise", "=", "None", ",", "includeRandomLocation", "=", "False", ")", ":", "sensations", "=", "{", "}", "for", "col", "in", "xrange", "(", "self", ".", "numColumns", ")", ":", "locationID", ",", "...
This method takes a list of (location, feature) index pairs (one pair per cortical column), and returns a sensation dict in the correct format, adding noise if necessary.
[ "This", "method", "takes", "a", "list", "of", "(", "location", "feature", ")", "index", "pairs", "(", "one", "pair", "per", "cortical", "column", ")", "and", "returns", "a", "sensation", "dict", "in", "the", "correct", "format", "adding", "noise", "if", ...
python
train
InQuest/python-sandboxapi
sandboxapi/falcon.py
https://github.com/InQuest/python-sandboxapi/blob/9bad73f453e25d7d23e7b4b1ae927f44a35a5bc3/sandboxapi/falcon.py#L45-L71
def analyze(self, handle, filename): """Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File hash as a string """ ...
[ "def", "analyze", "(", "self", ",", "handle", ",", "filename", ")", ":", "# multipart post files.", "files", "=", "{", "\"file\"", ":", "(", "filename", ",", "handle", ")", "}", "# ensure the handle is at offset 0.", "handle", ".", "seek", "(", "0", ")", "re...
Submit a file for analysis. :type handle: File handle :param handle: Handle to file to upload for analysis. :type filename: str :param filename: File name. :rtype: str :return: File hash as a string
[ "Submit", "a", "file", "for", "analysis", "." ]
python
train
sdispater/orator
orator/query/builder.py
https://github.com/sdispater/orator/blob/bd90bf198ee897751848f9a92e49d18e60a74136/orator/query/builder.py#L107-L125
def select_raw(self, expression, bindings=None): """ Add a new raw select expression to the query :param expression: The raw expression :type expression: str :param bindings: The expression bindings :type bindings: list :return: The current QueryBuilder instanc...
[ "def", "select_raw", "(", "self", ",", "expression", ",", "bindings", "=", "None", ")", ":", "self", ".", "add_select", "(", "QueryExpression", "(", "expression", ")", ")", "if", "bindings", ":", "self", ".", "add_binding", "(", "bindings", ",", "\"select\...
Add a new raw select expression to the query :param expression: The raw expression :type expression: str :param bindings: The expression bindings :type bindings: list :return: The current QueryBuilder instance :rtype: QueryBuilder
[ "Add", "a", "new", "raw", "select", "expression", "to", "the", "query" ]
python
train
neithere/argh
argh/constants.py
https://github.com/neithere/argh/blob/dcd3253f2994400a6a58a700c118c53765bc50a4/argh/constants.py#L55-L91
def _expand_help(self, action): """ This method is copied verbatim from ArgumentDefaultsHelpFormatter with a couple of lines added just before the end. Reason: we need to `repr()` default values instead of simply inserting them as is. This helps notice, for example, an empty str...
[ "def", "_expand_help", "(", "self", ",", "action", ")", ":", "params", "=", "dict", "(", "vars", "(", "action", ")", ",", "prog", "=", "self", ".", "_prog", ")", "for", "name", "in", "list", "(", "params", ")", ":", "if", "params", "[", "name", "...
This method is copied verbatim from ArgumentDefaultsHelpFormatter with a couple of lines added just before the end. Reason: we need to `repr()` default values instead of simply inserting them as is. This helps notice, for example, an empty string as the default value; moreover, it preve...
[ "This", "method", "is", "copied", "verbatim", "from", "ArgumentDefaultsHelpFormatter", "with", "a", "couple", "of", "lines", "added", "just", "before", "the", "end", ".", "Reason", ":", "we", "need", "to", "repr", "()", "default", "values", "instead", "of", ...
python
test
bykof/billomapy
billomapy/billomapy.py
https://github.com/bykof/billomapy/blob/a28ba69fd37654fa145d0411d52c200e7f8984ab/billomapy/billomapy.py#L837-L850
def get_all_tags_of_article(self, article_id): """ Get all tags of article This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param article_id: the article id :return: list ...
[ "def", "get_all_tags_of_article", "(", "self", ",", "article_id", ")", ":", "return", "self", ".", "_iterate_through_pages", "(", "get_function", "=", "self", ".", "get_tags_of_article_per_page", ",", "resource", "=", "ARTICLE_TAGS", ",", "*", "*", "{", "'article_...
Get all tags of article This will iterate over all pages until it gets all elements. So if the rate limit exceeded it will throw an Exception and you will get nothing :param article_id: the article id :return: list
[ "Get", "all", "tags", "of", "article", "This", "will", "iterate", "over", "all", "pages", "until", "it", "gets", "all", "elements", ".", "So", "if", "the", "rate", "limit", "exceeded", "it", "will", "throw", "an", "Exception", "and", "you", "will", "get"...
python
train
timothydmorton/VESPA
vespa/transit_basic.py
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L745-L753
def fit_traptransit(ts,fs,p0): """ Fits trapezoid model to provided ts,fs """ pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs)) if success not in [1,2,3,4]: raise NoFitError #logging.debug('success = {}'.format(success)) return pfit
[ "def", "fit_traptransit", "(", "ts", ",", "fs", ",", "p0", ")", ":", "pfit", ",", "success", "=", "leastsq", "(", "traptransit_resid", ",", "p0", ",", "args", "=", "(", "ts", ",", "fs", ")", ")", "if", "success", "not", "in", "[", "1", ",", "2", ...
Fits trapezoid model to provided ts,fs
[ "Fits", "trapezoid", "model", "to", "provided", "ts", "fs" ]
python
train
jmgilman/Neolib
neolib/pyamf/util/pure.py
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/util/pure.py#L477-L485
def read_utf8_string(self, length): """ Reads a UTF-8 string from the stream. @rtype: C{unicode} """ s = struct.unpack("%s%ds" % (self.endian, length), self.read(length))[0] return s.decode('utf-8')
[ "def", "read_utf8_string", "(", "self", ",", "length", ")", ":", "s", "=", "struct", ".", "unpack", "(", "\"%s%ds\"", "%", "(", "self", ".", "endian", ",", "length", ")", ",", "self", ".", "read", "(", "length", ")", ")", "[", "0", "]", "return", ...
Reads a UTF-8 string from the stream. @rtype: C{unicode}
[ "Reads", "a", "UTF", "-", "8", "string", "from", "the", "stream", "." ]
python
train
ChristianTremblay/BAC0
BAC0/sql/sql.py
https://github.com/ChristianTremblay/BAC0/blob/8d95b065ea068524a08f5b0c34322ebeeba95d06/BAC0/sql/sql.py#L147-L153
def his_from_sql(self, db_name, point): """ Retrive point histories from SQL database """ his = self._read_from_sql('select * from "%s"' % "history", db_name) his.index = his["index"].apply(Timestamp) return his.set_index("index")[point]
[ "def", "his_from_sql", "(", "self", ",", "db_name", ",", "point", ")", ":", "his", "=", "self", ".", "_read_from_sql", "(", "'select * from \"%s\"'", "%", "\"history\"", ",", "db_name", ")", "his", ".", "index", "=", "his", "[", "\"index\"", "]", ".", "a...
Retrive point histories from SQL database
[ "Retrive", "point", "histories", "from", "SQL", "database" ]
python
train
ffcalculator/fantasydata-python
fantasy_data/FantasyData.py
https://github.com/ffcalculator/fantasydata-python/blob/af90cac1e80d8356cffaa80621ee513201f6c661/fantasy_data/FantasyData.py#L161-L166
def get_projected_player_game_stats_by_player(self, season, week, player_id): """ Projected Player Game Stats by Player """ result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id) ...
[ "def", "get_projected_player_game_stats_by_player", "(", "self", ",", "season", ",", "week", ",", "player_id", ")", ":", "result", "=", "self", ".", "_method_call", "(", "\"PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}\"", ",", "\"projections\"", ",", "s...
Projected Player Game Stats by Player
[ "Projected", "Player", "Game", "Stats", "by", "Player" ]
python
train
nickmckay/LiPD-utilities
Python/lipd/timeseries.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/timeseries.py#L340-L369
def _extract_table(table_data, current, pc, ts, tt): """ Use the given table data to create a time series entry for each column in the table. :param dict table_data: Table data :param dict current: LiPD root data :param str pc: paleoData or chronData :param list ts: Time series (so far) :pa...
[ "def", "_extract_table", "(", "table_data", ",", "current", ",", "pc", ",", "ts", ",", "tt", ")", ":", "current", "[", "\"tableType\"", "]", "=", "tt", "# Get root items for this table", "current", "=", "_extract_table_root", "(", "table_data", ",", "current", ...
Use the given table data to create a time series entry for each column in the table. :param dict table_data: Table data :param dict current: LiPD root data :param str pc: paleoData or chronData :param list ts: Time series (so far) :param bool summary: Summary Table or not :return list ts: Time ...
[ "Use", "the", "given", "table", "data", "to", "create", "a", "time", "series", "entry", "for", "each", "column", "in", "the", "table", "." ]
python
train
hasgeek/coaster
coaster/sqlalchemy/statemanager.py
https://github.com/hasgeek/coaster/blob/07f7eb5d5f516e22fa14fdf4dc70e0ae13ee398d/coaster/sqlalchemy/statemanager.py#L709-L738
def add_conditional_state(self, name, state, validator, class_validator=None, cache_for=None, label=None): """ Add a conditional state that combines an existing state with a validator that must also pass. The validator receives the object on which the property is present as a parameter. ...
[ "def", "add_conditional_state", "(", "self", ",", "name", ",", "state", ",", "validator", ",", "class_validator", "=", "None", ",", "cache_for", "=", "None", ",", "label", "=", "None", ")", ":", "# We'll accept a ManagedState with grouped values, but not a ManagedStat...
Add a conditional state that combines an existing state with a validator that must also pass. The validator receives the object on which the property is present as a parameter. :param str name: Name of the new state :param ManagedState state: Existing state that this is based on ...
[ "Add", "a", "conditional", "state", "that", "combines", "an", "existing", "state", "with", "a", "validator", "that", "must", "also", "pass", ".", "The", "validator", "receives", "the", "object", "on", "which", "the", "property", "is", "present", "as", "a", ...
python
train
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/pymavlink/dialects/v20/ardupilotmega.py#L10652-L10662
def remote_log_data_block_send(self, target_system, target_component, seqno, data, force_mavlink1=False): ''' Send a block of log data to remote location target_system : System ID (uint8_t) target_component : Component ID (uint8_t) ...
[ "def", "remote_log_data_block_send", "(", "self", ",", "target_system", ",", "target_component", ",", "seqno", ",", "data", ",", "force_mavlink1", "=", "False", ")", ":", "return", "self", ".", "send", "(", "self", ".", "remote_log_data_block_encode", "(", "targ...
Send a block of log data to remote location target_system : System ID (uint8_t) target_component : Component ID (uint8_t) seqno : log data block sequence number (uint32_t) data : log data block...
[ "Send", "a", "block", "of", "log", "data", "to", "remote", "location" ]
python
train
05bit/peewee-async
peewee_async.py
https://github.com/05bit/peewee-async/blob/d15f4629da1d9975da4ec37306188e68d288c862/peewee_async.py#L193-L204
async def get_or_create(self, model_, defaults=None, **kwargs): """Try to get an object or create it with the specified defaults. Return 2-tuple containing the model instance and a boolean indicating whether the instance was created. """ try: return (await self.get(m...
[ "async", "def", "get_or_create", "(", "self", ",", "model_", ",", "defaults", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "(", "await", "self", ".", "get", "(", "model_", ",", "*", "*", "kwargs", ")", ")", ",", "False", ...
Try to get an object or create it with the specified defaults. Return 2-tuple containing the model instance and a boolean indicating whether the instance was created.
[ "Try", "to", "get", "an", "object", "or", "create", "it", "with", "the", "specified", "defaults", "." ]
python
train
RedHatQE/Sentaku
examples/todo_example/ux.py
https://github.com/RedHatQE/Sentaku/blob/b336cef5b6ee2db4e8dff28dcdb2be35a1f3d01c/examples/todo_example/ux.py#L44-L50
def get_by(self, name): """ find a todo list element by name """ item = self.controlled_list.get_by(name) if item: return TodoElementUX(parent=self, controlled_element=item)
[ "def", "get_by", "(", "self", ",", "name", ")", ":", "item", "=", "self", ".", "controlled_list", ".", "get_by", "(", "name", ")", "if", "item", ":", "return", "TodoElementUX", "(", "parent", "=", "self", ",", "controlled_element", "=", "item", ")" ]
find a todo list element by name
[ "find", "a", "todo", "list", "element", "by", "name" ]
python
train
ontio/ontology-python-sdk
ontology/smart_contract/native_contract/ontid.py
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/smart_contract/native_contract/ontid.py#L110-L146
def parse_ddo(ont_id: str, serialized_ddo: str or bytes) -> dict: """ This interface is used to deserialize a hexadecimal string into a DDO object in the from of dict. :param ont_id: the unique ID for identity. :param serialized_ddo: an serialized description object of ONT ID in form of...
[ "def", "parse_ddo", "(", "ont_id", ":", "str", ",", "serialized_ddo", ":", "str", "or", "bytes", ")", "->", "dict", ":", "if", "len", "(", "serialized_ddo", ")", "==", "0", ":", "return", "dict", "(", ")", "if", "isinstance", "(", "serialized_ddo", ","...
This interface is used to deserialize a hexadecimal string into a DDO object in the from of dict. :param ont_id: the unique ID for identity. :param serialized_ddo: an serialized description object of ONT ID in form of str or bytes. :return: a description object of ONT ID in the from of dict.
[ "This", "interface", "is", "used", "to", "deserialize", "a", "hexadecimal", "string", "into", "a", "DDO", "object", "in", "the", "from", "of", "dict", "." ]
python
train
swisscom/cleanerversion
versions/admin.py
https://github.com/swisscom/cleanerversion/blob/becadbab5d7b474a0e9a596b99e97682402d2f2c/versions/admin.py#L211-L224
def will_not_clone(self, request, *args, **kwargs): """ Add save but not clone capability in the changeview """ paths = request.path_info.split('/') index_of_object_id = paths.index("will_not_clone") - 1 object_id = paths[index_of_object_id] self.change_view(reque...
[ "def", "will_not_clone", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "paths", "=", "request", ".", "path_info", ".", "split", "(", "'/'", ")", "index_of_object_id", "=", "paths", ".", "index", "(", "\"will_not_clone\...
Add save but not clone capability in the changeview
[ "Add", "save", "but", "not", "clone", "capability", "in", "the", "changeview" ]
python
train
vatlab/SoS
src/sos/eval.py
https://github.com/vatlab/SoS/blob/6b60ed0770916d135e17322e469520d778e9d4e7/src/sos/eval.py#L96-L98
def SoS_eval(expr: str, extra_dict: dict = {}) -> Any: '''Evaluate an expression with sos dict.''' return eval(expr, env.sos_dict.dict(), extra_dict)
[ "def", "SoS_eval", "(", "expr", ":", "str", ",", "extra_dict", ":", "dict", "=", "{", "}", ")", "->", "Any", ":", "return", "eval", "(", "expr", ",", "env", ".", "sos_dict", ".", "dict", "(", ")", ",", "extra_dict", ")" ]
Evaluate an expression with sos dict.
[ "Evaluate", "an", "expression", "with", "sos", "dict", "." ]
python
train
Arkq/flake8-requirements
src/flake8_requirements/checker.py
https://github.com/Arkq/flake8-requirements/blob/d7cb84af2429a63635528b531111a5da527bf2d1/src/flake8_requirements/checker.py#L322-L385
def run(self): """Run checker.""" def split(module): """Split module into submodules.""" return tuple(module.split(".")) def modcmp(lib=(), test=()): """Compare import modules.""" if len(lib) > len(test): return False ...
[ "def", "run", "(", "self", ")", ":", "def", "split", "(", "module", ")", ":", "\"\"\"Split module into submodules.\"\"\"", "return", "tuple", "(", "module", ".", "split", "(", "\".\"", ")", ")", "def", "modcmp", "(", "lib", "=", "(", ")", ",", "test", ...
Run checker.
[ "Run", "checker", "." ]
python
train
rwl/godot
godot/xdot_parser.py
https://github.com/rwl/godot/blob/013687c9e8983d2aa2ceebb8a76c5c4f1e37c90f/godot/xdot_parser.py#L378-L384
def _proc_bspline(self, tokens, filled): """ Returns the components of a B-spline (Bezier curve). """ pts = [(p["x"], p["y"]) for p in tokens["points"]] component = BSpline(pen=self.pen, points=pts, filled=filled) return component
[ "def", "_proc_bspline", "(", "self", ",", "tokens", ",", "filled", ")", ":", "pts", "=", "[", "(", "p", "[", "\"x\"", "]", ",", "p", "[", "\"y\"", "]", ")", "for", "p", "in", "tokens", "[", "\"points\"", "]", "]", "component", "=", "BSpline", "("...
Returns the components of a B-spline (Bezier curve).
[ "Returns", "the", "components", "of", "a", "B", "-", "spline", "(", "Bezier", "curve", ")", "." ]
python
test
aouyar/PyMunin
pysysinfo/postgresql.py
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L88-L101
def _createStatsDict(self, headers, rows): """Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. Fi...
[ "def", "_createStatsDict", "(", "self", ",", "headers", ",", "rows", ")", ":", "dbstats", "=", "{", "}", "for", "row", "in", "rows", ":", "dbstats", "[", "row", "[", "0", "]", "]", "=", "dict", "(", "zip", "(", "headers", "[", "1", ":", "]", ",...
Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. First key is the database name and the second key is the...
[ "Utility", "method", "that", "returns", "database", "stats", "as", "a", "nested", "dictionary", "." ]
python
train
Unidata/MetPy
metpy/io/_nexrad_msgs/parse_spec.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/io/_nexrad_msgs/parse_spec.py#L126-L135
def fix_var_name(var_name): """Clean up and apply standard formatting to variable names.""" name = var_name.strip() for char in '(). /#,': name = name.replace(char, '_') name = name.replace('+', 'pos_') name = name.replace('-', 'neg_') if name.endswith('_'): name = name[:-1] ...
[ "def", "fix_var_name", "(", "var_name", ")", ":", "name", "=", "var_name", ".", "strip", "(", ")", "for", "char", "in", "'(). /#,'", ":", "name", "=", "name", ".", "replace", "(", "char", ",", "'_'", ")", "name", "=", "name", ".", "replace", "(", "...
Clean up and apply standard formatting to variable names.
[ "Clean", "up", "and", "apply", "standard", "formatting", "to", "variable", "names", "." ]
python
train
Chilipp/psy-simple
psy_simple/colors.py
https://github.com/Chilipp/psy-simple/blob/7d916406a6d3c3c27c0b7102f98fef07a4da0a61/psy_simple/colors.py#L155-L198
def get_cmap(name, lut=None): """ Returns the specified colormap. Parameters ---------- name: str or :class:`matplotlib.colors.Colormap` If a colormap, it returned unchanged. %(cmap_note)s lut: int An integer giving the number of entries desired in the lookup table ...
[ "def", "get_cmap", "(", "name", ",", "lut", "=", "None", ")", ":", "if", "name", "in", "rcParams", "[", "'colors.cmaps'", "]", ":", "colors", "=", "rcParams", "[", "'colors.cmaps'", "]", "[", "name", "]", "lut", "=", "lut", "or", "len", "(", "colors"...
Returns the specified colormap. Parameters ---------- name: str or :class:`matplotlib.colors.Colormap` If a colormap, it returned unchanged. %(cmap_note)s lut: int An integer giving the number of entries desired in the lookup table Returns ------- matplotlib.colors....
[ "Returns", "the", "specified", "colormap", "." ]
python
train
bioasp/iggy
src/sif_parser.py
https://github.com/bioasp/iggy/blob/451dee74f277d822d64cf8f3859c94b2f2b6d4db/src/sif_parser.py#L99-L118
def p_identlist(self, t): '''identlist : IDENT | NOT IDENT | IDENT AND identlist | NOT IDENT AND identlist ''' if len(t)==5 : #print(t[1],t[2],t[3],t[4]) t[0] = t[1]+t[2]+t[3]+t[4] elif len(t)==4 : #pri...
[ "def", "p_identlist", "(", "self", ",", "t", ")", ":", "if", "len", "(", "t", ")", "==", "5", ":", "#print(t[1],t[2],t[3],t[4])", "t", "[", "0", "]", "=", "t", "[", "1", "]", "+", "t", "[", "2", "]", "+", "t", "[", "3", "]", "+", "t", "[", ...
identlist : IDENT | NOT IDENT | IDENT AND identlist | NOT IDENT AND identlist
[ "identlist", ":", "IDENT", "|", "NOT", "IDENT", "|", "IDENT", "AND", "identlist", "|", "NOT", "IDENT", "AND", "identlist" ]
python
train
ihgazni2/elist
elist/elist.py
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L3318-L3370
def remove_many(ol,values,seqs,**kwargs): ''' from elist.elist import * ol = [1,'a',3,'b',5,'a',6,'a',7,'b',8,'b',9] id(ol) new = remove_many(ol,['a','b'],[1,2]) ol new id(ol) id(new) #### ol = [1,'a',3,'b',5,'a',6,'a',7,'b',8,'b',9] ...
[ "def", "remove_many", "(", "ol", ",", "values", ",", "seqs", ",", "*", "*", "kwargs", ")", ":", "if", "(", "'mode'", "in", "kwargs", ")", ":", "mode", "=", "kwargs", "[", "\"mode\"", "]", "else", ":", "mode", "=", "\"new\"", "values", "=", "copy", ...
from elist.elist import * ol = [1,'a',3,'b',5,'a',6,'a',7,'b',8,'b',9] id(ol) new = remove_many(ol,['a','b'],[1,2]) ol new id(ol) id(new) #### ol = [1,'a',3,'b',5,'a',6,'a',7,'b',8,'b',9] id(ol) rslt = remove_many(ol,['a','b'],[1,2]...
[ "from", "elist", ".", "elist", "import", "*", "ol", "=", "[", "1", "a", "3", "b", "5", "a", "6", "a", "7", "b", "8", "b", "9", "]", "id", "(", "ol", ")", "new", "=", "remove_many", "(", "ol", "[", "a", "b", "]", "[", "1", "2", "]", ")",...
python
valid
woolfson-group/isambard
isambard/optimisation/optimizer.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L47-L67
def buff_internal_eval(params): """Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score...
[ "def", "buff_internal_eval", "(", "params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", "=", "params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "build", "(", ")", "model", ".", "pack_new_sequences", "(", "s...
Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score: float BUFF internal energy sc...
[ "Builds", "and", "evaluates", "BUFF", "internal", "energy", "of", "a", "model", "in", "parallelization" ]
python
train
hugapi/hug
hug/output_format.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/output_format.py#L233-L250
def video(video_type, video_mime, doc=None): """Dynamically creates a video type handler for the specified video type""" @on_valid(video_mime) def video_handler(data, **kwargs): if hasattr(data, 'read'): return data elif hasattr(data, 'save'): output = stream() ...
[ "def", "video", "(", "video_type", ",", "video_mime", ",", "doc", "=", "None", ")", ":", "@", "on_valid", "(", "video_mime", ")", "def", "video_handler", "(", "data", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "data", ",", "'read'", ")"...
Dynamically creates a video type handler for the specified video type
[ "Dynamically", "creates", "a", "video", "type", "handler", "for", "the", "specified", "video", "type" ]
python
train
bitesofcode/projexui
projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xwalkthroughwidget/xwalkthroughscene.py#L66-L81
def findReference(self, name, cls=QtGui.QWidget): """ Looks up a reference from the widget based on its object name. :param name | <str> cls | <subclass of QtGui.QObject> :return <QtGui.QObject> || None """ ref_widg...
[ "def", "findReference", "(", "self", ",", "name", ",", "cls", "=", "QtGui", ".", "QWidget", ")", ":", "ref_widget", "=", "self", ".", "_referenceWidget", "if", "not", "ref_widget", ":", "return", "None", "if", "ref_widget", ".", "objectName", "(", ")", "...
Looks up a reference from the widget based on its object name. :param name | <str> cls | <subclass of QtGui.QObject> :return <QtGui.QObject> || None
[ "Looks", "up", "a", "reference", "from", "the", "widget", "based", "on", "its", "object", "name", ".", ":", "param", "name", "|", "<str", ">", "cls", "|", "<subclass", "of", "QtGui", ".", "QObject", ">", ":", "return", "<QtGui", ".", "QObject", ">", ...
python
train
agoragames/kairos
kairos/cassandra_backend.py
https://github.com/agoragames/kairos/blob/0b062d543b0f4a46df460fa0eb6ec281232ab179/kairos/cassandra_backend.py#L175-L185
def _insert(self, name, value, timestamp, intervals, **kwargs): ''' Insert the new value. ''' if self._value_type in QUOTE_TYPES and not QUOTE_MATCH.match(value): value = "'%s'"%(value) for interval,config in self._intervals.items(): timestamps = self._normalize_timestamps(timestamp, in...
[ "def", "_insert", "(", "self", ",", "name", ",", "value", ",", "timestamp", ",", "intervals", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "_value_type", "in", "QUOTE_TYPES", "and", "not", "QUOTE_MATCH", ".", "match", "(", "value", ")", ":", ...
Insert the new value.
[ "Insert", "the", "new", "value", "." ]
python
train
google/grr
grr/server/grr_response_server/client_index.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/client_index.py#L375-L406
def LookupClients(self, keywords): """Returns a list of client URNs associated with keywords. Args: keywords: The list of keywords to search by. Returns: A list of client URNs. Raises: ValueError: A string (single keyword) was passed instead of an iterable. """ if isinstance...
[ "def", "LookupClients", "(", "self", ",", "keywords", ")", ":", "if", "isinstance", "(", "keywords", ",", "string_types", ")", ":", "raise", "ValueError", "(", "\"Keywords should be an iterable, not a string (got %s).\"", "%", "keywords", ")", "start_time", ",", "fi...
Returns a list of client URNs associated with keywords. Args: keywords: The list of keywords to search by. Returns: A list of client URNs. Raises: ValueError: A string (single keyword) was passed instead of an iterable.
[ "Returns", "a", "list", "of", "client", "URNs", "associated", "with", "keywords", "." ]
python
train
fossasia/knittingpattern
knittingpattern/Row.py
https://github.com/fossasia/knittingpattern/blob/8e608896b0ab82fea1ca9fbfa2b4ee023d8c8027/knittingpattern/Row.py#L46-L54
def _instructions_changed(self, change): """Call when there is a change in the instructions.""" if change.adds(): for index, instruction in change.items(): if isinstance(instruction, dict): in_row = self._parser.instruction_in_row(self, instruction) ...
[ "def", "_instructions_changed", "(", "self", ",", "change", ")", ":", "if", "change", ".", "adds", "(", ")", ":", "for", "index", ",", "instruction", "in", "change", ".", "items", "(", ")", ":", "if", "isinstance", "(", "instruction", ",", "dict", ")",...
Call when there is a change in the instructions.
[ "Call", "when", "there", "is", "a", "change", "in", "the", "instructions", "." ]
python
valid
greenbone/ospd
ospd/misc.py
https://github.com/greenbone/ospd/blob/cef773166b15a19c17764721d3fe404fa0e107bf/ospd/misc.py#L742-L759
def port_list_compress(port_list): """ Compress a port list and return a string. """ if not port_list or len(port_list) == 0: LOGGER.info("Invalid or empty port list.") return '' port_list = sorted(set(port_list)) compressed_list = [] for key, group in itertools.groupby(enumerate(p...
[ "def", "port_list_compress", "(", "port_list", ")", ":", "if", "not", "port_list", "or", "len", "(", "port_list", ")", "==", "0", ":", "LOGGER", ".", "info", "(", "\"Invalid or empty port list.\"", ")", "return", "''", "port_list", "=", "sorted", "(", "set",...
Compress a port list and return a string.
[ "Compress", "a", "port", "list", "and", "return", "a", "string", "." ]
python
train
ellmetha/django-machina
machina/apps/forum_conversation/views.py
https://github.com/ellmetha/django-machina/blob/89ac083c1eaf1cfdeae6686ee094cc86362e8c69/machina/apps/forum_conversation/views.py#L209-L226
def get_post_form_kwargs(self): """ Returns the keyword arguments for instantiating the post form. """ kwargs = { 'user': self.request.user, 'forum': self.get_forum(), 'topic': self.get_topic(), } post = self.get_post() if post: kw...
[ "def", "get_post_form_kwargs", "(", "self", ")", ":", "kwargs", "=", "{", "'user'", ":", "self", ".", "request", ".", "user", ",", "'forum'", ":", "self", ".", "get_forum", "(", ")", ",", "'topic'", ":", "self", ".", "get_topic", "(", ")", ",", "}", ...
Returns the keyword arguments for instantiating the post form.
[ "Returns", "the", "keyword", "arguments", "for", "instantiating", "the", "post", "form", "." ]
python
train
ralphje/imagemounter
imagemounter/parser.py
https://github.com/ralphje/imagemounter/blob/86213781c366cad65096447d91f522f0a3fb4b93/imagemounter/parser.py#L152-L160
def get_volumes(self): """Gets a list of all volumes of all disks, concatenating :func:`Disk.get_volumes` of all disks. :rtype: list""" volumes = [] for disk in self.disks: volumes.extend(disk.get_volumes()) return volumes
[ "def", "get_volumes", "(", "self", ")", ":", "volumes", "=", "[", "]", "for", "disk", "in", "self", ".", "disks", ":", "volumes", ".", "extend", "(", "disk", ".", "get_volumes", "(", ")", ")", "return", "volumes" ]
Gets a list of all volumes of all disks, concatenating :func:`Disk.get_volumes` of all disks. :rtype: list
[ "Gets", "a", "list", "of", "all", "volumes", "of", "all", "disks", "concatenating", ":", "func", ":", "Disk", ".", "get_volumes", "of", "all", "disks", "." ]
python
train
lebinh/aq
aq/engines.py
https://github.com/lebinh/aq/blob/eb366dd063db25598daa70a216170776e83383f4/aq/engines.py#L75-L89
def load_table(self, table): """ Load resources as specified by given table into our db. """ region = table.database if table.database else self.default_region resource_name, collection_name = table.table.split('_', 1) # we use underscore "_" instead of dash "-" for regio...
[ "def", "load_table", "(", "self", ",", "table", ")", ":", "region", "=", "table", ".", "database", "if", "table", ".", "database", "else", "self", ".", "default_region", "resource_name", ",", "collection_name", "=", "table", ".", "table", ".", "split", "("...
Load resources as specified by given table into our db.
[ "Load", "resources", "as", "specified", "by", "given", "table", "into", "our", "db", "." ]
python
train
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2363-L2374
def cublasSger(handle, m, n, alpha, x, incx, y, incy, A, lda): """ Rank-1 operation on real general matrix. """ status = _libcublas.cublasSger_v2(handle, m, n, ctypes.byref(ctypes.c_float(alpha)), ...
[ "def", "cublasSger", "(", "handle", ",", "m", ",", "n", ",", "alpha", ",", "x", ",", "incx", ",", "y", ",", "incy", ",", "A", ",", "lda", ")", ":", "status", "=", "_libcublas", ".", "cublasSger_v2", "(", "handle", ",", "m", ",", "n", ",", "ctyp...
Rank-1 operation on real general matrix.
[ "Rank", "-", "1", "operation", "on", "real", "general", "matrix", "." ]
python
train
RLBot/RLBot
src/main/python/rlbot/agents/base_agent.py
https://github.com/RLBot/RLBot/blob/3f9b6bec8b9baf4dcfff0f6cf3103c8744ac6234/src/main/python/rlbot/agents/base_agent.py#L96-L105
def send_quick_chat(self, team_only, quick_chat): """ Sends a quick chat to the other bots. If it is QuickChats.CHAT_NONE or None it does not send a quick chat to other bots. :param team_only: either True or False, this says if the quick chat should only go to team members. :para...
[ "def", "send_quick_chat", "(", "self", ",", "team_only", ",", "quick_chat", ")", ":", "if", "quick_chat", "==", "QuickChats", ".", "CHAT_NONE", "or", "quick_chat", "is", "None", ":", "return", "self", ".", "__quick_chat_func", "(", "team_only", ",", "quick_cha...
Sends a quick chat to the other bots. If it is QuickChats.CHAT_NONE or None it does not send a quick chat to other bots. :param team_only: either True or False, this says if the quick chat should only go to team members. :param quick_chat: The quick chat selection, available chats are defined in...
[ "Sends", "a", "quick", "chat", "to", "the", "other", "bots", ".", "If", "it", "is", "QuickChats", ".", "CHAT_NONE", "or", "None", "it", "does", "not", "send", "a", "quick", "chat", "to", "other", "bots", ".", ":", "param", "team_only", ":", "either", ...
python
train
ftao/python-ifcfg
src/ifcfg/__init__.py
https://github.com/ftao/python-ifcfg/blob/724a4a103088fee7dc2bc2f63b0b9006a614e1d0/src/ifcfg/__init__.py#L18-L39
def get_parser_class(): """ Returns the parser according to the system platform """ global distro if distro == 'Linux': Parser = parser.LinuxParser if not os.path.exists(Parser.get_command()[0]): Parser = parser.UnixIPParser elif distro in ['Darwin', 'MacOSX']: ...
[ "def", "get_parser_class", "(", ")", ":", "global", "distro", "if", "distro", "==", "'Linux'", ":", "Parser", "=", "parser", ".", "LinuxParser", "if", "not", "os", ".", "path", ".", "exists", "(", "Parser", ".", "get_command", "(", ")", "[", "0", "]", ...
Returns the parser according to the system platform
[ "Returns", "the", "parser", "according", "to", "the", "system", "platform" ]
python
train
GeorgeArgyros/symautomata
symautomata/pdacnf.py
https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/pdacnf.py#L106-L117
def get(self, statediag): """ Args: statediag (list): The states of the PDA Returns: list: A reduced list of states using BFS """ if len(statediag) < 1: print 'PDA is empty and can not be reduced' return statediag newstatedi...
[ "def", "get", "(", "self", ",", "statediag", ")", ":", "if", "len", "(", "statediag", ")", "<", "1", ":", "print", "'PDA is empty and can not be reduced'", "return", "statediag", "newstatediag", "=", "self", ".", "bfs", "(", "statediag", ",", "statediag", "[...
Args: statediag (list): The states of the PDA Returns: list: A reduced list of states using BFS
[ "Args", ":", "statediag", "(", "list", ")", ":", "The", "states", "of", "the", "PDA", "Returns", ":", "list", ":", "A", "reduced", "list", "of", "states", "using", "BFS" ]
python
train
twisted/axiom
benchmark/benchlib.py
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/benchmark/benchlib.py#L13-L22
def itemTypeWithSomeAttributes(attributeTypes): """ Create a new L{Item} subclass with L{numAttributes} integers in its schema. """ class SomeItem(Item): typeName = 'someitem_' + str(typeNameCounter()) for i, attributeType in enumerate(attributeTypes): locals()['attr_' + ...
[ "def", "itemTypeWithSomeAttributes", "(", "attributeTypes", ")", ":", "class", "SomeItem", "(", "Item", ")", ":", "typeName", "=", "'someitem_'", "+", "str", "(", "typeNameCounter", "(", ")", ")", "for", "i", ",", "attributeType", "in", "enumerate", "(", "at...
Create a new L{Item} subclass with L{numAttributes} integers in its schema.
[ "Create", "a", "new", "L", "{", "Item", "}", "subclass", "with", "L", "{", "numAttributes", "}", "integers", "in", "its", "schema", "." ]
python
train
deepmind/pysc2
pysc2/lib/stopwatch.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/stopwatch.py#L242-L252
def parse(s): """Parse the output below to create a new StopWatch.""" stopwatch = StopWatch() for line in s.splitlines(): if line.strip(): parts = line.split(None) name = parts[0] if name != "%": # ie not the header line rest = (float(v) for v in parts[2:]) ...
[ "def", "parse", "(", "s", ")", ":", "stopwatch", "=", "StopWatch", "(", ")", "for", "line", "in", "s", ".", "splitlines", "(", ")", ":", "if", "line", ".", "strip", "(", ")", ":", "parts", "=", "line", ".", "split", "(", "None", ")", "name", "=...
Parse the output below to create a new StopWatch.
[ "Parse", "the", "output", "below", "to", "create", "a", "new", "StopWatch", "." ]
python
train
danielhrisca/asammdf
benchmarks/gen_images.py
https://github.com/danielhrisca/asammdf/blob/3c7a1fd19c957ceebe4dcdbb2abf00806c2bdb66/benchmarks/gen_images.py#L8-L94
def generate_graphs(result, topic, aspect, for_doc=False): """ genrate graphs from result file Parameters ---------- result : str path to result file topic : str benchmark topic; for example "Open file" or "Save file" aspect : str performance indiitemsor; can be "ram" (R...
[ "def", "generate_graphs", "(", "result", ",", "topic", ",", "aspect", ",", "for_doc", "=", "False", ")", ":", "result", "=", "result", "topic", "=", "topic", "aspect", "=", "aspect", "for_doc", "=", "for_doc", "with", "open", "(", "result", ",", "'r'", ...
genrate graphs from result file Parameters ---------- result : str path to result file topic : str benchmark topic; for example "Open file" or "Save file" aspect : str performance indiitemsor; can be "ram" (RAM memory usage) or "time" (elapsed time) for_doc : bool ...
[ "genrate", "graphs", "from", "result", "file" ]
python
train
hubo1016/vlcp
vlcp/event/core.py
https://github.com/hubo1016/vlcp/blob/239055229ec93a99cc7e15208075724ccf543bd1/vlcp/event/core.py#L303-L518
def main(self, installsignal = True, sendinit = True): ''' Start main loop ''' if installsignal: sigterm = signal(SIGTERM, self._quitsignal) sigint = signal(SIGINT, self._quitsignal) try: from signal import SIGUSR1 sigus...
[ "def", "main", "(", "self", ",", "installsignal", "=", "True", ",", "sendinit", "=", "True", ")", ":", "if", "installsignal", ":", "sigterm", "=", "signal", "(", "SIGTERM", ",", "self", ".", "_quitsignal", ")", "sigint", "=", "signal", "(", "SIGINT", "...
Start main loop
[ "Start", "main", "loop" ]
python
train
shi-cong/PYSTUDY
PYSTUDY/middleware/rabbitmqlib.py
https://github.com/shi-cong/PYSTUDY/blob/c8da7128ea18ecaa5849f2066d321e70d6f97f70/PYSTUDY/middleware/rabbitmqlib.py#L107-L114
def store_data(self, data): """ 存储数据到存储队列 :param data: 数据 :return: """ self.ch.basic_publish(exchange='', routing_key=self.store_queue, properties=pika.BasicProperties(delivery_mode=2), body=data)
[ "def", "store_data", "(", "self", ",", "data", ")", ":", "self", ".", "ch", ".", "basic_publish", "(", "exchange", "=", "''", ",", "routing_key", "=", "self", ".", "store_queue", ",", "properties", "=", "pika", ".", "BasicProperties", "(", "delivery_mode",...
存储数据到存储队列 :param data: 数据 :return:
[ "存储数据到存储队列", ":", "param", "data", ":", "数据", ":", "return", ":" ]
python
train
honzamach/pydgets
pydgets/widgets.py
https://github.com/honzamach/pydgets/blob/5ca4ce19fc2d9b5f41441fb9163810f8ca502e79/pydgets/widgets.py#L1159-L1176
def fmt_row(self, columns, dimensions, row, **settings): """ Format single table row. """ cells = [] i = 0 for column in columns: cells.append(self.fmt_cell( row[i], dimensions[i], column, ...
[ "def", "fmt_row", "(", "self", ",", "columns", ",", "dimensions", ",", "row", ",", "*", "*", "settings", ")", ":", "cells", "=", "[", "]", "i", "=", "0", "for", "column", "in", "columns", ":", "cells", ".", "append", "(", "self", ".", "fmt_cell", ...
Format single table row.
[ "Format", "single", "table", "row", "." ]
python
train
odlgroup/odl
odl/contrib/datasets/images/cambridge.py
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/datasets/images/cambridge.py#L32-L59
def convert(image, shape, gray=False, dtype='float64', normalize='max'): """Convert image to standardized format. Several properties of the input image may be changed including the shape, data type and maximal value of the image. In addition, this function may convert the image into an ODL object and/o...
[ "def", "convert", "(", "image", ",", "shape", ",", "gray", "=", "False", ",", "dtype", "=", "'float64'", ",", "normalize", "=", "'max'", ")", ":", "image", "=", "image", ".", "astype", "(", "dtype", ")", "if", "gray", ":", "image", "[", "...", ",",...
Convert image to standardized format. Several properties of the input image may be changed including the shape, data type and maximal value of the image. In addition, this function may convert the image into an ODL object and/or a gray scale image.
[ "Convert", "image", "to", "standardized", "format", "." ]
python
train
theonion/django-bulbs
bulbs/content/serializers.py
https://github.com/theonion/django-bulbs/blob/0c0e6e3127a7dc487b96677fab95cacd2b3806da/bulbs/content/serializers.py#L24-L28
def to_internal_value(self, value): """Convert to integer id.""" natural_key = value.split("_") content_type = ContentType.objects.get_by_natural_key(*natural_key) return content_type.id
[ "def", "to_internal_value", "(", "self", ",", "value", ")", ":", "natural_key", "=", "value", ".", "split", "(", "\"_\"", ")", "content_type", "=", "ContentType", ".", "objects", ".", "get_by_natural_key", "(", "*", "natural_key", ")", "return", "content_type"...
Convert to integer id.
[ "Convert", "to", "integer", "id", "." ]
python
train
agoragames/haigha
haigha/reader.py
https://github.com/agoragames/haigha/blob/7b004e1c0316ec14b94fec1c54554654c38b1a25/haigha/reader.py#L123-L145
def read_bits(self, num): ''' Read several bits packed into the same field. Will return as a list. The bit field itself is little-endian, though the order of the returned array looks big-endian for ease of decomposition. Reader('\x02').read_bits(2) -> [False,True] Reader...
[ "def", "read_bits", "(", "self", ",", "num", ")", ":", "# Perform a faster check on underflow", "if", "self", ".", "_pos", ">=", "self", ".", "_end_pos", ":", "raise", "self", ".", "BufferUnderflow", "(", ")", "if", "num", "<", "0", "or", "num", ">=", "9...
Read several bits packed into the same field. Will return as a list. The bit field itself is little-endian, though the order of the returned array looks big-endian for ease of decomposition. Reader('\x02').read_bits(2) -> [False,True] Reader('\x08').read_bits(2) -> [False,Tr...
[ "Read", "several", "bits", "packed", "into", "the", "same", "field", ".", "Will", "return", "as", "a", "list", ".", "The", "bit", "field", "itself", "is", "little", "-", "endian", "though", "the", "order", "of", "the", "returned", "array", "looks", "big"...
python
train
TangoAlpha/liffylights
liffylights.py
https://github.com/TangoAlpha/liffylights/blob/7ae9ed947ecf039734014d98b6e18de0f26fa1d3/liffylights.py#L130-L153
def _gen_header(self, sequence, payloadtype): """ Create packet header. """ protocol = bytearray.fromhex("00 34") source = bytearray.fromhex("42 52 4b 52") target = bytearray.fromhex("00 00 00 00 00 00 00 00") reserved1 = bytearray.fromhex("00 00 00 00 00 00") sequence = ...
[ "def", "_gen_header", "(", "self", ",", "sequence", ",", "payloadtype", ")", ":", "protocol", "=", "bytearray", ".", "fromhex", "(", "\"00 34\"", ")", "source", "=", "bytearray", ".", "fromhex", "(", "\"42 52 4b 52\"", ")", "target", "=", "bytearray", ".", ...
Create packet header.
[ "Create", "packet", "header", "." ]
python
train
seung-lab/cloud-volume
cloudvolume/cacheservice.py
https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cacheservice.py#L177-L233
def check_info_validity(self): """ ValueError if cache differs at all from source data layer with an excepton for volume_size which prints a warning. """ cache_info = self.get_json('info') if not cache_info: return fresh_info = self.vol._fetch_info() mismatch_error = ValueError("...
[ "def", "check_info_validity", "(", "self", ")", ":", "cache_info", "=", "self", ".", "get_json", "(", "'info'", ")", "if", "not", "cache_info", ":", "return", "fresh_info", "=", "self", ".", "vol", ".", "_fetch_info", "(", ")", "mismatch_error", "=", "Valu...
ValueError if cache differs at all from source data layer with an excepton for volume_size which prints a warning.
[ "ValueError", "if", "cache", "differs", "at", "all", "from", "source", "data", "layer", "with", "an", "excepton", "for", "volume_size", "which", "prints", "a", "warning", "." ]
python
train
mehcode/python-saml
saml/signature.py
https://github.com/mehcode/python-saml/blob/33ed62018efa9ec15b551f309429de510fa44321/saml/signature.py#L113-L166
def verify(xml, stream): """ Verify the signaure of an XML document with the given certificate. Returns `True` if the document is signed with a valid signature. Returns `False` if the document is not signed or if the signature is invalid. :param lxml.etree._Element xml: The document to sign ...
[ "def", "verify", "(", "xml", ",", "stream", ")", ":", "# Import xmlsec here to delay initializing the C library in", "# case we don't need it.", "import", "xmlsec", "# Find the <Signature/> node.", "signature_node", "=", "xmlsec", ".", "tree", ".", "find_node", "(", "xml", ...
Verify the signaure of an XML document with the given certificate. Returns `True` if the document is signed with a valid signature. Returns `False` if the document is not signed or if the signature is invalid. :param lxml.etree._Element xml: The document to sign :param file stream: The private key ...
[ "Verify", "the", "signaure", "of", "an", "XML", "document", "with", "the", "given", "certificate", ".", "Returns", "True", "if", "the", "document", "is", "signed", "with", "a", "valid", "signature", ".", "Returns", "False", "if", "the", "document", "is", "...
python
valid
wandb/client
wandb/vendor/prompt_toolkit/shortcuts.py
https://github.com/wandb/client/blob/7d08954ed5674fee223cd85ed0d8518fe47266b2/wandb/vendor/prompt_toolkit/shortcuts.py#L664-L671
def confirm(message='Confirm (y or n) '): """ Display a confirmation prompt. """ assert isinstance(message, text_type) app = create_confirm_application(message) return run_application(app)
[ "def", "confirm", "(", "message", "=", "'Confirm (y or n) '", ")", ":", "assert", "isinstance", "(", "message", ",", "text_type", ")", "app", "=", "create_confirm_application", "(", "message", ")", "return", "run_application", "(", "app", ")" ]
Display a confirmation prompt.
[ "Display", "a", "confirmation", "prompt", "." ]
python
train
twilio/twilio-python
twilio/rest/api/v2010/account/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/__init__.py#L474-L483
def new_keys(self): """ Access the new_keys :returns: twilio.rest.api.v2010.account.new_key.NewKeyList :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList """ if self._new_keys is None: self._new_keys = NewKeyList(self._version, account_sid=self._solutio...
[ "def", "new_keys", "(", "self", ")", ":", "if", "self", ".", "_new_keys", "is", "None", ":", "self", ".", "_new_keys", "=", "NewKeyList", "(", "self", ".", "_version", ",", "account_sid", "=", "self", ".", "_solution", "[", "'sid'", "]", ",", ")", "r...
Access the new_keys :returns: twilio.rest.api.v2010.account.new_key.NewKeyList :rtype: twilio.rest.api.v2010.account.new_key.NewKeyList
[ "Access", "the", "new_keys" ]
python
train
PyMLGame/pymlgame
game_example.py
https://github.com/PyMLGame/pymlgame/blob/450fe77d35f9a26c107586d6954f69c3895bf504/game_example.py#L134-L144
def gameloop(self): """ A game loop that circles through the methods. """ try: while True: self.handle_events() self.update() self.render() except KeyboardInterrupt: pass
[ "def", "gameloop", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "handle_events", "(", ")", "self", ".", "update", "(", ")", "self", ".", "render", "(", ")", "except", "KeyboardInterrupt", ":", "pass" ]
A game loop that circles through the methods.
[ "A", "game", "loop", "that", "circles", "through", "the", "methods", "." ]
python
train
apache/incubator-heron
heron/tools/common/src/python/access/heron_api.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/tools/common/src/python/access/heron_api.py#L772-L799
def fetch_max(self, cluster, metric, topology, component, instance, timerange, environ=None): ''' :param cluster: :param metric: :param topology: :param component: :param instance: :param timerange: :param environ: :return: ''' components = [component] if component != "*" els...
[ "def", "fetch_max", "(", "self", ",", "cluster", ",", "metric", ",", "topology", ",", "component", ",", "instance", ",", "timerange", ",", "environ", "=", "None", ")", ":", "components", "=", "[", "component", "]", "if", "component", "!=", "\"*\"", "else...
:param cluster: :param metric: :param topology: :param component: :param instance: :param timerange: :param environ: :return:
[ ":", "param", "cluster", ":", ":", "param", "metric", ":", ":", "param", "topology", ":", ":", "param", "component", ":", ":", "param", "instance", ":", ":", "param", "timerange", ":", ":", "param", "environ", ":", ":", "return", ":" ]
python
valid
lpantano/seqcluster
seqcluster/libs/thinkbayes.py
https://github.com/lpantano/seqcluster/blob/774e23add8cd4fdc83d626cea3bd1f458e7d060d/seqcluster/libs/thinkbayes.py#L1633-L1649
def GaussianCdfInverse(p, mu=0, sigma=1): """Evaluates the inverse CDF of the gaussian distribution. See http://en.wikipedia.org/wiki/Normal_distribution#Quantile_function Args: p: float mu: mean parameter sigma: standard deviation parameter Returns...
[ "def", "GaussianCdfInverse", "(", "p", ",", "mu", "=", "0", ",", "sigma", "=", "1", ")", ":", "x", "=", "ROOT2", "*", "erfinv", "(", "2", "*", "p", "-", "1", ")", "return", "mu", "+", "x", "*", "sigma" ]
Evaluates the inverse CDF of the gaussian distribution. See http://en.wikipedia.org/wiki/Normal_distribution#Quantile_function Args: p: float mu: mean parameter sigma: standard deviation parameter Returns: float
[ "Evaluates", "the", "inverse", "CDF", "of", "the", "gaussian", "distribution", "." ]
python
train
mikusjelly/apkutils
apkutils/elf/elfparser.py
https://github.com/mikusjelly/apkutils/blob/2db1ed0cdb610dfc55bfd77266e9a91e4764bba4/apkutils/elf/elfparser.py#L87-L100
def _section_from_spec(self, spec): ''' Retrieve a section given a "spec" (either number or name). Return None if no such section exists in the file. ''' try: num = int(spec) if num < self.elf_file.num_sections(): return sel...
[ "def", "_section_from_spec", "(", "self", ",", "spec", ")", ":", "try", ":", "num", "=", "int", "(", "spec", ")", "if", "num", "<", "self", ".", "elf_file", ".", "num_sections", "(", ")", ":", "return", "self", ".", "elf_file", ".", "get_section", "(...
Retrieve a section given a "spec" (either number or name). Return None if no such section exists in the file.
[ "Retrieve", "a", "section", "given", "a", "spec", "(", "either", "number", "or", "name", ")", ".", "Return", "None", "if", "no", "such", "section", "exists", "in", "the", "file", "." ]
python
train
mabuchilab/QNET
src/qnet/algebra/core/circuit_algebra.py
https://github.com/mabuchilab/QNET/blob/cc20d26dad78691d34c67173e5cd67dcac94208a/src/qnet/algebra/core/circuit_algebra.py#L130-L152
def get_blocks(self, block_structure=None): """For a reducible circuit, get a sequence of subblocks that when concatenated again yield the original circuit. The block structure given has to be compatible with the circuits actual block structure, i.e. it can only be more coarse-grained. ...
[ "def", "get_blocks", "(", "self", ",", "block_structure", "=", "None", ")", ":", "if", "block_structure", "is", "None", ":", "block_structure", "=", "self", ".", "block_structure", "try", ":", "return", "self", ".", "_get_blocks", "(", "block_structure", ")", ...
For a reducible circuit, get a sequence of subblocks that when concatenated again yield the original circuit. The block structure given has to be compatible with the circuits actual block structure, i.e. it can only be more coarse-grained. Args: block_structure (tuple): The...
[ "For", "a", "reducible", "circuit", "get", "a", "sequence", "of", "subblocks", "that", "when", "concatenated", "again", "yield", "the", "original", "circuit", ".", "The", "block", "structure", "given", "has", "to", "be", "compatible", "with", "the", "circuits"...
python
train
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L393-L399
def yaml(self): """ returns the yaml output of the dict. """ return ordered_dump(OrderedDict(self), Dumper=yaml.SafeDumper, default_flow_style=False)
[ "def", "yaml", "(", "self", ")", ":", "return", "ordered_dump", "(", "OrderedDict", "(", "self", ")", ",", "Dumper", "=", "yaml", ".", "SafeDumper", ",", "default_flow_style", "=", "False", ")" ]
returns the yaml output of the dict.
[ "returns", "the", "yaml", "output", "of", "the", "dict", "." ]
python
train
gabstopper/smc-python
smc/core/engine.py
https://github.com/gabstopper/smc-python/blob/e027b8a5dcfaf884eada32d113d41c1e56b32457/smc/core/engine.py#L1007-L1024
def refresh(self, timeout=3, wait_for_finish=False, **kw): """ Refresh existing policy on specified device. This is an asynchronous call that will return a 'follower' link that can be queried to determine the status of the task. :: poller = engine.refresh() ...
[ "def", "refresh", "(", "self", ",", "timeout", "=", "3", ",", "wait_for_finish", "=", "False", ",", "*", "*", "kw", ")", ":", "return", "Task", ".", "execute", "(", "self", ",", "'refresh'", ",", "timeout", "=", "timeout", ",", "wait_for_finish", "=", ...
Refresh existing policy on specified device. This is an asynchronous call that will return a 'follower' link that can be queried to determine the status of the task. :: poller = engine.refresh() while not poller.done(): poller.wait(5) prin...
[ "Refresh", "existing", "policy", "on", "specified", "device", ".", "This", "is", "an", "asynchronous", "call", "that", "will", "return", "a", "follower", "link", "that", "can", "be", "queried", "to", "determine", "the", "status", "of", "the", "task", ".", ...
python
train
bd808/python-iptools
iptools/__init__.py
https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/__init__.py#L58-L65
def _address2long(address): """ Convert an address string to a long. """ parsed = ipv4.ip2long(address) if parsed is None: parsed = ipv6.ip2long(address) return parsed
[ "def", "_address2long", "(", "address", ")", ":", "parsed", "=", "ipv4", ".", "ip2long", "(", "address", ")", "if", "parsed", "is", "None", ":", "parsed", "=", "ipv6", ".", "ip2long", "(", "address", ")", "return", "parsed" ]
Convert an address string to a long.
[ "Convert", "an", "address", "string", "to", "a", "long", "." ]
python
train
Telefonica/toolium
toolium/pageelements/page_element.py
https://github.com/Telefonica/toolium/blob/56847c243b3a98876df74c184b75e43f8810e475/toolium/pageelements/page_element.py#L103-L111
def scroll_element_into_view(self): """Scroll element into view :returns: page element instance """ x = self.web_element.location['x'] y = self.web_element.location['y'] self.driver.execute_script('window.scrollTo({0}, {1})'.format(x, y)) return self
[ "def", "scroll_element_into_view", "(", "self", ")", ":", "x", "=", "self", ".", "web_element", ".", "location", "[", "'x'", "]", "y", "=", "self", ".", "web_element", ".", "location", "[", "'y'", "]", "self", ".", "driver", ".", "execute_script", "(", ...
Scroll element into view :returns: page element instance
[ "Scroll", "element", "into", "view" ]
python
train
Contraz/demosys-py
demosys/loaders/scene/gltf.py
https://github.com/Contraz/demosys-py/blob/6466128a3029c4d09631420ccce73024025bd5b6/demosys/loaders/scene/gltf.py#L474-L476
def interleaves(self, info): """Does the buffer interleave with this one?""" return info.byte_offset == self.component_type.size * self.components
[ "def", "interleaves", "(", "self", ",", "info", ")", ":", "return", "info", ".", "byte_offset", "==", "self", ".", "component_type", ".", "size", "*", "self", ".", "components" ]
Does the buffer interleave with this one?
[ "Does", "the", "buffer", "interleave", "with", "this", "one?" ]
python
valid
ctuning/ck
ck/kernel.py
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L3118-L3261
def perform_remote_action(i): """ Input: { See 'perform_action' function } Output: { See 'perform_action' function } """ # Import modules compatible with Python 2.x and 3.x import urllib try: import urllib.request as urllib2 except: import urllib2 # pragma: no cover try: fr...
[ "def", "perform_remote_action", "(", "i", ")", ":", "# Import modules compatible with Python 2.x and 3.x", "import", "urllib", "try", ":", "import", "urllib", ".", "request", "as", "urllib2", "except", ":", "import", "urllib2", "# pragma: no cover", "try", ":", "from"...
Input: { See 'perform_action' function } Output: { See 'perform_action' function }
[ "Input", ":", "{", "See", "perform_action", "function", "}", "Output", ":", "{", "See", "perform_action", "function", "}" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/utils/learning_rate.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/learning_rate.py#L105-L114
def _global_step(hparams): """Adjust global step if a multi-step optimizer is used.""" step = tf.to_float(tf.train.get_or_create_global_step()) multiplier = hparams.optimizer_multistep_accumulate_steps if not multiplier: return step tf.logging.info("Dividing global step by %d for multi-step optimizer." ...
[ "def", "_global_step", "(", "hparams", ")", ":", "step", "=", "tf", ".", "to_float", "(", "tf", ".", "train", ".", "get_or_create_global_step", "(", ")", ")", "multiplier", "=", "hparams", ".", "optimizer_multistep_accumulate_steps", "if", "not", "multiplier", ...
Adjust global step if a multi-step optimizer is used.
[ "Adjust", "global", "step", "if", "a", "multi", "-", "step", "optimizer", "is", "used", "." ]
python
train
scanny/python-pptx
pptx/api.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/api.py#L20-L36
def Presentation(pptx=None): """ Return a |Presentation| object loaded from *pptx*, where *pptx* can be either a path to a ``.pptx`` file (a string) or a file-like object. If *pptx* is missing or ``None``, the built-in default presentation "template" is loaded. """ if pptx is None: p...
[ "def", "Presentation", "(", "pptx", "=", "None", ")", ":", "if", "pptx", "is", "None", ":", "pptx", "=", "_default_pptx_path", "(", ")", "presentation_part", "=", "Package", ".", "open", "(", "pptx", ")", ".", "main_document_part", "if", "not", "_is_pptx_p...
Return a |Presentation| object loaded from *pptx*, where *pptx* can be either a path to a ``.pptx`` file (a string) or a file-like object. If *pptx* is missing or ``None``, the built-in default presentation "template" is loaded.
[ "Return", "a", "|Presentation|", "object", "loaded", "from", "*", "pptx", "*", "where", "*", "pptx", "*", "can", "be", "either", "a", "path", "to", "a", ".", "pptx", "file", "(", "a", "string", ")", "or", "a", "file", "-", "like", "object", ".", "I...
python
train
jupyterhub/kubespawner
kubespawner/spawner.py
https://github.com/jupyterhub/kubespawner/blob/46a4b109c5e657a4c3d5bfa8ea4731ec6564ea13/kubespawner/spawner.py#L1839-L1873
def options_from_form(self, formdata): """get the option selected by the user on the form This only constructs the user_options dict, it should not actually load any options. That is done later in `.load_user_options()` Args: formdata: user selection returned by the...
[ "def", "options_from_form", "(", "self", ",", "formdata", ")", ":", "if", "not", "self", ".", "profile_list", "or", "self", ".", "_profile_list", "is", "None", ":", "return", "formdata", "# Default to first profile if somehow none is provided", "try", ":", "selected...
get the option selected by the user on the form This only constructs the user_options dict, it should not actually load any options. That is done later in `.load_user_options()` Args: formdata: user selection returned by the form To access to the value, you can use...
[ "get", "the", "option", "selected", "by", "the", "user", "on", "the", "form" ]
python
train
Alignak-monitoring/alignak
alignak/external_command.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/external_command.py#L2195-L2208
def disable_host_notifications(self, host): """Disable notifications for a host Format of the line that triggers function call:: DISABLE_HOST_NOTIFICATIONS;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None """ if h...
[ "def", "disable_host_notifications", "(", "self", ",", "host", ")", ":", "if", "host", ".", "notifications_enabled", ":", "host", ".", "modified_attributes", "|=", "DICT_MODATTR", "[", "\"MODATTR_NOTIFICATIONS_ENABLED\"", "]", ".", "value", "host", ".", "notificatio...
Disable notifications for a host Format of the line that triggers function call:: DISABLE_HOST_NOTIFICATIONS;<host_name> :param host: host to edit :type host: alignak.objects.host.Host :return: None
[ "Disable", "notifications", "for", "a", "host", "Format", "of", "the", "line", "that", "triggers", "function", "call", "::" ]
python
train
polyaxon/polyaxon-cli
polyaxon_cli/cli/job.py
https://github.com/polyaxon/polyaxon-cli/blob/a7f5eed74d4d909cad79059f3c21c58606881449/polyaxon_cli/cli/job.py#L131-L169
def update(ctx, name, description, tags): """Update job. Uses [Caching](/references/polyaxon-cli/#caching) Example: \b ```bash $ polyaxon job -j 2 update --description="new description for my job" ``` """ user, project_name, _job = get_job_or_local(ctx.obj.get('project'), ctx.obj....
[ "def", "update", "(", "ctx", ",", "name", ",", "description", ",", "tags", ")", ":", "user", ",", "project_name", ",", "_job", "=", "get_job_or_local", "(", "ctx", ".", "obj", ".", "get", "(", "'project'", ")", ",", "ctx", ".", "obj", ".", "get", "...
Update job. Uses [Caching](/references/polyaxon-cli/#caching) Example: \b ```bash $ polyaxon job -j 2 update --description="new description for my job" ```
[ "Update", "job", "." ]
python
valid
Sheeprider/BitBucket-api
bitbucket/bitbucket.py
https://github.com/Sheeprider/BitBucket-api/blob/be45515d506d87f14807a676f3c2f20d79674b75/bitbucket/bitbucket.py#L216-L251
def dispatch(self, method, url, auth=None, params=None, **kwargs): """ Send HTTP request, with given method, credentials and data to the given URL, and return the success and the result on success. """ r = Request( method=method, url=url, ...
[ "def", "dispatch", "(", "self", ",", "method", ",", "url", ",", "auth", "=", "None", ",", "params", "=", "None", ",", "*", "*", "kwargs", ")", ":", "r", "=", "Request", "(", "method", "=", "method", ",", "url", "=", "url", ",", "auth", "=", "au...
Send HTTP request, with given method, credentials and data to the given URL, and return the success and the result on success.
[ "Send", "HTTP", "request", "with", "given", "method", "credentials", "and", "data", "to", "the", "given", "URL", "and", "return", "the", "success", "and", "the", "result", "on", "success", "." ]
python
train
Robpol86/sphinxcontrib-versioning
sphinxcontrib/versioning/__main__.py
https://github.com/Robpol86/sphinxcontrib-versioning/blob/920edec0ac764081b583a2ecf4e6952762b9dbf2/sphinxcontrib/versioning/__main__.py#L80-L89
def invoke(self, ctx): """Inject overflow arguments into context state. :param click.core.Context ctx: Click context. :return: super() return value. """ if self.overflow: ctx.ensure_object(Config).update(dict(overflow=self.overflow)) return super(ClickGroup,...
[ "def", "invoke", "(", "self", ",", "ctx", ")", ":", "if", "self", ".", "overflow", ":", "ctx", ".", "ensure_object", "(", "Config", ")", ".", "update", "(", "dict", "(", "overflow", "=", "self", ".", "overflow", ")", ")", "return", "super", "(", "C...
Inject overflow arguments into context state. :param click.core.Context ctx: Click context. :return: super() return value.
[ "Inject", "overflow", "arguments", "into", "context", "state", "." ]
python
train
lreis2415/PyGeoC
pygeoc/vector.py
https://github.com/lreis2415/PyGeoC/blob/9a92d1a229bb74298e3c57f27c97079980b5f729/pygeoc/vector.py#L94-L117
def write_line_shp(line_list, out_shp): """Export ESRI Shapefile -- Line feature""" print('Write line shapefile: %s' % out_shp) driver = ogr_GetDriverByName(str('ESRI Shapefile')) if driver is None: print('ESRI Shapefile driver not available.') sys.exit(1) ...
[ "def", "write_line_shp", "(", "line_list", ",", "out_shp", ")", ":", "print", "(", "'Write line shapefile: %s'", "%", "out_shp", ")", "driver", "=", "ogr_GetDriverByName", "(", "str", "(", "'ESRI Shapefile'", ")", ")", "if", "driver", "is", "None", ":", "print...
Export ESRI Shapefile -- Line feature
[ "Export", "ESRI", "Shapefile", "--", "Line", "feature" ]
python
train
spdx/tools-python
spdx/parsers/tagvalue.py
https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/parsers/tagvalue.py#L400-L409
def p_file_contrib_1(self, p): """file_contrib : FILE_CONTRIB LINE""" try: if six.PY2: value = p[2].decode(encoding='utf-8') else: value = p[2] self.builder.add_file_contribution(self.document, value) except OrderError: ...
[ "def", "p_file_contrib_1", "(", "self", ",", "p", ")", ":", "try", ":", "if", "six", ".", "PY2", ":", "value", "=", "p", "[", "2", "]", ".", "decode", "(", "encoding", "=", "'utf-8'", ")", "else", ":", "value", "=", "p", "[", "2", "]", "self", ...
file_contrib : FILE_CONTRIB LINE
[ "file_contrib", ":", "FILE_CONTRIB", "LINE" ]
python
valid
quantopian/alphalens
alphalens/utils.py
https://github.com/quantopian/alphalens/blob/d43eac871bb061e956df936794d3dd514da99e44/alphalens/utils.py#L830-L853
def std_conversion(period_std, base_period): """ one_period_len standard deviation (or standard error) approximation Parameters ---------- period_std: pd.DataFrame DataFrame containing standard deviation or standard error values with column headings representing the return period. ...
[ "def", "std_conversion", "(", "period_std", ",", "base_period", ")", ":", "period_len", "=", "period_std", ".", "name", "conversion_factor", "=", "(", "pd", ".", "Timedelta", "(", "period_len", ")", "/", "pd", ".", "Timedelta", "(", "base_period", ")", ")", ...
one_period_len standard deviation (or standard error) approximation Parameters ---------- period_std: pd.DataFrame DataFrame containing standard deviation or standard error values with column headings representing the return period. base_period: string The base period length use...
[ "one_period_len", "standard", "deviation", "(", "or", "standard", "error", ")", "approximation" ]
python
train
breuleux/hrepr
hrepr/__init__.py
https://github.com/breuleux/hrepr/blob/a411395d31ac7c8c071d174e63a093751aa5997b/hrepr/__init__.py#L236-L256
def stdrepr_short(self, obj, *, cls=None, tag='span'): """ Standard short representation for objects, used for objects at a depth that exceeds ``hrepr_object.config.max_depth``. That representation is just the object's type between ``<>``s, e.g. ``<MyClass>``. This behav...
[ "def", "stdrepr_short", "(", "self", ",", "obj", ",", "*", ",", "cls", "=", "None", ",", "tag", "=", "'span'", ")", ":", "cls_name", "=", "obj", ".", "__class__", ".", "__name__", "if", "cls", "is", "None", ":", "cls", "=", "f'hrepr-short-{cls_name}'",...
Standard short representation for objects, used for objects at a depth that exceeds ``hrepr_object.config.max_depth``. That representation is just the object's type between ``<>``s, e.g. ``<MyClass>``. This behavior can be overriden with a ``__hrepr_short__`` method on the objec...
[ "Standard", "short", "representation", "for", "objects", "used", "for", "objects", "at", "a", "depth", "that", "exceeds", "hrepr_object", ".", "config", ".", "max_depth", ".", "That", "representation", "is", "just", "the", "object", "s", "type", "between", "<"...
python
train
angr/angr
angr/calling_conventions.py
https://github.com/angr/angr/blob/4e2f97d56af5419ee73bdb30482c8dd8ff5f3e40/angr/calling_conventions.py#L667-L687
def get_return_val(self, state, is_fp=None, size=None, stack_base=None): """ Get the return value out of the given state """ ty = self.func_ty.returnty if self.func_ty is not None else None if self.ret_val is not None: loc = self.ret_val elif is_fp is not None...
[ "def", "get_return_val", "(", "self", ",", "state", ",", "is_fp", "=", "None", ",", "size", "=", "None", ",", "stack_base", "=", "None", ")", ":", "ty", "=", "self", ".", "func_ty", ".", "returnty", "if", "self", ".", "func_ty", "is", "not", "None", ...
Get the return value out of the given state
[ "Get", "the", "return", "value", "out", "of", "the", "given", "state" ]
python
train
hyperledger/indy-plenum
plenum/server/catchup/catchup_rep_service.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/plenum/server/catchup/catchup_rep_service.py#L374-L425
def _has_valid_catchup_replies(self, seq_no: int, txns_to_process: List[Tuple[int, Any]]) -> Tuple[bool, str, int]: """ Transforms transactions for ledger! Returns: Whether catchup reply corresponding to seq_no Name of node from which txns came Number of tran...
[ "def", "_has_valid_catchup_replies", "(", "self", ",", "seq_no", ":", "int", ",", "txns_to_process", ":", "List", "[", "Tuple", "[", "int", ",", "Any", "]", "]", ")", "->", "Tuple", "[", "bool", ",", "str", ",", "int", "]", ":", "# TODO: Remove after sto...
Transforms transactions for ledger! Returns: Whether catchup reply corresponding to seq_no Name of node from which txns came Number of transactions ready to be processed
[ "Transforms", "transactions", "for", "ledger!" ]
python
train
rande/python-simple-ioc
ioc/extra/tornado/router.py
https://github.com/rande/python-simple-ioc/blob/36ddf667c1213a07a53cd4cdd708d02494e5190b/ioc/extra/tornado/router.py#L32-L42
def generate_static(self, path): """ This method generates a valid path to the public folder of the running project """ if not path: return "" if path[0] == '/': return "%s?v=%s" % (path, self.version) return "%s/%s?v=%s" % (self.static, path, se...
[ "def", "generate_static", "(", "self", ",", "path", ")", ":", "if", "not", "path", ":", "return", "\"\"", "if", "path", "[", "0", "]", "==", "'/'", ":", "return", "\"%s?v=%s\"", "%", "(", "path", ",", "self", ".", "version", ")", "return", "\"%s/%s?v...
This method generates a valid path to the public folder of the running project
[ "This", "method", "generates", "a", "valid", "path", "to", "the", "public", "folder", "of", "the", "running", "project" ]
python
train
saltstack/salt
salt/modules/netbox.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/netbox.py#L644-L697
def openconfig_lacp(device_name=None): ''' .. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_ YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for ag...
[ "def", "openconfig_lacp", "(", "device_name", "=", "None", ")", ":", "oc_lacp", "=", "{", "}", "interfaces", "=", "get_interfaces", "(", "device_name", "=", "device_name", ")", "for", "interface", "in", "interfaces", ":", "if", "not", "interface", "[", "'lag...
.. versionadded:: 2019.2.0 Return a dictionary structured as standardised in the `openconfig-lacp <http://ops.openconfig.net/branches/master/openconfig-lacp.html>`_ YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for aggregate interfaces. .. note:: The ``in...
[ "..", "versionadded", "::", "2019", ".", "2", ".", "0" ]
python
train
Devoxin/Lavalink.py
lavalink/PlayerManager.py
https://github.com/Devoxin/Lavalink.py/blob/63f55c3d726d24c4cfd3674d3cd6aab6f5be110d/lavalink/PlayerManager.py#L55-L60
def connected_channel(self): """ Returns the voice channel the player is connected to. """ if not self.channel_id: return None return self._lavalink.bot.get_channel(int(self.channel_id))
[ "def", "connected_channel", "(", "self", ")", ":", "if", "not", "self", ".", "channel_id", ":", "return", "None", "return", "self", ".", "_lavalink", ".", "bot", ".", "get_channel", "(", "int", "(", "self", ".", "channel_id", ")", ")" ]
Returns the voice channel the player is connected to.
[ "Returns", "the", "voice", "channel", "the", "player", "is", "connected", "to", "." ]
python
valid
rochacbruno/manage
manage/commands_collector.py
https://github.com/rochacbruno/manage/blob/e904c451862f036f4be8723df5704a9844103c74/manage/commands_collector.py#L10-L27
def add_click_commands(module, cli, command_dict, namespaced): """Loads all click commands""" module_commands = [ item for item in getmembers(module) if isinstance(item[1], BaseCommand) ] options = command_dict.get('config', {}) namespace = command_dict.get('namespace') for name,...
[ "def", "add_click_commands", "(", "module", ",", "cli", ",", "command_dict", ",", "namespaced", ")", ":", "module_commands", "=", "[", "item", "for", "item", "in", "getmembers", "(", "module", ")", "if", "isinstance", "(", "item", "[", "1", "]", ",", "Ba...
Loads all click commands
[ "Loads", "all", "click", "commands" ]
python
train
saltstack/salt
salt/utils/profile.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/profile.py#L30-L47
def profile_func(filename=None): ''' Decorator for adding profiling to a nested function in Salt ''' def proffunc(fun): def profiled_func(*args, **kwargs): logging.info('Profiling function %s', fun.__name__) try: profiler = cProfile.Profile() ...
[ "def", "profile_func", "(", "filename", "=", "None", ")", ":", "def", "proffunc", "(", "fun", ")", ":", "def", "profiled_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "info", "(", "'Profiling function %s'", ",", "fun", "."...
Decorator for adding profiling to a nested function in Salt
[ "Decorator", "for", "adding", "profiling", "to", "a", "nested", "function", "in", "Salt" ]
python
train
CartoDB/cartoframes
cartoframes/utils.py
https://github.com/CartoDB/cartoframes/blob/c94238a545f3dec45963dac3892540942b6f0df8/cartoframes/utils.py#L60-L67
def safe_quotes(text, escape_single_quotes=False): """htmlify string""" if isinstance(text, str): safe_text = text.replace('"', "&quot;") if escape_single_quotes: safe_text = safe_text.replace("'", "&#92;'") return safe_text.replace('True', 'true') return text
[ "def", "safe_quotes", "(", "text", ",", "escape_single_quotes", "=", "False", ")", ":", "if", "isinstance", "(", "text", ",", "str", ")", ":", "safe_text", "=", "text", ".", "replace", "(", "'\"'", ",", "\"&quot;\"", ")", "if", "escape_single_quotes", ":",...
htmlify string
[ "htmlify", "string" ]
python
train
tensorflow/cleverhans
examples/multigpu_advtrain/evaluator.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/multigpu_advtrain/evaluator.py#L138-L159
def eval_advs(self, x, y, preds_adv, X_test, Y_test, att_type): """ Evaluate the accuracy of the model on adversarial examples :param x: symbolic input to model. :param y: symbolic variable for the label. :param preds_adv: symbolic variable for the prediction on an adversarial...
[ "def", "eval_advs", "(", "self", ",", "x", ",", "y", ",", "preds_adv", ",", "X_test", ",", "Y_test", ",", "att_type", ")", ":", "end", "=", "(", "len", "(", "X_test", ")", "//", "self", ".", "batch_size", ")", "*", "self", ".", "batch_size", "if", ...
Evaluate the accuracy of the model on adversarial examples :param x: symbolic input to model. :param y: symbolic variable for the label. :param preds_adv: symbolic variable for the prediction on an adversarial example. :param X_test: NumPy array of test set inputs. :param Y_te...
[ "Evaluate", "the", "accuracy", "of", "the", "model", "on", "adversarial", "examples" ]
python
train
what-studio/profiling
profiling/tracing/__init__.py
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/tracing/__init__.py#L116-L124
def record_leaving(self, time, code, frame_key, parent_stats): """Left from a function call.""" try: stats = parent_stats.get_child(code) time_entered = self._times_entered.pop((code, frame_key)) except KeyError: return time_elapsed = time - time_enter...
[ "def", "record_leaving", "(", "self", ",", "time", ",", "code", ",", "frame_key", ",", "parent_stats", ")", ":", "try", ":", "stats", "=", "parent_stats", ".", "get_child", "(", "code", ")", "time_entered", "=", "self", ".", "_times_entered", ".", "pop", ...
Left from a function call.
[ "Left", "from", "a", "function", "call", "." ]
python
train
wavycloud/pyboto3
pyboto3/mturk.py
https://github.com/wavycloud/pyboto3/blob/924957ccf994303713a4eed90b775ff2ab95b2e5/pyboto3/mturk.py#L195-L442
def create_hit(MaxAssignments=None, AutoApprovalDelayInSeconds=None, LifetimeInSeconds=None, AssignmentDurationInSeconds=None, Reward=None, Title=None, Keywords=None, Description=None, Question=None, RequesterAnnotation=None, QualificationRequirements=None, UniqueRequestToken=None, AssignmentReviewPolicy=None, HITRevie...
[ "def", "create_hit", "(", "MaxAssignments", "=", "None", ",", "AutoApprovalDelayInSeconds", "=", "None", ",", "LifetimeInSeconds", "=", "None", ",", "AssignmentDurationInSeconds", "=", "None", ",", "Reward", "=", "None", ",", "Title", "=", "None", ",", "Keywords...
The CreateHIT operation creates a new Human Intelligence Task (HIT). The new HIT is made available for Workers to find and accept on the Amazon Mechanical Turk website. This operation allows you to specify a new HIT by passing in values for the properties of the HIT, such as its title, reward amount and number of a...
[ "The", "CreateHIT", "operation", "creates", "a", "new", "Human", "Intelligence", "Task", "(", "HIT", ")", ".", "The", "new", "HIT", "is", "made", "available", "for", "Workers", "to", "find", "and", "accept", "on", "the", "Amazon", "Mechanical", "Turk", "we...
python
train