nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_psosx.py
python
Process.memory_maps
(self)
return cext.proc_memory_maps(self.pid)
[]
def memory_maps(self): return cext.proc_memory_maps(self.pid)
[ "def", "memory_maps", "(", "self", ")", ":", "return", "cext", ".", "proc_memory_maps", "(", "self", ".", "pid", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/x86/psutil/_psosx.py#L362-L363
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/vax/incremental/vietnam.py
python
Vietnam.pipe_clean_source_url
(self, df: pd.DataFrame)
return df.assign(source_url=df.source_url.apply(lambda x: x.split("?")[0]))
[]
def pipe_clean_source_url(self, df: pd.DataFrame) -> pd.DataFrame: return df.assign(source_url=df.source_url.apply(lambda x: x.split("?")[0]))
[ "def", "pipe_clean_source_url", "(", "self", ",", "df", ":", "pd", ".", "DataFrame", ")", "->", "pd", ".", "DataFrame", ":", "return", "df", ".", "assign", "(", "source_url", "=", "df", ".", "source_url", ".", "apply", "(", "lambda", "x", ":", "x", "...
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/vax/incremental/vietnam.py#L57-L58
ecederstrand/exchangelib
c7653778f8110d56608ad38c8a92d083c142e660
exchangelib/services/common.py
python
EWSPagingService._get_pages
(self, payload_func, kwargs, expected_message_count)
return page_elems
Request a page, or a list of pages if multiple collections are pages in a single request. Return each page.
Request a page, or a list of pages if multiple collections are pages in a single request. Return each page.
[ "Request", "a", "page", "or", "a", "list", "of", "pages", "if", "multiple", "collections", "are", "pages", "in", "a", "single", "request", ".", "Return", "each", "page", "." ]
def _get_pages(self, payload_func, kwargs, expected_message_count): """Request a page, or a list of pages if multiple collections are pages in a single request. Return each page. """ payload = payload_func(**kwargs) page_elems = list(self._get_elements(payload=payload)) i...
[ "def", "_get_pages", "(", "self", ",", "payload_func", ",", "kwargs", ",", "expected_message_count", ")", ":", "payload", "=", "payload_func", "(", "*", "*", "kwargs", ")", "page_elems", "=", "list", "(", "self", ".", "_get_elements", "(", "payload", "=", ...
https://github.com/ecederstrand/exchangelib/blob/c7653778f8110d56608ad38c8a92d083c142e660/exchangelib/services/common.py#L815-L825
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/nilrt_ip.py
python
set_static_all
(interface, address, netmask, gateway, nameservers=None)
return True
Configure specified adapter to use ipv4 manual settings Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot. :param str interface: interface label :param str address: ipv4 address :param str netmask: ipv4 netmask :param str gateway: ipv4 gateway :p...
Configure specified adapter to use ipv4 manual settings
[ "Configure", "specified", "adapter", "to", "use", "ipv4", "manual", "settings" ]
def set_static_all(interface, address, netmask, gateway, nameservers=None): """ Configure specified adapter to use ipv4 manual settings Change adapter mode to TCP/IP. If previous adapter mode was EtherCAT, the target will need reboot. :param str interface: interface label :param str address: ipv4 ...
[ "def", "set_static_all", "(", "interface", ",", "address", ",", "netmask", ",", "gateway", ",", "nameservers", "=", "None", ")", ":", "validate", ",", "msg", "=", "_validate_ipv4", "(", "[", "address", ",", "netmask", ",", "gateway", "]", ")", "if", "not...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/nilrt_ip.py#L889-L967
nodesign/weio
1d67d705a5c36a2e825ad13feab910b0aca9a2e8
updateMaker/imageTools/prepareWeioFiles.py
python
download
(url)
[]
def download(url): http_client = httpclient.AsyncHTTPClient() http_client.fetch(url, callback=decompress)
[ "def", "download", "(", "url", ")", ":", "http_client", "=", "httpclient", ".", "AsyncHTTPClient", "(", ")", "http_client", ".", "fetch", "(", "url", ",", "callback", "=", "decompress", ")" ]
https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/updateMaker/imageTools/prepareWeioFiles.py#L89-L91
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py
python
VersionControl.compare_urls
(cls, url1, url2)
return (cls.normalize_url(url1) == cls.normalize_url(url2))
Compare two repo URLs for identity, ignoring incidental differences.
Compare two repo URLs for identity, ignoring incidental differences.
[ "Compare", "two", "repo", "URLs", "for", "identity", "ignoring", "incidental", "differences", "." ]
def compare_urls(cls, url1, url2): # type: (str, str) -> bool """ Compare two repo URLs for identity, ignoring incidental differences. """ return (cls.normalize_url(url1) == cls.normalize_url(url2))
[ "def", "compare_urls", "(", "cls", ",", "url1", ",", "url2", ")", ":", "# type: (str, str) -> bool", "return", "(", "cls", ".", "normalize_url", "(", "url1", ")", "==", "cls", ".", "normalize_url", "(", "url2", ")", ")" ]
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py#L372-L377
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/settings/__init__.py
python
BaseSettings.__len__
(self)
return len(self.attributes)
[]
def __len__(self): return len(self.attributes)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "attributes", ")" ]
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/settings/__init__.py#L374-L375
Neuraxio/Neuraxle
c5627e663ef6d50736bc6a01110afa626fffec07
neuraxle/steps/loop.py
python
StepClonerForEachDataInput.__getitem__
(self, item)
return self.steps_as_tuple[item][1]
Get cloned step at the given index. :return: iter(self.steps_as_tuple)
Get cloned step at the given index.
[ "Get", "cloned", "step", "at", "the", "given", "index", "." ]
def __getitem__(self, item): """ Get cloned step at the given index. :return: iter(self.steps_as_tuple) """ return self.steps_as_tuple[item][1]
[ "def", "__getitem__", "(", "self", ",", "item", ")", ":", "return", "self", ".", "steps_as_tuple", "[", "item", "]", "[", "1", "]" ]
https://github.com/Neuraxio/Neuraxle/blob/c5627e663ef6d50736bc6a01110afa626fffec07/neuraxle/steps/loop.py#L303-L309
gkrizek/bash-lambda-layer
703b0ade8174022d44779d823172ab7ac33a5505
bin/docutils/statemachine.py
python
ViewList.trim_end
(self, n=1)
Remove items from the end of the list, without touching the parent.
Remove items from the end of the list, without touching the parent.
[ "Remove", "items", "from", "the", "end", "of", "the", "list", "without", "touching", "the", "parent", "." ]
def trim_end(self, n=1): """ Remove items from the end of the list, without touching the parent. """ if n > len(self.data): raise IndexError("Size of trim too large; can't trim %s items " "from a list of size %s." % (n, len(self.data))) el...
[ "def", "trim_end", "(", "self", ",", "n", "=", "1", ")", ":", "if", "n", ">", "len", "(", "self", ".", "data", ")", ":", "raise", "IndexError", "(", "\"Size of trim too large; can't trim %s items \"", "\"from a list of size %s.\"", "%", "(", "n", ",", "len",...
https://github.com/gkrizek/bash-lambda-layer/blob/703b0ade8174022d44779d823172ab7ac33a5505/bin/docutils/statemachine.py#L1271-L1281
numba/llvmlite
aeddf447d4befc336b26bde8c46042553a13cf75
llvmlite/ir/values.py
python
Function.descr_prototype
(self, buf)
Describe the prototype ("head") of the function.
Describe the prototype ("head") of the function.
[ "Describe", "the", "prototype", "(", "head", ")", "of", "the", "function", "." ]
def descr_prototype(self, buf): """ Describe the prototype ("head") of the function. """ state = "define" if self.blocks else "declare" ret = self.return_value args = ", ".join(str(a) for a in self.args) name = self.get_reference() attrs = self.attributes ...
[ "def", "descr_prototype", "(", "self", ",", "buf", ")", ":", "state", "=", "\"define\"", "if", "self", ".", "blocks", "else", "\"declare\"", "ret", "=", "self", ".", "return_value", "args", "=", "\", \"", ".", "join", "(", "str", "(", "a", ")", "for", ...
https://github.com/numba/llvmlite/blob/aeddf447d4befc336b26bde8c46042553a13cf75/llvmlite/ir/values.py#L966-L987
Yubico/python-fido2
58471d4af1c09cc9fe316771d6203b4844cbc668
fido2/ctap2/bio.py
python
FPEnrollmentContext.cancel
(self)
Cancels ongoing enrollment.
Cancels ongoing enrollment.
[ "Cancels", "ongoing", "enrollment", "." ]
def cancel(self): """Cancels ongoing enrollment.""" self._bio.enroll_cancel() self.template_id = None
[ "def", "cancel", "(", "self", ")", ":", "self", ".", "_bio", ".", "enroll_cancel", "(", ")", "self", ".", "template_id", "=", "None" ]
https://github.com/Yubico/python-fido2/blob/58471d4af1c09cc9fe316771d6203b4844cbc668/fido2/ctap2/bio.py#L133-L136
pyglet/pyglet
2833c1df902ca81aeeffa786c12e7e87d402434b
pyglet/event.py
python
EventDispatcher._remove_handler
(self, name, handler)
Used internally to remove all handler instances for the given event name. This is normally called from a dead ``WeakMethod`` to remove itself from the event stack.
Used internally to remove all handler instances for the given event name.
[ "Used", "internally", "to", "remove", "all", "handler", "instances", "for", "the", "given", "event", "name", "." ]
def _remove_handler(self, name, handler): """Used internally to remove all handler instances for the given event name. This is normally called from a dead ``WeakMethod`` to remove itself from the event stack. """ # Iterate over a copy as we might mutate the list for fra...
[ "def", "_remove_handler", "(", "self", ",", "name", ",", "handler", ")", ":", "# Iterate over a copy as we might mutate the list", "for", "frame", "in", "list", "(", "self", ".", "_event_stack", ")", ":", "if", "name", "in", "frame", ":", "try", ":", "if", "...
https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/event.py#L348-L366
wradlib/wradlib
25f9768ddfd69b5c339d8b22d20e45e591eaeb8d
wradlib/atten.py
python
correct_attenuation_hb
( gateset, coefficients={"a": 1.67e-4, "b": 0.7, "gate_length": 1.0}, mode="except", thrs=59.0, )
return pia
Gate-by-Gate attenuation correction according to \ :cite:`Hitschfeld1954` Parameters ---------- gateset : :py:class:`numpy:numpy.ndarray` multidimensional array. The range gates (over which iteration has to be performed) are supposed to vary along the *last* dimension so, e.g., ...
Gate-by-Gate attenuation correction according to \ :cite:`Hitschfeld1954`
[ "Gate", "-", "by", "-", "Gate", "attenuation", "correction", "according", "to", "\\", ":", "cite", ":", "Hitschfeld1954" ]
def correct_attenuation_hb( gateset, coefficients={"a": 1.67e-4, "b": 0.7, "gate_length": 1.0}, mode="except", thrs=59.0, ): """Gate-by-Gate attenuation correction according to \ :cite:`Hitschfeld1954` Parameters ---------- gateset : :py:class:`numpy:numpy.ndarray` multidime...
[ "def", "correct_attenuation_hb", "(", "gateset", ",", "coefficients", "=", "{", "\"a\"", ":", "1.67e-4", ",", "\"b\"", ":", "0.7", ",", "\"gate_length\"", ":", "1.0", "}", ",", "mode", "=", "\"except\"", ",", "thrs", "=", "59.0", ",", ")", ":", "a", "=...
https://github.com/wradlib/wradlib/blob/25f9768ddfd69b5c339d8b22d20e45e591eaeb8d/wradlib/atten.py#L46-L136
yistLin/pytorch-dual-learning
a2a6ff78cd8643ed86fe56e315848dca6b982e4f
nmt/nmt.py
python
to_input_variable
(sents, vocab, cuda=False, is_test=False)
return sents_var
return a tensor of shape (src_sent_len, batch_size)
return a tensor of shape (src_sent_len, batch_size)
[ "return", "a", "tensor", "of", "shape", "(", "src_sent_len", "batch_size", ")" ]
def to_input_variable(sents, vocab, cuda=False, is_test=False): """ return a tensor of shape (src_sent_len, batch_size) """ word_ids = word2id(sents, vocab) sents_t, masks = input_transpose(word_ids, vocab['<pad>']) sents_var = Variable(torch.LongTensor(sents_t), volatile=is_test, requires_gra...
[ "def", "to_input_variable", "(", "sents", ",", "vocab", ",", "cuda", "=", "False", ",", "is_test", "=", "False", ")", ":", "word_ids", "=", "word2id", "(", "sents", ",", "vocab", ")", "sents_t", ",", "masks", "=", "input_transpose", "(", "word_ids", ",",...
https://github.com/yistLin/pytorch-dual-learning/blob/a2a6ff78cd8643ed86fe56e315848dca6b982e4f/nmt/nmt.py#L470-L482
araffin/rl-baselines-zoo
ff84f398a1fae65e18819490bb4e41a201322759
utils/hyperparams_opt.py
python
sample_ppo2_params
(trial)
return { 'n_steps': n_steps, 'nminibatches': nminibatches, 'gamma': gamma, 'learning_rate': learning_rate, 'ent_coef': ent_coef, 'cliprange': cliprange, 'noptepochs': noptepochs, 'lam': lam }
Sampler for PPO2 hyperparams. :param trial: (optuna.trial) :return: (dict)
Sampler for PPO2 hyperparams.
[ "Sampler", "for", "PPO2", "hyperparams", "." ]
def sample_ppo2_params(trial): """ Sampler for PPO2 hyperparams. :param trial: (optuna.trial) :return: (dict) """ batch_size = trial.suggest_categorical('batch_size', [32, 64, 128, 256]) n_steps = trial.suggest_categorical('n_steps', [16, 32, 64, 128, 256, 512, 1024, 2048]) gamma = tria...
[ "def", "sample_ppo2_params", "(", "trial", ")", ":", "batch_size", "=", "trial", ".", "suggest_categorical", "(", "'batch_size'", ",", "[", "32", ",", "64", ",", "128", ",", "256", "]", ")", "n_steps", "=", "trial", ".", "suggest_categorical", "(", "'n_ste...
https://github.com/araffin/rl-baselines-zoo/blob/ff84f398a1fae65e18819490bb4e41a201322759/utils/hyperparams_opt.py#L148-L178
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/beacons/cert_info.py
python
beacon
(config)
return ret
Monitor the certificate files on the minion. Specify a notification threshold in days and only emit a beacon if any certificates are expiring within that timeframe or if `notify_days` equals `-1` (always report information). The default notification threshold is 45 days and can be overridden at the beacon ...
Monitor the certificate files on the minion.
[ "Monitor", "the", "certificate", "files", "on", "the", "minion", "." ]
def beacon(config): """ Monitor the certificate files on the minion. Specify a notification threshold in days and only emit a beacon if any certificates are expiring within that timeframe or if `notify_days` equals `-1` (always report information). The default notification threshold is 45 days and ...
[ "def", "beacon", "(", "config", ")", ":", "ret", "=", "[", "]", "certificates", "=", "[", "]", "CryptoError", "=", "crypto", ".", "Error", "# pylint: disable=invalid-name", "config", "=", "salt", ".", "utils", ".", "beacons", ".", "list_to_dict", "(", "con...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/beacons/cert_info.py#L55-L178
astropy/photutils
3caa48e4e4d139976ed7457dc41583fb2c56ba20
photutils/utils/_wcs_helpers.py
python
_pixel_scale_angle_at_skycoord
(skycoord, wcs, offset=1 * u.arcsec)
return (xpos, ypos), scale, angle
Calculate the pixel coordinate and scale and WCS rotation angle at the position of a SkyCoord coordinate. Parameters ---------- skycoord : `~astropy.coordinates.SkyCoord` The SkyCoord coordinate. wcs : WCS object A world coordinate system (WCS) transformation that supports ...
Calculate the pixel coordinate and scale and WCS rotation angle at the position of a SkyCoord coordinate.
[ "Calculate", "the", "pixel", "coordinate", "and", "scale", "and", "WCS", "rotation", "angle", "at", "the", "position", "of", "a", "SkyCoord", "coordinate", "." ]
def _pixel_scale_angle_at_skycoord(skycoord, wcs, offset=1 * u.arcsec): """ Calculate the pixel coordinate and scale and WCS rotation angle at the position of a SkyCoord coordinate. Parameters ---------- skycoord : `~astropy.coordinates.SkyCoord` The SkyCoord coordinate. wcs : WCS ...
[ "def", "_pixel_scale_angle_at_skycoord", "(", "skycoord", ",", "wcs", ",", "offset", "=", "1", "*", "u", ".", "arcsec", ")", ":", "# Convert to pixel coordinates", "xpos", ",", "ypos", "=", "wcs", ".", "world_to_pixel", "(", "skycoord", ")", "# We take a point d...
https://github.com/astropy/photutils/blob/3caa48e4e4d139976ed7457dc41583fb2c56ba20/photutils/utils/_wcs_helpers.py#L11-L65
airnotifier/airnotifier
27207bc9e8ee8f3ac9db428a456020d9e55eabda
pushservices/mpns.py
python
MPNSBase.optional_attribute
(self, element, attribute, payload_param, payload)
[]
def optional_attribute(self, element, attribute, payload_param, payload): if payload_param in payload: element.attrib["attribute"] = payload[payload_param]
[ "def", "optional_attribute", "(", "self", ",", "element", ",", "attribute", ",", "payload_param", ",", "payload", ")", ":", "if", "payload_param", "in", "payload", ":", "element", ".", "attrib", "[", "\"attribute\"", "]", "=", "payload", "[", "payload_param", ...
https://github.com/airnotifier/airnotifier/blob/27207bc9e8ee8f3ac9db428a456020d9e55eabda/pushservices/mpns.py#L133-L135
RhetTbull/osxphotos
231d13279296ee4a242d3140d8abe7b5a5bcc9c0
osxphotos/photosdb/photosdb.py
python
PhotosDB.keywords
(self)
return list(keywords)
return list of keywords found in photos database
return list of keywords found in photos database
[ "return", "list", "of", "keywords", "found", "in", "photos", "database" ]
def keywords(self): """return list of keywords found in photos database""" keywords = self._dbkeywords_keyword.keys() return list(keywords)
[ "def", "keywords", "(", "self", ")", ":", "keywords", "=", "self", ".", "_dbkeywords_keyword", ".", "keys", "(", ")", "return", "list", "(", "keywords", ")" ]
https://github.com/RhetTbull/osxphotos/blob/231d13279296ee4a242d3140d8abe7b5a5bcc9c0/osxphotos/photosdb/photosdb.py#L406-L409
limodou/uliweb
8bc827fa6bf7bf58aa8136b6c920fe2650c52422
uliweb/lib/werkzeug/wrappers.py
python
BaseResponse._ensure_sequence
(self, mutable=False)
This method can be called by methods that need a sequence. If `mutable` is true, it will also ensure that the response sequence is a standard Python list. .. versionadded:: 0.6
This method can be called by methods that need a sequence. If `mutable` is true, it will also ensure that the response sequence is a standard Python list.
[ "This", "method", "can", "be", "called", "by", "methods", "that", "need", "a", "sequence", ".", "If", "mutable", "is", "true", "it", "will", "also", "ensure", "that", "the", "response", "sequence", "is", "a", "standard", "Python", "list", "." ]
def _ensure_sequence(self, mutable=False): """This method can be called by methods that need a sequence. If `mutable` is true, it will also ensure that the response sequence is a standard Python list. .. versionadded:: 0.6 """ if self.is_sequence: # if we ne...
[ "def", "_ensure_sequence", "(", "self", ",", "mutable", "=", "False", ")", ":", "if", "self", ".", "is_sequence", ":", "# if we need a mutable object, we ensure it's a list.", "if", "mutable", "and", "not", "isinstance", "(", "self", ".", "response", ",", "list", ...
https://github.com/limodou/uliweb/blob/8bc827fa6bf7bf58aa8136b6c920fe2650c52422/uliweb/lib/werkzeug/wrappers.py#L885-L906
SeldonIO/alibi
ce961caf995d22648a8338857822c90428af4765
alibi/explainers/backends/cfrl_tabular.py
python
split_ohe
(X_ohe: 'Union[np.ndarray, torch.Tensor, tf.Tensor]', category_map: Dict[int, List[str]])
return X_ohe_num_split, X_ohe_cat_split
Splits a one-hot encoding array in a list of numerical heads and a list of categorical heads. Since by convention the numerical heads are merged in a single head, if the function returns a list of numerical heads, then the size of the list is 1. Parameters ---------- X_ohe One-hot encoding ...
Splits a one-hot encoding array in a list of numerical heads and a list of categorical heads. Since by convention the numerical heads are merged in a single head, if the function returns a list of numerical heads, then the size of the list is 1.
[ "Splits", "a", "one", "-", "hot", "encoding", "array", "in", "a", "list", "of", "numerical", "heads", "and", "a", "list", "of", "categorical", "heads", ".", "Since", "by", "convention", "the", "numerical", "heads", "are", "merged", "in", "a", "single", "...
def split_ohe(X_ohe: 'Union[np.ndarray, torch.Tensor, tf.Tensor]', category_map: Dict[int, List[str]]) -> Tuple[List, List]: """ Splits a one-hot encoding array in a list of numerical heads and a list of categorical heads. Since by convention the numerical heads are merged in a single head, if...
[ "def", "split_ohe", "(", "X_ohe", ":", "'Union[np.ndarray, torch.Tensor, tf.Tensor]'", ",", "category_map", ":", "Dict", "[", "int", ",", "List", "[", "str", "]", "]", ")", "->", "Tuple", "[", "List", ",", "List", "]", ":", "assert", "hasattr", "(", "X_ohe...
https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/explainers/backends/cfrl_tabular.py#L40-L83
Robot-Will/Stino
a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2
libs/serial/serialwin32.py
python
Serial.set_buffer_size
(self, rx_size=4096, tx_size=None)
\ Recommend a buffer size to the driver (device driver can ignore this value). Must be called before the port is opened.
\ Recommend a buffer size to the driver (device driver can ignore this value). Must be called before the port is opened.
[ "\\", "Recommend", "a", "buffer", "size", "to", "the", "driver", "(", "device", "driver", "can", "ignore", "this", "value", ")", ".", "Must", "be", "called", "before", "the", "port", "is", "opened", "." ]
def set_buffer_size(self, rx_size=4096, tx_size=None): """\ Recommend a buffer size to the driver (device driver can ignore this value). Must be called before the port is opened. """ if tx_size is None: tx_size = rx_size win32.SetupComm(self._port_handle, rx_s...
[ "def", "set_buffer_size", "(", "self", ",", "rx_size", "=", "4096", ",", "tx_size", "=", "None", ")", ":", "if", "tx_size", "is", "None", ":", "tx_size", "=", "rx_size", "win32", ".", "SetupComm", "(", "self", ".", "_port_handle", ",", "rx_size", ",", ...
https://github.com/Robot-Will/Stino/blob/a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2/libs/serial/serialwin32.py#L416-L423
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-modules/twisted/twisted/conch/client/agent.py
python
SSHAgentClient.getPublicKey
(self)
return None
Return a L{Key} from the first blob in C{self.blobs}, if any, or return C{None}.
Return a L{Key} from the first blob in C{self.blobs}, if any, or return C{None}.
[ "Return", "a", "L", "{", "Key", "}", "from", "the", "first", "blob", "in", "C", "{", "self", ".", "blobs", "}", "if", "any", "or", "return", "C", "{", "None", "}", "." ]
def getPublicKey(self): """ Return a L{Key} from the first blob in C{self.blobs}, if any, or return C{None}. """ if self.blobs: return keys.Key.fromString(self.blobs.pop(0)) return None
[ "def", "getPublicKey", "(", "self", ")", ":", "if", "self", ".", "blobs", ":", "return", "keys", ".", "Key", ".", "fromString", "(", "self", ".", "blobs", ".", "pop", "(", "0", ")", ")", "return", "None" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/conch/client/agent.py#L35-L42
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/importlib/_bootstrap_external.py
python
_check_name
(method)
return _check_name_wrapper
Decorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised.
Decorator to verify that the module being requested matches the one the loader can handle.
[ "Decorator", "to", "verify", "that", "the", "module", "being", "requested", "matches", "the", "one", "the", "loader", "can", "handle", "." ]
def _check_name(method): """Decorator to verify that the module being requested matches the one the loader can handle. The first argument (self) must define _name which the second argument is compared against. If the comparison fails then ImportError is raised. """ def _check_name_wrapper(self...
[ "def", "_check_name", "(", "method", ")", ":", "def", "_check_name_wrapper", "(", "self", ",", "name", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "name", "elif", "sel...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/importlib/_bootstrap_external.py#L393-L418
google/brain-tokyo-workshop
faf12f6bbae773fbe535c7a6cf357dc662c6c1d8
AttentionAgent/misc/communication.py
python
CommunicationHelper.create_cma_request
(roll_out_index, env_seed, evaluate, parameters)
return protobuf.roll_out_service_pb2.RollOutRequest( roll_out_index=roll_out_index, env_seed=env_seed, evaluate=evaluate, cma_parameters=cma_msg, )
Create a CMA request message.
Create a CMA request message.
[ "Create", "a", "CMA", "request", "message", "." ]
def create_cma_request(roll_out_index, env_seed, evaluate, parameters): """Create a CMA request message.""" cma_msg = protobuf.roll_out_service_pb2.CMAParameters( parameters=parameters, ) return...
[ "def", "create_cma_request", "(", "roll_out_index", ",", "env_seed", ",", "evaluate", ",", "parameters", ")", ":", "cma_msg", "=", "protobuf", ".", "roll_out_service_pb2", ".", "CMAParameters", "(", "parameters", "=", "parameters", ",", ")", "return", "protobuf", ...
https://github.com/google/brain-tokyo-workshop/blob/faf12f6bbae773fbe535c7a6cf357dc662c6c1d8/AttentionAgent/misc/communication.py#L68-L82
microsoft/Oscar
4788a7425cd0f9861ea80fed79528abbb72eb169
oscar/modeling/modeling_utils.py
python
top_k_top_p_filtering
(logits, top_k=0, top_p=1.0, filter_value=-float("Inf"), min_tokens_to_keep=1)
return logits
Filter a distribution of logits using top-k and/or nucleus (top-p) filtering Args: logits: logits distribution shape (batch size, vocabulary size) if top_k > 0: keep only top k tokens with highest probability (top-k filtering). if top_p < 1.0: keep the top tokens with cumulat...
Filter a distribution of logits using top-k and/or nucleus (top-p) filtering Args: logits: logits distribution shape (batch size, vocabulary size) if top_k > 0: keep only top k tokens with highest probability (top-k filtering). if top_p < 1.0: keep the top tokens with cumulat...
[ "Filter", "a", "distribution", "of", "logits", "using", "top", "-", "k", "and", "/", "or", "nucleus", "(", "top", "-", "p", ")", "filtering", "Args", ":", "logits", ":", "logits", "distribution", "shape", "(", "batch", "size", "vocabulary", "size", ")", ...
def top_k_top_p_filtering(logits, top_k=0, top_p=1.0, filter_value=-float("Inf"), min_tokens_to_keep=1): """ Filter a distribution of logits using top-k and/or nucleus (top-p) filtering Args: logits: logits distribution shape (batch size, vocabulary size) if top_k > 0: keep only top ...
[ "def", "top_k_top_p_filtering", "(", "logits", ",", "top_k", "=", "0", ",", "top_p", "=", "1.0", ",", "filter_value", "=", "-", "float", "(", "\"Inf\"", ")", ",", "min_tokens_to_keep", "=", "1", ")", ":", "if", "top_k", ">", "0", ":", "top_k", "=", "...
https://github.com/microsoft/Oscar/blob/4788a7425cd0f9861ea80fed79528abbb72eb169/oscar/modeling/modeling_utils.py#L600-L632
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/modeling_utils.py
python
PoolerAnswerClass.__init__
(self, config)
[]
def __init__(self, config): super().__init__() self.dense_0 = nn.Linear(config.hidden_size * 2, config.hidden_size) self.activation = nn.Tanh() self.dense_1 = nn.Linear(config.hidden_size, 1, bias=False)
[ "def", "__init__", "(", "self", ",", "config", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "dense_0", "=", "nn", ".", "Linear", "(", "config", ".", "hidden_size", "*", "2", ",", "config", ".", "hidden_size", ")", "self", "....
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/modeling_utils.py#L1884-L1888
asyml/texar-pytorch
b83d3ec17e19da08fc5f81996d02f91176e55e54
texar/torch/data/tokenizers/gpt2_tokenizer.py
python
GPT2Tokenizer._map_token_to_id
(self, token: str)
return self.encoder.get(token, self.encoder.get(self.unk_token))
r"""Maps a token to an id using the vocabulary.
r"""Maps a token to an id using the vocabulary.
[ "r", "Maps", "a", "token", "to", "an", "id", "using", "the", "vocabulary", "." ]
def _map_token_to_id(self, token: str) -> int: r"""Maps a token to an id using the vocabulary.""" return self.encoder.get(token, self.encoder.get(self.unk_token))
[ "def", "_map_token_to_id", "(", "self", ",", "token", ":", "str", ")", "->", "int", ":", "return", "self", ".", "encoder", ".", "get", "(", "token", ",", "self", ".", "encoder", ".", "get", "(", "self", ".", "unk_token", ")", ")" ]
https://github.com/asyml/texar-pytorch/blob/b83d3ec17e19da08fc5f81996d02f91176e55e54/texar/torch/data/tokenizers/gpt2_tokenizer.py#L229-L231
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/dimse_primitives.py
python
C_GET.Priority
(self, value: int)
Set the *Priority*.
Set the *Priority*.
[ "Set", "the", "*", "Priority", "*", "." ]
def Priority(self, value: int) -> None: """Set the *Priority*.""" self._Priority = value
[ "def", "Priority", "(", "self", ",", "value", ":", "int", ")", "->", "None", ":", "self", ".", "_Priority", "=", "value" ]
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/dimse_primitives.py#L923-L925
Bitmessage/PyBitmessage
97612b049e0453867d6d90aa628f8e7b007b4d85
src/depends.py
python
check_pyqt
()
return passed
Do pyqt dependency check. Here we are checking for PyQt4 with its version, as for it require PyQt 4.8 or later.
Do pyqt dependency check.
[ "Do", "pyqt", "dependency", "check", "." ]
def check_pyqt(): """Do pyqt dependency check. Here we are checking for PyQt4 with its version, as for it require PyQt 4.8 or later. """ QtCore = try_import( 'PyQt4.QtCore', 'PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.') if not QtCore: return False logger....
[ "def", "check_pyqt", "(", ")", ":", "QtCore", "=", "try_import", "(", "'PyQt4.QtCore'", ",", "'PyBitmessage requires PyQt 4.8 or later and Qt 4.7 or later.'", ")", "if", "not", "QtCore", ":", "return", "False", "logger", ".", "info", "(", "'PyQt Version: %s'", ",", ...
https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/depends.py#L380-L405
dipy/dipy
be956a529465b28085f8fc435a756947ddee1c89
dipy/reconst/qtdmri.py
python
qtdmri_mapmri_isotropic_normalization
(j, l, u0)
return sqrtC
Normalization factor for Spherical MAP-MRI basis. The normalization for a basis function with orders [j,l,m] depends only on orders j,l and the isotropic scale factor.
Normalization factor for Spherical MAP-MRI basis. The normalization for a basis function with orders [j,l,m] depends only on orders j,l and the isotropic scale factor.
[ "Normalization", "factor", "for", "Spherical", "MAP", "-", "MRI", "basis", ".", "The", "normalization", "for", "a", "basis", "function", "with", "orders", "[", "j", "l", "m", "]", "depends", "only", "on", "orders", "j", "l", "and", "the", "isotropic", "s...
def qtdmri_mapmri_isotropic_normalization(j, l, u0): """Normalization factor for Spherical MAP-MRI basis. The normalization for a basis function with orders [j,l,m] depends only on orders j,l and the isotropic scale factor. """ sqrtC = ((2 * np.pi) ** (3. / 2.) * np.sqrt(2 ** l * ...
[ "def", "qtdmri_mapmri_isotropic_normalization", "(", "j", ",", "l", ",", "u0", ")", ":", "sqrtC", "=", "(", "(", "2", "*", "np", ".", "pi", ")", "**", "(", "3.", "/", "2.", ")", "*", "np", ".", "sqrt", "(", "2", "**", "l", "*", "u0", "**", "3...
https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/qtdmri.py#L1174-L1181
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/tools/interfaces/controllers/xbox.py
python
XboxControllerInterface.ABS_HAT0Y
(self)
return self.buttons['Dpad'][1]
Directional pad Y position
Directional pad Y position
[ "Directional", "pad", "Y", "position" ]
def ABS_HAT0Y(self): """Directional pad Y position""" return self.buttons['Dpad'][1]
[ "def", "ABS_HAT0Y", "(", "self", ")", ":", "return", "self", ".", "buttons", "[", "'Dpad'", "]", "[", "1", "]" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/tools/interfaces/controllers/xbox.py#L282-L284
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/textreport/placereport.py
python
PlaceOptions.__event_table_style
(self)
Define the style used for event table
Define the style used for event table
[ "Define", "the", "style", "used", "for", "event", "table" ]
def __event_table_style(self): """ Define the style used for event table """ table = TableStyle() table.set_width(100) table.set_columns(4) table.set_column_width(0, 25) table.set_column_width(1, 15) table.set_column_width(2, 35) table.set_...
[ "def", "__event_table_style", "(", "self", ")", ":", "table", "=", "TableStyle", "(", ")", "table", ".", "set_width", "(", "100", ")", "table", ".", "set_columns", "(", "4", ")", "table", ".", "set_column_width", "(", "0", ",", "25", ")", "table", ".",...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/textreport/placereport.py#L574-L592
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Nodes.py
python
ParallelStatNode.restore_labels
(self, code)
Restore all old labels. Call this before the 'else' clause to for loops and always before ending the parallel control flow block.
Restore all old labels. Call this before the 'else' clause to for loops and always before ending the parallel control flow block.
[ "Restore", "all", "old", "labels", ".", "Call", "this", "before", "the", "else", "clause", "to", "for", "loops", "and", "always", "before", "ending", "the", "parallel", "control", "flow", "block", "." ]
def restore_labels(self, code): """ Restore all old labels. Call this before the 'else' clause to for loops and always before ending the parallel control flow block. """ code.set_all_labels(self.old_loop_labels + (self.old_return_label, ...
[ "def", "restore_labels", "(", "self", ",", "code", ")", ":", "code", ".", "set_all_labels", "(", "self", ".", "old_loop_labels", "+", "(", "self", ".", "old_return_label", ",", "self", ".", "old_error_label", ")", ")" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Nodes.py#L8166-L8172
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/django/contrib/localflavor/nl/forms.py
python
NLZipCodeField.clean
(self, value)
return '%s %s' % (value[:4], value[4:])
[]
def clean(self, value): super(NLZipCodeField, self).clean(value) if value in EMPTY_VALUES: return '' value = value.strip().upper().replace(' ', '') if not pc_re.search(value): raise ValidationError(self.error_messages['invalid']) if int(value[:4]) < 1000...
[ "def", "clean", "(", "self", ",", "value", ")", ":", "super", "(", "NLZipCodeField", ",", "self", ")", ".", "clean", "(", "value", ")", "if", "value", "in", "EMPTY_VALUES", ":", "return", "''", "value", "=", "value", ".", "strip", "(", ")", ".", "u...
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/localflavor/nl/forms.py#L29-L41
declare-lab/conv-emotion
0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e
emotion-cause-extraction/RoBERTa Baseline/simpletransformers/question_answering/question_answering_utils.py
python
convert_examples_to_features
( examples, tokenizer, max_seq_length, doc_stride, max_query_length, is_training, cls_token_at_end=False, cls_token="[CLS]", sep_token="[SEP]", pad_token=0, sequence_a_segment_id=0, sequence_b_segment_id=1, cls_token_segment_id=0, pad_token_segment_id=0, mask_...
return features
Converts examples into a list of `InputBatch`s.
Converts examples into a list of `InputBatch`s.
[ "Converts", "examples", "into", "a", "list", "of", "InputBatch", "s", "." ]
def convert_examples_to_features( examples, tokenizer, max_seq_length, doc_stride, max_query_length, is_training, cls_token_at_end=False, cls_token="[CLS]", sep_token="[SEP]", pad_token=0, sequence_a_segment_id=0, sequence_b_segment_id=1, cls_token_segment_id=0, p...
[ "def", "convert_examples_to_features", "(", "examples", ",", "tokenizer", ",", "max_seq_length", ",", "doc_stride", ",", "max_query_length", ",", "is_training", ",", "cls_token_at_end", "=", "False", ",", "cls_token", "=", "\"[CLS]\"", ",", "sep_token", "=", "\"[SEP...
https://github.com/declare-lab/conv-emotion/blob/0c9dcb9cc5234a7ca8cf6af81aabe28ef3814d0e/emotion-cause-extraction/RoBERTa Baseline/simpletransformers/question_answering/question_answering_utils.py#L514-L762
JaidedAI/EasyOCR
048e8ecb52ace84fb344be6c0ca847340816dfff
easyocr/utils.py
python
reformat_input_batched
(image, n_width=None, n_height=None)
return img, img_cv_grey
reformats an image or list of images or a 4D numpy image array & returns a list of corresponding img, img_cv_grey nd.arrays image: [file path, numpy-array, byte stream object, list of file paths, list of numpy-array, 4D numpy array, list of byte stream objects]
reformats an image or list of images or a 4D numpy image array & returns a list of corresponding img, img_cv_grey nd.arrays image: [file path, numpy-array, byte stream object, list of file paths, list of numpy-array, 4D numpy array, list of byte stream objects]
[ "reformats", "an", "image", "or", "list", "of", "images", "or", "a", "4D", "numpy", "image", "array", "&", "returns", "a", "list", "of", "corresponding", "img", "img_cv_grey", "nd", ".", "arrays", "image", ":", "[", "file", "path", "numpy", "-", "array",...
def reformat_input_batched(image, n_width=None, n_height=None): """ reformats an image or list of images or a 4D numpy image array & returns a list of corresponding img, img_cv_grey nd.arrays image: [file path, numpy-array, byte stream object, list of file paths, list of numpy-array, 4D ...
[ "def", "reformat_input_batched", "(", "image", ",", "n_width", "=", "None", ",", "n_height", "=", "None", ")", ":", "if", "(", "(", "isinstance", "(", "image", ",", "np", ".", "ndarray", ")", "and", "len", "(", "image", ".", "shape", ")", "==", "4", ...
https://github.com/JaidedAI/EasyOCR/blob/048e8ecb52ace84fb344be6c0ca847340816dfff/easyocr/utils.py#L730-L756
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
samples/doodle/superdoodle.py
python
ControlPanel.OnSetThickness
(self, event)
Use the event ID to set the thickness in the doodle.
Use the event ID to set the thickness in the doodle.
[ "Use", "the", "event", "ID", "to", "set", "the", "thickness", "in", "the", "doodle", "." ]
def OnSetThickness(self, event): """ Use the event ID to set the thickness in the doodle. """ thickness = event.GetId() if thickness != self.doodle.thickness: # untoggle the old thickness button self.thknsBtns[self.doodle.thickness].SetToggle(False) ...
[ "def", "OnSetThickness", "(", "self", ",", "event", ")", ":", "thickness", "=", "event", ".", "GetId", "(", ")", "if", "thickness", "!=", "self", ".", "doodle", ".", "thickness", ":", "# untoggle the old thickness button", "self", ".", "thknsBtns", "[", "sel...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/samples/doodle/superdoodle.py#L291-L300
inspurer/WorkAttendanceSystem
1221e2d67bdf5bb15fe99517cc3ded58ccb066df
V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/vcs/git.py
python
Git.get_url
(self, location)
return url.strip()
Return URL of the first remote encountered.
Return URL of the first remote encountered.
[ "Return", "URL", "of", "the", "first", "remote", "encountered", "." ]
def get_url(self, location): """Return URL of the first remote encountered.""" remotes = self.run_command( ['config', '--get-regexp', 'remote\..*\.url'], show_stdout=False, cwd=location) remotes = remotes.splitlines() found_remote = remotes[0] for remote i...
[ "def", "get_url", "(", "self", ",", "location", ")", ":", "remotes", "=", "self", ".", "run_command", "(", "[", "'config'", ",", "'--get-regexp'", ",", "'remote\\..*\\.url'", "]", ",", "show_stdout", "=", "False", ",", "cwd", "=", "location", ")", "remotes...
https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/vcs/git.py#L155-L167
omniti-labs/pg_extractor
6a64eb018704d43a4c549505d85703807aafa6c3
pg_extractor.py
python
PGExtractor._run_pg_restore
(self, list_file, output_file)
Run pg_restore using a file that can be fed to it using the -L option. Assumes a temporary dumpfile was create via _create_temp_dump() and uses that * list_file: file containing objects obtained from pg_restore -l that will be restored * output_file: target output file that pg_restore writes t...
Run pg_restore using a file that can be fed to it using the -L option. Assumes a temporary dumpfile was create via _create_temp_dump() and uses that
[ "Run", "pg_restore", "using", "a", "file", "that", "can", "be", "fed", "to", "it", "using", "the", "-", "L", "option", ".", "Assumes", "a", "temporary", "dumpfile", "was", "create", "via", "_create_temp_dump", "()", "and", "uses", "that" ]
def _run_pg_restore(self, list_file, output_file): """ Run pg_restore using a file that can be fed to it using the -L option. Assumes a temporary dumpfile was create via _create_temp_dump() and uses that * list_file: file containing objects obtained from pg_restore -l that will be rest...
[ "def", "_run_pg_restore", "(", "self", ",", "list_file", ",", "output_file", ")", ":", "if", "self", ".", "args", ".", "debug", ":", "fh", "=", "open", "(", "list_file", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "self", ".", "_debug_print", "("...
https://github.com/omniti-labs/pg_extractor/blob/6a64eb018704d43a4c549505d85703807aafa6c3/pg_extractor.py#L1346-L1375
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
gluon/gluoncv2/models/msdnet.py
python
msdnet22
(**kwargs)
return get_msdnet(blocks=22, model_name="msdnet22", **kwargs)
MSDNet-22 model from 'Multi-Scale Dense Networks for Resource Efficient Image Classification,' https://arxiv.org/abs/1703.09844. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which ...
MSDNet-22 model from 'Multi-Scale Dense Networks for Resource Efficient Image Classification,' https://arxiv.org/abs/1703.09844.
[ "MSDNet", "-", "22", "model", "from", "Multi", "-", "Scale", "Dense", "Networks", "for", "Resource", "Efficient", "Image", "Classification", "https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", "1703", ".", "09844", "." ]
def msdnet22(**kwargs): """ MSDNet-22 model from 'Multi-Scale Dense Networks for Resource Efficient Image Classification,' https://arxiv.org/abs/1703.09844. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, defau...
[ "def", "msdnet22", "(", "*", "*", "kwargs", ")", ":", "return", "get_msdnet", "(", "blocks", "=", "22", ",", "model_name", "=", "\"msdnet22\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/gluon/gluoncv2/models/msdnet.py#L580-L594
stanfordnlp/stanza
e44d1c88340e33bf9813e6f5a6bd24387eefc4b2
stanza/utils/datasets/prepare_tokenizer_treebank.py
python
augment_move_comma
(sents, ratio=0.02)
return new_sents
Move the comma from after a word to before the next word some fraction of the time We looks for this exact pattern: w1, w2 and replace it with w1 ,w2 The idea is that this is a relatively common typo, but the tool won't learn how to tokenize it without some help. Note that this modifi...
Move the comma from after a word to before the next word some fraction of the time
[ "Move", "the", "comma", "from", "after", "a", "word", "to", "before", "the", "next", "word", "some", "fraction", "of", "the", "time" ]
def augment_move_comma(sents, ratio=0.02): """ Move the comma from after a word to before the next word some fraction of the time We looks for this exact pattern: w1, w2 and replace it with w1 ,w2 The idea is that this is a relatively common typo, but the tool won't learn how to to...
[ "def", "augment_move_comma", "(", "sents", ",", "ratio", "=", "0.02", ")", ":", "new_sents", "=", "[", "]", "num_operations", "=", "0", "for", "sentence", "in", "sents", ":", "if", "random", ".", "random", "(", ")", ">", "ratio", ":", "new_sents", ".",...
https://github.com/stanfordnlp/stanza/blob/e44d1c88340e33bf9813e6f5a6bd24387eefc4b2/stanza/utils/datasets/prepare_tokenizer_treebank.py#L385-L467
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/search_term_view_service/transports/grpc.py
python
SearchTermViewServiceGrpcTransport.create_channel
( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, )
return grpc_helpers.create_channel( host, credentials=credentials, scopes=scopes or cls.AUTH_SCOPES, **kwargs, )
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
[ "Create", "and", "return", "a", "gRPC", "channel", "object", ".", "Args", ":", "address", "(", "Optionsl", "[", "str", "]", ")", ":", "The", "host", "for", "the", "channel", "to", "use", ".", "credentials", "(", "Optional", "[", "~", ".", "Credentials"...
def create_channel( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: address (Options...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"googleads.googleapis.com\"", ",", "credentials", ":", "ga_credentials", ".", "Credentials", "=", "None", ",", "scopes", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None",...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/search_term_view_service/transports/grpc.py#L176-L204
redhat-imaging/imagefactory
176f6e045e1df049d50f33a924653128d5ab8b27
imagefactory_plugins/vSphere/VSphereHelper.py
python
VSphereHelper.curl_progress
(self, download_t, download_d, upload_t, upload_d)
[]
def curl_progress(self, download_t, download_d, upload_t, upload_d): curtime=time() # TODO: Make poke frequency variable # 5 seconds isn't too much and it makes the status bar in the vSphere GUI look nice :-) if (curtime - self.time_at_last_poke) >= 5: self.lease.HttpNfcLeas...
[ "def", "curl_progress", "(", "self", ",", "download_t", ",", "download_d", ",", "upload_t", ",", "upload_d", ")", ":", "curtime", "=", "time", "(", ")", "# TODO: Make poke frequency variable", "# 5 seconds isn't too much and it makes the status bar in the vSphere GUI look nic...
https://github.com/redhat-imaging/imagefactory/blob/176f6e045e1df049d50f33a924653128d5ab8b27/imagefactory_plugins/vSphere/VSphereHelper.py#L39-L45
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/discrete/discrete_model.py
python
MultinomialResults.summary2
(self, alpha=0.05, float_format="%.4f")
return smry
Experimental function to summarize regression results Parameters ---------- alpha : float significance level for the confidence intervals float_format : str print format for floats in parameters summary Returns ------- smry : Summary inst...
Experimental function to summarize regression results
[ "Experimental", "function", "to", "summarize", "regression", "results" ]
def summary2(self, alpha=0.05, float_format="%.4f"): """Experimental function to summarize regression results Parameters ---------- alpha : float significance level for the confidence intervals float_format : str print format for floats in parameters summ...
[ "def", "summary2", "(", "self", ",", "alpha", "=", "0.05", ",", "float_format", "=", "\"%.4f\"", ")", ":", "from", "statsmodels", ".", "iolib", "import", "summary2", "smry", "=", "summary2", ".", "Summary", "(", ")", "smry", ".", "add_dict", "(", "summar...
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/discrete/discrete_model.py#L5377-L5418
chartbeat-labs/textacy
40cd12fe953ef8be5958cff93ad8762262f3b757
src/textacy/text_stats/api.py
python
TextStats.diversity
(self, name: DiversityNameType, **kwargs)
return func(self.words, **kwargs)
Compute a measure of lexical diversity using a method with specified ``name`` , optionally specifying method variants and parameters. Higher values => higher lexical diversity. See Also: :mod:`textacy.text_stats.diversity`
Compute a measure of lexical diversity using a method with specified ``name`` , optionally specifying method variants and parameters.
[ "Compute", "a", "measure", "of", "lexical", "diversity", "using", "a", "method", "with", "specified", "name", "optionally", "specifying", "method", "variants", "and", "parameters", "." ]
def diversity(self, name: DiversityNameType, **kwargs) -> float: """ Compute a measure of lexical diversity using a method with specified ``name`` , optionally specifying method variants and parameters. Higher values => higher lexical diversity. See Also: :mod:`text...
[ "def", "diversity", "(", "self", ",", "name", ":", "DiversityNameType", ",", "*", "*", "kwargs", ")", "->", "float", ":", "# in case users prefer \"log-ttr\" or \"log ttr\"", "# to the underscored func-standard name \"log_ttr\"", "name", "=", "name", ".", "replace", "("...
https://github.com/chartbeat-labs/textacy/blob/40cd12fe953ef8be5958cff93ad8762262f3b757/src/textacy/text_stats/api.py#L310-L333
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/hqwebapp/tasks.py
python
process_bounced_emails
()
[]
def process_bounced_emails(): if settings.RETURN_PATH_EMAIL and settings.RETURN_PATH_EMAIL_PASSWORD: try: with BouncedEmailManager( delete_processed_messages=True ) as bounced_manager, metrics_track_errors('process_bounced_emails_task'): bounced_manage...
[ "def", "process_bounced_emails", "(", ")", ":", "if", "settings", ".", "RETURN_PATH_EMAIL", "and", "settings", ".", "RETURN_PATH_EMAIL_PASSWORD", ":", "try", ":", "with", "BouncedEmailManager", "(", "delete_processed_messages", "=", "True", ")", "as", "bounced_manager...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqwebapp/tasks.py#L190-L204
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/enumerated.py
python
SET.__init__
(self, *values, **kw)
Construct a SET. E.g.:: Column('myset', SET("foo", "bar", "baz")) The list of potential values is required in the case that this set will be used to generate DDL for a table, or if the :paramref:`.SET.retrieve_as_bitwise` flag is set to True. :param values: The ran...
Construct a SET.
[ "Construct", "a", "SET", "." ]
def __init__(self, *values, **kw): """Construct a SET. E.g.:: Column('myset', SET("foo", "bar", "baz")) The list of potential values is required in the case that this set will be used to generate DDL for a table, or if the :paramref:`.SET.retrieve_as_bitwise` flag i...
[ "def", "__init__", "(", "self", ",", "*", "values", ",", "*", "*", "kw", ")", ":", "self", ".", "retrieve_as_bitwise", "=", "kw", ".", "pop", "(", "'retrieve_as_bitwise'", ",", "False", ")", "values", ",", "length", "=", "self", ".", "_init_values", "(...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/enumerated.py#L156-L236
ANCIR/grano
cee2ec1974df5df2bc6ed5e214f6bd5d201397a4
grano/views/filters.py
python
property_filters
(cls, q, alias)
return q
Parse the query arguments and apply any specified property filters to the given query ``q``. The property-holding object (a relation or entity) is given as ``cls``.
Parse the query arguments and apply any specified property filters to the given query ``q``. The property-holding object (a relation or entity) is given as ``cls``.
[ "Parse", "the", "query", "arguments", "and", "apply", "any", "specified", "property", "filters", "to", "the", "given", "query", "q", ".", "The", "property", "-", "holding", "object", "(", "a", "relation", "or", "entity", ")", "is", "given", "as", "cls", ...
def property_filters(cls, q, alias): """ Parse the query arguments and apply any specified property filters to the given query ``q``. The property-holding object (a relation or entity) is given as ``cls``. """ for key in request.args.keys(): if not key.startswith(PROPERTY): continue ...
[ "def", "property_filters", "(", "cls", ",", "q", ",", "alias", ")", ":", "for", "key", "in", "request", ".", "args", ".", "keys", "(", ")", ":", "if", "not", "key", ".", "startswith", "(", "PROPERTY", ")", ":", "continue", "prop", "=", "key", "[", ...
https://github.com/ANCIR/grano/blob/cee2ec1974df5df2bc6ed5e214f6bd5d201397a4/grano/views/filters.py#L15-L33
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/diffgeom/diffgeom.py
python
CoordSystem.coord_function
(self, coord_index)
return BaseScalarField(self, coord_index)
Return a ``BaseScalarField`` that takes a point and returns one of the coords. Takes a point and returns its coordinate in this coordinate system. See the docstring of ``CoordSystem`` for examples.
Return a ``BaseScalarField`` that takes a point and returns one of the coords.
[ "Return", "a", "BaseScalarField", "that", "takes", "a", "point", "and", "returns", "one", "of", "the", "coords", "." ]
def coord_function(self, coord_index): """Return a ``BaseScalarField`` that takes a point and returns one of the coords. Takes a point and returns its coordinate in this coordinate system. See the docstring of ``CoordSystem`` for examples.""" return BaseScalarField(self, coord_index)
[ "def", "coord_function", "(", "self", ",", "coord_index", ")", ":", "return", "BaseScalarField", "(", "self", ",", "coord_index", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/diffgeom/diffgeom.py#L279-L285
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/CPython/27/Lib/ntpath.py
python
join
(a, *p)
return path
Join two or more pathname components, inserting "\\" as needed. If any component is an absolute path, all previous path components will be discarded.
Join two or more pathname components, inserting "\\" as needed. If any component is an absolute path, all previous path components will be discarded.
[ "Join", "two", "or", "more", "pathname", "components", "inserting", "\\\\", "as", "needed", ".", "If", "any", "component", "is", "an", "absolute", "path", "all", "previous", "path", "components", "will", "be", "discarded", "." ]
def join(a, *p): """Join two or more pathname components, inserting "\\" as needed. If any component is an absolute path, all previous path components will be discarded.""" path = a for b in p: b_wins = 0 # set to 1 iff b makes path irrelevant if path == "": b_wins = 1 ...
[ "def", "join", "(", "a", ",", "*", "p", ")", ":", "path", "=", "a", "for", "b", "in", "p", ":", "b_wins", "=", "0", "# set to 1 iff b makes path irrelevant", "if", "path", "==", "\"\"", ":", "b_wins", "=", "1", "elif", "isabs", "(", "b", ")", ":", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/ntpath.py#L63-L116
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/jupyter_client/threaded.py
python
ThreadedZMQSocketChannel.flush
(self, timeout=1.0)
Immediately processes all pending messages on this channel. This is only used for the IOPub channel. Callers should use this method to ensure that :meth:`call_handlers` has been called for all messages that have been received on the 0MQ SUB socket of this channel. This method ...
Immediately processes all pending messages on this channel.
[ "Immediately", "processes", "all", "pending", "messages", "on", "this", "channel", "." ]
def flush(self, timeout=1.0): """Immediately processes all pending messages on this channel. This is only used for the IOPub channel. Callers should use this method to ensure that :meth:`call_handlers` has been called for all messages that have been received on the 0MQ SUB sock...
[ "def", "flush", "(", "self", ",", "timeout", "=", "1.0", ")", ":", "# We do the IOLoop callback process twice to ensure that the IOLoop", "# gets to perform at least one full poll.", "stop_time", "=", "time", ".", "time", "(", ")", "+", "timeout", "for", "i", "in", "r...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/jupyter_client/threaded.py#L116-L140
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/analysis/elasticity/elastic.py
python
ElasticTensorExpansion.get_compliance_expansion
(self)
return TensorCollection(ce_exp)
Gets a compliance tensor expansion from the elastic tensor expansion.
Gets a compliance tensor expansion from the elastic tensor expansion.
[ "Gets", "a", "compliance", "tensor", "expansion", "from", "the", "elastic", "tensor", "expansion", "." ]
def get_compliance_expansion(self): """ Gets a compliance tensor expansion from the elastic tensor expansion. """ # TODO: this might have a general form if not self.order <= 4: raise ValueError("Compliance tensor expansion only supported for fourth-order and l...
[ "def", "get_compliance_expansion", "(", "self", ")", ":", "# TODO: this might have a general form", "if", "not", "self", ".", "order", "<=", "4", ":", "raise", "ValueError", "(", "\"Compliance tensor expansion only supported for fourth-order and lower\"", ")", "ce_exp", "="...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/elasticity/elastic.py#L762-L785
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/corpus/reader/verbnet.py
python
VerbnetCorpusReader._pprint_single_frame
(self, vnframe, indent="")
return frame_string
Returns pretty printed version of a single frame in a VerbNet class Returns a string containing a pretty-printed representation of the given frame. :param vnframe: An ElementTree containing the xml contents of a VerbNet frame.
Returns pretty printed version of a single frame in a VerbNet class
[ "Returns", "pretty", "printed", "version", "of", "a", "single", "frame", "in", "a", "VerbNet", "class" ]
def _pprint_single_frame(self, vnframe, indent=""): """Returns pretty printed version of a single frame in a VerbNet class Returns a string containing a pretty-printed representation of the given frame. :param vnframe: An ElementTree containing the xml contents of a VerbNet...
[ "def", "_pprint_single_frame", "(", "self", ",", "vnframe", ",", "indent", "=", "\"\"", ")", ":", "frame_string", "=", "self", ".", "_pprint_description_within_frame", "(", "vnframe", ",", "indent", ")", "+", "\"\\n\"", "frame_string", "+=", "self", ".", "_ppr...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/corpus/reader/verbnet.py#L538-L554
JDAI-CV/fast-reid
31d99b793fe0937461b9c9bc8a8a11f88bf5642c
fastreid/modeling/backbones/repvgg.py
python
RepVGGBlock.__init__
(self, in_channels, out_channels, norm_type, kernel_size, stride=1, padding=0, groups=1)
[]
def __init__(self, in_channels, out_channels, norm_type, kernel_size, stride=1, padding=0, groups=1): super(RepVGGBlock, self).__init__() self.deploying = False self.groups = groups self.in_channels = in_channels assert kernel_size == 3 assert padding =...
[ "def", "__init__", "(", "self", ",", "in_channels", ",", "out_channels", ",", "norm_type", ",", "kernel_size", ",", "stride", "=", "1", ",", "padding", "=", "0", ",", "groups", "=", "1", ")", ":", "super", "(", "RepVGGBlock", ",", "self", ")", ".", "...
https://github.com/JDAI-CV/fast-reid/blob/31d99b793fe0937461b9c9bc8a8a11f88bf5642c/fastreid/modeling/backbones/repvgg.py#L40-L69
openmc-dev/openmc
0cf7d9283786677e324bfbdd0984a54d1c86dacc
openmc/lib/material.py
python
Material._get_densities
(self)
return nuclide_list, density_array
Get atom densities in a material. Returns ------- list of string List of nuclide names numpy.ndarray Array of densities in atom/b-cm
Get atom densities in a material.
[ "Get", "atom", "densities", "in", "a", "material", "." ]
def _get_densities(self): """Get atom densities in a material. Returns ------- list of string List of nuclide names numpy.ndarray Array of densities in atom/b-cm """ # Allocate memory for arguments that are written to nuclides = P...
[ "def", "_get_densities", "(", "self", ")", ":", "# Allocate memory for arguments that are written to", "nuclides", "=", "POINTER", "(", "c_int", ")", "(", ")", "densities", "=", "POINTER", "(", "c_double", ")", "(", ")", "n", "=", "c_int", "(", ")", "# Get nuc...
https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/lib/material.py#L180-L202
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/Hash_ID.py
python
md5saltpass
()
[]
def md5saltpass(): hs='22cc5ce1a1ef747cd3fa06106c148dfa' if len(hash)==len(hs) and hash.isdigit()==False and hash.isalpha()==False and hash.isalnum()==True: jerar.append("106280")
[ "def", "md5saltpass", "(", ")", ":", "hs", "=", "'22cc5ce1a1ef747cd3fa06106c148dfa'", "if", "len", "(", "hash", ")", "==", "len", "(", "hs", ")", "and", "hash", ".", "isdigit", "(", ")", "==", "False", "and", "hash", ".", "isalpha", "(", ")", "==", "...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/Hash_ID.py#L153-L156
crazydonkey200/neural-symbolic-machines
a03ff05228cfebcc818b6a901c4d7b0ed459fa7c
nsm/computer_factory.py
python
LispInterpreter.add_constant
(self, value, type, name=None)
return name
Generate the code and variables to hold the constants.
Generate the code and variables to hold the constants.
[ "Generate", "the", "code", "and", "variables", "to", "hold", "the", "constants", "." ]
def add_constant(self, value, type, name=None): """Generate the code and variables to hold the constants.""" if name is None: name = self.namespace.generate_new_name() self.namespace[name] = dict( value=value, type=type, is_constant=True) return name
[ "def", "add_constant", "(", "self", ",", "value", ",", "type", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "namespace", ".", "generate_new_name", "(", ")", "self", ".", "namespace", "[", "name", "]",...
https://github.com/crazydonkey200/neural-symbolic-machines/blob/a03ff05228cfebcc818b6a901c4d7b0ed459fa7c/nsm/computer_factory.py#L64-L71
pwnieexpress/pwn_plug_sources
1a23324f5dc2c3de20f9c810269b6a29b2758cad
src/metagoofil/hachoir_core/field/helper.py
python
createRawField
(parent, size, name="raw[]", description=None)
[]
def createRawField(parent, size, name="raw[]", description=None): if size <= 0: raise FieldError("Unable to create raw field of %s bits" % size) if (size % 8) == 0: return RawBytes(parent, name, size/8, description) else: return RawBits(parent, name, size, description)
[ "def", "createRawField", "(", "parent", ",", "size", ",", "name", "=", "\"raw[]\"", ",", "description", "=", "None", ")", ":", "if", "size", "<=", "0", ":", "raise", "FieldError", "(", "\"Unable to create raw field of %s bits\"", "%", "size", ")", "if", "(",...
https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/metagoofil/hachoir_core/field/helper.py#L8-L14
iclavera/learning_to_adapt
bd7d99ba402521c96631e7d09714128f549db0f1
learning_to_adapt/mujoco_py/glfw.py
python
_glfw_get_version
(filename)
Queries and returns the library version tuple or None by using a subprocess.
Queries and returns the library version tuple or None by using a subprocess.
[ "Queries", "and", "returns", "the", "library", "version", "tuple", "or", "None", "by", "using", "a", "subprocess", "." ]
def _glfw_get_version(filename): ''' Queries and returns the library version tuple or None by using a subprocess. ''' version_checker_source = """ import sys import ctypes def get_version(library_handle): ''' Queries and returns the library version tu...
[ "def", "_glfw_get_version", "(", "filename", ")", ":", "version_checker_source", "=", "\"\"\"\n import sys\n import ctypes\n\n def get_version(library_handle):\n '''\n Queries and returns the library version tuple or None.\n '''\n majo...
https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/glfw.py#L80-L131
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_serviceaccount.py
python
OpenShiftCLI._run
(self, cmds, input_data)
return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8')
Actually executes the command. This makes mocking easier.
Actually executes the command. This makes mocking easier.
[ "Actually", "executes", "the", "command", ".", "This", "makes", "mocking", "easier", "." ]
def _run(self, cmds, input_data): ''' Actually executes the command. This makes mocking easier. ''' curr_env = os.environ.copy() curr_env.update({'KUBECONFIG': self.kubeconfig}) proc = subprocess.Popen(cmds, stdin=subprocess.PIPE, ...
[ "def", "_run", "(", "self", ",", "cmds", ",", "input_data", ")", ":", "curr_env", "=", "os", ".", "environ", ".", "copy", "(", ")", "curr_env", ".", "update", "(", "{", "'KUBECONFIG'", ":", "self", ".", "kubeconfig", "}", ")", "proc", "=", "subproces...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_serviceaccount.py#L1093-L1105
markj3d/Red9_StudioPack
1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919
core/Red9_PoseSaver.py
python
PosePointCloud.syncdatafromCurrentInstance
(self)
pull existing data back from the metaNode
pull existing data back from the metaNode
[ "pull", "existing", "data", "back", "from", "the", "metaNode" ]
def syncdatafromCurrentInstance(self): ''' pull existing data back from the metaNode ''' if self.getCurrentInstances(): self.ppcMeta = self.getCurrentInstances()[0] self.posePointCloudNodes = self.ppcMeta.posePointCloudNodes self.posePointRoot = self.p...
[ "def", "syncdatafromCurrentInstance", "(", "self", ")", ":", "if", "self", ".", "getCurrentInstances", "(", ")", ":", "self", ".", "ppcMeta", "=", "self", ".", "getCurrentInstances", "(", ")", "[", "0", "]", "self", ".", "posePointCloudNodes", "=", "self", ...
https://github.com/markj3d/Red9_StudioPack/blob/1d40a8bf84c45ce7eaefdd9ccfa3cdbeb1471919/core/Red9_PoseSaver.py#L1580-L1588
playframework/play1
0ecac3bc2421ae2dbec27a368bf671eda1c9cba5
python/Lib/numbers.py
python
Integral.numerator
(self)
return +self
Integers are their own numerators.
Integers are their own numerators.
[ "Integers", "are", "their", "own", "numerators", "." ]
def numerator(self): """Integers are their own numerators.""" return +self
[ "def", "numerator", "(", "self", ")", ":", "return", "+", "self" ]
https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/numbers.py#L381-L383
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/apigateway/v20180808/apigateway_client.py
python
ApigatewayClient.DescribeLogSearch
(self, request)
本接口DescribeLogSearch用于搜索日志 :param request: Request instance for DescribeLogSearch. :type request: :class:`tencentcloud.apigateway.v20180808.models.DescribeLogSearchRequest` :rtype: :class:`tencentcloud.apigateway.v20180808.models.DescribeLogSearchResponse`
本接口DescribeLogSearch用于搜索日志
[ "本接口DescribeLogSearch用于搜索日志" ]
def DescribeLogSearch(self, request): """本接口DescribeLogSearch用于搜索日志 :param request: Request instance for DescribeLogSearch. :type request: :class:`tencentcloud.apigateway.v20180808.models.DescribeLogSearchRequest` :rtype: :class:`tencentcloud.apigateway.v20180808.models.DescribeLogSearc...
[ "def", "DescribeLogSearch", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeLogSearch\"", ",", "params", ")", "response", "=", "json", ".", "loads...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/apigateway/v20180808/apigateway_client.py#L1273-L1298
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/celery/result.py
python
result_from_tuple
(r, app=None)
return r
Deserialize result from tuple.
Deserialize result from tuple.
[ "Deserialize", "result", "from", "tuple", "." ]
def result_from_tuple(r, app=None): """Deserialize result from tuple.""" # earlier backends may just pickle, so check if # result is already prepared. app = app_or_default(app) Result = app.AsyncResult if not isinstance(r, ResultBase): res, nodes = r if nodes: return ...
[ "def", "result_from_tuple", "(", "r", ",", "app", "=", "None", ")", ":", "# earlier backends may just pickle, so check if", "# result is already prepared.", "app", "=", "app_or_default", "(", "app", ")", "Result", "=", "app", ".", "AsyncResult", "if", "not", "isinst...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/result.py#L959-L976
joe-siyuan-qiao/DetectoRS
612916ba89ad6452b07ae52d3a6ec8d34a792608
mmdet/core/fp16/decorators.py
python
force_fp32
(apply_to=None, out_fp16=False)
return force_fp32_wrapper
Decorator to convert input arguments to fp32 in force. This decorator is useful when you write custom modules and want to support mixed precision training. If there are some inputs that must be processed in fp32 mode, then this decorator can handle it. If inputs arguments are fp16 tensors, they will be...
Decorator to convert input arguments to fp32 in force.
[ "Decorator", "to", "convert", "input", "arguments", "to", "fp32", "in", "force", "." ]
def force_fp32(apply_to=None, out_fp16=False): """Decorator to convert input arguments to fp32 in force. This decorator is useful when you write custom modules and want to support mixed precision training. If there are some inputs that must be processed in fp32 mode, then this decorator can handle it. ...
[ "def", "force_fp32", "(", "apply_to", "=", "None", ",", "out_fp16", "=", "False", ")", ":", "def", "force_fp32_wrapper", "(", "old_func", ")", ":", "@", "functools", ".", "wraps", "(", "old_func", ")", "def", "new_func", "(", "*", "args", ",", "*", "*"...
https://github.com/joe-siyuan-qiao/DetectoRS/blob/612916ba89ad6452b07ae52d3a6ec8d34a792608/mmdet/core/fp16/decorators.py#L86-L160
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/postgres/v20170312/models.py
python
CreateServerlessDBInstanceRequest.__init__
(self)
r""" :param Zone: 可用区ID。公测阶段仅支持ap-shanghai-2、ap-beijing-1,ap-guangzhou-2. :type Zone: str :param DBInstanceName: DB实例名称,同一个账号下该值必须唯一。 :type DBInstanceName: str :param DBVersion: PostgreSQL内核版本,目前只支持:10.4。 :type DBVersion: str :param DBCharset: PostgreSQL数据库字符集,目前支...
r""" :param Zone: 可用区ID。公测阶段仅支持ap-shanghai-2、ap-beijing-1,ap-guangzhou-2. :type Zone: str :param DBInstanceName: DB实例名称,同一个账号下该值必须唯一。 :type DBInstanceName: str :param DBVersion: PostgreSQL内核版本,目前只支持:10.4。 :type DBVersion: str :param DBCharset: PostgreSQL数据库字符集,目前支...
[ "r", ":", "param", "Zone", ":", "可用区ID。公测阶段仅支持ap", "-", "shanghai", "-", "2、ap", "-", "beijing", "-", "1", "ap", "-", "guangzhou", "-", "2", ".", ":", "type", "Zone", ":", "str", ":", "param", "DBInstanceName", ":", "DB实例名称,同一个账号下该值必须唯一。", ":", "type", ...
def __init__(self): r""" :param Zone: 可用区ID。公测阶段仅支持ap-shanghai-2、ap-beijing-1,ap-guangzhou-2. :type Zone: str :param DBInstanceName: DB实例名称,同一个账号下该值必须唯一。 :type DBInstanceName: str :param DBVersion: PostgreSQL内核版本,目前只支持:10.4。 :type DBVersion: str :param DBC...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Zone", "=", "None", "self", ".", "DBInstanceName", "=", "None", "self", ".", "DBVersion", "=", "None", "self", ".", "DBCharset", "=", "None", "self", ".", "ProjectId", "=", "None", "self", ".", ...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/postgres/v20170312/models.py#L795-L821
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/email/message.py
python
Message.get_content_charset
(self, failobj=None)
return charset.lower()
Return the charset parameter of the Content-Type header. The returned string is always coerced to lower case. If there is no Content-Type header, or if that header has no charset parameter, failobj is returned.
Return the charset parameter of the Content-Type header.
[ "Return", "the", "charset", "parameter", "of", "the", "Content", "-", "Type", "header", "." ]
def get_content_charset(self, failobj=None): """Return the charset parameter of the Content-Type header. The returned string is always coerced to lower case. If there is no Content-Type header, or if that header has no charset parameter, failobj is returned. """ missing...
[ "def", "get_content_charset", "(", "self", ",", "failobj", "=", "None", ")", ":", "missing", "=", "object", "(", ")", "charset", "=", "self", ".", "get_param", "(", "'charset'", ",", "missing", ")", "if", "charset", "is", "missing", ":", "return", "failo...
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/email/message.py#L882-L910
PYFTS/pyFTS
ad3e857024d0da068feb0d7eae214b55a038a9ca
pyFTS/common/Util.py
python
plot_distribution
(ax, cmap, probabilitydist, fig, time_from, reference_data=None)
Plot forecasted ProbabilityDistribution objects on a matplotlib axis :param ax: matplotlib axis :param cmap: matplotlib colormap name :param probabilitydist: list of ProbabilityDistribution objects :param fig: matplotlib figure :param time_from: starting time (on x axis) to begin the plots :par...
Plot forecasted ProbabilityDistribution objects on a matplotlib axis
[ "Plot", "forecasted", "ProbabilityDistribution", "objects", "on", "a", "matplotlib", "axis" ]
def plot_distribution(ax, cmap, probabilitydist, fig, time_from, reference_data=None): """ Plot forecasted ProbabilityDistribution objects on a matplotlib axis :param ax: matplotlib axis :param cmap: matplotlib colormap name :param probabilitydist: list of ProbabilityDistribution objects :param...
[ "def", "plot_distribution", "(", "ax", ",", "cmap", ",", "probabilitydist", ",", "fig", ",", "time_from", ",", "reference_data", "=", "None", ")", ":", "from", "matplotlib", ".", "patches", "import", "Rectangle", "from", "matplotlib", ".", "collections", "impo...
https://github.com/PYFTS/pyFTS/blob/ad3e857024d0da068feb0d7eae214b55a038a9ca/pyFTS/common/Util.py#L127-L160
log2timeline/dftimewolf
18b4d0760d6a6ca378ac06c2242d04a0d8caf072
dftimewolf/lib/processors/turbinia_gcp_tam.py
python
TurbiniaGCPProcessorThreaded.Process
(self, disk_container: containers.GCEDisk)
Process a disk with Turbinia. Args: disk_container: Container referencing a GCE Disk.
Process a disk with Turbinia.
[ "Process", "a", "disk", "with", "Turbinia", "." ]
def Process(self, disk_container: containers.GCEDisk) -> None: """Process a disk with Turbinia. Args: disk_container: Container referencing a GCE Disk.""" log_file_path = os.path.join(self._output_path, 'turbinia-{0:s}.log'\ .format(disk_container.name)) print('Turbinia log file: {0:s}'.f...
[ "def", "Process", "(", "self", ",", "disk_container", ":", "containers", ".", "GCEDisk", ")", "->", "None", ":", "log_file_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_output_path", ",", "'turbinia-{0:s}.log'", ".", "format", "(", "disk_...
https://github.com/log2timeline/dftimewolf/blob/18b4d0760d6a6ca378ac06c2242d04a0d8caf072/dftimewolf/lib/processors/turbinia_gcp_tam.py#L307-L354
ming71/mmdetection-annotated
dc25243ea11d9c4cfd517d7c08dfa2fd61e01895
mmdet/datasets/utils.py
python
random_scale
(img_scales, mode='range')
return img_scale
Randomly select a scale from a list of scales or scale ranges. Args: img_scales (list[tuple]): Image scale or scale range. mode (str): "range" or "value". Returns: tuple: Sampled image scale.
Randomly select a scale from a list of scales or scale ranges.
[ "Randomly", "select", "a", "scale", "from", "a", "list", "of", "scales", "or", "scale", "ranges", "." ]
def random_scale(img_scales, mode='range'): """Randomly select a scale from a list of scales or scale ranges. Args: img_scales (list[tuple]): Image scale or scale range. mode (str): "range" or "value". Returns: tuple: Sampled image scale. """ num_scales = len(img_scales) ...
[ "def", "random_scale", "(", "img_scales", ",", "mode", "=", "'range'", ")", ":", "num_scales", "=", "len", "(", "img_scales", ")", "if", "num_scales", "==", "1", ":", "# fixed scale is specified", "img_scale", "=", "img_scales", "[", "0", "]", "elif", "num_s...
https://github.com/ming71/mmdetection-annotated/blob/dc25243ea11d9c4cfd517d7c08dfa2fd61e01895/mmdet/datasets/utils.py#L30-L61
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py
python
pprint
(walker)
return "\n".join(output)
Pretty printer for tree walkers
Pretty printer for tree walkers
[ "Pretty", "printer", "for", "tree", "walkers" ]
def pprint(walker): """Pretty printer for tree walkers""" output = [] indent = 0 for token in concatenateCharacterTokens(walker): type = token["type"] if type in ("StartTag", "EmptyTag"): # tag name if token["namespace"] and token["namespace"] != constants.namespa...
[ "def", "pprint", "(", "walker", ")", ":", "output", "=", "[", "]", "indent", "=", "0", "for", "token", "in", "concatenateCharacterTokens", "(", "walker", ")", ":", "type", "=", "token", "[", "\"type\"", "]", "if", "type", "in", "(", "\"StartTag\"", ","...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/html5lib/treewalkers/__init__.py#L75-L143
scipy/scipy
e0a749f01e79046642ccfdc419edbf9e7ca141ad
scipy/stats/_multivariate.py
python
wishart_gen.logpdf
(self, x, df, scale)
return _squeeze_output(out)
Log of the Wishart probability density function. Parameters ---------- x : array_like Quantiles, with the last axis of `x` denoting the components. Each quantile must be a symmetric positive definite matrix. %(_doc_default_callparams)s Returns --...
Log of the Wishart probability density function.
[ "Log", "of", "the", "Wishart", "probability", "density", "function", "." ]
def logpdf(self, x, df, scale): """Log of the Wishart probability density function. Parameters ---------- x : array_like Quantiles, with the last axis of `x` denoting the components. Each quantile must be a symmetric positive definite matrix. %(_doc_defau...
[ "def", "logpdf", "(", "self", ",", "x", ",", "df", ",", "scale", ")", ":", "dim", ",", "df", ",", "scale", "=", "self", ".", "_process_parameters", "(", "df", ",", "scale", ")", "x", "=", "self", ".", "_process_quantiles", "(", "x", ",", "dim", "...
https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/stats/_multivariate.py#L1862-L1889
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/email/_policybase.py
python
Policy.handle_defect
(self, obj, defect)
Based on policy, either raise defect or call register_defect. handle_defect(obj, defect) defect should be a Defect subclass, but in any case must be an Exception subclass. obj is the object on which the defect should be registered if it is not raised. If the raise_on_defect is Tr...
Based on policy, either raise defect or call register_defect.
[ "Based", "on", "policy", "either", "raise", "defect", "or", "call", "register_defect", "." ]
def handle_defect(self, obj, defect): """Based on policy, either raise defect or call register_defect. handle_defect(obj, defect) defect should be a Defect subclass, but in any case must be an Exception subclass. obj is the object on which the defect should be registered i...
[ "def", "handle_defect", "(", "self", ",", "obj", ",", "defect", ")", ":", "if", "self", ".", "raise_on_defect", ":", "raise", "defect", "self", ".", "register_defect", "(", "obj", ",", "defect", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/email/_policybase.py#L159-L176
Trusted-AI/adversarial-robustness-toolbox
9fabffdbb92947efa1ecc5d825d634d30dfbaf29
examples/inverse_gan_author_utils.py
python
AbstractModel.get_learning_rate
( self, init_lr=None, decay_epoch=None, decay_mult=None, iters_per_epoch=None, decay_iter=None, global_step=None, decay_lr=True, )
Prepares the learning rate. Args: init_lr: The initial learning rate decay_epoch: The epoch of decay decay_mult: The decay factor iters_per_epoch: Number of iterations per epoch decay_iter: The iteration of decay [either this or decay_epoch ...
Prepares the learning rate.
[ "Prepares", "the", "learning", "rate", "." ]
def get_learning_rate( self, init_lr=None, decay_epoch=None, decay_mult=None, iters_per_epoch=None, decay_iter=None, global_step=None, decay_lr=True, ): """Prepares the learning rate. Args: init_lr: The initial learning rat...
[ "def", "get_learning_rate", "(", "self", ",", "init_lr", "=", "None", ",", "decay_epoch", "=", "None", ",", "decay_mult", "=", "None", ",", "iters_per_epoch", "=", "None", ",", "decay_iter", "=", "None", ",", "global_step", "=", "None", ",", "decay_lr", "=...
https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/9fabffdbb92947efa1ecc5d825d634d30dfbaf29/examples/inverse_gan_author_utils.py#L661-L704
regel/loudml
0008baef02259a8ae81dd210d3f91a51ffc9ed9f
loudml/bucket.py
python
Bucket.save_timeseries_prediction
(self, prediction, tags=None)
Save time-series prediction to the bucket
Save time-series prediction to the bucket
[ "Save", "time", "-", "series", "prediction", "to", "the", "bucket" ]
def save_timeseries_prediction(self, prediction, tags=None): """ Save time-series prediction to the bucket """ for bucket in prediction.format_buckets(): data = bucket['predicted'] data.update({ '@{}'.format(key): val for key, val i...
[ "def", "save_timeseries_prediction", "(", "self", ",", "prediction", ",", "tags", "=", "None", ")", ":", "for", "bucket", "in", "prediction", ".", "format_buckets", "(", ")", ":", "data", "=", "bucket", "[", "'predicted'", "]", "data", ".", "update", "(", ...
https://github.com/regel/loudml/blob/0008baef02259a8ae81dd210d3f91a51ffc9ed9f/loudml/bucket.py#L232-L253
google/trax
d6cae2067dedd0490b78d831033607357e975015
trax/data/text_encoder.py
python
BertBasicEncoder._run_strip_accents
(self, text)
return "".join(output)
Strips accents from a piece of text.
Strips accents from a piece of text.
[ "Strips", "accents", "from", "a", "piece", "of", "text", "." ]
def _run_strip_accents(self, text): """Strips accents from a piece of text.""" text = unicodedata.normalize("NFD", text) output = [] for char in text: cat = unicodedata.category(char) if cat == "Mn": continue output.append(char) return "".join(output)
[ "def", "_run_strip_accents", "(", "self", ",", "text", ")", ":", "text", "=", "unicodedata", ".", "normalize", "(", "\"NFD\"", ",", "text", ")", "output", "=", "[", "]", "for", "char", "in", "text", ":", "cat", "=", "unicodedata", ".", "category", "(",...
https://github.com/google/trax/blob/d6cae2067dedd0490b78d831033607357e975015/trax/data/text_encoder.py#L1152-L1161
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/sun/__init__.py
python
SunPlugin.get_events
(self, latitude: Optional[float] = None, longitude: Optional[float] = None)
return schema.dump({ attr: self._convert_time(t) for attr, t in response.items() if attr in schema.declared_fields.keys() })
Return the next sun events. :param latitude: Default latitude override. :param longitude: Default longitude override. :return: .. schema:: sun.SunEventsSchema
Return the next sun events.
[ "Return", "the", "next", "sun", "events", "." ]
def get_events(self, latitude: Optional[float] = None, longitude: Optional[float] = None) -> dict: """ Return the next sun events. :param latitude: Default latitude override. :param longitude: Default longitude override. :return: .. schema:: sun.SunEventsSchema """ ...
[ "def", "get_events", "(", "self", ",", "latitude", ":", "Optional", "[", "float", "]", "=", "None", ",", "longitude", ":", "Optional", "[", "float", "]", "=", "None", ")", "->", "dict", ":", "response", "=", "requests", ".", "get", "(", "self", ".", ...
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/sun/__init__.py#L69-L87
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/dynamic_search_ads_search_term_view_service/client.py
python
DynamicSearchAdsSearchTermViewServiceClient.parse_common_location_path
(path: str)
return m.groupdict() if m else {}
Parse a location path into its component segments.
Parse a location path into its component segments.
[ "Parse", "a", "location", "path", "into", "its", "component", "segments", "." ]
def parse_common_location_path(path: str) -> Dict[str, str]: """Parse a location path into its component segments.""" m = re.match( r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$", path ) return m.groupdict() if m else {}
[ "def", "parse_common_location_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^projects/(?P<project>.+?)/locations/(?P<location>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdi...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/dynamic_search_ads_search_term_view_service/client.py#L269-L274
openai/mlsh
2ae2393db0949c087883ca162ff84591a47fbe5d
gym/misc/check_envs_for_change.py
python
cap
(cmd)
Call and print command
Call and print command
[ "Call", "and", "print", "command" ]
def cap(cmd): "Call and print command" print utils.colorize(cmd, "green") subprocess.check_call(cmd,shell=True)
[ "def", "cap", "(", "cmd", ")", ":", "print", "utils", ".", "colorize", "(", "cmd", ",", "\"green\"", ")", "subprocess", ".", "check_call", "(", "cmd", ",", "shell", "=", "True", ")" ]
https://github.com/openai/mlsh/blob/2ae2393db0949c087883ca162ff84591a47fbe5d/gym/misc/check_envs_for_change.py#L10-L13
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/skeinforge_application/skeinforge_utilities/skeinforge_craft.py
python
getCraftPreferences
(pluginName)
return settings.getReadRepository(getCraftModule(pluginName).getNewRepository()).preferences
Get craft preferences.
Get craft preferences.
[ "Get", "craft", "preferences", "." ]
def getCraftPreferences(pluginName): 'Get craft preferences.' return settings.getReadRepository(getCraftModule(pluginName).getNewRepository()).preferences
[ "def", "getCraftPreferences", "(", "pluginName", ")", ":", "return", "settings", ".", "getReadRepository", "(", "getCraftModule", "(", "pluginName", ")", ".", "getNewRepository", "(", ")", ")", ".", "preferences" ]
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_utilities/skeinforge_craft.py#L58-L60
GNS3/gns3-server
aff06572d4173df945ad29ea8feb274f7885d9e4
gns3server/compute/dynamips/hypervisor.py
python
Hypervisor.id
(self)
return self._id
Returns the unique ID for this hypervisor. :returns: id (integer)
Returns the unique ID for this hypervisor.
[ "Returns", "the", "unique", "ID", "for", "this", "hypervisor", "." ]
def id(self): """ Returns the unique ID for this hypervisor. :returns: id (integer) """ return self._id
[ "def", "id", "(", "self", ")", ":", "return", "self", ".", "_id" ]
https://github.com/GNS3/gns3-server/blob/aff06572d4173df945ad29ea8feb274f7885d9e4/gns3server/compute/dynamips/hypervisor.py#L65-L72
naszilla/bananas
e2c12ade9e290e309e206fc3c8f97a373a136a81
nas_bench_201/cell.py
python
Cell.random_cell
(cls, nasbench, max_nodes=4)
return {'string':cls.get_string_from_ops(ops)}
From the AutoDL-Projects repository
From the AutoDL-Projects repository
[ "From", "the", "AutoDL", "-", "Projects", "repository" ]
def random_cell(cls, nasbench, max_nodes=4): """ From the AutoDL-Projects repository """ ops = [] for i in range(OP_SPOTS): op = random.choice(OPS) ops.append(op) return {'string':cls.get_string_from_ops(ops)}
[ "def", "random_cell", "(", "cls", ",", "nasbench", ",", "max_nodes", "=", "4", ")", ":", "ops", "=", "[", "]", "for", "i", "in", "range", "(", "OP_SPOTS", ")", ":", "op", "=", "random", ".", "choice", "(", "OPS", ")", "ops", ".", "append", "(", ...
https://github.com/naszilla/bananas/blob/e2c12ade9e290e309e206fc3c8f97a373a136a81/nas_bench_201/cell.py#L29-L37
thaines/helit
04bd36ee0fb6b762c63d746e2cd8813641dceda9
gmm/mixture.py
python
Mixture.getData
(self)
Returns the data contained within, so it can be serialised with other data. (You can of course serialise this class directly if you want, but the returned object is a tuple of numpy arrays, so less likely to be an issue for any program that loads it.)
Returns the data contained within, so it can be serialised with other data. (You can of course serialise this class directly if you want, but the returned object is a tuple of numpy arrays, so less likely to be an issue for any program that loads it.)
[ "Returns", "the", "data", "contained", "within", "so", "it", "can", "be", "serialised", "with", "other", "data", ".", "(", "You", "can", "of", "course", "serialise", "this", "class", "directly", "if", "you", "want", "but", "the", "returned", "object", "is"...
def getData(self): """Returns the data contained within, so it can be serialised with other data. (You can of course serialise this class directly if you want, but the returned object is a tuple of numpy arrays, so less likely to be an issue for any program that loads it.)""" raise exceptions.NotImplementedErro...
[ "def", "getData", "(", "self", ")", ":", "raise", "exceptions", ".", "NotImplementedError", "(", ")" ]
https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/gmm/mixture.py#L140-L142
Stiivi/bubbles
b3c9332b8a9534655bd77821586e45a5086b1ddc
bubbles/objects.py
python
DataObject.append_from
(self, obj)
Appends data from object `obj` which might be a `DataObject` instance or an iterable. Default implementation uses iterable and calls `append()` for each element of the iterable. This method executes the append instead of returning a composed object. For object composition see `append` o...
Appends data from object `obj` which might be a `DataObject` instance or an iterable. Default implementation uses iterable and calls `append()` for each element of the iterable.
[ "Appends", "data", "from", "object", "obj", "which", "might", "be", "a", "DataObject", "instance", "or", "an", "iterable", ".", "Default", "implementation", "uses", "iterable", "and", "calls", "append", "()", "for", "each", "element", "of", "the", "iterable", ...
def append_from(self, obj): """Appends data from object `obj` which might be a `DataObject` instance or an iterable. Default implementation uses iterable and calls `append()` for each element of the iterable. This method executes the append instead of returning a composed object...
[ "def", "append_from", "(", "self", ",", "obj", ")", ":", "for", "row", "in", "iter", "(", "obj", ")", ":", "self", ".", "append", "(", "row", ")" ]
https://github.com/Stiivi/bubbles/blob/b3c9332b8a9534655bd77821586e45a5086b1ddc/bubbles/objects.py#L163-L172
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/channels/ci_channel.py
python
CIChannel.ci_pulse_freq_dig_fltr_enable
(self)
[]
def ci_pulse_freq_dig_fltr_enable(self): cfunc = lib_importer.windll.DAQmxResetCIPulseFreqDigFltrEnable if cfunc.argtypes is None: with cfunc.arglock: if cfunc.argtypes is None: cfunc.argtypes = [ lib_importer.task_handle, ctypes_by...
[ "def", "ci_pulse_freq_dig_fltr_enable", "(", "self", ")", ":", "cfunc", "=", "lib_importer", ".", "windll", ".", "DAQmxResetCIPulseFreqDigFltrEnable", "if", "cfunc", ".", "argtypes", "is", "None", ":", "with", "cfunc", ".", "arglock", ":", "if", "cfunc", ".", ...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L6927-L6937
jonathf/chaospy
f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e
chaospy/distributions/baseclass/distribution.py
python
Distribution.upper
(self)
return out
Upper bound for the distribution.
Upper bound for the distribution.
[ "Upper", "bound", "for", "the", "distribution", "." ]
def upper(self): """Upper bound for the distribution.""" cache = {} out = numpy.zeros(len(self)) for idx in self._rotation: out[idx] = self._get_upper(idx, cache=cache) return out
[ "def", "upper", "(", "self", ")", ":", "cache", "=", "{", "}", "out", "=", "numpy", ".", "zeros", "(", "len", "(", "self", ")", ")", "for", "idx", "in", "self", ".", "_rotation", ":", "out", "[", "idx", "]", "=", "self", ".", "_get_upper", "(",...
https://github.com/jonathf/chaospy/blob/f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e/chaospy/distributions/baseclass/distribution.py#L145-L151
Emptyset110/dHydra
8ec44994ff4dda8bf1ec40e38dd068b757945933
dHydra/console.py
python
send_command
( channel_name="dHydra.Command", command_type="sys", operation_name=None, token=None, kwargs={} )
[]
def send_command( channel_name="dHydra.Command", command_type="sys", operation_name=None, token=None, kwargs={} ): if operation_name is not None: command = { "type": command_type, "operation_name": operation_name, "token": token, ...
[ "def", "send_command", "(", "channel_name", "=", "\"dHydra.Command\"", ",", "command_type", "=", "\"sys\"", ",", "operation_name", "=", "None", ",", "token", "=", "None", ",", "kwargs", "=", "{", "}", ")", ":", "if", "operation_name", "is", "not", "None", ...
https://github.com/Emptyset110/dHydra/blob/8ec44994ff4dda8bf1ec40e38dd068b757945933/dHydra/console.py#L93-L107
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/distutils/ccompiler.py
python
CCompiler.add_include_dir
(self, dir)
Add 'dir' to the list of directories that will be searched for header files. The compiler is instructed to search directories in the order in which they are supplied by successive calls to 'add_include_dir()'.
Add 'dir' to the list of directories that will be searched for header files. The compiler is instructed to search directories in the order in which they are supplied by successive calls to 'add_include_dir()'.
[ "Add", "dir", "to", "the", "list", "of", "directories", "that", "will", "be", "searched", "for", "header", "files", ".", "The", "compiler", "is", "instructed", "to", "search", "directories", "in", "the", "order", "in", "which", "they", "are", "supplied", "...
def add_include_dir(self, dir): """Add 'dir' to the list of directories that will be searched for header files. The compiler is instructed to search directories in the order in which they are supplied by successive calls to 'add_include_dir()'. """ self.include_dirs.appe...
[ "def", "add_include_dir", "(", "self", ",", "dir", ")", ":", "self", ".", "include_dirs", ".", "append", "(", "dir", ")" ]
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/distutils/ccompiler.py#L229-L235
XanaduAI/strawberryfields
298601e409528f22c6717c2d816ab68ae8bda1fa
strawberryfields/engine.py
python
RemoteEngine.target
(self)
return self._target
The target device used by the engine. Returns: str: the name of the target
The target device used by the engine.
[ "The", "target", "device", "used", "by", "the", "engine", "." ]
def target(self) -> str: """The target device used by the engine. Returns: str: the name of the target """ return self._target
[ "def", "target", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_target" ]
https://github.com/XanaduAI/strawberryfields/blob/298601e409528f22c6717c2d816ab68ae8bda1fa/strawberryfields/engine.py#L580-L586
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
doc/development/source/orange-demo/orangedemo/OWLearningCurveA.py
python
OWLearningCurveA.set_dataset
(self, data)
Set the input train dataset.
Set the input train dataset.
[ "Set", "the", "input", "train", "dataset", "." ]
def set_dataset(self, data): """Set the input train dataset.""" # Clear all results/scores for id in list(self.results): self.results[id] = None for id in list(self.curves): self.curves[id] = None self.data = data if data is not None: ...
[ "def", "set_dataset", "(", "self", ",", "data", ")", ":", "# Clear all results/scores", "for", "id", "in", "list", "(", "self", ".", "results", ")", ":", "self", ".", "results", "[", "id", "]", "=", "None", "for", "id", "in", "list", "(", "self", "."...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/doc/development/source/orange-demo/orangedemo/OWLearningCurveA.py#L127-L142
10XGenomics/cellranger
a83c753ce641db6409a59ad817328354fbe7187e
lib/python/cellranger/utils.py
python
load_barcode_csv
(barcode_csv)
return bcs_per_genome
Load a csv file of (genome,barcode)
Load a csv file of (genome,barcode)
[ "Load", "a", "csv", "file", "of", "(", "genome", "barcode", ")" ]
def load_barcode_csv(barcode_csv): """ Load a csv file of (genome,barcode) """ bcs_per_genome = collections.defaultdict(list) with open(barcode_csv, 'r') as f: reader = csv.reader(f) for row in reader: if len(row) != 2: raise ValueError("Bad barcode file: %s" % b...
[ "def", "load_barcode_csv", "(", "barcode_csv", ")", ":", "bcs_per_genome", "=", "collections", ".", "defaultdict", "(", "list", ")", "with", "open", "(", "barcode_csv", ",", "'r'", ")", "as", "f", ":", "reader", "=", "csv", ".", "reader", "(", "f", ")", ...
https://github.com/10XGenomics/cellranger/blob/a83c753ce641db6409a59ad817328354fbe7187e/lib/python/cellranger/utils.py#L840-L851
kblomqvist/yasha
56bb1f69077957954e1ebeb77f7273e8dc6a891b
yasha/cmsis.py
python
SvdElement.__init__
(self, element=None, defaults={}, parent=None)
[]
def __init__(self, element=None, defaults={}, parent=None): if element is not None: self.from_element(element, defaults) if parent is not None: self.parent = parent
[ "def", "__init__", "(", "self", ",", "element", "=", "None", ",", "defaults", "=", "{", "}", ",", "parent", "=", "None", ")", ":", "if", "element", "is", "not", "None", ":", "self", ".", "from_element", "(", "element", ",", "defaults", ")", "if", "...
https://github.com/kblomqvist/yasha/blob/56bb1f69077957954e1ebeb77f7273e8dc6a891b/yasha/cmsis.py#L69-L73
luispedro/milk
abc2a28b526c199414d42c0a26092938968c3caf
milk/measures/measures.py
python
bayesian_significance
(n, c0, c1)
return min(sig, 1. - sig)
sig = bayesian_significance(n, c0, c1) Computes the Bayesian significance of the difference between a classifier that gets ``c0`` correct versus one that gets ``c1`` right on ``n`` examples. Parameters ---------- n : int Total number of examples c0 : int Examples that first...
sig = bayesian_significance(n, c0, c1)
[ "sig", "=", "bayesian_significance", "(", "n", "c0", "c1", ")" ]
def bayesian_significance(n, c0, c1): ''' sig = bayesian_significance(n, c0, c1) Computes the Bayesian significance of the difference between a classifier that gets ``c0`` correct versus one that gets ``c1`` right on ``n`` examples. Parameters ---------- n : int Total number of...
[ "def", "bayesian_significance", "(", "n", ",", "c0", ",", "c1", ")", ":", "def", "_logp", "(", "r", ",", "n", ",", "c", ")", ":", "return", "c", "*", "np", ".", "log", "(", "r", ")", "+", "(", "n", "-", "c", ")", "*", "np", ".", "log", "(...
https://github.com/luispedro/milk/blob/abc2a28b526c199414d42c0a26092938968c3caf/milk/measures/measures.py#L130-L162
apache/superset
3d829fc3c838358dd8c798ecaeefd34c502edca0
superset/migrations/versions/085f06488938_country_map_use_lowercase_country_name.py
python
downgrade
()
Convert all country names to sentence case
Convert all country names to sentence case
[ "Convert", "all", "country", "names", "to", "sentence", "case" ]
def downgrade(): """ Convert all country names to sentence case """ bind = op.get_bind() session = db.Session(bind=bind) for slc in session.query(Slice).filter(Slice.viz_type == "country_map").all(): try: params = json.loads(slc.params) if params.get("select_coun...
[ "def", "downgrade", "(", ")", ":", "bind", "=", "op", ".", "get_bind", "(", ")", "session", "=", "db", ".", "Session", "(", "bind", "=", "bind", ")", "for", "slc", "in", "session", ".", "query", "(", "Slice", ")", ".", "filter", "(", "Slice", "."...
https://github.com/apache/superset/blob/3d829fc3c838358dd8c798ecaeefd34c502edca0/superset/migrations/versions/085f06488938_country_map_use_lowercase_country_name.py#L67-L85
mozilla/zamboni
14b1a44658e47b9f048962fa52dbf00a3beaaf30
mkt/site/models.py
python
TransformQuerySet.only_translations
(self)
return (self.no_transforms().extra(select={'_only_trans': 1}) .transform(transformer.get_trans))
Remove all transforms except translations.
Remove all transforms except translations.
[ "Remove", "all", "transforms", "except", "translations", "." ]
def only_translations(self): """Remove all transforms except translations.""" from mkt.translations import transformer # Add an extra select so these are cached separately. return (self.no_transforms().extra(select={'_only_trans': 1}) .transform(transformer.get_trans))
[ "def", "only_translations", "(", "self", ")", ":", "from", "mkt", ".", "translations", "import", "transformer", "# Add an extra select so these are cached separately.", "return", "(", "self", ".", "no_transforms", "(", ")", ".", "extra", "(", "select", "=", "{", "...
https://github.com/mozilla/zamboni/blob/14b1a44658e47b9f048962fa52dbf00a3beaaf30/mkt/site/models.py#L47-L52
VLSIDA/OpenRAM
f66aac3264598eeae31225c62b6a4af52412d407
compiler/characterizer/lib.py
python
lib.write_data_bus_output
(self, read_port)
Adds data bus timing results.
Adds data bus timing results.
[ "Adds", "data", "bus", "timing", "results", "." ]
def write_data_bus_output(self, read_port): """ Adds data bus timing results.""" self.lib.write(" bus(dout{0}){{\n".format(read_port)) self.lib.write(" bus_type : data; \n") self.lib.write(" direction : output; \n") # This is conservative, but limit to range t...
[ "def", "write_data_bus_output", "(", "self", ",", "read_port", ")", ":", "self", ".", "lib", ".", "write", "(", "\" bus(dout{0}){{\\n\"", ".", "format", "(", "read_port", ")", ")", "self", ".", "lib", ".", "write", "(", "\" bus_type : data; \\n\"", ...
https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/characterizer/lib.py#L419-L452
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/apps/qrscp/db.py
python
_search_universal
(elem, session, query=None)
return query
Perform a universal search for empty elements. Parameters ---------- elem : pydicom.dataelem.DataElement The attribute to perform the search with. session : sqlalchemy.orm.session.Session The session we are using to query the database. query : sqlalchemy.orm.query.Query, optional ...
Perform a universal search for empty elements.
[ "Perform", "a", "universal", "search", "for", "empty", "elements", "." ]
def _search_universal(elem, session, query=None): """Perform a universal search for empty elements. Parameters ---------- elem : pydicom.dataelem.DataElement The attribute to perform the search with. session : sqlalchemy.orm.session.Session The session we are using to query the data...
[ "def", "_search_universal", "(", "elem", ",", "session", ",", "query", "=", "None", ")", ":", "# If the value is zero length then all entities shall match", "if", "not", "query", ":", "query", "=", "session", ".", "query", "(", "Instance", ")", "return", "query" ]
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/apps/qrscp/db.py#L611-L634
plaid/plaid-python
8c60fca608e426f3ff30da8857775946d29e122c
plaid/model/bank_transfer_list_request.py
python
BankTransferListRequest.__init__
(self, *args, **kwargs)
BankTransferListRequest - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. ...
BankTransferListRequest - a model defined in OpenAPI
[ "BankTransferListRequest", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, *args, **kwargs): # noqa: E501 """BankTransferListRequest - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be ...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "_check_type", "=", "kwargs", ".", "pop", "(", "'_check_type'", ",", "True", ")", "_spec_property_naming", "=", "kwargs", ".", "pop", "(", "'_spec_property...
https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/bank_transfer_list_request.py#L123-L197
apple/ccs-calendarserver
13c706b985fb728b9aab42dc0fef85aae21921c3
twistedcaldav/cache.py
python
MemcacheChangeNotifier.changed
(self, url=None)
return self.getCachePool().set( 'cacheToken:%s' % (url,), self._newCacheToken(), expireTime=config.ResponseCacheTimeout * 60)
Change the cache token for a resource @param url: the url whose token is being changed, or C{None} to determine the URL from the supplied resource @type: L{str} return: A L{Deferred} that fires when the token has been changed.
Change the cache token for a resource
[ "Change", "the", "cache", "token", "for", "a", "resource" ]
def changed(self, url=None): """ Change the cache token for a resource @param url: the url whose token is being changed, or C{None} to determine the URL from the supplied resource @type: L{str} return: A L{Deferred} that fires when the token has been changed. ...
[ "def", "changed", "(", "self", ",", "url", "=", "None", ")", ":", "# For shared resources we use the owner URL as the cache key", "if", "url", "is", "None", ":", "url", "=", "self", ".", "_resource", ".", "url", "(", ")", "self", ".", "log", ".", "debug", ...
https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/twistedcaldav/cache.py#L116-L134