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
Tencent/bk-PaaS
7ede6d304d5fb510e5f234a10c50b75e0006f330
paas-ce/paas/paas/user_center/views.py
python
unbind_wx_user_info
(request)
return JsonResponse({'result': ok, 'message': message})
【公众号/企业号/企业微信】解绑微信
【公众号/企业号/企业微信】解绑微信
[ "【公众号", "/", "企业号", "/", "企业微信】解绑微信" ]
def unbind_wx_user_info(request): """ 【公众号/企业号/企业微信】解绑微信 """ bk_token = request.COOKIES.get(settings.BK_COOKIE_NAME) ok, message = login.unbind_wx_user_info(bk_token) return JsonResponse({'result': ok, 'message': message})
[ "def", "unbind_wx_user_info", "(", "request", ")", ":", "bk_token", "=", "request", ".", "COOKIES", ".", "get", "(", "settings", ".", "BK_COOKIE_NAME", ")", "ok", ",", "message", "=", "login", ".", "unbind_wx_user_info", "(", "bk_token", ")", "return", "Json...
https://github.com/Tencent/bk-PaaS/blob/7ede6d304d5fb510e5f234a10c50b75e0006f330/paas-ce/paas/paas/user_center/views.py#L39-L45
jinserk/pytorch-asr
26b12981af942631b98afea83245448e5af55450
asr/models/las/network.py
python
split_last
(x, shape)
return x.view(*x.size()[:-1], *shape)
split the last dimension to given shape
split the last dimension to given shape
[ "split", "the", "last", "dimension", "to", "given", "shape" ]
def split_last(x, shape): "split the last dimension to given shape" shape = list(shape) assert shape.count(-1) <= 1 if -1 in shape: shape[shape.index(-1)] = int(x.size(-1) / -np.prod(shape)) return x.view(*x.size()[:-1], *shape)
[ "def", "split_last", "(", "x", ",", "shape", ")", ":", "shape", "=", "list", "(", "shape", ")", "assert", "shape", ".", "count", "(", "-", "1", ")", "<=", "1", "if", "-", "1", "in", "shape", ":", "shape", "[", "shape", ".", "index", "(", "-", ...
https://github.com/jinserk/pytorch-asr/blob/26b12981af942631b98afea83245448e5af55450/asr/models/las/network.py#L180-L186
burke-software/django-report-builder
21394979d3dc35afac06155aa2dd6cc4bdaffe19
report_builder_demo/demo_models/models.py
python
Bar.i_need_char_field
(self)
return 'lol yes'
[]
def i_need_char_field(self): return 'lol yes'
[ "def", "i_need_char_field", "(", "self", ")", ":", "return", "'lol yes'" ]
https://github.com/burke-software/django-report-builder/blob/21394979d3dc35afac06155aa2dd6cc4bdaffe19/report_builder_demo/demo_models/models.py#L43-L44
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/sklearn/linear_model/base.py
python
LinearClassifierMixin._predict_proba_lr
(self, X)
Probability estimation for OvR logistic regression. Positive class probabilities are computed as 1. / (1. + np.exp(-self.decision_function(X))); multiclass is handled by normalizing that over all classes.
Probability estimation for OvR logistic regression.
[ "Probability", "estimation", "for", "OvR", "logistic", "regression", "." ]
def _predict_proba_lr(self, X): """Probability estimation for OvR logistic regression. Positive class probabilities are computed as 1. / (1. + np.exp(-self.decision_function(X))); multiclass is handled by normalizing that over all classes. """ prob = self.decision_functi...
[ "def", "_predict_proba_lr", "(", "self", ",", "X", ")", ":", "prob", "=", "self", ".", "decision_function", "(", "X", ")", "prob", "*=", "-", "1", "np", ".", "exp", "(", "prob", ",", "prob", ")", "prob", "+=", "1", "np", ".", "reciprocal", "(", "...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/sklearn/linear_model/base.py#L343-L360
zestedesavoir/zds-site
2ba922223c859984a413cc6c108a8aa4023b113e
zds/member/models.py
python
Profile.get_opinion_count
(self)
return self.get_content_count(_type="OPINION")
:return: the count of opinions with this user as author. Count all opinions, no only published one.
:return: the count of opinions with this user as author. Count all opinions, no only published one.
[ ":", "return", ":", "the", "count", "of", "opinions", "with", "this", "user", "as", "author", ".", "Count", "all", "opinions", "no", "only", "published", "one", "." ]
def get_opinion_count(self): """ :return: the count of opinions with this user as author. Count all opinions, no only published one. """ return self.get_content_count(_type="OPINION")
[ "def", "get_opinion_count", "(", "self", ")", ":", "return", "self", ".", "get_content_count", "(", "_type", "=", "\"OPINION\"", ")" ]
https://github.com/zestedesavoir/zds-site/blob/2ba922223c859984a413cc6c108a8aa4023b113e/zds/member/models.py#L315-L319
plasticityai/magnitude
7ac0baeaf181263b661c3ae00643d21e3fd90216
pymagnitude/__init__.py
python
Magnitude.most_similar
(self, positive, negative=[], topn=10, min_similarity=None, return_similarities=True)
return self._db_query_similarity( positive=positive, negative=negative, min_similarity=min_similarity, topn=topn, exclude_keys=self._exclude_set( positive, negative), return_similarities=return_similarities, ...
Finds the topn most similar vectors under or equal to max distance.
Finds the topn most similar vectors under or equal to max distance.
[ "Finds", "the", "topn", "most", "similar", "vectors", "under", "or", "equal", "to", "max", "distance", "." ]
def most_similar(self, positive, negative=[], topn=10, min_similarity=None, return_similarities=True): """Finds the topn most similar vectors under or equal to max distance. """ positive, negative = self._handle_pos_neg_args(positive, negative) return self._...
[ "def", "most_similar", "(", "self", ",", "positive", ",", "negative", "=", "[", "]", ",", "topn", "=", "10", ",", "min_similarity", "=", "None", ",", "return_similarities", "=", "True", ")", ":", "positive", ",", "negative", "=", "self", ".", "_handle_po...
https://github.com/plasticityai/magnitude/blob/7ac0baeaf181263b661c3ae00643d21e3fd90216/pymagnitude/__init__.py#L1527-L1543
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/commands/list.py
python
ListCommand.iter_packages_latest_infos
(self, packages, options)
[]
def iter_packages_latest_infos(self, packages, options): index_urls = [options.index_url] + options.extra_index_urls if options.no_index: logger.debug('Ignoring indexes: %s', ','.join(index_urls)) index_urls = [] dependency_links = [] for dist in packages: ...
[ "def", "iter_packages_latest_infos", "(", "self", ",", "packages", ",", "options", ")", ":", "index_urls", "=", "[", "options", ".", "index_url", "]", "+", "options", ".", "extra_index_urls", "if", "options", ".", "no_index", ":", "logger", ".", "debug", "("...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/commands/list.py#L184-L221
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/mailbox.py
python
mbox._post_message_hook
(self, f)
Called after writing each message to file f.
Called after writing each message to file f.
[ "Called", "after", "writing", "each", "message", "to", "file", "f", "." ]
def _post_message_hook(self, f): """Called after writing each message to file f.""" f.write(os.linesep)
[ "def", "_post_message_hook", "(", "self", ",", "f", ")", ":", "f", ".", "write", "(", "os", ".", "linesep", ")" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/mailbox.py#L834-L836
Jiramew/spoon
a301f8e9fe6956b44b02861a3931143b987693b0
spoon_server/proxy/cool_provider.py
python
CoolProvider._gen_url_list
()
return url_list
[]
def _gen_url_list(): url_list = ['https://www.cool-proxy.net/proxies/http_proxy_list/sort:score/direction:desc/page:{0}'.format(i) for i in range(1, 6)] return url_list
[ "def", "_gen_url_list", "(", ")", ":", "url_list", "=", "[", "'https://www.cool-proxy.net/proxies/http_proxy_list/sort:score/direction:desc/page:{0}'", ".", "format", "(", "i", ")", "for", "i", "in", "range", "(", "1", ",", "6", ")", "]", "return", "url_list" ]
https://github.com/Jiramew/spoon/blob/a301f8e9fe6956b44b02861a3931143b987693b0/spoon_server/proxy/cool_provider.py#L17-L21
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/bulkloader.py
python
_Database.ThreadComplete
(self)
Finalize any operations the secondary thread has performed. The database aggregates lots of operations into a single commit, and this method is used to commit any pending operations as the thread is about to shut down.
Finalize any operations the secondary thread has performed.
[ "Finalize", "any", "operations", "the", "secondary", "thread", "has", "performed", "." ]
def ThreadComplete(self): """Finalize any operations the secondary thread has performed. The database aggregates lots of operations into a single commit, and this method is used to commit any pending operations as the thread is about to shut down. """ if self.secondary_conn: self._MaybeCo...
[ "def", "ThreadComplete", "(", "self", ")", ":", "if", "self", ".", "secondary_conn", ":", "self", ".", "_MaybeCommit", "(", "force_commit", "=", "True", ")" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/bulkloader.py#L1801-L1809
tomerfiliba/plumbum
20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1
plumbum/machines/remote.py
python
BaseRemoteMachine.close
(self)
closes the connection to the remote machine; all paths and programs will become defunct
closes the connection to the remote machine; all paths and programs will become defunct
[ "closes", "the", "connection", "to", "the", "remote", "machine", ";", "all", "paths", "and", "programs", "will", "become", "defunct" ]
def close(self): """closes the connection to the remote machine; all paths and programs will become defunct""" self._session.close() self._session = ClosedRemote(self)
[ "def", "close", "(", "self", ")", ":", "self", ".", "_session", ".", "close", "(", ")", "self", ".", "_session", "=", "ClosedRemote", "(", "self", ")" ]
https://github.com/tomerfiliba/plumbum/blob/20cdda5e8bbd9f83d64b154f6b4fcd28216c63e1/plumbum/machines/remote.py#L203-L207
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/examples/tetris.py
python
MyGame.new_stone
(self)
Randomly grab a new stone and set the stone location to the top. If we immediately collide, then game-over.
Randomly grab a new stone and set the stone location to the top. If we immediately collide, then game-over.
[ "Randomly", "grab", "a", "new", "stone", "and", "set", "the", "stone", "location", "to", "the", "top", ".", "If", "we", "immediately", "collide", "then", "game", "-", "over", "." ]
def new_stone(self): """ Randomly grab a new stone and set the stone location to the top. If we immediately collide, then game-over. """ self.stone = random.choice(tetris_shapes) self.stone_x = int(COLUMN_COUNT / 2 - len(self.stone[0]) / 2) self.stone_y = 0 ...
[ "def", "new_stone", "(", "self", ")", ":", "self", ".", "stone", "=", "random", ".", "choice", "(", "tetris_shapes", ")", "self", ".", "stone_x", "=", "int", "(", "COLUMN_COUNT", "/", "2", "-", "len", "(", "self", ".", "stone", "[", "0", "]", ")", ...
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/tetris.py#L143-L153
vlachoudis/bCNC
67126b4894dabf6579baf47af8d0f9b7de35e6e3
bCNC/lib/svg_elements.py
python
SVG.property_by_object
(self, s)
[]
def property_by_object(self, s): Group.property_by_object(self, s) self.x = s.x self.y = s.y self.width = s.width self.height = s.height self.viewbox = Viewbox(s.viewbox) if s.viewbox is not None else None
[ "def", "property_by_object", "(", "self", ",", "s", ")", ":", "Group", ".", "property_by_object", "(", "self", ",", "s", ")", "self", ".", "x", "=", "s", ".", "x", "self", ".", "y", "=", "s", ".", "y", "self", ".", "width", "=", "s", ".", "widt...
https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/lib/svg_elements.py#L7261-L7267
jhpyle/docassemble
b90c84e57af59aa88b3404d44d0b125c70f832cc
docassemble_base/docassemble/base/functions.py
python
set_save_status
(status)
Indicates whether the current processing of the interview logic should result in a new step in the interview.
Indicates whether the current processing of the interview logic should result in a new step in the interview.
[ "Indicates", "whether", "the", "current", "processing", "of", "the", "interview", "logic", "should", "result", "in", "a", "new", "step", "in", "the", "interview", "." ]
def set_save_status(status): """Indicates whether the current processing of the interview logic should result in a new step in the interview.""" if status in ('new', 'overwrite', 'ignore'): this_thread.misc['save_status'] = status
[ "def", "set_save_status", "(", "status", ")", ":", "if", "status", "in", "(", "'new'", ",", "'overwrite'", ",", "'ignore'", ")", ":", "this_thread", ".", "misc", "[", "'save_status'", "]", "=", "status" ]
https://github.com/jhpyle/docassemble/blob/b90c84e57af59aa88b3404d44d0b125c70f832cc/docassemble_base/docassemble/base/functions.py#L1218-L1221
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/locale.py
python
getdefaultlocale
(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE'))
return _parse_localename(localename)
Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. Calling setlocale(LC_ALL, "") lets it use the default locale as define...
Tries to determine the default locale settings and returns them as tuple (language code, encoding).
[ "Tries", "to", "determine", "the", "default", "locale", "settings", "and", "returns", "them", "as", "tuple", "(", "language", "code", "encoding", ")", "." ]
def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. ...
[ "def", "getdefaultlocale", "(", "envvars", "=", "(", "'LC_ALL'", ",", "'LC_CTYPE'", ",", "'LANG'", ",", "'LANGUAGE'", ")", ")", ":", "try", ":", "# check if it's supported by the _locale module", "import", "_locale", "code", ",", "encoding", "=", "_locale", ".", ...
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/locale.py#L487-L537
clalancette/oz
1ab43e88033efa774815c6ebb59ae2841f2980e9
oz/Guest.py
python
Guest._generate_virtio_channel
(self, devices, name)
Method to generate libvirt XML for a virtio channel.
Method to generate libvirt XML for a virtio channel.
[ "Method", "to", "generate", "libvirt", "XML", "for", "a", "virtio", "channel", "." ]
def _generate_virtio_channel(self, devices, name): """ Method to generate libvirt XML for a virtio channel. """ virtio = oz.ozutil.lxml_subelement(devices, "channel", None, {'type': 'tcp'}) oz.ozutil.lxml_subelement(virtio, "source", None, {'mode...
[ "def", "_generate_virtio_channel", "(", "self", ",", "devices", ",", "name", ")", ":", "virtio", "=", "oz", ".", "ozutil", ".", "lxml_subelement", "(", "devices", ",", "\"channel\"", ",", "None", ",", "{", "'type'", ":", "'tcp'", "}", ")", "oz", ".", "...
https://github.com/clalancette/oz/blob/1ab43e88033efa774815c6ebb59ae2841f2980e9/oz/Guest.py#L439-L446
triaquae/triaquae
bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9
TriAquae/models/Centos_6.4/paramiko/channel.py
python
Channel.get_name
(self)
return self._name
Get the name of this channel that was previously set by L{set_name}. @return: the name of this channel. @rtype: str
Get the name of this channel that was previously set by L{set_name}.
[ "Get", "the", "name", "of", "this", "channel", "that", "was", "previously", "set", "by", "L", "{", "set_name", "}", "." ]
def get_name(self): """ Get the name of this channel that was previously set by L{set_name}. @return: the name of this channel. @rtype: str """ return self._name
[ "def", "get_name", "(", "self", ")", ":", "return", "self", ".", "_name" ]
https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/paramiko/channel.py#L437-L444
aquasecurity/kube-hunter
b379e64314ba61250a40da6953c8a67464917405
kube_hunter/core/events/handler.py
python
EventQueue._update_multi_hooks
(self, hook, event)
Updates published events in the multi hooks fulfilled store.
Updates published events in the multi hooks fulfilled store.
[ "Updates", "published", "events", "in", "the", "multi", "hooks", "fulfilled", "store", "." ]
def _update_multi_hooks(self, hook, event): """ Updates published events in the multi hooks fulfilled store. """ self.hook_fulfilled_deps[hook][event.__class__].append(event)
[ "def", "_update_multi_hooks", "(", "self", ",", "hook", ",", "event", ")", ":", "self", ".", "hook_fulfilled_deps", "[", "hook", "]", "[", "event", ".", "__class__", "]", ".", "append", "(", "event", ")" ]
https://github.com/aquasecurity/kube-hunter/blob/b379e64314ba61250a40da6953c8a67464917405/kube_hunter/core/events/handler.py#L203-L207
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/command_support/GeneratorBaseClass.py
python
GeneratorBaseClass.restore_defaults_btn_clicked
(self)
Slot for the Restore Defaults button.
Slot for the Restore Defaults button.
[ "Slot", "for", "the", "Restore", "Defaults", "button", "." ]
def restore_defaults_btn_clicked(self): """Slot for the Restore Defaults button.""" ### TODO: docstring needs to say under what conditions this should be # overridden. ### WARNING: Mark says this is never called in practice, since it's # overridden by the same method in PropMgrBa...
[ "def", "restore_defaults_btn_clicked", "(", "self", ")", ":", "### TODO: docstring needs to say under what conditions this should be", "# overridden.", "### WARNING: Mark says this is never called in practice, since it's", "# overridden by the same method in PropMgrBaseClass, and that this", "# ...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/command_support/GeneratorBaseClass.py#L230-L240
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1beta1_role_binding_list.py
python
V1beta1RoleBindingList.api_version
(self, api_version)
Sets the api_version of this V1beta1RoleBindingList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions...
Sets the api_version of this V1beta1RoleBindingList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions...
[ "Sets", "the", "api_version", "of", "this", "V1beta1RoleBindingList", ".", "APIVersion", "defines", "the", "versioned", "schema", "of", "this", "representation", "of", "an", "object", ".", "Servers", "should", "convert", "recognized", "schemas", "to", "the", "late...
def api_version(self, api_version): """ Sets the api_version of this V1beta1RoleBindingList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https:/...
[ "def", "api_version", "(", "self", ",", "api_version", ")", ":", "self", ".", "_api_version", "=", "api_version" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1beta1_role_binding_list.py#L64-L73
implus/PytorchInsight
2864528f8b83f52c3df76f7c3804aa468b91e5cf
classification/models/imagenet/resnet_sk.py
python
sk_resnet18
(pretrained=False, **kwargs)
return model
Constructs a ResNet-18 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
Constructs a ResNet-18 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
[ "Constructs", "a", "ResNet", "-", "18", "model", ".", "Args", ":", "pretrained", "(", "bool", ")", ":", "If", "True", "returns", "a", "model", "pre", "-", "trained", "on", "ImageNet" ]
def sk_resnet18(pretrained=False, **kwargs): """Constructs a ResNet-18 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs) return model
[ "def", "sk_resnet18", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "ResNet", "(", "BasicBlock", ",", "[", "2", ",", "2", ",", "2", ",", "2", "]", ",", "*", "*", "kwargs", ")", "return", "model" ]
https://github.com/implus/PytorchInsight/blob/2864528f8b83f52c3df76f7c3804aa468b91e5cf/classification/models/imagenet/resnet_sk.py#L182-L188
ynhacler/RedKindle
7c970920dc840f869e38cbda480d630cc2e7b200
cssutils/css/cssstyledeclaration.py
python
CSSStyleDeclaration._getP
(self, CSSName)
return self.getPropertyValue(CSSName)
(DOM CSS2Properties) Overwritten here and effectively the same as ``self.getPropertyValue(CSSname)``. Parameter is in CSSname format ('font-style'), see CSS2Properties. Example:: >>> style = CSSStyleDeclaration(cssText='font-style:italic;') >>> print style.fontStyle ...
(DOM CSS2Properties) Overwritten here and effectively the same as ``self.getPropertyValue(CSSname)``.
[ "(", "DOM", "CSS2Properties", ")", "Overwritten", "here", "and", "effectively", "the", "same", "as", "self", ".", "getPropertyValue", "(", "CSSname", ")", "." ]
def _getP(self, CSSName): """(DOM CSS2Properties) Overwritten here and effectively the same as ``self.getPropertyValue(CSSname)``. Parameter is in CSSname format ('font-style'), see CSS2Properties. Example:: >>> style = CSSStyleDeclaration(cssText='font-style:italic;') ...
[ "def", "_getP", "(", "self", ",", "CSSName", ")", ":", "return", "self", ".", "getPropertyValue", "(", "CSSName", ")" ]
https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/cssutils/css/cssstyledeclaration.py#L213-L225
PaddlePaddle/X2Paddle
b492545f61446af69e5d5d6288bc3a43a9a3931e
x2paddle/op_mapper/pytorch2paddle/aten.py
python
aten_gru
(mapper, graph, node)
return current_inputs, current_outputs
构造门控循环单元网络(GRU)的PaddleLayer。 TorchScript示例: %21, %22 = aten::gru(%input, %hx, %20, %11, %10, %9, %11, %8, %11) 参数含义: %21 (Tensor): 输出,由前向和后向cell的输出拼接得到。 %22 (Tensor): 输出,最终状态。 %input (Tensor): 网络输入。 %hx (Tensor): 网络的初始状态。 %20 (list): 所有权重组合成的list。 %11 ...
构造门控循环单元网络(GRU)的PaddleLayer。 TorchScript示例: %21, %22 = aten::gru(%input, %hx, %20, %11, %10, %9, %11, %8, %11) 参数含义: %21 (Tensor): 输出,由前向和后向cell的输出拼接得到。 %22 (Tensor): 输出,最终状态。 %input (Tensor): 网络输入。 %hx (Tensor): 网络的初始状态。 %20 (list): 所有权重组合成的list。 %11 ...
[ "构造门控循环单元网络(GRU)的PaddleLayer。", "TorchScript示例", ":", "%21", "%22", "=", "aten", "::", "gru", "(", "%input", "%hx", "%20", "%11", "%10", "%9", "%11", "%8", "%11", ")", "参数含义", ":", "%21", "(", "Tensor", ")", ":", "输出,由前向和后向cell的输出拼接得到。", "%22", "(", "Tenso...
def aten_gru(mapper, graph, node): """ 构造门控循环单元网络(GRU)的PaddleLayer。 TorchScript示例: %21, %22 = aten::gru(%input, %hx, %20, %11, %10, %9, %11, %8, %11) 参数含义: %21 (Tensor): 输出,由前向和后向cell的输出拼接得到。 %22 (Tensor): 输出,最终状态。 %input (Tensor): 网络输入。 %hx (Tensor): 网络的初始状态。 ...
[ "def", "aten_gru", "(", "mapper", ",", "graph", ",", "node", ")", ":", "scope_name", "=", "mapper", ".", "normalize_scope_name", "(", "node", ")", "op_name", "=", "name_generator", "(", "\"gru\"", ",", "mapper", ".", "nn_name2id", ")", "output_names", "=", ...
https://github.com/PaddlePaddle/X2Paddle/blob/b492545f61446af69e5d5d6288bc3a43a9a3931e/x2paddle/op_mapper/pytorch2paddle/aten.py#L2493-L2580
explosion/srsly
8617ecc099d1f34a60117b5287bef5424ea2c837
srsly/ruamel_yaml/comments.py
python
CommentedSet.__len__
(self)
return len(self.odict)
[]
def __len__(self): # type: () -> int return len(self.odict)
[ "def", "__len__", "(", "self", ")", ":", "# type: () -> int", "return", "len", "(", "self", ".", "odict", ")" ]
https://github.com/explosion/srsly/blob/8617ecc099d1f34a60117b5287bef5424ea2c837/srsly/ruamel_yaml/comments.py#L1111-L1113
couchbase/couchbase-python-client
58ccfd42af320bde6b733acf094fd5a4cf34e0ad
couchbase/bucket.py
python
Bucket.views_timeout
(self)
return timedelta(seconds=self._get_timeout_common( _LCB.LCB_CNTL_VIEW_TIMEOUT))
The default timeout for all view operations on this bucket. :: # Set the default view timeout to 10 seconds: cb.view_timeout = timedelta(seconds=10) # Get the default view timeout: timeout = cb.view_timeout
The default timeout for all view operations on this bucket. :: # Set the default view timeout to 10 seconds: cb.view_timeout = timedelta(seconds=10)
[ "The", "default", "timeout", "for", "all", "view", "operations", "on", "this", "bucket", ".", "::", "#", "Set", "the", "default", "view", "timeout", "to", "10", "seconds", ":", "cb", ".", "view_timeout", "=", "timedelta", "(", "seconds", "=", "10", ")" ]
def views_timeout(self): # type: (...) -> timedelta """ The default timeout for all view operations on this bucket. :: # Set the default view timeout to 10 seconds: cb.view_timeout = timedelta(seconds=10) # Get the default view timeout: ti...
[ "def", "views_timeout", "(", "self", ")", ":", "# type: (...) -> timedelta", "# lets use the private function in the private _bucket for now. Soon", "# that _bucket will be gone and we will have migrated this all into", "# here.", "return", "timedelta", "(", "seconds", "=", "self", ...
https://github.com/couchbase/couchbase-python-client/blob/58ccfd42af320bde6b733acf094fd5a4cf34e0ad/couchbase/bucket.py#L327-L342
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/utils/utils.py
python
iter_to_string
(initer, endsep="and", addquote=False)
This pretty-formats an iterable list as string output, adding an optional alternative separator to the second to last entry. If `addquote` is `True`, the outgoing strings will be surrounded by quotes. Args: initer (any): Usually an iterable to print. Each element must be possible to pr...
This pretty-formats an iterable list as string output, adding an optional alternative separator to the second to last entry. If `addquote` is `True`, the outgoing strings will be surrounded by quotes.
[ "This", "pretty", "-", "formats", "an", "iterable", "list", "as", "string", "output", "adding", "an", "optional", "alternative", "separator", "to", "the", "second", "to", "last", "entry", ".", "If", "addquote", "is", "True", "the", "outgoing", "strings", "wi...
def iter_to_string(initer, endsep="and", addquote=False): """ This pretty-formats an iterable list as string output, adding an optional alternative separator to the second to last entry. If `addquote` is `True`, the outgoing strings will be surrounded by quotes. Args: initer (any): Usually...
[ "def", "iter_to_string", "(", "initer", ",", "endsep", "=", "\"and\"", ",", "addquote", "=", "False", ")", ":", "if", "not", "endsep", ":", "endsep", "=", "\",\"", "else", ":", "endsep", "=", "\" \"", "+", "endsep", "if", "not", "initer", ":", "return"...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/utils/utils.py#L347-L391
home-assistant/supervisor
69c2517d5211b483fdfe968b0a2b36b672ee7ab2
supervisor/resolution/fixup.py
python
ResolutionFixup.all_fixes
(self)
return [ self._create_full_backup, self._clear_full_backup, self._store_execute_reload, self._store_execute_reset, self._store_execute_remove, ]
Return a list of all fixups. Order can be important!
Return a list of all fixups.
[ "Return", "a", "list", "of", "all", "fixups", "." ]
def all_fixes(self) -> list[FixupBase]: """Return a list of all fixups. Order can be important! """ return [ self._create_full_backup, self._clear_full_backup, self._store_execute_reload, self._store_execute_reset, self._store_...
[ "def", "all_fixes", "(", "self", ")", "->", "list", "[", "FixupBase", "]", ":", "return", "[", "self", ".", "_create_full_backup", ",", "self", ".", "_clear_full_backup", ",", "self", ".", "_store_execute_reload", ",", "self", ".", "_store_execute_reset", ",",...
https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/resolution/fixup.py#L32-L43
KoreLogicSecurity/mastiff
04d569e4fa59513572e77c74b049cad82f9b0310
mastiff/conf.py
python
Conf.get_var
(self, section, var)
Return a specified variable.
Return a specified variable.
[ "Return", "a", "specified", "variable", "." ]
def get_var(self, section, var): """Return a specified variable.""" try: return self.config.get(section, var) except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): log = logging.getLogger('Mastiff.Conf.GetVar') log.error('Could not find "%s": "%s"'...
[ "def", "get_var", "(", "self", ",", "section", ",", "var", ")", ":", "try", ":", "return", "self", ".", "config", ".", "get", "(", "section", ",", "var", ")", "except", "(", "ConfigParser", ".", "NoOptionError", ",", "ConfigParser", ".", "NoSectionError"...
https://github.com/KoreLogicSecurity/mastiff/blob/04d569e4fa59513572e77c74b049cad82f9b0310/mastiff/conf.py#L89-L96
python-telegram-bot/python-telegram-bot
ade1529986f5b6d394a65372d6a27045a70725b2
telegram/poll.py
python
Poll.__init__
( self, id: str, # pylint: disable=W0622 question: str, options: List[PollOption], total_voter_count: int, is_closed: bool, is_anonymous: bool, type: str, # pylint: disable=W0622 allows_multiple_answers: bool, correct_option_id: int = Non...
[]
def __init__( self, id: str, # pylint: disable=W0622 question: str, options: List[PollOption], total_voter_count: int, is_closed: bool, is_anonymous: bool, type: str, # pylint: disable=W0622 allows_multiple_answers: bool, correct_option_i...
[ "def", "__init__", "(", "self", ",", "id", ":", "str", ",", "# pylint: disable=W0622", "question", ":", "str", ",", "options", ":", "List", "[", "PollOption", "]", ",", "total_voter_count", ":", "int", ",", "is_closed", ":", "bool", ",", "is_anonymous", ":...
https://github.com/python-telegram-bot/python-telegram-bot/blob/ade1529986f5b6d394a65372d6a27045a70725b2/telegram/poll.py#L170-L201
dulwich/dulwich
1f66817d712e3563ce1ff53b1218491a2eae39da
dulwich/fastexport.py
python
GitImportProcessor.tag_handler
(self, cmd)
Process a TagCommand.
Process a TagCommand.
[ "Process", "a", "TagCommand", "." ]
def tag_handler(self, cmd): """Process a TagCommand.""" tag = Tag() tag.tagger = cmd.tagger tag.message = cmd.message tag.name = cmd.tag self.repo.add_object(tag) self.repo.refs["refs/tags/" + tag.name] = tag.id
[ "def", "tag_handler", "(", "self", ",", "cmd", ")", ":", "tag", "=", "Tag", "(", ")", "tag", ".", "tagger", "=", "cmd", ".", "tagger", "tag", ".", "message", "=", "cmd", ".", "message", "tag", ".", "name", "=", "cmd", ".", "tag", "self", ".", "...
https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/fastexport.py#L247-L254
dropbox/changes
37e23c3141b75e4785cf398d015e3dbca41bdd56
changes/ext/statsreporter.py
python
Stats.incr
(self, key, delta=1)
Increment a count. @param key - the name of the stat. @param delta - amount to increment the stat by. Must be positive.
Increment a count.
[ "Increment", "a", "count", "." ]
def incr(self, key, delta=1): # type: (bytes, float) -> None """ Increment a count. @param key - the name of the stat. @param delta - amount to increment the stat by. Must be positive. """ assert isinstance(delta, (int, float, long)) assert delta >= 0 ...
[ "def", "incr", "(", "self", ",", "key", ",", "delta", "=", "1", ")", ":", "# type: (bytes, float) -> None", "assert", "isinstance", "(", "delta", ",", "(", "int", ",", "float", ",", "long", ")", ")", "assert", "delta", ">=", "0", "Stats", ".", "_check_...
https://github.com/dropbox/changes/blob/37e23c3141b75e4785cf398d015e3dbca41bdd56/changes/ext/statsreporter.py#L103-L113
limodou/ulipad
4c7d590234f39cac80bb1d36dca095b646e287fb
packages/winpdb/rpdb2.py
python
CDebuggerEngine.stop_debuggee
(self)
Notify the client and terminate this proccess.
Notify the client and terminate this proccess.
[ "Notify", "the", "client", "and", "terminate", "this", "proccess", "." ]
def stop_debuggee(self): """ Notify the client and terminate this proccess. """ g_server.m_work_queue.post_work_item(target = _atexit, args = (True, ), name = '_atexit')
[ "def", "stop_debuggee", "(", "self", ")", ":", "g_server", ".", "m_work_queue", ".", "post_work_item", "(", "target", "=", "_atexit", ",", "args", "=", "(", "True", ",", ")", ",", "name", "=", "'_atexit'", ")" ]
https://github.com/limodou/ulipad/blob/4c7d590234f39cac80bb1d36dca095b646e287fb/packages/winpdb/rpdb2.py#L9171-L9176
nutonomy/nuscenes-devkit
05d05b3c994fb3c17b6643016d9f622a001c7275
python-sdk/nuscenes/prediction/models/backbone.py
python
trim_network_at_index
(network: nn.Module, index: int = -1)
return nn.Sequential(*list(network.children())[:index])
Returns a new network with all layers up to index from the back. :param network: Module to trim. :param index: Where to trim the network. Counted from the last layer.
Returns a new network with all layers up to index from the back. :param network: Module to trim. :param index: Where to trim the network. Counted from the last layer.
[ "Returns", "a", "new", "network", "with", "all", "layers", "up", "to", "index", "from", "the", "back", ".", ":", "param", "network", ":", "Module", "to", "trim", ".", ":", "param", "index", ":", "Where", "to", "trim", "the", "network", ".", "Counted", ...
def trim_network_at_index(network: nn.Module, index: int = -1) -> nn.Module: """ Returns a new network with all layers up to index from the back. :param network: Module to trim. :param index: Where to trim the network. Counted from the last layer. """ assert index < 0, f"Param index must be nega...
[ "def", "trim_network_at_index", "(", "network", ":", "nn", ".", "Module", ",", "index", ":", "int", "=", "-", "1", ")", "->", "nn", ".", "Module", ":", "assert", "index", "<", "0", ",", "f\"Param index must be negative. Received {index}.\"", "return", "nn", ...
https://github.com/nutonomy/nuscenes-devkit/blob/05d05b3c994fb3c17b6643016d9f622a001c7275/python-sdk/nuscenes/prediction/models/backbone.py#L11-L18
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py
python
PiecewisePolynomialPauliRotations.mapped_coeffs
(self)
return mapped_coeffs
The coefficients mapped to the internal representation, since we only compare x>=breakpoint. Returns: The mapped coefficients.
The coefficients mapped to the internal representation, since we only compare x>=breakpoint.
[ "The", "coefficients", "mapped", "to", "the", "internal", "representation", "since", "we", "only", "compare", "x", ">", "=", "breakpoint", "." ]
def mapped_coeffs(self) -> List[List[float]]: """The coefficients mapped to the internal representation, since we only compare x>=breakpoint. Returns: The mapped coefficients. """ mapped_coeffs = [] # First polynomial mapped_coeffs.append(self._hom_c...
[ "def", "mapped_coeffs", "(", "self", ")", "->", "List", "[", "List", "[", "float", "]", "]", ":", "mapped_coeffs", "=", "[", "]", "# First polynomial", "mapped_coeffs", ".", "append", "(", "self", ".", "_hom_coeffs", "[", "0", "]", ")", "for", "i", "in...
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py#L182-L198
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/templates/CumbriaEAC/menus.py
python
S3MainMenu.menu_modules
(cls)
return menu
Custom Modules Menu
Custom Modules Menu
[ "Custom", "Modules", "Menu" ]
def menu_modules(cls): """ Custom Modules Menu """ if not current.auth.is_logged_in(): return None shelter_id = current.session.s3.shelter_id if shelter_id: menu = [MM("My Shelter", c="cr", f="shelter", args=[shelter_id])( MM("All Shelter...
[ "def", "menu_modules", "(", "cls", ")", ":", "if", "not", "current", ".", "auth", ".", "is_logged_in", "(", ")", ":", "return", "None", "shelter_id", "=", "current", ".", "session", ".", "s3", ".", "shelter_id", "if", "shelter_id", ":", "menu", "=", "[...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/CumbriaEAC/menus.py#L35-L69
jimersylee/MachineLearningAction
4902bf9868a4eb0c486b0595f66ff18dae283832
Logistic/logRegres.py
python
plotBestFit
(weights)
画出数据集和Logistic回归最佳拟合直线的函数 :param weights:系数 :return:
画出数据集和Logistic回归最佳拟合直线的函数 :param weights:系数 :return:
[ "画出数据集和Logistic回归最佳拟合直线的函数", ":", "param", "weights", ":", "系数", ":", "return", ":" ]
def plotBestFit(weights): """ 画出数据集和Logistic回归最佳拟合直线的函数 :param weights:系数 :return: """ import matplotlib.pyplot as plt weights = weights.getA() dataMat, labelMat = loadDataSet() dataArr = array(dataMat) n = shape(dataArr)[0] xcord1 = [] ycord1 = [] xcord2 = [] yco...
[ "def", "plotBestFit", "(", "weights", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "weights", "=", "weights", ".", "getA", "(", ")", "dataMat", ",", "labelMat", "=", "loadDataSet", "(", ")", "dataArr", "=", "array", "(", "dataMat", ")", ...
https://github.com/jimersylee/MachineLearningAction/blob/4902bf9868a4eb0c486b0595f66ff18dae283832/Logistic/logRegres.py#L94-L126
tengxing/tensorflow-learn
4d41f2a27af346e4d2adb206ebbc25aafbe52be6
mnist/mnist.py
python
evaluation
(logits, labels)
return tf.reduce_sum(tf.cast(correct, tf.int32))
Evaluate the quality of the logits at predicting the label. Args: logits: Logits tensor, float - [batch_size, NUM_CLASSES]. labels: Labels tensor, int32 - [batch_size], with values in the range [0, NUM_CLASSES). Returns: A scalar int32 tensor with the number of examples (out of batch_size) t...
Evaluate the quality of the logits at predicting the label.
[ "Evaluate", "the", "quality", "of", "the", "logits", "at", "predicting", "the", "label", "." ]
def evaluation(logits, labels): """Evaluate the quality of the logits at predicting the label. Args: logits: Logits tensor, float - [batch_size, NUM_CLASSES]. labels: Labels tensor, int32 - [batch_size], with values in the range [0, NUM_CLASSES). Returns: A scalar int32 tensor with the number ...
[ "def", "evaluation", "(", "logits", ",", "labels", ")", ":", "# For a classifier model, we can use the in_top_k Op.", "# It returns a bool tensor with shape [batch_size] that is true for", "# the examples where the label's is was in the top k (here k=one)", "# of all logits for that example.",...
https://github.com/tengxing/tensorflow-learn/blob/4d41f2a27af346e4d2adb206ebbc25aafbe52be6/mnist/mnist.py#L143-L161
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol30948.py
python
decode_replay_tracker_events
(contents)
Decodes and yields each tracker event from the contents byte string.
Decodes and yields each tracker event from the contents byte string.
[ "Decodes", "and", "yields", "each", "tracker", "event", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_tracker_events(contents): """Decodes and yields each tracker event from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, tracker_eventid_typeid, ...
[ "def", "decode_replay_tracker_events", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "for", "event", "in", "_decode_event_stream", "(", "decoder", ",", "tracker_eventid_typeid", ",", "tracker_event_types", ",", ...
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol30948.py#L420-L427
pimutils/todoman
6460032da527cd6885621b882d9f37f653412feb
todoman/model.py
python
Cache.add_vtodo
(self, todo: icalendar.Todo, file_path: str, id=None)
return rv
Adds a todo into the cache. :param icalendar.Todo todo: The icalendar component object on which
Adds a todo into the cache.
[ "Adds", "a", "todo", "into", "the", "cache", "." ]
def add_vtodo(self, todo: icalendar.Todo, file_path: str, id=None) -> int: """ Adds a todo into the cache. :param icalendar.Todo todo: The icalendar component object on which """ sql = """ INSERT INTO todos ( {} file_path, ...
[ "def", "add_vtodo", "(", "self", ",", "todo", ":", "icalendar", ".", "Todo", ",", "file_path", ":", "str", ",", "id", "=", "None", ")", "->", "int", ":", "sql", "=", "\"\"\"\n INSERT INTO todos (\n {}\n file_path,\n ...
https://github.com/pimutils/todoman/blob/6460032da527cd6885621b882d9f37f653412feb/todoman/model.py#L623-L697
SCons/scons
309f0234d1d9cc76955818be47c5c722f577dac6
SCons/Node/FS.py
python
File._morph
(self)
Turn a file system node into a File object.
Turn a file system node into a File object.
[ "Turn", "a", "file", "system", "node", "into", "a", "File", "object", "." ]
def _morph(self): """Turn a file system node into a File object.""" self.scanner_paths = {} if not hasattr(self, '_local'): self._local = 0 if not hasattr(self, 'released_target_info'): self.released_target_info = False self.store_info = 1 self._f...
[ "def", "_morph", "(", "self", ")", ":", "self", ".", "scanner_paths", "=", "{", "}", "if", "not", "hasattr", "(", "self", ",", "'_local'", ")", ":", "self", ".", "_local", "=", "0", "if", "not", "hasattr", "(", "self", ",", "'released_target_info'", ...
https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Node/FS.py#L2700-L2727
DataIntegrationAlliance/data_integration_celery
6775292030213dd1fa33a1ec0f542d5d2d2e612a
tasks/tushare/tushare_future/continuse_contract_md.py
python
is_earlier_instruments
(inst_a, inst_b, by_wind_code=True)
return inst_num_a < inst_num_b
比较两个合约交割日期 True :param inst_a: :param inst_b: :param by_wind_code: :return:
比较两个合约交割日期 True :param inst_a: :param inst_b: :param by_wind_code: :return:
[ "比较两个合约交割日期", "True", ":", "param", "inst_a", ":", ":", "param", "inst_b", ":", ":", "param", "by_wind_code", ":", ":", "return", ":" ]
def is_earlier_instruments(inst_a, inst_b, by_wind_code=True): """ 比较两个合约交割日期 True :param inst_a: :param inst_b: :param by_wind_code: :return: """ inst_num_a = get_instrument_num(inst_a, by_wind_code) inst_num_b = get_instrument_num(inst_b, by_wind_code) return inst_num_a < i...
[ "def", "is_earlier_instruments", "(", "inst_a", ",", "inst_b", ",", "by_wind_code", "=", "True", ")", ":", "inst_num_a", "=", "get_instrument_num", "(", "inst_a", ",", "by_wind_code", ")", "inst_num_b", "=", "get_instrument_num", "(", "inst_b", ",", "by_wind_code"...
https://github.com/DataIntegrationAlliance/data_integration_celery/blob/6775292030213dd1fa33a1ec0f542d5d2d2e612a/tasks/tushare/tushare_future/continuse_contract_md.py#L83-L93
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/rfc822.py
python
AddrlistClass.getphraselist
(self)
return plist
Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
Parse a sequence of RFC 2822 phrases.
[ "Parse", "a", "sequence", "of", "RFC", "2822", "phrases", "." ]
def getphraselist(self): """Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. """ plist = [] ...
[ "def", "getphraselist", "(", "self", ")", ":", "plist", "=", "[", "]", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "in", "self", ".", "LWS", ":", "self"...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/rfc822.py#L747-L768
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/storage/vc_holder/in_memory.py
python
InMemoryVCRecordSearch.fetch
(self, max_count: int = None)
Fetch the next list of VC records from the store. Args: max_count: Max number of records to return. If not provided, defaults to the backend's preferred page size Returns: A list of `VCRecord` instances
Fetch the next list of VC records from the store.
[ "Fetch", "the", "next", "list", "of", "VC", "records", "from", "the", "store", "." ]
async def fetch(self, max_count: int = None) -> Sequence[VCRecord]: """ Fetch the next list of VC records from the store. Args: max_count: Max number of records to return. If not provided, defaults to the backend's preferred page size Returns: A li...
[ "async", "def", "fetch", "(", "self", ",", "max_count", ":", "int", "=", "None", ")", "->", "Sequence", "[", "VCRecord", "]", ":", "rows", "=", "await", "self", ".", "_search", ".", "fetch", "(", "max_count", ")", "records", "=", "[", "storage_to_vc_re...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/storage/vc_holder/in_memory.py#L142-L163
sebp/scikit-survival
68631e2d8b0b824a3b056c77ce4a19ab30ac8f5b
sksurv/linear_model/coxph.py
python
CoxPHSurvivalAnalysis.predict_cumulative_hazard_function
(self, X)
return self._baseline_model.get_cumulative_hazard_function(self.predict(X))
Predict cumulative hazard function. The cumulative hazard function for an individual with feature vector :math:`x` is defined as .. math:: H(t \\mid x) = \\exp(x^\\top \\beta) H_0(t) , where :math:`H_0(t)` is the baseline hazard function, estimated by Breslow's es...
Predict cumulative hazard function.
[ "Predict", "cumulative", "hazard", "function", "." ]
def predict_cumulative_hazard_function(self, X): """Predict cumulative hazard function. The cumulative hazard function for an individual with feature vector :math:`x` is defined as .. math:: H(t \\mid x) = \\exp(x^\\top \\beta) H_0(t) , where :math:`H_0(t)` is the...
[ "def", "predict_cumulative_hazard_function", "(", "self", ",", "X", ")", ":", "return", "self", ".", "_baseline_model", ".", "get_cumulative_hazard_function", "(", "self", ".", "predict", "(", "X", ")", ")" ]
https://github.com/sebp/scikit-survival/blob/68631e2d8b0b824a3b056c77ce4a19ab30ac8f5b/sksurv/linear_model/coxph.py#L484-L534
davidmogar/cucco
e2a0ff3342e4a9f25a65c486206a5a2ae1a4dbd4
cucco/batch.py
python
Batch.process_files
(self, path, recursive=False)
Apply normalizations over all files in the given directory. Iterate over all files in a given directory. Normalizations will be applied to each file, storing the result in a new file. The extension for the new file will be the one defined in BATCH_EXTENSION. Args: p...
Apply normalizations over all files in the given directory.
[ "Apply", "normalizations", "over", "all", "files", "in", "the", "given", "directory", "." ]
def process_files(self, path, recursive=False): """Apply normalizations over all files in the given directory. Iterate over all files in a given directory. Normalizations will be applied to each file, storing the result in a new file. The extension for the new file will be the one defin...
[ "def", "process_files", "(", "self", ",", "path", ",", "recursive", "=", "False", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Processing files in \"%s\"'", ",", "path", ")", "for", "(", "path", ",", "file", ")", "in", "files_generator", "(", "p...
https://github.com/davidmogar/cucco/blob/e2a0ff3342e4a9f25a65c486206a5a2ae1a4dbd4/cucco/batch.py#L99-L115
ArdalanM/nlp-benchmarks
00fd3c07530b2f01002ec2ffe8681815ce4b3fcf
src/transformer/net.py
python
Encoders.forward
(self, src, src_mask)
return self.norm(x)
Follow Figure 1 (left) for connections.
Follow Figure 1 (left) for connections.
[ "Follow", "Figure", "1", "(", "left", ")", "for", "connections", "." ]
def forward(self, src, src_mask): "Follow Figure 1 (left) for connections." x = self.drop(self.pe(self.emb(src))) for layer in self.layers: x = layer(x, src_mask) return self.norm(x)
[ "def", "forward", "(", "self", ",", "src", ",", "src_mask", ")", ":", "x", "=", "self", ".", "drop", "(", "self", ".", "pe", "(", "self", ".", "emb", "(", "src", ")", ")", ")", "for", "layer", "in", "self", ".", "layers", ":", "x", "=", "laye...
https://github.com/ArdalanM/nlp-benchmarks/blob/00fd3c07530b2f01002ec2ffe8681815ce4b3fcf/src/transformer/net.py#L162-L169
RaRe-Technologies/gensim
8b8203d8df354673732dff635283494a33d0d422
gensim/models/ldamodel.py
python
LdaModel.show_topic
(self, topicid, topn=10)
return [(self.id2word[id], value) for id, value in self.get_topic_terms(topicid, topn)]
Get the representation for a single topic. Words here are the actual strings, in constrast to :meth:`~gensim.models.ldamodel.LdaModel.get_topic_terms` that represents words by their vocabulary ID. Parameters ---------- topicid : int The ID of the topic to be returned ...
Get the representation for a single topic. Words here are the actual strings, in constrast to :meth:`~gensim.models.ldamodel.LdaModel.get_topic_terms` that represents words by their vocabulary ID.
[ "Get", "the", "representation", "for", "a", "single", "topic", ".", "Words", "here", "are", "the", "actual", "strings", "in", "constrast", "to", ":", "meth", ":", "~gensim", ".", "models", ".", "ldamodel", ".", "LdaModel", ".", "get_topic_terms", "that", "...
def show_topic(self, topicid, topn=10): """Get the representation for a single topic. Words here are the actual strings, in constrast to :meth:`~gensim.models.ldamodel.LdaModel.get_topic_terms` that represents words by their vocabulary ID. Parameters ---------- topicid : int ...
[ "def", "show_topic", "(", "self", ",", "topicid", ",", "topn", "=", "10", ")", ":", "return", "[", "(", "self", ".", "id2word", "[", "id", "]", ",", "value", ")", "for", "id", ",", "value", "in", "self", ".", "get_topic_terms", "(", "topicid", ",",...
https://github.com/RaRe-Technologies/gensim/blob/8b8203d8df354673732dff635283494a33d0d422/gensim/models/ldamodel.py#L1200-L1217
yihui-he/KL-Loss
66c0ed9e886a2218f4cf88c0efd4f40199bff54a
detectron/core/config.py
python
merge_cfg_from_list
(cfg_list)
Merge config keys, values in a list (e.g., from command line) into the global config. For example, `cfg_list = ['TEST.NMS', 0.5]`.
Merge config keys, values in a list (e.g., from command line) into the global config. For example, `cfg_list = ['TEST.NMS', 0.5]`.
[ "Merge", "config", "keys", "values", "in", "a", "list", "(", "e", ".", "g", ".", "from", "command", "line", ")", "into", "the", "global", "config", ".", "For", "example", "cfg_list", "=", "[", "TEST", ".", "NMS", "0", ".", "5", "]", "." ]
def merge_cfg_from_list(cfg_list): """Merge config keys, values in a list (e.g., from command line) into the global config. For example, `cfg_list = ['TEST.NMS', 0.5]`. """ assert len(cfg_list) % 2 == 0 for full_key, v in zip(cfg_list[0::2], cfg_list[1::2]): if _key_is_deprecated(full_key): ...
[ "def", "merge_cfg_from_list", "(", "cfg_list", ")", ":", "assert", "len", "(", "cfg_list", ")", "%", "2", "==", "0", "for", "full_key", ",", "v", "in", "zip", "(", "cfg_list", "[", "0", ":", ":", "2", "]", ",", "cfg_list", "[", "1", ":", ":", "2"...
https://github.com/yihui-he/KL-Loss/blob/66c0ed9e886a2218f4cf88c0efd4f40199bff54a/detectron/core/config.py#L1156-L1177
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
datadog_checks_dev/datadog_checks/dev/tooling/commands/env/prune.py
python
prune
(force)
Remove all configuration for environments.
Remove all configuration for environments.
[ "Remove", "all", "configuration", "for", "environments", "." ]
def prune(force): """Remove all configuration for environments.""" if not force: echo_warning( 'Removing configuration of environments that may be in use will leave ' 'them in a potentially unusable state. If you wish to proceed (e.g. you ' 'have just restarted your m...
[ "def", "prune", "(", "force", ")", ":", "if", "not", "force", ":", "echo_warning", "(", "'Removing configuration of environments that may be in use will leave '", "'them in a potentially unusable state. If you wish to proceed (e.g. you '", "'have just restarted your machine), you may use...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/prune.py#L12-L33
linuxerwang/rkflashkit
c6b422afa372bf1d498fcddb6a6b95360021d2a6
src/rkflashkit/climain.py
python
ConsoleLogger.print_error
(self, message)
[]
def print_error(self, message): self.log('\n%sERROR:%s %s' % (self.WARN_COLOR, self.RESET_COLOR, message))
[ "def", "print_error", "(", "self", ",", "message", ")", ":", "self", ".", "log", "(", "'\\n%sERROR:%s %s'", "%", "(", "self", ".", "WARN_COLOR", ",", "self", ".", "RESET_COLOR", ",", "message", ")", ")" ]
https://github.com/linuxerwang/rkflashkit/blob/c6b422afa372bf1d498fcddb6a6b95360021d2a6/src/rkflashkit/climain.py#L47-L48
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
pypy/module/_socket/interp_func.py
python
htonl
(space, x)
return space.newint(rsocket.htonl(r_uint32(x)))
htonl(integer) -> integer Convert a 32-bit integer from host to network byte order.
htonl(integer) -> integer
[ "htonl", "(", "integer", ")", "-", ">", "integer" ]
def htonl(space, x): """htonl(integer) -> integer Convert a 32-bit integer from host to network byte order. """ if x < r_longlong(0): raise oefmt(space.w_OverflowError, "can't convert negative number to unsigned long") if x > LONGLONG_UINT32_MAX: raise oefmt(spac...
[ "def", "htonl", "(", "space", ",", "x", ")", ":", "if", "x", "<", "r_longlong", "(", "0", ")", ":", "raise", "oefmt", "(", "space", ".", "w_OverflowError", ",", "\"can't convert negative number to unsigned long\"", ")", "if", "x", ">", "LONGLONG_UINT32_MAX", ...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/_socket/interp_func.py#L208-L218
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_modeling/tensorflow/bert_large/training/bfloat16/create_pretraining_data.py
python
create_training_instances
(input_files, tokenizer, max_seq_length, dupe_factor, short_seq_prob, masked_lm_prob, max_predictions_per_seq, rng)
return instances
Create `TrainingInstance`s from raw text.
Create `TrainingInstance`s from raw text.
[ "Create", "TrainingInstance", "s", "from", "raw", "text", "." ]
def create_training_instances(input_files, tokenizer, max_seq_length, dupe_factor, short_seq_prob, masked_lm_prob, max_predictions_per_seq, rng): """Create `TrainingInstance`s from raw text.""" all_documents = [[]] # Input file format: # (1) One sente...
[ "def", "create_training_instances", "(", "input_files", ",", "tokenizer", ",", "max_seq_length", ",", "dupe_factor", ",", "short_seq_prob", ",", "masked_lm_prob", ",", "max_predictions_per_seq", ",", "rng", ")", ":", "all_documents", "=", "[", "[", "]", "]", "# In...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_modeling/tensorflow/bert_large/training/bfloat16/create_pretraining_data.py#L182-L223
pyradius/pyrad
990900d1fbd99946f5452d0b992c08e5b501f42e
pyrad/dictfile.py
python
DictFile.File
(self)
Returns name of current file
Returns name of current file
[ "Returns", "name", "of", "current", "file" ]
def File(self): """Returns name of current file """ if self.stack: return self.stack[-1].name else: return ''
[ "def", "File", "(", "self", ")", ":", "if", "self", ".", "stack", ":", "return", "self", ".", "stack", "[", "-", "1", "]", ".", "name", "else", ":", "return", "''" ]
https://github.com/pyradius/pyrad/blob/990900d1fbd99946f5452d0b992c08e5b501f42e/pyrad/dictfile.py#L94-L100
opengapps/apkcrawler
e33ab5d1f37c54139ebf9fa93214adbe037bc679
reporthelper.py
python
ReportHelper.needsBetaSupport
(self, avi)
return (avi.lowername.endswith('.beta') or avi.lowername + '.beta' in self.dAllApks)
def needsBetaSupport(): Returns True if beta support is needed, else False
def needsBetaSupport(): Returns True if beta support is needed, else False
[ "def", "needsBetaSupport", "()", ":", "Returns", "True", "if", "beta", "support", "is", "needed", "else", "False" ]
def needsBetaSupport(self, avi): """ def needsBetaSupport(): Returns True if beta support is needed, else False """ return (avi.lowername.endswith('.beta') or avi.lowername + '.beta' in self.dAllApks)
[ "def", "needsBetaSupport", "(", "self", ",", "avi", ")", ":", "return", "(", "avi", ".", "lowername", ".", "endswith", "(", "'.beta'", ")", "or", "avi", ".", "lowername", "+", "'.beta'", "in", "self", ".", "dAllApks", ")" ]
https://github.com/opengapps/apkcrawler/blob/e33ab5d1f37c54139ebf9fa93214adbe037bc679/reporthelper.py#L213-L217
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/djangoapps/split_modulestore_django/models.py
python
SplitModulestoreCourseIndex.clean
(self)
Validation for this model
Validation for this model
[ "Validation", "for", "this", "model" ]
def clean(self): """ Validation for this model """ super().clean() # Check that course_id is a supported type: course_id_str = str(self.course_id) if not course_id_str.startswith("course-v1:") and not course_id_str.startswith("library-v1:"): raise Valu...
[ "def", "clean", "(", "self", ")", ":", "super", "(", ")", ".", "clean", "(", ")", "# Check that course_id is a supported type:", "course_id_str", "=", "str", "(", "self", ".", "course_id", ")", "if", "not", "course_id_str", ".", "startswith", "(", "\"course-v1...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/djangoapps/split_modulestore_django/models.py#L144-L157
VDIGPKU/CBNet_caffe
3bf4db9bfe5439f844f8f4e9188c7e6e83f6f769
detectron/core/rpn_generator.py
python
im_proposals
(model, im)
return boxes, scores
Generate RPN proposals on a single image.
Generate RPN proposals on a single image.
[ "Generate", "RPN", "proposals", "on", "a", "single", "image", "." ]
def im_proposals(model, im): """Generate RPN proposals on a single image.""" inputs = {} inputs['data'], im_scale, inputs['im_info'] = \ blob_utils.get_image_blob(im, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE) for k, v in inputs.items(): workspace.FeedBlob(core.ScopedName(k), v.astype(np.float32...
[ "def", "im_proposals", "(", "model", ",", "im", ")", ":", "inputs", "=", "{", "}", "inputs", "[", "'data'", "]", ",", "im_scale", ",", "inputs", "[", "'im_info'", "]", "=", "blob_utils", ".", "get_image_blob", "(", "im", ",", "cfg", ".", "TEST", ".",...
https://github.com/VDIGPKU/CBNet_caffe/blob/3bf4db9bfe5439f844f8f4e9188c7e6e83f6f769/detectron/core/rpn_generator.py#L209-L251
landlab/landlab
a5dd80b8ebfd03d1ba87ef6c4368c409485f222c
landlab/components/profiler/trickle_down_profiler.py
python
TrickleDownProfiler._create_flat_structures
(self)
Create expected flattened structures for ids, distances, and colors.
Create expected flattened structures for ids, distances, and colors.
[ "Create", "expected", "flattened", "structures", "for", "ids", "distances", "and", "colors", "." ]
def _create_flat_structures(self): """Create expected flattened structures for ids, distances, and colors.""" self._nodes = [] self._distance_along_profile = [] self._colors = [] for outlet_id in self._data_struct: seg_tuples = self._data_struct[outlet_id].keys() ...
[ "def", "_create_flat_structures", "(", "self", ")", ":", "self", ".", "_nodes", "=", "[", "]", "self", ".", "_distance_along_profile", "=", "[", "]", "self", ".", "_colors", "=", "[", "]", "for", "outlet_id", "in", "self", ".", "_data_struct", ":", "seg_...
https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/components/profiler/trickle_down_profiler.py#L345-L362
JaniceWuo/MovieRecommend
4c86db64ca45598917d304f535413df3bc9fea65
movierecommend/venv1/Lib/site-packages/django/forms/widgets.py
python
SelectDateWidget.__init__
(self, attrs=None, years=None, months=None, empty_label=None)
[]
def __init__(self, attrs=None, years=None, months=None, empty_label=None): self.attrs = attrs or {} # Optional list or tuple of years to use in the "year" select box. if years: self.years = years else: this_year = datetime.date.today().year self.years...
[ "def", "__init__", "(", "self", ",", "attrs", "=", "None", ",", "years", "=", "None", ",", "months", "=", "None", ",", "empty_label", "=", "None", ")", ":", "self", ".", "attrs", "=", "attrs", "or", "{", "}", "# Optional list or tuple of years to use in th...
https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/django/forms/widgets.py#L911-L941
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/engines/libvirt_events.py
python
_domain_event_watchdog_cb
(conn, domain, action, opaque)
Domain watchdog events handler
Domain watchdog events handler
[ "Domain", "watchdog", "events", "handler" ]
def _domain_event_watchdog_cb(conn, domain, action, opaque): """ Domain watchdog events handler """ _salt_send_domain_event( opaque, conn, domain, opaque["event"], {"action": _get_libvirt_enum_string("VIR_DOMAIN_EVENT_WATCHDOG_", action)}, )
[ "def", "_domain_event_watchdog_cb", "(", "conn", ",", "domain", ",", "action", ",", "opaque", ")", ":", "_salt_send_domain_event", "(", "opaque", ",", "conn", ",", "domain", ",", "opaque", "[", "\"event\"", "]", ",", "{", "\"action\"", ":", "_get_libvirt_enum_...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/engines/libvirt_events.py#L292-L302
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
KG/AAAI2021_SSAN/dataset.py
python
BaseReader.get_train_progress
(self)
return self.current_example, self.current_epoch
Gets progress for training phase.
Gets progress for training phase.
[ "Gets", "progress", "for", "training", "phase", "." ]
def get_train_progress(self): """Gets progress for training phase.""" return self.current_example, self.current_epoch
[ "def", "get_train_progress", "(", "self", ")", ":", "return", "self", ".", "current_example", ",", "self", ".", "current_epoch" ]
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/KG/AAAI2021_SSAN/dataset.py#L102-L104
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/cluster/hierarchy.py
python
average
(y)
return linkage(y, method='average', metric='euclidean')
Performs average/UPGMA linkage on a condensed distance matrix Parameters ---------- y : ndarray The upper triangular of the distance matrix. The result of ``pdist`` is returned in this form. Returns ------- Z : ndarray A linkage matrix containing the hierarchical cluste...
Performs average/UPGMA linkage on a condensed distance matrix
[ "Performs", "average", "/", "UPGMA", "linkage", "on", "a", "condensed", "distance", "matrix" ]
def average(y): """ Performs average/UPGMA linkage on a condensed distance matrix Parameters ---------- y : ndarray The upper triangular of the distance matrix. The result of ``pdist`` is returned in this form. Returns ------- Z : ndarray A linkage matrix contai...
[ "def", "average", "(", "y", ")", ":", "return", "linkage", "(", "y", ",", "method", "=", "'average'", ",", "metric", "=", "'euclidean'", ")" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/cluster/hierarchy.py#L285-L307
google-research/football
c5c6a5c1d587a94673597ff6d61da43044a0c9ac
gfootball/env/players/bot.py
python
Player._get_action
(self)
return move_action
Returns action to perform for the current observations.
Returns action to perform for the current observations.
[ "Returns", "action", "to", "perform", "for", "the", "current", "observations", "." ]
def _get_action(self): """Returns action to perform for the current observations.""" active = self._observation['left_team'][self._observation['active']] # Corner etc. - just pass the ball if self._observation['game_mode'] != 0: return football_action_set.action_long_pass if self._observation...
[ "def", "_get_action", "(", "self", ")", ":", "active", "=", "self", ".", "_observation", "[", "'left_team'", "]", "[", "self", ".", "_observation", "[", "'active'", "]", "]", "# Corner etc. - just pass the ball", "if", "self", ".", "_observation", "[", "'game_...
https://github.com/google-research/football/blob/c5c6a5c1d587a94673597ff6d61da43044a0c9ac/gfootball/env/players/bot.py#L164-L209
SickChill/SickChill
01020f3636d01535f60b83464d8127ea0efabfc7
sickchill/adba/aniDBresponses.py
python
PermvoteNotAllowedResponse.__init__
(self, cmd, restag, rescode, resstr, datalines)
attributes: data: aname - name of the anime
attributes:
[ "attributes", ":" ]
def __init__(self, cmd, restag, rescode, resstr, datalines): """ attributes: data: aname - name of the anime """ super().__init__(cmd, restag, rescode, resstr, datalines) self.codestr = "PERMVOTE_NOT_ALLOWED" self.codehead = () self.codetail = ("...
[ "def", "__init__", "(", "self", ",", "cmd", ",", "restag", ",", "rescode", ",", "resstr", ",", "datalines", ")", ":", "super", "(", ")", ".", "__init__", "(", "cmd", ",", "restag", ",", "rescode", ",", "resstr", ",", "datalines", ")", "self", ".", ...
https://github.com/SickChill/SickChill/blob/01020f3636d01535f60b83464d8127ea0efabfc7/sickchill/adba/aniDBresponses.py#L1489-L1501
deepset-ai/haystack
79fdda8a7cf393d774803608a4874f2a6e63cf6f
haystack/nodes/retriever/sparse.py
python
TfidfRetriever.retrieve
(self, query: str, filters: dict = None, top_k: Optional[int] = None, index: str = None, headers: Optional[Dict[str, str]] = None)
return documents
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param query: The query :param filters: A dictionary where the keys specify a metadata field and the value is a list of accepted values for that field :param top_k: How many ...
Scan through documents in DocumentStore and return a small number documents that are most relevant to the query.
[ "Scan", "through", "documents", "in", "DocumentStore", "and", "return", "a", "small", "number", "documents", "that", "are", "most", "relevant", "to", "the", "query", "." ]
def retrieve(self, query: str, filters: dict = None, top_k: Optional[int] = None, index: str = None, headers: Optional[Dict[str, str]] = None) -> List[Document]: """ Scan through documents in DocumentStore and return a small number documents that are most relevant to the query. :param q...
[ "def", "retrieve", "(", "self", ",", "query", ":", "str", ",", "filters", ":", "dict", "=", "None", ",", "top_k", ":", "Optional", "[", "int", "]", "=", "None", ",", "index", ":", "str", "=", "None", ",", "headers", ":", "Optional", "[", "Dict", ...
https://github.com/deepset-ai/haystack/blob/79fdda8a7cf393d774803608a4874f2a6e63cf6f/haystack/nodes/retriever/sparse.py#L186-L236
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py
python
getTetragridC
(elementNode, prefix, tetragrid)
return tetragrid
Get the matrix Tetragrid from the elementNode letter c values.
Get the matrix Tetragrid from the elementNode letter c values.
[ "Get", "the", "matrix", "Tetragrid", "from", "the", "elementNode", "letter", "c", "values", "." ]
def getTetragridC(elementNode, prefix, tetragrid): 'Get the matrix Tetragrid from the elementNode letter c values.' columnKeys = 'Pc1 Pc2 Pc3 Pc4'.replace('P', prefix).split() evaluatedDictionary = evaluate.getEvaluatedDictionaryByEvaluationKeys(elementNode, columnKeys) if len(evaluatedDictionary.keys()) < 1: ret...
[ "def", "getTetragridC", "(", "elementNode", ",", "prefix", ",", "tetragrid", ")", ":", "columnKeys", "=", "'Pc1 Pc2 Pc3 Pc4'", ".", "replace", "(", "'P'", ",", "prefix", ")", ".", "split", "(", ")", "evaluatedDictionary", "=", "evaluate", ".", "getEvaluatedDic...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/fabmetheus_utilities/geometry/geometry_utilities/matrix.py#L239-L257
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tke/v20180525/models.py
python
DescribePrometheusOverviewsResponse.__init__
(self)
r""" :param Instances: 实例列表 :type Instances: list of PrometheusInstanceOverview :param Total: 实例总数 注意:此字段可能返回 null,表示取不到有效值。 :type Total: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param Instances: 实例列表 :type Instances: list of PrometheusInstanceOverview :param Total: 实例总数 注意:此字段可能返回 null,表示取不到有效值。 :type Total: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "Instances", ":", "实例列表", ":", "type", "Instances", ":", "list", "of", "PrometheusInstanceOverview", ":", "param", "Total", ":", "实例总数", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "Total", ":", "int", ":", "param", "RequestId", ":", "唯一请...
def __init__(self): r""" :param Instances: 实例列表 :type Instances: list of PrometheusInstanceOverview :param Total: 实例总数 注意:此字段可能返回 null,表示取不到有效值。 :type Total: int :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Instances", "=", "None", "self", ".", "Total", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tke/v20180525/models.py#L5177-L5189
arsaboo/homeassistant-config
53c998986fbe84d793a0b174757154ab30e676e4
custom_components/androidtv/media_player.py
python
FireTVDevice.supported_features
(self)
return SUPPORT_FIRETV
Flag media player features that are supported.
Flag media player features that are supported.
[ "Flag", "media", "player", "features", "that", "are", "supported", "." ]
def supported_features(self): """Flag media player features that are supported.""" return SUPPORT_FIRETV
[ "def", "supported_features", "(", "self", ")", ":", "return", "SUPPORT_FIRETV" ]
https://github.com/arsaboo/homeassistant-config/blob/53c998986fbe84d793a0b174757154ab30e676e4/custom_components/androidtv/media_player.py#L758-L760
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/wx/tree_editor.py
python
SimpleEditor._object_info_for
(self, object, name="")
return result
Returns the tree node data for a specified object as a list of the form: [ ( expanded, node, nid ), ... ].
Returns the tree node data for a specified object as a list of the form: [ ( expanded, node, nid ), ... ].
[ "Returns", "the", "tree", "node", "data", "for", "a", "specified", "object", "as", "a", "list", "of", "the", "form", ":", "[", "(", "expanded", "node", "nid", ")", "...", "]", "." ]
def _object_info_for(self, object, name=""): """Returns the tree node data for a specified object as a list of the form: [ ( expanded, node, nid ), ... ]. """ result = [] for name2, nid in self._map[id(object)]: if name == name2: expanded, node, ignore...
[ "def", "_object_info_for", "(", "self", ",", "object", ",", "name", "=", "\"\"", ")", ":", "result", "=", "[", "]", "for", "name2", ",", "nid", "in", "self", ".", "_map", "[", "id", "(", "object", ")", "]", ":", "if", "name", "==", "name2", ":", ...
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/wx/tree_editor.py#L617-L627
DonnchaC/shadowbrokers-exploits
42d8265db860b634717da4faa668b2670457cf7e
windows/fuzzbunch/pyreadline/console/console.py
python
Console.__init__
(self, newbuffer=0)
Initialize the Console object. newbuffer=1 will allocate a new buffer so the old content will be restored on exit.
Initialize the Console object.
[ "Initialize", "the", "Console", "object", "." ]
def __init__(self, newbuffer=0): '''Initialize the Console object. newbuffer=1 will allocate a new buffer so the old content will be restored on exit. ''' #Do I need the following line? It causes a console to be created whenever #readline is imported into a pythonw appli...
[ "def", "__init__", "(", "self", ",", "newbuffer", "=", "0", ")", ":", "#Do I need the following line? It causes a console to be created whenever", "#readline is imported into a pythonw application which seems wrong. Things", "#seem to work without it...", "#self.AllocConsole()", "if", ...
https://github.com/DonnchaC/shadowbrokers-exploits/blob/42d8265db860b634717da4faa668b2670457cf7e/windows/fuzzbunch/pyreadline/console/console.py#L173-L215
yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification
2a6d2f9c732a362458030643e131540e7d1cdcca
bert/run_squad.py
python
_check_is_max_context
(doc_spans, cur_span_index, position)
return cur_span_index == best_span_index
Check if this is the 'max context' doc span for the token.
Check if this is the 'max context' doc span for the token.
[ "Check", "if", "this", "is", "the", "max", "context", "doc", "span", "for", "the", "token", "." ]
def _check_is_max_context(doc_spans, cur_span_index, position): """Check if this is the 'max context' doc span for the token.""" # Because of the sliding window approach taken to scoring documents, a single # token can appear in multiple documents. E.g. # Doc: the man went to the store and bought a gallon of ...
[ "def", "_check_is_max_context", "(", "doc_spans", ",", "cur_span_index", ",", "position", ")", ":", "# Because of the sliding window approach taken to scoring documents, a single", "# token can appear in multiple documents. E.g.", "# Doc: the man went to the store and bought a gallon of mil...
https://github.com/yuanxiaosc/BERT-for-Sequence-Labeling-and-Text-Classification/blob/2a6d2f9c732a362458030643e131540e7d1cdcca/bert/run_squad.py#L513-L547
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/distutils/cmd.py
python
Command.copy_tree
(self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1)
return dir_util.copy_tree(infile, outfile, preserve_mode, preserve_times, preserve_symlinks, not self.force, dry_run=self.dry_run)
Copy an entire directory tree respecting verbose, dry-run, and force flags.
Copy an entire directory tree respecting verbose, dry-run, and force flags.
[ "Copy", "an", "entire", "directory", "tree", "respecting", "verbose", "dry", "-", "run", "and", "force", "flags", "." ]
def copy_tree(self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1): """Copy an entire directory tree respecting verbose, dry-run, and force flags. """ return dir_util.copy_tree(infile, outfile, preserve_mode, ...
[ "def", "copy_tree", "(", "self", ",", "infile", ",", "outfile", ",", "preserve_mode", "=", "1", ",", "preserve_times", "=", "1", ",", "preserve_symlinks", "=", "0", ",", "level", "=", "1", ")", ":", "return", "dir_util", ".", "copy_tree", "(", "infile", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/distutils/cmd.py#L349-L356
lunixbochs/SublimeXiki
4b81ced42cab40b33d4519a97467c5b9f4e2e04c
lib/util.py
python
touch
(path)
[]
def touch(path): with open(path, 'a'): os.utime(path, None)
[ "def", "touch", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'a'", ")", ":", "os", ".", "utime", "(", "path", ",", "None", ")" ]
https://github.com/lunixbochs/SublimeXiki/blob/4b81ced42cab40b33d4519a97467c5b9f4e2e04c/lib/util.py#L107-L109
Breakthrough/PySceneDetect
f1724075498f66712a9082abe8b3c7446b19790a
scenedetect/video_manager.py
python
VideoManager.get_video_paths
(self)
return list(self._video_file_paths)
Get Video Paths - returns list of strings containing paths to the open video(s). Returns: List[str]: List of paths to the video files opened by the VideoManager.
Get Video Paths - returns list of strings containing paths to the open video(s).
[ "Get", "Video", "Paths", "-", "returns", "list", "of", "strings", "containing", "paths", "to", "the", "open", "video", "(", "s", ")", "." ]
def get_video_paths(self): # type: () -> List[str] """ Get Video Paths - returns list of strings containing paths to the open video(s). Returns: List[str]: List of paths to the video files opened by the VideoManager. """ return list(self._video_file_paths)
[ "def", "get_video_paths", "(", "self", ")", ":", "# type: () -> List[str]", "return", "list", "(", "self", ".", "_video_file_paths", ")" ]
https://github.com/Breakthrough/PySceneDetect/blob/f1724075498f66712a9082abe8b3c7446b19790a/scenedetect/video_manager.py#L419-L426
google/prettytensor
75daa0b11252590f548da5647addc0ea610c4c45
prettytensor/pretty_tensor_methods.py
python
apply_op
(input_layer, operation, *op_args, **op_kwargs)
return input_layer.with_tensor( operation(input_layer.tensor, *op_args, **op_kwargs))
Applies the given operation to this before without adding any summaries. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_kwargs: Keyword arguments for the operation. Returns: A new l...
Applies the given operation to this before without adding any summaries.
[ "Applies", "the", "given", "operation", "to", "this", "before", "without", "adding", "any", "summaries", "." ]
def apply_op(input_layer, operation, *op_args, **op_kwargs): """Applies the given operation to this before without adding any summaries. Args: input_layer: The input layer for this op. operation: An operation that takes a tensor and the supplied args. *op_args: Extra arguments for operation. **op_k...
[ "def", "apply_op", "(", "input_layer", ",", "operation", ",", "*", "op_args", ",", "*", "*", "op_kwargs", ")", ":", "return", "input_layer", ".", "with_tensor", "(", "operation", "(", "input_layer", ".", "tensor", ",", "*", "op_args", ",", "*", "*", "op_...
https://github.com/google/prettytensor/blob/75daa0b11252590f548da5647addc0ea610c4c45/prettytensor/pretty_tensor_methods.py#L412-L424
fkie/multimaster_fkie
3d23df29d25d71a75c66bbd3cc6e9cbb255724d8
fkie_node_manager/src/fkie_node_manager/editor/text_search_frame.py
python
TextSearchFrame._update_label
(self, clear_label=False)
Updates the status label for search results. The info is created from search result lists.
Updates the status label for search results. The info is created from search result lists.
[ "Updates", "the", "status", "label", "for", "search", "results", ".", "The", "info", "is", "created", "from", "search", "result", "lists", "." ]
def _update_label(self, clear_label=False): ''' Updates the status label for search results. The info is created from search result lists. ''' msg = ' ' if self.search_results: count_files = len(self.search_results_fileset) msg = '%d/%d' % (self._search_re...
[ "def", "_update_label", "(", "self", ",", "clear_label", "=", "False", ")", ":", "msg", "=", "' '", "if", "self", ".", "search_results", ":", "count_files", "=", "len", "(", "self", ".", "search_results_fileset", ")", "msg", "=", "'%d/%d'", "%", "(", "se...
https://github.com/fkie/multimaster_fkie/blob/3d23df29d25d71a75c66bbd3cc6e9cbb255724d8/fkie_node_manager/src/fkie_node_manager/editor/text_search_frame.py#L341-L360
BEEmod/BEE2.4
02767f3cf476581789425ab308ca1bea978f6a74
src/app/itemconfig.py
python
widget_checkmark_multi
( parent: tk.Frame, values: List[Tuple[str, tk.StringVar]], conf: Property, )
return parent
For checkmarks, display in a more compact form.
For checkmarks, display in a more compact form.
[ "For", "checkmarks", "display", "in", "a", "more", "compact", "form", "." ]
def widget_checkmark_multi( parent: tk.Frame, values: List[Tuple[str, tk.StringVar]], conf: Property, ) -> tk.Widget: """For checkmarks, display in a more compact form.""" for row, column, tim_text, var in multi_grid(values): checkbox = widget_checkmark(parent, var, conf) checkbox.gr...
[ "def", "widget_checkmark_multi", "(", "parent", ":", "tk", ".", "Frame", ",", "values", ":", "List", "[", "Tuple", "[", "str", ",", "tk", ".", "StringVar", "]", "]", ",", "conf", ":", "Property", ",", ")", "->", "tk", ".", "Widget", ":", "for", "ro...
https://github.com/BEEmod/BEE2.4/blob/02767f3cf476581789425ab308ca1bea978f6a74/src/app/itemconfig.py#L510-L520
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/locations/models.py
python
LocationQueriesMixin.accessible_to_user
(self, domain, user)
return SQLLocation.objects.get_locations_and_children(assigned_location_ids)
[]
def accessible_to_user(self, domain, user): if user.has_permission(domain, 'access_all_locations'): return self.filter(domain=domain) assigned_location_ids = user.get_location_ids(domain) if not assigned_location_ids: return self.none() # No locations are assigned to th...
[ "def", "accessible_to_user", "(", "self", ",", "domain", ",", "user", ")", ":", "if", "user", ".", "has_permission", "(", "domain", ",", "'access_all_locations'", ")", ":", "return", "self", ".", "filter", "(", "domain", "=", "domain", ")", "assigned_locatio...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/locations/models.py#L252-L260
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/objects/ocel/util/log_ocel.py
python
from_traditional_log
(log: EventLog, parameters: Optional[Dict[Any, Any]] = None)
return OCEL(events=events, objects=objects, relations=relations)
Transforms an EventLog to an OCEL Parameters ----------------- log Event log parameters Parameters of the algorithm, including: - Parameters.TARGET_OBJECT_TYPE => the name of the object type to which the cases should be mapped - Parameters.ACTIVITY_KEY => the attribute t...
Transforms an EventLog to an OCEL
[ "Transforms", "an", "EventLog", "to", "an", "OCEL" ]
def from_traditional_log(log: EventLog, parameters: Optional[Dict[Any, Any]] = None) -> OCEL: """ Transforms an EventLog to an OCEL Parameters ----------------- log Event log parameters Parameters of the algorithm, including: - Parameters.TARGET_OBJECT_TYPE => the name o...
[ "def", "from_traditional_log", "(", "log", ":", "EventLog", ",", "parameters", ":", "Optional", "[", "Dict", "[", "Any", ",", "Any", "]", "]", "=", "None", ")", "->", "OCEL", ":", "if", "parameters", "is", "None", ":", "parameters", "=", "{", "}", "l...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/objects/ocel/util/log_ocel.py#L39-L101
Netflix/security_monkey
c28592ffd518fa399527d26262683fc860c30eef
security_monkey/watcher.py
python
Watcher.find_deleted
(self, previous=[], current=[], exception_map={})
Find any items that have been deleted since the last run of the watcher. Add these items to the deleted_items list.
Find any items that have been deleted since the last run of the watcher. Add these items to the deleted_items list.
[ "Find", "any", "items", "that", "have", "been", "deleted", "since", "the", "last", "run", "of", "the", "watcher", ".", "Add", "these", "items", "to", "the", "deleted_items", "list", "." ]
def find_deleted(self, previous=[], current=[], exception_map={}): """ Find any items that have been deleted since the last run of the watcher. Add these items to the deleted_items list. """ prev_map = {item.location(): item for item in previous} curr_map = {item.location...
[ "def", "find_deleted", "(", "self", ",", "previous", "=", "[", "]", ",", "current", "=", "[", "]", ",", "exception_map", "=", "{", "}", ")", ":", "prev_map", "=", "{", "item", ".", "location", "(", ")", ":", "item", "for", "item", "in", "previous",...
https://github.com/Netflix/security_monkey/blob/c28592ffd518fa399527d26262683fc860c30eef/security_monkey/watcher.py#L280-L295
fboender/ansible-cmdb
3f3e412d2a7be91c97c5a1842f4e57cc85b06961
src/ansiblecmdb/render.py
python
Render._tpl_possibilities
(self)
return tpl_possibilities
Construct a list of possible paths to templates.
Construct a list of possible paths to templates.
[ "Construct", "a", "list", "of", "possible", "paths", "to", "templates", "." ]
def _tpl_possibilities(self): """ Construct a list of possible paths to templates. """ tpl_possibilities = [ os.path.realpath(self.tpl) ] for tpl_dir in self.tpl_dirs: tpl_possibilities.append(os.path.realpath(os.path.join(tpl_dir, "{0}.tpl".format...
[ "def", "_tpl_possibilities", "(", "self", ")", ":", "tpl_possibilities", "=", "[", "os", ".", "path", ".", "realpath", "(", "self", ".", "tpl", ")", "]", "for", "tpl_dir", "in", "self", ".", "tpl_dirs", ":", "tpl_possibilities", ".", "append", "(", "os",...
https://github.com/fboender/ansible-cmdb/blob/3f3e412d2a7be91c97c5a1842f4e57cc85b06961/src/ansiblecmdb/render.py#L22-L33
dmlc/dgl
8d14a739bc9e446d6c92ef83eafe5782398118de
python/dgl/distributed/rpc.py
python
register_sig_handler
()
Register for handling signal event.
Register for handling signal event.
[ "Register", "for", "handling", "signal", "event", "." ]
def register_sig_handler(): """Register for handling signal event. """ _CAPI_DGLRPCHandleSignal()
[ "def", "register_sig_handler", "(", ")", ":", "_CAPI_DGLRPCHandleSignal", "(", ")" ]
https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/distributed/rpc.py#L989-L992
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py
python
OpenShiftCLI._version
(self)
return self.openshift_cmd(['version'], output=True, output_type='raw')
return the openshift version
return the openshift version
[ "return", "the", "openshift", "version" ]
def _version(self): ''' return the openshift version''' return self.openshift_cmd(['version'], output=True, output_type='raw')
[ "def", "_version", "(", "self", ")", ":", "return", "self", ".", "openshift_cmd", "(", "[", "'version'", "]", ",", "output", "=", "True", ",", "output_type", "=", "'raw'", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_label.py#L1093-L1095
DataBiosphere/toil
2e148eee2114ece8dcc3ec8a83f36333266ece0d
src/toil/fileStores/cachingFileStore.py
python
CachingFileStore.__del__
(self)
Cleanup function that is run when destroying the class instance that ensures that all the file writing threads exit.
Cleanup function that is run when destroying the class instance that ensures that all the file writing threads exit.
[ "Cleanup", "function", "that", "is", "run", "when", "destroying", "the", "class", "instance", "that", "ensures", "that", "all", "the", "file", "writing", "threads", "exit", "." ]
def __del__(self): """ Cleanup function that is run when destroying the class instance that ensures that all the file writing threads exit. """ self.waitForCommit()
[ "def", "__del__", "(", "self", ")", ":", "self", ".", "waitForCommit", "(", ")" ]
https://github.com/DataBiosphere/toil/blob/2e148eee2114ece8dcc3ec8a83f36333266ece0d/src/toil/fileStores/cachingFileStore.py#L1921-L1927
spotify/luigi
c3b66f4a5fa7eaa52f9a72eb6704b1049035c789
luigi/contrib/s3.py
python
S3Client.get_as_bytes
(self, s3_path)
return contents
Get the contents of an object stored in S3 as bytes :param s3_path: URL for target S3 location :return: File contents as pure bytes
Get the contents of an object stored in S3 as bytes
[ "Get", "the", "contents", "of", "an", "object", "stored", "in", "S3", "as", "bytes" ]
def get_as_bytes(self, s3_path): """ Get the contents of an object stored in S3 as bytes :param s3_path: URL for target S3 location :return: File contents as pure bytes """ (bucket, key) = self._path_to_bucket_and_key(s3_path) obj = self.s3.Object(bucket, key) ...
[ "def", "get_as_bytes", "(", "self", ",", "s3_path", ")", ":", "(", "bucket", ",", "key", ")", "=", "self", ".", "_path_to_bucket_and_key", "(", "s3_path", ")", "obj", "=", "self", ".", "s3", ".", "Object", "(", "bucket", ",", "key", ")", "contents", ...
https://github.com/spotify/luigi/blob/c3b66f4a5fa7eaa52f9a72eb6704b1049035c789/luigi/contrib/s3.py#L367-L377
jyapayne/Web2Executable
027b01914e4faecfa038169d477851de0cbd9b96
main.py
python
MainWindow.create_text_input_setting
(self, name)
return hlayout
Create a generic text input with the setting name.
Create a generic text input with the setting name.
[ "Create", "a", "generic", "text", "input", "with", "the", "setting", "name", "." ]
def create_text_input_setting(self, name): """Create a generic text input with the setting name.""" hlayout = QtWidgets.QHBoxLayout() setting = self.get_setting(name) text = QtWidgets.QLineEdit() text.setValidator(Validator(setting.filter, setting.filter_action)) text.s...
[ "def", "create_text_input_setting", "(", "self", ",", "name", ")", ":", "hlayout", "=", "QtWidgets", ".", "QHBoxLayout", "(", ")", "setting", "=", "self", ".", "get_setting", "(", "name", ")", "text", "=", "QtWidgets", ".", "QLineEdit", "(", ")", "text", ...
https://github.com/jyapayne/Web2Executable/blob/027b01914e4faecfa038169d477851de0cbd9b96/main.py#L1393-L1412
tensorflow/privacy
867f3d4c5566b21433a6a1bed998094d1479b4d5
tensorflow_privacy/privacy/logistic_regression/multinomial_logistic.py
python
compute_dpsgd_noise_multiplier
( num_train: int, epsilon: float, delta: float, epochs: int, batch_size: int, tolerance: float = 1e-2)
return common.inverse_monotone_function( lambda x: compute_epsilon(num_train, batch_size, x, epochs, delta)[0], epsilon, search_parameters)
Computes the noise multiplier for DP-SGD given privacy parameters. The algorithm performs binary search on the values of epsilon. Args: num_train: number of input training points. epsilon: epsilon parameter in (epsilon, delta)-DP. delta: delta parameter in (epsilon, delta)-DP. epochs: number of ...
Computes the noise multiplier for DP-SGD given privacy parameters.
[ "Computes", "the", "noise", "multiplier", "for", "DP", "-", "SGD", "given", "privacy", "parameters", "." ]
def compute_dpsgd_noise_multiplier( num_train: int, epsilon: float, delta: float, epochs: int, batch_size: int, tolerance: float = 1e-2) -> Optional[float]: """Computes the noise multiplier for DP-SGD given privacy parameters. The algorithm performs binary search on the values of epsilon. Args: nu...
[ "def", "compute_dpsgd_noise_multiplier", "(", "num_train", ":", "int", ",", "epsilon", ":", "float", ",", "delta", ":", "float", ",", "epochs", ":", "int", ",", "batch_size", ":", "int", ",", "tolerance", ":", "float", "=", "1e-2", ")", "->", "Optional", ...
https://github.com/tensorflow/privacy/blob/867f3d4c5566b21433a6a1bed998094d1479b4d5/tensorflow_privacy/privacy/logistic_regression/multinomial_logistic.py#L134-L162
tahoe-lafs/tahoe-lafs
766a53b5208c03c45ca0a98e97eee76870276aa1
src/allmydata/immutable/downloader/node.py
python
DownloadNode.get_segsize
(self)
return d
Return a Deferred that fires when we know the real segment size.
Return a Deferred that fires when we know the real segment size.
[ "Return", "a", "Deferred", "that", "fires", "when", "we", "know", "the", "real", "segment", "size", "." ]
def get_segsize(self): """Return a Deferred that fires when we know the real segment size.""" if self.segment_size: return defer.succeed(self.segment_size) # TODO: this downloads (and discards) the first segment of the file. # We could make this more efficient by writing ...
[ "def", "get_segsize", "(", "self", ")", ":", "if", "self", ".", "segment_size", ":", "return", "defer", ".", "succeed", "(", "self", ".", "segment_size", ")", "# TODO: this downloads (and discards) the first segment of the file.", "# We could make this more efficient by wri...
https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/immutable/downloader/node.py#L222-L235
zuoym15/craves.ai
f4bd1ed90562748257749b3c98431f6ffcaaed84
unreal/virtual_db/vdb.py
python
Dataset.get_cams
(self)
return cams
Get camera names of this dataset
Get camera names of this dataset
[ "Get", "camera", "names", "of", "this", "dataset" ]
def get_cams(self): ''' Get camera names of this dataset ''' cams = [os.path.basename(v) for v in glob.glob(os.path.join(self.db_root_dir, '*')) if os.path.isdir(v)] # Remove special data folders # cams = list(set(cams) - set(['summary'])) cams = [v for v in cams if v.lower().fin...
[ "def", "get_cams", "(", "self", ")", ":", "cams", "=", "[", "os", ".", "path", ".", "basename", "(", "v", ")", "for", "v", "in", "glob", ".", "glob", "(", "os", ".", "path", ".", "join", "(", "self", ".", "db_root_dir", ",", "'*'", ")", ")", ...
https://github.com/zuoym15/craves.ai/blob/f4bd1ed90562748257749b3c98431f6ffcaaed84/unreal/virtual_db/vdb.py#L22-L28
Alexander-H-Liu/End-to-end-ASR-Pytorch
1103d144423e8e692f1d18cd9db27a96cb49fb9d
src/module.py
python
VGGExtractor.forward
(self, feature, feat_len)
return feature, feat_len
[]
def forward(self, feature, feat_len): # Feature shape BSxTxD -> BS x CH(num of delta) x T x D(acoustic feature dim) feature, feat_len = self.view_input(feature, feat_len) # Foward feature = self.extractor(feature) # BSx128xT/4xD/4 -> BSxT/4x128xD/4 feature = feature.trans...
[ "def", "forward", "(", "self", ",", "feature", ",", "feat_len", ")", ":", "# Feature shape BSxTxD -> BS x CH(num of delta) x T x D(acoustic feature dim)", "feature", ",", "feat_len", "=", "self", ".", "view_input", "(", "feature", ",", "feat_len", ")", "# Foward", "fe...
https://github.com/Alexander-H-Liu/End-to-end-ASR-Pytorch/blob/1103d144423e8e692f1d18cd9db27a96cb49fb9d/src/module.py#L57-L66
python-rope/rope
bcdfe6b70b1437d976e21c56b6ec1281b22823aa
rope/base/default_config.py
python
project_opened
(project)
This function is called after opening the project
This function is called after opening the project
[ "This", "function", "is", "called", "after", "opening", "the", "project" ]
def project_opened(project): """This function is called after opening the project"""
[ "def", "project_opened", "(", "project", ")", ":" ]
https://github.com/python-rope/rope/blob/bcdfe6b70b1437d976e21c56b6ec1281b22823aa/rope/base/default_config.py#L123-L124
robhagemans/pcbasic
c3a043b46af66623a801e18a38175be077251ada
pcbasic/basic/implementation.py
python
Implementation.term_
(self, args)
TERM: terminal emulator.
TERM: terminal emulator.
[ "TERM", ":", "terminal", "emulator", "." ]
def term_(self, args): """TERM: terminal emulator.""" list(args) self._clear_all() self.interpreter.tron = False if not self._term_program: # on Tandy, raises Internal Error # and deletes the program currently in memory raise error.BASICError(e...
[ "def", "term_", "(", "self", ",", "args", ")", ":", "list", "(", "args", ")", "self", ".", "_clear_all", "(", ")", "self", ".", "interpreter", ".", "tron", "=", "False", "if", "not", "self", ".", "_term_program", ":", "# on Tandy, raises Internal Error", ...
https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/implementation.py#L505-L520
WZMIAOMIAO/deep-learning-for-image-processing
a4502c284958d4bf78fb77b089a90e7688ddc196
pytorch_object_detection/train_coco_dataset/validation.py
python
summarize
(self, catId=None)
return stats, print_info
Compute and display summary metrics for evaluation results. Note this functin can *only* be applied on the default parameter setting
Compute and display summary metrics for evaluation results. Note this functin can *only* be applied on the default parameter setting
[ "Compute", "and", "display", "summary", "metrics", "for", "evaluation", "results", ".", "Note", "this", "functin", "can", "*", "only", "*", "be", "applied", "on", "the", "default", "parameter", "setting" ]
def summarize(self, catId=None): """ Compute and display summary metrics for evaluation results. Note this functin can *only* be applied on the default parameter setting """ def _summarize(ap=1, iouThr=None, areaRng='all', maxDets=100): p = self.params iStr = ' {:<18} {} @[ IoU={:<9...
[ "def", "summarize", "(", "self", ",", "catId", "=", "None", ")", ":", "def", "_summarize", "(", "ap", "=", "1", ",", "iouThr", "=", "None", ",", "areaRng", "=", "'all'", ",", "maxDets", "=", "100", ")", ":", "p", "=", "self", ".", "params", "iStr...
https://github.com/WZMIAOMIAO/deep-learning-for-image-processing/blob/a4502c284958d4bf78fb77b089a90e7688ddc196/pytorch_object_detection/train_coco_dataset/validation.py#L21-L90
Theano/Theano
8fd9203edfeecebced9344b0c70193be292a9ade
theano/gof/graph.py
python
ancestors
(variable_list, blockers=None)
return dfs_variables
Return the variables that contribute to those in variable_list (inclusive). Parameters ---------- variable_list : list of `Variable` instances Output `Variable` instances from which to search backward through owners. Returns ------- list of `Variable` instances All inpu...
Return the variables that contribute to those in variable_list (inclusive).
[ "Return", "the", "variables", "that", "contribute", "to", "those", "in", "variable_list", "(", "inclusive", ")", "." ]
def ancestors(variable_list, blockers=None): """ Return the variables that contribute to those in variable_list (inclusive). Parameters ---------- variable_list : list of `Variable` instances Output `Variable` instances from which to search backward through owners. Returns ...
[ "def", "ancestors", "(", "variable_list", ",", "blockers", "=", "None", ")", ":", "def", "expand", "(", "r", ")", ":", "if", "r", ".", "owner", "and", "(", "not", "blockers", "or", "r", "not", "in", "blockers", ")", ":", "return", "reversed", "(", ...
https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/gof/graph.py#L685-L706
pantsbuild/pex
473c6ac732ed4bc338b4b20a9ec930d1d722c9b4
pex/vendor/_vendored/pip/pip/_vendor/html5lib/filters/optionaltags.py
python
Filter.slider
(self)
[]
def slider(self): previous1 = previous2 = None for token in self.source: if previous1 is not None: yield previous2, previous1, token previous2 = previous1 previous1 = token if previous1 is not None: yield previous2, previous1, None
[ "def", "slider", "(", "self", ")", ":", "previous1", "=", "previous2", "=", "None", "for", "token", "in", "self", ".", "source", ":", "if", "previous1", "is", "not", "None", ":", "yield", "previous2", ",", "previous1", ",", "token", "previous2", "=", "...
https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_vendor/html5lib/filters/optionaltags.py#L8-L16
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/asyncio/events.py
python
_get_running_loop
()
Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific.
Return the running event loop or None.
[ "Return", "the", "running", "event", "loop", "or", "None", "." ]
def _get_running_loop(): """Return the running event loop or None. This is a low-level function intended to be used by event loops. This function is thread-specific. """ # NOTE: this function is implemented in C (see _asynciomodule.c) running_loop, pid = _running_loop.loop_pid if running_lo...
[ "def", "_get_running_loop", "(", ")", ":", "# NOTE: this function is implemented in C (see _asynciomodule.c)", "running_loop", ",", "pid", "=", "_running_loop", ".", "loop_pid", "if", "running_loop", "is", "not", "None", "and", "pid", "==", "os", ".", "getpid", "(", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/events.py#L689-L698
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/dna/model/pam3plus5_ops.py
python
find_Pl_between
(s1, s2)
Assume s1 and s2 are Ss3 and/or Ss5 atoms which might be directly bonded or might have a Pl5 between them. If they are directly bonded, return None. If they have a Pl between them, return it. If neither is true, raise an exception.
Assume s1 and s2 are Ss3 and/or Ss5 atoms which might be directly bonded or might have a Pl5 between them. If they are directly bonded, return None. If they have a Pl between them, return it. If neither is true, raise an exception.
[ "Assume", "s1", "and", "s2", "are", "Ss3", "and", "/", "or", "Ss5", "atoms", "which", "might", "be", "directly", "bonded", "or", "might", "have", "a", "Pl5", "between", "them", ".", "If", "they", "are", "directly", "bonded", "return", "None", ".", "If"...
def find_Pl_between(s1, s2): #bruce 080409 """ Assume s1 and s2 are Ss3 and/or Ss5 atoms which might be directly bonded or might have a Pl5 between them. If they are directly bonded, return None. If they have a Pl between them, return it. If neither is true, raise an exception. """ # opt...
[ "def", "find_Pl_between", "(", "s1", ",", "s2", ")", ":", "#bruce 080409", "# optimize for the Pl being found", "bond1", ",", "bond2", "=", "find_Pl_bonds", "(", "s1", ",", "s2", ")", "if", "bond1", ":", "return", "bond1", ".", "other", "(", "s1", ")", "el...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/model/pam3plus5_ops.py#L403-L418
deepfakes/faceswap
09c7d8aca3c608d1afad941ea78e9fd9b64d9219
lib/align/detected_face.py
python
BlurMask._multipass_factor
(self)
return factor[self._blur_type]
For multiple passes the kernel must be scaled down. This value is different for box filter and gaussian
For multiple passes the kernel must be scaled down. This value is different for box filter and gaussian
[ "For", "multiple", "passes", "the", "kernel", "must", "be", "scaled", "down", ".", "This", "value", "is", "different", "for", "box", "filter", "and", "gaussian" ]
def _multipass_factor(self): """ For multiple passes the kernel must be scaled down. This value is different for box filter and gaussian """ factor = dict(gaussian=0.8, normalized=0.5) return factor[self._blur_type]
[ "def", "_multipass_factor", "(", "self", ")", ":", "factor", "=", "dict", "(", "gaussian", "=", "0.8", ",", "normalized", "=", "0.5", ")", "return", "factor", "[", "self", ".", "_blur_type", "]" ]
https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/align/detected_face.py#L799-L803
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/webapps/galaxy/services/history_contents.py
python
HistoriesContentsService.update_permissions
( self, trans, history_content_id: EncodedDatabaseIdField, payload: UpdateDatasetPermissionsPayload, )
return DatasetAssociationRoles.parse_obj(roles)
Set permissions of the given dataset to the given role ids. :param payload: dictionary structure containing: :param action: (required) describes what action should be performed available actions: make_private, remove_restrictions, set_permissions :...
Set permissions of the given dataset to the given role ids.
[ "Set", "permissions", "of", "the", "given", "dataset", "to", "the", "given", "role", "ids", "." ]
def update_permissions( self, trans, history_content_id: EncodedDatabaseIdField, payload: UpdateDatasetPermissionsPayload, ) -> DatasetAssociationRoles: """ Set permissions of the given dataset to the given role ids. :param payload: dictionary structure containing:...
[ "def", "update_permissions", "(", "self", ",", "trans", ",", "history_content_id", ":", "EncodedDatabaseIdField", ",", "payload", ":", "UpdateDatasetPermissionsPayload", ",", ")", "->", "DatasetAssociationRoles", ":", "payload_dict", "=", "payload", ".", "dict", "(", ...
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/webapps/galaxy/services/history_contents.py#L368-L395
okpy/ok
50a00190f05363d096478dd8e53aa1a36dd40c4a
server/jobs/__init__.py
python
get_job_logger
()
return logging.getLogger('{}.job_{}'.format(__name__, get_current_job().id))
[]
def get_job_logger(): return logging.getLogger('{}.job_{}'.format(__name__, get_current_job().id))
[ "def", "get_job_logger", "(", ")", ":", "return", "logging", ".", "getLogger", "(", "'{}.job_{}'", ".", "format", "(", "__name__", ",", "get_current_job", "(", ")", ".", "id", ")", ")" ]
https://github.com/okpy/ok/blob/50a00190f05363d096478dd8e53aa1a36dd40c4a/server/jobs/__init__.py#L38-L39
OWASP/ZSC
5bb9fed69efdc17996be4856b54af632aaed87b0
module/readline_windows/pyreadline/modes/basemode.py
python
BaseMode.downcase_word
(self, e)
Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move the cursor.
Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move the cursor.
[ "Lowercase", "the", "current", "(", "or", "following", ")", "word", ".", "With", "a", "negative", "argument", "lowercase", "the", "previous", "word", "but", "do", "not", "move", "the", "cursor", "." ]
def downcase_word(self, e): # (M-l) """Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move the cursor.""" self.l_buffer.downcase_word() self.finalize()
[ "def", "downcase_word", "(", "self", ",", "e", ")", ":", "# (M-l)", "self", ".", "l_buffer", ".", "downcase_word", "(", ")", "self", ".", "finalize", "(", ")" ]
https://github.com/OWASP/ZSC/blob/5bb9fed69efdc17996be4856b54af632aaed87b0/module/readline_windows/pyreadline/modes/basemode.py#L418-L422