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
wwj718/paperweekly_forum
76185ef126626b7079d0fc34c915c440fe937959
wechat_bot/wxbot.py
python
WXBot.add_friend_to_group
(self,uid,group_name)
return dic['BaseResponse']['Ret'] == 0
将好友加入到群聊中
将好友加入到群聊中
[ "将好友加入到群聊中" ]
def add_friend_to_group(self,uid,group_name): """ 将好友加入到群聊中 """ gid = '' #通过群名获取群id,群没保存到通讯录中的话无法添加哦 for group in self.group_list: if group['NickName'] == group_name: gid = group['UserName'] if gid == '': return False ...
[ "def", "add_friend_to_group", "(", "self", ",", "uid", ",", "group_name", ")", ":", "gid", "=", "''", "#通过群名获取群id,群没保存到通讯录中的话无法添加哦", "for", "group", "in", "self", ".", "group_list", ":", "if", "group", "[", "'NickName'", "]", "==", "group_name", ":", "gid", ...
https://github.com/wwj718/paperweekly_forum/blob/76185ef126626b7079d0fc34c915c440fe937959/wechat_bot/wxbot.py#L714-L743
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py
python
DistPathLocator.__init__
(self, distpath, **kwargs)
Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search.
Initialise an instance.
[ "Initialise", "an", "instance", "." ]
def __init__(self, distpath, **kwargs): """ Initialise an instance. :param distpath: A :class:`DistributionPath` instance to search. """ super(DistPathLocator, self).__init__(**kwargs) assert isinstance(distpath, DistributionPath) self.distpath = distpath
[ "def", "__init__", "(", "self", ",", "distpath", ",", "*", "*", "kwargs", ")", ":", "super", "(", "DistPathLocator", ",", "self", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "assert", "isinstance", "(", "distpath", ",", "DistributionPath", ")", ...
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L924-L932
maciejkula/spotlight
75f4c8c55090771b52b88ef1a00f75bb39f9f2a9
spotlight/sequence/implicit.py
python
ImplicitSequenceModel.fit
(self, interactions, verbose=False)
Fit the model. When called repeatedly, model fitting will resume from the point at which training stopped in the previous fit call. Parameters ---------- interactions: :class:`spotlight.interactions.SequenceInteractions` The input sequence dataset.
Fit the model.
[ "Fit", "the", "model", "." ]
def fit(self, interactions, verbose=False): """ Fit the model. When called repeatedly, model fitting will resume from the point at which training stopped in the previous fit call. Parameters ---------- interactions: :class:`spotlight.interactions.Sequen...
[ "def", "fit", "(", "self", ",", "interactions", ",", "verbose", "=", "False", ")", ":", "sequences", "=", "interactions", ".", "sequences", ".", "astype", "(", "np", ".", "int64", ")", "if", "not", "self", ".", "_initialized", ":", "self", ".", "_initi...
https://github.com/maciejkula/spotlight/blob/75f4c8c55090771b52b88ef1a00f75bb39f9f2a9/spotlight/sequence/implicit.py#L193-L264
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/idlelib/UndoDelegator.py
python
CommandSequence.__len__
(self)
return len(self.cmds)
[]
def __len__(self): return len(self.cmds)
[ "def", "__len__", "(", "self", ")", ":", "return", "len", "(", "self", ".", "cmds", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/UndoDelegator.py#L316-L317
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/middleware/common.py
python
CommonMiddleware.process_request
(self, request)
return http.HttpResponsePermanentRedirect(newurl)
Check for denied User-Agents and rewrite the URL based on settings.APPEND_SLASH and settings.PREPEND_WWW
Check for denied User-Agents and rewrite the URL based on settings.APPEND_SLASH and settings.PREPEND_WWW
[ "Check", "for", "denied", "User", "-", "Agents", "and", "rewrite", "the", "URL", "based", "on", "settings", ".", "APPEND_SLASH", "and", "settings", ".", "PREPEND_WWW" ]
def process_request(self, request): """ Check for denied User-Agents and rewrite the URL based on settings.APPEND_SLASH and settings.PREPEND_WWW """ # check that the models file has not been modified # import os # print os.path.getsize("C:/dev/gitsta...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "# check that the models file has not been modified", "# import os", "# print os.path.getsize(\"C:/dev/gitstack/app/gitstack/models.pyc\")", "# print os.path.getsize(\"C:/dev/gitstack/app/gitstack/license.pyc\")", "model_size",...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/middleware/common.py#L35-L113
grantmcconnaughey/cookiecutter-django-vue-graphql-aws
3978e14380fdfac6f2f5981d3a7ffdd2d16cbce2
{{cookiecutter.project_slug}}/backend/psycopg2/_json.py
python
_create_json_typecasters
(oid, array_oid, loads=None, name='JSON')
return JSON, JSONARRAY
Create typecasters for json data type.
Create typecasters for json data type.
[ "Create", "typecasters", "for", "json", "data", "type", "." ]
def _create_json_typecasters(oid, array_oid, loads=None, name='JSON'): """Create typecasters for json data type.""" if loads is None: if json is None: raise ImportError("no json module available") else: loads = json.loads def typecast_json(s, cur): if s is No...
[ "def", "_create_json_typecasters", "(", "oid", ",", "array_oid", ",", "loads", "=", "None", ",", "name", "=", "'JSON'", ")", ":", "if", "loads", "is", "None", ":", "if", "json", "is", "None", ":", "raise", "ImportError", "(", "\"no json module available\"", ...
https://github.com/grantmcconnaughey/cookiecutter-django-vue-graphql-aws/blob/3978e14380fdfac6f2f5981d3a7ffdd2d16cbce2/{{cookiecutter.project_slug}}/backend/psycopg2/_json.py#L174-L193
sentinel-hub/eo-learn
cf964eaf173668d6a374675dbd7c1d244264c11d
geometry/eolearn/geometry/transformations.py
python
RasterToVectorTask._vectorize_single_raster
(self, raster, affine_transform, crs, timestamp=None)
return vector_data
Vectorizes a data slice of a single time component :param raster: Numpy array or shape (height, width, channels) :type raster: numpy.ndarray :param affine_transform: Object holding a transform vector (i.e. geographical location vector) of the raster :type affine_transform: affine.Affine...
Vectorizes a data slice of a single time component
[ "Vectorizes", "a", "data", "slice", "of", "a", "single", "time", "component" ]
def _vectorize_single_raster(self, raster, affine_transform, crs, timestamp=None): """ Vectorizes a data slice of a single time component :param raster: Numpy array or shape (height, width, channels) :type raster: numpy.ndarray :param affine_transform: Object holding a transform vector ...
[ "def", "_vectorize_single_raster", "(", "self", ",", "raster", ",", "affine_transform", ",", "crs", ",", "timestamp", "=", "None", ")", ":", "mask", "=", "None", "if", "self", ".", "values", ":", "mask", "=", "np", ".", "zeros", "(", "raster", ".", "sh...
https://github.com/sentinel-hub/eo-learn/blob/cf964eaf173668d6a374675dbd7c1d244264c11d/geometry/eolearn/geometry/transformations.py#L368-L408
facebookarchive/augmented-traffic-control
575720854de4f609b6209028857ec8d81efcf654
atc/atcd/atcd/AtcdThriftHandlerTask.py
python
AtcdThriftHandlerTask._cleanup_packet_capture_procs
(self)
Delete finished procs from the map
Delete finished procs from the map
[ "Delete", "finished", "procs", "from", "the", "map" ]
def _cleanup_packet_capture_procs(self): '''Delete finished procs from the map''' for ip, p in self.ip_to_pcap_proc_map.items(): if not p or p.poll() is not None: del self.ip_to_pcap_proc_map[ip]
[ "def", "_cleanup_packet_capture_procs", "(", "self", ")", ":", "for", "ip", ",", "p", "in", "self", ".", "ip_to_pcap_proc_map", ".", "items", "(", ")", ":", "if", "not", "p", "or", "p", ".", "poll", "(", ")", "is", "not", "None", ":", "del", "self", ...
https://github.com/facebookarchive/augmented-traffic-control/blob/575720854de4f609b6209028857ec8d81efcf654/atc/atcd/atcd/AtcdThriftHandlerTask.py#L583-L587
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/cnt/model/NanotubeSegment.py
python
NanotubeSegment.edit
(self)
return
Edit this NanotubeSegment. @see: EditNanotube_EditCommand
Edit this NanotubeSegment.
[ "Edit", "this", "NanotubeSegment", "." ]
def edit(self): """ Edit this NanotubeSegment. @see: EditNanotube_EditCommand """ commandSequencer = self.assy.w.commandSequencer commandSequencer.userEnterCommand('EDIT_NANOTUBE') assert commandSequencer.currentCommand.commandName == 'EDIT_NANOTUBE' comma...
[ "def", "edit", "(", "self", ")", ":", "commandSequencer", "=", "self", ".", "assy", ".", "w", ".", "commandSequencer", "commandSequencer", ".", "userEnterCommand", "(", "'EDIT_NANOTUBE'", ")", "assert", "commandSequencer", ".", "currentCommand", ".", "commandName"...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/cnt/model/NanotubeSegment.py#L125-L134
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/multiprocessing/synchronize.py
python
RLock.__repr__
(self)
return '<RLock(%s, %s)>' % (name, count)
[]
def __repr__(self): try: if self._semlock._is_mine(): name = current_process().name if threading.current_thread().name != 'MainThread': name += '|' + threading.current_thread().name count = self._semlock._count() elif se...
[ "def", "__repr__", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_semlock", ".", "_is_mine", "(", ")", ":", "name", "=", "current_process", "(", ")", ".", "name", "if", "threading", ".", "current_thread", "(", ")", ".", "name", "!=", "'MainT...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/multiprocessing/synchronize.py#L174-L189
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py
python
OpenShiftCLI._schedulable
(self, node=None, selector=None, schedulable=True)
return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw')
perform oadm manage-node scheduable
perform oadm manage-node scheduable
[ "perform", "oadm", "manage", "-", "node", "scheduable" ]
def _schedulable(self, node=None, selector=None, schedulable=True): ''' perform oadm manage-node scheduable ''' cmd = ['manage-node'] if node: cmd.extend(node) else: cmd.append('--selector={}'.format(selector)) cmd.append('--schedulable={}'.format(schedul...
[ "def", "_schedulable", "(", "self", ",", "node", "=", "None", ",", "selector", "=", "None", ",", "schedulable", "=", "True", ")", ":", "cmd", "=", "[", "'manage-node'", "]", "if", "node", ":", "cmd", ".", "extend", "(", "node", ")", "else", ":", "c...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_policy_group.py#L1017-L1027
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/flowchart/library/functions.py
python
besselFilter
(data, cutoff, order=1, dt=None, btype='low', bidir=True)
return applyFilter(data, b, a, bidir=bidir)
return data passed through bessel filter
return data passed through bessel filter
[ "return", "data", "passed", "through", "bessel", "filter" ]
def besselFilter(data, cutoff, order=1, dt=None, btype='low', bidir=True): """return data passed through bessel filter""" try: import scipy.signal except ImportError: raise Exception("besselFilter() requires the package scipy.signal.") if dt is None: try: tvals =...
[ "def", "besselFilter", "(", "data", ",", "cutoff", ",", "order", "=", "1", ",", "dt", "=", "None", ",", "btype", "=", "'low'", ",", "bidir", "=", "True", ")", ":", "try", ":", "import", "scipy", ".", "signal", "except", "ImportError", ":", "raise", ...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/flowchart/library/functions.py#L74-L90
Bitmessage/PyBitmessage
97612b049e0453867d6d90aa628f8e7b007b4d85
src/network/udp.py
python
UDPSocket.set_socket_reuse
(self)
Set socket reuse option
Set socket reuse option
[ "Set", "socket", "reuse", "option" ]
def set_socket_reuse(self): """Set socket reuse option""" self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) try: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) except ...
[ "def", "set_socket_reuse", "(", "self", ")", ":", "self", ".", "socket", ".", "setsockopt", "(", "socket", ".", "SOL_SOCKET", ",", "socket", ".", "SO_BROADCAST", ",", "1", ")", "self", ".", "socket", ".", "setsockopt", "(", "socket", ".", "SOL_SOCKET", "...
https://github.com/Bitmessage/PyBitmessage/blob/97612b049e0453867d6d90aa628f8e7b007b4d85/src/network/udp.py#L53-L60
splunk/splunk-sdk-python
ef88e9d3e90ab9d6cf48cf940c7376400ed759b8
examples/job.py
python
Program.perf
(self, argv)
Retrive performance info for the specified search jobs.
Retrive performance info for the specified search jobs.
[ "Retrive", "performance", "info", "for", "the", "specified", "search", "jobs", "." ]
def perf(self, argv): """Retrive performance info for the specified search jobs.""" self.foreach(argv, lambda job: pprint(job['performance']))
[ "def", "perf", "(", "self", ",", "argv", ")", ":", "self", ".", "foreach", "(", "argv", ",", "lambda", "job", ":", "pprint", "(", "job", "[", "'performance'", "]", ")", ")" ]
https://github.com/splunk/splunk-sdk-python/blob/ef88e9d3e90ab9d6cf48cf940c7376400ed759b8/examples/job.py#L205-L207
emmetio/livestyle-sublime-old
c42833c046e9b2f53ebce3df3aa926528f5a33b5
tornado/gen.py
python
Wait.__init__
(self, key)
[]
def __init__(self, key): self.key = key
[ "def", "__init__", "(", "self", ",", "key", ")", ":", "self", ".", "key", "=", "key" ]
https://github.com/emmetio/livestyle-sublime-old/blob/c42833c046e9b2f53ebce3df3aa926528f5a33b5/tornado/gen.py#L311-L312
meijieru/AtomNAS
a3ea885c5e94269c6a95140e1ee30ed750b314e8
utils/config.py
python
AttrDict.yaml
(self)
return yaml_dict
Convert object to yaml dict and return.
Convert object to yaml dict and return.
[ "Convert", "object", "to", "yaml", "dict", "and", "return", "." ]
def yaml(self): """Convert object to yaml dict and return.""" yaml_dict = {} for key in self.__dict__: value = self.__dict__[key] if isinstance(value, AttrDict): yaml_dict[key] = value.yaml() elif isinstance(value, list): if isi...
[ "def", "yaml", "(", "self", ")", ":", "yaml_dict", "=", "{", "}", "for", "key", "in", "self", ".", "__dict__", ":", "value", "=", "self", ".", "__dict__", "[", "key", "]", "if", "isinstance", "(", "value", ",", "AttrDict", ")", ":", "yaml_dict", "[...
https://github.com/meijieru/AtomNAS/blob/a3ea885c5e94269c6a95140e1ee30ed750b314e8/utils/config.py#L99-L116
openstack/cinder
23494a6d6c51451688191e1847a458f1d3cdcaa5
cinder/volume/drivers/netapp/dataontap/client/api.py
python
NaServer.set_transport_type
(self, transport_type)
Set the transport type protocol for API. Supports http and https transport types.
Set the transport type protocol for API.
[ "Set", "the", "transport", "type", "protocol", "for", "API", "." ]
def set_transport_type(self, transport_type): """Set the transport type protocol for API. Supports http and https transport types. """ if not transport_type: raise ValueError('No transport type specified') if transport_type.lower() not in ( NaServer.T...
[ "def", "set_transport_type", "(", "self", ",", "transport_type", ")", ":", "if", "not", "transport_type", ":", "raise", "ValueError", "(", "'No transport type specified'", ")", "if", "transport_type", ".", "lower", "(", ")", "not", "in", "(", "NaServer", ".", ...
https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/netapp/dataontap/client/api.py#L86-L108
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/cmds.py
python
VisualizePaths.__init__
(self, context, paths)
[]
def __init__(self, context, paths): super(VisualizePaths, self).__init__(context) context = self.context browser = utils.shell_split(prefs.history_browser(context)) if paths: self.argv = browser + ['--'] + list(paths) else: self.argv = browser
[ "def", "__init__", "(", "self", ",", "context", ",", "paths", ")", ":", "super", "(", "VisualizePaths", ",", "self", ")", ".", "__init__", "(", "context", ")", "context", "=", "self", ".", "context", "browser", "=", "utils", ".", "shell_split", "(", "p...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/cmds.py#L2751-L2758
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/identity/identity_client.py
python
IdentityClient.list_tag_namespaces
(self, compartment_id, **kwargs)
Lists the tag namespaces in the specified compartment. :param str compartment_id: (required) The OCID of the compartment (remember that the tenancy is simply the root compartment). :param str page: (optional) The value of the `opc-next-page` response header from the previous \...
Lists the tag namespaces in the specified compartment.
[ "Lists", "the", "tag", "namespaces", "in", "the", "specified", "compartment", "." ]
def list_tag_namespaces(self, compartment_id, **kwargs): """ Lists the tag namespaces in the specified compartment. :param str compartment_id: (required) The OCID of the compartment (remember that the tenancy is simply the root compartment). :param str page: (optional) ...
[ "def", "list_tag_namespaces", "(", "self", ",", "compartment_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/tagNamespaces\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs", "expected_kwargs", "=", "[", "\"retry_strategy\"", ",", "\"page\...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/identity/identity_client.py#L10030-L10126
deluge-torrent/deluge
2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc
deluge/core/rpcserver.py
python
RPCServer.get_rpc_auth_level
(self, rpc)
return self.factory.methods[rpc]._rpcserver_auth_level
Returns the auth level requirement for an exported rpc. :returns: the auth level :rtype: int
Returns the auth level requirement for an exported rpc.
[ "Returns", "the", "auth", "level", "requirement", "for", "an", "exported", "rpc", "." ]
def get_rpc_auth_level(self, rpc): """ Returns the auth level requirement for an exported rpc. :returns: the auth level :rtype: int """ return self.factory.methods[rpc]._rpcserver_auth_level
[ "def", "get_rpc_auth_level", "(", "self", ",", "rpc", ")", ":", "return", "self", ".", "factory", ".", "methods", "[", "rpc", "]", ".", "_rpcserver_auth_level" ]
https://github.com/deluge-torrent/deluge/blob/2316088f5c0dd6cb044d9d4832fa7d56dcc79cdc/deluge/core/rpcserver.py#L505-L512
facebookresearch/hgnn
2a22fdb479996c2318f85ad36d2750a383011773
utils/utils.py
python
set_seed
(seed)
Set the random seed
Set the random seed
[ "Set", "the", "random", "seed" ]
def set_seed(seed): """ Set the random seed """ random.seed(seed) np.random.seed(seed) th.manual_seed(seed) th.cuda.manual_seed(seed) th.cuda.manual_seed_all(seed)
[ "def", "set_seed", "(", "seed", ")", ":", "random", ".", "seed", "(", "seed", ")", "np", ".", "random", ".", "seed", "(", "seed", ")", "th", ".", "manual_seed", "(", "seed", ")", "th", ".", "cuda", ".", "manual_seed", "(", "seed", ")", "th", ".",...
https://github.com/facebookresearch/hgnn/blob/2a22fdb479996c2318f85ad36d2750a383011773/utils/utils.py#L121-L129
pyscf/pyscf
0adfb464333f5ceee07b664f291d4084801bae64
pyscf/ci/cisd.py
python
make_diagonal
(myci, eris)
return numpy.hstack((ehf, e1diag.reshape(-1), e2diag.reshape(-1)))
Return diagonal of CISD hamiltonian in Slater determinant basis. Note that a constant has been substracted of all elements. The first element is the HF energy (minus the constant), the next elements are the diagonal elements with singly excited determinants (<D_i^a|H|D_i^a> within the constant), then ...
Return diagonal of CISD hamiltonian in Slater determinant basis.
[ "Return", "diagonal", "of", "CISD", "hamiltonian", "in", "Slater", "determinant", "basis", "." ]
def make_diagonal(myci, eris): ''' Return diagonal of CISD hamiltonian in Slater determinant basis. Note that a constant has been substracted of all elements. The first element is the HF energy (minus the constant), the next elements are the diagonal elements with singly excited determinants (<...
[ "def", "make_diagonal", "(", "myci", ",", "eris", ")", ":", "# DO NOT use eris.mo_energy, it may differ to eris.fock.diagonal()", "mo_energy", "=", "eris", ".", "fock", ".", "diagonal", "(", ")", "nmo", "=", "mo_energy", ".", "size", "jdiag", "=", "numpy", ".", ...
https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/ci/cisd.py#L100-L153
jmcgeheeiv/pyfakefs
197e3882749ef5fc12984ba6885023663ad4f883
pyfakefs/fake_filesystem.py
python
StandardStreamWrapper.fileno
(self)
Return the file descriptor of the wrapped standard stream.
Return the file descriptor of the wrapped standard stream.
[ "Return", "the", "file", "descriptor", "of", "the", "wrapped", "standard", "stream", "." ]
def fileno(self) -> int: """Return the file descriptor of the wrapped standard stream.""" if self.filedes is not None: return self.filedes raise OSError(errno.EBADF, 'Invalid file descriptor')
[ "def", "fileno", "(", "self", ")", "->", "int", ":", "if", "self", ".", "filedes", "is", "not", "None", ":", "return", "self", ".", "filedes", "raise", "OSError", "(", "errno", ".", "EBADF", ",", "'Invalid file descriptor'", ")" ]
https://github.com/jmcgeheeiv/pyfakefs/blob/197e3882749ef5fc12984ba6885023663ad4f883/pyfakefs/fake_filesystem.py#L5382-L5386
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/speedmeter.py
python
SpeedMeter.SetArcColour
(self, colour=None)
Sets the external arc colour (thicker line). :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, the arc colour will be black.
Sets the external arc colour (thicker line).
[ "Sets", "the", "external", "arc", "colour", "(", "thicker", "line", ")", "." ]
def SetArcColour(self, colour=None): """ Sets the external arc colour (thicker line). :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, the arc colour will be black. """ if colour is None: colour = wx.BLACK self._arccolo...
[ "def", "SetArcColour", "(", "self", ",", "colour", "=", "None", ")", ":", "if", "colour", "is", "None", ":", "colour", "=", "wx", ".", "BLACK", "self", ".", "_arccolour", "=", "colour" ]
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/speedmeter.py#L1401-L1412
Greenwolf/ntlm_theft
81589eafff22eec254d0881689b2eff2f14816bc
ntlm_theft.py
python
create_zoom
(generate,server,filename)
[]
def create_zoom(generate,server,filename): if generate == "modern": print("Skipping zoom as it does not work on the latest versions") return file = open(filename,'w') file.write('''To attack zoom, just put the following link along with your phishing message in the chat window: \\\\''' + server + '''\\xyz ''') ...
[ "def", "create_zoom", "(", "generate", ",", "server", ",", "filename", ")", ":", "if", "generate", "==", "\"modern\"", ":", "print", "(", "\"Skipping zoom as it does not work on the latest versions\"", ")", "return", "file", "=", "open", "(", "filename", ",", "'w'...
https://github.com/Greenwolf/ntlm_theft/blob/81589eafff22eec254d0881689b2eff2f14816bc/ntlm_theft.py#L377-L387
zacharyvoase/dagny
37a0c459ef6a4bc3b151371961f184b2f71871d6
distribute_setup.py
python
download_setuptools
(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, delay=15)
return os.path.realpath(saveto)
Download distribute from a specified location and return its filename `version` should be a valid distribute version number that is available as an egg for download under the `download_base` URL (which should end with a '/'). `to_dir` is the directory where the egg will be downloaded. `delay` is the nu...
Download distribute from a specified location and return its filename
[ "Download", "distribute", "from", "a", "specified", "location", "and", "return", "its", "filename" ]
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, delay=15): """Download distribute from a specified location and return its filename `version` should be a valid distribute version number that is available as an egg for download under the ...
[ "def", "download_setuptools", "(", "version", "=", "DEFAULT_VERSION", ",", "download_base", "=", "DEFAULT_URL", ",", "to_dir", "=", "os", ".", "curdir", ",", "delay", "=", "15", ")", ":", "# making sure we use the absolute path", "to_dir", "=", "os", ".", "path"...
https://github.com/zacharyvoase/dagny/blob/37a0c459ef6a4bc3b151371961f184b2f71871d6/distribute_setup.py#L170-L204
hacktoolkit/django-htk
902f3780630f1308aa97a70b9b62a5682239ff2d
lib/yahoo/groups/message.py
python
YahooGroupsMessage.message
(self)
return message
Returns the main message text
Returns the main message text
[ "Returns", "the", "main", "message", "text" ]
def message(self): """Returns the main message text """ main_div = self.soup.find(id='ygrp-text') paragraphs = main_div.find_all('p') for p in paragraphs: p.insert_after('<br/><br/>') message = main_div.text return message
[ "def", "message", "(", "self", ")", ":", "main_div", "=", "self", ".", "soup", ".", "find", "(", "id", "=", "'ygrp-text'", ")", "paragraphs", "=", "main_div", ".", "find_all", "(", "'p'", ")", "for", "p", "in", "paragraphs", ":", "p", ".", "insert_af...
https://github.com/hacktoolkit/django-htk/blob/902f3780630f1308aa97a70b9b62a5682239ff2d/lib/yahoo/groups/message.py#L20-L29
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/interfaces.py
python
IElement.queryTaggedValue
(tag, default=None)
Returns the value associated with `tag`. Return the default value of the tag isn't set.
Returns the value associated with `tag`.
[ "Returns", "the", "value", "associated", "with", "tag", "." ]
def queryTaggedValue(tag, default=None): """Returns the value associated with `tag`. Return the default value of the tag isn't set. """
[ "def", "queryTaggedValue", "(", "tag", ",", "default", "=", "None", ")", ":" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/interfaces.py#L38-L42
instaloader/instaloader
d6e5e310054aa42d3fd8d881389f04d1b4cdbe72
instaloader/structures.py
python
Post.get_comments
(self)
return NodeIterator( self._context, '97b41c52301f77ce508f55e66d17620e', lambda d: d['data']['shortcode_media']['edge_media_to_parent_comment'], _postcomment, {'shortcode': self.shortcode}, 'https://www.instagram.com/p/{0}/'.format(self.shortcode), ...
r"""Iterate over all comments of the post. Each comment is represented by a PostComment namedtuple with fields text (string), created_at (datetime), id (int), owner (:class:`Profile`) and answers (:class:`~typing.Iterator`\ [:class:`PostCommentAnswer`]) if available. .. versionchanged:...
r"""Iterate over all comments of the post.
[ "r", "Iterate", "over", "all", "comments", "of", "the", "post", "." ]
def get_comments(self) -> Iterable[PostComment]: r"""Iterate over all comments of the post. Each comment is represented by a PostComment namedtuple with fields text (string), created_at (datetime), id (int), owner (:class:`Profile`) and answers (:class:`~typing.Iterator`\ [:class:`PostCommentAn...
[ "def", "get_comments", "(", "self", ")", "->", "Iterable", "[", "PostComment", "]", ":", "def", "_postcommentanswer", "(", "node", ")", ":", "return", "PostCommentAnswer", "(", "id", "=", "int", "(", "node", "[", "'id'", "]", ")", ",", "created_at_utc", ...
https://github.com/instaloader/instaloader/blob/d6e5e310054aa42d3fd8d881389f04d1b4cdbe72/instaloader/structures.py#L458-L516
biocore/qiime
76d633c0389671e93febbe1338b5ded658eba31f
qiime/normalize_table.py
python
normalize_DESeq2
(input_path, out_path, DESeq_negatives_to_zero)
performs DESeq2VS normalization on a single raw abundance OTU matrix
performs DESeq2VS normalization on a single raw abundance OTU matrix
[ "performs", "DESeq2VS", "normalization", "on", "a", "single", "raw", "abundance", "OTU", "matrix" ]
def normalize_DESeq2(input_path, out_path, DESeq_negatives_to_zero): """performs DESeq2VS normalization on a single raw abundance OTU matrix """ tmp_bt = load_table(input_path) with tempfile.NamedTemporaryFile(dir=get_qiime_temp_dir(), prefix='QIIME-normalize-table-...
[ "def", "normalize_DESeq2", "(", "input_path", ",", "out_path", ",", "DESeq_negatives_to_zero", ")", ":", "tmp_bt", "=", "load_table", "(", "input_path", ")", "with", "tempfile", ".", "NamedTemporaryFile", "(", "dir", "=", "get_qiime_temp_dir", "(", ")", ",", "pr...
https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/normalize_table.py#L81-L90
dataabc/weiboSpider
937fc27d5e8863cf1a79ba6e8fb6db805efaa620
weibo_spider/parser/index_parser.py
python
IndexParser.get_page_num
(self)
获取微博总页数
获取微博总页数
[ "获取微博总页数" ]
def get_page_num(self): """获取微博总页数""" try: if self.selector.xpath("//input[@name='mp']") == []: page_num = 1 else: page_num = (int)(self.selector.xpath("//input[@name='mp']") [0].attrib['value']) return ...
[ "def", "get_page_num", "(", "self", ")", ":", "try", ":", "if", "self", ".", "selector", ".", "xpath", "(", "\"//input[@name='mp']\"", ")", "==", "[", "]", ":", "page_num", "=", "1", "else", ":", "page_num", "=", "(", "int", ")", "(", "self", ".", ...
https://github.com/dataabc/weiboSpider/blob/937fc27d5e8863cf1a79ba6e8fb6db805efaa620/weibo_spider/parser/index_parser.py#L46-L56
exaile/exaile
a7b58996c5c15b3aa7b9975ac13ee8f784ef4689
plugins/osd/__init__.py
python
OSDWindow.show_for_a_while
(self)
This method makes sure that the OSD is shown. Any previous hiding timers or fading transitions will be stopped. If hiding is allowed through self.__autohide, a new hiding timer will be started.
This method makes sure that the OSD is shown. Any previous hiding timers or fading transitions will be stopped. If hiding is allowed through self.__autohide, a new hiding timer will be started.
[ "This", "method", "makes", "sure", "that", "the", "OSD", "is", "shown", ".", "Any", "previous", "hiding", "timers", "or", "fading", "transitions", "will", "be", "stopped", ".", "If", "hiding", "is", "allowed", "through", "self", ".", "__autohide", "a", "ne...
def show_for_a_while(self): """ This method makes sure that the OSD is shown. Any previous hiding timers or fading transitions will be stopped. If hiding is allowed through self.__autohide, a new hiding timer will be started. """ # unset potential fadeout process ...
[ "def", "show_for_a_while", "(", "self", ")", ":", "# unset potential fadeout process", "if", "self", ".", "__fadeout_id", ":", "GLib", ".", "source_remove", "(", "self", ".", "__fadeout_id", ")", "self", ".", "__fadeout_id", "=", "None", "if", "Gtk", ".", "Wid...
https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/plugins/osd/__init__.py#L491-L514
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/rigged_configurations/rc_infinity.py
python
InfinityCrystalOfNonSimplyLacedRC.to_virtual
(self, rc)
return self.virtual.element_class(self.virtual, partition_list=partitions, rigging_list=riggings)
Convert ``rc`` into a rigged configuration in the virtual crystal. INPUT: - ``rc`` -- a rigged configuration element EXAMPLES:: sage: vct = CartanType(['C', 2]).as_folding() sage: RC = crystals.infinity.RiggedConfigurations(vct) sage: mg = RC.highest_weigh...
Convert ``rc`` into a rigged configuration in the virtual crystal.
[ "Convert", "rc", "into", "a", "rigged", "configuration", "in", "the", "virtual", "crystal", "." ]
def to_virtual(self, rc): """ Convert ``rc`` into a rigged configuration in the virtual crystal. INPUT: - ``rc`` -- a rigged configuration element EXAMPLES:: sage: vct = CartanType(['C', 2]).as_folding() sage: RC = crystals.infinity.RiggedConfiguration...
[ "def", "to_virtual", "(", "self", ",", "rc", ")", ":", "gamma", "=", "[", "int", "(", "_", ")", "for", "_", "in", "self", ".", "_folded_ct", ".", "scaling_factors", "(", ")", "]", "sigma", "=", "self", ".", "_folded_ct", ".", "_orbit", "n", "=", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/rigged_configurations/rc_infinity.py#L415-L457
gammapy/gammapy
735b25cd5bbed35e2004d633621896dcd5295e8b
gammapy/utils/coordinates/fov.py
python
fov_to_sky
(lon, lat, lon_pnt, lat_pnt)
return target_sky.ra, target_sky.dec
Transform field-of-view coordinates to sky coordinates. Parameters ---------- lon, lat : `~astropy.units.Quantity` Field-of-view coordinate to be transformed lon_pnt, lat_pnt : `~astropy.units.Quantity` Coordinate specifying the pointing position (i.e. the center of the field of...
Transform field-of-view coordinates to sky coordinates.
[ "Transform", "field", "-", "of", "-", "view", "coordinates", "to", "sky", "coordinates", "." ]
def fov_to_sky(lon, lat, lon_pnt, lat_pnt): """Transform field-of-view coordinates to sky coordinates. Parameters ---------- lon, lat : `~astropy.units.Quantity` Field-of-view coordinate to be transformed lon_pnt, lat_pnt : `~astropy.units.Quantity` Coordinate specifying the pointin...
[ "def", "fov_to_sky", "(", "lon", ",", "lat", ",", "lon_pnt", ",", "lat_pnt", ")", ":", "# Create a frame that is centered on the pointing position", "center", "=", "SkyCoord", "(", "lon_pnt", ",", "lat_pnt", ")", "fov_frame", "=", "SkyOffsetFrame", "(", "origin", ...
https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/gammapy/utils/coordinates/fov.py#L7-L35
MontrealCorpusTools/Montreal-Forced-Aligner
63473f9a4fabd31eec14e1e5022882f85cfdaf31
montreal_forced_aligner/corpus/multiprocessing.py
python
Job.utt2spk_scp_data
(self)
return data
Generate the job's data for Kaldi's utt2spk scp files Returns ------- dict[str, dict[str, str]] Utterance to speaker mapping, per dictionary name
Generate the job's data for Kaldi's utt2spk scp files
[ "Generate", "the", "job", "s", "data", "for", "Kaldi", "s", "utt2spk", "scp", "files" ]
def utt2spk_scp_data(self) -> Dict[str, Dict[str, str]]: """ Generate the job's data for Kaldi's utt2spk scp files Returns ------- dict[str, dict[str, str]] Utterance to speaker mapping, per dictionary name """ data = {x: {} for x in self.current_dict...
[ "def", "utt2spk_scp_data", "(", "self", ")", "->", "Dict", "[", "str", ",", "Dict", "[", "str", ",", "str", "]", "]", ":", "data", "=", "{", "x", ":", "{", "}", "for", "x", "in", "self", ".", "current_dictionary_names", "}", "for", "utt", "in", "...
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/corpus/multiprocessing.py#L255-L268
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/hassio/__init__.py
python
async_restart_addon
(hass: HomeAssistant, slug: str)
return await hassio.send_command(command, timeout=None)
Restart add-on. The caller of the function should handle HassioAPIError.
Restart add-on.
[ "Restart", "add", "-", "on", "." ]
async def async_restart_addon(hass: HomeAssistant, slug: str) -> dict: """Restart add-on. The caller of the function should handle HassioAPIError. """ hassio = hass.data[DOMAIN] command = f"/addons/{slug}/restart" return await hassio.send_command(command, timeout=None)
[ "async", "def", "async_restart_addon", "(", "hass", ":", "HomeAssistant", ",", "slug", ":", "str", ")", "->", "dict", ":", "hassio", "=", "hass", ".", "data", "[", "DOMAIN", "]", "command", "=", "f\"/addons/{slug}/restart\"", "return", "await", "hassio", "."...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/hassio/__init__.py#L265-L272
osmr/imgclsmob
f2993d3ce73a2f7ddba05da3891defb08547d504
tensorflow2/tf2cv/models/simpleposemobile_coco.py
python
simplepose_mobile_resnet50b_coco
(pretrained_backbone=False, keypoints=17, data_format="channels_last", **kwargs)
return get_simpleposemobile(backbone=backbone, backbone_out_channels=2048, keypoints=keypoints, model_name="simplepose_mobile_resnet50b_coco", data_format=data_format, **kwargs)
SimplePose(Mobile) model on the base of ResNet-50b for COCO Keypoint from 'Simple Baselines for Human Pose Estimation and Tracking,' https://arxiv.org/abs/1804.06208. Parameters: ---------- pretrained_backbone : bool, default False Whether to load the pretrained weights for feature extractor. ...
SimplePose(Mobile) model on the base of ResNet-50b for COCO Keypoint from 'Simple Baselines for Human Pose Estimation and Tracking,' https://arxiv.org/abs/1804.06208.
[ "SimplePose", "(", "Mobile", ")", "model", "on", "the", "base", "of", "ResNet", "-", "50b", "for", "COCO", "Keypoint", "from", "Simple", "Baselines", "for", "Human", "Pose", "Estimation", "and", "Tracking", "https", ":", "//", "arxiv", ".", "org", "/", "...
def simplepose_mobile_resnet50b_coco(pretrained_backbone=False, keypoints=17, data_format="channels_last", **kwargs): """ SimplePose(Mobile) model on the base of ResNet-50b for COCO Keypoint from 'Simple Baselines for Human Pose Estimation and Tracking,' https://arxiv.org/abs/1804.06208. Parameters: ...
[ "def", "simplepose_mobile_resnet50b_coco", "(", "pretrained_backbone", "=", "False", ",", "keypoints", "=", "17", ",", "data_format", "=", "\"channels_last\"", ",", "*", "*", "kwargs", ")", ":", "backbone", "=", "resnet50b", "(", "pretrained", "=", "pretrained_bac...
https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow2/tf2cv/models/simpleposemobile_coco.py#L182-L203
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
rpython/tool/jitlogparser/module_finder.py
python
gather_all_code_objs
(fname)
return _all_codes_from(code)
Gathers all code objects from a give fname and sorts them by starting lineno
Gathers all code objects from a give fname and sorts them by starting lineno
[ "Gathers", "all", "code", "objects", "from", "a", "give", "fname", "and", "sorts", "them", "by", "starting", "lineno" ]
def gather_all_code_objs(fname): """ Gathers all code objects from a give fname and sorts them by starting lineno """ fname = str(fname) if fname.endswith('.pyc'): code = compile(open(fname[:-1]).read(), fname, 'exec') elif fname.endswith('.py'): code = compile(open(fname).read()...
[ "def", "gather_all_code_objs", "(", "fname", ")", ":", "fname", "=", "str", "(", "fname", ")", "if", "fname", ".", "endswith", "(", "'.pyc'", ")", ":", "code", "=", "compile", "(", "open", "(", "fname", "[", ":", "-", "1", "]", ")", ".", "read", ...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/tool/jitlogparser/module_finder.py#L14-L25
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/index.py
python
Index.close
(self)
Closes any open resources held by the Index object itself. This may not close all resources being used everywhere, for example by a Searcher object.
Closes any open resources held by the Index object itself. This may not close all resources being used everywhere, for example by a Searcher object.
[ "Closes", "any", "open", "resources", "held", "by", "the", "Index", "object", "itself", ".", "This", "may", "not", "close", "all", "resources", "being", "used", "everywhere", "for", "example", "by", "a", "Searcher", "object", "." ]
def close(self): """Closes any open resources held by the Index object itself. This may not close all resources being used everywhere, for example by a Searcher object. """ pass
[ "def", "close", "(", "self", ")", ":", "pass" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/index.py#L219-L224
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/cdn/v20180606/models.py
python
SearchClsLogRequest.__init__
(self)
r""" :param LogsetId: 需要查询的日志集ID :type LogsetId: str :param TopicIds: 需要查询的日志主题ID组合,以逗号分隔 :type TopicIds: str :param StartTime: 需要查询的日志的起始时间,格式 YYYY-mm-dd HH:MM:SS :type StartTime: str :param EndTime: 需要查询的日志的结束时间,格式 YYYY-mm-dd HH:MM:SS :type EndTime: str ...
r""" :param LogsetId: 需要查询的日志集ID :type LogsetId: str :param TopicIds: 需要查询的日志主题ID组合,以逗号分隔 :type TopicIds: str :param StartTime: 需要查询的日志的起始时间,格式 YYYY-mm-dd HH:MM:SS :type StartTime: str :param EndTime: 需要查询的日志的结束时间,格式 YYYY-mm-dd HH:MM:SS :type EndTime: str ...
[ "r", ":", "param", "LogsetId", ":", "需要查询的日志集ID", ":", "type", "LogsetId", ":", "str", ":", "param", "TopicIds", ":", "需要查询的日志主题ID组合,以逗号分隔", ":", "type", "TopicIds", ":", "str", ":", "param", "StartTime", ":", "需要查询的日志的起始时间,格式", "YYYY", "-", "mm", "-", "dd...
def __init__(self): r""" :param LogsetId: 需要查询的日志集ID :type LogsetId: str :param TopicIds: 需要查询的日志主题ID组合,以逗号分隔 :type TopicIds: str :param StartTime: 需要查询的日志的起始时间,格式 YYYY-mm-dd HH:MM:SS :type StartTime: str :param EndTime: 需要查询的日志的结束时间,格式 YYYY-mm-dd HH:MM:SS...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "LogsetId", "=", "None", "self", ".", "TopicIds", "=", "None", "self", ".", "StartTime", "=", "None", "self", ".", "EndTime", "=", "None", "self", ".", "Limit", "=", "None", "self", ".", "Channel...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cdn/v20180606/models.py#L12748-L12777
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/agents/memnn/memnn.py
python
MemnnAgent.build_dictionary
(self)
return d
Add the time features to the dictionary before building the model.
Add the time features to the dictionary before building the model.
[ "Add", "the", "time", "features", "to", "the", "dictionary", "before", "building", "the", "model", "." ]
def build_dictionary(self): """Add the time features to the dictionary before building the model.""" d = super().build_dictionary() if self.use_time_features: # add time features to dictionary before building the model for i in range(self.memsize): d[self....
[ "def", "build_dictionary", "(", "self", ")", ":", "d", "=", "super", "(", ")", ".", "build_dictionary", "(", ")", "if", "self", ".", "use_time_features", ":", "# add time features to dictionary before building the model", "for", "i", "in", "range", "(", "self", ...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/memnn/memnn.py#L88-L95
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/yunjing/v20180228/models.py
python
AddLoginWhiteListResponse.__init__
(self)
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/yunjing/v20180228/models.py#L138-L143
mlcommons/training
4a4d5a0b7efe99c680306b1940749211d4238a84
reinforcement/tensorflow/minigo/ml_perf/train_loop.py
python
wait_for_training_examples
(state, num_games)
Wait for training examples to be generated by the latest model. Args: state: the RL loop State instance. num_games: number of games to wait for.
Wait for training examples to be generated by the latest model.
[ "Wait", "for", "training", "examples", "to", "be", "generated", "by", "the", "latest", "model", "." ]
def wait_for_training_examples(state, num_games): """Wait for training examples to be generated by the latest model. Args: state: the RL loop State instance. num_games: number of games to wait for. """ model_dir = os.path.join(FLAGS.selfplay_dir, state.selfplay_model_name) pattern ...
[ "def", "wait_for_training_examples", "(", "state", ",", "num_games", ")", ":", "model_dir", "=", "os", ".", "path", ".", "join", "(", "FLAGS", ".", "selfplay_dir", ",", "state", ".", "selfplay_model_name", ")", "pattern", "=", "os", ".", "path", ".", "join...
https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/reinforcement/tensorflow/minigo/ml_perf/train_loop.py#L110-L130
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/_yaxis.py
python
YAxis.tickwidth
(self)
return self["tickwidth"]
Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
[ "Sets", "the", "tick", "width", "(", "in", "px", ")", ".", "The", "tickwidth", "property", "is", "a", "number", "and", "may", "be", "specified", "as", ":", "-", "An", "int", "or", "float", "in", "the", "interval", "[", "0", "inf", "]" ]
def tickwidth(self): """ Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["tickwidth"]
[ "def", "tickwidth", "(", "self", ")", ":", "return", "self", "[", "\"tickwidth\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_yaxis.py#L2125-L2136
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/object_detection/core/model.py
python
DetectionModel.provide_groundtruth
(self, groundtruth_boxes_list, groundtruth_classes_list, groundtruth_masks_list=None, groundtruth_keypoints_list=None)
Provide groundtruth tensors. Args: groundtruth_boxes_list: a list of 2-D tf.float32 tensors of shape [num_boxes, 4] containing coordinates of the groundtruth boxes. Groundtruth boxes are provided in [y_min, x_min, y_max, x_max] format and assumed to be normalized and clipped ...
Provide groundtruth tensors.
[ "Provide", "groundtruth", "tensors", "." ]
def provide_groundtruth(self, groundtruth_boxes_list, groundtruth_classes_list, groundtruth_masks_list=None, groundtruth_keypoints_list=None): """Provide groundtruth tensors. Args: groundtruth_boxes_li...
[ "def", "provide_groundtruth", "(", "self", ",", "groundtruth_boxes_list", ",", "groundtruth_classes_list", ",", "groundtruth_masks_list", "=", "None", ",", "groundtruth_keypoints_list", "=", "None", ")", ":", "self", ".", "_groundtruth_lists", "[", "fields", ".", "Box...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/object_detection/core/model.py#L208-L242
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/SearchKippt/alp/request/requests_cache/backends/mongo.py
python
MongoCache.__init__
(self, db_name='requests-cache', **options)
:param db_name: database name (default: ``'requests-cache'``) :param connection: (optional) ``pymongo.Connection``
:param db_name: database name (default: ``'requests-cache'``) :param connection: (optional) ``pymongo.Connection``
[ ":", "param", "db_name", ":", "database", "name", "(", "default", ":", "requests", "-", "cache", ")", ":", "param", "connection", ":", "(", "optional", ")", "pymongo", ".", "Connection" ]
def __init__(self, db_name='requests-cache', **options): """ :param db_name: database name (default: ``'requests-cache'``) :param connection: (optional) ``pymongo.Connection`` """ super(MongoCache, self).__init__() self.responses = MongoPickleDict(db_name, 'responses', ...
[ "def", "__init__", "(", "self", ",", "db_name", "=", "'requests-cache'", ",", "*", "*", "options", ")", ":", "super", "(", "MongoCache", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "responses", "=", "MongoPickleDict", "(", "db_name", ",", ...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/SearchKippt/alp/request/requests_cache/backends/mongo.py#L16-L24
tholum/PiBunny
289563fbd8e5334a2889dc1b5a7391465d212a3b
system.d/library/tools_installer/tools_to_install/impacket/impacket/dot11.py
python
Dot11ControlFrameCTS.get_duration
(self)
return b
Return 802.11 CTS control frame 'Duration' field
Return 802.11 CTS control frame 'Duration' field
[ "Return", "802", ".", "11", "CTS", "control", "frame", "Duration", "field" ]
def get_duration(self): "Return 802.11 CTS control frame 'Duration' field" b = self.header.get_word(0, "<") return b
[ "def", "get_duration", "(", "self", ")", ":", "b", "=", "self", ".", "header", ".", "get_word", "(", "0", ",", "\"<\"", ")", "return", "b" ]
https://github.com/tholum/PiBunny/blob/289563fbd8e5334a2889dc1b5a7391465d212a3b/system.d/library/tools_installer/tools_to_install/impacket/impacket/dot11.py#L537-L540
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/demo/media_player.py
python
DemoYoutubePlayer.supported_features
(self)
return YOUTUBE_PLAYER_SUPPORT
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 YOUTUBE_PLAYER_SUPPORT
[ "def", "supported_features", "(", "self", ")", ":", "return", "YOUTUBE_PLAYER_SUPPORT" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/demo/media_player.py#L282-L284
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/contrib/ingame_python/scripts.py
python
EventHandler.get_variable
(self, variable_name)
return self.ndb.current_locals.get(variable_name)
Return the variable defined in the locals. This can be very useful to check the value of a variable that can be modified in an event, and whose value will be used in code. This system allows additional customization. Args: variable_name (str): the name of the variable to return. ...
Return the variable defined in the locals.
[ "Return", "the", "variable", "defined", "in", "the", "locals", "." ]
def get_variable(self, variable_name): """ Return the variable defined in the locals. This can be very useful to check the value of a variable that can be modified in an event, and whose value will be used in code. This system allows additional customization. Args: variabl...
[ "def", "get_variable", "(", "self", ",", "variable_name", ")", ":", "return", "self", ".", "ndb", ".", "current_locals", ".", "get", "(", "variable_name", ")" ]
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/contrib/ingame_python/scripts.py#L151-L174
rcaloras/bashhub-client
cde081810d2efcbb102a717f85be4efaa10bae7b
bashhub/shell_utils.py
python
get_session_information
()
return (ppid, start_time)
[]
def get_session_information(): ppid = os.getppid() # Non standard across systems GNU Date and BSD Date # both convert to epoch differently. Need to use # python date util to make standard. start_time_command = "ps -p {0} -o lstart | sed -n 2p".format(ppid) date_string = os.popen(start_time_comm...
[ "def", "get_session_information", "(", ")", ":", "ppid", "=", "os", ".", "getppid", "(", ")", "# Non standard across systems GNU Date and BSD Date", "# both convert to epoch differently. Need to use", "# python date util to make standard.", "start_time_command", "=", "\"ps -p {0} -...
https://github.com/rcaloras/bashhub-client/blob/cde081810d2efcbb102a717f85be4efaa10bae7b/bashhub/shell_utils.py#L7-L17
edgewall/trac
beb3e4eaf1e0a456d801a50a8614ecab06de29fc
trac/ticket/roadmap.py
python
get_num_tickets_for_milestone
(env, milestone, exclude_closed=False)
return env.db_query(sql, (name,))[0][0]
Returns the number of tickets associated with the milestone. :param milestone: name of a milestone or a Milestone instance. :param exclude_closed: whether tickets with status 'closed' should be excluded from the count. Defaults to False. :since: 1.2
Returns the number of tickets associated with the milestone.
[ "Returns", "the", "number", "of", "tickets", "associated", "with", "the", "milestone", "." ]
def get_num_tickets_for_milestone(env, milestone, exclude_closed=False): """Returns the number of tickets associated with the milestone. :param milestone: name of a milestone or a Milestone instance. :param exclude_closed: whether tickets with status 'closed' should be excluded f...
[ "def", "get_num_tickets_for_milestone", "(", "env", ",", "milestone", ",", "exclude_closed", "=", "False", ")", ":", "name", "=", "milestone", ".", "name", "if", "isinstance", "(", "milestone", ",", "Milestone", ")", "else", "milestone", "sql", "=", "\"SELECT ...
https://github.com/edgewall/trac/blob/beb3e4eaf1e0a456d801a50a8614ecab06de29fc/trac/ticket/roadmap.py#L343-L356
Qiskit/qiskit-terra
b66030e3b9192efdd3eb95cf25c6545fe0a13da4
qiskit/algorithms/linear_solvers/matrices/numpy_matrix.py
python
NumPyMatrix.matrix
(self, matrix: np.ndarray)
Set the matrix. Args: matrix: The new matrix.
Set the matrix.
[ "Set", "the", "matrix", "." ]
def matrix(self, matrix: np.ndarray) -> None: """Set the matrix. Args: matrix: The new matrix. """ self._matrix = matrix
[ "def", "matrix", "(", "self", ",", "matrix", ":", "np", ".", "ndarray", ")", "->", "None", ":", "self", ".", "_matrix", "=", "matrix" ]
https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/algorithms/linear_solvers/matrices/numpy_matrix.py#L138-L144
ansible-collections/community.general
3faffe8f47968a2400ba3c896c8901c03001a194
plugins/modules/notification/cisco_webex.py
python
webex_msg
(module)
return results
When check mode is specified, establish a read only connection, that does not return any user specific data, to validate connectivity. In regular mode, send a message to a Cisco Webex Teams Room or Individual
When check mode is specified, establish a read only connection, that does not return any user specific data, to validate connectivity. In regular mode, send a message to a Cisco Webex Teams Room or Individual
[ "When", "check", "mode", "is", "specified", "establish", "a", "read", "only", "connection", "that", "does", "not", "return", "any", "user", "specific", "data", "to", "validate", "connectivity", ".", "In", "regular", "mode", "send", "a", "message", "to", "a",...
def webex_msg(module): """When check mode is specified, establish a read only connection, that does not return any user specific data, to validate connectivity. In regular mode, send a message to a Cisco Webex Teams Room or Individual""" # Ansible Specific Variables results = {} ansible = module.pa...
[ "def", "webex_msg", "(", "module", ")", ":", "# Ansible Specific Variables", "results", "=", "{", "}", "ansible", "=", "module", ".", "params", "headers", "=", "{", "'Authorization'", ":", "'Bearer {0}'", ".", "format", "(", "ansible", "[", "'personal_token'", ...
https://github.com/ansible-collections/community.general/blob/3faffe8f47968a2400ba3c896c8901c03001a194/plugins/modules/notification/cisco_webex.py#L119-L165
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Tools/scripts/texi2html.py
python
TexinfoParserHTML3.end_example
(self)
[]
def end_example(self): self.write("</CODE></PRE>\n") self.nofill = self.nofill - 1
[ "def", "end_example", "(", "self", ")", ":", "self", ".", "write", "(", "\"</CODE></PRE>\\n\"", ")", "self", ".", "nofill", "=", "self", ".", "nofill", "-", "1" ]
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/scripts/texi2html.py#L1661-L1663
sacmehta/ESPNetv2
b78e323039908f31347d8ca17f49d5502ef1a594
imagenet/cnn_utils.py
python
CB.forward
(self, input)
return output
:param input: input feature map :return: transformed feature map
[]
def forward(self, input): ''' :param input: input feature map :return: transformed feature map ''' output = self.conv(input) output = self.bn(output) return output
[ "def", "forward", "(", "self", ",", "input", ")", ":", "output", "=", "self", ".", "conv", "(", "input", ")", "output", "=", "self", ".", "bn", "(", "output", ")", "return", "output" ]
https://github.com/sacmehta/ESPNetv2/blob/b78e323039908f31347d8ca17f49d5502ef1a594/imagenet/cnn_utils.py#L81-L89
perone/Pyevolve
589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0
pyevolve/GSimpleGA.py
python
GSimpleGA.__gp_catch_functions
(self, prefix)
Internally used to catch functions with some specific prefix as non-terminals of the GP core
Internally used to catch functions with some specific prefix as non-terminals of the GP core
[ "Internally", "used", "to", "catch", "functions", "with", "some", "specific", "prefix", "as", "non", "-", "terminals", "of", "the", "GP", "core" ]
def __gp_catch_functions(self, prefix): """ Internally used to catch functions with some specific prefix as non-terminals of the GP core """ import __main__ as mod_main function_set = {} main_dict = mod_main.__dict__ for obj, addr in main_dict.items(): if ob...
[ "def", "__gp_catch_functions", "(", "self", ",", "prefix", ")", ":", "import", "__main__", "as", "mod_main", "function_set", "=", "{", "}", "main_dict", "=", "mod_main", ".", "__dict__", "for", "obj", ",", "addr", "in", "main_dict", ".", "items", "(", ")",...
https://github.com/perone/Pyevolve/blob/589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0/pyevolve/GSimpleGA.py#L592-L611
flosch/simpleapi
7832036e6a9c076a993557eb40f071f2ef572750
example_project/client/python/sapi/message.py
python
MessageElement.__getslice__
(self, start, stop)
return self._children[start:stop]
Returns a list containing subelements in the given range. @param start The first subelement to return. @param stop The first subelement that shouldn't be returned. @return A sequence object containing subelements.
Returns a list containing subelements in the given range.
[ "Returns", "a", "list", "containing", "subelements", "in", "the", "given", "range", "." ]
def __getslice__(self, start, stop): """ Returns a list containing subelements in the given range. @param start The first subelement to return. @param stop The first subelement that shouldn't be returned. @return A sequence object containing subelements. """ retu...
[ "def", "__getslice__", "(", "self", ",", "start", ",", "stop", ")", ":", "return", "self", ".", "_children", "[", "start", ":", "stop", "]" ]
https://github.com/flosch/simpleapi/blob/7832036e6a9c076a993557eb40f071f2ef572750/example_project/client/python/sapi/message.py#L125-L133
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/dnspod/v20210323/dnspod_client.py
python
DnspodClient.DescribeDomainShareInfo
(self, request)
获取域名共享信息 :param request: Request instance for DescribeDomainShareInfo. :type request: :class:`tencentcloud.dnspod.v20210323.models.DescribeDomainShareInfoRequest` :rtype: :class:`tencentcloud.dnspod.v20210323.models.DescribeDomainShareInfoResponse`
获取域名共享信息
[ "获取域名共享信息" ]
def DescribeDomainShareInfo(self, request): """获取域名共享信息 :param request: Request instance for DescribeDomainShareInfo. :type request: :class:`tencentcloud.dnspod.v20210323.models.DescribeDomainShareInfoRequest` :rtype: :class:`tencentcloud.dnspod.v20210323.models.DescribeDomainShareInfoR...
[ "def", "DescribeDomainShareInfo", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeDomainShareInfo\"", ",", "params", ")", "response", "=", "json", "...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/dnspod/v20210323/dnspod_client.py#L477-L502
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/programs/utils.py
python
ProgramDataExtender._extend_course_runs
(self)
Execute course run data handlers.
Execute course run data handlers.
[ "Execute", "course", "run", "data", "handlers", "." ]
def _extend_course_runs(self): """Execute course run data handlers.""" for course in self.data['courses']: for course_run in course['course_runs']: # State to be shared across handlers. self.course_run_key = CourseKey.from_string(course_run['key']) ...
[ "def", "_extend_course_runs", "(", "self", ")", ":", "for", "course", "in", "self", ".", "data", "[", "'courses'", "]", ":", "for", "course_run", "in", "course", "[", "'course_runs'", "]", ":", "# State to be shared across handlers.", "self", ".", "course_run_ke...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/programs/utils.py#L515-L531
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/firmata/pin.py
python
FirmataBinaryDigitalOutput.turn_on
(self)
Turn on digital output.
Turn on digital output.
[ "Turn", "on", "digital", "output", "." ]
async def turn_on(self) -> None: """Turn on digital output.""" _LOGGER.debug("Turning digital output on pin %s on", self._pin) new_pin_state = not self._negate await self.board.api.digital_pin_write(self._firmata_pin, int(new_pin_state)) self._state = True
[ "async", "def", "turn_on", "(", "self", ")", "->", "None", ":", "_LOGGER", ".", "debug", "(", "\"Turning digital output on pin %s on\"", ",", "self", ".", "_pin", ")", "new_pin_state", "=", "not", "self", ".", "_negate", "await", "self", ".", "board", ".", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/firmata/pin.py#L77-L82
encode/httpx
7f0d43daad60b37d07f7734a83986e9dade59bf7
httpx/_models.py
python
Response.is_redirect
(self)
return codes.is_redirect(self.status_code)
A property which is `True` for 3xx status codes, `False` otherwise. Note that not all responses with a 3xx status code indicate a URL redirect. Use `response.has_redirect_location` to determine responses with a properly formed URL redirection.
A property which is `True` for 3xx status codes, `False` otherwise.
[ "A", "property", "which", "is", "True", "for", "3xx", "status", "codes", "False", "otherwise", "." ]
def is_redirect(self) -> bool: """ A property which is `True` for 3xx status codes, `False` otherwise. Note that not all responses with a 3xx status code indicate a URL redirect. Use `response.has_redirect_location` to determine responses with a properly formed URL redirection....
[ "def", "is_redirect", "(", "self", ")", "->", "bool", ":", "return", "codes", ".", "is_redirect", "(", "self", ".", "status_code", ")" ]
https://github.com/encode/httpx/blob/7f0d43daad60b37d07f7734a83986e9dade59bf7/httpx/_models.py#L1418-L1427
Floobits/flootty
731fb4516da3ad34c724440787e57c97229838e8
flootty/floo/common/flooui.py
python
FlooUI.user_dir
(self, context, prompt, initial, cb)
@returns a String directory (probably not expanded)
[]
def user_dir(self, context, prompt, initial, cb): """@returns a String directory (probably not expanded)""" raise NotImplemented()
[ "def", "user_dir", "(", "self", ",", "context", ",", "prompt", ",", "initial", ",", "cb", ")", ":", "raise", "NotImplemented", "(", ")" ]
https://github.com/Floobits/flootty/blob/731fb4516da3ad34c724440787e57c97229838e8/flootty/floo/common/flooui.py#L39-L41
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/dns/message.py
python
Message.get_rrset
(self, section, name, rdclass, rdtype, covers=dns.rdatatype.NONE, deleting=None, create=False, force_unique=False)
return rrset
Get the RRset with the given attributes in the specified section. If the RRset is not found, None is returned. *section*, an ``int`` section number, or one of the section attributes of this message. This specifies the the section of the message to search. For example:: m...
Get the RRset with the given attributes in the specified section.
[ "Get", "the", "RRset", "with", "the", "given", "attributes", "in", "the", "specified", "section", "." ]
def get_rrset(self, section, name, rdclass, rdtype, covers=dns.rdatatype.NONE, deleting=None, create=False, force_unique=False): """Get the RRset with the given attributes in the specified section. If the RRset is not found, None is returned. *section*, an `...
[ "def", "get_rrset", "(", "self", ",", "section", ",", "name", ",", "rdclass", ",", "rdtype", ",", "covers", "=", "dns", ".", "rdatatype", ".", "NONE", ",", "deleting", "=", "None", ",", "create", "=", "False", ",", "force_unique", "=", "False", ")", ...
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/dns/message.py#L363-L405
openedx/ecommerce
db6c774e239e5aa65e5a6151995073d364e8c896
ecommerce/courses/models.py
python
Course._create_or_update_enrollment_code
(self, seat_type, id_verification_required, partner, price, expires)
return enrollment_code
Creates an enrollment code product and corresponding stock record for the specified seat. Includes course ID and seat type as product attributes. Args: seat_type (str): Seat type. partner (Partner): Seat provider set in the stock record. price (Decimal): Price of the...
Creates an enrollment code product and corresponding stock record for the specified seat. Includes course ID and seat type as product attributes.
[ "Creates", "an", "enrollment", "code", "product", "and", "corresponding", "stock", "record", "for", "the", "specified", "seat", ".", "Includes", "course", "ID", "and", "seat", "type", "as", "product", "attributes", "." ]
def _create_or_update_enrollment_code(self, seat_type, id_verification_required, partner, price, expires): """ Creates an enrollment code product and corresponding stock record for the specified seat. Includes course ID and seat type as product attributes. Args: seat_type (s...
[ "def", "_create_or_update_enrollment_code", "(", "self", ",", "seat_type", ",", "id_verification_required", ",", "partner", ",", "price", ",", "expires", ")", ":", "enrollment_code_product_class", "=", "ProductClass", ".", "objects", ".", "get", "(", "name", "=", ...
https://github.com/openedx/ecommerce/blob/db6c774e239e5aa65e5a6151995073d364e8c896/ecommerce/courses/models.py#L277-L324
deanishe/zothero
5b057ef080ee730d82d5dd15e064d2a4730c2b11
src/lib/zothero/util.py
python
time_since
(ts)
return '{:0.1f} {} ago'.format(n, units[i])
Human-readable time since timestamp ``ts``.
Human-readable time since timestamp ``ts``.
[ "Human", "-", "readable", "time", "since", "timestamp", "ts", "." ]
def time_since(ts): """Human-readable time since timestamp ``ts``.""" if not ts: return 'never' units = ('secs', 'mins', 'hours') i = 0 n = time.time() - ts while i < len(units) - 1: if n > 60: n /= 60 i += 1 else: break return...
[ "def", "time_since", "(", "ts", ")", ":", "if", "not", "ts", ":", "return", "'never'", "units", "=", "(", "'secs'", ",", "'mins'", ",", "'hours'", ")", "i", "=", "0", "n", "=", "time", ".", "time", "(", ")", "-", "ts", "while", "i", "<", "len",...
https://github.com/deanishe/zothero/blob/5b057ef080ee730d82d5dd15e064d2a4730c2b11/src/lib/zothero/util.py#L276-L294
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/apis/batch_v2alpha1_api.py
python
BatchV2alpha1Api.replace_namespaced_cron_job_status
(self, name, namespace, body, **kwargs)
replace status of the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) ...
replace status of the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) ...
[ "replace", "status", "of", "the", "specified", "CronJob", "This", "method", "makes", "a", "synchronous", "HTTP", "request", "by", "default", ".", "To", "make", "an", "asynchronous", "HTTP", "request", "please", "define", "a", "callback", "function", "to", "be"...
def replace_namespaced_cron_job_status(self, name, namespace, body, **kwargs): """ replace status of the specified CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receivi...
[ "def", "replace_namespaced_cron_job_status", "(", "self", ",", "name", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'callback'", ")", ":", "...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/apis/batch_v2alpha1_api.py#L2521-L2547
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v2beta2_cross_version_object_reference.py
python
V2beta2CrossVersionObjectReference.__eq__
(self, other)
return self.to_dict() == other.to_dict()
Returns true if both objects are equal
Returns true if both objects are equal
[ "Returns", "true", "if", "both", "objects", "are", "equal" ]
def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, V2beta2CrossVersionObjectReference): return False return self.to_dict() == other.to_dict()
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V2beta2CrossVersionObjectReference", ")", ":", "return", "False", "return", "self", ".", "to_dict", "(", ")", "==", "other", ".", "to_dict", "(", ")" ]
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v2beta2_cross_version_object_reference.py#L168-L173
seopbo/nlp_classification
21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf
Character-level_Convolutional_Networks_for_Text_Classification/utils.py
python
SummaryManager.summary
(self)
return self._summary
[]
def summary(self): return self._summary
[ "def", "summary", "(", "self", ")", ":", "return", "self", ".", "_summary" ]
https://github.com/seopbo/nlp_classification/blob/21ea6e3f5737e7074bdd8dd190e5f5172f86f6bf/Character-level_Convolutional_Networks_for_Text_Classification/utils.py#L134-L135
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py
python
SJISProber.__init__
(self)
[]
def __init__(self): MultiByteCharSetProber.__init__(self) self._mCodingSM = CodingStateMachine(SJISSMModel) self._mDistributionAnalyzer = SJISDistributionAnalysis() self._mContextAnalyzer = SJISContextAnalysis() self.reset()
[ "def", "__init__", "(", "self", ")", ":", "MultiByteCharSetProber", ".", "__init__", "(", "self", ")", "self", ".", "_mCodingSM", "=", "CodingStateMachine", "(", "SJISSMModel", ")", "self", ".", "_mDistributionAnalyzer", "=", "SJISDistributionAnalysis", "(", ")", ...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py#L38-L43
aceisace/Inkycal
552744bc5d80769c1015d48fd8b13201683ee679
inkycal/display/drivers/epd_7_in_5.py
python
EPD.ReadBusy
(self)
[]
def ReadBusy(self): logging.debug("e-Paper busy") while(epdconfig.digital_read(self.busy_pin) == 0): # 0: idle, 1: busy epdconfig.delay_ms(100) logging.debug("e-Paper busy release")
[ "def", "ReadBusy", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"e-Paper busy\"", ")", "while", "(", "epdconfig", ".", "digital_read", "(", "self", ".", "busy_pin", ")", "==", "0", ")", ":", "# 0: idle, 1: busy", "epdconfig", ".", "delay_ms", "("...
https://github.com/aceisace/Inkycal/blob/552744bc5d80769c1015d48fd8b13201683ee679/inkycal/display/drivers/epd_7_in_5.py#L68-L72
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/analysis/local_env.py
python
site_is_of_motif_type
(struct, n, approach="min_dist", delta=0.1, cutoff=10.0, thresh=None)
return motif_type
Returns the motif type of the site with index n in structure struct; currently featuring "tetrahedral", "octahedral", "bcc", and "cp" (close-packed: fcc and hcp) as well as "square pyramidal" and "trigonal bipyramidal". If the site is not recognized, "unrecognized" is returned. If a site should be ass...
Returns the motif type of the site with index n in structure struct; currently featuring "tetrahedral", "octahedral", "bcc", and "cp" (close-packed: fcc and hcp) as well as "square pyramidal" and "trigonal bipyramidal". If the site is not recognized, "unrecognized" is returned. If a site should be ass...
[ "Returns", "the", "motif", "type", "of", "the", "site", "with", "index", "n", "in", "structure", "struct", ";", "currently", "featuring", "tetrahedral", "octahedral", "bcc", "and", "cp", "(", "close", "-", "packed", ":", "fcc", "and", "hcp", ")", "as", "...
def site_is_of_motif_type(struct, n, approach="min_dist", delta=0.1, cutoff=10.0, thresh=None): """ Returns the motif type of the site with index n in structure struct; currently featuring "tetrahedral", "octahedral", "bcc", and "cp" (close-packed: fcc and hcp) as well as "square pyramidal" and "tri...
[ "def", "site_is_of_motif_type", "(", "struct", ",", "n", ",", "approach", "=", "\"min_dist\"", ",", "delta", "=", "0.1", ",", "cutoff", "=", "10.0", ",", "thresh", "=", "None", ")", ":", "if", "thresh", "is", "None", ":", "thresh", "=", "{", "\"qtet\""...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/local_env.py#L2034-L2107
ipython/ipyparallel
d35d4fb9501da5b3280b11e83ed633a95f17be1d
ipyparallel/client/asyncresult.py
python
AsyncMapResult._unordered_iter
(self)
iterator for results *as they arrive*, on FCFS basis, ignoring submission order.
iterator for results *as they arrive*, on FCFS basis, ignoring submission order.
[ "iterator", "for", "results", "*", "as", "they", "arrive", "*", "on", "FCFS", "basis", "ignoring", "submission", "order", "." ]
def _unordered_iter(self): """iterator for results *as they arrive*, on FCFS basis, ignoring submission order.""" try: rlist = self.get(0) except TimeoutError: pending = self._children while pending: done, pending = concurrent.futures.wait( ...
[ "def", "_unordered_iter", "(", "self", ")", ":", "try", ":", "rlist", "=", "self", ".", "get", "(", "0", ")", "except", "TimeoutError", ":", "pending", "=", "self", ".", "_children", "while", "pending", ":", "done", ",", "pending", "=", "concurrent", "...
https://github.com/ipython/ipyparallel/blob/d35d4fb9501da5b3280b11e83ed633a95f17be1d/ipyparallel/client/asyncresult.py#L1145-L1159
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_router.py
python
Service.get_ports
(self)
return self.get(Service.port_path) or []
get a list of ports
get a list of ports
[ "get", "a", "list", "of", "ports" ]
def get_ports(self): ''' get a list of ports ''' return self.get(Service.port_path) or []
[ "def", "get_ports", "(", "self", ")", ":", "return", "self", ".", "get", "(", "Service", ".", "port_path", ")", "or", "[", "]" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_adm_router.py#L1687-L1689
allenai/allennlp
a3d71254fcc0f3615910e9c3d48874515edf53e0
allennlp/training/scheduler.py
python
Scheduler.step
(self, metric: float = None)
[]
def step(self, metric: float = None) -> None: self.last_epoch += 1 self.metric = metric for param_group, value in zip(self.optimizer.param_groups, self.get_values()): param_group[self.param_group_field] = value
[ "def", "step", "(", "self", ",", "metric", ":", "float", "=", "None", ")", "->", "None", ":", "self", ".", "last_epoch", "+=", "1", "self", ".", "metric", "=", "metric", "for", "param_group", ",", "value", "in", "zip", "(", "self", ".", "optimizer", ...
https://github.com/allenai/allennlp/blob/a3d71254fcc0f3615910e9c3d48874515edf53e0/allennlp/training/scheduler.py#L71-L75
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/Utility.py
python
MessageInterface.canonicalize
(self)
canonicalize the underlying DOM, and return as string.
canonicalize the underlying DOM, and return as string.
[ "canonicalize", "the", "underlying", "DOM", "and", "return", "as", "string", "." ]
def canonicalize(self): '''canonicalize the underlying DOM, and return as string. ''' raise NotImplementedError, ''
[ "def", "canonicalize", "(", "self", ")", ":", "raise", "NotImplementedError", ",", "''" ]
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/ZSI-2.1-a1/ZSI/wstools/Utility.py#L679-L682
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
components/isceobj/ImageFilter/ComplexExtractor.py
python
ComplexExtractor.finalize
(self)
Finalize filter baseclass and output accessor if created here and not passed
Finalize filter baseclass and output accessor if created here and not passed
[ "Finalize", "filter", "baseclass", "and", "output", "accessor", "if", "created", "here", "and", "not", "passed" ]
def finalize(self):#extend base one """Finalize filter baseclass and output accessor if created here and not passed""" if self._outCreatedHere: self._imgOut.finalizeImage() Filter.finalize(self)
[ "def", "finalize", "(", "self", ")", ":", "#extend base one", "if", "self", ".", "_outCreatedHere", ":", "self", ".", "_imgOut", ".", "finalizeImage", "(", ")", "Filter", ".", "finalize", "(", "self", ")" ]
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/ImageFilter/ComplexExtractor.py#L84-L88
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_version.py
python
OpenShiftCLIConfig.to_option_list
(self, ascommalist='')
return self.stringify(ascommalist)
return all options as a string if ascommalist is set to the name of a key, and the value of that key is a dict, format the dict as a list of comma delimited key=value pairs
return all options as a string if ascommalist is set to the name of a key, and the value of that key is a dict, format the dict as a list of comma delimited key=value pairs
[ "return", "all", "options", "as", "a", "string", "if", "ascommalist", "is", "set", "to", "the", "name", "of", "a", "key", "and", "the", "value", "of", "that", "key", "is", "a", "dict", "format", "the", "dict", "as", "a", "list", "of", "comma", "delim...
def to_option_list(self, ascommalist=''): '''return all options as a string if ascommalist is set to the name of a key, and the value of that key is a dict, format the dict as a list of comma delimited key=value pairs''' return self.stringify(ascommalist)
[ "def", "to_option_list", "(", "self", ",", "ascommalist", "=", "''", ")", ":", "return", "self", ".", "stringify", "(", "ascommalist", ")" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_version.py#L1401-L1406
lawsie/guizero
1c3011a3b0930175beaec3aa2f5503bf9339a0a3
guizero/base.py
python
BaseWindow.__init__
(self, master, tk, title, width, height, layout, bg, visible)
Base class for objects which use windows e.g. `App` and `Window`
Base class for objects which use windows e.g. `App` and `Window`
[ "Base", "class", "for", "objects", "which", "use", "windows", "e", ".", "g", ".", "App", "and", "Window" ]
def __init__(self, master, tk, title, width, height, layout, bg, visible): """ Base class for objects which use windows e.g. `App` and `Window` """ super().__init__(master, tk, layout, False) # Initial setup self.tk.title( str(title) ) self.tk.geometry(str(width)...
[ "def", "__init__", "(", "self", ",", "master", ",", "tk", ",", "title", ",", "width", ",", "height", ",", "layout", ",", "bg", ",", "visible", ")", ":", "super", "(", ")", ".", "__init__", "(", "master", ",", "tk", ",", "layout", ",", "False", ")...
https://github.com/lawsie/guizero/blob/1c3011a3b0930175beaec3aa2f5503bf9339a0a3/guizero/base.py#L478-L498
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/interfaces/fricas.py
python
FriCAS._assign_symbol
(self)
return ":="
Return the symbol used for setting a variable in FriCAS. EXAMPLES:: sage: fricas.set("x", "1"); # optional - fricas, indirect doctest sage: fricas.get("x") # optional - fricas '1' ...
Return the symbol used for setting a variable in FriCAS.
[ "Return", "the", "symbol", "used", "for", "setting", "a", "variable", "in", "FriCAS", "." ]
def _assign_symbol(self): """ Return the symbol used for setting a variable in FriCAS. EXAMPLES:: sage: fricas.set("x", "1"); # optional - fricas, indirect doctest sage: fricas.get("x") ...
[ "def", "_assign_symbol", "(", "self", ")", ":", "return", "\":=\"" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/interfaces/fricas.py#L821-L833
avocado-framework/avocado
1f9b3192e8ba47d029c33fe21266bd113d17811f
avocado/utils/datadrainer.py
python
BufferFDDrainer.data
(self)
return self._data.getvalue()
Returns the buffer data, as bytes
Returns the buffer data, as bytes
[ "Returns", "the", "buffer", "data", "as", "bytes" ]
def data(self): """ Returns the buffer data, as bytes """ return self._data.getvalue()
[ "def", "data", "(", "self", ")", ":", "return", "self", ".", "_data", ".", "getvalue", "(", ")" ]
https://github.com/avocado-framework/avocado/blob/1f9b3192e8ba47d029c33fe21266bd113d17811f/avocado/utils/datadrainer.py#L164-L168
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/_lib/future/future/backports/urllib/parse.py
python
splitvalue
(attr)
return attr, None
splitvalue('attr=value') --> 'attr', 'value'.
splitvalue('attr=value') --> 'attr', 'value'.
[ "splitvalue", "(", "attr", "=", "value", ")", "--", ">", "attr", "value", "." ]
def splitvalue(attr): """splitvalue('attr=value') --> 'attr', 'value'.""" global _valueprog if _valueprog is None: import re _valueprog = re.compile('^([^=]*)=(.*)$') match = _valueprog.match(attr) if match: return match.group(1, 2) return attr, None
[ "def", "splitvalue", "(", "attr", ")", ":", "global", "_valueprog", "if", "_valueprog", "is", "None", ":", "import", "re", "_valueprog", "=", "re", ".", "compile", "(", "'^([^=]*)=(.*)$'", ")", "match", "=", "_valueprog", ".", "match", "(", "attr", ")", ...
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/urllib/parse.py#L982-L991
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
apps/rss_feeds/management/commands/task_feeds.py
python
Command.add_arguments
(self, parser)
[]
def add_arguments(self, parser): parser.add_argument("-f", "--feed", default=None) parser.add_argument("-a", "--all", default=False, action='store_true') parser.add_argument("-b", "--broken", help="Task broken feeds that havent been fetched in a day.", default=False, action='store_true') ...
[ "def", "add_arguments", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "\"-f\"", ",", "\"--feed\"", ",", "default", "=", "None", ")", "parser", ".", "add_argument", "(", "\"-a\"", ",", "\"--all\"", ",", "default", "=", "False", ...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/rss_feeds/management/commands/task_feeds.py#L9-L14
fortharris/Pcode
147962d160a834c219e12cb456abc130826468e4
Xtra/autopep8.py
python
fix_multiple_files
(filenames, options, output=None)
Fix list of files. Optionally fix files recursively.
Fix list of files.
[ "Fix", "list", "of", "files", "." ]
def fix_multiple_files(filenames, options, output=None): """Fix list of files. Optionally fix files recursively. """ filenames = find_files(filenames, options.recursive, options.exclude) if options.jobs > 1: import multiprocessing pool = multiprocessing.Pool(options.jobs) p...
[ "def", "fix_multiple_files", "(", "filenames", ",", "options", ",", "output", "=", "None", ")", ":", "filenames", "=", "find_files", "(", "filenames", ",", "options", ".", "recursive", ",", "options", ".", "exclude", ")", "if", "options", ".", "jobs", ">",...
https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Xtra/autopep8.py#L3525-L3539
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
site-packages/babel/messages/catalog.py
python
Catalog.__delitem__
(self, id)
Delete the message with the specified ID.
Delete the message with the specified ID.
[ "Delete", "the", "message", "with", "the", "specified", "ID", "." ]
def __delitem__(self, id): """Delete the message with the specified ID.""" self.delete(id)
[ "def", "__delitem__", "(", "self", ",", "id", ")", ":", "self", ".", "delete", "(", "id", ")" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/babel/messages/catalog.py#L567-L569
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/ssl.py
python
SSLContext.verify_flags
(self, value)
[]
def verify_flags(self, value): super(SSLContext, SSLContext).verify_flags.__set__(self, value)
[ "def", "verify_flags", "(", "self", ",", "value", ")", ":", "super", "(", "SSLContext", ",", "SSLContext", ")", ".", "verify_flags", ".", "__set__", "(", "self", ",", "value", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/ssl.py#L724-L725
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
libs/platform-tools/platform-tools_windows/systrace/catapult/common/py_utils/py_utils/refactor/module.py
python
Module.Write
(self)
Write modifications to the file.
Write modifications to the file.
[ "Write", "modifications", "to", "the", "file", "." ]
def Write(self): """Write modifications to the file.""" if not self.modified: return # Stringify before opening the file for writing. # If we fail, we won't truncate the file. string = str(self._snippet) with open(self._file_path, 'w') as f: f.write(string)
[ "def", "Write", "(", "self", ")", ":", "if", "not", "self", ".", "modified", ":", "return", "# Stringify before opening the file for writing.", "# If we fail, we won't truncate the file.", "string", "=", "str", "(", "self", ".", "_snippet", ")", "with", "open", "(",...
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_windows/systrace/catapult/common/py_utils/py_utils/refactor/module.py#L30-L39
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/tkinter/ttk.py
python
Labelframe.__init__
(self, master=None, **kw)
Construct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height
Construct a Ttk Labelframe with parent master.
[ "Construct", "a", "Ttk", "Labelframe", "with", "parent", "master", "." ]
def __init__(self, master=None, **kw): """Construct a Ttk Labelframe with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS labelanchor, text, underline, padding, labelwidget, width, height """ Widget.__...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "*", "*", "kw", ")", ":", "Widget", ".", "__init__", "(", "self", ",", "master", ",", "\"ttk::labelframe\"", ",", "kw", ")" ]
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/ttk.py#L760-L771
huggingface/datasets
249b4a38390bf1543f5b6e2f3dc208b5689c1c13
datasets/subjqa/subjqa.py
python
Subjqa._create_paragraphs
(self, df)
return pars
A helper function to convert a pandas.DataFrame of (question, context, answer) rows to SQuAD paragraphs.
A helper function to convert a pandas.DataFrame of (question, context, answer) rows to SQuAD paragraphs.
[ "A", "helper", "function", "to", "convert", "a", "pandas", ".", "DataFrame", "of", "(", "question", "context", "answer", ")", "rows", "to", "SQuAD", "paragraphs", "." ]
def _create_paragraphs(self, df): "A helper function to convert a pandas.DataFrame of (question, context, answer) rows to SQuAD paragraphs." self.question_meta_columns = [ "domain", "nn_mod", "nn_asp", "query_mod", "query_asp", "q_r...
[ "def", "_create_paragraphs", "(", "self", ",", "df", ")", ":", "self", ".", "question_meta_columns", "=", "[", "\"domain\"", ",", "\"nn_mod\"", ",", "\"nn_asp\"", ",", "\"query_mod\"", ",", "\"query_asp\"", ",", "\"q_reviews_id\"", ",", "\"question_subj_level\"", ...
https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/subjqa/subjqa.py#L159-L198
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/metrics/agreement.py
python
AnnotationTask.weighted_kappa
(self, max_distance=1.0)
return self._pairwise_average( lambda cA, cB: self.weighted_kappa_pairwise(cA, cB, max_distance) )
Cohen 1968
Cohen 1968
[ "Cohen", "1968" ]
def weighted_kappa(self, max_distance=1.0): """Cohen 1968""" return self._pairwise_average( lambda cA, cB: self.weighted_kappa_pairwise(cA, cB, max_distance) )
[ "def", "weighted_kappa", "(", "self", ",", "max_distance", "=", "1.0", ")", ":", "return", "self", ".", "_pairwise_average", "(", "lambda", "cA", ",", "cB", ":", "self", ".", "weighted_kappa_pairwise", "(", "cA", ",", "cB", ",", "max_distance", ")", ")" ]
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/metrics/agreement.py#L340-L344
Paradoxis/StegCracker
a2539db285a363fcc5210e340058ea5af48257e3
stegcracker/helpers.py
python
handle_interrupt
(func)
return wrapper
Decorator which ensures that keyboard interrupts are handled properly.
Decorator which ensures that keyboard interrupts are handled properly.
[ "Decorator", "which", "ensures", "that", "keyboard", "interrupts", "are", "handled", "properly", "." ]
def handle_interrupt(func): """Decorator which ensures that keyboard interrupts are handled properly.""" def wrapper(): try: return func() or 0 except KeyboardInterrupt: print('\n\033[31mError:\033[0m Aborted.') return 1 return wrapper
[ "def", "handle_interrupt", "(", "func", ")", ":", "def", "wrapper", "(", ")", ":", "try", ":", "return", "func", "(", ")", "or", "0", "except", "KeyboardInterrupt", ":", "print", "(", "'\\n\\033[31mError:\\033[0m Aborted.'", ")", "return", "1", "return", "wr...
https://github.com/Paradoxis/StegCracker/blob/a2539db285a363fcc5210e340058ea5af48257e3/stegcracker/helpers.py#L46-L54
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/werkzeug/exceptions.py
python
HTTPException.get_response
(self, environ)
return BaseResponse(self.get_body(environ), self.code, headers)
Get a response object. :param environ: the environ for the request. :return: a :class:`BaseResponse` object or a subclass thereof.
Get a response object.
[ "Get", "a", "response", "object", "." ]
def get_response(self, environ): """Get a response object. :param environ: the environ for the request. :return: a :class:`BaseResponse` object or a subclass thereof. """ # lazily imported for various reasons. For one, we can use the exceptions # with custom responses (...
[ "def", "get_response", "(", "self", ",", "environ", ")", ":", "# lazily imported for various reasons. For one, we can use the exceptions", "# with custom responses (testing exception instances against types) and", "# so we don't ever have to import the wrappers, but also because there", "# ar...
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/werkzeug/exceptions.py#L119-L132
rootpy/rootpy
3926935e1f2100d8ba68070c2ab44055d4800f73
rootpy/io/file.py
python
_DirectoryBase.__contains__
(self, path)
Determine if a an object exists in the file at the path `path`:: if 'some/thing' in file: # do something
Determine if a an object exists in the file at the path `path`::
[ "Determine", "if", "a", "an", "object", "exists", "in", "the", "file", "at", "the", "path", "path", "::" ]
def __contains__(self, path): """ Determine if a an object exists in the file at the path `path`:: if 'some/thing' in file: # do something """ try: self.GetKey(path) return True except DoesNotExist: return False
[ "def", "__contains__", "(", "self", ",", "path", ")", ":", "try", ":", "self", ".", "GetKey", "(", "path", ")", "return", "True", "except", "DoesNotExist", ":", "return", "False" ]
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/io/file.py#L372-L383
beeware/ouroboros
a29123c6fab6a807caffbb7587cf548e0c370296
ouroboros/numbers.py
python
Integral.__rand__
(self, other)
other & self
other & self
[ "other", "&", "self" ]
def __rand__(self, other): """other & self""" raise NotImplementedError
[ "def", "__rand__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/numbers.py#L345-L347
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/nltk/corpus/reader/framenet.py
python
_pretty_fe_relation
(ferel)
return outstr
Helper function for pretty-printing an FE relation. :param ferel: The FE relation to be printed. :type ferel: AttrDict :return: A nicely formatted string representation of the FE relation. :rtype: str
Helper function for pretty-printing an FE relation.
[ "Helper", "function", "for", "pretty", "-", "printing", "an", "FE", "relation", "." ]
def _pretty_fe_relation(ferel): """ Helper function for pretty-printing an FE relation. :param ferel: The FE relation to be printed. :type ferel: AttrDict :return: A nicely formatted string representation of the FE relation. :rtype: str """ outstr = "<{0.type.superFrameName}={0.frameRe...
[ "def", "_pretty_fe_relation", "(", "ferel", ")", ":", "outstr", "=", "\"<{0.type.superFrameName}={0.frameRelation.superFrameName}.{0.superFEName} -- {0.type.name} -> {0.type.subFrameName}={0.frameRelation.subFrameName}.{0.subFEName}>\"", ".", "format", "(", "ferel", ")", "return", "out...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/corpus/reader/framenet.py#L161-L174
dipy/dipy
be956a529465b28085f8fc435a756947ddee1c89
dipy/data/fetcher.py
python
read_cenir_multib
(bvals=None)
return (nib.Nifti1Image(np.concatenate(data, -1), aff), gradient_table(bval_list, np.concatenate(bvec_list, -1)))
Read CENIR multi b-value data. Parameters ---------- bvals : list or int The b-values to read from file (200, 400, 1000, 2000, 3000). Returns ------- gtab : a GradientTable class instance img : nibabel.Nifti1Image
Read CENIR multi b-value data.
[ "Read", "CENIR", "multi", "b", "-", "value", "data", "." ]
def read_cenir_multib(bvals=None): """Read CENIR multi b-value data. Parameters ---------- bvals : list or int The b-values to read from file (200, 400, 1000, 2000, 3000). Returns ------- gtab : a GradientTable class instance img : nibabel.Nifti1Image """ files, folder...
[ "def", "read_cenir_multib", "(", "bvals", "=", "None", ")", ":", "files", ",", "folder", "=", "fetch_cenir_multib", "(", "with_raw", "=", "False", ")", "if", "bvals", "is", "None", ":", "bvals", "=", "[", "200", ",", "400", ",", "1000", ",", "2000", ...
https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/data/fetcher.py#L1137-L1182
rabobank-cdc/DeTTECT
0b886c2663bc7a6a15488839c2569785c16d08e9
technique_mapping.py
python
export_techniques_list_to_excel
(filename, output_filename)
Makes an overview of the MITRE ATT&CK techniques from the YAML administration file. :param filename: the filename of the YAML file containing the techniques administration :param output_filename: the output filename defined by the user :return:
Makes an overview of the MITRE ATT&CK techniques from the YAML administration file. :param filename: the filename of the YAML file containing the techniques administration :param output_filename: the output filename defined by the user :return:
[ "Makes", "an", "overview", "of", "the", "MITRE", "ATT&CK", "techniques", "from", "the", "YAML", "administration", "file", ".", ":", "param", "filename", ":", "the", "filename", "of", "the", "YAML", "file", "containing", "the", "techniques", "administration", "...
def export_techniques_list_to_excel(filename, output_filename): """ Makes an overview of the MITRE ATT&CK techniques from the YAML administration file. :param filename: the filename of the YAML file containing the techniques administration :param output_filename: the output filename defined by the user ...
[ "def", "export_techniques_list_to_excel", "(", "filename", ",", "output_filename", ")", ":", "# pylint: disable=unused-variable", "my_techniques", ",", "name", ",", "platform", "=", "load_techniques", "(", "filename", ")", "my_techniques", "=", "dict", "(", "sorted", ...
https://github.com/rabobank-cdc/DeTTECT/blob/0b886c2663bc7a6a15488839c2569785c16d08e9/technique_mapping.py#L344-L482
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/config.py
python
merge_packages_config
( hass: HomeAssistant, config: dict, packages: dict[str, Any], _log_pkg_error: Callable = _log_pkg_error, )
return config
Merge packages into the top-level configuration. Mutate config.
Merge packages into the top-level configuration. Mutate config.
[ "Merge", "packages", "into", "the", "top", "-", "level", "configuration", ".", "Mutate", "config", "." ]
async def merge_packages_config( hass: HomeAssistant, config: dict, packages: dict[str, Any], _log_pkg_error: Callable = _log_pkg_error, ) -> dict: """Merge packages into the top-level configuration. Mutate config.""" PACKAGES_CONFIG_SCHEMA(packages) for pack_name, pack_conf in packages.item...
[ "async", "def", "merge_packages_config", "(", "hass", ":", "HomeAssistant", ",", "config", ":", "dict", ",", "packages", ":", "dict", "[", "str", ",", "Any", "]", ",", "_log_pkg_error", ":", "Callable", "=", "_log_pkg_error", ",", ")", "->", "dict", ":", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/config.py#L706-L784
pypa/pipenv
b21baade71a86ab3ee1429f71fbc14d4f95fb75d
pipenv/vendor/tomlkit/parser.py
python
Parser._peek
(self, n)
Peeks ahead n characters. n is the max number of characters that will be peeked.
Peeks ahead n characters.
[ "Peeks", "ahead", "n", "characters", "." ]
def _peek(self, n): # type: (int) -> str """ Peeks ahead n characters. n is the max number of characters that will be peeked. """ # we always want to restore after exiting this scope with self._state(restore=True): buf = "" for _ in range(n): ...
[ "def", "_peek", "(", "self", ",", "n", ")", ":", "# type: (int) -> str", "# we always want to restore after exiting this scope", "with", "self", ".", "_state", "(", "restore", "=", "True", ")", ":", "buf", "=", "\"\"", "for", "_", "in", "range", "(", "n", ")...
https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/tomlkit/parser.py#L1247-L1263
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/virt/libvirt/utils.py
python
remove_logical_volumes
(*paths)
Remove one or more logical volume.
Remove one or more logical volume.
[ "Remove", "one", "or", "more", "logical", "volume", "." ]
def remove_logical_volumes(*paths): """Remove one or more logical volume.""" for path in paths: clear_logical_volume(path) if paths: lvremove = ('lvremove', '-f') + paths execute(*lvremove, attempts=3, run_as_root=True)
[ "def", "remove_logical_volumes", "(", "*", "paths", ")", ":", "for", "path", "in", "paths", ":", "clear_logical_volume", "(", "path", ")", "if", "paths", ":", "lvremove", "=", "(", "'lvremove'", ",", "'-f'", ")", "+", "paths", "execute", "(", "*", "lvrem...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/virt/libvirt/utils.py#L345-L353
smicallef/spiderfoot
fd4bf9394c9ab3ecc90adc3115c56349fb23165b
modules/sfp_jsonwhoiscom.py
python
sfp_jsonwhoiscom.setup
(self, sfc, userOpts=dict())
[]
def setup(self, sfc, userOpts=dict()): self.sf = sfc self.results = self.tempStorage() self.errorState = False for opt in userOpts.keys(): self.opts[opt] = userOpts[opt]
[ "def", "setup", "(", "self", ",", "sfc", ",", "userOpts", "=", "dict", "(", ")", ")", ":", "self", ".", "sf", "=", "sfc", "self", ".", "results", "=", "self", ".", "tempStorage", "(", ")", "self", ".", "errorState", "=", "False", "for", "opt", "i...
https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_jsonwhoiscom.py#L67-L73