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
Stranger6667/postmarker
postmarker/models/stats.py
https://github.com/Stranger6667/postmarker/blob/013224ab1761e95c488c7d2701e6fa83f3108d94/postmarker/models/stats.py#L67-L71
def clicks(self, tag=None, fromdate=None, todate=None): """ Gets total counts of unique links that were clicked. """ return self.call("GET", "/stats/outbound/clicks", tag=tag, fromdate=fromdate, todate=todate)
[ "def", "clicks", "(", "self", ",", "tag", "=", "None", ",", "fromdate", "=", "None", ",", "todate", "=", "None", ")", ":", "return", "self", ".", "call", "(", "\"GET\"", ",", "\"/stats/outbound/clicks\"", ",", "tag", "=", "tag", ",", "fromdate", "=", ...
Gets total counts of unique links that were clicked.
[ "Gets", "total", "counts", "of", "unique", "links", "that", "were", "clicked", "." ]
python
train
django-ses/django-ses
django_ses/__init__.py
https://github.com/django-ses/django-ses/blob/2f0fd8e3fdc76d3512982c0bb8e2f6e93e09fa3c/django_ses/__init__.py#L77-L96
def open(self): """Create a connection to the AWS API server. This can be reused for sending multiple emails. """ if self.connection: return False try: self.connection = SESConnection( aws_access_key_id=self._access_key_id, ...
[ "def", "open", "(", "self", ")", ":", "if", "self", ".", "connection", ":", "return", "False", "try", ":", "self", ".", "connection", "=", "SESConnection", "(", "aws_access_key_id", "=", "self", ".", "_access_key_id", ",", "aws_secret_access_key", "=", "self...
Create a connection to the AWS API server. This can be reused for sending multiple emails.
[ "Create", "a", "connection", "to", "the", "AWS", "API", "server", ".", "This", "can", "be", "reused", "for", "sending", "multiple", "emails", "." ]
python
train
trec-kba/streamcorpus-pipeline
streamcorpus_pipeline/_taggers.py
https://github.com/trec-kba/streamcorpus-pipeline/blob/8bb82ea1beb83c6b40ed03fa1659df2897c2292a/streamcorpus_pipeline/_taggers.py#L415-L451
def multi_token_match(stream_item, aligner_data): ''' iterate through tokens looking for near-exact matches to strings in si.ratings...mentions ''' tagger_id = _get_tagger_id(stream_item, aligner_data) sentences = stream_item.body.sentences.get(tagger_id) if not sentences: return...
[ "def", "multi_token_match", "(", "stream_item", ",", "aligner_data", ")", ":", "tagger_id", "=", "_get_tagger_id", "(", "stream_item", ",", "aligner_data", ")", "sentences", "=", "stream_item", ".", "body", ".", "sentences", ".", "get", "(", "tagger_id", ")", ...
iterate through tokens looking for near-exact matches to strings in si.ratings...mentions
[ "iterate", "through", "tokens", "looking", "for", "near", "-", "exact", "matches", "to", "strings", "in", "si", ".", "ratings", "...", "mentions" ]
python
test
TestInABox/stackInABox
stackinabox/util/requests_mock/core.py
https://github.com/TestInABox/stackInABox/blob/63ee457401e9a88d987f85f513eb512dcb12d984/stackinabox/util/requests_mock/core.py#L226-L228
def requests_post(url, data=None, json=None, **kwargs): """Requests-mock requests.post wrapper.""" return requests_request('post', url, data=data, json=json, **kwargs)
[ "def", "requests_post", "(", "url", ",", "data", "=", "None", ",", "json", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "requests_request", "(", "'post'", ",", "url", ",", "data", "=", "data", ",", "json", "=", "json", ",", "*", "*", ...
Requests-mock requests.post wrapper.
[ "Requests", "-", "mock", "requests", ".", "post", "wrapper", "." ]
python
train
PyHDI/Pyverilog
pyverilog/vparser/parser.py
https://github.com/PyHDI/Pyverilog/blob/b852cc5ed6a7a2712e33639f9d9782d0d1587a53/pyverilog/vparser/parser.py#L1886-L1889
def p_genvarlist(self, p): 'genvarlist : genvarlist COMMA genvar' p[0] = p[1] + (p[3],) p.set_lineno(0, p.lineno(1))
[ "def", "p_genvarlist", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]", "+", "(", "p", "[", "3", "]", ",", ")", "p", ".", "set_lineno", "(", "0", ",", "p", ".", "lineno", "(", "1", ")", ")" ]
genvarlist : genvarlist COMMA genvar
[ "genvarlist", ":", "genvarlist", "COMMA", "genvar" ]
python
train
HewlettPackard/python-hpOneView
hpOneView/resources/uncategorized/os_deployment_servers.py
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L153-L171
def delete(self, resource, force=False, timeout=-1): """ Deletes a Deployment Server object based on its UUID or URI. Args: resource (dict): Object to delete. force: If set to true, the operation completes despite any problems with ...
[ "def", "delete", "(", "self", ",", "resource", ",", "force", "=", "False", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "delete", "(", "resource", ",", "force", "=", "force", ",", "timeout", "=", "timeout", ")" ]
Deletes a Deployment Server object based on its UUID or URI. Args: resource (dict): Object to delete. force: If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The def...
[ "Deletes", "a", "Deployment", "Server", "object", "based", "on", "its", "UUID", "or", "URI", "." ]
python
train
pyviz/holoviews
holoviews/core/traversal.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/traversal.py#L40-L95
def unique_dimkeys(obj, default_dim='Frame'): """ Finds all common dimension keys in the object including subsets of dimensions. If there are is no common subset of dimensions, None is returned. Returns the list of dimensions followed by the list of unique keys. """ from .ndmapping impo...
[ "def", "unique_dimkeys", "(", "obj", ",", "default_dim", "=", "'Frame'", ")", ":", "from", ".", "ndmapping", "import", "NdMapping", ",", "item_check", "from", ".", "spaces", "import", "HoloMap", "key_dims", "=", "obj", ".", "traverse", "(", "lambda", "x", ...
Finds all common dimension keys in the object including subsets of dimensions. If there are is no common subset of dimensions, None is returned. Returns the list of dimensions followed by the list of unique keys.
[ "Finds", "all", "common", "dimension", "keys", "in", "the", "object", "including", "subsets", "of", "dimensions", ".", "If", "there", "are", "is", "no", "common", "subset", "of", "dimensions", "None", "is", "returned", "." ]
python
train
pennersr/django-allauth
allauth/socialaccount/models.py
https://github.com/pennersr/django-allauth/blob/f70cb3d622f992f15fe9b57098e0b328445b664e/allauth/socialaccount/models.py#L254-L285
def lookup(self): """ Lookup existing account, if any. """ assert not self.is_existing try: a = SocialAccount.objects.get(provider=self.account.provider, uid=self.account.uid) # Update account a.extra_d...
[ "def", "lookup", "(", "self", ")", ":", "assert", "not", "self", ".", "is_existing", "try", ":", "a", "=", "SocialAccount", ".", "objects", ".", "get", "(", "provider", "=", "self", ".", "account", ".", "provider", ",", "uid", "=", "self", ".", "acco...
Lookup existing account, if any.
[ "Lookup", "existing", "account", "if", "any", "." ]
python
train
bitcraze/crazyflie-lib-python
cflib/positioning/position_hl_commander.py
https://github.com/bitcraze/crazyflie-lib-python/blob/f6ebb4eb315bbe6e02db518936ac17fb615b2af8/cflib/positioning/position_hl_commander.py#L82-L110
def take_off(self, height=DEFAULT, velocity=DEFAULT): """ Takes off, that is starts the motors, goes straight up and hovers. Do not call this function if you use the with keyword. Take off is done automatically when the context is created. :param height: the height (meters) to h...
[ "def", "take_off", "(", "self", ",", "height", "=", "DEFAULT", ",", "velocity", "=", "DEFAULT", ")", ":", "if", "self", ".", "_is_flying", ":", "raise", "Exception", "(", "'Already flying'", ")", "if", "not", "self", ".", "_cf", ".", "is_connected", "(",...
Takes off, that is starts the motors, goes straight up and hovers. Do not call this function if you use the with keyword. Take off is done automatically when the context is created. :param height: the height (meters) to hover at. None uses the default height set when cons...
[ "Takes", "off", "that", "is", "starts", "the", "motors", "goes", "straight", "up", "and", "hovers", ".", "Do", "not", "call", "this", "function", "if", "you", "use", "the", "with", "keyword", ".", "Take", "off", "is", "done", "automatically", "when", "th...
python
train
skorch-dev/skorch
skorch/classifier.py
https://github.com/skorch-dev/skorch/blob/5b9b8b7b7712cb6e5aaa759d9608ea6269d5bcd3/skorch/classifier.py#L321-L362
def predict_proba(self, X): """Where applicable, return probability estimates for samples. If the module's forward method returns multiple outputs as a tuple, it is assumed that the first output contains the relevant information and the other values are ignored. If all v...
[ "def", "predict_proba", "(", "self", ",", "X", ")", ":", "y_probas", "=", "[", "]", "bce_logits_loss", "=", "isinstance", "(", "self", ".", "criterion_", ",", "torch", ".", "nn", ".", "BCEWithLogitsLoss", ")", "for", "yp", "in", "self", ".", "forward_ite...
Where applicable, return probability estimates for samples. If the module's forward method returns multiple outputs as a tuple, it is assumed that the first output contains the relevant information and the other values are ignored. If all values are relevant, consider using ...
[ "Where", "applicable", "return", "probability", "estimates", "for", "samples", "." ]
python
train
saltstack/salt
salt/states/win_path.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/win_path.py#L66-L234
def exists(name, index=None): ''' Add the directory to the system PATH at index location index Position where the directory should be placed in the PATH. This is 0-indexed, so 0 means to prepend at the very start of the PATH. .. note:: If the index is not specified, and...
[ "def", "exists", "(", "name", ",", "index", "=", "None", ")", ":", "try", ":", "name", "=", "os", ".", "path", ".", "normpath", "(", "salt", ".", "utils", ".", "stringutils", ".", "to_unicode", "(", "name", ")", ")", "except", "TypeError", ":", "na...
Add the directory to the system PATH at index location index Position where the directory should be placed in the PATH. This is 0-indexed, so 0 means to prepend at the very start of the PATH. .. note:: If the index is not specified, and the directory needs to be added ...
[ "Add", "the", "directory", "to", "the", "system", "PATH", "at", "index", "location" ]
python
train
ultrabug/uhashring
uhashring/ring.py
https://github.com/ultrabug/uhashring/blob/2297471a392e28ed913b3276c2f48d0c01523375/uhashring/ring.py#L140-L168
def _get(self, key, what): """Generic getter magic method. The node with the nearest but not less hash value is returned. :param key: the key to look for. :param what: the information to look for in, allowed values: - instance (default): associated node instance ...
[ "def", "_get", "(", "self", ",", "key", ",", "what", ")", ":", "if", "not", "self", ".", "runtime", ".", "_ring", ":", "return", "None", "pos", "=", "self", ".", "_get_pos", "(", "key", ")", "if", "what", "==", "'pos'", ":", "return", "pos", "nod...
Generic getter magic method. The node with the nearest but not less hash value is returned. :param key: the key to look for. :param what: the information to look for in, allowed values: - instance (default): associated node instance - nodename: node name - p...
[ "Generic", "getter", "magic", "method", "." ]
python
train
opendatateam/udata
udata/core/dataset/commands.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/core/dataset/commands.py#L30-L64
def licenses(source=DEFAULT_LICENSE_FILE): '''Feed the licenses from a JSON file''' if source.startswith('http'): json_licenses = requests.get(source).json() else: with open(source) as fp: json_licenses = json.load(fp) if len(json_licenses): log.info('Dropping existi...
[ "def", "licenses", "(", "source", "=", "DEFAULT_LICENSE_FILE", ")", ":", "if", "source", ".", "startswith", "(", "'http'", ")", ":", "json_licenses", "=", "requests", ".", "get", "(", "source", ")", ".", "json", "(", ")", "else", ":", "with", "open", "...
Feed the licenses from a JSON file
[ "Feed", "the", "licenses", "from", "a", "JSON", "file" ]
python
train
titusjan/argos
argos/utils/cls.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/utils/cls.py#L373-L387
def check_class(obj, target_class, allow_none = False): """ Checks that the obj is a (sub)type of target_class. Raises a TypeError if this is not the case. :param obj: object whos type is to be checked :type obj: any type :param target_class: target type/class :type target_...
[ "def", "check_class", "(", "obj", ",", "target_class", ",", "allow_none", "=", "False", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "target_class", ")", ":", "if", "not", "(", "allow_none", "and", "obj", "is", "None", ")", ":", "raise", "Type...
Checks that the obj is a (sub)type of target_class. Raises a TypeError if this is not the case. :param obj: object whos type is to be checked :type obj: any type :param target_class: target type/class :type target_class: any class or type :param allow_none: if true obj ...
[ "Checks", "that", "the", "obj", "is", "a", "(", "sub", ")", "type", "of", "target_class", ".", "Raises", "a", "TypeError", "if", "this", "is", "not", "the", "case", "." ]
python
train
shreyaspotnis/rampage
rampage/ramps.py
https://github.com/shreyaspotnis/rampage/blob/e2565aef7ee16ee06523de975e8aa41aca14e3b2/rampage/ramps.py#L270-L277
def del_unused_keyframes(self): """Scans through list of keyframes in the channel and removes those which are not in self.key_frame_list.""" skl = self.key_frame_list.sorted_key_list() unused_keys = [k for k in self.dct['keys'] if k not in skl] for k in unu...
[ "def", "del_unused_keyframes", "(", "self", ")", ":", "skl", "=", "self", ".", "key_frame_list", ".", "sorted_key_list", "(", ")", "unused_keys", "=", "[", "k", "for", "k", "in", "self", ".", "dct", "[", "'keys'", "]", "if", "k", "not", "in", "skl", ...
Scans through list of keyframes in the channel and removes those which are not in self.key_frame_list.
[ "Scans", "through", "list", "of", "keyframes", "in", "the", "channel", "and", "removes", "those", "which", "are", "not", "in", "self", ".", "key_frame_list", "." ]
python
train
kytos/kytos-utils
kytos/utils/napps.py
https://github.com/kytos/kytos-utils/blob/b4750c618d15cff75970ea6124bda4d2b9a33578/kytos/utils/napps.py#L325-L337
def _extract(filename): """Extract package to a temporary folder. Return: pathlib.Path: Temp dir with package contents. """ random_string = '{:0d}'.format(randint(0, 10**6)) tmp = '/tmp/kytos-napp-' + Path(filename).stem + '-' + random_string os.mkdir(tmp) ...
[ "def", "_extract", "(", "filename", ")", ":", "random_string", "=", "'{:0d}'", ".", "format", "(", "randint", "(", "0", ",", "10", "**", "6", ")", ")", "tmp", "=", "'/tmp/kytos-napp-'", "+", "Path", "(", "filename", ")", ".", "stem", "+", "'-'", "+",...
Extract package to a temporary folder. Return: pathlib.Path: Temp dir with package contents.
[ "Extract", "package", "to", "a", "temporary", "folder", "." ]
python
train
tensorpack/tensorpack
tensorpack/utils/concurrency.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/tensorpack/utils/concurrency.py#L208-L219
def mask_sigint(): """ Returns: If called in main thread, returns a context where ``SIGINT`` is ignored, and yield True. Otherwise yield False. """ if is_main_thread(): sigint_handler = signal.signal(signal.SIGINT, signal.SIG_IGN) yield True signal.signal(signal.S...
[ "def", "mask_sigint", "(", ")", ":", "if", "is_main_thread", "(", ")", ":", "sigint_handler", "=", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "signal", ".", "SIG_IGN", ")", "yield", "True", "signal", ".", "signal", "(", "signal", ".", ...
Returns: If called in main thread, returns a context where ``SIGINT`` is ignored, and yield True. Otherwise yield False.
[ "Returns", ":", "If", "called", "in", "main", "thread", "returns", "a", "context", "where", "SIGINT", "is", "ignored", "and", "yield", "True", ".", "Otherwise", "yield", "False", "." ]
python
train
davenquinn/Attitude
attitude/error/axes.py
https://github.com/davenquinn/Attitude/blob/2ce97b9aba0aa5deedc6617c2315e07e6396d240/attitude/error/axes.py#L67-L77
def angular_errors(hyp_axes): """ Minimum and maximum angular errors corresponding to 1st and 2nd axes of PCA distribution. Ordered as [minimum, maximum] angular error. """ # Not quite sure why this is sqrt but it is empirically correct ax = N.sqrt(hyp_axes) return tuple(N.arctan2(a...
[ "def", "angular_errors", "(", "hyp_axes", ")", ":", "# Not quite sure why this is sqrt but it is empirically correct", "ax", "=", "N", ".", "sqrt", "(", "hyp_axes", ")", "return", "tuple", "(", "N", ".", "arctan2", "(", "ax", "[", "-", "1", "]", ",", "ax", "...
Minimum and maximum angular errors corresponding to 1st and 2nd axes of PCA distribution. Ordered as [minimum, maximum] angular error.
[ "Minimum", "and", "maximum", "angular", "errors", "corresponding", "to", "1st", "and", "2nd", "axes", "of", "PCA", "distribution", "." ]
python
train
boriel/zxbasic
zxbparser.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxbparser.py#L468-L515
def p_start(p): """ start : program """ global ast, data_ast user_data = make_label('.ZXBASIC_USER_DATA', 0) make_label('.ZXBASIC_USER_DATA_LEN', 0) if PRINT_IS_USED: zxbpp.ID_TABLE.define('___PRINT_IS_USED___', 1) # zxbasmpp.ID_TABLE.define('___PRINT_IS_USED___', 1) if zx...
[ "def", "p_start", "(", "p", ")", ":", "global", "ast", ",", "data_ast", "user_data", "=", "make_label", "(", "'.ZXBASIC_USER_DATA'", ",", "0", ")", "make_label", "(", "'.ZXBASIC_USER_DATA_LEN'", ",", "0", ")", "if", "PRINT_IS_USED", ":", "zxbpp", ".", "ID_TA...
start : program
[ "start", ":", "program" ]
python
train
ouroboroscoding/format-oc-python
FormatOC/__init__.py
https://github.com/ouroboroscoding/format-oc-python/blob/c160b46fe4ff2c92333c776991c712de23991225/FormatOC/__init__.py#L836-L859
def toDict(self): """To Dict Returns the Hashed Node as a dictionary in the same format as is used in constructing it Returns: dict """ # Init the dictionary we will return dRet = {} # Add the hash key dRet['__hash__'] = self._key.toDict() # Get the parents dict and add it to the return dR...
[ "def", "toDict", "(", "self", ")", ":", "# Init the dictionary we will return", "dRet", "=", "{", "}", "# Add the hash key", "dRet", "[", "'__hash__'", "]", "=", "self", ".", "_key", ".", "toDict", "(", ")", "# Get the parents dict and add it to the return", "dRet",...
To Dict Returns the Hashed Node as a dictionary in the same format as is used in constructing it Returns: dict
[ "To", "Dict" ]
python
train
edx/edx-drf-extensions
edx_rest_framework_extensions/auth/bearer/authentication.py
https://github.com/edx/edx-drf-extensions/blob/2f4c1682b8471bf894ea566a43fd9f91ba219f83/edx_rest_framework_extensions/auth/bearer/authentication.py#L85-L115
def get_user_info(self, token): """ Retrieves the user info from the OAuth provider. Arguments: token (str): OAuth2 access token. Returns: dict Raises: UserInfoRetrievalFailed: Retrieval of user info from the remote server failed. ""...
[ "def", "get_user_info", "(", "self", ",", "token", ")", ":", "url", "=", "self", ".", "get_user_info_url", "(", ")", "try", ":", "headers", "=", "{", "'Authorization'", ":", "'Bearer {}'", ".", "format", "(", "token", ")", "}", "response", "=", "requests...
Retrieves the user info from the OAuth provider. Arguments: token (str): OAuth2 access token. Returns: dict Raises: UserInfoRetrievalFailed: Retrieval of user info from the remote server failed.
[ "Retrieves", "the", "user", "info", "from", "the", "OAuth", "provider", "." ]
python
train
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L2881-L2924
def IIR_filter_design(CentralFreq, bandwidth, transitionWidth, SampleFreq, GainStop=40, GainPass=0.01): """ Function to calculate the coefficients of an IIR filter, IMPORTANT NOTE: make_butterworth_bandpass_b_a and make_butterworth_b_a can produce IIR filters with higher sample rates and are prefereabl...
[ "def", "IIR_filter_design", "(", "CentralFreq", ",", "bandwidth", ",", "transitionWidth", ",", "SampleFreq", ",", "GainStop", "=", "40", ",", "GainPass", "=", "0.01", ")", ":", "NyquistFreq", "=", "SampleFreq", "/", "2", "if", "(", "CentralFreq", "+", "bandw...
Function to calculate the coefficients of an IIR filter, IMPORTANT NOTE: make_butterworth_bandpass_b_a and make_butterworth_b_a can produce IIR filters with higher sample rates and are prefereable due to this. Parameters ---------- CentralFreq : float Central frequency of the IIR filte...
[ "Function", "to", "calculate", "the", "coefficients", "of", "an", "IIR", "filter", "IMPORTANT", "NOTE", ":", "make_butterworth_bandpass_b_a", "and", "make_butterworth_b_a", "can", "produce", "IIR", "filters", "with", "higher", "sample", "rates", "and", "are", "prefe...
python
train
materialsproject/pymatgen
pymatgen/analysis/local_env.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/local_env.py#L2042-L2109
def get_q2(self, thetas=None, phis=None): """ Calculates the value of the bond orientational order parameter of weight l=2. If the function is called with non-empty lists of polar and azimuthal angles the corresponding trigonometric terms are computed afresh. Otherwise, it is ...
[ "def", "get_q2", "(", "self", ",", "thetas", "=", "None", ",", "phis", "=", "None", ")", ":", "if", "thetas", "is", "not", "None", "and", "phis", "is", "not", "None", ":", "self", ".", "compute_trigonometric_terms", "(", "thetas", ",", "phis", ")", "...
Calculates the value of the bond orientational order parameter of weight l=2. If the function is called with non-empty lists of polar and azimuthal angles the corresponding trigonometric terms are computed afresh. Otherwise, it is expected that the compute_trigonometric_terms function ...
[ "Calculates", "the", "value", "of", "the", "bond", "orientational", "order", "parameter", "of", "weight", "l", "=", "2", ".", "If", "the", "function", "is", "called", "with", "non", "-", "empty", "lists", "of", "polar", "and", "azimuthal", "angles", "the",...
python
train
onnx/onnxmltools
onnxmltools/utils/main.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/utils/main.py#L78-L96
def set_model_version(model, version): """ Sets the version of the ONNX model. :param model: instance of an ONNX model :param version: integer containing the version of the model Example: :: from onnxmltools.utils import set_model_version onnx_model = load_model("SqueezeNet.on...
[ "def", "set_model_version", "(", "model", ",", "version", ")", ":", "if", "model", "is", "None", "or", "not", "isinstance", "(", "model", ",", "onnx_proto", ".", "ModelProto", ")", ":", "raise", "ValueError", "(", "\"Model is not a valid ONNX model.\"", ")", "...
Sets the version of the ONNX model. :param model: instance of an ONNX model :param version: integer containing the version of the model Example: :: from onnxmltools.utils import set_model_version onnx_model = load_model("SqueezeNet.onnx") set_model_version(onnx_model, 1)
[ "Sets", "the", "version", "of", "the", "ONNX", "model", "." ]
python
train
saltstack/salt-pylint
saltpylint/strings.py
https://github.com/saltstack/salt-pylint/blob/524a419d3bfc7dbd91c9c85040bc64935a275b24/saltpylint/strings.py#L247-L258
def process_non_raw_string_token(self, prefix, string_body, start_row): ''' check for bad escapes in a non-raw string. prefix: lowercase string of eg 'ur' string prefix markers. string_body: the un-parsed body of the string, not including the quote marks. start_row: inte...
[ "def", "process_non_raw_string_token", "(", "self", ",", "prefix", ",", "string_body", ",", "start_row", ")", ":", "if", "'u'", "in", "prefix", ":", "if", "string_body", ".", "find", "(", "'\\\\0'", ")", "!=", "-", "1", ":", "self", ".", "add_message", "...
check for bad escapes in a non-raw string. prefix: lowercase string of eg 'ur' string prefix markers. string_body: the un-parsed body of the string, not including the quote marks. start_row: integer line number in the source.
[ "check", "for", "bad", "escapes", "in", "a", "non", "-", "raw", "string", "." ]
python
train
kislyuk/aegea
aegea/packages/github3/repos/repo.py
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/repo.py#L314-L338
def archive(self, format, path='', ref='master'): """Get the tarball or zipball archive for this repo at ref. See: http://developer.github.com/v3/repos/contents/#get-archive-link :param str format: (required), accepted values: ('tarball', 'zipball') :param path: (optional),...
[ "def", "archive", "(", "self", ",", "format", ",", "path", "=", "''", ",", "ref", "=", "'master'", ")", ":", "resp", "=", "None", "if", "format", "in", "(", "'tarball'", ",", "'zipball'", ")", ":", "url", "=", "self", ".", "_build_url", "(", "forma...
Get the tarball or zipball archive for this repo at ref. See: http://developer.github.com/v3/repos/contents/#get-archive-link :param str format: (required), accepted values: ('tarball', 'zipball') :param path: (optional), path where the file should be saved to, default ...
[ "Get", "the", "tarball", "or", "zipball", "archive", "for", "this", "repo", "at", "ref", "." ]
python
train
CalebBell/fpi
fpi/saltation.py
https://github.com/CalebBell/fpi/blob/6e6da3b9d0c17e10cc0886c97bc1bb8aeba2cca5/fpi/saltation.py#L455-L518
def Geldart_Ling(mp, rhog, D, mug): r'''Calculates saltation velocity of the gas for pneumatic conveying, according to [1]_ as described in [2]_ and [3]_. if Gs/D < 47000, use equation 1, otherwise use equation 2. .. math:: V_{salt} = 1.5G_s^{0.465}D^{-0.01} \mu^{0.055}\rho_f^{-0.42} ...
[ "def", "Geldart_Ling", "(", "mp", ",", "rhog", ",", "D", ",", "mug", ")", ":", "Gs", "=", "mp", "/", "(", "pi", "/", "4", "*", "D", "**", "2", ")", "if", "Gs", "/", "D", "<=", "47000", ":", "V", "=", "1.5", "*", "Gs", "**", "0.465", "*", ...
r'''Calculates saltation velocity of the gas for pneumatic conveying, according to [1]_ as described in [2]_ and [3]_. if Gs/D < 47000, use equation 1, otherwise use equation 2. .. math:: V_{salt} = 1.5G_s^{0.465}D^{-0.01} \mu^{0.055}\rho_f^{-0.42} V_{salt} = 8.7G_s^{0.302}D^{0.153} \mu^{...
[ "r", "Calculates", "saltation", "velocity", "of", "the", "gas", "for", "pneumatic", "conveying", "according", "to", "[", "1", "]", "_", "as", "described", "in", "[", "2", "]", "_", "and", "[", "3", "]", "_", "." ]
python
train
jrigden/pyPodcastParser
pyPodcastParser/Podcast.py
https://github.com/jrigden/pyPodcastParser/blob/b21e027bb56ec77986d76fc1990f4e420c6de869/pyPodcastParser/Podcast.py#L315-L321
def set_itunes_complete(self): """Parses complete from itunes tags and sets value""" try: self.itunes_complete = self.soup.find('itunes:complete').string self.itunes_complete = self.itunes_complete.lower() except AttributeError: self.itunes_complete = None
[ "def", "set_itunes_complete", "(", "self", ")", ":", "try", ":", "self", ".", "itunes_complete", "=", "self", ".", "soup", ".", "find", "(", "'itunes:complete'", ")", ".", "string", "self", ".", "itunes_complete", "=", "self", ".", "itunes_complete", ".", ...
Parses complete from itunes tags and sets value
[ "Parses", "complete", "from", "itunes", "tags", "and", "sets", "value" ]
python
train
pantsbuild/pants
src/python/pants/init/extension_loader.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/init/extension_loader.py#L40-L96
def load_plugins(build_configuration, plugins, working_set): """Load named plugins from the current working_set into the supplied build_configuration "Loading" a plugin here refers to calling registration methods -- it is assumed each plugin is already on the path and an error will be thrown if it is not. Plugin...
[ "def", "load_plugins", "(", "build_configuration", ",", "plugins", ",", "working_set", ")", ":", "loaded", "=", "{", "}", "for", "plugin", "in", "plugins", ":", "req", "=", "Requirement", ".", "parse", "(", "plugin", ")", "dist", "=", "working_set", ".", ...
Load named plugins from the current working_set into the supplied build_configuration "Loading" a plugin here refers to calling registration methods -- it is assumed each plugin is already on the path and an error will be thrown if it is not. Plugins should define their entrypoints in the `pantsbuild.plugin` gro...
[ "Load", "named", "plugins", "from", "the", "current", "working_set", "into", "the", "supplied", "build_configuration" ]
python
train
insightindustry/validator-collection
validator_collection/validators.py
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/validators.py#L1883-L1968
def writeable(value, allow_empty = False, **kwargs): """Validate that ``value`` is a path to a writeable file. .. caution:: This validator does **NOT** work correctly on a Windows file system. This is due to the vagaries of how Windows manages its file system and the ...
[ "def", "writeable", "(", "value", ",", "allow_empty", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "value", "and", "not", "allow_empty", ":", "raise", "errors", ".", "EmptyValueError", "(", "'value (%s) was empty'", "%", "value", ")", "eli...
Validate that ``value`` is a path to a writeable file. .. caution:: This validator does **NOT** work correctly on a Windows file system. This is due to the vagaries of how Windows manages its file system and the various ways in which it can manage file permission. If called on a Windows f...
[ "Validate", "that", "value", "is", "a", "path", "to", "a", "writeable", "file", "." ]
python
train
gitpython-developers/GitPython
git/remote.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/remote.py#L751-L792
def fetch(self, refspec=None, progress=None, **kwargs): """Fetch the latest changes for this remote :param refspec: A "refspec" is used by fetch and push to describe the mapping between remote ref and local ref. They are combined with a colon in the format <src>:<dst...
[ "def", "fetch", "(", "self", ",", "refspec", "=", "None", ",", "progress", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "refspec", "is", "None", ":", "# No argument refspec, then ensure the repo's config has a fetch refspec.", "self", ".", "_assert_refspe...
Fetch the latest changes for this remote :param refspec: A "refspec" is used by fetch and push to describe the mapping between remote ref and local ref. They are combined with a colon in the format <src>:<dst>, preceded by an optional plus sign, +. For example: g...
[ "Fetch", "the", "latest", "changes", "for", "this", "remote" ]
python
train
uber/tchannel-python
tchannel/_queue.py
https://github.com/uber/tchannel-python/blob/ee08cce6234f24fd2373774988186dd374306c43/tchannel/_queue.py#L159-L190
def get(self): """Gets the next item from the queue. Returns a Future that resolves to the next item once it is available. """ io_loop = IOLoop.current() new_get = Future() with self._lock: get, self._get = self._get, new_get answer = Future() ...
[ "def", "get", "(", "self", ")", ":", "io_loop", "=", "IOLoop", ".", "current", "(", ")", "new_get", "=", "Future", "(", ")", "with", "self", ".", "_lock", ":", "get", ",", "self", ".", "_get", "=", "self", ".", "_get", ",", "new_get", "answer", "...
Gets the next item from the queue. Returns a Future that resolves to the next item once it is available.
[ "Gets", "the", "next", "item", "from", "the", "queue", "." ]
python
train
gem/oq-engine
openquake/calculators/extract.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/extract.py#L710-L726
def build_damage_array(data, damage_dt): """ :param data: an array of shape (A, L, 1, D) or (A, L, 2, D) :param damage_dt: a damage composite data type loss_type -> states :returns: a composite array of length N and dtype damage_dt """ A, L, MS, D = data.shape dmg = numpy.zeros(A, damage_dt)...
[ "def", "build_damage_array", "(", "data", ",", "damage_dt", ")", ":", "A", ",", "L", ",", "MS", ",", "D", "=", "data", ".", "shape", "dmg", "=", "numpy", ".", "zeros", "(", "A", ",", "damage_dt", ")", "for", "a", "in", "range", "(", "A", ")", "...
:param data: an array of shape (A, L, 1, D) or (A, L, 2, D) :param damage_dt: a damage composite data type loss_type -> states :returns: a composite array of length N and dtype damage_dt
[ ":", "param", "data", ":", "an", "array", "of", "shape", "(", "A", "L", "1", "D", ")", "or", "(", "A", "L", "2", "D", ")", ":", "param", "damage_dt", ":", "a", "damage", "composite", "data", "type", "loss_type", "-", ">", "states", ":", "returns"...
python
train
bionikspoon/pureyaml
pureyaml/_compat/total_ordering.py
https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/_compat/total_ordering.py#L62-L67
def _lt_from_gt(self, other): """Return a < b. Computed by @total_ordering from (not a > b) and (a != b).""" op_result = self.__gt__(other) if op_result is NotImplemented: return NotImplemented return not op_result and self != other
[ "def", "_lt_from_gt", "(", "self", ",", "other", ")", ":", "op_result", "=", "self", ".", "__gt__", "(", "other", ")", "if", "op_result", "is", "NotImplemented", ":", "return", "NotImplemented", "return", "not", "op_result", "and", "self", "!=", "other" ]
Return a < b. Computed by @total_ordering from (not a > b) and (a != b).
[ "Return", "a", "<", "b", ".", "Computed", "by" ]
python
train
spyder-ide/spyder
spyder/app/mainwindow.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/mainwindow.py#L2043-L2059
def load_last_visible_toolbars(self): """Loads the last visible toolbars from the .ini file.""" toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[]) if toolbars_names: dic = {} for toolbar in self.toolbarslist: dic[toolbar.objectN...
[ "def", "load_last_visible_toolbars", "(", "self", ")", ":", "toolbars_names", "=", "CONF", ".", "get", "(", "'main'", ",", "'last_visible_toolbars'", ",", "default", "=", "[", "]", ")", "if", "toolbars_names", ":", "dic", "=", "{", "}", "for", "toolbar", "...
Loads the last visible toolbars from the .ini file.
[ "Loads", "the", "last", "visible", "toolbars", "from", "the", ".", "ini", "file", "." ]
python
train
swharden/PyOriginTools
PyOriginTools/workbook.py
https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/workbook.py#L162-L186
def push(self,bookName=None,sheetName=None,overwrite=False): """pull this OR.SHEET into a real book/sheet in Origin""" # tons of validation if bookName: self.bookName=bookName if sheetName: self.sheetName=sheetName if not self.sheetName in OR.sheetNames(bookName): pri...
[ "def", "push", "(", "self", ",", "bookName", "=", "None", ",", "sheetName", "=", "None", ",", "overwrite", "=", "False", ")", ":", "# tons of validation", "if", "bookName", ":", "self", ".", "bookName", "=", "bookName", "if", "sheetName", ":", "self", "....
pull this OR.SHEET into a real book/sheet in Origin
[ "pull", "this", "OR", ".", "SHEET", "into", "a", "real", "book", "/", "sheet", "in", "Origin" ]
python
train
xapple/plumbing
plumbing/databases/access_database.py
https://github.com/xapple/plumbing/blob/4a7706c7722f5996d0ca366f191aff9ac145880a/plumbing/databases/access_database.py#L134-L138
def table_as_df(self, table_name): """Return a table as a dataframe.""" self.table_must_exist(table_name) query = "SELECT * FROM `%s`" % table_name.lower() return pandas.read_sql(query, self.own_conn)
[ "def", "table_as_df", "(", "self", ",", "table_name", ")", ":", "self", ".", "table_must_exist", "(", "table_name", ")", "query", "=", "\"SELECT * FROM `%s`\"", "%", "table_name", ".", "lower", "(", ")", "return", "pandas", ".", "read_sql", "(", "query", ","...
Return a table as a dataframe.
[ "Return", "a", "table", "as", "a", "dataframe", "." ]
python
train
jaywink/federation
federation/entities/diaspora/mappers.py
https://github.com/jaywink/federation/blob/59d31bb37e662891dbea72c1dee05dc53146c78b/federation/entities/diaspora/mappers.py#L158-L233
def transform_attributes(attrs, cls): """Transform some attribute keys. :param attrs: Properties from the XML :type attrs: dict :param cls: Class of the entity :type cls: class """ transformed = {} for key, value in attrs.items(): if value is None: value = "" ...
[ "def", "transform_attributes", "(", "attrs", ",", "cls", ")", ":", "transformed", "=", "{", "}", "for", "key", ",", "value", "in", "attrs", ".", "items", "(", ")", ":", "if", "value", "is", "None", ":", "value", "=", "\"\"", "if", "key", "==", "\"t...
Transform some attribute keys. :param attrs: Properties from the XML :type attrs: dict :param cls: Class of the entity :type cls: class
[ "Transform", "some", "attribute", "keys", "." ]
python
train
langloisjp/tstore
tstore/pgtablestorage.py
https://github.com/langloisjp/tstore/blob/b438f8aaf09117bf6f922ba06ae5cf46b7b97a57/tstore/pgtablestorage.py#L472-L492
def parse_dburl(dburl): """Parse DB URL. Return (scheme, user, password, host, dbname) pg://user:pass@host/dbname >>> parse_dburl("pg://user:pass@host/name") ('pg', 'user', 'pass', 'host', 'name') >>> parse_dburl("dbm:///dbfile") ('dbm', '', '', '', 'dbfile') >>> parse_dburl("pg://user:@/na...
[ "def", "parse_dburl", "(", "dburl", ")", ":", "res", "=", "urlparse", ".", "urlparse", "(", "dburl", ")", "if", "'@'", "in", "res", ".", "netloc", ":", "(", "creds", ",", "host", ")", "=", "res", ".", "netloc", ".", "split", "(", "'@'", ")", "els...
Parse DB URL. Return (scheme, user, password, host, dbname) pg://user:pass@host/dbname >>> parse_dburl("pg://user:pass@host/name") ('pg', 'user', 'pass', 'host', 'name') >>> parse_dburl("dbm:///dbfile") ('dbm', '', '', '', 'dbfile') >>> parse_dburl("pg://user:@/name") ('pg', 'user', '', '',...
[ "Parse", "DB", "URL", ".", "Return", "(", "scheme", "user", "password", "host", "dbname", ")", "pg", ":", "//", "user", ":", "pass@host", "/", "dbname" ]
python
train
gtaylor/django-athumb
athumb/pial/engines/base.py
https://github.com/gtaylor/django-athumb/blob/69261ace0dff81e33156a54440874456a7b38dfb/athumb/pial/engines/base.py#L106-L125
def write(self, image, dest_fobj, quality=95, format=None): """ Wrapper for ``_write`` :param Image image: This is your engine's ``Image`` object. For PIL it's PIL.Image. :keyword int quality: A quality level as a percent. The lower, the higher the compression, t...
[ "def", "write", "(", "self", ",", "image", ",", "dest_fobj", ",", "quality", "=", "95", ",", "format", "=", "None", ")", ":", "if", "isinstance", "(", "format", ",", "basestring", ")", "and", "format", ".", "lower", "(", ")", "==", "'jpg'", ":", "#...
Wrapper for ``_write`` :param Image image: This is your engine's ``Image`` object. For PIL it's PIL.Image. :keyword int quality: A quality level as a percent. The lower, the higher the compression, the worse the artifacts. :keyword str format: The format to save to. If o...
[ "Wrapper", "for", "_write" ]
python
train
inveniosoftware/invenio-github
invenio_github/api.py
https://github.com/inveniosoftware/invenio-github/blob/ec42fd6a06079310dcbe2c46d9fd79d5197bbe26/invenio_github/api.py#L354-L361
def title(self): """Extract title from a release.""" if self.event: if self.release['name']: return u'{0}: {1}'.format( self.repository['full_name'], self.release['name'] ) return u'{0} {1}'.format(self.repo_model.name, self.model.t...
[ "def", "title", "(", "self", ")", ":", "if", "self", ".", "event", ":", "if", "self", ".", "release", "[", "'name'", "]", ":", "return", "u'{0}: {1}'", ".", "format", "(", "self", ".", "repository", "[", "'full_name'", "]", ",", "self", ".", "release...
Extract title from a release.
[ "Extract", "title", "from", "a", "release", "." ]
python
train
googledatalab/pydatalab
google/datalab/contrib/mlworkbench/_local_predict.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/contrib/mlworkbench/_local_predict.py#L56-L87
def _tf_predict(model_dir, input_csvlines): """Prediction with a tf savedmodel. Args: model_dir: directory that contains a saved model input_csvlines: list of csv strings Returns: Dict in the form tensor_name:prediction_list. Note that the value is always a list, even if there was only 1 row...
[ "def", "_tf_predict", "(", "model_dir", ",", "input_csvlines", ")", ":", "with", "tf", ".", "Graph", "(", ")", ".", "as_default", "(", ")", ",", "tf", ".", "Session", "(", ")", "as", "sess", ":", "input_alias_map", ",", "output_alias_map", "=", "_tf_load...
Prediction with a tf savedmodel. Args: model_dir: directory that contains a saved model input_csvlines: list of csv strings Returns: Dict in the form tensor_name:prediction_list. Note that the value is always a list, even if there was only 1 row in input_csvlines.
[ "Prediction", "with", "a", "tf", "savedmodel", "." ]
python
train
ethereum/py-evm
eth/tools/_utils/mappings.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/tools/_utils/mappings.py#L24-L49
def is_cleanly_mergable(*dicts: Dict[Any, Any]) -> bool: """Check that nothing will be overwritten when dictionaries are merged using `deep_merge`. Examples: >>> is_cleanly_mergable({"a": 1}, {"b": 2}, {"c": 3}) True >>> is_cleanly_mergable({"a": 1}, {"b": 2}, {"a": 0, c": 3}) ...
[ "def", "is_cleanly_mergable", "(", "*", "dicts", ":", "Dict", "[", "Any", ",", "Any", "]", ")", "->", "bool", ":", "if", "len", "(", "dicts", ")", "<=", "1", ":", "return", "True", "elif", "len", "(", "dicts", ")", "==", "2", ":", "if", "not", ...
Check that nothing will be overwritten when dictionaries are merged using `deep_merge`. Examples: >>> is_cleanly_mergable({"a": 1}, {"b": 2}, {"c": 3}) True >>> is_cleanly_mergable({"a": 1}, {"b": 2}, {"a": 0, c": 3}) False >>> is_cleanly_mergable({"a": 1, "b": {"ba": 2}}, ...
[ "Check", "that", "nothing", "will", "be", "overwritten", "when", "dictionaries", "are", "merged", "using", "deep_merge", "." ]
python
train
Skyscanner/pages
pages/ui_component.py
https://github.com/Skyscanner/pages/blob/f80471ef01f84b11e4d751dff1e6398ae1e230b8/pages/ui_component.py#L68-L80
def locate(self): """ Lazily locates the element on the DOM if the WebElement instance is not available already. Returns a WebElement object. It also caches the element if caching has been set through cache(). """ if self._web_element: return self....
[ "def", "locate", "(", "self", ")", ":", "if", "self", ".", "_web_element", ":", "return", "self", ".", "_web_element", "else", ":", "locator_type", ",", "locator_value", "=", "self", ".", "__locator", "element", "=", "self", ".", "driver", ".", "find_eleme...
Lazily locates the element on the DOM if the WebElement instance is not available already. Returns a WebElement object. It also caches the element if caching has been set through cache().
[ "Lazily", "locates", "the", "element", "on", "the", "DOM", "if", "the", "WebElement", "instance", "is", "not", "available", "already", ".", "Returns", "a", "WebElement", "object", ".", "It", "also", "caches", "the", "element", "if", "caching", "has", "been",...
python
test
PolyJIT/benchbuild
benchbuild/utils/versions.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/utils/versions.py#L40-L58
def get_git_hash(from_url): """ Get the git commit hash of HEAD from :from_url. Args: from_url: The file system url of our git repository. Returns: git commit hash of HEAD, or empty string. """ from benchbuild.utils.cmd import git if from_url is None: return "" ...
[ "def", "get_git_hash", "(", "from_url", ")", ":", "from", "benchbuild", ".", "utils", ".", "cmd", "import", "git", "if", "from_url", "is", "None", ":", "return", "\"\"", "if", "not", "path", ".", "exists", "(", "from_url", ")", ":", "return", "\"\"", "...
Get the git commit hash of HEAD from :from_url. Args: from_url: The file system url of our git repository. Returns: git commit hash of HEAD, or empty string.
[ "Get", "the", "git", "commit", "hash", "of", "HEAD", "from", ":", "from_url", "." ]
python
train
apache/incubator-superset
superset/jinja_context.py
https://github.com/apache/incubator-superset/blob/ca2996c78f679260eb79c6008e276733df5fb653/superset/jinja_context.py#L85-L125
def filter_values(column, default=None): """ Gets a values for a particular filter as a list This is useful if: - you want to use a filter box to filter a query where the name of filter box column doesn't match the one in the select statement - you want to have the ability for filter ...
[ "def", "filter_values", "(", "column", ",", "default", "=", "None", ")", ":", "form_data", "=", "json", ".", "loads", "(", "request", ".", "form", ".", "get", "(", "'form_data'", ",", "'{}'", ")", ")", "return_val", "=", "[", "]", "for", "filter_type",...
Gets a values for a particular filter as a list This is useful if: - you want to use a filter box to filter a query where the name of filter box column doesn't match the one in the select statement - you want to have the ability for filter inside the main query for speed purposes Thi...
[ "Gets", "a", "values", "for", "a", "particular", "filter", "as", "a", "list" ]
python
train
mfcovington/django-project-home-templatetags
project_home_tags/templatetags/project_home.py
https://github.com/mfcovington/django-project-home-templatetags/blob/abc660906086088792c5e5e7be6ecd151c2ccddb/project_home_tags/templatetags/project_home.py#L86-L122
def project_home_breadcrumb_bs3(label): """A template tag to return the project's home URL and label formatted as a Bootstrap 3 breadcrumb. PROJECT_HOME_NAMESPACE must be defined in settings, for example: PROJECT_HOME_NAMESPACE = 'project_name:index_view' Usage Example: {% load project...
[ "def", "project_home_breadcrumb_bs3", "(", "label", ")", ":", "url", "=", "home_url", "(", ")", "if", "url", ":", "return", "format_html", "(", "'<li><a href=\"{}\">{}</a></li>'", ",", "url", ",", "label", ")", "else", ":", "return", "format_html", "(", "'<li>...
A template tag to return the project's home URL and label formatted as a Bootstrap 3 breadcrumb. PROJECT_HOME_NAMESPACE must be defined in settings, for example: PROJECT_HOME_NAMESPACE = 'project_name:index_view' Usage Example: {% load project_home_tags %} <ol class="breadcrumb"> ...
[ "A", "template", "tag", "to", "return", "the", "project", "s", "home", "URL", "and", "label", "formatted", "as", "a", "Bootstrap", "3", "breadcrumb", "." ]
python
test
mitsei/dlkit
dlkit/handcar/repository/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2703-L2726
def get_composition_search_session(self, proxy): """Gets a composition search session. arg proxy (osid.proxy.Proxy): a proxy return: (osid.repository.CompositionSearchSession) - a CompositionSearchSession raise: OperationFailed - unable to complete request r...
[ "def", "get_composition_search_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_composition_search", "(", ")", ":", "raise", "Unimplemented", "(", ")", "try", ":", "from", ".", "import", "sessions", "except", "ImportError", ":...
Gets a composition search session. arg proxy (osid.proxy.Proxy): a proxy return: (osid.repository.CompositionSearchSession) - a CompositionSearchSession raise: OperationFailed - unable to complete request raise: Unimplemented - supports_composition_search() is fals...
[ "Gets", "a", "composition", "search", "session", "." ]
python
train
GibbsConsulting/django-plotly-dash
demo/demo/plotly_apps.py
https://github.com/GibbsConsulting/django-plotly-dash/blob/773ed081fc2ea3cc7607590322a14686a7a79bc5/demo/demo/plotly_apps.py#L101-L118
def callback_c(*args, **kwargs): 'Update the output following a change of the input selection' #da = kwargs['dash_app'] session_state = kwargs['session_state'] calls_so_far = session_state.get('calls_so_far', 0) session_state['calls_so_far'] = calls_so_far + 1 user_counts = session_state.get(...
[ "def", "callback_c", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#da = kwargs['dash_app']", "session_state", "=", "kwargs", "[", "'session_state'", "]", "calls_so_far", "=", "session_state", ".", "get", "(", "'calls_so_far'", ",", "0", ")", "session_...
Update the output following a change of the input selection
[ "Update", "the", "output", "following", "a", "change", "of", "the", "input", "selection" ]
python
train
StanfordVL/robosuite
robosuite/models/base.py
https://github.com/StanfordVL/robosuite/blob/65cd16810e2ed647e3ec88746af3412065b7f278/robosuite/models/base.py#L113-L127
def save_model(self, fname, pretty=False): """ Saves the xml to file. Args: fname: output file location pretty: attempts!! to pretty print the output """ with open(fname, "w") as f: xml_str = ET.tostring(self.root, encoding="unicode") ...
[ "def", "save_model", "(", "self", ",", "fname", ",", "pretty", "=", "False", ")", ":", "with", "open", "(", "fname", ",", "\"w\"", ")", "as", "f", ":", "xml_str", "=", "ET", ".", "tostring", "(", "self", ".", "root", ",", "encoding", "=", "\"unicod...
Saves the xml to file. Args: fname: output file location pretty: attempts!! to pretty print the output
[ "Saves", "the", "xml", "to", "file", "." ]
python
train
lsst-sqre/sqre-apikit
apikit/convenience.py
https://github.com/lsst-sqre/sqre-apikit/blob/ff505b63d2e29303ff7f05f2bd5eabd0f6d7026e/apikit/convenience.py#L104-L146
def add_metadata_route(app, route): """ Creates a /metadata route that returns service metadata. Also creates a /v{api_version}/metadata route, and those routes with ".json" appended. If route is specified, prepends it (or each component) to the front of the route. Parameters ---------- ...
[ "def", "add_metadata_route", "(", "app", ",", "route", ")", ":", "errstr", "=", "add_metadata_route", ".", "__doc__", "if", "route", "is", "None", ":", "route", "=", "[", "\"\"", "]", "if", "isinstance", "(", "route", ",", "str", ")", ":", "route", "="...
Creates a /metadata route that returns service metadata. Also creates a /v{api_version}/metadata route, and those routes with ".json" appended. If route is specified, prepends it (or each component) to the front of the route. Parameters ---------- app : :class:`flask.Flask` instance F...
[ "Creates", "a", "/", "metadata", "route", "that", "returns", "service", "metadata", ".", "Also", "creates", "a", "/", "v", "{", "api_version", "}", "/", "metadata", "route", "and", "those", "routes", "with", ".", "json", "appended", ".", "If", "route", "...
python
train
saulpw/visidata
visidata/canvas.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/canvas.py#L566-L568
def scaleY(self, y): 'returns plotter y coordinate' return round(self.plotviewBox.ymin+(y-self.visibleBox.ymin)*self.yScaler)
[ "def", "scaleY", "(", "self", ",", "y", ")", ":", "return", "round", "(", "self", ".", "plotviewBox", ".", "ymin", "+", "(", "y", "-", "self", ".", "visibleBox", ".", "ymin", ")", "*", "self", ".", "yScaler", ")" ]
returns plotter y coordinate
[ "returns", "plotter", "y", "coordinate" ]
python
train
PyMySQL/mysqlclient-python
MySQLdb/connections.py
https://github.com/PyMySQL/mysqlclient-python/blob/b66971ee36be96b772ae7fdec79ccc1611376f3c/MySQLdb/connections.py#L309-L318
def show_warnings(self): """Return detailed information about warnings as a sequence of tuples of (Level, Code, Message). This is only supported in MySQL-4.1 and up. If your server is an earlier version, an empty sequence is returned.""" if self._server_version < (4,1): return ()...
[ "def", "show_warnings", "(", "self", ")", ":", "if", "self", ".", "_server_version", "<", "(", "4", ",", "1", ")", ":", "return", "(", ")", "self", ".", "query", "(", "\"SHOW WARNINGS\"", ")", "r", "=", "self", ".", "store_result", "(", ")", "warning...
Return detailed information about warnings as a sequence of tuples of (Level, Code, Message). This is only supported in MySQL-4.1 and up. If your server is an earlier version, an empty sequence is returned.
[ "Return", "detailed", "information", "about", "warnings", "as", "a", "sequence", "of", "tuples", "of", "(", "Level", "Code", "Message", ")", ".", "This", "is", "only", "supported", "in", "MySQL", "-", "4", ".", "1", "and", "up", ".", "If", "your", "ser...
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/psutil/_psosx.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/psutil/_psosx.py#L196-L201
def get_ext_memory_info(self): """Return a tuple with the process' RSS and VMS size.""" rss, vms, pfaults, pageins = _psutil_osx.get_process_memory_info(self.pid) return self._nt_ext_mem(rss, vms, pfaults * _PAGESIZE, pageins * _PAG...
[ "def", "get_ext_memory_info", "(", "self", ")", ":", "rss", ",", "vms", ",", "pfaults", ",", "pageins", "=", "_psutil_osx", ".", "get_process_memory_info", "(", "self", ".", "pid", ")", "return", "self", ".", "_nt_ext_mem", "(", "rss", ",", "vms", ",", "...
Return a tuple with the process' RSS and VMS size.
[ "Return", "a", "tuple", "with", "the", "process", "RSS", "and", "VMS", "size", "." ]
python
test
pywbem/pywbem
pywbem/_utils.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_utils.py#L131-L147
def _stacklevel_above_module(mod_name): """ Return the stack level (with 1 = caller of this function) of the first caller that is not defined in the specified module (e.g. "pywbem.cim_obj"). The returned stack level can be used directly by the caller of this function as an argument for the stacklev...
[ "def", "_stacklevel_above_module", "(", "mod_name", ")", ":", "stacklevel", "=", "2", "# start with caller of our caller", "frame", "=", "inspect", ".", "stack", "(", ")", "[", "stacklevel", "]", "[", "0", "]", "# stack() level is 0-based", "while", "True", ":", ...
Return the stack level (with 1 = caller of this function) of the first caller that is not defined in the specified module (e.g. "pywbem.cim_obj"). The returned stack level can be used directly by the caller of this function as an argument for the stacklevel parameter of warnings.warn().
[ "Return", "the", "stack", "level", "(", "with", "1", "=", "caller", "of", "this", "function", ")", "of", "the", "first", "caller", "that", "is", "not", "defined", "in", "the", "specified", "module", "(", "e", ".", "g", ".", "pywbem", ".", "cim_obj", ...
python
train
HPENetworking/PYHPEIMC
pyhpeimc/plat/alarms.py
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/alarms.py#L158-L175
def acknowledge_alarm(alarm_id, auth, url): """ Function tasks input of str of alarm ID and sends to REST API. Function will acknowledge designated alarm in the IMC alarm database. :param alarm_id: str of alarm ID param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "def", "acknowledge_alarm", "(", "alarm_id", ",", "auth", ",", "url", ")", ":", "f_url", "=", "url", "+", "\"/imcrs/fault/alarm/acknowledge/\"", "+", "str", "(", "alarm_id", ")", "response", "=", "requests", ".", "put", "(", "f_url", ",", "auth", "=", "aut...
Function tasks input of str of alarm ID and sends to REST API. Function will acknowledge designated alarm in the IMC alarm database. :param alarm_id: str of alarm ID param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth...
[ "Function", "tasks", "input", "of", "str", "of", "alarm", "ID", "and", "sends", "to", "REST", "API", ".", "Function", "will", "acknowledge", "designated", "alarm", "in", "the", "IMC", "alarm", "database", ".", ":", "param", "alarm_id", ":", "str", "of", ...
python
train
saltstack/salt
salt/utils/openstack/neutron.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/openstack/neutron.py#L700-L739
def create_ipsec_site_connection(self, name, ipsecpolicy, ikepolicy, vpnservice, peer_cidrs, peer_address, peer_id, ...
[ "def", "create_ipsec_site_connection", "(", "self", ",", "name", ",", "ipsecpolicy", ",", "ikepolicy", ",", "vpnservice", ",", "peer_cidrs", ",", "peer_address", ",", "peer_id", ",", "psk", ",", "admin_state_up", "=", "True", ",", "*", "*", "kwargs", ")", ":...
Creates a new IPsecSiteConnection
[ "Creates", "a", "new", "IPsecSiteConnection" ]
python
train
RPi-Distro/python-gpiozero
gpiozero/spi_devices.py
https://github.com/RPi-Distro/python-gpiozero/blob/7b67374fd0c8c4fde5586d9bad9531f076db9c0c/gpiozero/spi_devices.py#L93-L107
def _words_to_int(self, words, expected_bits=None): """ Given a sequence of words which each fit in the internal SPI interface's number of bits per word, returns the value obtained by concatenating each word into a single bit-string. If *expected_bits* is specified, it limits th...
[ "def", "_words_to_int", "(", "self", ",", "words", ",", "expected_bits", "=", "None", ")", ":", "if", "expected_bits", "is", "None", ":", "expected_bits", "=", "len", "(", "words", ")", "*", "self", ".", "_spi", ".", "bits_per_word", "shifts", "=", "rang...
Given a sequence of words which each fit in the internal SPI interface's number of bits per word, returns the value obtained by concatenating each word into a single bit-string. If *expected_bits* is specified, it limits the size of the output to the specified number of bits (by masking...
[ "Given", "a", "sequence", "of", "words", "which", "each", "fit", "in", "the", "internal", "SPI", "interface", "s", "number", "of", "bits", "per", "word", "returns", "the", "value", "obtained", "by", "concatenating", "each", "word", "into", "a", "single", "...
python
train
ThreatConnect-Inc/tcex
app_init/playbook_utility/app.py
https://github.com/ThreatConnect-Inc/tcex/blob/dd4d7a1ef723af1561687120191886b9a2fd4b47/app_init/playbook_utility/app.py#L25-L48
def run(self): """Run the App main logic. This method should contain the core logic of the App. """ # read inputs indent = int(self.tcex.playbook.read(self.args.indent)) json_data = self.tcex.playbook.read(self.args.json_data) # get the playbook variable type ...
[ "def", "run", "(", "self", ")", ":", "# read inputs", "indent", "=", "int", "(", "self", ".", "tcex", ".", "playbook", ".", "read", "(", "self", ".", "args", ".", "indent", ")", ")", "json_data", "=", "self", ".", "tcex", ".", "playbook", ".", "rea...
Run the App main logic. This method should contain the core logic of the App.
[ "Run", "the", "App", "main", "logic", "." ]
python
train
marrow/mailer
marrow/mailer/message.py
https://github.com/marrow/mailer/blob/3995ef98a3f7feb75f1aeb652e6afe40a5c94def/marrow/mailer/message.py#L254-L337
def attach(self, name, data=None, maintype=None, subtype=None, inline=False, filename=None, filename_charset='', filename_language='', encoding=None): """Attach a file to this message. :param name: Path to the file to attach if data is None, or the name of the file if the ``data`` argument is given :pa...
[ "def", "attach", "(", "self", ",", "name", ",", "data", "=", "None", ",", "maintype", "=", "None", ",", "subtype", "=", "None", ",", "inline", "=", "False", ",", "filename", "=", "None", ",", "filename_charset", "=", "''", ",", "filename_language", "="...
Attach a file to this message. :param name: Path to the file to attach if data is None, or the name of the file if the ``data`` argument is given :param data: Contents of the file to attach, or None if the data is to be read from the file pointed to by the ``name`` argument :type data: bytes or a fil...
[ "Attach", "a", "file", "to", "this", "message", "." ]
python
train
tensorflow/datasets
tensorflow_datasets/core/download/resource.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/download/resource.py#L193-L196
def get_dl_dirname(url): """Returns name of temp dir for given url.""" checksum = hashlib.sha256(tf.compat.as_bytes(url)).hexdigest() return get_dl_fname(url, checksum)
[ "def", "get_dl_dirname", "(", "url", ")", ":", "checksum", "=", "hashlib", ".", "sha256", "(", "tf", ".", "compat", ".", "as_bytes", "(", "url", ")", ")", ".", "hexdigest", "(", ")", "return", "get_dl_fname", "(", "url", ",", "checksum", ")" ]
Returns name of temp dir for given url.
[ "Returns", "name", "of", "temp", "dir", "for", "given", "url", "." ]
python
train
Duke-GCB/DukeDSClient
ddsc/cmdparser.py
https://github.com/Duke-GCB/DukeDSClient/blob/117f68fb9bae82e4c81ea487ad5d61ac350f3726/ddsc/cmdparser.py#L257-L268
def _add_include_arg(arg_parser): """ Adds optional repeatable include parameter to a parser. :param arg_parser: ArgumentParser parser to add this argument to. """ arg_parser.add_argument("--include", metavar='Path', action='append', ...
[ "def", "_add_include_arg", "(", "arg_parser", ")", ":", "arg_parser", ".", "add_argument", "(", "\"--include\"", ",", "metavar", "=", "'Path'", ",", "action", "=", "'append'", ",", "type", "=", "to_unicode", ",", "dest", "=", "'include_paths'", ",", "help", ...
Adds optional repeatable include parameter to a parser. :param arg_parser: ArgumentParser parser to add this argument to.
[ "Adds", "optional", "repeatable", "include", "parameter", "to", "a", "parser", ".", ":", "param", "arg_parser", ":", "ArgumentParser", "parser", "to", "add", "this", "argument", "to", "." ]
python
train
erget/StereoVision
stereovision/blockmatchers.py
https://github.com/erget/StereoVision/blob/1adff45e291362f52188e0fd0211265845a4461a/stereovision/blockmatchers.py#L190-L204
def get_disparity(self, pair): """ Compute disparity from image pair (left, right). First, convert images to grayscale if needed. Then pass to the ``_block_matcher`` for stereo matching. """ gray = [] if pair[0].ndim == 3: for side in pair: ...
[ "def", "get_disparity", "(", "self", ",", "pair", ")", ":", "gray", "=", "[", "]", "if", "pair", "[", "0", "]", ".", "ndim", "==", "3", ":", "for", "side", "in", "pair", ":", "gray", ".", "append", "(", "cv2", ".", "cvtColor", "(", "side", ",",...
Compute disparity from image pair (left, right). First, convert images to grayscale if needed. Then pass to the ``_block_matcher`` for stereo matching.
[ "Compute", "disparity", "from", "image", "pair", "(", "left", "right", ")", "." ]
python
train
sethmlarson/virtualbox-python
virtualbox/library_ext/vbox.py
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library_ext/vbox.py#L75-L83
def register_on_snapshot_taken(self, callback): """Set the callback function to consume on snapshot taken events. Callback receives a ISnapshotTakenEvent object. Returns the callback_id """ event_type = library.VBoxEventType.on_snapshot_taken return self.event_source.re...
[ "def", "register_on_snapshot_taken", "(", "self", ",", "callback", ")", ":", "event_type", "=", "library", ".", "VBoxEventType", ".", "on_snapshot_taken", "return", "self", ".", "event_source", ".", "register_callback", "(", "callback", ",", "event_type", ")" ]
Set the callback function to consume on snapshot taken events. Callback receives a ISnapshotTakenEvent object. Returns the callback_id
[ "Set", "the", "callback", "function", "to", "consume", "on", "snapshot", "taken", "events", "." ]
python
train
sci-bots/svg-model
docs/generate_modules.py
https://github.com/sci-bots/svg-model/blob/2d119650f995e62b29ce0b3151a23f3b957cb072/docs/generate_modules.py#L230-L257
def main(): """ Parse and check the command line arguments. """ parser = optparse.OptionParser(usage="""usage: %prog [options] <package path> [exclude paths, ...] Note: By default this script will not overwrite already created files.""") parser.add_option("-n", "--doc-header", action="store", dest=...
[ "def", "main", "(", ")", ":", "parser", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "\"\"\"usage: %prog [options] <package path> [exclude paths, ...]\n\nNote: By default this script will not overwrite already created files.\"\"\"", ")", "parser", ".", "add_option", "...
Parse and check the command line arguments.
[ "Parse", "and", "check", "the", "command", "line", "arguments", "." ]
python
train
salu133445/pypianoroll
pypianoroll/multitrack.py
https://github.com/salu133445/pypianoroll/blob/6224dc1e29222de2124d249acb80f3d072166917/pypianoroll/multitrack.py#L282-L299
def get_active_length(self): """ Return the maximum active length (i.e., without trailing silence) among the pianorolls of all tracks. The unit is time step. Returns ------- active_length : int The maximum active length (i.e., without trailing silence) among ...
[ "def", "get_active_length", "(", "self", ")", ":", "active_length", "=", "0", "for", "track", "in", "self", ".", "tracks", ":", "now_length", "=", "track", ".", "get_active_length", "(", ")", "if", "active_length", "<", "track", ".", "get_active_length", "("...
Return the maximum active length (i.e., without trailing silence) among the pianorolls of all tracks. The unit is time step. Returns ------- active_length : int The maximum active length (i.e., without trailing silence) among the pianorolls of all tracks. The uni...
[ "Return", "the", "maximum", "active", "length", "(", "i", ".", "e", ".", "without", "trailing", "silence", ")", "among", "the", "pianorolls", "of", "all", "tracks", ".", "The", "unit", "is", "time", "step", "." ]
python
train
Azure/blobxfer
blobxfer/operations/azure/__init__.py
https://github.com/Azure/blobxfer/blob/3eccbe7530cc6a20ab2d30f9e034b6f021817f34/blobxfer/operations/azure/__init__.py#L188-L208
def _key_is_sas(key): # type: (str) -> bool """Determine if key is a sas :param str key: key to parse :rtype: bool :return: if key is a sas """ # keys starting with ? are sas keys as ? is not in the base-64 # character range if key.startswith('?'):...
[ "def", "_key_is_sas", "(", "key", ")", ":", "# type: (str) -> bool", "# keys starting with ? are sas keys as ? is not in the base-64", "# character range", "if", "key", ".", "startswith", "(", "'?'", ")", ":", "return", "True", "else", ":", "# & is not in the base-64 charac...
Determine if key is a sas :param str key: key to parse :rtype: bool :return: if key is a sas
[ "Determine", "if", "key", "is", "a", "sas", ":", "param", "str", "key", ":", "key", "to", "parse", ":", "rtype", ":", "bool", ":", "return", ":", "if", "key", "is", "a", "sas" ]
python
train
pyupio/pyup
pyup/bot.py
https://github.com/pyupio/pyup/blob/b20fa88e03cfdf5dc409a9f00d27629188171c31/pyup/bot.py#L275-L294
def is_bot_the_only_committer(self, pr): """ Checks if the bot is the only committer for the given pull request. :param update: Update to check :return: bool - True if conflict found """ committer = self.provider.get_pull_request_committer( self.user_repo, ...
[ "def", "is_bot_the_only_committer", "(", "self", ",", "pr", ")", ":", "committer", "=", "self", ".", "provider", ".", "get_pull_request_committer", "(", "self", ".", "user_repo", ",", "pr", ")", "# flatten the list and remove duplicates", "committer_set", "=", "set"...
Checks if the bot is the only committer for the given pull request. :param update: Update to check :return: bool - True if conflict found
[ "Checks", "if", "the", "bot", "is", "the", "only", "committer", "for", "the", "given", "pull", "request", ".", ":", "param", "update", ":", "Update", "to", "check", ":", "return", ":", "bool", "-", "True", "if", "conflict", "found" ]
python
train
enkore/i3pystatus
i3pystatus/core/io.py
https://github.com/enkore/i3pystatus/blob/14cfde967cecf79b40e223e35a04600f4c875af7/i3pystatus/core/io.py#L193-L203
def parse_line(self, line): """Parse a single line of JSON and write modified JSON back.""" prefix = "" # ignore comma at start of lines if line.startswith(","): line, prefix = line[1:], "," j = json.loads(line) yield j self.io.write_line(prefix + js...
[ "def", "parse_line", "(", "self", ",", "line", ")", ":", "prefix", "=", "\"\"", "# ignore comma at start of lines", "if", "line", ".", "startswith", "(", "\",\"", ")", ":", "line", ",", "prefix", "=", "line", "[", "1", ":", "]", ",", "\",\"", "j", "=",...
Parse a single line of JSON and write modified JSON back.
[ "Parse", "a", "single", "line", "of", "JSON", "and", "write", "modified", "JSON", "back", "." ]
python
train
OLC-Bioinformatics/sipprverse
sixteenS/sixteens_full.py
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/sixteenS/sixteens_full.py#L235-L259
def makeblastdb(self): """ Makes blast database files from targets as necessary """ # Iterate through the samples to set the bait file. for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': # Remove the file extension ...
[ "def", "makeblastdb", "(", "self", ")", ":", "# Iterate through the samples to set the bait file.", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":", "# Remove the file...
Makes blast database files from targets as necessary
[ "Makes", "blast", "database", "files", "from", "targets", "as", "necessary" ]
python
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L140-L147
def reset_scan_stats(self): """Clears the scan event statistics and updates the last reset time""" self._scan_event_count = 0 self._v1_scan_count = 0 self._v1_scan_response_count = 0 self._v2_scan_count = 0 self._device_scan_counts = {} self._last_reset_time = tim...
[ "def", "reset_scan_stats", "(", "self", ")", ":", "self", ".", "_scan_event_count", "=", "0", "self", ".", "_v1_scan_count", "=", "0", "self", ".", "_v1_scan_response_count", "=", "0", "self", ".", "_v2_scan_count", "=", "0", "self", ".", "_device_scan_counts"...
Clears the scan event statistics and updates the last reset time
[ "Clears", "the", "scan", "event", "statistics", "and", "updates", "the", "last", "reset", "time" ]
python
train
nvbn/thefuck
thefuck/shells/fish.py
https://github.com/nvbn/thefuck/blob/40ab4eb62db57627bff10cf029d29c94704086a2/thefuck/shells/fish.py#L107-L112
def info(self): """Returns the name and version of the current shell""" proc = Popen(['fish', '--version'], stdout=PIPE, stderr=DEVNULL) version = proc.stdout.read().decode('utf-8').split()[-1] return u'Fish Shell {}'.format(version)
[ "def", "info", "(", "self", ")", ":", "proc", "=", "Popen", "(", "[", "'fish'", ",", "'--version'", "]", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "DEVNULL", ")", "version", "=", "proc", ".", "stdout", ".", "read", "(", ")", ".", "decode", ...
Returns the name and version of the current shell
[ "Returns", "the", "name", "and", "version", "of", "the", "current", "shell" ]
python
train
tilezen/mapbox-vector-tile
mapbox_vector_tile/optimise.py
https://github.com/tilezen/mapbox-vector-tile/blob/7327b8cff0aa2de1d5233e556bf00429ba2126a0/mapbox_vector_tile/optimise.py#L226-L247
def optimise_tile(tile_bytes): """ Decode a sequence of bytes as an MVT tile and reorder the string table of its layers and the order of its multilinestrings to save a few bytes. """ t = tile() t.ParseFromString(tile_bytes) for layer in t.layers: sto = StringTableOptimiser() ...
[ "def", "optimise_tile", "(", "tile_bytes", ")", ":", "t", "=", "tile", "(", ")", "t", ".", "ParseFromString", "(", "tile_bytes", ")", "for", "layer", "in", "t", ".", "layers", ":", "sto", "=", "StringTableOptimiser", "(", ")", "for", "feature", "in", "...
Decode a sequence of bytes as an MVT tile and reorder the string table of its layers and the order of its multilinestrings to save a few bytes.
[ "Decode", "a", "sequence", "of", "bytes", "as", "an", "MVT", "tile", "and", "reorder", "the", "string", "table", "of", "its", "layers", "and", "the", "order", "of", "its", "multilinestrings", "to", "save", "a", "few", "bytes", "." ]
python
train
fastai/fastai
fastai/callbacks/general_sched.py
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/general_sched.py#L40-L46
def on_batch_end(self, train, **kwargs:Any)->None: "Take a step in lr,mom sched, start next stepper when the current one is complete." if train: if self.idx_s >= len(self.scheds): return {'stop_training': True, 'stop_epoch': True} sched = self.scheds[self.idx_s] for k...
[ "def", "on_batch_end", "(", "self", ",", "train", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "if", "train", ":", "if", "self", ".", "idx_s", ">=", "len", "(", "self", ".", "scheds", ")", ":", "return", "{", "'stop_training'", ":",...
Take a step in lr,mom sched, start next stepper when the current one is complete.
[ "Take", "a", "step", "in", "lr", "mom", "sched", "start", "next", "stepper", "when", "the", "current", "one", "is", "complete", "." ]
python
train
toejough/pimento
pimento/__init__.py
https://github.com/toejough/pimento/blob/cdb00a93976733aa5521f8504152cedeedfc711a/pimento/__init__.py#L298-L311
def _exact_match(response, matches, insensitive, fuzzy): ''' returns an exact match, if it exists, given parameters for the match ''' for match in matches: if response == match: return match elif insensitive and response.lower() == match.lower(): return match ...
[ "def", "_exact_match", "(", "response", ",", "matches", ",", "insensitive", ",", "fuzzy", ")", ":", "for", "match", "in", "matches", ":", "if", "response", "==", "match", ":", "return", "match", "elif", "insensitive", "and", "response", ".", "lower", "(", ...
returns an exact match, if it exists, given parameters for the match
[ "returns", "an", "exact", "match", "if", "it", "exists", "given", "parameters", "for", "the", "match" ]
python
train
saltstack/salt
salt/modules/ps.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ps.py#L416-L435
def virtual_memory(): ''' .. versionadded:: 2014.7.0 Return a dict that describes statistics about system memory usage. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.virtual_memory ''' if p...
[ "def", "virtual_memory", "(", ")", ":", "if", "psutil", ".", "version_info", "<", "(", "0", ",", "6", ",", "0", ")", ":", "msg", "=", "'virtual_memory is only available in psutil 0.6.0 or greater'", "raise", "CommandExecutionError", "(", "msg", ")", "return", "d...
.. versionadded:: 2014.7.0 Return a dict that describes statistics about system memory usage. .. note:: This function is only available in psutil version 0.6.0 and above. CLI Example: .. code-block:: bash salt '*' ps.virtual_memory
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
python
train
Esri/ArcREST
src/arcrest/manageorg/_portals.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1367-L1408
def cost(self, tileStorage=0, fileStorage=0, featureStorage=0, generatedTileCount=0, loadedTileCount=0, enrichVariableCount=0, enrichReportCount=0, serviceAreaCount=0, geocodeCount=0): """ ...
[ "def", "cost", "(", "self", ",", "tileStorage", "=", "0", ",", "fileStorage", "=", "0", ",", "featureStorage", "=", "0", ",", "generatedTileCount", "=", "0", ",", "loadedTileCount", "=", "0", ",", "enrichVariableCount", "=", "0", ",", "enrichReportCount", ...
returns the cost values for a given portal Inputs: tileStorage - int - numbe of tiles to store in MBs fileStorage - int - size of file to store in MBs featureStorage - int - size in MBs generateTileCount - int - number of tiles to genearte on site loadedTileCount -in...
[ "returns", "the", "cost", "values", "for", "a", "given", "portal", "Inputs", ":", "tileStorage", "-", "int", "-", "numbe", "of", "tiles", "to", "store", "in", "MBs", "fileStorage", "-", "int", "-", "size", "of", "file", "to", "store", "in", "MBs", "fea...
python
train
CEA-COSMIC/ModOpt
modopt/opt/proximity.py
https://github.com/CEA-COSMIC/ModOpt/blob/019b189cb897cbb4d210c44a100daaa08468830c/modopt/opt/proximity.py#L90-L105
def _cost_method(self, *args, **kwargs): """Calculate positivity component of the cost This method returns 0 as the posivituty does not contribute to the cost. Returns ------- float zero """ if 'verbose' in kwargs and kwargs['verbose']: pri...
[ "def", "_cost_method", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'verbose'", "in", "kwargs", "and", "kwargs", "[", "'verbose'", "]", ":", "print", "(", "' - Min (X):'", ",", "np", ".", "min", "(", "args", "[", "0", "]...
Calculate positivity component of the cost This method returns 0 as the posivituty does not contribute to the cost. Returns ------- float zero
[ "Calculate", "positivity", "component", "of", "the", "cost" ]
python
train
googledatalab/pydatalab
solutionbox/ml_workbench/tensorflow/transform.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/solutionbox/ml_workbench/tensorflow/transform.py#L373-L389
def encode_csv(data_dict, column_names): """Builds a csv string. Args: data_dict: dict of {column_name: 1 value} column_names: list of column names Returns: A csv string version of data_dict """ import csv import six values = [str(data_dict[x]) for x in column_names] str_buff = six.StringI...
[ "def", "encode_csv", "(", "data_dict", ",", "column_names", ")", ":", "import", "csv", "import", "six", "values", "=", "[", "str", "(", "data_dict", "[", "x", "]", ")", "for", "x", "in", "column_names", "]", "str_buff", "=", "six", ".", "StringIO", "("...
Builds a csv string. Args: data_dict: dict of {column_name: 1 value} column_names: list of column names Returns: A csv string version of data_dict
[ "Builds", "a", "csv", "string", "." ]
python
train
tensorflow/mesh
mesh_tensorflow/auto_mtf/graph_interface.py
https://github.com/tensorflow/mesh/blob/3921196e5e43302e820da0a87329f25d7e2a3016/mesh_tensorflow/auto_mtf/graph_interface.py#L259-L272
def get_tensor_mtf_dimension_names(self, tensor_name): """The Mesh TensorFlow dimensions associated with a tensor. Args: tensor_name: a string, name of a tensor in the graph. Returns: a [string], the names of Mesh TensorFlow dimensions. """ tensor = self._name_to_tensor(tensor_name) ...
[ "def", "get_tensor_mtf_dimension_names", "(", "self", ",", "tensor_name", ")", ":", "tensor", "=", "self", ".", "_name_to_tensor", "(", "tensor_name", ")", "if", "isinstance", "(", "tensor", ",", "mtf", ".", "Tensor", ")", ":", "return", "tensor", ".", "shap...
The Mesh TensorFlow dimensions associated with a tensor. Args: tensor_name: a string, name of a tensor in the graph. Returns: a [string], the names of Mesh TensorFlow dimensions.
[ "The", "Mesh", "TensorFlow", "dimensions", "associated", "with", "a", "tensor", "." ]
python
train
merll/docker-map
dockermap/dep.py
https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/dep.py#L108-L124
def get_dependencies(self, item): """ Performs a dependency check on the given item. :param item: Node to start the dependency check with. :return: The result on merged dependencies down the hierarchy. """ def _get_sub_dependency(sub_item): e = self._deps.get...
[ "def", "get_dependencies", "(", "self", ",", "item", ")", ":", "def", "_get_sub_dependency", "(", "sub_item", ")", ":", "e", "=", "self", ".", "_deps", ".", "get", "(", "sub_item", ")", "if", "e", "is", "None", ":", "return", "self", ".", "get_default"...
Performs a dependency check on the given item. :param item: Node to start the dependency check with. :return: The result on merged dependencies down the hierarchy.
[ "Performs", "a", "dependency", "check", "on", "the", "given", "item", "." ]
python
train
ToFuProject/tofu
tofu/pathfile.py
https://github.com/ToFuProject/tofu/blob/39d6b2e7ced9e13666572dfd37e19403f1d6ff8d/tofu/pathfile.py#L73-L121
def get_PolyFromPolyFileObj(PolyFileObj, SavePathInp=None, units='m', comments='#', skiprows=0, shape0=2): """ Return a polygon as a np.ndarray, extracted from a txt file or from a ToFu object, with appropriate units Useful for :meth:`tofu.plugins.AUG.Ves._create()` Parameters ---------- PolyFileO...
[ "def", "get_PolyFromPolyFileObj", "(", "PolyFileObj", ",", "SavePathInp", "=", "None", ",", "units", "=", "'m'", ",", "comments", "=", "'#'", ",", "skiprows", "=", "0", ",", "shape0", "=", "2", ")", ":", "assert", "type", "(", "PolyFileObj", ")", "in", ...
Return a polygon as a np.ndarray, extracted from a txt file or from a ToFu object, with appropriate units Useful for :meth:`tofu.plugins.AUG.Ves._create()` Parameters ---------- PolyFileObj : str / :mod:`tofu.geom` object / np.ndarray The source where the polygon is to be found, either: ...
[ "Return", "a", "polygon", "as", "a", "np", ".", "ndarray", "extracted", "from", "a", "txt", "file", "or", "from", "a", "ToFu", "object", "with", "appropriate", "units" ]
python
train
molmod/molmod
molmod/molecular_graphs.py
https://github.com/molmod/molmod/blob/a7b5b4364ed514ad4c465856c05b5eda1cb561e0/molmod/molecular_graphs.py#L66-L73
def _check_symbols(self, symbols): """the size must be the same as the length of the array numbers and all elements must be strings""" if len(symbols) != self.size: raise TypeError("The number of symbols in the graph does not " "match the length of the atomic numbers array.")...
[ "def", "_check_symbols", "(", "self", ",", "symbols", ")", ":", "if", "len", "(", "symbols", ")", "!=", "self", ".", "size", ":", "raise", "TypeError", "(", "\"The number of symbols in the graph does not \"", "\"match the length of the atomic numbers array.\"", ")", "...
the size must be the same as the length of the array numbers and all elements must be strings
[ "the", "size", "must", "be", "the", "same", "as", "the", "length", "of", "the", "array", "numbers", "and", "all", "elements", "must", "be", "strings" ]
python
train
markovmodel/msmtools
msmtools/flux/api.py
https://github.com/markovmodel/msmtools/blob/54dc76dd2113a0e8f3d15d5316abab41402941be/msmtools/flux/api.py#L162-L230
def flux_matrix(T, pi, qminus, qplus, netflux=True): r"""Compute the TPT flux network for the reaction A-->B. Parameters ---------- T : (M, M) ndarray transition matrix pi : (M,) ndarray Stationary distribution corresponding to T qminus : (M,) ndarray Backward comittor ...
[ "def", "flux_matrix", "(", "T", ",", "pi", ",", "qminus", ",", "qplus", ",", "netflux", "=", "True", ")", ":", "if", "issparse", "(", "T", ")", ":", "return", "sparse", ".", "tpt", ".", "flux_matrix", "(", "T", ",", "pi", ",", "qminus", ",", "qpl...
r"""Compute the TPT flux network for the reaction A-->B. Parameters ---------- T : (M, M) ndarray transition matrix pi : (M,) ndarray Stationary distribution corresponding to T qminus : (M,) ndarray Backward comittor qplus : (M,) ndarray Forward committor net...
[ "r", "Compute", "the", "TPT", "flux", "network", "for", "the", "reaction", "A", "--", ">", "B", "." ]
python
train
danilobellini/audiolazy
audiolazy/lazy_itertools.py
https://github.com/danilobellini/audiolazy/blob/dba0a278937909980ed40b976d866b8e97c35dee/audiolazy/lazy_itertools.py#L69-L76
def accumulate(iterable): " Return series of accumulated sums. " iterator = iter(iterable) sum_data = next(iterator) yield sum_data for el in iterator: sum_data += el yield sum_data
[ "def", "accumulate", "(", "iterable", ")", ":", "iterator", "=", "iter", "(", "iterable", ")", "sum_data", "=", "next", "(", "iterator", ")", "yield", "sum_data", "for", "el", "in", "iterator", ":", "sum_data", "+=", "el", "yield", "sum_data" ]
Return series of accumulated sums.
[ "Return", "series", "of", "accumulated", "sums", "." ]
python
train
jxtech/wechatpy
wechatpy/client/api/invoice.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L91-L113
def set_auth_field(self, user_field, biz_field): """ 设置授权页字段信息 详情请参考 https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2 :param user_field: 授权页个人发票字段 :type user_field: dict :param biz_field: 授权页单位发票字段 :type biz_field: dict """ return self....
[ "def", "set_auth_field", "(", "self", ",", "user_field", ",", "biz_field", ")", ":", "return", "self", ".", "_post", "(", "'setbizattr'", ",", "params", "=", "{", "'action'", ":", "'set_auth_field'", ",", "}", ",", "data", "=", "{", "'auth_field'", ":", ...
设置授权页字段信息 详情请参考 https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2 :param user_field: 授权页个人发票字段 :type user_field: dict :param biz_field: 授权页单位发票字段 :type biz_field: dict
[ "设置授权页字段信息", "详情请参考", "https", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki?id", "=", "mp1497082828_r1cI2" ]
python
train
mojaie/chorus
chorus/util/geometry.py
https://github.com/mojaie/chorus/blob/fc7fe23a0272554c67671645ab07830b315eeb1b/chorus/util/geometry.py#L149-L160
def p_seg(p1, p2, cw, interval, trim=0, align=0): """ parallel segment Args: p1, p2: point(x, y) cw: m_seg rad True: -π/2, False: π/2 interval: m_seg dist trim: t_seg trim align: t_seg align """ case = {True: pi / -2, False: pi / 2} p1m, p2m = m_seg(p1, p2, case[cw], in...
[ "def", "p_seg", "(", "p1", ",", "p2", ",", "cw", ",", "interval", ",", "trim", "=", "0", ",", "align", "=", "0", ")", ":", "case", "=", "{", "True", ":", "pi", "/", "-", "2", ",", "False", ":", "pi", "/", "2", "}", "p1m", ",", "p2m", "=",...
parallel segment Args: p1, p2: point(x, y) cw: m_seg rad True: -π/2, False: π/2 interval: m_seg dist trim: t_seg trim align: t_seg align
[ "parallel", "segment", "Args", ":", "p1", "p2", ":", "point", "(", "x", "y", ")", "cw", ":", "m_seg", "rad", "True", ":", "-", "π", "/", "2", "False", ":", "π", "/", "2", "interval", ":", "m_seg", "dist", "trim", ":", "t_seg", "trim", "align", ...
python
train
moonso/vcftoolbox
vcftoolbox/parse_variant.py
https://github.com/moonso/vcftoolbox/blob/438fb1d85a83812c389774b94802eb5921c89e3a/vcftoolbox/parse_variant.py#L90-L111
def get_vep_info(vep_string, vep_header): """Make the vep annotations into a dictionaries A vep dictionary will have the vep column names as keys and the vep annotations as values. The dictionaries are stored in a list Args: vep_string (string): A string with the C...
[ "def", "get_vep_info", "(", "vep_string", ",", "vep_header", ")", ":", "vep_annotations", "=", "[", "dict", "(", "zip", "(", "vep_header", ",", "vep_annotation", ".", "split", "(", "'|'", ")", ")", ")", "for", "vep_annotation", "in", "vep_string", ".", "sp...
Make the vep annotations into a dictionaries A vep dictionary will have the vep column names as keys and the vep annotations as values. The dictionaries are stored in a list Args: vep_string (string): A string with the CSQ annotation vep_header (list): A li...
[ "Make", "the", "vep", "annotations", "into", "a", "dictionaries", "A", "vep", "dictionary", "will", "have", "the", "vep", "column", "names", "as", "keys", "and", "the", "vep", "annotations", "as", "values", ".", "The", "dictionaries", "are", "stored", "in", ...
python
train
census-instrumentation/opencensus-python
contrib/opencensus-ext-django/opencensus/ext/django/middleware.py
https://github.com/census-instrumentation/opencensus-python/blob/992b223f7e34c5dcb65922b7d5c827e7a1351e7d/contrib/opencensus-ext-django/opencensus/ext/django/middleware.py#L188-L204
def process_view(self, request, view_func, *args, **kwargs): """Process view is executed before the view function, here we get the function name add set it as the span name. """ # Do not trace if the url is blacklisted if utils.disable_tracing_url(request.path, self.blacklist_pa...
[ "def", "process_view", "(", "self", ",", "request", ",", "view_func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Do not trace if the url is blacklisted", "if", "utils", ".", "disable_tracing_url", "(", "request", ".", "path", ",", "self", ".", "...
Process view is executed before the view function, here we get the function name add set it as the span name.
[ "Process", "view", "is", "executed", "before", "the", "view", "function", "here", "we", "get", "the", "function", "name", "add", "set", "it", "as", "the", "span", "name", "." ]
python
train
jldantas/libmft
libmft/api.py
https://github.com/jldantas/libmft/blob/65a988605fe7663b788bd81dcb52c0a4eaad1549/libmft/api.py#L903-L943
def _compute_full_path(self, fn_parent_ref, fn_parent_seq): '''Based on the parent reference and sequence, computes the full path. The majority of the files in a filesystem has a very small amount of parent directories. By definition, a filesystem is expected to have much smaller amount...
[ "def", "_compute_full_path", "(", "self", ",", "fn_parent_ref", ",", "fn_parent_seq", ")", ":", "names", "=", "[", "]", "root_id", "=", "5", "index", ",", "seq", "=", "fn_parent_ref", ",", "fn_parent_seq", "is_orphan", "=", "False", "#search until hit the root e...
Based on the parent reference and sequence, computes the full path. The majority of the files in a filesystem has a very small amount of parent directories. By definition, a filesystem is expected to have much smaller amount of directories than files. As such we use a function with the ...
[ "Based", "on", "the", "parent", "reference", "and", "sequence", "computes", "the", "full", "path", "." ]
python
train
dedupeio/dedupe
dedupe/core.py
https://github.com/dedupeio/dedupe/blob/9f7c9f84473a4bcacf0f2b11152d8ed3eb35d48b/dedupe/core.py#L65-L79
def randomPairsMatch(n_records_A, n_records_B, sample_size): """ Return random combinations of indices for record list A and B """ n = int(n_records_A * n_records_B) if sample_size >= n: random_pairs = numpy.arange(n) else: random_pairs = numpy.array(random.sample(range(n), samp...
[ "def", "randomPairsMatch", "(", "n_records_A", ",", "n_records_B", ",", "sample_size", ")", ":", "n", "=", "int", "(", "n_records_A", "*", "n_records_B", ")", "if", "sample_size", ">=", "n", ":", "random_pairs", "=", "numpy", ".", "arange", "(", "n", ")", ...
Return random combinations of indices for record list A and B
[ "Return", "random", "combinations", "of", "indices", "for", "record", "list", "A", "and", "B" ]
python
train
scanny/python-pptx
pptx/oxml/text.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/oxml/text.py#L356-L362
def content_children(self): """ A sequence containing the text-container child elements of this ``<a:p>`` element, i.e. (a:r|a:br|a:fld). """ text_types = {CT_RegularTextRun, CT_TextLineBreak, CT_TextField} return tuple(elm for elm in self if type(elm) in text_types)
[ "def", "content_children", "(", "self", ")", ":", "text_types", "=", "{", "CT_RegularTextRun", ",", "CT_TextLineBreak", ",", "CT_TextField", "}", "return", "tuple", "(", "elm", "for", "elm", "in", "self", "if", "type", "(", "elm", ")", "in", "text_types", ...
A sequence containing the text-container child elements of this ``<a:p>`` element, i.e. (a:r|a:br|a:fld).
[ "A", "sequence", "containing", "the", "text", "-", "container", "child", "elements", "of", "this", "<a", ":", "p", ">", "element", "i", ".", "e", ".", "(", "a", ":", "r|a", ":", "br|a", ":", "fld", ")", "." ]
python
train
mfcloud/python-zvm-sdk
smtLayer/changeVM.py
https://github.com/mfcloud/python-zvm-sdk/blob/de9994ceca764f5460ce51bd74237986341d8e3c/smtLayer/changeVM.py#L558-L663
def addLOADDEV(rh): """ Sets the LOADDEV statement in the virtual machine's directory entry. Input: Request Handle with the following properties: function - 'CHANGEVM' subfunction - 'ADDLOADDEV' userid - userid of the virtual machine parms['boot'] ...
[ "def", "addLOADDEV", "(", "rh", ")", ":", "rh", ".", "printSysLog", "(", "\"Enter changeVM.addLOADDEV\"", ")", "# scpDataType and scpData must appear or disappear concurrently", "if", "(", "'scpData'", "in", "rh", ".", "parms", "and", "'scpDataType'", "not", "in", "rh...
Sets the LOADDEV statement in the virtual machine's directory entry. Input: Request Handle with the following properties: function - 'CHANGEVM' subfunction - 'ADDLOADDEV' userid - userid of the virtual machine parms['boot'] - Boot program number ...
[ "Sets", "the", "LOADDEV", "statement", "in", "the", "virtual", "machine", "s", "directory", "entry", "." ]
python
train
openfisca/openfisca-survey-manager
openfisca_survey_manager/scenarios.py
https://github.com/openfisca/openfisca-survey-manager/blob/bed6c65dc5e4ec2bdc9cda5b865fefd9e3d0c358/openfisca_survey_manager/scenarios.py#L1210-L1217
def _set_id_variable_by_entity_key(self) -> Dict[str, str]: '''Identify and set the good ids for the different entities''' if self.id_variable_by_entity_key is None: self.id_variable_by_entity_key = dict( (entity.key, entity.key + '_id') for entity in self.tax_benefit_system....
[ "def", "_set_id_variable_by_entity_key", "(", "self", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "if", "self", ".", "id_variable_by_entity_key", "is", "None", ":", "self", ".", "id_variable_by_entity_key", "=", "dict", "(", "(", "entity", ".", "key...
Identify and set the good ids for the different entities
[ "Identify", "and", "set", "the", "good", "ids", "for", "the", "different", "entities" ]
python
train
titusjan/argos
argos/config/intcti.py
https://github.com/titusjan/argos/blob/20d0a3cae26c36ea789a5d219c02ca7df21279dd/argos/config/intcti.py#L73-L77
def debugInfo(self): """ Returns the string with debugging information """ return ("enabled = {}, min = {}, max = {}, step = {}, specVal = {}" .format(self.enabled, self.minValue, self.maxValue, self.stepSize, self.specialValueText))
[ "def", "debugInfo", "(", "self", ")", ":", "return", "(", "\"enabled = {}, min = {}, max = {}, step = {}, specVal = {}\"", ".", "format", "(", "self", ".", "enabled", ",", "self", ".", "minValue", ",", "self", ".", "maxValue", ",", "self", ".", "stepSize", ",", ...
Returns the string with debugging information
[ "Returns", "the", "string", "with", "debugging", "information" ]
python
train
genialis/resolwe
resolwe/elastic/management/commands/elastic_index.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/elastic/management/commands/elastic_index.py#L23-L31
def handle(self, *args, **options): """Command handle.""" verbosity = int(options['verbosity']) if self.has_filter(options): self.filter_indices(options, verbosity) else: # Process all indices. index_builder.build()
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "verbosity", "=", "int", "(", "options", "[", "'verbosity'", "]", ")", "if", "self", ".", "has_filter", "(", "options", ")", ":", "self", ".", "filter_indices", "(", ...
Command handle.
[ "Command", "handle", "." ]
python
train
johncosta/django-like-button
like_button/templatetags/like_button.py
https://github.com/johncosta/django-like-button/blob/c93a1be9c041d76e8de9a26f424ad4f836ab97bd/like_button/templatetags/like_button.py#L59-L94
def like_button_tag(context): """ This tag will check to see if they have the FACEBOOK_APP_ID setup correctly in the django settings, if so then it will pass the data along to the intercom_tag template to be displayed. If something isn't perfect we will return False, which will then not ...
[ "def", "like_button_tag", "(", "context", ")", ":", "if", "FACEBOOK_APP_ID", "is", "None", ":", "log", ".", "warning", "(", "\"FACEBOOK_APP_ID isn't setup correctly in your settings\"", ")", "# make sure INTERCOM_APPID is setup correct and user is authenticated", "if", "FACEBOO...
This tag will check to see if they have the FACEBOOK_APP_ID setup correctly in the django settings, if so then it will pass the data along to the intercom_tag template to be displayed. If something isn't perfect we will return False, which will then not install the javascript since it i...
[ "This", "tag", "will", "check", "to", "see", "if", "they", "have", "the", "FACEBOOK_APP_ID", "setup", "correctly", "in", "the", "django", "settings", "if", "so", "then", "it", "will", "pass", "the", "data", "along", "to", "the", "intercom_tag", "template", ...
python
train
onicagroup/runway
runway/commands/modules_command.py
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/commands/modules_command.py#L54-L86
def determine_module_class(path, class_path): """Determine type of module and return deployment module class.""" if not class_path: # First check directory name for type-indicating suffix basename = os.path.basename(path) if basename.endswith('.sls'): class_path = 'runway.mod...
[ "def", "determine_module_class", "(", "path", ",", "class_path", ")", ":", "if", "not", "class_path", ":", "# First check directory name for type-indicating suffix", "basename", "=", "os", ".", "path", ".", "basename", "(", "path", ")", "if", "basename", ".", "end...
Determine type of module and return deployment module class.
[ "Determine", "type", "of", "module", "and", "return", "deployment", "module", "class", "." ]
python
train
deepmind/pysc2
pysc2/lib/renderer_human.py
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/renderer_human.py#L1062-L1076
def draw_help(self, surf): """Draw the help dialog.""" if not self._help: return def write(loc, text): surf.write_screen(self._font_large, colors.black, loc, text) surf.surf.fill(colors.white * 0.8) write((1, 1), "Shortcuts:") max_len = max(len(s) for s, _ in self.shortcuts) f...
[ "def", "draw_help", "(", "self", ",", "surf", ")", ":", "if", "not", "self", ".", "_help", ":", "return", "def", "write", "(", "loc", ",", "text", ")", ":", "surf", ".", "write_screen", "(", "self", ".", "_font_large", ",", "colors", ".", "black", ...
Draw the help dialog.
[ "Draw", "the", "help", "dialog", "." ]
python
train
fprimex/zdesk
zdesk/zdesk_api.py
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L4044-L4048
def user_requests(self, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/requests#list-requests" api_path = "/api/v2/users/{id}/requests.json" api_path = api_path.format(id=id) return self.call(api_path, **kwargs)
[ "def", "user_requests", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "api_path", "=", "\"/api/v2/users/{id}/requests.json\"", "api_path", "=", "api_path", ".", "format", "(", "id", "=", "id", ")", "return", "self", ".", "call", "(", "api_path...
https://developer.zendesk.com/rest_api/docs/core/requests#list-requests
[ "https", ":", "//", "developer", ".", "zendesk", ".", "com", "/", "rest_api", "/", "docs", "/", "core", "/", "requests#list", "-", "requests" ]
python
train