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
jobovy/galpy
8e6a230bbe24ce16938db10053f92eb17fe4bb52
galpy/actionAngle/actionAngleAdiabatic.py
python
actionAngleAdiabatic.calczmax
(self,*args,**kwargs)
return aAAxi.calczmax(**kwargs)
NAME: calczmax PURPOSE: calculate the maximum height INPUT: Either: a) R,vR,vT,z,vz b) Orbit instance: initial condition used if that's it, orbit(t) if there is a time given as well OUTPUT: zmax HIST...
NAME: calczmax PURPOSE: calculate the maximum height INPUT: Either: a) R,vR,vT,z,vz b) Orbit instance: initial condition used if that's it, orbit(t) if there is a time given as well OUTPUT: zmax HIST...
[ "NAME", ":", "calczmax", "PURPOSE", ":", "calculate", "the", "maximum", "height", "INPUT", ":", "Either", ":", "a", ")", "R", "vR", "vT", "z", "vz", "b", ")", "Orbit", "instance", ":", "initial", "condition", "used", "if", "that", "s", "it", "orbit", ...
def calczmax(self,*args,**kwargs): #pragma: no cover """ NAME: calczmax PURPOSE: calculate the maximum height INPUT: Either: a) R,vR,vT,z,vz b) Orbit instance: initial condition used if that's it, orbit(t) if t...
[ "def", "calczmax", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#pragma: no cover", "warnings", ".", "warn", "(", "\"actionAngleAdiabatic.calczmax function will soon be deprecated; please contact galpy's maintainer if you require this function\"", ")", "...
https://github.com/jobovy/galpy/blob/8e6a230bbe24ce16938db10053f92eb17fe4bb52/galpy/actionAngle/actionAngleAdiabatic.py#L258-L282
ansible/ansible-modules-core
00911a75ad6635834b6d28eef41f197b2f73c381
packaging/os/yum.py
python
local_nvra
(module, path)
return '%s-%s-%s.%s' % (header[rpm.RPMTAG_NAME], header[rpm.RPMTAG_VERSION], header[rpm.RPMTAG_RELEASE], header[rpm.RPMTAG_ARCH])
return nvra of a local rpm passed in
return nvra of a local rpm passed in
[ "return", "nvra", "of", "a", "local", "rpm", "passed", "in" ]
def local_nvra(module, path): """return nvra of a local rpm passed in""" ts = rpm.TransactionSet() ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) fd = os.open(path, os.O_RDONLY) try: header = ts.hdrFromFdno(fd) finally: os.close(fd) return '%s-%s-%s.%s' % (header[rpm.RPMTAG_NAME],...
[ "def", "local_nvra", "(", "module", ",", "path", ")", ":", "ts", "=", "rpm", ".", "TransactionSet", "(", ")", "ts", ".", "setVSFlags", "(", "rpm", ".", "_RPMVSF_NOSIGNATURES", ")", "fd", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_RDONLY"...
https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/packaging/os/yum.py#L524-L538
mrkipling/maraschino
c6be9286937783ae01df2d6d8cebfc8b2734a7d7
lib/sqlalchemy/event.py
python
remove
(target, identifier, fn)
Remove an event listener. Note that some event removals, particularly for those event dispatchers which create wrapper functions and secondary even listeners, may not yet be supported.
Remove an event listener.
[ "Remove", "an", "event", "listener", "." ]
def remove(target, identifier, fn): """Remove an event listener. Note that some event removals, particularly for those event dispatchers which create wrapper functions and secondary even listeners, may not yet be supported. """ for evt_cls in _registrars[identifier]: for tgt in evt_cls...
[ "def", "remove", "(", "target", ",", "identifier", ",", "fn", ")", ":", "for", "evt_cls", "in", "_registrars", "[", "identifier", "]", ":", "for", "tgt", "in", "evt_cls", ".", "_accept_with", "(", "target", ")", ":", "tgt", ".", "dispatch", ".", "_remo...
https://github.com/mrkipling/maraschino/blob/c6be9286937783ae01df2d6d8cebfc8b2734a7d7/lib/sqlalchemy/event.py#L62-L73
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v7/services/services/feed_item_target_service/client.py
python
FeedItemTargetServiceClientMeta.get_transport_class
( cls, label: str = None, )
return next(iter(cls._transport_registry.values()))
Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is used. Returns: The transport class to use.
Return an appropriate transport class.
[ "Return", "an", "appropriate", "transport", "class", "." ]
def get_transport_class( cls, label: str = None, ) -> Type[FeedItemTargetServiceTransport]: """Return an appropriate transport class. Args: label: The name of the desired transport. If none is provided, then the first transport in the registry is used. R...
[ "def", "get_transport_class", "(", "cls", ",", "label", ":", "str", "=", "None", ",", ")", "->", "Type", "[", "FeedItemTargetServiceTransport", "]", ":", "# If a specific transport is requested, return that one.", "if", "label", ":", "return", "cls", ".", "_transpor...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/feed_item_target_service/client.py#L52-L70
garywiz/chaperone
9ff2c3a5b9c6820f8750320a564ea214042df06f
chaperone/cproc/pt/inetd.py
python
InetdService._create_server
(self)
return asyncio.get_event_loop().create_server(InetdServiceProtocol.buildProtocol(self, process=self.process), '0.0.0.0', self.process.port)
[]
def _create_server(self): return asyncio.get_event_loop().create_server(InetdServiceProtocol.buildProtocol(self, process=self.process), '0.0.0.0', self.process.port)
[ "def", "_create_server", "(", "self", ")", ":", "return", "asyncio", ".", "get_event_loop", "(", ")", ".", "create_server", "(", "InetdServiceProtocol", ".", "buildProtocol", "(", "self", ",", "process", "=", "self", ".", "process", ")", ",", "'0.0.0.0'", ",...
https://github.com/garywiz/chaperone/blob/9ff2c3a5b9c6820f8750320a564ea214042df06f/chaperone/cproc/pt/inetd.py#L83-L86
weinbe58/QuSpin
5bbc3204dbf5c227a87a44f0dacf39509cba580c
quspin/basis/basis_general/fermion.py
python
spinful_fermion_basis_general.__init__
(self,N,Nf=None,nf=None,Ns_block_est=None,simple_symm=True,make_basis=True,block_order=None,double_occupancy=True,**blocks)
Intializes the `spinful_fermion_basis_general` object (basis for fermionic operators). Parameters ----------- L: int Length of chain/number of sites. Nf: tuple(int), optional Number of fermions in chain. Can be tupe of integers or list of tuples of integers `[(Nup,Ndown),...]` to specify one or more part...
Intializes the `spinful_fermion_basis_general` object (basis for fermionic operators).
[ "Intializes", "the", "spinful_fermion_basis_general", "object", "(", "basis", "for", "fermionic", "operators", ")", "." ]
def __init__(self,N,Nf=None,nf=None,Ns_block_est=None,simple_symm=True,make_basis=True,block_order=None,double_occupancy=True,**blocks): """Intializes the `spinful_fermion_basis_general` object (basis for fermionic operators). Parameters ----------- L: int Length of chain/number of sites. Nf: tuple(int), ...
[ "def", "__init__", "(", "self", ",", "N", ",", "Nf", "=", "None", ",", "nf", "=", "None", ",", "Ns_block_est", "=", "None", ",", "simple_symm", "=", "True", ",", "make_basis", "=", "True", ",", "block_order", "=", "None", ",", "double_occupancy", "=", ...
https://github.com/weinbe58/QuSpin/blob/5bbc3204dbf5c227a87a44f0dacf39509cba580c/quspin/basis/basis_general/fermion.py#L328-L501
yangxudong/deeplearning
1b925c2171902d9a352d3747495030e058220204
telepath/mobilenet_v2.py
python
mobilenet
(input_tensor, num_classes=1001, depth_multiplier=1.0, scope='MobilenetV2', conv_defs=None, finegrain_classification_mode=False, min_depth=None, divisible_by=None, **kwargs)
Creates mobilenet V2 network. Inference mode is created by default. To create training use training_scope below. with tf.contrib.slim.arg_scope(mobilenet_v2.training_scope()): logits, endpoints = mobilenet_v2.mobilenet(input_tensor) Args: input_tensor: The input tensor num_classes: number of cla...
Creates mobilenet V2 network.
[ "Creates", "mobilenet", "V2", "network", "." ]
def mobilenet(input_tensor, num_classes=1001, depth_multiplier=1.0, scope='MobilenetV2', conv_defs=None, finegrain_classification_mode=False, min_depth=None, divisible_by=None, **kwargs): """Creates mobilen...
[ "def", "mobilenet", "(", "input_tensor", ",", "num_classes", "=", "1001", ",", "depth_multiplier", "=", "1.0", ",", "scope", "=", "'MobilenetV2'", ",", "conv_defs", "=", "None", ",", "finegrain_classification_mode", "=", "False", ",", "min_depth", "=", "None", ...
https://github.com/yangxudong/deeplearning/blob/1b925c2171902d9a352d3747495030e058220204/telepath/mobilenet_v2.py#L85-L154
galaxyproject/galaxy
4c03520f05062e0f4a1b3655dc0b7452fda69943
lib/galaxy/web_stack/__init__.py
python
ApplicationStack._set_default_job_handler_assignment_methods
(self, job_config, base_pool)
Override in subclasses to set default job handler assignment methods if not explicitly configured by the administrator. Called once per job_config.
Override in subclasses to set default job handler assignment methods if not explicitly configured by the administrator.
[ "Override", "in", "subclasses", "to", "set", "default", "job", "handler", "assignment", "methods", "if", "not", "explicitly", "configured", "by", "the", "administrator", "." ]
def _set_default_job_handler_assignment_methods(self, job_config, base_pool): """Override in subclasses to set default job handler assignment methods if not explicitly configured by the administrator. Called once per job_config. """
[ "def", "_set_default_job_handler_assignment_methods", "(", "self", ",", "job_config", ",", "base_pool", ")", ":" ]
https://github.com/galaxyproject/galaxy/blob/4c03520f05062e0f4a1b3655dc0b7452fda69943/lib/galaxy/web_stack/__init__.py#L110-L114
web2py/web2py
095905c4e010a1426c729483d912e270a51b7ba8
gluon/contrib/login_methods/openid_auth.py
python
OpenIDAuth._form_with_notification
(self)
return lambda: form
Render the form for normal login with a notice of OpenID authenticated
Render the form for normal login with a notice of OpenID authenticated
[ "Render", "the", "form", "for", "normal", "login", "with", "a", "notice", "of", "OpenID", "authenticated" ]
def _form_with_notification(self): """ Render the form for normal login with a notice of OpenID authenticated """ form = DIV() # TODO: check when will happen if self.auth.settings.login_form in (self.auth, self): self.auth.settings.login_form = self.auth ...
[ "def", "_form_with_notification", "(", "self", ")", ":", "form", "=", "DIV", "(", ")", "# TODO: check when will happen", "if", "self", ".", "auth", ".", "settings", ".", "login_form", "in", "(", "self", ".", "auth", ",", "self", ")", ":", "self", ".", "a...
https://github.com/web2py/web2py/blob/095905c4e010a1426c729483d912e270a51b7ba8/gluon/contrib/login_methods/openid_auth.py#L247-L259
fooying/3102
0faee38c30b2e24154f41e68457cfd8f7a61c040
thirdparty/dns/tokenizer.py
python
Tokenizer.get_identifier
(self, origin=None)
return token.value
Read the next token and raise an exception if it is not an identifier. @raises dns.exception.SyntaxError: @rtype: string
Read the next token and raise an exception if it is not an identifier.
[ "Read", "the", "next", "token", "and", "raise", "an", "exception", "if", "it", "is", "not", "an", "identifier", "." ]
def get_identifier(self, origin=None): """Read the next token and raise an exception if it is not an identifier. @raises dns.exception.SyntaxError: @rtype: string """ token = self.get().unescape() if not token.is_identifier(): raise dns.exception.SyntaxError...
[ "def", "get_identifier", "(", "self", ",", "origin", "=", "None", ")", ":", "token", "=", "self", ".", "get", "(", ")", ".", "unescape", "(", ")", "if", "not", "token", ".", "is_identifier", "(", ")", ":", "raise", "dns", ".", "exception", ".", "Sy...
https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/dns/tokenizer.py#L507-L517
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/plistlib.py
python
_is_fmt_xml
(header)
return False
[]
def _is_fmt_xml(header): prefixes = (b'<?xml', b'<plist') for pfx in prefixes: if header.startswith(pfx): return True # Also check for alternative XML encodings, this is slightly # overkill because the Apple tools (and plistlib) will not # generate files with these encodings. ...
[ "def", "_is_fmt_xml", "(", "header", ")", ":", "prefixes", "=", "(", "b'<?xml'", ",", "b'<plist'", ")", "for", "pfx", "in", "prefixes", ":", "if", "header", ".", "startswith", "(", "pfx", ")", ":", "return", "True", "# Also check for alternative XML encodings,...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/plistlib.py#L406-L432
Blizzard/heroprotocol
3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c
heroprotocol/versions/protocol52351.py
python
decode_replay_game_events
(contents)
Decodes and yields each game event from the contents byte string.
Decodes and yields each game event from the contents byte string.
[ "Decodes", "and", "yields", "each", "game", "event", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_game_events(contents): """Decodes and yields each game event from the contents byte string.""" decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, game_eventid_typeid, game_ev...
[ "def", "decode_replay_game_events", "(", "contents", ")", ":", "decoder", "=", "BitPackedDecoder", "(", "contents", ",", "typeinfos", ")", "for", "event", "in", "_decode_event_stream", "(", "decoder", ",", "game_eventid_typeid", ",", "game_event_types", ",", "decode...
https://github.com/Blizzard/heroprotocol/blob/3d36eaf44fc4c8ff3331c2ae2f1dc08a94535f1c/heroprotocol/versions/protocol52351.py#L395-L402
certtools/intelmq
7c1ab88b77bcbb30c7cabca5bb3525ad4aaac138
intelmq/lib/bot.py
python
Bot.__handle_sighup_signal
(self, signum: int, stack: Optional[object])
Called when signal is received and postpone.
Called when signal is received and postpone.
[ "Called", "when", "signal", "is", "received", "and", "postpone", "." ]
def __handle_sighup_signal(self, signum: int, stack: Optional[object]): """ Called when signal is received and postpone. """ self.__sighup.set() if not self._sighup_delay: self.__handle_sighup() else: self.logger.info('Received SIGHUP, initializing...
[ "def", "__handle_sighup_signal", "(", "self", ",", "signum", ":", "int", ",", "stack", ":", "Optional", "[", "object", "]", ")", ":", "self", ".", "__sighup", ".", "set", "(", ")", "if", "not", "self", ".", "_sighup_delay", ":", "self", ".", "__handle_...
https://github.com/certtools/intelmq/blob/7c1ab88b77bcbb30c7cabca5bb3525ad4aaac138/intelmq/lib/bot.py#L262-L270
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/metadata.py
python
LegacyMetadata.is_field
(self, name)
return name in _ALL_FIELDS
return True if name is a valid metadata key
return True if name is a valid metadata key
[ "return", "True", "if", "name", "is", "a", "valid", "metadata", "key" ]
def is_field(self, name): """return True if name is a valid metadata key""" name = self._convert_name(name) return name in _ALL_FIELDS
[ "def", "is_field", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "return", "name", "in", "_ALL_FIELDS" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/metadata.py#L345-L348
loicland/superpoint_graph
9dfa370542aed1f817c6267e5af7921747da30a6
partition/provider.py
python
object_name_to_label
(object_class)
return object_label
convert from object name in S3DIS to an int
convert from object name in S3DIS to an int
[ "convert", "from", "object", "name", "in", "S3DIS", "to", "an", "int" ]
def object_name_to_label(object_class): """convert from object name in S3DIS to an int""" object_label = { 'ceiling': 1, 'floor': 2, 'wall': 3, 'column': 4, 'beam': 5, 'window': 6, 'door': 7, 'table': 8, 'chair': 9, 'bookcase': 10, ...
[ "def", "object_name_to_label", "(", "object_class", ")", ":", "object_label", "=", "{", "'ceiling'", ":", "1", ",", "'floor'", ":", "2", ",", "'wall'", ":", "3", ",", "'column'", ":", "4", ",", "'beam'", ":", "5", ",", "'window'", ":", "6", ",", "'do...
https://github.com/loicland/superpoint_graph/blob/9dfa370542aed1f817c6267e5af7921747da30a6/partition/provider.py#L229-L247
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_user.py
python
Yedit.update
(self, path, value, index=None, curr_value=None)
return (False, self.yaml_dict)
put path, value into a dict
put path, value into a dict
[ "put", "path", "value", "into", "a", "dict" ]
def update(self, path, value, index=None, curr_value=None): ''' put path, value into a dict ''' try: entry = Yedit.get_entry(self.yaml_dict, path, self.separator) except KeyError: entry = None if isinstance(entry, dict): # AUDIT:maybe-no-member makes ...
[ "def", "update", "(", "self", ",", "path", ",", "value", ",", "index", "=", "None", ",", "curr_value", "=", "None", ")", ":", "try", ":", "entry", "=", "Yedit", ".", "get_entry", "(", "self", ".", "yaml_dict", ",", "path", ",", "self", ".", "separa...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_user.py#L595-L640
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow2/Classification/ConvNets/efficientnet/utils/augment.py
python
unwrap
(image: tf.Tensor, replace: int)
return image
Unwraps an image produced by wrap. Where there is a 0 in the last channel for every spatial position, the rest of the three channels in that spatial dimension are grayed (set to 128). Operations like translate and shear on a wrapped Tensor will leave 0s in empty locations. Some transformations look at the ...
Unwraps an image produced by wrap.
[ "Unwraps", "an", "image", "produced", "by", "wrap", "." ]
def unwrap(image: tf.Tensor, replace: int) -> tf.Tensor: """Unwraps an image produced by wrap. Where there is a 0 in the last channel for every spatial position, the rest of the three channels in that spatial dimension are grayed (set to 128). Operations like translate and shear on a wrapped Tensor will lea...
[ "def", "unwrap", "(", "image", ":", "tf", ".", "Tensor", ",", "replace", ":", "int", ")", "->", "tf", ".", "Tensor", ":", "image_shape", "=", "tf", ".", "shape", "(", "image", ")", "# Flatten the spatial dimensions.", "flattened_image", "=", "tf", ".", "...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow2/Classification/ConvNets/efficientnet/utils/augment.py#L538-L573
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/apply.py
python
Apply.normalize_dictlike_arg
( self, how: str, obj: DataFrame | Series, func: AggFuncTypeDict )
return func
Handler for dict-like argument. Ensures that necessary columns exist if obj is a DataFrame, and that a nested renamer is not passed. Also normalizes to all lists when values consists of a mix of list and non-lists.
Handler for dict-like argument.
[ "Handler", "for", "dict", "-", "like", "argument", "." ]
def normalize_dictlike_arg( self, how: str, obj: DataFrame | Series, func: AggFuncTypeDict ) -> AggFuncTypeDict: """ Handler for dict-like argument. Ensures that necessary columns exist if obj is a DataFrame, and that a nested renamer is not passed. Also normalizes to all li...
[ "def", "normalize_dictlike_arg", "(", "self", ",", "how", ":", "str", ",", "obj", ":", "DataFrame", "|", "Series", ",", "func", ":", "AggFuncTypeDict", ")", "->", "AggFuncTypeDict", ":", "assert", "how", "in", "(", "\"apply\"", ",", "\"agg\"", ",", "\"tran...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/apply.py#L559-L602
ClementPinard/DepthNet
3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3
datasets/listdataset.py
python
default_loader
(root, path_imgs, path_depth)
return [imgs, depth]
[]
def default_loader(root, path_imgs, path_depth): imgs = [imread(root/path) for path in path_imgs] depth = np.load(root/path_depth) return [imgs, depth]
[ "def", "default_loader", "(", "root", ",", "path_imgs", ",", "path_depth", ")", ":", "imgs", "=", "[", "imread", "(", "root", "/", "path", ")", "for", "path", "in", "path_imgs", "]", "depth", "=", "np", ".", "load", "(", "root", "/", "path_depth", ")...
https://github.com/ClementPinard/DepthNet/blob/3c753fc21b06c9be307d73c8e7a0c61f2ea56cc3/datasets/listdataset.py#L6-L9
awslabs/aws-lambda-powertools-python
0c6ac0fe183476140ee1df55fe9fa1cc20925577
aws_lambda_powertools/utilities/parameters/base.py
python
BaseProvider._get
(self, name: str, **sdk_options)
Retrieve parameter value from the underlying parameter store
Retrieve parameter value from the underlying parameter store
[ "Retrieve", "parameter", "value", "from", "the", "underlying", "parameter", "store" ]
def _get(self, name: str, **sdk_options) -> Union[str, bytes]: """ Retrieve parameter value from the underlying parameter store """ raise NotImplementedError()
[ "def", "_get", "(", "self", ",", "name", ":", "str", ",", "*", "*", "sdk_options", ")", "->", "Union", "[", "str", ",", "bytes", "]", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/utilities/parameters/base.py#L105-L109
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/jinja2/environment.py
python
Template.stream
(self, *args, **kwargs)
return TemplateStream(self.generate(*args, **kwargs))
Works exactly like :meth:`generate` but returns a :class:`TemplateStream`.
Works exactly like :meth:`generate` but returns a :class:`TemplateStream`.
[ "Works", "exactly", "like", ":", "meth", ":", "generate", "but", "returns", "a", ":", "class", ":", "TemplateStream", "." ]
def stream(self, *args, **kwargs): """Works exactly like :meth:`generate` but returns a :class:`TemplateStream`. """ return TemplateStream(self.generate(*args, **kwargs))
[ "def", "stream", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "TemplateStream", "(", "self", ".", "generate", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/jinja2/environment.py#L1023-L1027
mozilla/kitsune
7c7cf9baed57aa776547aea744243ccad6ca91fb
kitsune/groups/views.py
python
remove_leader
(request, group_slug, user_id)
return render(request, "groups/confirm_remove_leader.html", {"profile": prof, "leader": user})
Remove a leader from the group.
Remove a leader from the group.
[ "Remove", "a", "leader", "from", "the", "group", "." ]
def remove_leader(request, group_slug, user_id): """Remove a leader from the group.""" prof = get_object_or_404(GroupProfile, slug=group_slug) user = get_object_or_404(User, id=user_id) if not _user_can_manage_leaders(request.user, prof): raise PermissionDenied if request.method == "POST":...
[ "def", "remove_leader", "(", "request", ",", "group_slug", ",", "user_id", ")", ":", "prof", "=", "get_object_or_404", "(", "GroupProfile", ",", "slug", "=", "group_slug", ")", "user", "=", "get_object_or_404", "(", "User", ",", "id", "=", "user_id", ")", ...
https://github.com/mozilla/kitsune/blob/7c7cf9baed57aa776547aea744243ccad6ca91fb/kitsune/groups/views.py#L201-L215
mysql/mysql-utilities
08276b2258bf9739f53406b354b21195ff69a261
mysql/utilities/common/replication.py
python
Slave.get_delay
(self)
return (state, sec_behind, delay_remaining, read_log_file, read_log_pos)
Return slave delay values This method retrieves the slave's delay parameters. Returns tuple - slave delay values or None if not connected
Return slave delay values
[ "Return", "slave", "delay", "values" ]
def get_delay(self): """Return slave delay values This method retrieves the slave's delay parameters. Returns tuple - slave delay values or None if not connected """ res = self.get_status() if res == []: return None # slave IO state state = ...
[ "def", "get_delay", "(", "self", ")", ":", "res", "=", "self", ".", "get_status", "(", ")", "if", "res", "==", "[", "]", ":", "return", "None", "# slave IO state", "state", "=", "res", "[", "0", "]", "[", "_SLAVE_IO_STATE", "]", "# seconds behind master"...
https://github.com/mysql/mysql-utilities/blob/08276b2258bf9739f53406b354b21195ff69a261/mysql/utilities/common/replication.py#L1466-L1492
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/pkg_resources/__init__.py
python
get_distribution
(dist)
return dist
Return a current distribution object for a Requirement or string
Return a current distribution object for a Requirement or string
[ "Return", "a", "current", "distribution", "object", "for", "a", "Requirement", "or", "string" ]
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "six", ".", "string_types", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "di...
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/__init__.py#L476-L484
modin-project/modin
0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee
modin/pandas/indexing.py
python
boolean_mask_to_numeric
(indexer)
Convert boolean mask to numeric indices. Parameters ---------- indexer : list-like of booleans Returns ------- np.ndarray of ints Numerical positions of ``True`` elements in the passed `indexer`.
Convert boolean mask to numeric indices.
[ "Convert", "boolean", "mask", "to", "numeric", "indices", "." ]
def boolean_mask_to_numeric(indexer): """ Convert boolean mask to numeric indices. Parameters ---------- indexer : list-like of booleans Returns ------- np.ndarray of ints Numerical positions of ``True`` elements in the passed `indexer`. """ if isinstance(indexer, (np.n...
[ "def", "boolean_mask_to_numeric", "(", "indexer", ")", ":", "if", "isinstance", "(", "indexer", ",", "(", "np", ".", "ndarray", ",", "Series", ",", "pandas", ".", "Series", ")", ")", ":", "return", "np", ".", "where", "(", "indexer", ")", "[", "0", "...
https://github.com/modin-project/modin/blob/0d9d14e6669be3dd6bb3b72222dbe6a6dffe1bee/modin/pandas/indexing.py#L204-L227
pillone/usntssearch
24b5e5bc4b6af2589d95121c4d523dc58cb34273
NZBmegasearch/mechanize/_pullparser.py
python
_AbstractParser.get_tag
(self, *names)
Return the next Token that represents an opening or closing tag. If arguments are given, they are taken to be element names in which the caller is interested: tags representing other elements will be skipped. Element names must be given in lower case. Raises NoMoreTokensError.
Return the next Token that represents an opening or closing tag.
[ "Return", "the", "next", "Token", "that", "represents", "an", "opening", "or", "closing", "tag", "." ]
def get_tag(self, *names): """Return the next Token that represents an opening or closing tag. If arguments are given, they are taken to be element names in which the caller is interested: tags representing other elements will be skipped. Element names must be given in lower case. ...
[ "def", "get_tag", "(", "self", ",", "*", "names", ")", ":", "while", "1", ":", "tok", "=", "self", ".", "get_token", "(", ")", "if", "tok", ".", "type", "not", "in", "[", "\"starttag\"", ",", "\"endtag\"", ",", "\"startendtag\"", "]", ":", "continue"...
https://github.com/pillone/usntssearch/blob/24b5e5bc4b6af2589d95121c4d523dc58cb34273/NZBmegasearch/mechanize/_pullparser.py#L245-L263
OpenCobolIDE/OpenCobolIDE
c78d0d335378e5fe0a5e74f53c19b68b55e85388
open_cobol_ide/extlibs/pyqode/core/api/utils.py
python
TextHelper.selection_range
(self)
return start, end
Returns the selected lines boundaries (start line, end line) :return: tuple(int, int)
Returns the selected lines boundaries (start line, end line)
[ "Returns", "the", "selected", "lines", "boundaries", "(", "start", "line", "end", "line", ")" ]
def selection_range(self): """ Returns the selected lines boundaries (start line, end line) :return: tuple(int, int) """ editor = self._editor doc = editor.document() start = doc.findBlock( editor.textCursor().selectionStart()).blockNumber() e...
[ "def", "selection_range", "(", "self", ")", ":", "editor", "=", "self", ".", "_editor", "doc", "=", "editor", ".", "document", "(", ")", "start", "=", "doc", ".", "findBlock", "(", "editor", ".", "textCursor", "(", ")", ".", "selectionStart", "(", ")",...
https://github.com/OpenCobolIDE/OpenCobolIDE/blob/c78d0d335378e5fe0a5e74f53c19b68b55e85388/open_cobol_ide/extlibs/pyqode/core/api/utils.py#L467-L483
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
python
open_txns_args.__init__
(self, rqst=None,)
[]
def __init__(self, rqst=None,): self.rqst = rqst
[ "def", "__init__", "(", "self", ",", "rqst", "=", "None", ",", ")", ":", "self", ".", "rqst", "=", "rqst" ]
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L32104-L32105
mozman/ezdxf
59d0fc2ea63f5cf82293428f5931da7e9f9718e9
src/ezdxf/document.py
python
Drawing.dxfversion
(self)
return self._dxfversion
Get current DXF version.
Get current DXF version.
[ "Get", "current", "DXF", "version", "." ]
def dxfversion(self) -> str: """Get current DXF version.""" return self._dxfversion
[ "def", "dxfversion", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_dxfversion" ]
https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/document.py#L272-L274
holland-backup/holland
77dcfe9f23d4254e4c351cdc18f29a8d34945812
holland/core/util/path.py
python
disk_capacity
(target_path)
return info.f_frsize * info.f_blocks
Find the total capacity of the filesystem that target_path is on :returns: integer number of input_bytes
Find the total capacity of the filesystem that target_path is on
[ "Find", "the", "total", "capacity", "of", "the", "filesystem", "that", "target_path", "is", "on" ]
def disk_capacity(target_path): """Find the total capacity of the filesystem that target_path is on :returns: integer number of input_bytes """ path = getmount(target_path) info = os.statvfs(path) return info.f_frsize * info.f_blocks
[ "def", "disk_capacity", "(", "target_path", ")", ":", "path", "=", "getmount", "(", "target_path", ")", "info", "=", "os", ".", "statvfs", "(", "path", ")", "return", "info", ".", "f_frsize", "*", "info", ".", "f_blocks" ]
https://github.com/holland-backup/holland/blob/77dcfe9f23d4254e4c351cdc18f29a8d34945812/holland/core/util/path.py#L126-L133
brainiak/brainiak
ee093597c6c11597b0a59e95b48d2118e40394a5
brainiak/fcma/classifier.py
python
Classifier._prepare_test_data
(self, corr_data)
return data
Prepare the data to be applied to the predict function. if the classifier is SVM, do kernel precomputation, otherwise the test data is the reshaped corr_data Parameters ---------- corr_data: the (normalized) correlation data in shape [num_samples, num_voxels...
Prepare the data to be applied to the predict function.
[ "Prepare", "the", "data", "to", "be", "applied", "to", "the", "predict", "function", "." ]
def _prepare_test_data(self, corr_data): """Prepare the data to be applied to the predict function. if the classifier is SVM, do kernel precomputation, otherwise the test data is the reshaped corr_data Parameters ---------- corr_data: the (normalized) correlation data ...
[ "def", "_prepare_test_data", "(", "self", ",", "corr_data", ")", ":", "num_test_samples", "=", "corr_data", ".", "shape", "[", "0", "]", "assert", "num_test_samples", ">", "0", ",", "'at least one test sample is needed'", "if", "isinstance", "(", "self", ".", "c...
https://github.com/brainiak/brainiak/blob/ee093597c6c11597b0a59e95b48d2118e40394a5/brainiak/fcma/classifier.py#L222-L277
RiotGames/cloud-inquisitor
29a26c705381fdba3538b4efedb25b9e09b387ed
plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py
python
RequiredTagsAuditor.process_actions
(self, actions)
return notices
Process the actions we want to take Args: actions (`list`): List of actions we want to take Returns: `list` of notifications
Process the actions we want to take
[ "Process", "the", "actions", "we", "want", "to", "take" ]
def process_actions(self, actions): """Process the actions we want to take Args: actions (`list`): List of actions we want to take Returns: `list` of notifications """ notices = {} notification_contacts = {} for action in actions: ...
[ "def", "process_actions", "(", "self", ",", "actions", ")", ":", "notices", "=", "{", "}", "notification_contacts", "=", "{", "}", "for", "action", "in", "actions", ":", "resource", "=", "action", "[", "'resource'", "]", "action_status", "=", "ActionStatus",...
https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/plugins/public/cinq-auditor-required-tags/cinq_auditor_required_tags/__init__.py#L347-L423
grnet/synnefo
d06ec8c7871092131cdaabf6b03ed0b504c93e43
snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py
python
Node.node_get_properties
(self, node)
return l
Return the node's (parent, path). Return None if the node is not found.
Return the node's (parent, path). Return None if the node is not found.
[ "Return", "the", "node", "s", "(", "parent", "path", ")", ".", "Return", "None", "if", "the", "node", "is", "not", "found", "." ]
def node_get_properties(self, node): """Return the node's (parent, path). Return None if the node is not found. """ s = select([self.nodes.c.parent, self.nodes.c.path]) s = s.where(self.nodes.c.node == node) r = self.conn.execute(s) l = r.fetchone() r....
[ "def", "node_get_properties", "(", "self", ",", "node", ")", ":", "s", "=", "select", "(", "[", "self", ".", "nodes", ".", "c", ".", "parent", ",", "self", ".", "nodes", ".", "c", ".", "path", "]", ")", "s", "=", "s", ".", "where", "(", "self",...
https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py#L299-L309
mayank93/Twitter-Sentiment-Analysis
f095c6ca6bf69787582b5dabb140fefaf278eb37
front-end/web2py/gluon/contrib/feedparser.py
python
_stripDoctype
(data)
return version, data, dict(replacement and [(k.decode('utf-8'), v.decode('utf-8')) for k, v in safe_pattern.findall(replacement)])
Strips DOCTYPE from XML document, returns (rss_version, stripped_data) rss_version may be 'rss091n' or None stripped_data is the same XML document, minus the DOCTYPE
Strips DOCTYPE from XML document, returns (rss_version, stripped_data)
[ "Strips", "DOCTYPE", "from", "XML", "document", "returns", "(", "rss_version", "stripped_data", ")" ]
def _stripDoctype(data): '''Strips DOCTYPE from XML document, returns (rss_version, stripped_data) rss_version may be 'rss091n' or None stripped_data is the same XML document, minus the DOCTYPE ''' start = re.search(_s2bytes('<\w'), data) start = start and start.start() or -1 head,data = da...
[ "def", "_stripDoctype", "(", "data", ")", ":", "start", "=", "re", ".", "search", "(", "_s2bytes", "(", "'<\\w'", ")", ",", "data", ")", "start", "=", "start", "and", "start", ".", "start", "(", ")", "or", "-", "1", "head", ",", "data", "=", "dat...
https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/gluon/contrib/feedparser.py#L3648-L3678
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/netutil.py
python
Resolver.close
(self)
Closes the `Resolver`, freeing any resources used. .. versionadded:: 3.1
Closes the `Resolver`, freeing any resources used.
[ "Closes", "the", "Resolver", "freeing", "any", "resources", "used", "." ]
def close(self) -> None: """Closes the `Resolver`, freeing any resources used. .. versionadded:: 3.1 """ pass
[ "def", "close", "(", "self", ")", "->", "None", ":", "pass" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/tornado-6.0.1-py3.7-macosx-12.1-iPad6,7.egg/tornado/netutil.py#L362-L368
rafellerc/Pytorch-SiamFC
d64d0fee08c7972726337be07e783d44bd9c275e
training/summary_utils.py
python
SummaryMaker.__init__
(self, log_dir, params, up_factor)
Args: log_dir: (str) The path to the folder where the summary files are going to be written. The summary object creates a train and a val folders to store the summary files. params: (train.utils.Params) The parameters loaded from the parameters.jso...
Args: log_dir: (str) The path to the folder where the summary files are going to be written. The summary object creates a train and a val folders to store the summary files. params: (train.utils.Params) The parameters loaded from the parameters.jso...
[ "Args", ":", "log_dir", ":", "(", "str", ")", "The", "path", "to", "the", "folder", "where", "the", "summary", "files", "are", "going", "to", "be", "written", ".", "The", "summary", "object", "creates", "a", "train", "and", "a", "val", "folders", "to",...
def __init__(self, log_dir, params, up_factor): """ Args: log_dir: (str) The path to the folder where the summary files are going to be written. The summary object creates a train and a val folders to store the summary files. params: (train.utils.P...
[ "def", "__init__", "(", "self", ",", "log_dir", ",", "params", ",", "up_factor", ")", ":", "# We use two different summary writers so we can plot both curves in", "# the same plot, as suggested in https://www.quora.com/How-do-you-plot-training-and-validation-loss-on-the-same-graph-using-Te...
https://github.com/rafellerc/Pytorch-SiamFC/blob/d64d0fee08c7972726337be07e783d44bd9c275e/training/summary_utils.py#L20-L51
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/pyasn1/type/univ.py
python
Real.isMinusInfinity
(self)
return self.isMinusInf
[]
def isMinusInfinity(self): return self.isMinusInf
[ "def", "isMinusInfinity", "(", "self", ")", ":", "return", "self", ".", "isMinusInf" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/pyasn1/type/univ.py#L1544-L1545
iagcl/watchmen
d329b357e6fde3ad91e972988b160a33c12afc2a
elasticsearch/roll_indexes/packages/requests/sessions.py
python
Session.prepare_request
(self, request)
return p
Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this ...
Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`.
[ "Constructs", "a", ":", "class", ":", "PreparedRequest", "<PreparedRequest", ">", "for", "transmission", "and", "returns", "it", ".", "The", ":", "class", ":", "PreparedRequest", "has", "settings", "merged", "from", "the", ":", "class", ":", "Request", "<Reque...
def prepare_request(self, request): """Constructs a :class:`PreparedRequest <PreparedRequest>` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request <Request>` instance and those of the :class:`Session`. :param request: :class...
[ "def", "prepare_request", "(", "self", ",", "request", ")", ":", "cookies", "=", "request", ".", "cookies", "or", "{", "}", "# Bootstrap CookieJar.", "if", "not", "isinstance", "(", "cookies", ",", "cookielib", ".", "CookieJar", ")", ":", "cookies", "=", "...
https://github.com/iagcl/watchmen/blob/d329b357e6fde3ad91e972988b160a33c12afc2a/elasticsearch/roll_indexes/packages/requests/sessions.py#L401-L439
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/toric/divisor.py
python
ToricDivisor_generic._sheaf_complex
(self, m)
return SimplicialComplex([c.ambient_ray_indices() for c in negative_cones])
r""" Return a simplicial complex whose cohomology is isomorphic to the `m\in M`-graded piece of the sheaf cohomology. Helper for :meth:`cohomology`. INPUT: - `m` -- a point in ``self.scheme().fan().dual_lattice()``. OUTPUT: - :class:`simplicial complex <sage....
r""" Return a simplicial complex whose cohomology is isomorphic to the `m\in M`-graded piece of the sheaf cohomology.
[ "r", "Return", "a", "simplicial", "complex", "whose", "cohomology", "is", "isomorphic", "to", "the", "m", "\\", "in", "M", "-", "graded", "piece", "of", "the", "sheaf", "cohomology", "." ]
def _sheaf_complex(self, m): r""" Return a simplicial complex whose cohomology is isomorphic to the `m\in M`-graded piece of the sheaf cohomology. Helper for :meth:`cohomology`. INPUT: - `m` -- a point in ``self.scheme().fan().dual_lattice()``. OUTPUT: ...
[ "def", "_sheaf_complex", "(", "self", ",", "m", ")", ":", "fan", "=", "self", ".", "parent", "(", ")", ".", "scheme", "(", ")", ".", "fan", "(", ")", "ray_is_negative", "=", "[", "m", "*", "ray", "+", "self", ".", "coefficient", "(", "i", ")", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/divisor.py#L1543-L1579
weewx/weewx
cb594fce224560bd8696050fc5c7843c7839320e
bin/weewx/wxxtypes.py
python
StdWXXTypes.__init__
(self, engine, config_dict)
Initialize an instance of StdWXXTypes
Initialize an instance of StdWXXTypes
[ "Initialize", "an", "instance", "of", "StdWXXTypes" ]
def __init__(self, engine, config_dict): """Initialize an instance of StdWXXTypes""" super(StdWXXTypes, self).__init__(engine, config_dict) altitude_vt = engine.stn_info.altitude_vt latitude_f = engine.stn_info.latitude_f longitude_f = engine.stn_info.longitude_f # Thes...
[ "def", "__init__", "(", "self", ",", "engine", ",", "config_dict", ")", ":", "super", "(", "StdWXXTypes", ",", "self", ")", ".", "__init__", "(", "engine", ",", "config_dict", ")", "altitude_vt", "=", "engine", ".", "stn_info", ".", "altitude_vt", "latitud...
https://github.com/weewx/weewx/blob/cb594fce224560bd8696050fc5c7843c7839320e/bin/weewx/wxxtypes.py#L617-L691
thiagopena/djangoSIGE
e32186b27bfd8acf21b0fa400e699cb5c73e5433
djangosige/apps/base/custom_views.py
python
CustomUpdateView.post
(self, request, *args, **kwargs)
return self.form_invalid(form)
[]
def post(self, request, *args, **kwargs): self.object = self.get_object() form_class = self.get_form_class() form = form_class(request.POST, instance=self.object) if form.is_valid(): self.object = form.save() return redirect(self.success_url) return self.f...
[ "def", "post", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "object", "=", "self", ".", "get_object", "(", ")", "form_class", "=", "self", ".", "get_form_class", "(", ")", "form", "=", "form_class", ...
https://github.com/thiagopena/djangoSIGE/blob/e32186b27bfd8acf21b0fa400e699cb5c73e5433/djangosige/apps/base/custom_views.py#L68-L75
kennethreitz-archive/requests3
69eb662703b40db58fdc6c095d0fe130c56649bb
requests3/core/_http/exceptions.py
python
BadVersionError.__init__
(self, version)
[]
def __init__(self, version): message = "HTTP version {} is unsupported".format(version) super(BadVersionError, self).__init__(message)
[ "def", "__init__", "(", "self", ",", "version", ")", ":", "message", "=", "\"HTTP version {} is unsupported\"", ".", "format", "(", "version", ")", "super", "(", "BadVersionError", ",", "self", ")", ".", "__init__", "(", "message", ")" ]
https://github.com/kennethreitz-archive/requests3/blob/69eb662703b40db58fdc6c095d0fe130c56649bb/requests3/core/_http/exceptions.py#L192-L194
theislab/anndata
664e32b0aa6625fe593370d37174384c05abfd4e
anndata/_core/anndata.py
python
AnnData.__getitem__
(self, index: Index)
return AnnData(self, oidx=oidx, vidx=vidx, asview=True)
Returns a sliced view of the object.
Returns a sliced view of the object.
[ "Returns", "a", "sliced", "view", "of", "the", "object", "." ]
def __getitem__(self, index: Index) -> "AnnData": """Returns a sliced view of the object.""" oidx, vidx = self._normalize_indices(index) return AnnData(self, oidx=oidx, vidx=vidx, asview=True)
[ "def", "__getitem__", "(", "self", ",", "index", ":", "Index", ")", "->", "\"AnnData\"", ":", "oidx", ",", "vidx", "=", "self", ".", "_normalize_indices", "(", "index", ")", "return", "AnnData", "(", "self", ",", "oidx", "=", "oidx", ",", "vidx", "=", ...
https://github.com/theislab/anndata/blob/664e32b0aa6625fe593370d37174384c05abfd4e/anndata/_core/anndata.py#L1097-L1100
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
vdloc_t.reg1
(self, *args)
return _idaapi.vdloc_t_reg1(self, *args)
reg1(self) -> int
reg1(self) -> int
[ "reg1", "(", "self", ")", "-", ">", "int" ]
def reg1(self, *args): """ reg1(self) -> int """ return _idaapi.vdloc_t_reg1(self, *args)
[ "def", "reg1", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "vdloc_t_reg1", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L35683-L35687
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/comm_interface.py
python
XBeeCommunicationInterface.close
(self)
Terminates the underlying hardware communication interface. Subclasses may throw specific exceptions to signal implementation specific hardware errors.
Terminates the underlying hardware communication interface.
[ "Terminates", "the", "underlying", "hardware", "communication", "interface", "." ]
def close(self): """ Terminates the underlying hardware communication interface. Subclasses may throw specific exceptions to signal implementation specific hardware errors. """
[ "def", "close", "(", "self", ")", ":" ]
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/comm_interface.py#L35-L41
vanheeringen-lab/genomepy
4c10e69b6886cf52381caf6498395391834a675b
genomepy/functions.py
python
_provider_selection
(name, localname, genomes_dir, provider=None)
return _lazy_provider_selection(name, provider)
Return a provider object First tries to return a specified provider, Second tries to return the provider from the README Third tries to return the first provider which has the genome (Ensembl>UCSC>NCBI)
Return a provider object
[ "Return", "a", "provider", "object" ]
def _provider_selection(name, localname, genomes_dir, provider=None): """ Return a provider object First tries to return a specified provider, Second tries to return the provider from the README Third tries to return the first provider which has the genome (Ensembl>UCSC>NCBI) """ readme = o...
[ "def", "_provider_selection", "(", "name", ",", "localname", ",", "genomes_dir", ",", "provider", "=", "None", ")", ":", "readme", "=", "os", ".", "path", ".", "join", "(", "genomes_dir", ",", "localname", ",", "\"README.txt\"", ")", "if", "provider", "is"...
https://github.com/vanheeringen-lab/genomepy/blob/4c10e69b6886cf52381caf6498395391834a675b/genomepy/functions.py#L338-L353
ronf/asyncssh
ee1714c598d8c2ea6f5484e465443f38b68714aa
asyncssh/kex.py
python
register_gss_kex_alg
(alg: bytes, handler: Type[Kex], hash_alg: HashType, args: Tuple, default: bool)
Register a GSSAPI key exchange algorithm
Register a GSSAPI key exchange algorithm
[ "Register", "a", "GSSAPI", "key", "exchange", "algorithm" ]
def register_gss_kex_alg(alg: bytes, handler: Type[Kex], hash_alg: HashType, args: Tuple, default: bool) -> None: """Register a GSSAPI key exchange algorithm""" _gss_kex_algs.append(alg) if default: _default_gss_kex_algs.append(alg) _gss_kex_handlers[alg] = (handler, ...
[ "def", "register_gss_kex_alg", "(", "alg", ":", "bytes", ",", "handler", ":", "Type", "[", "Kex", "]", ",", "hash_alg", ":", "HashType", ",", "args", ":", "Tuple", ",", "default", ":", "bool", ")", "->", "None", ":", "_gss_kex_algs", ".", "append", "("...
https://github.com/ronf/asyncssh/blob/ee1714c598d8c2ea6f5484e465443f38b68714aa/asyncssh/kex.py#L104-L113
joke2k/faker
0ebe46fc9b9793fe315cf0fce430258ce74df6f8
faker/providers/address/az_AZ/__init__.py
python
Provider.village
(self)
return self.random_element(self.villages)
:example 'Didivar'
:example 'Didivar'
[ ":", "example", "Didivar" ]
def village(self): """ :example 'Didivar' """ return self.random_element(self.villages)
[ "def", "village", "(", "self", ")", ":", "return", "self", ".", "random_element", "(", "self", ".", "villages", ")" ]
https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/address/az_AZ/__init__.py#L641-L645
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/op2/tables/geom/ept.py
python
EPT._read_nsm1
(self, data: bytes, n: int)
return n
NSM1(3301, 33, 992) Defines the properties of a nonstructural mass. Word Name Type Description 1 SID I Set identification number 2 PROP CHAR4 Set of properties 3 TYPE CHAR4 Set of elements 4 ORIGIN I Entry origin 5 VALUE RS Nonstructural mass value ...
NSM1(3301, 33, 992)
[ "NSM1", "(", "3301", "33", "992", ")" ]
def _read_nsm1(self, data: bytes, n: int) -> int: """ NSM1(3301, 33, 992) Defines the properties of a nonstructural mass. Word Name Type Description 1 SID I Set identification number 2 PROP CHAR4 Set of properties 3 TYPE CHAR4 Set of elements 4 ORIGI...
[ "def", "_read_nsm1", "(", "self", ",", "data", ":", "bytes", ",", "n", ":", "int", ")", "->", "int", ":", "op2", "=", "self", ".", "op2", "#op2.show_data(data[n:], types='ifs')", "n0", "=", "n", "#op2.show_data(data[n:])", "ints", "=", "np", ".", "frombuff...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/op2/tables/geom/ept.py#L456-L554
cyberdelia/metrology
a029ec45228f59dfa82d8068698a3fa60ea8f7c2
metrology/instruments/counter.py
python
Counter.decrement
(self, value=1)
Decrement the counter. By default it will decrement by 1. :param value: value to decrement the counter.
Decrement the counter. By default it will decrement by 1.
[ "Decrement", "the", "counter", ".", "By", "default", "it", "will", "decrement", "by", "1", "." ]
def decrement(self, value=1): """Decrement the counter. By default it will decrement by 1. :param value: value to decrement the counter. """ self._count -= value
[ "def", "decrement", "(", "self", ",", "value", "=", "1", ")", ":", "self", ".", "_count", "-=", "value" ]
https://github.com/cyberdelia/metrology/blob/a029ec45228f59dfa82d8068698a3fa60ea8f7c2/metrology/instruments/counter.py#L24-L29
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/dna/operations/crossovers.py
python
Pl5_recognizer._C_strand_direction_well_defined
(self)
return self.ordered_bases is not None
[compute method for self.strand_direction_well_defined] ###doc
[compute method for self.strand_direction_well_defined] ###doc
[ "[", "compute", "method", "for", "self", ".", "strand_direction_well_defined", "]", "###doc" ]
def _C_strand_direction_well_defined(self): """ [compute method for self.strand_direction_well_defined] ###doc """ return self.ordered_bases is not None
[ "def", "_C_strand_direction_well_defined", "(", "self", ")", ":", "return", "self", ".", "ordered_bases", "is", "not", "None" ]
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/operations/crossovers.py#L401-L406
charlesq34/frustum-pointnets
2ffdd345e1fce4775ecb508d207e0ad465bcca80
kitti/kitti_util.py
python
Calibration.project_velo_to_image
(self, pts_3d_velo)
return self.project_rect_to_image(pts_3d_rect)
Input: nx3 points in velodyne coord. Output: nx2 points in image2 coord.
Input: nx3 points in velodyne coord. Output: nx2 points in image2 coord.
[ "Input", ":", "nx3", "points", "in", "velodyne", "coord", ".", "Output", ":", "nx2", "points", "in", "image2", "coord", "." ]
def project_velo_to_image(self, pts_3d_velo): ''' Input: nx3 points in velodyne coord. Output: nx2 points in image2 coord. ''' pts_3d_rect = self.project_velo_to_rect(pts_3d_velo) return self.project_rect_to_image(pts_3d_rect)
[ "def", "project_velo_to_image", "(", "self", ",", "pts_3d_velo", ")", ":", "pts_3d_rect", "=", "self", ".", "project_velo_to_rect", "(", "pts_3d_velo", ")", "return", "self", ".", "project_rect_to_image", "(", "pts_3d_rect", ")" ]
https://github.com/charlesq34/frustum-pointnets/blob/2ffdd345e1fce4775ecb508d207e0ad465bcca80/kitti/kitti_util.py#L190-L195
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/compiler.py
python
CodeGenerator.macro_def
(self, node, frame)
Dump the macro definition for the def created by macro_body.
Dump the macro definition for the def created by macro_body.
[ "Dump", "the", "macro", "definition", "for", "the", "def", "created", "by", "macro_body", "." ]
def macro_def(self, node, frame): """Dump the macro definition for the def created by macro_body.""" arg_tuple = ', '.join(repr(x.name) for x in node.args) name = getattr(node, 'name', None) if len(node.args) == 1: arg_tuple += ',' self.write('Macro(environment, macro...
[ "def", "macro_def", "(", "self", ",", "node", ",", "frame", ")", ":", "arg_tuple", "=", "', '", ".", "join", "(", "repr", "(", "x", ".", "name", ")", "for", "x", "in", "node", ".", "args", ")", "name", "=", "getattr", "(", "node", ",", "'name'", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/compiler.py#L668-L683
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/AndroBugs/tools/modified/androguard/core/bytecode.py
python
method2jpg
(output, mx, raw=False)
Export method to a jpg file format :param output: output filename :type output: string :param mx: specify the MethodAnalysis object :type mx: :class:`MethodAnalysis` object :param raw: use directly a dot raw buffer (optional) :type raw: string
Export method to a jpg file format
[ "Export", "method", "to", "a", "jpg", "file", "format" ]
def method2jpg(output, mx, raw=False): """ Export method to a jpg file format :param output: output filename :type output: string :param mx: specify the MethodAnalysis object :type mx: :class:`MethodAnalysis` object :param raw: use directly a dot raw buffer (optional...
[ "def", "method2jpg", "(", "output", ",", "mx", ",", "raw", "=", "False", ")", ":", "buff", "=", "raw", "if", "raw", "==", "False", ":", "buff", "=", "method2dot", "(", "mx", ")", "method2format", "(", "output", ",", "\"jpg\"", ",", "mx", ",", "buff...
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/AndroBugs/tools/modified/androguard/core/bytecode.py#L381-L396
kadalu/kadalu
5d91d92830553b47d3729adc3c7f69ce6fd45e2d
kadalulib.py
python
ProcState.restart
(self)
Restart a Process
Restart a Process
[ "Restart", "a", "Process" ]
def restart(self): """Restart a Process""" self.stop() self.start()
[ "def", "restart", "(", "self", ")", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
https://github.com/kadalu/kadalu/blob/5d91d92830553b47d3729adc3c7f69ce6fd45e2d/kadalulib.py#L345-L348
pyqteval/evlal_win
ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92
pyinstaller-2.0/PyInstaller/compat.py
python
exec_python_all
(*args, **kwargs)
return exec_command_all(*cmdargs, **kwargs)
Wrap running python script in a subprocess. Return tuple (exit_code, stdout, stderr) of the invoked command.
Wrap running python script in a subprocess.
[ "Wrap", "running", "python", "script", "in", "a", "subprocess", "." ]
def exec_python_all(*args, **kwargs): """ Wrap running python script in a subprocess. Return tuple (exit_code, stdout, stderr) of the invoked command. """ cmdargs, kwargs = __wrap_python(args, kwargs) return exec_command_all(*cmdargs, **kwargs)
[ "def", "exec_python_all", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cmdargs", ",", "kwargs", "=", "__wrap_python", "(", "args", ",", "kwargs", ")", "return", "exec_command_all", "(", "*", "cmdargs", ",", "*", "*", "kwargs", ")" ]
https://github.com/pyqteval/evlal_win/blob/ce7fc77ac5cdf864cd6aa9b04b5329501f8f4c92/pyinstaller-2.0/PyInstaller/compat.py#L309-L316
beetbox/beets
2fea53c34dd505ba391cb345424e0613901c8025
beets/plugins.py
python
BeetsPlugin.add_media_field
(self, name, descriptor)
Add a field that is synchronized between media files and items. When a media field is added ``item.write()`` will set the name property of the item's MediaFile to ``item[name]`` and save the changes. Similarly ``item.read()`` will set ``item[name]`` to the value of the name property of ...
Add a field that is synchronized between media files and items.
[ "Add", "a", "field", "that", "is", "synchronized", "between", "media", "files", "and", "items", "." ]
def add_media_field(self, name, descriptor): """Add a field that is synchronized between media files and items. When a media field is added ``item.write()`` will set the name property of the item's MediaFile to ``item[name]`` and save the changes. Similarly ``item.read()`` will set ``it...
[ "def", "add_media_field", "(", "self", ",", "name", ",", "descriptor", ")", ":", "# Defer import to prevent circular dependency", "from", "beets", "import", "library", "mediafile", ".", "MediaFile", ".", "add_field", "(", "name", ",", "descriptor", ")", "library", ...
https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beets/plugins.py#L192-L205
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/importlib/_bootstrap_external.py
python
decode_source
(source_bytes)
return newline_decoder.decode(source_bytes.decode(encoding[0]))
Decode bytes representing source code and return the string. Universal newline support is used in the decoding.
Decode bytes representing source code and return the string.
[ "Decode", "bytes", "representing", "source", "code", "and", "return", "the", "string", "." ]
def decode_source(source_bytes): """Decode bytes representing source code and return the string. Universal newline support is used in the decoding. """ import tokenize # To avoid bootstrap issues. source_bytes_readline = _io.BytesIO(source_bytes).readline encoding = tokenize.detect_encoding(so...
[ "def", "decode_source", "(", "source_bytes", ")", ":", "import", "tokenize", "# To avoid bootstrap issues.", "source_bytes_readline", "=", "_io", ".", "BytesIO", "(", "source_bytes", ")", ".", "readline", "encoding", "=", "tokenize", ".", "detect_encoding", "(", "so...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/importlib/_bootstrap_external.py#L635-L644
kubernetes-client/python
47b9da9de2d02b2b7a34fbe05afb44afd130d73a
kubernetes/client/models/v2beta2_horizontal_pod_autoscaler_status.py
python
V2beta2HorizontalPodAutoscalerStatus.__init__
(self, conditions=None, current_metrics=None, current_replicas=None, desired_replicas=None, last_scale_time=None, observed_generation=None, local_vars_configuration=None)
V2beta2HorizontalPodAutoscalerStatus - a model defined in OpenAPI
V2beta2HorizontalPodAutoscalerStatus - a model defined in OpenAPI
[ "V2beta2HorizontalPodAutoscalerStatus", "-", "a", "model", "defined", "in", "OpenAPI" ]
def __init__(self, conditions=None, current_metrics=None, current_replicas=None, desired_replicas=None, last_scale_time=None, observed_generation=None, local_vars_configuration=None): # noqa: E501 """V2beta2HorizontalPodAutoscalerStatus - a model defined in OpenAPI""" # noqa: E501 if local_vars_config...
[ "def", "__init__", "(", "self", ",", "conditions", "=", "None", ",", "current_metrics", "=", "None", ",", "current_replicas", "=", "None", ",", "desired_replicas", "=", "None", ",", "last_scale_time", "=", "None", ",", "observed_generation", "=", "None", ",", ...
https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v2beta2_horizontal_pod_autoscaler_status.py#L53-L75
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/utils/dummy_flax_objects.py
python
FlaxGPT2PreTrainedModel.from_pretrained
(cls, *args, **kwargs)
[]
def from_pretrained(cls, *args, **kwargs): requires_backends(cls, ["flax"])
[ "def", "from_pretrained", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "requires_backends", "(", "cls", ",", "[", "\"flax\"", "]", ")" ]
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_flax_objects.py#L1000-L1001
ReactionMechanismGenerator/RMG-Py
2b7baf51febf27157def58fb3f6cee03fb6a684c
rmgpy/__init__.py
python
Settings.report
(self)
return '\n'.join(lines)
Returns a string saying what is set and where things came from, suitable for logging
Returns a string saying what is set and where things came from, suitable for logging
[ "Returns", "a", "string", "saying", "what", "is", "set", "and", "where", "things", "came", "from", "suitable", "for", "logging" ]
def report(self): """ Returns a string saying what is set and where things came from, suitable for logging """ lines = ['Global RMG Settings:'] for key in self.keys(): lines.append(" {0:20s} = {1:20s} ({2})".format(key, self[key], self.sources[key])) return ...
[ "def", "report", "(", "self", ")", ":", "lines", "=", "[", "'Global RMG Settings:'", "]", "for", "key", "in", "self", ".", "keys", "(", ")", ":", "lines", ".", "append", "(", "\" {0:20s} = {1:20s} ({2})\"", ".", "format", "(", "key", ",", "self", "[", ...
https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/__init__.py#L73-L80
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py
python
any_server_selector
(selection)
return selection
[]
def any_server_selector(selection): return selection
[ "def", "any_server_selector", "(", "selection", ")", ":", "return", "selection" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/tokumx/datadog_checks/tokumx/vendor/pymongo/server_selectors.py#L81-L82
BMW-InnovationLab/BMW-TensorFlow-Training-GUI
4f10d1f00f9ac312ca833e5b28fd0f8952cfee17
training_api/research/object_detection/utils/vrd_evaluation.py
python
_VRDDetectionEvaluation.clear_detections
(self)
Clears detections.
Clears detections.
[ "Clears", "detections", "." ]
def clear_detections(self): """Clears detections.""" self._detection_keys = set() self._scores = [] self._relation_field_values = [] self._tp_fp_labels = [] self._average_precisions = {} self._precisions = [] self._recalls = []
[ "def", "clear_detections", "(", "self", ")", ":", "self", ".", "_detection_keys", "=", "set", "(", ")", "self", ".", "_scores", "=", "[", "]", "self", ".", "_relation_field_values", "=", "[", "]", "self", ".", "_tp_fp_labels", "=", "[", "]", "self", "....
https://github.com/BMW-InnovationLab/BMW-TensorFlow-Training-GUI/blob/4f10d1f00f9ac312ca833e5b28fd0f8952cfee17/training_api/research/object_detection/utils/vrd_evaluation.py#L437-L445
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/group/binary_sensor.py
python
BinarySensorGroup.async_added_to_hass
(self)
Register callbacks.
Register callbacks.
[ "Register", "callbacks", "." ]
async def async_added_to_hass(self) -> None: """Register callbacks.""" @callback def async_state_changed_listener(event: Event) -> None: """Handle child updates.""" self.async_set_context(event.context) self.async_defer_or_update_ha_state() self.asyn...
[ "async", "def", "async_added_to_hass", "(", "self", ")", "->", "None", ":", "@", "callback", "def", "async_state_changed_listener", "(", "event", ":", "Event", ")", "->", "None", ":", "\"\"\"Handle child updates.\"\"\"", "self", ".", "async_set_context", "(", "eve...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/group/binary_sensor.py#L90-L105
Cadene/tensorflow-model-zoo.torch
990b10ffc22d4c8eacb2a502f20415b4f70c74c2
models/research/object_detection/data_decoders/tf_example_decoder.py
python
TfExampleDecoder.__init__
(self, load_instance_masks=False, label_map_proto_file=None, use_display_name=False)
Constructor sets keys_to_features and items_to_handlers. Args: load_instance_masks: whether or not to load and handle instance masks. label_map_proto_file: a file path to a object_detection.protos.StringIntLabelMap proto. If provided, then the mapped IDs of 'image/object/class/text' wil...
Constructor sets keys_to_features and items_to_handlers.
[ "Constructor", "sets", "keys_to_features", "and", "items_to_handlers", "." ]
def __init__(self, load_instance_masks=False, label_map_proto_file=None, use_display_name=False): """Constructor sets keys_to_features and items_to_handlers. Args: load_instance_masks: whether or not to load and handle instance masks. label_map_proto_fil...
[ "def", "__init__", "(", "self", ",", "load_instance_masks", "=", "False", ",", "label_map_proto_file", "=", "None", ",", "use_display_name", "=", "False", ")", ":", "self", ".", "keys_to_features", "=", "{", "'image/encoded'", ":", "tf", ".", "FixedLenFeature", ...
https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/object_detection/data_decoders/tf_example_decoder.py#L33-L121
python-control/python-control
df6b35212f8f657469627c227c893a175a6902cc
control/ctrlutil.py
python
unwrap
(angle, period=2*math.pi)
return angle
Unwrap a phase angle to give a continuous curve Parameters ---------- angle : array_like Array of angles to be unwrapped period : float, optional Period (defaults to `2*pi`) Returns ------- angle_out : array_like Output array, with jumps of period/2 eliminated ...
Unwrap a phase angle to give a continuous curve
[ "Unwrap", "a", "phase", "angle", "to", "give", "a", "continuous", "curve" ]
def unwrap(angle, period=2*math.pi): """Unwrap a phase angle to give a continuous curve Parameters ---------- angle : array_like Array of angles to be unwrapped period : float, optional Period (defaults to `2*pi`) Returns ------- angle_out : array_like Output ar...
[ "def", "unwrap", "(", "angle", ",", "period", "=", "2", "*", "math", ".", "pi", ")", ":", "dangle", "=", "np", ".", "diff", "(", "angle", ")", "dangle_desired", "=", "(", "dangle", "+", "period", "/", "2.", ")", "%", "period", "-", "period", "/",...
https://github.com/python-control/python-control/blob/df6b35212f8f657469627c227c893a175a6902cc/control/ctrlutil.py#L51-L78
zacharyvoase/urlobject
5699ad545648fb976fef8905f3defbcba7cf04ba
urlobject/urlobject.py
python
URLObject.with_username
(self, username)
return self.with_netloc(self.netloc.with_username(username))
Add or replace this URL's :attr:`.username`. >>> print(URLObject("http://user@www.google.com").with_username("user2")) http://user2@www.google.com
Add or replace this URL's :attr:`.username`.
[ "Add", "or", "replace", "this", "URL", "s", ":", "attr", ":", ".", "username", "." ]
def with_username(self, username): """ Add or replace this URL's :attr:`.username`. >>> print(URLObject("http://user@www.google.com").with_username("user2")) http://user2@www.google.com """ return self.with_netloc(self.netloc.with_username(username))
[ "def", "with_username", "(", "self", ",", "username", ")", ":", "return", "self", ".", "with_netloc", "(", "self", ".", "netloc", ".", "with_username", "(", "username", ")", ")" ]
https://github.com/zacharyvoase/urlobject/blob/5699ad545648fb976fef8905f3defbcba7cf04ba/urlobject/urlobject.py#L129-L136
john-kurkowski/tldextract
bdaa6f309c62465daa50a7759c9508f4a9472279
tldextract/suffix_list.py
python
extract_tlds_from_suffix_list
(suffix_list_text)
return public_tlds, private_tlds
Parse the raw suffix list text for its different designations of suffixes.
Parse the raw suffix list text for its different designations of suffixes.
[ "Parse", "the", "raw", "suffix", "list", "text", "for", "its", "different", "designations", "of", "suffixes", "." ]
def extract_tlds_from_suffix_list(suffix_list_text): """Parse the raw suffix list text for its different designations of suffixes.""" public_text, _, private_text = suffix_list_text.partition( PUBLIC_PRIVATE_SUFFIX_SEPARATOR ) public_tlds = [m.group("suffix") for m in PUBLIC_SUFFIX_RE.findi...
[ "def", "extract_tlds_from_suffix_list", "(", "suffix_list_text", ")", ":", "public_text", ",", "_", ",", "private_text", "=", "suffix_list_text", ".", "partition", "(", "PUBLIC_PRIVATE_SUFFIX_SEPARATOR", ")", "public_tlds", "=", "[", "m", ".", "group", "(", "\"suffi...
https://github.com/john-kurkowski/tldextract/blob/bdaa6f309c62465daa50a7759c9508f4a9472279/tldextract/suffix_list.py#L41-L50
ialbert/biostar-central
2dc7bd30691a50b2da9c2833ba354056bc686afa
biostar/forum/util.py
python
datetime_to_iso
(date)
return date.isoformat()
Converts a datetime to the ISO8601 format, like: 2014-05-20T06:11:41.733900. Parameters: date -- a `datetime` instance.
Converts a datetime to the ISO8601 format, like: 2014-05-20T06:11:41.733900.
[ "Converts", "a", "datetime", "to", "the", "ISO8601", "format", "like", ":", "2014", "-", "05", "-", "20T06", ":", "11", ":", "41", ".", "733900", "." ]
def datetime_to_iso(date): """ Converts a datetime to the ISO8601 format, like: 2014-05-20T06:11:41.733900. Parameters: date -- a `datetime` instance. """ if not isinstance(date, datetime): date = datetime.combine(date, datetime.min.time()) return date.isoformat()
[ "def", "datetime_to_iso", "(", "date", ")", ":", "if", "not", "isinstance", "(", "date", ",", "datetime", ")", ":", "date", "=", "datetime", ".", "combine", "(", "date", ",", "datetime", ".", "min", ".", "time", "(", ")", ")", "return", "date", ".", ...
https://github.com/ialbert/biostar-central/blob/2dc7bd30691a50b2da9c2833ba354056bc686afa/biostar/forum/util.py#L40-L49
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/core/grr_response_core/lib/utils.py
python
ShellQuote
(value)
return pipes.quote(SmartUnicode(value))
Escapes the string for the safe use inside shell command line.
Escapes the string for the safe use inside shell command line.
[ "Escapes", "the", "string", "for", "the", "safe", "use", "inside", "shell", "command", "line", "." ]
def ShellQuote(value): """Escapes the string for the safe use inside shell command line.""" # TODO(user): replace pipes.quote with shlex.quote when time comes. return pipes.quote(SmartUnicode(value))
[ "def", "ShellQuote", "(", "value", ")", ":", "# TODO(user): replace pipes.quote with shlex.quote when time comes.", "return", "pipes", ".", "quote", "(", "SmartUnicode", "(", "value", ")", ")" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/utils.py#L614-L617
opengapps/apkcrawler
e33ab5d1f37c54139ebf9fa93214adbe037bc679
googleplayapi/googleplay.py
python
GooglePlayAPI.details
(self, packageName)
return RequestResult(status_code, None)
Get app details from a package name. packageName is the app unique ID (usually starting with 'com.').
Get app details from a package name. packageName is the app unique ID (usually starting with 'com.').
[ "Get", "app", "details", "from", "a", "package", "name", ".", "packageName", "is", "the", "app", "unique", "ID", "(", "usually", "starting", "with", "com", ".", ")", "." ]
def details(self, packageName): """Get app details from a package name. packageName is the app unique ID (usually starting with 'com.').""" path = "details?doc=%s" % requests.utils.quote(packageName) (status_code, message) = self.executeRequestApi2(path) if status_code == http.cl...
[ "def", "details", "(", "self", ",", "packageName", ")", ":", "path", "=", "\"details?doc=%s\"", "%", "requests", ".", "utils", ".", "quote", "(", "packageName", ")", "(", "status_code", ",", "message", ")", "=", "self", ".", "executeRequestApi2", "(", "pat...
https://github.com/opengapps/apkcrawler/blob/e33ab5d1f37c54139ebf9fa93214adbe037bc679/googleplayapi/googleplay.py#L304-L311
oaubert/python-vlc
908ffdbd0844dc1849728c456e147788798c99da
generated/dev/vlc.py
python
Instance.media_new_fd
(self, fd)
return libvlc_media_new_fd(self, fd)
Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are suppo...
Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are suppo...
[ "Create", "a", "media", "for", "an", "already", "open", "file", "descriptor", ".", "The", "file", "descriptor", "shall", "be", "open", "for", "reading", "(", "or", "reading", "and", "writing", ")", ".", "Regular", "file", "descriptors", "pipe", "read", "de...
def media_new_fd(self, fd): '''Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. ...
[ "def", "media_new_fd", "(", "self", ",", "fd", ")", ":", "return", "libvlc_media_new_fd", "(", "self", ",", "fd", ")" ]
https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L2301-L2319
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/helpdesk/management/commands/create_escalation_exclusions.py
python
usage
()
[]
def usage(): print("Options:") print(" --days, -d: Days of week (monday, tuesday, etc)") print(" --occurrences, -o: Occurrences: How many weeks ahead to exclude this day") print(" --queues, -q: Queues to include (default: all). Use queue slugs") print(" --verbose, -v: Display a list of dates exclude...
[ "def", "usage", "(", ")", ":", "print", "(", "\"Options:\"", ")", "print", "(", "\" --days, -d: Days of week (monday, tuesday, etc)\"", ")", "print", "(", "\" --occurrences, -o: Occurrences: How many weeks ahead to exclude this day\"", ")", "print", "(", "\" --queues, -q: Queue...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/helpdesk/management/commands/create_escalation_exclusions.py#L105-L110
hamcrest/PyHamcrest
11aafabd688af2db23e8614f89da3015fd39f611
src/hamcrest/core/description.py
python
Description.append_text
(self, text: str)
Appends some plain text to the description. :returns: ``self``, for chaining
Appends some plain text to the description.
[ "Appends", "some", "plain", "text", "to", "the", "description", "." ]
def append_text(self, text: str) -> "Description": """Appends some plain text to the description. :returns: ``self``, for chaining """ raise NotImplementedError("append_text")
[ "def", "append_text", "(", "self", ",", "text", ":", "str", ")", "->", "\"Description\"", ":", "raise", "NotImplementedError", "(", "\"append_text\"", ")" ]
https://github.com/hamcrest/PyHamcrest/blob/11aafabd688af2db23e8614f89da3015fd39f611/src/hamcrest/core/description.py#L16-L22
ProgVal/Limnoria
181e34baf90a8cabc281e8349da6e36e1e558608
plugins/PluginDownloader/plugin.py
python
PluginDownloader.info
(self, irc, msg, args, repository, plugin)
<repository> <plugin> Displays informations on the <plugin> in the <repository>.
<repository> <plugin>
[ "<repository", ">", "<plugin", ">" ]
def info(self, irc, msg, args, repository, plugin): """<repository> <plugin> Displays informations on the <plugin> in the <repository>.""" global repositories if repository not in repositories: irc.error(_( 'This repository does not exist or is not kno...
[ "def", "info", "(", "self", ",", "irc", ",", "msg", ",", "args", ",", "repository", ",", "plugin", ")", ":", "global", "repositories", "if", "repository", "not", "in", "repositories", ":", "irc", ".", "error", "(", "_", "(", "'This repository does not exis...
https://github.com/ProgVal/Limnoria/blob/181e34baf90a8cabc281e8349da6e36e1e558608/plugins/PluginDownloader/plugin.py#L419-L440
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/utils/cloud_mlengine.py
python
flags_as_args
()
return args
Convert FLAGS to list of args suitable for passing on cmd line.
Convert FLAGS to list of args suitable for passing on cmd line.
[ "Convert", "FLAGS", "to", "list", "of", "args", "suitable", "for", "passing", "on", "cmd", "line", "." ]
def flags_as_args(): """Convert FLAGS to list of args suitable for passing on cmd line.""" if hasattr(FLAGS, "flag_values_dict"): args_dict = FLAGS.flag_values_dict() else: args_dict = dict(FLAGS.__dict__["__flags"]) del args_dict["cloud_mlengine"] # Configured later del args_dict["t2t_usr_dir"] a...
[ "def", "flags_as_args", "(", ")", ":", "if", "hasattr", "(", "FLAGS", ",", "\"flag_values_dict\"", ")", ":", "args_dict", "=", "FLAGS", ".", "flag_values_dict", "(", ")", "else", ":", "args_dict", "=", "dict", "(", "FLAGS", ".", "__dict__", "[", "\"__flags...
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/utils/cloud_mlengine.py#L93-L113
patrickdessalle/periscope
74537da58c3f930ef61cb04d3f8f964aedde88ef
periscope/periscope.py
python
Periscope.listSubtitles
(self, filename, langs=None)
return subtitles
Searches subtitles within the active plugins and returns all found matching subtitles ordered by language then by plugin.
Searches subtitles within the active plugins and returns all found matching subtitles ordered by language then by plugin.
[ "Searches", "subtitles", "within", "the", "active", "plugins", "and", "returns", "all", "found", "matching", "subtitles", "ordered", "by", "language", "then", "by", "plugin", "." ]
def listSubtitles(self, filename, langs=None): '''Searches subtitles within the active plugins and returns all found matching subtitles ordered by language then by plugin.''' #if not os.path.isfile(filename): #raise InvalidFileException(filename, "does not exist") log.info("Searchin...
[ "def", "listSubtitles", "(", "self", ",", "filename", ",", "langs", "=", "None", ")", ":", "#if not os.path.isfile(filename):", "#raise InvalidFileException(filename, \"does not exist\")", "log", ".", "info", "(", "\"Searching subtitles for %s with langs %s\"", "%", "(", "f...
https://github.com/patrickdessalle/periscope/blob/74537da58c3f930ef61cb04d3f8f964aedde88ef/periscope/periscope.py#L144-L174
biolab/orange3
41685e1c7b1d1babe680113685a2d44bcc9fec0b
Orange/widgets/utils/itemmodels.py
python
ContinuousPalettesModel.indexOf
(self, x)
return None
[]
def indexOf(self, x): if isinstance(x, str): for i, item in enumerate(self.items): if not isinstance(item, str) \ and x in (item.name, item.friendly_name): return i elif isinstance(x, ContinuousPalette): return self.item...
[ "def", "indexOf", "(", "self", ",", "x", ")", ":", "if", "isinstance", "(", "x", ",", "str", ")", ":", "for", "i", ",", "item", "in", "enumerate", "(", "self", ".", "items", ")", ":", "if", "not", "isinstance", "(", "item", ",", "str", ")", "an...
https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/utils/itemmodels.py#L661-L669
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/ec2/connection.py
python
EC2Connection.get_all_reservations
(self, instance_ids=None, filters=None, dry_run=False, max_results=None, next_token=None)
return self.get_list('DescribeInstances', params, [('item', Reservation)], verb='POST')
Retrieve all the instance reservations associated with your account. :type instance_ids: list :param instance_ids: A list of strings of instance IDs :type filters: dict :param filters: Optional filters that can be used to limit the results returned. Filters are provided in...
Retrieve all the instance reservations associated with your account.
[ "Retrieve", "all", "the", "instance", "reservations", "associated", "with", "your", "account", "." ]
def get_all_reservations(self, instance_ids=None, filters=None, dry_run=False, max_results=None, next_token=None): """ Retrieve all the instance reservations associated with your account. :type instance_ids: list :param instance_ids: A list of strings of ins...
[ "def", "get_all_reservations", "(", "self", ",", "instance_ids", "=", "None", ",", "filters", "=", "None", ",", "dry_run", "=", "False", ",", "max_results", "=", "None", ",", "next_token", "=", "None", ")", ":", "params", "=", "{", "}", "if", "instance_i...
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/ec2/connection.py#L631-L681
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/mhlib.py
python
Folder._copysequences
(self, fromfolder, refileditems)
Helper for refilemessages() to copy sequences.
Helper for refilemessages() to copy sequences.
[ "Helper", "for", "refilemessages", "()", "to", "copy", "sequences", "." ]
def _copysequences(self, fromfolder, refileditems): """Helper for refilemessages() to copy sequences.""" fromsequences = fromfolder.getsequences() tosequences = self.getsequences() changed = 0 for name, seq in fromsequences.items(): try: toseq = tosequ...
[ "def", "_copysequences", "(", "self", ",", "fromfolder", ",", "refileditems", ")", ":", "fromsequences", "=", "fromfolder", ".", "getsequences", "(", ")", "tosequences", "=", "self", ".", "getsequences", "(", ")", "changed", "=", "0", "for", "name", ",", "...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/mhlib.py#L525-L544
openvinotoolkit/training_extensions
e7aa33af94a1f8004d3ea2df259d99234dfca046
ote_sdk/ote_sdk/entities/annotation.py
python
AnnotationSceneEntity.editor_name
(self)
return self.__editor
Returns the editor's name that made the AnnotationSceneEntity object.
Returns the editor's name that made the AnnotationSceneEntity object.
[ "Returns", "the", "editor", "s", "name", "that", "made", "the", "AnnotationSceneEntity", "object", "." ]
def editor_name(self): """ Returns the editor's name that made the AnnotationSceneEntity object. """ return self.__editor
[ "def", "editor_name", "(", "self", ")", ":", "return", "self", ".", "__editor" ]
https://github.com/openvinotoolkit/training_extensions/blob/e7aa33af94a1f8004d3ea2df259d99234dfca046/ote_sdk/ote_sdk/entities/annotation.py#L211-L215
sapruash/RecursiveNN
0ec71d3762625d1f72c0af42127d3d588f33c539
tf_seq_lstm.py
python
tf_seqLSTM.add_placeholders
(self)
[]
def add_placeholders(self): self.batch_len = tf.placeholder(tf.int32,name="batch_len") self.max_time = tf.placeholder(tf.int32,name="max_time") dim1=self.config.batch_size*(1+self.internal) self.input = tf.placeholder(tf.int32,shape=[None,self.config.maxseqlen],name="input") s...
[ "def", "add_placeholders", "(", "self", ")", ":", "self", ".", "batch_len", "=", "tf", ".", "placeholder", "(", "tf", ".", "int32", ",", "name", "=", "\"batch_len\"", ")", "self", ".", "max_time", "=", "tf", ".", "placeholder", "(", "tf", ".", "int32",...
https://github.com/sapruash/RecursiveNN/blob/0ec71d3762625d1f72c0af42127d3d588f33c539/tf_seq_lstm.py#L14-L28
peterbrittain/asciimatics
9a490faddf484ee5b9b845316f921f5888b23b18
asciimatics/paths.py
python
Path._add_step
(self, pos)
Add a step to the end of the current recorded path. :param pos: The position tuple (x, y) to add to the list.
Add a step to the end of the current recorded path.
[ "Add", "a", "step", "to", "the", "end", "of", "the", "current", "recorded", "path", "." ]
def _add_step(self, pos): """ Add a step to the end of the current recorded path. :param pos: The position tuple (x, y) to add to the list. """ self._steps.append(pos) self._rec_x = pos[0] self._rec_y = pos[1]
[ "def", "_add_step", "(", "self", ",", "pos", ")", ":", "self", ".", "_steps", ".", "append", "(", "pos", ")", "self", ".", "_rec_x", "=", "pos", "[", "0", "]", "self", ".", "_rec_y", "=", "pos", "[", "1", "]" ]
https://github.com/peterbrittain/asciimatics/blob/9a490faddf484ee5b9b845316f921f5888b23b18/asciimatics/paths.py#L113-L121
google/grr
8ad8a4d2c5a93c92729206b7771af19d92d4f915
grr/client/grr_response_client/osx/objc.py
python
CFBoolean.__bool__
(self)
return self.value
[]
def __bool__(self): return self.value
[ "def", "__bool__", "(", "self", ")", ":", "return", "self", ".", "value" ]
https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/client/grr_response_client/osx/objc.py#L304-L305
nipy/nibabel
4703f4d8e32be4cec30e829c2d93ebe54759bb62
nibabel/_version.py
python
render_git_describe
(pieces)
return rendered
TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix)
TAG[-DISTANCE-gHEX][-dirty].
[ "TAG", "[", "-", "DISTANCE", "-", "gHEX", "]", "[", "-", "dirty", "]", "." ]
def render_git_describe(pieces): """TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered +=...
[ "def", "render_git_describe", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", ":", "rendered", "+=", "\"-%d-g%s\"", "%", "(", "pieces...
https://github.com/nipy/nibabel/blob/4703f4d8e32be4cec30e829c2d93ebe54759bb62/nibabel/_version.py#L424-L441
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/setuptools/package_index.py
python
open_with_auth
(url, opener=urllib.request.urlopen)
return fp
Open a urllib2 request, handling HTTP authentication
Open a urllib2 request, handling HTTP authentication
[ "Open", "a", "urllib2", "request", "handling", "HTTP", "authentication" ]
def open_with_auth(url, opener=urllib.request.urlopen): """Open a urllib2 request, handling HTTP authentication""" scheme, netloc, path, params, query, frag = urllib.parse.urlparse(url) # Double scheme does not raise on Mac OS X as revealed by a # failing test. We would expect "nonnumeric port". Refs ...
[ "def", "open_with_auth", "(", "url", ",", "opener", "=", "urllib", ".", "request", ".", "urlopen", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "frag", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")"...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/setuptools/package_index.py#L1035-L1077
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/examples/demo/Advanced/Tabular_editor_with_context_menu_demo.py
python
PlayerAdapter.sub
(self, object, column)
Decrement the affected player statistic.
Decrement the affected player statistic.
[ "Decrement", "the", "affected", "player", "statistic", "." ]
def sub(self, object, column): """Decrement the affected player statistic.""" column_name = self.column_map[column] setattr(object, column_name, getattr(object, column_name) - 1)
[ "def", "sub", "(", "self", ",", "object", ",", "column", ")", ":", "column_name", "=", "self", ".", "column_map", "[", "column", "]", "setattr", "(", "object", ",", "column_name", ",", "getattr", "(", "object", ",", "column_name", ")", "-", "1", ")" ]
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/examples/demo/Advanced/Tabular_editor_with_context_menu_demo.py#L81-L84
rsmusllp/termineter
9311d6d995a7bf0f80853a00a115a8fa16aa0727
lib/termineter/interface.py
python
InteractiveInterpreter.do_reload
(self, args)
Reload a module in to the framework
Reload a module in to the framework
[ "Reload", "a", "module", "in", "to", "the", "framework" ]
def do_reload(self, args): """Reload a module in to the framework""" if args.module is not None: if args.module not in self.frmwk.modules: self.print_error('Invalid Module Selected.') return module = self.frmwk.modules[args.module] elif self.frmwk.current_module: module = self.frmwk.current_modul...
[ "def", "do_reload", "(", "self", ",", "args", ")", ":", "if", "args", ".", "module", "is", "not", "None", ":", "if", "args", ".", "module", "not", "in", "self", ".", "frmwk", ".", "modules", ":", "self", ".", "print_error", "(", "'Invalid Module Select...
https://github.com/rsmusllp/termineter/blob/9311d6d995a7bf0f80853a00a115a8fa16aa0727/lib/termineter/interface.py#L428-L440
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/asyncio/sslproto.py
python
_SSLProtocolTransport.can_write_eof
(self)
return False
Return True if this transport supports write_eof(), False if not.
Return True if this transport supports write_eof(), False if not.
[ "Return", "True", "if", "this", "transport", "supports", "write_eof", "()", "False", "if", "not", "." ]
def can_write_eof(self): """Return True if this transport supports write_eof(), False if not.""" return False
[ "def", "can_write_eof", "(", "self", ")", ":", "return", "False" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/asyncio/sslproto.py#L392-L394
lvpengyuan/masktextspotter.caffe2
da99ef31f5ccb4de5248bb881d5b4a291910c8ae
lib/datasets/roidb.py
python
filter_for_training
(roidb)
return filtered_roidb
Remove roidb entries that have no usable RoIs based on config settings.
Remove roidb entries that have no usable RoIs based on config settings.
[ "Remove", "roidb", "entries", "that", "have", "no", "usable", "RoIs", "based", "on", "config", "settings", "." ]
def filter_for_training(roidb): """Remove roidb entries that have no usable RoIs based on config settings. """ def is_valid(entry): # Valid images have: # (1) At least one foreground RoI OR # (2) At least one background RoI overlaps = entry['max_overlaps'] # find ...
[ "def", "filter_for_training", "(", "roidb", ")", ":", "def", "is_valid", "(", "entry", ")", ":", "# Valid images have:", "# (1) At least one foreground RoI OR", "# (2) At least one background RoI", "overlaps", "=", "entry", "[", "'max_overlaps'", "]", "# find boxes with...
https://github.com/lvpengyuan/masktextspotter.caffe2/blob/da99ef31f5ccb4de5248bb881d5b4a291910c8ae/lib/datasets/roidb.py#L111-L136
reclosedev/requests-cache
a29b85c3df40f874f80d06c949463b9532dada40
requests_cache/patcher.py
python
install_cache
( cache_name: str = 'http_cache', backend: BackendSpecifier = None, expire_after: ExpirationTime = -1, urls_expire_after: Dict[str, ExpirationTime] = None, allowable_codes: Iterable[int] = (200,), allowable_methods: Iterable['str'] = ('GET', 'HEAD'), filter_fn: Callable = None, stale_if_...
Install the cache for all ``requests`` functions by monkey-patching :py:class:`requests.Session` Example: >>> requests_cache.install_cache('demo_cache') Accepts all the same parameters as :py:class:`.CachedSession`. Additional parameters: Args: session_factory: Session class to use. It m...
Install the cache for all ``requests`` functions by monkey-patching :py:class:`requests.Session`
[ "Install", "the", "cache", "for", "all", "requests", "functions", "by", "monkey", "-", "patching", ":", "py", ":", "class", ":", "requests", ".", "Session" ]
def install_cache( cache_name: str = 'http_cache', backend: BackendSpecifier = None, expire_after: ExpirationTime = -1, urls_expire_after: Dict[str, ExpirationTime] = None, allowable_codes: Iterable[int] = (200,), allowable_methods: Iterable['str'] = ('GET', 'HEAD'), filter_fn: Callable = No...
[ "def", "install_cache", "(", "cache_name", ":", "str", "=", "'http_cache'", ",", "backend", ":", "BackendSpecifier", "=", "None", ",", "expire_after", ":", "ExpirationTime", "=", "-", "1", ",", "urls_expire_after", ":", "Dict", "[", "str", ",", "ExpirationTime...
https://github.com/reclosedev/requests-cache/blob/a29b85c3df40f874f80d06c949463b9532dada40/requests_cache/patcher.py#L23-L63
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/Shared/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.keys
(self)
return list(self)
od.keys() -> list of keys in od
od.keys() -> list of keys in od
[ "od", ".", "keys", "()", "-", ">", "list", "of", "keys", "in", "od" ]
def keys(self): 'od.keys() -> list of keys in od' return list(self)
[ "def", "keys", "(", "self", ")", ":", "return", "list", "(", "self", ")" ]
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/Shared/requests/packages/urllib3/packages/ordered_dict.py#L116-L118
inducer/loopy
55143b21711a534c07bbb14aaa63ff3879a93433
loopy/symbolic.py
python
AffineConditionToISLSetMapper._map_logical_reduce
(self, expr, f)
return reduce(f, sets)
:arg f: Reduction callable.
:arg f: Reduction callable.
[ ":", "arg", "f", ":", "Reduction", "callable", "." ]
def _map_logical_reduce(self, expr, f): """ :arg f: Reduction callable. """ sets = [self.rec(child) for child in expr.children] return reduce(f, sets)
[ "def", "_map_logical_reduce", "(", "self", ",", "expr", ",", "f", ")", ":", "sets", "=", "[", "self", ".", "rec", "(", "child", ")", "for", "child", "in", "expr", ".", "children", "]", "return", "reduce", "(", "f", ",", "sets", ")" ]
https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/symbolic.py#L2115-L2120
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/widgets/DataFilterWidget.py
python
DataFilterParameter.setFields
(self, fields)
Set the list of fields that are available to be filtered. *fields* must be a dict or list of tuples that maps field names to a specification describing the field. Each specification is itself a dict with either ``'mode':'range'`` or ``'mode':'enum'``:: filter.setFields([ ...
Set the list of fields that are available to be filtered.
[ "Set", "the", "list", "of", "fields", "that", "are", "available", "to", "be", "filtered", "." ]
def setFields(self, fields): """Set the list of fields that are available to be filtered. *fields* must be a dict or list of tuples that maps field names to a specification describing the field. Each specification is itself a dict with either ``'mode':'range'`` or ``'mode':'enum'``:: ...
[ "def", "setFields", "(", "self", ",", "fields", ")", ":", "with", "fn", ".", "SignalBlock", "(", "self", ".", "sigTreeStateChanged", ",", "self", ".", "filterChanged", ")", ":", "self", ".", "fields", "=", "OrderedDict", "(", "fields", ")", "names", "=",...
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/extern/pyqtgraph_0_11_0/pyqtgraph/widgets/DataFilterWidget.py#L67-L90
misterch0c/shadowbroker
e3a069bea47a2c1009697941ac214adc6f90aa8d
windows/Resources/Python/Core/Lib/numbers.py
python
Real.__divmod__
(self, other)
return ( self // other, self % other)
divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations.
divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations.
[ "divmod", "(", "self", "other", ")", ":", "The", "pair", "(", "self", "//", "other", "self", "%", "other", ")", ".", "Sometimes", "this", "can", "be", "computed", "faster", "than", "the", "pair", "of", "operations", "." ]
def __divmod__(self, other): """divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. """ return ( self // other, self % other)
[ "def", "__divmod__", "(", "self", ",", "other", ")", ":", "return", "(", "self", "//", "other", ",", "self", "%", "other", ")" ]
https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/numbers.py#L188-L195
conansherry/detectron2
72c935d9aad8935406b1038af408aa06077d950a
detectron2/utils/visualizer.py
python
Visualizer.draw_sem_seg
(self, sem_seg, area_threshold=None, alpha=0.8)
return self.output
Draw semantic segmentation predictions/labels. Args: sem_seg (Tensor or ndarray): the segmentation of shape (H, W). area_threshold (int): segments with less than `area_threshold` are not drawn. alpha (float): the larger it is, the more opaque the segmentations are. ...
Draw semantic segmentation predictions/labels.
[ "Draw", "semantic", "segmentation", "predictions", "/", "labels", "." ]
def draw_sem_seg(self, sem_seg, area_threshold=None, alpha=0.8): """ Draw semantic segmentation predictions/labels. Args: sem_seg (Tensor or ndarray): the segmentation of shape (H, W). area_threshold (int): segments with less than `area_threshold` are not drawn. ...
[ "def", "draw_sem_seg", "(", "self", ",", "sem_seg", ",", "area_threshold", "=", "None", ",", "alpha", "=", "0.8", ")", ":", "if", "isinstance", "(", "sem_seg", ",", "torch", ".", "Tensor", ")", ":", "sem_seg", "=", "sem_seg", ".", "numpy", "(", ")", ...
https://github.com/conansherry/detectron2/blob/72c935d9aad8935406b1038af408aa06077d950a/detectron2/utils/visualizer.py#L372-L405
MontrealCorpusTools/Montreal-Forced-Aligner
63473f9a4fabd31eec14e1e5022882f85cfdaf31
montreal_forced_aligner/language_modeling/trainer.py
python
LmCorpusTrainer.normalized_text_iter
(self, min_count: int = 1)
Construct an iterator over the normalized texts in the corpus Parameters ---------- min_count: int Minimum word count to include in the output, otherwise will use OOV code, defaults to 1 Yields ------- str Normalized text
Construct an iterator over the normalized texts in the corpus
[ "Construct", "an", "iterator", "over", "the", "normalized", "texts", "in", "the", "corpus" ]
def normalized_text_iter(self, min_count: int = 1) -> Generator: """ Construct an iterator over the normalized texts in the corpus Parameters ---------- min_count: int Minimum word count to include in the output, otherwise will use OOV code, defaults to 1 Yi...
[ "def", "normalized_text_iter", "(", "self", ",", "min_count", ":", "int", "=", "1", ")", "->", "Generator", ":", "unk_words", "=", "{", "k", "for", "k", ",", "v", "in", "self", ".", "word_counts", ".", "items", "(", ")", "if", "v", "<=", "min_count",...
https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/language_modeling/trainer.py#L313-L349
OpenNMT/OpenNMT-py
4815f07fcd482af9a1fe1d3b620d144197178bc5
onmt/translate/greedy_search.py
python
GreedySearch.__init__
(self, pad, bos, eos, unk, batch_size, global_scorer, min_length, block_ngram_repeat, exclusion_tokens, return_attention, max_length, sampling_temp, keep_topk, keep_topp, beam_size, ban_unk_token)
[]
def __init__(self, pad, bos, eos, unk, batch_size, global_scorer, min_length, block_ngram_repeat, exclusion_tokens, return_attention, max_length, sampling_temp, keep_topk, keep_topp, beam_size, ban_unk_token): super(GreedySearch, self).__init__( pad...
[ "def", "__init__", "(", "self", ",", "pad", ",", "bos", ",", "eos", ",", "unk", ",", "batch_size", ",", "global_scorer", ",", "min_length", ",", "block_ngram_repeat", ",", "exclusion_tokens", ",", "return_attention", ",", "max_length", ",", "sampling_temp", ",...
https://github.com/OpenNMT/OpenNMT-py/blob/4815f07fcd482af9a1fe1d3b620d144197178bc5/onmt/translate/greedy_search.py#L122-L134
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/setuptools/pep425tags.py
python
get_flag
(var, fallback, expected=True, warn=True)
return val == expected
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.
[ "Use", "a", "fallback", "method", "for", "determining", "SOABI", "flags", "if", "the", "needed", "config", "var", "is", "unset", "or", "unavailable", "." ]
def get_flag(var, fallback, expected=True, warn=True): """Use a fallback method for determining SOABI flags if the needed config var is unset or unavailable.""" val = get_config_var(var) if val is None: if warn: warnings.warn("Config variable '{0}' is unset, Python ABI tag may " ...
[ "def", "get_flag", "(", "var", ",", "fallback", ",", "expected", "=", "True", ",", "warn", "=", "True", ")", ":", "val", "=", "get_config_var", "(", "var", ")", "if", "val", "is", "None", ":", "if", "warn", ":", "warnings", ".", "warn", "(", "\"Con...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/setuptools/pep425tags.py#L66-L75
madduck/reclass
9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b
reclass/storage/__init__.py
python
NodeStorageBase.enumerate_nodes
(self)
[]
def enumerate_nodes(self): msg = "Storage class '{0}' does not implement node enumeration." raise NotImplementedError(msg.format(self.name))
[ "def", "enumerate_nodes", "(", "self", ")", ":", "msg", "=", "\"Storage class '{0}' does not implement node enumeration.\"", "raise", "NotImplementedError", "(", "msg", ".", "format", "(", "self", ".", "name", ")", ")" ]
https://github.com/madduck/reclass/blob/9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b/reclass/storage/__init__.py#L25-L27