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
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/templates/historic/Climate/ClimateDataPortal/DSL/Units.py
python
Units.__init__
(units, dimensions, positive)
Example: >>> c = Counter({"a": 4, "b": 2})
Example: >>> c = Counter({"a": 4, "b": 2})
[ "Example", ":", ">>>", "c", "=", "Counter", "(", "{", "a", ":", "4", "b", ":", "2", "}", ")" ]
def __init__(units, dimensions, positive): """Example: >>> c = Counter({"a": 4, "b": 2}) """ for dimension, count in dimensions.iteritems(): if not isinstance(count, int): raise DimensionError( "%s dimension count must be a whole number" %...
[ "def", "__init__", "(", "units", ",", "dimensions", ",", "positive", ")", ":", "for", "dimension", ",", "count", "in", "dimensions", ".", "iteritems", "(", ")", ":", "if", "not", "isinstance", "(", "count", ",", "int", ")", ":", "raise", "DimensionError"...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/historic/Climate/ClimateDataPortal/DSL/Units.py#L46-L57
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/typing.py
python
get_type_hints
(obj, globalns=None, localns=None)
return hints
Return type hints for an object. This is often the same as obj.__annotations__, but it handles forward references encoded as string literals, and if necessary adds Optional[t] if a default value equal to None is set. The argument may be a module, class, method, or function. The annotations are ret...
Return type hints for an object.
[ "Return", "type", "hints", "for", "an", "object", "." ]
def get_type_hints(obj, globalns=None, localns=None): """Return type hints for an object. This is often the same as obj.__annotations__, but it handles forward references encoded as string literals, and if necessary adds Optional[t] if a default value equal to None is set. The argument may be a mo...
[ "def", "get_type_hints", "(", "obj", ",", "globalns", "=", "None", ",", "localns", "=", "None", ")", ":", "if", "getattr", "(", "obj", ",", "'__no_type_check__'", ",", "None", ")", ":", "return", "{", "}", "# Classes require a special treatment.", "if", "isi...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/typing.py#L1185-L1268
open-telemetry/opentelemetry-python
f5d872050204685b5ef831d02ec593956820ebe6
exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py
python
_nsec_to_usec_round
(nsec: int)
return (nsec + 500) // 10 ** 3
Round nanoseconds to microseconds
Round nanoseconds to microseconds
[ "Round", "nanoseconds", "to", "microseconds" ]
def _nsec_to_usec_round(nsec: int) -> int: """Round nanoseconds to microseconds""" return (nsec + 500) // 10 ** 3
[ "def", "_nsec_to_usec_round", "(", "nsec", ":", "int", ")", "->", "int", ":", "return", "(", "nsec", "+", "500", ")", "//", "10", "**", "3" ]
https://github.com/open-telemetry/opentelemetry-python/blob/f5d872050204685b5ef831d02ec593956820ebe6/exporter/opentelemetry-exporter-jaeger-proto-grpc/src/opentelemetry/exporter/jaeger/proto/grpc/translate/__init__.py#L40-L42
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/blenderbot/modeling_blenderbot.py
python
BlenderbotAttention.forward
( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions: bool = Fal...
return attn_output, attn_weights_reshaped, past_key_value
Input shape: Batch x Time x Channel
Input shape: Batch x Time x Channel
[ "Input", "shape", ":", "Batch", "x", "Time", "x", "Channel" ]
def forward( self, hidden_states: torch.Tensor, key_value_states: Optional[torch.Tensor] = None, past_key_value: Optional[Tuple[torch.Tensor]] = None, attention_mask: Optional[torch.Tensor] = None, layer_head_mask: Optional[torch.Tensor] = None, output_attentions:...
[ "def", "forward", "(", "self", ",", "hidden_states", ":", "torch", ".", "Tensor", ",", "key_value_states", ":", "Optional", "[", "torch", ".", "Tensor", "]", "=", "None", ",", "past_key_value", ":", "Optional", "[", "Tuple", "[", "torch", ".", "Tensor", ...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/blenderbot/modeling_blenderbot.py#L162-L270
ifwe/digsby
f5fe00244744aa131e07f09348d10563f3d8fa99
digsby/src/AccountManager.py
python
AccountManager.accounts_set
(self, stanza=None, accounts=None)
Handle incoming network changes to the accounts list.
Handle incoming network changes to the accounts list.
[ "Handle", "incoming", "network", "changes", "to", "the", "accounts", "list", "." ]
def accounts_set(self, stanza=None, accounts=None): ''' Handle incoming network changes to the accounts list. ''' if stanza is None: assert accounts else: accounts = digsby.accounts.Accounts(stanza.get_query()) if self.maybe_delay_accounts(lambda:...
[ "def", "accounts_set", "(", "self", ",", "stanza", "=", "None", ",", "accounts", "=", "None", ")", ":", "if", "stanza", "is", "None", ":", "assert", "accounts", "else", ":", "accounts", "=", "digsby", ".", "accounts", ".", "Accounts", "(", "stanza", "....
https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/AccountManager.py#L481-L509
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Tools/scripts/texi2html.py
python
TexinfoParser.end_ifset
(self)
[]
def end_ifset(self): try: if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1] except KeyError: print '*** end_ifset: KeyError :', len(self.stack) + 1
[ "def", "end_ifset", "(", "self", ")", ":", "try", ":", "if", "self", ".", "stackinfo", "[", "len", "(", "self", ".", "stack", ")", "+", "1", "]", ":", "self", ".", "skip", "=", "self", ".", "skip", "-", "1", "del", "self", ".", "stackinfo", "["...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Tools/scripts/texi2html.py#L962-L968
ybabakhin/kaggle_salt_bes_phalanx
2f81d4dd8d50a01579e5f7650259dde92c5c3b8d
bes/segmentation_models/unet/model.py
python
Unet
(backbone_name='vgg16', input_shape=(None, None, 3), input_tensor=None, encoder_weights='imagenet', freeze_encoder=False, skip_connections='default', decoder_block_type='upsampling', decoder_filters=(256,128,64,32,16), decoder_use_batchnorm=False, ...
return model, hyper_list
Args: backbone_name: (str) look at list of available backbones. input_shape: (tuple) dimensions of input data (H, W, C) input_tensor: keras tensor encoder_weights: one of `None` (random initialization), 'imagenet' (pre-training on ImageNet) freeze_encoder: (bool) Set encoder lay...
[]
def Unet(backbone_name='vgg16', input_shape=(None, None, 3), input_tensor=None, encoder_weights='imagenet', freeze_encoder=False, skip_connections='default', decoder_block_type='upsampling', decoder_filters=(256,128,64,32,16), decoder_use_batchnorm...
[ "def", "Unet", "(", "backbone_name", "=", "'vgg16'", ",", "input_shape", "=", "(", "None", ",", "None", ",", "3", ")", ",", "input_tensor", "=", "None", ",", "encoder_weights", "=", "'imagenet'", ",", "freeze_encoder", "=", "False", ",", "skip_connections", ...
https://github.com/ybabakhin/kaggle_salt_bes_phalanx/blob/2f81d4dd8d50a01579e5f7650259dde92c5c3b8d/bes/segmentation_models/unet/model.py#L24-L85
tracim/tracim
a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21
backend/tracim_backend/applications/share/models_in_context.py
python
ContentShareInContext.content_file_extension
(self)
return self.content.file_extension
:return: file extension with "." at the beginning, example : .txt
:return: file extension with "." at the beginning, example : .txt
[ ":", "return", ":", "file", "extension", "with", ".", "at", "the", "beginning", "example", ":", ".", "txt" ]
def content_file_extension(self) -> str: """ :return: file extension with "." at the beginning, example : .txt """ return self.content.file_extension
[ "def", "content_file_extension", "(", "self", ")", "->", "str", ":", "return", "self", ".", "content", ".", "file_extension" ]
https://github.com/tracim/tracim/blob/a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21/backend/tracim_backend/applications/share/models_in_context.py#L120-L124
coreemu/core
7e18a7a72023a69a92ad61d87461bd659ba27f7c
daemon/core/api/grpc/events.py
python
EventStreamer.remove_handlers
(self)
Remove session event handlers for events being watched. :return: nothing
Remove session event handlers for events being watched.
[ "Remove", "session", "event", "handlers", "for", "events", "being", "watched", "." ]
def remove_handlers(self) -> None: """ Remove session event handlers for events being watched. :return: nothing """ if core_pb2.EventType.NODE in self.event_types: self.session.node_handlers.remove(self.queue.put) if core_pb2.EventType.LINK in self.event_type...
[ "def", "remove_handlers", "(", "self", ")", "->", "None", ":", "if", "core_pb2", ".", "EventType", ".", "NODE", "in", "self", ".", "event_types", ":", "self", ".", "session", ".", "node_handlers", ".", "remove", "(", "self", ".", "queue", ".", "put", "...
https://github.com/coreemu/core/blob/7e18a7a72023a69a92ad61d87461bd659ba27f7c/daemon/core/api/grpc/events.py#L209-L226
cbrgm/telegram-robot-rss
58fe98de427121fdc152c8df0721f1891174e6c9
venv/lib/python2.7/site-packages/telegram/ext/dispatcher.py
python
Dispatcher.add_error_handler
(self, callback)
Registers an error handler in the Dispatcher. Args: callback (:obj:`callable`): A function that takes ``Bot, Update, TelegramError`` as arguments.
Registers an error handler in the Dispatcher.
[ "Registers", "an", "error", "handler", "in", "the", "Dispatcher", "." ]
def add_error_handler(self, callback): """Registers an error handler in the Dispatcher. Args: callback (:obj:`callable`): A function that takes ``Bot, Update, TelegramError`` as arguments. """ self.error_handlers.append(callback)
[ "def", "add_error_handler", "(", "self", ",", "callback", ")", ":", "self", ".", "error_handlers", ".", "append", "(", "callback", ")" ]
https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/telegram/ext/dispatcher.py#L345-L353
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/views/generic/list.py
python
MultipleObjectTemplateResponseMixin.get_template_names
(self)
return names
Return a list of template names to be used for the request. Must return a list. May not be called if get_template is overridden.
Return a list of template names to be used for the request. Must return a list. May not be called if get_template is overridden.
[ "Return", "a", "list", "of", "template", "names", "to", "be", "used", "for", "the", "request", ".", "Must", "return", "a", "list", ".", "May", "not", "be", "called", "if", "get_template", "is", "overridden", "." ]
def get_template_names(self): """ Return a list of template names to be used for the request. Must return a list. May not be called if get_template is overridden. """ try: names = super(MultipleObjectTemplateResponseMixin, self).get_template_names() except Imp...
[ "def", "get_template_names", "(", "self", ")", ":", "try", ":", "names", "=", "super", "(", "MultipleObjectTemplateResponseMixin", ",", "self", ")", ".", "get_template_names", "(", ")", "except", "ImproperlyConfigured", ":", "# If template_name isn't specified, it's not...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/views/generic/list.py#L126-L146
mrJean1/PyGeodesy
7da5ca71aa3edb7bc49e219e0b8190686e1a7965
pygeodesy/frechet.py
python
FrechetRadians.point
(self, point)
Convert C{(lat, lon)} point in degrees to C{(a, b)} in radians. @return: An L{PhiLam2Tuple}C{(phi, lam)}.
Convert C{(lat, lon)} point in degrees to C{(a, b)} in radians.
[ "Convert", "C", "{", "(", "lat", "lon", ")", "}", "point", "in", "degrees", "to", "C", "{", "(", "a", "b", ")", "}", "in", "radians", "." ]
def point(self, point): '''Convert C{(lat, lon)} point in degrees to C{(a, b)} in radians. @return: An L{PhiLam2Tuple}C{(phi, lam)}. ''' try: return point.philam except AttributeError: return PhiLam2Tuple(radians(point.lat), radians(point.lo...
[ "def", "point", "(", "self", ",", "point", ")", ":", "try", ":", "return", "point", ".", "philam", "except", "AttributeError", ":", "return", "PhiLam2Tuple", "(", "radians", "(", "point", ".", "lat", ")", ",", "radians", "(", "point", ".", "lon", ")", ...
https://github.com/mrJean1/PyGeodesy/blob/7da5ca71aa3edb7bc49e219e0b8190686e1a7965/pygeodesy/frechet.py#L333-L342
xtiankisutsa/MARA_Framework
ac4ac88bfd38f33ae8780a606ed09ab97177c562
tools/qark/qark/lib/yapsy/PluginFileLocator.py
python
PluginFileLocator.removeAllAnalyzer
(self)
Remove all analyzers.
Remove all analyzers.
[ "Remove", "all", "analyzers", "." ]
def removeAllAnalyzer(self): """ Remove all analyzers. """ self._analyzers = []
[ "def", "removeAllAnalyzer", "(", "self", ")", ":", "self", ".", "_analyzers", "=", "[", "]" ]
https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/yapsy/PluginFileLocator.py#L369-L373
allegroai/clearml-server
bc2c2ebbfdcc43f56520630eb004278642f27309
apiserver/service_repo/util.py
python
get_local_addr
()
Get the local IP address (that isn't localhost)
Get the local IP address (that isn't localhost)
[ "Get", "the", "local", "IP", "address", "(", "that", "isn", "t", "localhost", ")" ]
def get_local_addr(): """ Get the local IP address (that isn't localhost) """ _, _, ipaddrlist = socket.gethostbyname_ex(socket.gethostname()) try: return next(ip for ip in ipaddrlist if ip not in ('127.0.0.1',)) except StopIteration: raise ValueError('Cannot find non-loopback ip address...
[ "def", "get_local_addr", "(", ")", ":", "_", ",", "_", ",", "ipaddrlist", "=", "socket", ".", "gethostbyname_ex", "(", "socket", ".", "gethostname", "(", ")", ")", "try", ":", "return", "next", "(", "ip", "for", "ip", "in", "ipaddrlist", "if", "ip", ...
https://github.com/allegroai/clearml-server/blob/bc2c2ebbfdcc43f56520630eb004278642f27309/apiserver/service_repo/util.py#L6-L12
numenta/nupic
b9ebedaf54f49a33de22d8d44dff7c765cdb5548
src/nupic/support/configuration_custom.py
python
Configuration.setCustomProperties
(cls, properties)
Set multiple custom properties and persist them to the custom configuration store. :param properties: (dict) of property name/value pairs to set
Set multiple custom properties and persist them to the custom configuration store.
[ "Set", "multiple", "custom", "properties", "and", "persist", "them", "to", "the", "custom", "configuration", "store", "." ]
def setCustomProperties(cls, properties): """ Set multiple custom properties and persist them to the custom configuration store. :param properties: (dict) of property name/value pairs to set """ _getLogger().info("Setting custom configuration properties=%r; caller=%r", p...
[ "def", "setCustomProperties", "(", "cls", ",", "properties", ")", ":", "_getLogger", "(", ")", ".", "info", "(", "\"Setting custom configuration properties=%r; caller=%r\"", ",", "properties", ",", "traceback", ".", "format_stack", "(", ")", ")", "_CustomConfiguration...
https://github.com/numenta/nupic/blob/b9ebedaf54f49a33de22d8d44dff7c765cdb5548/src/nupic/support/configuration_custom.py#L83-L96
santatic/web2attack
44b6e481a3d56cf0d98073ae0fb69833dda563d9
w2a/lib/mysql/connector/constants.py
python
FieldType.get_number_types
(cls)
return [ cls.DECIMAL, cls.NEWDECIMAL, cls.TINY, cls.SHORT, cls.LONG, cls.FLOAT, cls.DOUBLE, cls.LONGLONG, cls.INT24, cls.BIT, cls.YEAR, ]
[]
def get_number_types(cls): return [ cls.DECIMAL, cls.NEWDECIMAL, cls.TINY, cls.SHORT, cls.LONG, cls.FLOAT, cls.DOUBLE, cls.LONGLONG, cls.INT24, cls.BIT, cls.YEAR, ]
[ "def", "get_number_types", "(", "cls", ")", ":", "return", "[", "cls", ".", "DECIMAL", ",", "cls", ".", "NEWDECIMAL", ",", "cls", ".", "TINY", ",", "cls", ".", "SHORT", ",", "cls", ".", "LONG", ",", "cls", ".", "FLOAT", ",", "cls", ".", "DOUBLE", ...
https://github.com/santatic/web2attack/blob/44b6e481a3d56cf0d98073ae0fb69833dda563d9/w2a/lib/mysql/connector/constants.py#L161-L169
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py
python
DeploymentConfig.needs_update_replicas
(self, replicas)
return not current_reps == replicas
verify whether a replica update is needed
verify whether a replica update is needed
[ "verify", "whether", "a", "replica", "update", "is", "needed" ]
def needs_update_replicas(self, replicas): ''' verify whether a replica update is needed ''' current_reps = self.get(DeploymentConfig.replicas_path) return not current_reps == replicas
[ "def", "needs_update_replicas", "(", "self", ",", "replicas", ")", ":", "current_reps", "=", "self", ".", "get", "(", "DeploymentConfig", ".", "replicas_path", ")", "return", "not", "current_reps", "==", "replicas" ]
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_openshift/library/oc_scale.py#L1806-L1809
Ultimaker/Cura
a1622c77ea7259ecb956acd6de07b7d34b7ac52b
cura/OAuth2/AuthorizationHelpers.py
python
AuthorizationHelpers.getAccessTokenUsingRefreshToken
(self, refresh_token: str, callback: Callable[[AuthenticationResponse], None])
Request the access token from the authorization server using a refresh token. :param refresh_token: A long-lived token used to refresh the authentication token. :param callback: Once the token has been obtained, this function will be called with the response.
Request the access token from the authorization server using a refresh token. :param refresh_token: A long-lived token used to refresh the authentication token. :param callback: Once the token has been obtained, this function will be called with the response.
[ "Request", "the", "access", "token", "from", "the", "authorization", "server", "using", "a", "refresh", "token", ".", ":", "param", "refresh_token", ":", "A", "long", "-", "lived", "token", "used", "to", "refresh", "the", "authentication", "token", ".", ":",...
def getAccessTokenUsingRefreshToken(self, refresh_token: str, callback: Callable[[AuthenticationResponse], None]) -> None: """ Request the access token from the authorization server using a refresh token. :param refresh_token: A long-lived token used to refresh the authentication token. ...
[ "def", "getAccessTokenUsingRefreshToken", "(", "self", ",", "refresh_token", ":", "str", ",", "callback", ":", "Callable", "[", "[", "AuthenticationResponse", "]", ",", "None", "]", ")", "->", "None", ":", "Logger", ".", "log", "(", "\"d\"", ",", "\"Refreshi...
https://github.com/Ultimaker/Cura/blob/a1622c77ea7259ecb956acd6de07b7d34b7ac52b/cura/OAuth2/AuthorizationHelpers.py#L58-L79
openstack/python-keystoneclient
100253d52e0c62dffffddb6f046ad660a9bce1a9
keystoneclient/v3/contrib/federation/identity_providers.py
python
IdentityProviderManager.create
(self, id, **kwargs)
return self._build_url_and_put(identity_provider_id=id, **kwargs)
Create Identity Provider object. Utilize Keystone URI: PUT /OS-FEDERATION/identity_providers/$identity_provider :param id: unique id of the identity provider. :param kwargs: optional attributes: description (str), domain_id (str), enabled (boolean) and remote_ids...
Create Identity Provider object.
[ "Create", "Identity", "Provider", "object", "." ]
def create(self, id, **kwargs): """Create Identity Provider object. Utilize Keystone URI: PUT /OS-FEDERATION/identity_providers/$identity_provider :param id: unique id of the identity provider. :param kwargs: optional attributes: description (str), domain_id (str), ...
[ "def", "create", "(", "self", ",", "id", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_build_url_and_put", "(", "identity_provider_id", "=", "id", ",", "*", "*", "kwargs", ")" ]
https://github.com/openstack/python-keystoneclient/blob/100253d52e0c62dffffddb6f046ad660a9bce1a9/keystoneclient/v3/contrib/federation/identity_providers.py#L41-L55
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/humdrum/questions.py
python
Test.test048
(self)
Count the number of phrases in a score.
Count the number of phrases in a score.
[ "Count", "the", "number", "of", "phrases", "in", "a", "score", "." ]
def test048(self): '''Count the number of phrases in a score.''' pass
[ "def", "test048", "(", "self", ")", ":", "pass" ]
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/humdrum/questions.py#L411-L413
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/setuptools/pkg_resources/_vendor/appdirs.py
python
site_data_dir
(appname=None, appauthor=None, version=None, multipath=False)
return path
Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
Return full path to the user-shared data dir for this application.
[ "Return", "full", "path", "to", "the", "user", "-", "shared", "data", "dir", "for", "this", "application", "." ]
def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): """Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of t...
[ "def", "site_data_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "multipath", "=", "False", ")", ":", "if", "system", "==", "\"win32\"", ":", "if", "appauthor", "is", "None", ":", "appauthor", "=", "...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/setuptools/pkg_resources/_vendor/appdirs.py#L100-L163
KvasirSecurity/Kvasir
a5b3775184a8343240e1154a1f762f75df04dc0a
modules/zenmapCore_Kvasir/UmitConfigParser.py
python
UmitConfigParser.write
(self, fp)
Write alphabetically sorted config files
Write alphabetically sorted config files
[ "Write", "alphabetically", "sorted", "config", "files" ]
def write(self, fp): '''Write alphabetically sorted config files''' if self._defaults: fp.write("[%s]\n" % DEFAULTSECT) items = self._defaults.items() items.sort() for (key, value) in items: fp.write("%s = %s\n" % (key, str(value).replace...
[ "def", "write", "(", "self", ",", "fp", ")", ":", "if", "self", ".", "_defaults", ":", "fp", ".", "write", "(", "\"[%s]\\n\"", "%", "DEFAULTSECT", ")", "items", "=", "self", ".", "_defaults", ".", "items", "(", ")", "items", ".", "sort", "(", ")", ...
https://github.com/KvasirSecurity/Kvasir/blob/a5b3775184a8343240e1154a1f762f75df04dc0a/modules/zenmapCore_Kvasir/UmitConfigParser.py#L168-L189
Helpsypoo/primerpython
9d895cc56f14c5d1f9d809c5d8a4c7f0258a76a3
blender_scripts/video_scenes/natural_selection.py
python
NaturalSelectionScene.gradual_famine
(self)
tex = tex_bobject.TexBobject( '\\text{Food count} = 100', '\\substack {\\text{Gradually} \\\\ \\text{reduced food}}', scale = 2, location = [-6.5, 0, 8], rotation_euler = [74 * math.pi / 180, 0, 0], color = 'color2', centered = True ...
tex = tex_bobject.TexBobject( '\\text{Food count} = 100', '\\substack {\\text{Gradually} \\\\ \\text{reduced food}}', scale = 2, location = [-6.5, 0, 8], rotation_euler = [74 * math.pi / 180, 0, 0], color = 'color2', centered = True ...
[ "tex", "=", "tex_bobject", ".", "TexBobject", "(", "\\\\", "text", "{", "Food", "count", "}", "=", "100", "\\\\", "substack", "{", "\\\\", "text", "{", "Gradually", "}", "\\\\\\\\", "\\\\", "text", "{", "reduced", "food", "}}", "scale", "=", "2", "loca...
def gradual_famine(self): #cues = self.subscenes['gradual'] #st = cues['start'] cam_bobj, cam_swivel = cam_and_swivel( cam_location = [0, 0, 34], cam_rotation_euler = [0, 0, 0], cam_name = "Camera Bobject", swivel_location = [0, 0, 4], ...
[ "def", "gradual_famine", "(", "self", ")", ":", "#cues = self.subscenes['gradual']", "#st = cues['start']", "cam_bobj", ",", "cam_swivel", "=", "cam_and_swivel", "(", "cam_location", "=", "[", "0", ",", "0", ",", "34", "]", ",", "cam_rotation_euler", "=", "[", "...
https://github.com/Helpsypoo/primerpython/blob/9d895cc56f14c5d1f9d809c5d8a4c7f0258a76a3/blender_scripts/video_scenes/natural_selection.py#L2014-L2423
python-hyper/h2
53feb0e0d8ddd28fa2dbd534d519a8eefd441f14
examples/twisted/post_request.py
python
H2Protocol.connectionMade
(self)
Called by Twisted when the TCP connection is established. We can start sending some data now: we should open with the connection preamble.
Called by Twisted when the TCP connection is established. We can start sending some data now: we should open with the connection preamble.
[ "Called", "by", "Twisted", "when", "the", "TCP", "connection", "is", "established", ".", "We", "can", "start", "sending", "some", "data", "now", ":", "we", "should", "open", "with", "the", "connection", "preamble", "." ]
def connectionMade(self): """ Called by Twisted when the TCP connection is established. We can start sending some data now: we should open with the connection preamble. """ self.conn.initiate_connection() self.transport.write(self.conn.data_to_send())
[ "def", "connectionMade", "(", "self", ")", ":", "self", ".", "conn", ".", "initiate_connection", "(", ")", "self", ".", "transport", ".", "write", "(", "self", ".", "conn", ".", "data_to_send", "(", ")", ")" ]
https://github.com/python-hyper/h2/blob/53feb0e0d8ddd28fa2dbd534d519a8eefd441f14/examples/twisted/post_request.py#L48-L54
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/site-packages/django/contrib/sites/models.py
python
get_current_site
(request)
return current_site
Checks if contrib.sites is installed and returns either the current ``Site`` object or a ``RequestSite`` object based on the request.
Checks if contrib.sites is installed and returns either the current ``Site`` object or a ``RequestSite`` object based on the request.
[ "Checks", "if", "contrib", ".", "sites", "is", "installed", "and", "returns", "either", "the", "current", "Site", "object", "or", "a", "RequestSite", "object", "based", "on", "the", "request", "." ]
def get_current_site(request): """ Checks if contrib.sites is installed and returns either the current ``Site`` object or a ``RequestSite`` object based on the request. """ if Site._meta.installed: current_site = Site.objects.get_current() else: current_site = RequestSite(request...
[ "def", "get_current_site", "(", "request", ")", ":", "if", "Site", ".", "_meta", ".", "installed", ":", "current_site", "=", "Site", ".", "objects", ".", "get_current", "(", ")", "else", ":", "current_site", "=", "RequestSite", "(", "request", ")", "return...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/sites/models.py#L86-L95
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py
python
RaftSkein.addSupportLayerTemperature
( self, endpoints, z )
Add support layer and temperature before the object layer.
Add support layer and temperature before the object layer.
[ "Add", "support", "layer", "and", "temperature", "before", "the", "object", "layer", "." ]
def addSupportLayerTemperature( self, endpoints, z ): "Add support layer and temperature before the object layer." self.distanceFeedRate.addLinesSetAbsoluteDistanceMode( self.supportStartLines ) self.addTemperatureOrbits( endpoints, self.supportedLayersTemperature, z ) aroundPixelTable = {} layerFillInset = 0...
[ "def", "addSupportLayerTemperature", "(", "self", ",", "endpoints", ",", "z", ")", ":", "self", ".", "distanceFeedRate", ".", "addLinesSetAbsoluteDistanceMode", "(", "self", ".", "supportStartLines", ")", "self", ".", "addTemperatureOrbits", "(", "endpoints", ",", ...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-35/skeinforge_application/skeinforge_plugins/craft_plugins/raft.py#L660-L678
juhakivekas/multidiff
b22b5e202b1ce1a93657f6549e893242f9302f5a
multidiff/Multidiffmodel.py
python
MultidiffModel.__init__
(self, datas = [])
Create a MultiDiffModel for a set of objects
Create a MultiDiffModel for a set of objects
[ "Create", "a", "MultiDiffModel", "for", "a", "set", "of", "objects" ]
def __init__(self, datas = []): """Create a MultiDiffModel for a set of objects""" self.listeners = [] self.clear() self.add_all(datas)
[ "def", "__init__", "(", "self", ",", "datas", "=", "[", "]", ")", ":", "self", ".", "listeners", "=", "[", "]", "self", ".", "clear", "(", ")", "self", ".", "add_all", "(", "datas", ")" ]
https://github.com/juhakivekas/multidiff/blob/b22b5e202b1ce1a93657f6549e893242f9302f5a/multidiff/Multidiffmodel.py#L18-L22
danielhomola/mifs
f84a05d77a53586ffb475fcd42957d088c6b2906
mifs/version.py
python
_import_module_with_version_check
(module_name, minimum_version, install_info=None)
return module
Check that module is installed with a recent enough version
Check that module is installed with a recent enough version
[ "Check", "that", "module", "is", "installed", "with", "a", "recent", "enough", "version" ]
def _import_module_with_version_check(module_name, minimum_version, install_info=None): """Check that module is installed with a recent enough version """ from distutils.version import LooseVersion try: module = __import__(module_name) except ImportErro...
[ "def", "_import_module_with_version_check", "(", "module_name", ",", "minimum_version", ",", "install_info", "=", "None", ")", ":", "from", "distutils", ".", "version", "import", "LooseVersion", "try", ":", "module", "=", "__import__", "(", "module_name", ")", "ex...
https://github.com/danielhomola/mifs/blob/f84a05d77a53586ffb475fcd42957d088c6b2906/mifs/version.py#L50-L83
trufont/trufont
666edb661f53b457770af2ced5213a557215ae9a
Lib/defconQt/tools/drawing.py
python
drawFontPostscriptFamilyBlues
(painter, glyph, scale, color=None)
Draws a Glyph_ *glyph*’s family blue values. .. _Glyph: http://ts-defcon.readthedocs.org/en/ufo3/objects/glyph.html
Draws a Glyph_ *glyph*’s family blue values.
[ "Draws", "a", "Glyph_", "*", "glyph", "*", "’s", "family", "blue", "values", "." ]
def drawFontPostscriptFamilyBlues(painter, glyph, scale, color=None): """ Draws a Glyph_ *glyph*’s family blue values. .. _Glyph: http://ts-defcon.readthedocs.org/en/ufo3/objects/glyph.html """ font = glyph.font if font is None: return blues = [] if font.info.postscriptFamilyBlu...
[ "def", "drawFontPostscriptFamilyBlues", "(", "painter", ",", "glyph", ",", "scale", ",", "color", "=", "None", ")", ":", "font", "=", "glyph", ".", "font", "if", "font", "is", "None", ":", "return", "blues", "=", "[", "]", "if", "font", ".", "info", ...
https://github.com/trufont/trufont/blob/666edb661f53b457770af2ced5213a557215ae9a/Lib/defconQt/tools/drawing.py#L391-L409
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/docutils/transforms/__init__.py
python
Transform.__init__
(self, document, startnode=None)
Initial setup for in-place document transforms.
Initial setup for in-place document transforms.
[ "Initial", "setup", "for", "in", "-", "place", "document", "transforms", "." ]
def __init__(self, document, startnode=None): """ Initial setup for in-place document transforms. """ self.document = document """The document tree to transform.""" self.startnode = startnode """Node from which to begin the transform. For many transforms which ...
[ "def", "__init__", "(", "self", ",", "document", ",", "startnode", "=", "None", ")", ":", "self", ".", "document", "=", "document", "\"\"\"The document tree to transform.\"\"\"", "self", ".", "startnode", "=", "startnode", "\"\"\"Node from which to begin the transform. ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/docutils/transforms/__init__.py#L42-L57
scikit-hep/awkward-0.x
dd885bef15814f588b58944d2505296df4aaae0e
awkward0/array/base.py
python
AwkwardArray.isunmasked
(self)
return self.boolmask(maskedwhen=False)
[]
def isunmasked(self): return self.boolmask(maskedwhen=False)
[ "def", "isunmasked", "(", "self", ")", ":", "return", "self", ".", "boolmask", "(", "maskedwhen", "=", "False", ")" ]
https://github.com/scikit-hep/awkward-0.x/blob/dd885bef15814f588b58944d2505296df4aaae0e/awkward0/array/base.py#L470-L471
modoboa/modoboa
9065b7a5679fee149fc6f6f0e1760699c194cf89
modoboa/limits/lib.py
python
allocate_resources_from_user
(limit, user, value)
Allocate resource using an existing user. When a reseller creates a domain administrator, he generally assigns him resource to create new objetcs. As a reseller may also be limited, the resource he gives is taken from its own pool.
Allocate resource using an existing user.
[ "Allocate", "resource", "using", "an", "existing", "user", "." ]
def allocate_resources_from_user(limit, user, value): """Allocate resource using an existing user. When a reseller creates a domain administrator, he generally assigns him resource to create new objetcs. As a reseller may also be limited, the resource he gives is taken from its own pool. """ ...
[ "def", "allocate_resources_from_user", "(", "limit", ",", "user", ",", "value", ")", ":", "ol", "=", "user", ".", "userobjectlimit_set", ".", "get", "(", "name", "=", "limit", ".", "name", ")", "if", "value", "==", "-", "1", "and", "ol", ".", "max_valu...
https://github.com/modoboa/modoboa/blob/9065b7a5679fee149fc6f6f0e1760699c194cf89/modoboa/limits/lib.py#L36-L58
jinxiwang/ocr_TDR
391966af1a5d06a31cadba809df35ba170c71c60
utlis/make_data.py
python
__english_symbol
(symbol)
将英文符号转为中文符号 :param symbol: :return:
将英文符号转为中文符号 :param symbol: :return:
[ "将英文符号转为中文符号", ":", "param", "symbol", ":", ":", "return", ":" ]
def __english_symbol(symbol): """ 将英文符号转为中文符号 :param symbol: :return: """ if symbol is '.': return '。' elif symbol is '?': return '?' elif symbol is '!': return '!' elif symbol is '(': return '(' elif symbol is ')': return ')' elif symb...
[ "def", "__english_symbol", "(", "symbol", ")", ":", "if", "symbol", "is", "'.'", ":", "return", "'。'", "elif", "symbol", "is", "'?'", ":", "return", "'?'", "elif", "symbol", "is", "'!'", ":", "return", "'!'", "elif", "symbol", "is", "'('", ":", "return...
https://github.com/jinxiwang/ocr_TDR/blob/391966af1a5d06a31cadba809df35ba170c71c60/utlis/make_data.py#L70-L89
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/runtime.py
python
Context.super
(self, name, current)
return BlockReference(name, self, blocks, index)
Render a parent block.
Render a parent block.
[ "Render", "a", "parent", "block", "." ]
def super(self, name, current): """Render a parent block.""" try: blocks = self.blocks[name] index = blocks.index(current) + 1 blocks[index] except LookupError: return self.environment.undefined('there is no parent block ' ...
[ "def", "super", "(", "self", ",", "name", ",", "current", ")", ":", "try", ":", "blocks", "=", "self", ".", "blocks", "[", "name", "]", "index", "=", "blocks", ".", "index", "(", "current", ")", "+", "1", "blocks", "[", "index", "]", "except", "L...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Doc/jinja2/runtime.py#L124-L134
PythonCharmers/python-future
80523f383fbba1c6de0551e19d0277e73e69573c
src/libfuturize/fixer_util.py
python
NameImport
(package, as_name=None, prefix=None)
return Node(syms.import_name, children)
Accepts a package (Name node), name to import it as (string), and optional prefix and returns a node: import <package> [as <as_name>]
Accepts a package (Name node), name to import it as (string), and optional prefix and returns a node: import <package> [as <as_name>]
[ "Accepts", "a", "package", "(", "Name", "node", ")", "name", "to", "import", "it", "as", "(", "string", ")", "and", "optional", "prefix", "and", "returns", "a", "node", ":", "import", "<package", ">", "[", "as", "<as_name", ">", "]" ]
def NameImport(package, as_name=None, prefix=None): """ Accepts a package (Name node), name to import it as (string), and optional prefix and returns a node: import <package> [as <as_name>] """ if prefix is None: prefix = u"" children = [Name(u"import", prefix=prefix), package] i...
[ "def", "NameImport", "(", "package", ",", "as_name", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "prefix", "is", "None", ":", "prefix", "=", "u\"\"", "children", "=", "[", "Name", "(", "u\"import\"", ",", "prefix", "=", "prefix", ")", ",...
https://github.com/PythonCharmers/python-future/blob/80523f383fbba1c6de0551e19d0277e73e69573c/src/libfuturize/fixer_util.py#L136-L148
clarkkev/deep-coref
7827ab5002665c739d8de1fc8aeb65bfddb23394
modified_keras/keras/models.py
python
Sequential.load_weights
(self, filepath)
This method does not make use of Sequential.set_weights() for backwards compatibility.
This method does not make use of Sequential.set_weights() for backwards compatibility.
[ "This", "method", "does", "not", "make", "use", "of", "Sequential", ".", "set_weights", "()", "for", "backwards", "compatibility", "." ]
def load_weights(self, filepath): ''' This method does not make use of Sequential.set_weights() for backwards compatibility. ''' # Loads weights from HDF5 file import h5py f = h5py.File(filepath) for k in range(f.attrs['nb_layers']): g ...
[ "def", "load_weights", "(", "self", ",", "filepath", ")", ":", "# Loads weights from HDF5 file", "import", "h5py", "f", "=", "h5py", ".", "File", "(", "filepath", ")", "for", "k", "in", "range", "(", "f", ".", "attrs", "[", "'nb_layers'", "]", ")", ":", ...
https://github.com/clarkkev/deep-coref/blob/7827ab5002665c739d8de1fc8aeb65bfddb23394/modified_keras/keras/models.py#L559-L571
alegonz/baikal
332623c1d6121d3321f9cd9972fc36b6d16462d4
baikal/sklearn.py
python
SKLearnWrapper.fit
(self, X, y=None, **fit_params)
return self
Fit wrapped model. Parameters ---------- X Input data to the model. y Target data to the model. fit_params Parameters passed to the fit method of each model step, where each parameter name has the form ``<step-name>__<parameter-nam...
Fit wrapped model.
[ "Fit", "wrapped", "model", "." ]
def fit(self, X, y=None, **fit_params): """Fit wrapped model. Parameters ---------- X Input data to the model. y Target data to the model. fit_params Parameters passed to the fit method of each model step, where each parame...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "self", ".", "_model", ".", "fit", "(", "X", ",", "y", ",", "*", "*", "fit_params", ")", "return", "self" ]
https://github.com/alegonz/baikal/blob/332623c1d6121d3321f9cd9972fc36b6d16462d4/baikal/sklearn.py#L73-L91
Grunny/zap-cli
d58d4850ecfc5467badfac5e5bcc841d064bd419
zapcli/zap_helper.py
python
ZAPHelper.shutdown
(self)
Shutdown ZAP.
Shutdown ZAP.
[ "Shutdown", "ZAP", "." ]
def shutdown(self): """Shutdown ZAP.""" if not self.is_running(): self.logger.warn('ZAP is not running.') return self.logger.debug('Shutting down ZAP.') self.zap.core.shutdown() timeout_time = time.time() + self.timeout while self.is_running(): ...
[ "def", "shutdown", "(", "self", ")", ":", "if", "not", "self", ".", "is_running", "(", ")", ":", "self", ".", "logger", ".", "warn", "(", "'ZAP is not running.'", ")", "return", "self", ".", "logger", ".", "debug", "(", "'Shutting down ZAP.'", ")", "self...
https://github.com/Grunny/zap-cli/blob/d58d4850ecfc5467badfac5e5bcc841d064bd419/zapcli/zap_helper.py#L97-L112
aio-libs/aiohttp-session
09a93b936d94e514bd16791c37d9301715710c61
aiohttp_session/__init__.py
python
Session.new
(self)
return self._new
[]
def new(self) -> bool: return self._new
[ "def", "new", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "_new" ]
https://github.com/aio-libs/aiohttp-session/blob/09a93b936d94e514bd16791c37d9301715710c61/aiohttp_session/__init__.py#L89-L90
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/gen/plug/menu/_enumeratedlist.py
python
EnumeratedListOption.__init__
(self, label, value)
:param label: A friendly label to be applied to this option. Example: "Paper Size" :type label: string :param value: An initial value for this option. Example: 5 :type value: int :return: nothing
:param label: A friendly label to be applied to this option. Example: "Paper Size" :type label: string :param value: An initial value for this option. Example: 5 :type value: int :return: nothing
[ ":", "param", "label", ":", "A", "friendly", "label", "to", "be", "applied", "to", "this", "option", ".", "Example", ":", "Paper", "Size", ":", "type", "label", ":", "string", ":", "param", "value", ":", "An", "initial", "value", "for", "this", "option...
def __init__(self, label, value): """ :param label: A friendly label to be applied to this option. Example: "Paper Size" :type label: string :param value: An initial value for this option. Example: 5 :type value: int :return: nothing """ ...
[ "def", "__init__", "(", "self", ",", "label", ",", "value", ")", ":", "self", ".", "ini_value", "=", "value", "Option", ".", "__init__", "(", "self", ",", "label", ",", "value", ")", "self", ".", "__items", "=", "[", "]", "self", ".", "__xml_items", ...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/plug/menu/_enumeratedlist.py#L55-L68
Flexget/Flexget
ffad58f206278abefc88d63a1ffaa80476fc4d98
flexget/components/series/series.py
python
FilterSeries.process_quality
(self, config, entries)
return result
Filters eps that do not fall between within our defined quality standards. :returns: A list of eps that are in the acceptable range
Filters eps that do not fall between within our defined quality standards.
[ "Filters", "eps", "that", "do", "not", "fall", "between", "within", "our", "defined", "quality", "standards", "." ]
def process_quality(self, config, entries): """ Filters eps that do not fall between within our defined quality standards. :returns: A list of eps that are in the acceptable range """ reqs = qualities.Requirements(config['quality']) logger.debug('quality req: {}', reqs) ...
[ "def", "process_quality", "(", "self", ",", "config", ",", "entries", ")", ":", "reqs", "=", "qualities", ".", "Requirements", "(", "config", "[", "'quality'", "]", ")", "logger", ".", "debug", "(", "'quality req: {}'", ",", "reqs", ")", "result", "=", "...
https://github.com/Flexget/Flexget/blob/ffad58f206278abefc88d63a1ffaa80476fc4d98/flexget/components/series/series.py#L882-L901
tibonihoo/yapsy
e354643001fc822753843a54f72daf717cd6cdef
package/yapsy/IMultiprocessChildPlugin.py
python
IMultiprocessChildPlugin.run
(self)
return
Override this method in your implementation
Override this method in your implementation
[ "Override", "this", "method", "in", "your", "implementation" ]
def run(self): """ Override this method in your implementation """ return
[ "def", "run", "(", "self", ")", ":", "return" ]
https://github.com/tibonihoo/yapsy/blob/e354643001fc822753843a54f72daf717cd6cdef/package/yapsy/IMultiprocessChildPlugin.py#L42-L46
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/bmlb/v20180625/models.py
python
CreateL7RulesRequest.__init__
(self)
r""" :param LoadBalancerId: 负载均衡实例ID,可通过接口DescribeLoadBalancers查询。 :type LoadBalancerId: str :param ListenerId: 七层监听器实例ID,可通过接口DescribeL7Listeners查询。 :type ListenerId: str :param RuleSet: 七层转发规则信息数组,可以创建多个七层转发规则。目前一个七层监听器下面最多允许创建50个七层转发域名,而每一个转发域名下最多可以创建100个转发规则。目前只能单条创建,不能批量创建。 ...
r""" :param LoadBalancerId: 负载均衡实例ID,可通过接口DescribeLoadBalancers查询。 :type LoadBalancerId: str :param ListenerId: 七层监听器实例ID,可通过接口DescribeL7Listeners查询。 :type ListenerId: str :param RuleSet: 七层转发规则信息数组,可以创建多个七层转发规则。目前一个七层监听器下面最多允许创建50个七层转发域名,而每一个转发域名下最多可以创建100个转发规则。目前只能单条创建,不能批量创建。 ...
[ "r", ":", "param", "LoadBalancerId", ":", "负载均衡实例ID,可通过接口DescribeLoadBalancers查询。", ":", "type", "LoadBalancerId", ":", "str", ":", "param", "ListenerId", ":", "七层监听器实例ID,可通过接口DescribeL7Listeners查询。", ":", "type", "ListenerId", ":", "str", ":", "param", "RuleSet", ":"...
def __init__(self): r""" :param LoadBalancerId: 负载均衡实例ID,可通过接口DescribeLoadBalancers查询。 :type LoadBalancerId: str :param ListenerId: 七层监听器实例ID,可通过接口DescribeL7Listeners查询。 :type ListenerId: str :param RuleSet: 七层转发规则信息数组,可以创建多个七层转发规则。目前一个七层监听器下面最多允许创建50个七层转发域名,而每一个转发域名下最多可以...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "LoadBalancerId", "=", "None", "self", ".", "ListenerId", "=", "None", "self", ".", "RuleSet", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/bmlb/v20180625/models.py#L725-L736
frescobaldi/frescobaldi
301cc977fc4ba7caa3df9e4bf905212ad5d06912
frescobaldi_app/simplemarkdown.py
python
Parser.handle_lists
(self, indent, list_type=None)
Close ongoing lists or start new lists if needed. If given, list_type should be 'orderedlist', 'unorderedlist', or 'definitionlist'.
Close ongoing lists or start new lists if needed.
[ "Close", "ongoing", "lists", "or", "start", "new", "lists", "if", "needed", "." ]
def handle_lists(self, indent, list_type=None): """Close ongoing lists or start new lists if needed. If given, list_type should be 'orderedlist', 'unorderedlist', or 'definitionlist'. """ if list_type and (not self._lists or self._lists[-1][1] < indent): self._lists...
[ "def", "handle_lists", "(", "self", ",", "indent", ",", "list_type", "=", "None", ")", ":", "if", "list_type", "and", "(", "not", "self", ".", "_lists", "or", "self", ".", "_lists", "[", "-", "1", "]", "[", "1", "]", "<", "indent", ")", ":", "sel...
https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/simplemarkdown.py#L367-L389
grnet/synnefo
d06ec8c7871092131cdaabf6b03ed0b504c93e43
snf-pithos-backend/pithos/backends/modular.py
python
ModularBackend.get_object_permissions_bulk
(self, user, account, container, names)
return nobject_permissions
Return the action allowed on the object, the path from which the object gets its permissions from, along with a dictionary containing the permissions.
Return the action allowed on the object, the path from which the object gets its permissions from, along with a dictionary containing the permissions.
[ "Return", "the", "action", "allowed", "on", "the", "object", "the", "path", "from", "which", "the", "object", "gets", "its", "permissions", "from", "along", "with", "a", "dictionary", "containing", "the", "permissions", "." ]
def get_object_permissions_bulk(self, user, account, container, names): """Return the action allowed on the object, the path from which the object gets its permissions from, along with a dictionary containing the permissions.""" permissions_path = self._get_permissions_path_bulk(account...
[ "def", "get_object_permissions_bulk", "(", "self", ",", "user", ",", "account", ",", "container", ",", "names", ")", ":", "permissions_path", "=", "self", ".", "_get_permissions_path_bulk", "(", "account", ",", "container", ",", "names", ")", "access_objects", "...
https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-pithos-backend/pithos/backends/modular.py#L1228-L1255
tuckerbalch/QSTK
4981506c37227a72404229d5e1e0887f797a5d57
Bin/csv2fund.py
python
csv2fund
(filename)
return [share_table, commissions, i_start_cash]
@summary converts a csv file to a fund with the given starting value @param filename: csv file to open and convert @param start_val: starting value for the portfolio @return fund : time series containing fund value over time @return leverage : time series containing fund value over time @return slip...
[]
def csv2fund(filename): """ @summary converts a csv file to a fund with the given starting value @param filename: csv file to open and convert @param start_val: starting value for the portfolio @return fund : time series containing fund value over time @return leverage : time series containing f...
[ "def", "csv2fund", "(", "filename", ")", ":", "reader", "=", "csv", ".", "reader", "(", "open", "(", "filename", ",", "'rU'", ")", ",", "delimiter", "=", "','", ")", "reader", ".", "next", "(", ")", "symbols", "=", "[", "]", "dates", "=", "[", "]...
https://github.com/tuckerbalch/QSTK/blob/4981506c37227a72404229d5e1e0887f797a5d57/Bin/csv2fund.py#L248-L313
ufal/neuralmonkey
8b1465270f6bb28d5417a85cec492f7179036ede
neuralmonkey/decoders/output_projection.py
python
mlp_output
(layer_sizes: List[int], activation: Callable[[tf.Tensor], tf.Tensor] = tf.tanh, dropout_keep_prob: float = 1.0)
return _projection, layer_sizes[-1]
Apply a multilayer perceptron. Compute RNN deep output using the multilayer perceptron with a specified activation function. (Pascanu et al., 2013 [https://arxiv.org/pdf/1312.6026v5.pdf]) Arguments: layer_sizes: A list of sizes of the hiddel layers of the MLP dropout_keep_prob: the dro...
Apply a multilayer perceptron.
[ "Apply", "a", "multilayer", "perceptron", "." ]
def mlp_output(layer_sizes: List[int], activation: Callable[[tf.Tensor], tf.Tensor] = tf.tanh, dropout_keep_prob: float = 1.0) -> Tuple[OutputProjection, int]: """Apply a multilayer perceptron. Compute RNN deep output using the multilayer perceptron with a specified activation...
[ "def", "mlp_output", "(", "layer_sizes", ":", "List", "[", "int", "]", ",", "activation", ":", "Callable", "[", "[", "tf", ".", "Tensor", "]", ",", "tf", ".", "Tensor", "]", "=", "tf", ".", "tanh", ",", "dropout_keep_prob", ":", "float", "=", "1.0", ...
https://github.com/ufal/neuralmonkey/blob/8b1465270f6bb28d5417a85cec492f7179036ede/neuralmonkey/decoders/output_projection.py#L163-L188
pyca/pyopenssl
fb26edde0aa27670c7bb24c0daeb05516e83d7b0
src/OpenSSL/rand.py
python
add
(buffer, entropy)
Mix bytes from *string* into the PRNG state. The *entropy* argument is (the lower bound of) an estimate of how much randomness is contained in *string*, measured in bytes. For more information, see e.g. :rfc:`1750`. This function is only relevant if you are forking Python processes and need to re...
Mix bytes from *string* into the PRNG state.
[ "Mix", "bytes", "from", "*", "string", "*", "into", "the", "PRNG", "state", "." ]
def add(buffer, entropy): """ Mix bytes from *string* into the PRNG state. The *entropy* argument is (the lower bound of) an estimate of how much randomness is contained in *string*, measured in bytes. For more information, see e.g. :rfc:`1750`. This function is only relevant if you are forki...
[ "def", "add", "(", "buffer", ",", "entropy", ")", ":", "if", "not", "isinstance", "(", "buffer", ",", "bytes", ")", ":", "raise", "TypeError", "(", "\"buffer must be a byte string\"", ")", "if", "not", "isinstance", "(", "entropy", ",", "int", ")", ":", ...
https://github.com/pyca/pyopenssl/blob/fb26edde0aa27670c7bb24c0daeb05516e83d7b0/src/OpenSSL/rand.py#L8-L31
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_statuspageio/library/statuspage_component.py
python
StatusPageComponent.exists
(self)
verify if the incoming component exists A component is unique by its name and by its group_id.
verify if the incoming component exists
[ "verify", "if", "the", "incoming", "component", "exists" ]
def exists(self): ''' verify if the incoming component exists A component is unique by its name and by its group_id. ''' found = self.find_component() if len(found) == 1: return True if len(found) == 0: return False raise StatusPage...
[ "def", "exists", "(", "self", ")", ":", "found", "=", "self", ".", "find_component", "(", ")", "if", "len", "(", "found", ")", "==", "1", ":", "return", "True", "if", "len", "(", "found", ")", "==", "0", ":", "return", "False", "raise", "StatusPage...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_statuspageio/library/statuspage_component.py#L356-L371
moinwiki/moin
568f223231aadecbd3b21a701ec02271f8d8021d
src/moin/items/ticket.py
python
message_markup
(message)
return """{{{{{{#!wiki moin-ticket %(message)s }}}}}}""" % dict(message=message)
Add a heading with author and timestamp to message (aka ticket description).
Add a heading with author and timestamp to message (aka ticket description).
[ "Add", "a", "heading", "with", "author", "and", "timestamp", "to", "message", "(", "aka", "ticket", "description", ")", "." ]
def message_markup(message): """ Add a heading with author and timestamp to message (aka ticket description). """ timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") heading = L_('{author} wrote on {timestamp}:').format(author=flaskg.user.name[0], timestamp=timestamp) message = '{h...
[ "def", "message_markup", "(", "message", ")", ":", "timestamp", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ")", "heading", "=", "L_", "(", "'{author} wrote on {timestamp}:'", ")", ".", "format", "(", ...
https://github.com/moinwiki/moin/blob/568f223231aadecbd3b21a701ec02271f8d8021d/src/moin/items/ticket.py#L209-L218
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
lms/djangoapps/survey/apps.py
python
SurveyConfig.ready
(self)
Connect signal handlers.
Connect signal handlers.
[ "Connect", "signal", "handlers", "." ]
def ready(self): """ Connect signal handlers. """ from . import signals
[ "def", "ready", "(", "self", ")", ":", "from", ".", "import", "signals" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/survey/apps.py#L16-L20
Theano/Theano
8fd9203edfeecebced9344b0c70193be292a9ade
theano/tensor/shared_randomstreams.py
python
randomstate_constructor
(value, name=None, strict=False, allow_downcast=None, borrow=False)
return RandomStateSharedVariable( type=raw_random.random_state_type, value=value, name=name, strict=strict, allow_downcast=allow_downcast)
SharedVariable Constructor for RandomState.
SharedVariable Constructor for RandomState.
[ "SharedVariable", "Constructor", "for", "RandomState", "." ]
def randomstate_constructor(value, name=None, strict=False, allow_downcast=None, borrow=False): """ SharedVariable Constructor for RandomState. """ if not isinstance(value, np.random.RandomState): raise TypeError if not borrow: value = copy.deepcopy(value...
[ "def", "randomstate_constructor", "(", "value", ",", "name", "=", "None", ",", "strict", "=", "False", ",", "allow_downcast", "=", "None", ",", "borrow", "=", "False", ")", ":", "if", "not", "isinstance", "(", "value", ",", "np", ".", "random", ".", "R...
https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/tensor/shared_randomstreams.py#L24-L39
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_translation/tensorflow/transformer_mlperf/inference/bfloat16/transformer/model/beam_search.py
python
_gather_topk_beams
(nested, score_or_log_prob, batch_size, beam_size)
return _gather_beams(nested, topk_indexes, batch_size, beam_size)
Gather top beams from nested structure.
Gather top beams from nested structure.
[ "Gather", "top", "beams", "from", "nested", "structure", "." ]
def _gather_topk_beams(nested, score_or_log_prob, batch_size, beam_size): """Gather top beams from nested structure.""" _, topk_indexes = tf.nn.top_k(score_or_log_prob, k=beam_size) return _gather_beams(nested, topk_indexes, batch_size, beam_size)
[ "def", "_gather_topk_beams", "(", "nested", ",", "score_or_log_prob", ",", "batch_size", ",", "beam_size", ")", ":", "_", ",", "topk_indexes", "=", "tf", ".", "nn", ".", "top_k", "(", "score_or_log_prob", ",", "k", "=", "beam_size", ")", "return", "_gather_b...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_mlperf/inference/bfloat16/transformer/model/beam_search.py#L568-L571
lad1337/XDM
0c1b7009fe00f06f102a6f67c793478f515e7efe
xdm/__init__.py
python
Common.isThisVersionNewer
(self, major, minor, revision, build)
return (major, minor, revision, build) > self.getVersionTuple()
return bool weather the running version is OLDER then the one build by the params
return bool weather the running version is OLDER then the one build by the params
[ "return", "bool", "weather", "the", "running", "version", "is", "OLDER", "then", "the", "one", "build", "by", "the", "params" ]
def isThisVersionNewer(self, major, minor, revision, build): """return bool weather the running version is OLDER then the one build by the params""" return (major, minor, revision, build) > self.getVersionTuple()
[ "def", "isThisVersionNewer", "(", "self", ",", "major", ",", "minor", ",", "revision", ",", "build", ")", ":", "return", "(", "major", ",", "minor", ",", "revision", ",", "build", ")", ">", "self", ".", "getVersionTuple", "(", ")" ]
https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/xdm/__init__.py#L202-L204
jodal/pykka
f3a31db64674b600b5da6a9045332fc926cfd24d
src/pykka/_ref.py
python
ActorRef.tell
(self, message)
Send message to actor without waiting for any response. Will generally not block, but if the underlying queue is full it will block until a free slot is available. :param message: message to send :type message: any :raise: :exc:`pykka.ActorDeadError` if actor is not available ...
Send message to actor without waiting for any response.
[ "Send", "message", "to", "actor", "without", "waiting", "for", "any", "response", "." ]
def tell(self, message): """ Send message to actor without waiting for any response. Will generally not block, but if the underlying queue is full it will block until a free slot is available. :param message: message to send :type message: any :raise: :exc:`pyk...
[ "def", "tell", "(", "self", ",", "message", ")", ":", "if", "not", "self", ".", "is_alive", "(", ")", ":", "raise", "ActorDeadError", "(", "f\"{self} not found\"", ")", "self", ".", "actor_inbox", ".", "put", "(", "Envelope", "(", "message", ")", ")" ]
https://github.com/jodal/pykka/blob/f3a31db64674b600b5da6a9045332fc926cfd24d/src/pykka/_ref.py#L58-L73
pyrocko/pyrocko
b6baefb7540fb7fce6ed9b856ec0c413961a4320
src/cake.py
python
Layer.inner
(self, z)
return self.ztop <= z <= self.zbot and not \ self.at_bottom(z) and not \ self.at_top(z)
Tolerantly check if a given depth is within the layer (not including boundaries).
Tolerantly check if a given depth is within the layer (not including boundaries).
[ "Tolerantly", "check", "if", "a", "given", "depth", "is", "within", "the", "layer", "(", "not", "including", "boundaries", ")", "." ]
def inner(self, z): ''' Tolerantly check if a given depth is within the layer (not including boundaries). ''' return self.ztop <= z <= self.zbot and not \ self.at_bottom(z) and not \ self.at_top(z)
[ "def", "inner", "(", "self", ",", "z", ")", ":", "return", "self", ".", "ztop", "<=", "z", "<=", "self", ".", "zbot", "and", "not", "self", ".", "at_bottom", "(", "z", ")", "and", "not", "self", ".", "at_top", "(", "z", ")" ]
https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/cake.py#L1436-L1444
kivymd/KivyMD
1cb82f7d2437770f71be7c5a4f7de4b8da61f352
kivymd/uix/textfield/textfield.py
python
MDTextField.set_max_text_length
(self)
Called when text is entered into a text field.
Called when text is entered into a text field.
[ "Called", "when", "text", "is", "entered", "into", "a", "text", "field", "." ]
def set_max_text_length(self) -> NoReturn: """Called when text is entered into a text field.""" if self.max_text_length: self._max_length_label.text = ( f"{len(self.text)}/{self.max_text_length}" )
[ "def", "set_max_text_length", "(", "self", ")", "->", "NoReturn", ":", "if", "self", ".", "max_text_length", ":", "self", ".", "_max_length_label", ".", "text", "=", "(", "f\"{len(self.text)}/{self.max_text_length}\"", ")" ]
https://github.com/kivymd/KivyMD/blob/1cb82f7d2437770f71be7c5a4f7de4b8da61f352/kivymd/uix/textfield/textfield.py#L1183-L1189
pyqt/examples
843bb982917cecb2350b5f6d7f42c9b7fb142ec1
src/pyqt-official/graphicsview/elasticnodes.py
python
GraphWidget.keyPressEvent
(self, event)
[]
def keyPressEvent(self, event): key = event.key() if key == Qt.Key_Up: self.centerNode.moveBy(0, -20) elif key == Qt.Key_Down: self.centerNode.moveBy(0, 20) elif key == Qt.Key_Left: self.centerNode.moveBy(-20, 0) elif key == Qt.Key_Right: ...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "key", "=", "event", ".", "key", "(", ")", "if", "key", "==", "Qt", ".", "Key_Up", ":", "self", ".", "centerNode", ".", "moveBy", "(", "0", ",", "-", "20", ")", "elif", "key", "==", "...
https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/graphicsview/elasticnodes.py#L336-L356
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/base/utils.py
python
parse_delimited
(value_or_handle, delimiter, strip=False, remove_empty=False)
return processed_results
Parse a delimter separated value.
Parse a delimter separated value.
[ "Parse", "a", "delimter", "separated", "value", "." ]
def parse_delimited(value_or_handle, delimiter, strip=False, remove_empty=False): """Parse a delimter separated value.""" if hasattr(value_or_handle, 'read'): results = value_or_handle.read().split(delimiter) else: results = value_or_handle.split(delimiter) if not strip and not remo...
[ "def", "parse_delimited", "(", "value_or_handle", ",", "delimiter", ",", "strip", "=", "False", ",", "remove_empty", "=", "False", ")", ":", "if", "hasattr", "(", "value_or_handle", ",", "'read'", ")", ":", "results", "=", "value_or_handle", ".", "read", "("...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/base/utils.py#L887-L908
imageworks/OpenColorIO-Configs
0bb079c08be410030669cbf5f19ff869b88af953
aces_1.0.3/python/aces_ocio/colorspaces/aces.py
python
create_ODTs
(aces_ctl_directory, lut_directory, lut_resolution_1d, lut_resolution_3d, odt_info, shaper_name, cleanup, linear_display_space, log_display_space)
return colorspaces, displays
Create ColorSpaces representing the *ACES Output Transforms*. Parameters ---------- aces_ctl_directory : str or unicode The path to *ACES* *CTL* *transforms/ctl/utilities* directory. lut_directory : str or unicode The directory to use when generating LUTs. lut_resolution_1d : int ...
Create ColorSpaces representing the *ACES Output Transforms*.
[ "Create", "ColorSpaces", "representing", "the", "*", "ACES", "Output", "Transforms", "*", "." ]
def create_ODTs(aces_ctl_directory, lut_directory, lut_resolution_1d, lut_resolution_3d, odt_info, shaper_name, cleanup, linear_display_space, log_display_space): """ Create ColorSpace...
[ "def", "create_ODTs", "(", "aces_ctl_directory", ",", "lut_directory", ",", "lut_resolution_1d", ",", "lut_resolution_3d", ",", "odt_info", ",", "shaper_name", ",", "cleanup", ",", "linear_display_space", ",", "log_display_space", ")", ":", "colorspaces", "=", "[", ...
https://github.com/imageworks/OpenColorIO-Configs/blob/0bb079c08be410030669cbf5f19ff869b88af953/aces_1.0.3/python/aces_ocio/colorspaces/aces.py#L1675-L1783
mesalock-linux/mesapy
ed546d59a21b36feb93e2309d5c6b75aa0ad95c9
lib-python/2.7/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py
python
Mozilla_suite_Events.Open_Address_Book
(self, _no_object=None, _attributes={}, **_arguments)
Open Address Book: Opens the address book Keyword argument _attributes: AppleEvent attribute dictionary
Open Address Book: Opens the address book Keyword argument _attributes: AppleEvent attribute dictionary
[ "Open", "Address", "Book", ":", "Opens", "the", "address", "book", "Keyword", "argument", "_attributes", ":", "AppleEvent", "attribute", "dictionary" ]
def Open_Address_Book(self, _no_object=None, _attributes={}, **_arguments): """Open Address Book: Opens the address book Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'MOSS' _subcode = 'addr' if _arguments: raise TypeError, 'No optional args e...
[ "def", "Open_Address_Book", "(", "self", ",", "_no_object", "=", "None", ",", "_attributes", "=", "{", "}", ",", "*", "*", "_arguments", ")", ":", "_code", "=", "'MOSS'", "_subcode", "=", "'addr'", "if", "_arguments", ":", "raise", "TypeError", ",", "'No...
https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py#L121-L138
karanchahal/distiller
a17ec06cbeafcdd2aea19d7c7663033c951392f5
models/vision/squeezenet.py
python
squeezenet1_0
(pretrained=False, progress=True, **kwargs)
return _squeezenet('1_0', pretrained, progress, **kwargs)
r"""SqueezeNet model architecture from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progres...
r"""SqueezeNet model architecture from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper.
[ "r", "SqueezeNet", "model", "architecture", "from", "the", "SqueezeNet", ":", "AlexNet", "-", "level", "accuracy", "with", "50x", "fewer", "parameters", "and", "<0", ".", "5MB", "model", "size", "<https", ":", "//", "arxiv", ".", "org", "/", "abs", "/", ...
def squeezenet1_0(pretrained=False, progress=True, **kwargs): r"""SqueezeNet model architecture from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" <https://arxiv.org/abs/1602.07360>`_ paper. Args: pretrained (bool): If True, returns a model pre-traine...
[ "def", "squeezenet1_0", "(", "pretrained", "=", "False", ",", "progress", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "_squeezenet", "(", "'1_0'", ",", "pretrained", ",", "progress", ",", "*", "*", "kwargs", ")" ]
https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/vision/squeezenet.py#L115-L124
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/logging/config.py
python
DictConfigurator.add_handlers
(self, logger, handlers)
Add handlers to a logger from a list of names.
Add handlers to a logger from a list of names.
[ "Add", "handlers", "to", "a", "logger", "from", "a", "list", "of", "names", "." ]
def add_handlers(self, logger, handlers): """Add handlers to a logger from a list of names.""" for h in handlers: try: logger.addHandler(self.config['handlers'][h]) except Exception as e: raise ValueError('Unable to add handler %r' % h) from e
[ "def", "add_handlers", "(", "self", ",", "logger", ",", "handlers", ")", ":", "for", "h", "in", "handlers", ":", "try", ":", "logger", ".", "addHandler", "(", "self", ".", "config", "[", "'handlers'", "]", "[", "h", "]", ")", "except", "Exception", "...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/logging/config.py#L767-L773
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/ipaddr/__init__.py
python
_BaseV6.is_unspecified
(self)
return self._ip == 0 and getattr(self, '_prefixlen', 128) == 128
Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2.
Test if the address is unspecified.
[ "Test", "if", "the", "address", "is", "unspecified", "." ]
def is_unspecified(self): """Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. """ return self._ip == 0 and getattr(self, '_prefixlen', 128) == 128
[ "def", "is_unspecified", "(", "self", ")", ":", "return", "self", ".", "_ip", "==", "0", "and", "getattr", "(", "self", ",", "'_prefixlen'", ",", "128", ")", "==", "128" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/ipaddr/__init__.py#L1634-L1642
fake-name/ReadableWebProxy
ed5c7abe38706acc2684a1e6cd80242a03c5f010
WebMirror/management/rss_parser_funcs/feed_parse_extractKinokuraWordpressCom.py
python
extractKinokuraWordpressCom
(item)
return False
Parser for 'kinokura.wordpress.com'
Parser for 'kinokura.wordpress.com'
[ "Parser", "for", "kinokura", ".", "wordpress", ".", "com" ]
def extractKinokuraWordpressCom(item): ''' Parser for 'kinokura.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('masho no otoko wo mezashimasu', 'masho no otoko wo m...
[ "def", "extractKinokuraWordpressCom", "(", "item", ")", ":", "vol", ",", "chp", ",", "frag", ",", "postfix", "=", "extractVolChapterFragmentPostfix", "(", "item", "[", "'title'", "]", ")", "if", "not", "(", "chp", "or", "vol", ")", "or", "\"preview\"", "in...
https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractKinokuraWordpressCom.py#L1-L24
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/scapy/contrib/ospf.py
python
ospf_lsa_checksum
(lsa)
return chr(x) + chr(y)
Fletcher checksum for OSPF LSAs, returned as a 2 byte string. Give the whole LSA packet as argument. For details on the algorithm, see RFC 2328 chapter 12.1.7 and RFC 905 Annex B.
Fletcher checksum for OSPF LSAs, returned as a 2 byte string.
[ "Fletcher", "checksum", "for", "OSPF", "LSAs", "returned", "as", "a", "2", "byte", "string", "." ]
def ospf_lsa_checksum(lsa): """ Fletcher checksum for OSPF LSAs, returned as a 2 byte string. Give the whole LSA packet as argument. For details on the algorithm, see RFC 2328 chapter 12.1.7 and RFC 905 Annex B. """ # This is based on the GPLed C implementation in Zebra <http://www.zebra.org/> ...
[ "def", "ospf_lsa_checksum", "(", "lsa", ")", ":", "# This is based on the GPLed C implementation in Zebra <http://www.zebra.org/>", "CHKSUM_OFFSET", "=", "16", "if", "len", "(", "lsa", ")", "<", "CHKSUM_OFFSET", ":", "raise", "Exception", "(", "\"LSA Packet too short (%s by...
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/contrib/ospf.py#L208-L242
joblib/joblib
7742f5882273889f7aaf1d483a8a1c72a97d57e3
joblib/compressor.py
python
LZMACompressorWrapper.decompressor_file
(self, fileobj)
return lzma.LZMAFile(fileobj, 'rb')
Returns an instance of a decompressor file object.
Returns an instance of a decompressor file object.
[ "Returns", "an", "instance", "of", "a", "decompressor", "file", "object", "." ]
def decompressor_file(self, fileobj): """Returns an instance of a decompressor file object.""" return lzma.LZMAFile(fileobj, 'rb')
[ "def", "decompressor_file", "(", "self", ",", "fileobj", ")", ":", "return", "lzma", ".", "LZMAFile", "(", "fileobj", ",", "'rb'", ")" ]
https://github.com/joblib/joblib/blob/7742f5882273889f7aaf1d483a8a1c72a97d57e3/joblib/compressor.py#L175-L177
aws/sagemaker-python-sdk
9d259b316f7f43838c16f35c10e98a110b56735b
src/sagemaker/session.py
python
Session.logs_for_job
( # noqa: C901 - suppress complexity warning for this method self, job_name, wait=False, poll=10, log_type="All" )
Display logs for a given training job, optionally tailing them until job is complete. If the output is a tty or a Jupyter cell, it will be color-coded based on which instance the log entry is from. Args: job_name (str): Name of the training job to display the logs for. ...
Display logs for a given training job, optionally tailing them until job is complete.
[ "Display", "logs", "for", "a", "given", "training", "job", "optionally", "tailing", "them", "until", "job", "is", "complete", "." ]
def logs_for_job( # noqa: C901 - suppress complexity warning for this method self, job_name, wait=False, poll=10, log_type="All" ): """Display logs for a given training job, optionally tailing them until job is complete. If the output is a tty or a Jupyter cell, it will be color-coded ...
[ "def", "logs_for_job", "(", "# noqa: C901 - suppress complexity warning for this method", "self", ",", "job_name", ",", "wait", "=", "False", ",", "poll", "=", "10", ",", "log_type", "=", "\"All\"", ")", ":", "description", "=", "self", ".", "sagemaker_client", "....
https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/session.py#L3668-L3798
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/delicious/BeautifulSoup.py
python
BeautifulStoneSoup._toStringSubclass
(self, text, subclass)
Adds a certain piece of text to the tree as a NavigableString subclass.
Adds a certain piece of text to the tree as a NavigableString subclass.
[ "Adds", "a", "certain", "piece", "of", "text", "to", "the", "tree", "as", "a", "NavigableString", "subclass", "." ]
def _toStringSubclass(self, text, subclass): """Adds a certain piece of text to the tree as a NavigableString subclass.""" self.endData() self.handle_data(text) self.endData(subclass)
[ "def", "_toStringSubclass", "(", "self", ",", "text", ",", "subclass", ")", ":", "self", ".", "endData", "(", ")", "self", ".", "handle_data", "(", "text", ")", "self", ".", "endData", "(", "subclass", ")" ]
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/delicious/BeautifulSoup.py#L1376-L1381
balanced/status.balancedpayments.com
e51a371079a8fa215732be3cfa57497a9d113d35
venv/lib/python2.7/site-packages/twilio/twiml.py
python
Response.enqueue
(self, name, **kwargs)
return self.append(Enqueue(name, **kwargs))
Return a newly created :class:`Enqueue` verb, nested inside this :class:`Response`
Return a newly created :class:`Enqueue` verb, nested inside this :class:`Response`
[ "Return", "a", "newly", "created", ":", "class", ":", "Enqueue", "verb", "nested", "inside", "this", ":", "class", ":", "Response" ]
def enqueue(self, name, **kwargs): """Return a newly created :class:`Enqueue` verb, nested inside this :class:`Response` """ return self.append(Enqueue(name, **kwargs))
[ "def", "enqueue", "(", "self", ",", "name", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "append", "(", "Enqueue", "(", "name", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/balanced/status.balancedpayments.com/blob/e51a371079a8fa215732be3cfa57497a9d113d35/venv/lib/python2.7/site-packages/twilio/twiml.py#L152-L155
StanfordVL/taskonomy
9f814867b5fe4165860862211e8e99b0f200144d
taskbank/lib/models/encoder_decoder_segmentation.py
python
SegmentationED.build_train_op
( self, global_step )
return self.train_op
Builds train ops for discriminative task Args: global_step: A Tensor to be incremented Returns: [ loss_op, accuracy ]
Builds train ops for discriminative task Args: global_step: A Tensor to be incremented Returns: [ loss_op, accuracy ]
[ "Builds", "train", "ops", "for", "discriminative", "task", "Args", ":", "global_step", ":", "A", "Tensor", "to", "be", "incremented", "Returns", ":", "[", "loss_op", "accuracy", "]" ]
def build_train_op( self, global_step ): ''' Builds train ops for discriminative task Args: global_step: A Tensor to be incremented Returns: [ loss_op, accuracy ] ''' if not self.model_built or self.total_loss is No...
[ "def", "build_train_op", "(", "self", ",", "global_step", ")", ":", "if", "not", "self", ".", "model_built", "or", "self", ".", "total_loss", "is", "None", ":", "raise", "RuntimeError", "(", "\"Cannot build optimizers until 'build_model' ({0}) and 'get_losses' {1} are r...
https://github.com/StanfordVL/taskonomy/blob/9f814867b5fe4165860862211e8e99b0f200144d/taskbank/lib/models/encoder_decoder_segmentation.py#L151-L182
quantmind/pulsar
fee44e871954aa6ca36d00bb5a3739abfdb89b26
pulsar/apps/data/store.py
python
PubSub.publish_event
(self, channel, event, message)
return self.publish(channel, msg)
Publish a new event ``message`` to a ``channel``.
Publish a new event ``message`` to a ``channel``.
[ "Publish", "a", "new", "event", "message", "to", "a", "channel", "." ]
def publish_event(self, channel, event, message): '''Publish a new event ``message`` to a ``channel``. ''' assert self.protocol is not None, "Protocol required" msg = {'event': event, 'channel': channel} if message: msg['data'] = message return self.publish(ch...
[ "def", "publish_event", "(", "self", ",", "channel", ",", "event", ",", "message", ")", ":", "assert", "self", ".", "protocol", "is", "not", "None", ",", "\"Protocol required\"", "msg", "=", "{", "'event'", ":", "event", ",", "'channel'", ":", "channel", ...
https://github.com/quantmind/pulsar/blob/fee44e871954aa6ca36d00bb5a3739abfdb89b26/pulsar/apps/data/store.py#L303-L310
PIA-Group/BioSPPy
b391119e656bb5d3f6ddbd345493256867e46571
biosppy/signals/tools.py
python
normalize
(signal=None, ddof=1)
return utils.ReturnTuple((normalized,), ("signal",))
Normalize a signal to zero mean and unitary standard deviation. Parameters ---------- signal : array Input signal. ddof : int, optional Delta degrees of freedom for standard deviation computation; the divisor is `N - ddof`, where `N` is the number of elements; default is...
Normalize a signal to zero mean and unitary standard deviation.
[ "Normalize", "a", "signal", "to", "zero", "mean", "and", "unitary", "standard", "deviation", "." ]
def normalize(signal=None, ddof=1): """Normalize a signal to zero mean and unitary standard deviation. Parameters ---------- signal : array Input signal. ddof : int, optional Delta degrees of freedom for standard deviation computation; the divisor is `N - ddof`, where `N` is...
[ "def", "normalize", "(", "signal", "=", "None", ",", "ddof", "=", "1", ")", ":", "# check inputs", "if", "signal", "is", "None", ":", "raise", "TypeError", "(", "\"Please specify an input signal.\"", ")", "# ensure numpy", "signal", "=", "np", ".", "array", ...
https://github.com/PIA-Group/BioSPPy/blob/b391119e656bb5d3f6ddbd345493256867e46571/biosppy/signals/tools.py#L1017-L1046
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/lib2to3/pgen2/grammar.py
python
Grammar.report
(self)
Dump the grammar tables to standard output, for debugging.
Dump the grammar tables to standard output, for debugging.
[ "Dump", "the", "grammar", "tables", "to", "standard", "output", "for", "debugging", "." ]
def report(self): """Dump the grammar tables to standard output, for debugging.""" from pprint import pprint print 's2n' pprint(self.symbol2number) print 'n2s' pprint(self.number2symbol) print 'states' pprint(self.states) print 'dfas' pprin...
[ "def", "report", "(", "self", ")", ":", "from", "pprint", "import", "pprint", "print", "'s2n'", "pprint", "(", "self", ".", "symbol2number", ")", "print", "'n2s'", "pprint", "(", "self", ".", "number2symbol", ")", "print", "'states'", "pprint", "(", "self"...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/lib2to3/pgen2/grammar.py#L112-L125
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/ssl.py
python
SSLContext.wrap_socket
(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None)
return SSLSocket(sock=sock, server_side=server_side, do_handshake_on_connect=do_handshake_on_connect, suppress_ragged_eofs=suppress_ragged_eofs, server_hostname=server_hostname, _context=self)
[]
def wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None): return SSLSocket(sock=sock, server_side=server_side, do_handshake_on_connect=do_handshake_on_connect...
[ "def", "wrap_socket", "(", "self", ",", "sock", ",", "server_side", "=", "False", ",", "do_handshake_on_connect", "=", "True", ",", "suppress_ragged_eofs", "=", "True", ",", "server_hostname", "=", "None", ")", ":", "return", "SSLSocket", "(", "sock", "=", "...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/ssl.py#L342-L350
python-openxml/python-docx
36cac78de080d412e9e50d56c2784e33655cad59
docx/opc/phys_pkg.py
python
_DirPkgReader.content_types_xml
(self)
return self.blob_for(CONTENT_TYPES_URI)
Return the `[Content_Types].xml` blob from the package.
Return the `[Content_Types].xml` blob from the package.
[ "Return", "the", "[", "Content_Types", "]", ".", "xml", "blob", "from", "the", "package", "." ]
def content_types_xml(self): """ Return the `[Content_Types].xml` blob from the package. """ return self.blob_for(CONTENT_TYPES_URI)
[ "def", "content_types_xml", "(", "self", ")", ":", "return", "self", ".", "blob_for", "(", "CONTENT_TYPES_URI", ")" ]
https://github.com/python-openxml/python-docx/blob/36cac78de080d412e9e50d56c2784e33655cad59/docx/opc/phys_pkg.py#L77-L81
guildai/guildai
1665985a3d4d788efc1a3180ca51cc417f71ca78
guild/external/pip/_vendor/urllib3/response.py
python
HTTPResponse.from_httplib
(ResponseCls, r, **response_kw)
return resp
Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``.
Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object.
[ "Given", "an", ":", "class", ":", "httplib", ".", "HTTPResponse", "instance", "r", "return", "a", "corresponding", ":", "class", ":", "urllib3", ".", "response", ".", "HTTPResponse", "object", "." ]
def from_httplib(ResponseCls, r, **response_kw): """ Given an :class:`httplib.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``. ...
[ "def", "from_httplib", "(", "ResponseCls", ",", "r", ",", "*", "*", "response_kw", ")", ":", "headers", "=", "r", ".", "msg", "if", "not", "isinstance", "(", "headers", ",", "HTTPHeaderDict", ")", ":", "if", "PY3", ":", "# Python 3", "headers", "=", "H...
https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/urllib3/response.py#L471-L497
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
openmetrics/datadog_checks/openmetrics/config_models/defaults.py
python
instance_enable_health_service_check
(field, value)
return True
[]
def instance_enable_health_service_check(field, value): return True
[ "def", "instance_enable_health_service_check", "(", "field", ",", "value", ")", ":", "return", "True" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/openmetrics/datadog_checks/openmetrics/config_models/defaults.py#L89-L90
sassoftware/python-dlpy
6082b1eeaab7406cce22715a35a1f4308943d522
dlpy/utils.py
python
multiply_elements
(parameter_counts)
return result
Compute the product of an iterable array with None as its element Parameters ---------- array : iterable-of-numeric The numbers to use as input Returns ------- number Product of all the elements of the array
Compute the product of an iterable array with None as its element
[ "Compute", "the", "product", "of", "an", "iterable", "array", "with", "None", "as", "its", "element" ]
def multiply_elements(parameter_counts): ''' Compute the product of an iterable array with None as its element Parameters ---------- array : iterable-of-numeric The numbers to use as input Returns ------- number Product of all the elements of the array ''' res...
[ "def", "multiply_elements", "(", "parameter_counts", ")", ":", "result", "=", "1", "for", "i", "in", "parameter_counts", ":", "if", "i", "is", "not", "None", ":", "result", "*=", "i", "return", "result" ]
https://github.com/sassoftware/python-dlpy/blob/6082b1eeaab7406cce22715a35a1f4308943d522/dlpy/utils.py#L96-L116
pycom/pycom-libraries
75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7
examples/OTA-lorawan/firmware/1.17.0/flash/diff_match_patch.py
python
diff_match_patch.diff_cleanupSemanticLossless
(self, diffs)
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came. Args: diffs: Array of diff tuples.
Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
[ "Look", "for", "single", "edits", "surrounded", "on", "both", "sides", "by", "equalities", "which", "can", "be", "shifted", "sideways", "to", "align", "the", "edit", "to", "a", "word", "boundary", ".", "e", ".", "g", ":", "The", "c<ins", ">", "at", "c<...
def diff_cleanupSemanticLossless(self, diffs): """Look for single edits surrounded on both sides by equalities which can be shifted sideways to align the edit to a word boundary. e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came. Args: diffs: Array of diff tuples. """ def diff_cle...
[ "def", "diff_cleanupSemanticLossless", "(", "self", ",", "diffs", ")", ":", "def", "diff_cleanupSemanticScore", "(", "one", ",", "two", ")", ":", "\"\"\"Given two strings, compute a score representing whether the\n internal boundary falls on logical boundaries.\n Scores ran...
https://github.com/pycom/pycom-libraries/blob/75d0e67cb421e0576a3a9677bb0d9d81f27ebdb7/examples/OTA-lorawan/firmware/1.17.0/flash/diff_match_patch.py#L750-L859
nilmtk/nilmtk
d183c8bde7a5d3465ba72b38b7964d57d84f53c2
nilmtk/disaggregate/fhmm_exact.py
python
compute_means_fhmm
(list_means)
return [means, cov]
Returns ------- [mu, cov]
Returns ------- [mu, cov]
[ "Returns", "-------", "[", "mu", "cov", "]" ]
def compute_means_fhmm(list_means): """ Returns ------- [mu, cov] """ states_combination = list(itertools.product(*list_means)) num_combinations = len(states_combination) means_stacked = np.array([sum(x) for x in states_combination]) means = np.reshape(means_stacked, (num_combination...
[ "def", "compute_means_fhmm", "(", "list_means", ")", ":", "states_combination", "=", "list", "(", "itertools", ".", "product", "(", "*", "list_means", ")", ")", "num_combinations", "=", "len", "(", "states_combination", ")", "means_stacked", "=", "np", ".", "a...
https://github.com/nilmtk/nilmtk/blob/d183c8bde7a5d3465ba72b38b7964d57d84f53c2/nilmtk/disaggregate/fhmm_exact.py#L81-L92
s-leger/archipack
5a6243bf1edf08a6b429661ce291dacb551e5f8a
pygeos/op_overlay.py
python
GeometrySnapper.__init__
(self, geom)
* Creates a new snapper acting on the given geometry * * @param g the geometry to snap
* Creates a new snapper acting on the given geometry * *
[ "*", "Creates", "a", "new", "snapper", "acting", "on", "the", "given", "geometry", "*", "*" ]
def __init__(self, geom): """ * Creates a new snapper acting on the given geometry * * @param g the geometry to snap """ self.geom = geom
[ "def", "__init__", "(", "self", ",", "geom", ")", ":", "self", ".", "geom", "=", "geom" ]
https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/op_overlay.py#L340-L346
jina-ai/jina
c77a492fcd5adba0fc3de5347bea83dd4e7d8087
jina/hubble/helper.py
python
unpack_package
(filepath: 'Path', target_dir: 'Path')
Unpack the file to the target_dir. :param filepath: the path of given file :param target_dir: the path of target folder
Unpack the file to the target_dir.
[ "Unpack", "the", "file", "to", "the", "target_dir", "." ]
def unpack_package(filepath: 'Path', target_dir: 'Path'): """Unpack the file to the target_dir. :param filepath: the path of given file :param target_dir: the path of target folder """ if filepath.suffix == '.zip': with zipfile.ZipFile(filepath, 'r') as zip: zip.extractall(targe...
[ "def", "unpack_package", "(", "filepath", ":", "'Path'", ",", "target_dir", ":", "'Path'", ")", ":", "if", "filepath", ".", "suffix", "==", "'.zip'", ":", "with", "zipfile", ".", "ZipFile", "(", "filepath", ",", "'r'", ")", "as", "zip", ":", "zip", "."...
https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/hubble/helper.py#L100-L113
graphbrain/graphbrain
96cb902d9e22d8dc8c2110ff3176b9aafdeba444
graphbrain/patterns.py
python
PatternCounter._list2patterns
(self, ledge, depth=1, force_expansion=False, force_root=False, force_subtypes=False)
return patterns
[]
def _list2patterns(self, ledge, depth=1, force_expansion=False, force_root=False, force_subtypes=False): if depth > self.depth: return [] first = ledge[0] f_force_subtypes = force_subtypes | self._force_subtypes(first) f_force_root, f_force_expansion...
[ "def", "_list2patterns", "(", "self", ",", "ledge", ",", "depth", "=", "1", ",", "force_expansion", "=", "False", ",", "force_root", "=", "False", ",", "force_subtypes", "=", "False", ")", ":", "if", "depth", ">", "self", ".", "depth", ":", "return", "...
https://github.com/graphbrain/graphbrain/blob/96cb902d9e22d8dc8c2110ff3176b9aafdeba444/graphbrain/patterns.py#L73-L106
hzlzh/AlfredWorkflow.com
7055f14f6922c80ea5943839eb0caff11ae57255
Sources/Workflows/jc-weather/requests/utils.py
python
to_key_val_list
(value)
return list(value)
Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to_key_val_list('string') Val...
Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g.,
[ "Take", "an", "object", "and", "test", "to", "see", "if", "it", "can", "be", "represented", "as", "a", "dictionary", ".", "If", "it", "can", "be", "return", "a", "list", "of", "tuples", "e", ".", "g", "." ]
def to_key_val_list(value): """Take an object and test to see if it can be represented as a dictionary. If it can be, return a list of tuples, e.g., :: >>> to_key_val_list([('key', 'val')]) [('key', 'val')] >>> to_key_val_list({'key': 'val'}) [('key', 'val')] >>> to...
[ "def", "to_key_val_list", "(", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "if", "isinstance", "(", "value", ",", "(", "str", ",", "bytes", ",", "bool", ",", "int", ")", ")", ":", "raise", "ValueError", "(", "'cannot encode o...
https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/jc-weather/requests/utils.py#L117-L139
fabioz/mu-repo
a452d44c66c51224cceab502c949448ba26b444d
mu_repo/umsgpack_s_conn.py
python
get_free_port
()
return port
Helper to get free port (usually not needed as the server can receive '0' to connect to a new port).
Helper to get free port (usually not needed as the server can receive '0' to connect to a new port).
[ "Helper", "to", "get", "free", "port", "(", "usually", "not", "needed", "as", "the", "server", "can", "receive", "0", "to", "connect", "to", "a", "new", "port", ")", "." ]
def get_free_port(): ''' Helper to get free port (usually not needed as the server can receive '0' to connect to a new port). ''' s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('127.0.0.1', 0)) _, port = s.getsockname() s.close() return port
[ "def", "get_free_port", "(", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "s", ".", "bind", "(", "(", "'127.0.0.1'", ",", "0", ")", ")", "_", ",", "port", "=", "s", ".", "gets...
https://github.com/fabioz/mu-repo/blob/a452d44c66c51224cceab502c949448ba26b444d/mu_repo/umsgpack_s_conn.py#L69-L78
miracle2k/python-glob2
ef4b58f0d2a6eb0197446ab4b047cc45e4c60500
glob2/fnmatch.py
python
filter
(names, pat, norm_paths=True, case_sensitive=True, sep=None)
return result
Return the subset of the list NAMES that match PAT.
Return the subset of the list NAMES that match PAT.
[ "Return", "the", "subset", "of", "the", "list", "NAMES", "that", "match", "PAT", "." ]
def filter(names, pat, norm_paths=True, case_sensitive=True, sep=None): """Return the subset of the list NAMES that match PAT.""" result = [] pat = _norm_paths(pat, norm_paths, sep) match = _compile_pattern(pat, case_sensitive) for name in names: m = match(_norm_paths(name, norm_paths, sep))...
[ "def", "filter", "(", "names", ",", "pat", ",", "norm_paths", "=", "True", ",", "case_sensitive", "=", "True", ",", "sep", "=", "None", ")", ":", "result", "=", "[", "]", "pat", "=", "_norm_paths", "(", "pat", ",", "norm_paths", ",", "sep", ")", "m...
https://github.com/miracle2k/python-glob2/blob/ef4b58f0d2a6eb0197446ab4b047cc45e4c60500/glob2/fnmatch.py#L83-L93
zulip/python-zulip-api
70b86614bd15347e28ec2cab4c87c01122faae16
zulip/zulip/__init__.py
python
Client.render_message
(self, request: Optional[Dict[str, Any]] = None)
return self.call_endpoint( url="messages/render", method="POST", request=request, )
Example usage: >>> client.render_message(request=dict(content='foo **bar**')) {u'msg': u'', u'rendered': u'<p>foo <strong>bar</strong></p>', u'result': u'success'}
Example usage:
[ "Example", "usage", ":" ]
def render_message(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: """ Example usage: >>> client.render_message(request=dict(content='foo **bar**')) {u'msg': u'', u'rendered': u'<p>foo <strong>bar</strong></p>', u'result': u'success'} """ return self.c...
[ "def", "render_message", "(", "self", ",", "request", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "self", ".", "call_endpoint", "(", "url", "=", "\"mess...
https://github.com/zulip/python-zulip-api/blob/70b86614bd15347e28ec2cab4c87c01122faae16/zulip/zulip/__init__.py#L1566-L1577
firedm/FireDM
d27d3d27c869625f75520ca2bacfa9ebd11caf2f
firedm/controller.py
python
set_option
(**kwargs)
set global setting option(s) in config.py
set global setting option(s) in config.py
[ "set", "global", "setting", "option", "(", "s", ")", "in", "config", ".", "py" ]
def set_option(**kwargs): """set global setting option(s) in config.py""" try: config.__dict__.update(kwargs) # log('Settings:', kwargs) except: pass
[ "def", "set_option", "(", "*", "*", "kwargs", ")", ":", "try", ":", "config", ".", "__dict__", ".", "update", "(", "kwargs", ")", "# log('Settings:', kwargs)", "except", ":", "pass" ]
https://github.com/firedm/FireDM/blob/d27d3d27c869625f75520ca2bacfa9ebd11caf2f/firedm/controller.py#L42-L48
feisuzhu/thbattle
ac0dee1b2d86de7664289cf432b157ef25427ba1
src/pyglet/gl/gl_info.py
python
GLInfo.have_version
(self, major, minor=0, release=0)
return imajor > major or \ (imajor == major and iminor > minor) or \ (imajor == major and iminor == minor and irelease >= release)
Determine if a version of OpenGL is supported. :Parameters: `major` : int The major revision number (typically 1 or 2). `minor` : int The minor revision number. `release` : int The release number. :rtype: bool ...
Determine if a version of OpenGL is supported.
[ "Determine", "if", "a", "version", "of", "OpenGL", "is", "supported", "." ]
def have_version(self, major, minor=0, release=0): '''Determine if a version of OpenGL is supported. :Parameters: `major` : int The major revision number (typically 1 or 2). `minor` : int The minor revision number. `release` : int ...
[ "def", "have_version", "(", "self", ",", "major", ",", "minor", "=", "0", ",", "release", "=", "0", ")", ":", "if", "not", "self", ".", "have_context", ":", "warnings", ".", "warn", "(", "'No GL context created yet.'", ")", "ver", "=", "'%s.0.0'", "%", ...
https://github.com/feisuzhu/thbattle/blob/ac0dee1b2d86de7664289cf432b157ef25427ba1/src/pyglet/gl/gl_info.py#L148-L169
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/skew_tableau.py
python
SkewTableau.cells_containing
(self, i)
return cell_list
r""" Return the list of cells in which the letter ``i`` appears in the tableau ``self``. The list is ordered with cells appearing from left to right. Cells are given as pairs of coordinates `(a, b)`, where both rows and columns are counted from `0` (so `a = 0` means the cell ...
r""" Return the list of cells in which the letter ``i`` appears in the tableau ``self``. The list is ordered with cells appearing from left to right.
[ "r", "Return", "the", "list", "of", "cells", "in", "which", "the", "letter", "i", "appears", "in", "the", "tableau", "self", ".", "The", "list", "is", "ordered", "with", "cells", "appearing", "from", "left", "to", "right", "." ]
def cells_containing(self, i): r""" Return the list of cells in which the letter ``i`` appears in the tableau ``self``. The list is ordered with cells appearing from left to right. Cells are given as pairs of coordinates `(a, b)`, where both rows and columns are counted ...
[ "def", "cells_containing", "(", "self", ",", "i", ")", ":", "cell_list", "=", "[", "]", "for", "r", "in", "range", "(", "len", "(", "self", ")", "-", "1", ",", "-", "1", ",", "-", "1", ")", ":", "rth_row", "=", "self", "[", "r", "]", "for", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/skew_tableau.py#L1562-L1602
quodlibet/mutagen
399513b167ed00c4b7a9ef98dfe591a276efb701
mutagen/flac.py
python
FLAC.load
(self, filething)
Load file information from a filename.
Load file information from a filename.
[ "Load", "file", "information", "from", "a", "filename", "." ]
def load(self, filething): """Load file information from a filename.""" fileobj = filething.fileobj self.metadata_blocks = [] self.tags = None self.cuesheet = None self.seektable = None fileobj = StrictFileObject(fileobj) self.__check_header(fileobj, fi...
[ "def", "load", "(", "self", ",", "filething", ")", ":", "fileobj", "=", "filething", ".", "fileobj", "self", ".", "metadata_blocks", "=", "[", "]", "self", ".", "tags", "=", "None", "self", ".", "cuesheet", "=", "None", "self", ".", "seektable", "=", ...
https://github.com/quodlibet/mutagen/blob/399513b167ed00c4b7a9ef98dfe591a276efb701/mutagen/flac.py#L783-L809
oleg-yaroshevskiy/quest_qa_labeling
730a9632314e54584f69f909d5e2ef74d843e02c
packages/fairseq-hacked/fairseq/file_utils.py
python
url_to_filename
(url, etag=None)
return filename
Convert `url` into a hashed filename in a repeatable way. If `etag` is specified, append its hash to the URL's, delimited by a period.
Convert `url` into a hashed filename in a repeatable way. If `etag` is specified, append its hash to the URL's, delimited by a period.
[ "Convert", "url", "into", "a", "hashed", "filename", "in", "a", "repeatable", "way", ".", "If", "etag", "is", "specified", "append", "its", "hash", "to", "the", "URL", "s", "delimited", "by", "a", "period", "." ]
def url_to_filename(url, etag=None): """ Convert `url` into a hashed filename in a repeatable way. If `etag` is specified, append its hash to the URL's, delimited by a period. """ url_bytes = url.encode("utf-8") url_hash = sha256(url_bytes) filename = url_hash.hexdigest() if etag: ...
[ "def", "url_to_filename", "(", "url", ",", "etag", "=", "None", ")", ":", "url_bytes", "=", "url", ".", "encode", "(", "\"utf-8\"", ")", "url_hash", "=", "sha256", "(", "url_bytes", ")", "filename", "=", "url_hash", ".", "hexdigest", "(", ")", "if", "e...
https://github.com/oleg-yaroshevskiy/quest_qa_labeling/blob/730a9632314e54584f69f909d5e2ef74d843e02c/packages/fairseq-hacked/fairseq/file_utils.py#L95-L110
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/asyncio/unix_events.py
python
_UnixReadPipeTransport._read_ready
(self)
[]
def _read_ready(self): try: data = os.read(self._fileno, self.max_size) except (BlockingIOError, InterruptedError): pass except OSError as exc: self._fatal_error(exc, 'Fatal read error on pipe transport') else: if data: self...
[ "def", "_read_ready", "(", "self", ")", ":", "try", ":", "data", "=", "os", ".", "read", "(", "self", ".", "_fileno", ",", "self", ".", "max_size", ")", "except", "(", "BlockingIOError", ",", "InterruptedError", ")", ":", "pass", "except", "OSError", "...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/asyncio/unix_events.py#L501-L517
savio-code/fern-wifi-cracker
0da03aba988c66dfa131a45824568abb84b7704a
Fern-Wifi-Cracker/core/wep.py
python
wep_attack_dialog.arp_request_thread
(self)
[]
def arp_request_thread(self): access_point_mac = variables.victim_mac monitor = variables.monitor_interface variables.exec_command("%s aireplay-ng -3 -e '%s' -b %s %s"%(variables.xterm_setting,victim_access_point,access_point_mac,monitor),"/tmp/fern-log/WEP-DUMP/")
[ "def", "arp_request_thread", "(", "self", ")", ":", "access_point_mac", "=", "variables", ".", "victim_mac", "monitor", "=", "variables", ".", "monitor_interface", "variables", ".", "exec_command", "(", "\"%s aireplay-ng -3 -e '%s' -b %s %s\"", "%", "(", "variables", ...
https://github.com/savio-code/fern-wifi-cracker/blob/0da03aba988c66dfa131a45824568abb84b7704a/Fern-Wifi-Cracker/core/wep.py#L636-L639
HCIILAB/DeRPN
21e6738ee1f7d3f159ee48d435c543e773f8ce99
lib/rpn/derpn_proposals_layer.py
python
DeRPNProposalsLayer.setup
(self, bottom, top)
[]
def setup(self, bottom, top): cfg_key = str('TRAIN' if self.phase == 0 else 'TEST') # either 'TRAIN' or 'TEST' self.top_N = cfg[cfg_key].DeRPN_top_N self.final_top_M = cfg[cfg_key].DeRPN_final_top_M layer_params = yaml.load(self.param_str) self._feat_stride = layer_params['feat_stride'] self.do_NMS = Tru...
[ "def", "setup", "(", "self", ",", "bottom", ",", "top", ")", ":", "cfg_key", "=", "str", "(", "'TRAIN'", "if", "self", ".", "phase", "==", "0", "else", "'TEST'", ")", "# either 'TRAIN' or 'TEST'", "self", ".", "top_N", "=", "cfg", "[", "cfg_key", "]", ...
https://github.com/HCIILAB/DeRPN/blob/21e6738ee1f7d3f159ee48d435c543e773f8ce99/lib/rpn/derpn_proposals_layer.py#L17-L40
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/protein/commands/CompareProteins/CompareProteins_PropertyManager.py
python
CompareProteins_PropertyManager._thresholdChanged
(self, value)
return
Slot for Threshold spinbox.
Slot for Threshold spinbox.
[ "Slot", "for", "Threshold", "spinbox", "." ]
def _thresholdChanged(self, value): """ Slot for Threshold spinbox. """ self.threshold = value self._compareProteins() return
[ "def", "_thresholdChanged", "(", "self", ",", "value", ")", ":", "self", ".", "threshold", "=", "value", "self", ".", "_compareProteins", "(", ")", "return" ]
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/protein/commands/CompareProteins/CompareProteins_PropertyManager.py#L288-L294
reviewboard/reviewboard
7395902e4c181bcd1d633f61105012ffb1d18e1b
reviewboard/diffviewer/commit_utils.py
python
exclude_ancestor_filediffs
(to_filter, all_filediffs=None)
return [ filediff for filediff in to_filter if filediff.pk not in ancestor_pks ]
Exclude all ancestor FileDiffs from the given list and return the rest. A :pyclass:`~reviewboard.diffviewer.models.filediff.FileDiff` is considered an ancestor of another if it occurs in a previous commit and modifies the same file. As a result, only the most recent (commit-wise) FileDiffs that modify...
Exclude all ancestor FileDiffs from the given list and return the rest.
[ "Exclude", "all", "ancestor", "FileDiffs", "from", "the", "given", "list", "and", "return", "the", "rest", "." ]
def exclude_ancestor_filediffs(to_filter, all_filediffs=None): """Exclude all ancestor FileDiffs from the given list and return the rest. A :pyclass:`~reviewboard.diffviewer.models.filediff.FileDiff` is considered an ancestor of another if it occurs in a previous commit and modifies the same file. ...
[ "def", "exclude_ancestor_filediffs", "(", "to_filter", ",", "all_filediffs", "=", "None", ")", ":", "if", "all_filediffs", "is", "None", ":", "all_filediffs", "=", "to_filter", "ancestor_pks", "=", "{", "ancestor", ".", "pk", "for", "filediff", "in", "to_filter"...
https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/diffviewer/commit_utils.py#L78-L119
gevent/gevent
ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31
src/gevent/subprocess.py
python
Popen.communicate
(self, input=None, timeout=None)
return (None if greenlets.stdout is None else greenlets.stdout.get(), None if greenlets.stderr is None else greenlets.stderr.get())
Interact with process and return its output and error. - Send *input* data to stdin. - Read data from stdout and stderr, until end-of-file is reached. - Wait for process to terminate. The optional *input* argument should be a string to be sent to the child process, or None, if ...
Interact with process and return its output and error.
[ "Interact", "with", "process", "and", "return", "its", "output", "and", "error", "." ]
def communicate(self, input=None, timeout=None): """ Interact with process and return its output and error. - Send *input* data to stdin. - Read data from stdout and stderr, until end-of-file is reached. - Wait for process to terminate. The optional *input* argument sho...
[ "def", "communicate", "(", "self", ",", "input", "=", "None", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "_communicating_greenlets", "is", "None", ":", "self", ".", "_communicating_greenlets", "=", "_CommunicatingGreenlets", "(", "self", ",", ...
https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/subprocess.py#L963-L1026
thingsboard/thingsboard-gateway
1d1b1fc2450852dbd56ff137c6bfd49143dc758d
thingsboard_gateway/gateway/grpc_service/grpc_downlink_converter.py
python
GrpcDownlinkConverter.__init__
(self)
[]
def __init__(self): self.__conversion_methods = { DownlinkMessageType.Response: self.__convert_response_msg, DownlinkMessageType.ConnectorConfigurationMsg: self.__convert_connector_configuration_msg, DownlinkMessageType.GatewayAttributeUpdateNotificationMsg: self.__convert_ga...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "__conversion_methods", "=", "{", "DownlinkMessageType", ".", "Response", ":", "self", ".", "__convert_response_msg", ",", "DownlinkMessageType", ".", "ConnectorConfigurationMsg", ":", "self", ".", "__convert_co...
https://github.com/thingsboard/thingsboard-gateway/blob/1d1b1fc2450852dbd56ff137c6bfd49143dc758d/thingsboard_gateway/gateway/grpc_service/grpc_downlink_converter.py#L25-L33