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
fluentpython/example-code-2e
80f7f84274a47579e59c29a4657691525152c9d5
21-async/mojifinder/bottle.py
python
_hkey
(key)
return key.title().replace('_', '-')
[]
def _hkey(key): if '\n' in key or '\r' in key or '\0' in key: raise ValueError("Header names must not contain control characters: %r" % key) return key.title().replace('_', '-')
[ "def", "_hkey", "(", "key", ")", ":", "if", "'\\n'", "in", "key", "or", "'\\r'", "in", "key", "or", "'\\0'", "in", "key", ":", "raise", "ValueError", "(", "\"Header names must not contain control characters: %r\"", "%", "key", ")", "return", "key", ".", "tit...
https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/21-async/mojifinder/bottle.py#L1407-L1410
flask-admin/flask-admin
7cff9c742d44d42a8d3495c73a6d71381c796396
flask_admin/model/typefmt.py
python
bool_formatter
(view, value)
return Markup('<span class="fa %s glyphicon glyphicon-%s icon-%s"></span>' % (fa, glyph, glyph))
Return check icon if value is `True` or empty string otherwise. :param value: Value to check
Return check icon if value is `True` or empty string otherwise.
[ "Return", "check", "icon", "if", "value", "is", "True", "or", "empty", "string", "otherwise", "." ]
def bool_formatter(view, value): """ Return check icon if value is `True` or empty string otherwise. :param value: Value to check """ glyph = 'ok-circle' if value else 'minus-sign' fa = 'fa-check-circle' if value else 'fa-minus-circle' return Markup('<span class="fa %s g...
[ "def", "bool_formatter", "(", "view", ",", "value", ")", ":", "glyph", "=", "'ok-circle'", "if", "value", "else", "'minus-sign'", "fa", "=", "'fa-check-circle'", "if", "value", "else", "'fa-minus-circle'", "return", "Markup", "(", "'<span class=\"fa %s glyphicon gly...
https://github.com/flask-admin/flask-admin/blob/7cff9c742d44d42a8d3495c73a6d71381c796396/flask_admin/model/typefmt.py#L31-L40
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/skybeacon/sensor.py
python
Monitor._update
(self, handle, value)
Notification callback from pygatt.
Notification callback from pygatt.
[ "Notification", "callback", "from", "pygatt", "." ]
def _update(self, handle, value): """Notification callback from pygatt.""" _LOGGER.debug( "%s: %15s temperature = %-2d.%-2d, humidity = %3d", handle, self.name, value[0], value[2], value[1], ) self.data["temp"] = flo...
[ "def", "_update", "(", "self", ",", "handle", ",", "value", ")", ":", "_LOGGER", ".", "debug", "(", "\"%s: %15s temperature = %-2d.%-2d, humidity = %3d\"", ",", "handle", ",", "self", ".", "name", ",", "value", "[", "0", "]", ",", "value", "[", "2", "]", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/skybeacon/sensor.py#L177-L188
uqfoundation/multiprocess
028cc73f02655e6451d92e5147d19d8c10aebe50
py3.6/multiprocess/pool.py
python
Pool.map
(self, func, iterable, chunksize=None)
return self._map_async(func, iterable, mapstar, chunksize).get()
Apply `func` to each element in `iterable`, collecting the results in a list that is returned.
Apply `func` to each element in `iterable`, collecting the results in a list that is returned.
[ "Apply", "func", "to", "each", "element", "in", "iterable", "collecting", "the", "results", "in", "a", "list", "that", "is", "returned", "." ]
def map(self, func, iterable, chunksize=None): ''' Apply `func` to each element in `iterable`, collecting the results in a list that is returned. ''' return self._map_async(func, iterable, mapstar, chunksize).get()
[ "def", "map", "(", "self", ",", "func", ",", "iterable", ",", "chunksize", "=", "None", ")", ":", "return", "self", ".", "_map_async", "(", "func", ",", "iterable", ",", "mapstar", ",", "chunksize", ")", ".", "get", "(", ")" ]
https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.6/multiprocess/pool.py#L261-L266
PaulSonOfLars/tgbot
0ece72778b7772725ab214fe0929daaa2fc7d2d1
tg_bot/modules/helper_funcs/chat_status.py
python
is_user_ban_protected
(chat: Chat, user_id: int, member: ChatMember = None)
return member.status in ('administrator', 'creator')
[]
def is_user_ban_protected(chat: Chat, user_id: int, member: ChatMember = None) -> bool: if chat.type == 'private' \ or user_id in SUDO_USERS \ or user_id in WHITELIST_USERS \ or chat.all_members_are_administrators: return True if not member: member = chat.get...
[ "def", "is_user_ban_protected", "(", "chat", ":", "Chat", ",", "user_id", ":", "int", ",", "member", ":", "ChatMember", "=", "None", ")", "->", "bool", ":", "if", "chat", ".", "type", "==", "'private'", "or", "user_id", "in", "SUDO_USERS", "or", "user_id...
https://github.com/PaulSonOfLars/tgbot/blob/0ece72778b7772725ab214fe0929daaa2fc7d2d1/tg_bot/modules/helper_funcs/chat_status.py#L13-L22
projectmesa/mesa
246c69d592a82e89c75d555c79736c3f619d434a
mesa/space.py
python
ContinuousSpace.move_agent
(self, agent: Agent, pos: FloatCoordinate)
Move an agent from its current position to a new position. Args: agent: The agent object to move. pos: Coordinate tuple to move the agent to.
Move an agent from its current position to a new position.
[ "Move", "an", "agent", "from", "its", "current", "position", "to", "a", "new", "position", "." ]
def move_agent(self, agent: Agent, pos: FloatCoordinate) -> None: """Move an agent from its current position to a new position. Args: agent: The agent object to move. pos: Coordinate tuple to move the agent to. """ pos = self.torus_adj(pos) idx = self._ag...
[ "def", "move_agent", "(", "self", ",", "agent", ":", "Agent", ",", "pos", ":", "FloatCoordinate", ")", "->", "None", ":", "pos", "=", "self", ".", "torus_adj", "(", "pos", ")", "idx", "=", "self", ".", "_agent_to_index", "[", "agent", "]", "self", "....
https://github.com/projectmesa/mesa/blob/246c69d592a82e89c75d555c79736c3f619d434a/mesa/space.py#L748-L759
metabrainz/picard
535bf8c7d9363ffc7abb3f69418ec11823c38118
picard/tagger.py
python
Tagger.extract_and_submit_acousticbrainz_features
(self, objs)
Extract AcousticBrainz features and submit them.
Extract AcousticBrainz features and submit them.
[ "Extract", "AcousticBrainz", "features", "and", "submit", "them", "." ]
def extract_and_submit_acousticbrainz_features(self, objs): """Extract AcousticBrainz features and submit them.""" if not self.ab_extractor.available(): return for file in iter_files_from_objects(objs): # Skip unmatched files if not file.can_extract(): ...
[ "def", "extract_and_submit_acousticbrainz_features", "(", "self", ",", "objs", ")", ":", "if", "not", "self", ".", "ab_extractor", ".", "available", "(", ")", ":", "return", "for", "file", "in", "iter_files_from_objects", "(", "objs", ")", ":", "# Skip unmatched...
https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/tagger.py#L866-L895
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
xtune/src/transformers/file_utils.py
python
s3_etag
(url, proxies=None)
return s3_object.e_tag
Check ETag on S3 object.
Check ETag on S3 object.
[ "Check", "ETag", "on", "S3", "object", "." ]
def s3_etag(url, proxies=None): """Check ETag on S3 object.""" s3_resource = boto3.resource("s3", config=Config(proxies=proxies)) bucket_name, s3_path = split_s3_path(url) s3_object = s3_resource.Object(bucket_name, s3_path) return s3_object.e_tag
[ "def", "s3_etag", "(", "url", ",", "proxies", "=", "None", ")", ":", "s3_resource", "=", "boto3", ".", "resource", "(", "\"s3\"", ",", "config", "=", "Config", "(", "proxies", "=", "proxies", ")", ")", "bucket_name", ",", "s3_path", "=", "split_s3_path",...
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/file_utils.py#L333-L338
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/speaklater.py
python
_LazyString.__setstate__
(self, tup)
[]
def __setstate__(self, tup): self._func, self._args, self._kwargs = tup
[ "def", "__setstate__", "(", "self", ",", "tup", ")", ":", "self", ".", "_func", ",", "self", ".", "_args", ",", "self", ".", "_kwargs", "=", "tup" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/speaklater.py#L182-L183
wequant-org/liveStrategyEngine
6e799e33cfa83b4496dd694e1d2bf30ea104e2c1
exchangeConnection/huobi/huobiServiceETH.py
python
withdraw
(address_id, amount)
return api_key_post(params, url)
:param address_id: :param amount: :return:
:param address_id: :param amount: :return:
[ ":", "param", "address_id", ":", ":", "param", "amount", ":", ":", "return", ":" ]
def withdraw(address_id, amount): """ :param address_id: :param amount: :return: """ params = {'address-id': address_id, 'amount': amount} url = '/v1/dw/withdraw-virtual/create' return api_key_post(params, url)
[ "def", "withdraw", "(", "address_id", ",", "amount", ")", ":", "params", "=", "{", "'address-id'", ":", "address_id", ",", "'amount'", ":", "amount", "}", "url", "=", "'/v1/dw/withdraw-virtual/create'", "return", "api_key_post", "(", "params", ",", "url", ")" ...
https://github.com/wequant-org/liveStrategyEngine/blob/6e799e33cfa83b4496dd694e1d2bf30ea104e2c1/exchangeConnection/huobi/huobiServiceETH.py#L257-L267
trailofbits/manticore
b050fdf0939f6c63f503cdf87ec0ab159dd41159
manticore/native/cpu/x86.py
python
X86Cpu.PCMPGTD
(cpu, op0, op1)
PCMPGTD: Packed compare for greater than with double words see PCMPEQB
PCMPGTD: Packed compare for greater than with double words see PCMPEQB
[ "PCMPGTD", ":", "Packed", "compare", "for", "greater", "than", "with", "double", "words", "see", "PCMPEQB" ]
def PCMPGTD(cpu, op0, op1): """ PCMPGTD: Packed compare for greater than with double words see PCMPEQB """ arg0 = op0.read() arg1 = op1.read() res = 0 for i in range(0, op0.size, 32): res = Operators.ITEBV( op0.size, ...
[ "def", "PCMPGTD", "(", "cpu", ",", "op0", ",", "op1", ")", ":", "arg0", "=", "op0", ".", "read", "(", ")", "arg1", "=", "op1", ".", "read", "(", ")", "res", "=", "0", "for", "i", "in", "range", "(", "0", ",", "op0", ".", "size", ",", "32", ...
https://github.com/trailofbits/manticore/blob/b050fdf0939f6c63f503cdf87ec0ab159dd41159/manticore/native/cpu/x86.py#L5139-L5155
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.3/django/template/defaultfilters.py
python
get_digit
(value, arg)
Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is always an integer.
Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is always an integer.
[ "Given", "a", "whole", "number", "returns", "the", "requested", "digit", "of", "it", "where", "1", "is", "the", "right", "-", "most", "digit", "2", "is", "the", "second", "-", "right", "-", "most", "digit", "etc", ".", "Returns", "the", "original", "va...
def get_digit(value, arg): """ Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is a...
[ "def", "get_digit", "(", "value", ",", "arg", ")", ":", "try", ":", "arg", "=", "int", "(", "arg", ")", "value", "=", "int", "(", "value", ")", "except", "ValueError", ":", "return", "value", "# Fail silently for an invalid argument", "if", "arg", "<", "...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.3/django/template/defaultfilters.py#L660-L677
django/channels
6af1bc3ab45f55e3f47d0d1d059d5db0a18a9581
channels/generic/websocket.py
python
AsyncWebsocketConsumer.close
(self, code=None)
Closes the WebSocket from the server end
Closes the WebSocket from the server end
[ "Closes", "the", "WebSocket", "from", "the", "server", "end" ]
async def close(self, code=None): """ Closes the WebSocket from the server end """ if code is not None and code is not True: await super().send({"type": "websocket.close", "code": code}) else: await super().send({"type": "websocket.close"})
[ "async", "def", "close", "(", "self", ",", "code", "=", "None", ")", ":", "if", "code", "is", "not", "None", "and", "code", "is", "not", "True", ":", "await", "super", "(", ")", ".", "send", "(", "{", "\"type\"", ":", "\"websocket.close\"", ",", "\...
https://github.com/django/channels/blob/6af1bc3ab45f55e3f47d0d1d059d5db0a18a9581/channels/generic/websocket.py#L217-L224
meraki/dashboard-api-python
aef5e6fe5d23a40d435d5c64ff30580a28af07f1
meraki/api/switch.py
python
Switch.getNetworkSwitchStack
(self, networkId: str, switchStackId: str)
return self._session.get(metadata, resource)
**Show a switch stack** https://developer.cisco.com/meraki/api-v1/#!get-network-switch-stack - networkId (string): (required) - switchStackId (string): (required)
**Show a switch stack** https://developer.cisco.com/meraki/api-v1/#!get-network-switch-stack
[ "**", "Show", "a", "switch", "stack", "**", "https", ":", "//", "developer", ".", "cisco", ".", "com", "/", "meraki", "/", "api", "-", "v1", "/", "#!get", "-", "network", "-", "switch", "-", "stack" ]
def getNetworkSwitchStack(self, networkId: str, switchStackId: str): """ **Show a switch stack** https://developer.cisco.com/meraki/api-v1/#!get-network-switch-stack - networkId (string): (required) - switchStackId (string): (required) """ metadata = { ...
[ "def", "getNetworkSwitchStack", "(", "self", ",", "networkId", ":", "str", ",", "switchStackId", ":", "str", ")", ":", "metadata", "=", "{", "'tags'", ":", "[", "'switch'", ",", "'configure'", ",", "'stacks'", "]", ",", "'operation'", ":", "'getNetworkSwitch...
https://github.com/meraki/dashboard-api-python/blob/aef5e6fe5d23a40d435d5c64ff30580a28af07f1/meraki/api/switch.py#L1521-L1536
mlrun/mlrun
4c120719d64327a34b7ee1ab08fb5e01b258b00a
mlrun/frameworks/pytorch/callbacks/logging_callback.py
python
LoggingCallback.on_epoch_end
(self, epoch: int)
Before the given epoch ends, this method will be called to log the dynamic hyperparameters as needed. :param epoch: The epoch that has just ended.
Before the given epoch ends, this method will be called to log the dynamic hyperparameters as needed.
[ "Before", "the", "given", "epoch", "ends", "this", "method", "will", "be", "called", "to", "log", "the", "dynamic", "hyperparameters", "as", "needed", "." ]
def on_epoch_end(self, epoch: int): """ Before the given epoch ends, this method will be called to log the dynamic hyperparameters as needed. :param epoch: The epoch that has just ended. """ # Update the dynamic hyperparameters dictionary: if self._dynamic_hyperparameter...
[ "def", "on_epoch_end", "(", "self", ",", "epoch", ":", "int", ")", ":", "# Update the dynamic hyperparameters dictionary:", "if", "self", ".", "_dynamic_hyperparameters_keys", ":", "for", "(", "parameter_name", ",", "(", "source", ",", "key_chain", ",", ")", ",", ...
https://github.com/mlrun/mlrun/blob/4c120719d64327a34b7ee1ab08fb5e01b258b00a/mlrun/frameworks/pytorch/callbacks/logging_callback.py#L229-L244
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
src/codeintel/play/core.py
python
Sizer.ShowItems
(*args, **kwargs)
return _core.Sizer_ShowItems(*args, **kwargs)
ShowItems(bool show)
ShowItems(bool show)
[ "ShowItems", "(", "bool", "show", ")" ]
def ShowItems(*args, **kwargs): """ShowItems(bool show)""" return _core.Sizer_ShowItems(*args, **kwargs)
[ "def", "ShowItems", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core", ".", "Sizer_ShowItems", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/play/core.py#L8445-L8447
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/escalation/shell.py
python
Shell.do_exploit
(self, args)
[]
def do_exploit(self, args): target = self.core.curtarget print(GOOD + "Initializing backdoor...") target.ssh.exec_command(self.get_command()) print(GOOD + "Shell Backdoor attempted.") for mod in self.modules.keys(): print(INFO + "Attempting to execute " + mod.name + "...
[ "def", "do_exploit", "(", "self", ",", "args", ")", ":", "target", "=", "self", ".", "core", ".", "curtarget", "print", "(", "GOOD", "+", "\"Initializing backdoor...\"", ")", "target", ".", "ssh", ".", "exec_command", "(", "self", ".", "get_command", "(", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/escalation/shell.py#L21-L28
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/minion.py
python
Minion._execute_job_function
( self, function_name, function_args, executors, opts, data )
return None
Executes a function within a job given it's name, the args and the executors. It also checks if the function is allowed to run if 'blackout mode' is enabled.
Executes a function within a job given it's name, the args and the executors. It also checks if the function is allowed to run if 'blackout mode' is enabled.
[ "Executes", "a", "function", "within", "a", "job", "given", "it", "s", "name", "the", "args", "and", "the", "executors", ".", "It", "also", "checks", "if", "the", "function", "is", "allowed", "to", "run", "if", "blackout", "mode", "is", "enabled", "." ]
def _execute_job_function( self, function_name, function_args, executors, opts, data ): """ Executes a function within a job given it's name, the args and the executors. It also checks if the function is allowed to run if 'blackout mode' is enabled. """ minion_blackou...
[ "def", "_execute_job_function", "(", "self", ",", "function_name", ",", "function_args", ",", "executors", ",", "opts", ",", "data", ")", ":", "minion_blackout_violation", "=", "False", "if", "self", ".", "connected", "and", "self", ".", "opts", "[", "\"pillar...
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/minion.py#L1812-L1872
burke-software/schooldriver
a07262ba864aee0182548ecceb661e49c925725f
ecwsp/discipline/forms.py
python
get_start_date_default
()
return default_date
Return default date for report. It should be X work days ago.
Return default date for report. It should be X work days ago.
[ "Return", "default", "date", "for", "report", ".", "It", "should", "be", "X", "work", "days", "ago", "." ]
def get_start_date_default(): """ Return default date for report. It should be X work days ago. """ work_days = (0,1,2,3,4) # python day of weeks mon-fri # Traverse back these many days days_back = int(Configuration.get_or_default('Discipline Merit Default Days', default=14).value) default_date = da...
[ "def", "get_start_date_default", "(", ")", ":", "work_days", "=", "(", "0", ",", "1", ",", "2", ",", "3", ",", "4", ")", "# python day of weeks mon-fri", "# Traverse back these many days", "days_back", "=", "int", "(", "Configuration", ".", "get_or_default", "("...
https://github.com/burke-software/schooldriver/blob/a07262ba864aee0182548ecceb661e49c925725f/ecwsp/discipline/forms.py#L32-L43
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/api/v2010/account/conference/recording.py
python
RecordingInstance.account_sid
(self)
return self._properties['account_sid']
:returns: The SID of the Account that created the resource :rtype: unicode
:returns: The SID of the Account that created the resource :rtype: unicode
[ ":", "returns", ":", "The", "SID", "of", "the", "Account", "that", "created", "the", "resource", ":", "rtype", ":", "unicode" ]
def account_sid(self): """ :returns: The SID of the Account that created the resource :rtype: unicode """ return self._properties['account_sid']
[ "def", "account_sid", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'account_sid'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/api/v2010/account/conference/recording.py#L386-L391
laincloud/lain
0fe5f93d06540300c5dafb94d81b3b69d2c8f1da
playbooks/roles/collectd/files/plugins/lain/cluster_monitor.py
python
ClusterPlugin._get_cali_veth_stat
(self)
Check the status of all network interfaces. Value is 1 if any one of them is DOWN
Check the status of all network interfaces. Value is 1 if any one of them is DOWN
[ "Check", "the", "status", "of", "all", "network", "interfaces", ".", "Value", "is", "1", "if", "any", "one", "of", "them", "is", "DOWN" ]
def _get_cali_veth_stat(self): ''' Check the status of all network interfaces. Value is 1 if any one of them is DOWN ''' cali_veth_up = 0 cali_veth_down = 0 cali_veth_total = 0 tmp_veth_up = 0 tmp_veth_down = 0 tmp_veth_total = 0 fo...
[ "def", "_get_cali_veth_stat", "(", "self", ")", ":", "cali_veth_up", "=", "0", "cali_veth_down", "=", "0", "cali_veth_total", "=", "0", "tmp_veth_up", "=", "0", "tmp_veth_down", "=", "0", "tmp_veth_total", "=", "0", "for", "name", ",", "stat", "in", "psutil"...
https://github.com/laincloud/lain/blob/0fe5f93d06540300c5dafb94d81b3b69d2c8f1da/playbooks/roles/collectd/files/plugins/lain/cluster_monitor.py#L39-L80
markovmodel/PyEMMA
e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3
pyemma/coordinates/estimation/koopman.py
python
_KoopmanEstimator.weights
(self)
return _KoopmanWeights(u_input[0:-1], u_input[-1])
weights in the input basis (encapsulated in an object)
weights in the input basis (encapsulated in an object)
[ "weights", "in", "the", "input", "basis", "(", "encapsulated", "in", "an", "object", ")" ]
def weights(self): 'weights in the input basis (encapsulated in an object)' self._check_estimated() u_input = self.u return _KoopmanWeights(u_input[0:-1], u_input[-1])
[ "def", "weights", "(", "self", ")", ":", "self", ".", "_check_estimated", "(", ")", "u_input", "=", "self", ".", "u", "return", "_KoopmanWeights", "(", "u_input", "[", "0", ":", "-", "1", "]", ",", "u_input", "[", "-", "1", "]", ")" ]
https://github.com/markovmodel/PyEMMA/blob/e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3/pyemma/coordinates/estimation/koopman.py#L129-L133
hungpham2511/toppra
766a2c736319639c7b0176959d2baa624ef74415
toppra/interpolator.py
python
UnivariateSplineInterpolator.eval
(self, ss_sam)
return np.array(data).T
Return the path position.
Return the path position.
[ "Return", "the", "path", "position", "." ]
def eval(self, ss_sam): """Return the path position.""" data = [] for spl in self.uspl: data.append(spl(ss_sam)) return np.array(data).T
[ "def", "eval", "(", "self", ",", "ss_sam", ")", ":", "data", "=", "[", "]", "for", "spl", "in", "self", ".", "uspl", ":", "data", ".", "append", "(", "spl", "(", "ss_sam", ")", ")", "return", "np", ".", "array", "(", "data", ")", ".", "T" ]
https://github.com/hungpham2511/toppra/blob/766a2c736319639c7b0176959d2baa624ef74415/toppra/interpolator.py#L554-L559
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/ipaddress.py
python
IPv4Address.is_loopback
(self)
return self in self._constants._loopback_network
Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330.
Test if the address is a loopback address.
[ "Test", "if", "the", "address", "is", "a", "loopback", "address", "." ]
def is_loopback(self): """Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. """ return self in self._constants._loopback_network
[ "def", "is_loopback", "(", "self", ")", ":", "return", "self", "in", "self", ".", "_constants", ".", "_loopback_network" ]
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/ipaddress.py#L1459-L1466
dwadden/dygiepp
8faac5711489d4f5fb1189f8344c8ffb5548d2cb
scripts/data/genia/merge_coref.py
python
Corefs._assign_parent_indices
(corefs, coref_ids)
return corefs
Give each coref the index of it parent in the list of corefs.
Give each coref the index of it parent in the list of corefs.
[ "Give", "each", "coref", "the", "index", "of", "it", "parent", "in", "the", "list", "of", "corefs", "." ]
def _assign_parent_indices(corefs, coref_ids): """Give each coref the index of it parent in the list of corefs.""" for coref in corefs: if coref.ref is None: coref.parent_ix = None else: coref.parent_ix = coref_ids.index(coref.ref) return c...
[ "def", "_assign_parent_indices", "(", "corefs", ",", "coref_ids", ")", ":", "for", "coref", "in", "corefs", ":", "if", "coref", ".", "ref", "is", "None", ":", "coref", ".", "parent_ix", "=", "None", "else", ":", "coref", ".", "parent_ix", "=", "coref_ids...
https://github.com/dwadden/dygiepp/blob/8faac5711489d4f5fb1189f8344c8ffb5548d2cb/scripts/data/genia/merge_coref.py#L128-L135
yaksok/yaksok
73f14863d04f054eef2926f25a091f72f60352a5
yaksok/yacc.py
python
p_atom_paren
(t)
atom : LPAR expression RPAR | LPAR call RPAR | LPAR import_call RPAR
atom : LPAR expression RPAR | LPAR call RPAR | LPAR import_call RPAR
[ "atom", ":", "LPAR", "expression", "RPAR", "|", "LPAR", "call", "RPAR", "|", "LPAR", "import_call", "RPAR" ]
def p_atom_paren(t): '''atom : LPAR expression RPAR | LPAR call RPAR | LPAR import_call RPAR''' t[0] = t[2]
[ "def", "p_atom_paren", "(", "t", ")", ":", "t", "[", "0", "]", "=", "t", "[", "2", "]" ]
https://github.com/yaksok/yaksok/blob/73f14863d04f054eef2926f25a091f72f60352a5/yaksok/yacc.py#L739-L743
zsdlove/Hades
f3d8c43a40ccd7a1bca2a855d8cccc110c34448a
cfg/graphs.py
python
GraphManager.add_block_edge
(self, b1, b2, label="CONT")
join two pydot nodes / create nodes edge
join two pydot nodes / create nodes edge
[ "join", "two", "pydot", "nodes", "/", "create", "nodes", "edge" ]
def add_block_edge(self, b1, b2, label="CONT"): """ join two pydot nodes / create nodes edge """ # Edge color based on label text if label=='false': ecolor = "red" elif label=='true': ecolor = 'green' elif label == 'exception': ecolor = 'orange' elif label == 'try': ecolor = 'blue' else: ec...
[ "def", "add_block_edge", "(", "self", ",", "b1", ",", "b2", ",", "label", "=", "\"CONT\"", ")", ":", "# Edge color based on label text", "if", "label", "==", "'false'", ":", "ecolor", "=", "\"red\"", "elif", "label", "==", "'true'", ":", "ecolor", "=", "'g...
https://github.com/zsdlove/Hades/blob/f3d8c43a40ccd7a1bca2a855d8cccc110c34448a/cfg/graphs.py#L31-L70
NeuralEnsemble/python-neo
34d4db8fb0dc950dbbc6defd7fb75e99ea877286
neo/io/nwbio.py
python
EventProxy.load
(self, time_slice=None, strict_slicing=True)
return Event(times * pq.s, labels=labels, name=self.name, description=self.description, **self.annotations)
Load EventProxy args: :param time_slice: None or tuple of the time slice expressed with quantities. None is the entire signal. :param strict_slicing: True by default. Control if an error is raised or not when one of the time_slice members ...
Load EventProxy args: :param time_slice: None or tuple of the time slice expressed with quantities. None is the entire signal. :param strict_slicing: True by default. Control if an error is raised or not when one of the time_slice members ...
[ "Load", "EventProxy", "args", ":", ":", "param", "time_slice", ":", "None", "or", "tuple", "of", "the", "time", "slice", "expressed", "with", "quantities", ".", "None", "is", "the", "entire", "signal", ".", ":", "param", "strict_slicing", ":", "True", "by"...
def load(self, time_slice=None, strict_slicing=True): """ Load EventProxy args: :param time_slice: None or tuple of the time slice expressed with quantities. None is the entire signal. :param strict_slicing: True by default. Control if ...
[ "def", "load", "(", "self", ",", "time_slice", "=", "None", ",", "strict_slicing", "=", "True", ")", ":", "if", "time_slice", ":", "raise", "NotImplementedError", "(", "\"todo\"", ")", "else", ":", "times", "=", "self", ".", "_timeseries", ".", "timestamps...
https://github.com/NeuralEnsemble/python-neo/blob/34d4db8fb0dc950dbbc6defd7fb75e99ea877286/neo/io/nwbio.py#L746-L764
ckan/ckan
b3b01218ad88ed3fb914b51018abe8b07b07bff3
ckanext/datastore/backend/postgres.py
python
DatastorePostgresqlBackend._is_postgresql_engine
(self)
return drivername.startswith('postgres')
Returns True if the read engine is a Postgresql Database. According to http://docs.sqlalchemy.org/en/latest/core/engines.html#postgresql all Postgres driver names start with `postgres`.
Returns True if the read engine is a Postgresql Database.
[ "Returns", "True", "if", "the", "read", "engine", "is", "a", "Postgresql", "Database", "." ]
def _is_postgresql_engine(self): ''' Returns True if the read engine is a Postgresql Database. According to http://docs.sqlalchemy.org/en/latest/core/engines.html#postgresql all Postgres driver names start with `postgres`. ''' drivername = self._get_read_engine().engine....
[ "def", "_is_postgresql_engine", "(", "self", ")", ":", "drivername", "=", "self", ".", "_get_read_engine", "(", ")", ".", "engine", ".", "url", ".", "drivername", "return", "drivername", ".", "startswith", "(", "'postgres'", ")" ]
https://github.com/ckan/ckan/blob/b3b01218ad88ed3fb914b51018abe8b07b07bff3/ckanext/datastore/backend/postgres.py#L1719-L1727
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3/s3aaa.py
python
AuthS3.s3_link_to_human_resource
(self, user, person_id, hr_type, )
return hr_id
Link the user to a human resource record and make them owner Args: user: the user record person_id: the person ID linked to that user hr_type: the human resource type (staff/volunteer)
Link the user to a human resource record and make them owner
[ "Link", "the", "user", "to", "a", "human", "resource", "record", "and", "make", "them", "owner" ]
def s3_link_to_human_resource(self, user, person_id, hr_type, ): """ Link the user to a human resource record and make them owner Args: ...
[ "def", "s3_link_to_human_resource", "(", "self", ",", "user", ",", "person_id", ",", "hr_type", ",", ")", ":", "db", "=", "current", ".", "db", "s3db", "=", "current", ".", "s3db", "settings", "=", "current", ".", "deployment_settings", "user_id", "=", "us...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3aaa.py#L3393-L3520
scrtlabs/catalyst
2e8029780f2381da7a0729f7b52505e5db5f535b
catalyst/utils/numpy_utils.py
python
repeat_first_axis
(array, count)
return as_strided(array, (count,) + array.shape, (0,) + array.strides)
Restride `array` to repeat `count` times along the first axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape (count,) + array.shape, composed of `array` repe...
Restride `array` to repeat `count` times along the first axis.
[ "Restride", "array", "to", "repeat", "count", "times", "along", "the", "first", "axis", "." ]
def repeat_first_axis(array, count): """ Restride `array` to repeat `count` times along the first axis. Parameters ---------- array : np.array The array to restride. count : int Number of times to repeat `array`. Returns ------- result : array Array of shape...
[ "def", "repeat_first_axis", "(", "array", ",", "count", ")", ":", "return", "as_strided", "(", "array", ",", "(", "count", ",", ")", "+", "array", ".", "shape", ",", "(", "0", ",", ")", "+", "array", ".", "strides", ")" ]
https://github.com/scrtlabs/catalyst/blob/2e8029780f2381da7a0729f7b52505e5db5f535b/catalyst/utils/numpy_utils.py#L167-L207
aiven/pghoard
1de0d2e33bf087b7ce3b6af556bbf941acfac3a4
pghoard/webserver.py
python
RequestHandler.get_wal_or_timeline_file
(self, site, filename, filetype)
[]
def get_wal_or_timeline_file(self, site, filename, filetype): target_path = self.headers.get("x-pghoard-target-path") if not target_path: raise HttpResponse("x-pghoard-target-path header missing from download", status=400) self._process_completed_download_operations() # See...
[ "def", "get_wal_or_timeline_file", "(", "self", ",", "site", ",", "filename", ",", "filetype", ")", ":", "target_path", "=", "self", ".", "headers", ".", "get", "(", "\"x-pghoard-target-path\"", ")", "if", "not", "target_path", ":", "raise", "HttpResponse", "(...
https://github.com/aiven/pghoard/blob/1de0d2e33bf087b7ce3b6af556bbf941acfac3a4/pghoard/webserver.py#L412-L492
PrefectHQ/prefect
67bdc94e2211726d99561f6f52614bec8970e981
src/prefect/client/client.py
python
Client.get_available_tenants
(self)
return result.data.tenant
Returns a list of available tenants. NOTE: this should only be called by users who have provided a USER-scoped API token. Returns: - List[Dict]: a list of dictionaries containing the id, slug, and name of available tenants
Returns a list of available tenants.
[ "Returns", "a", "list", "of", "available", "tenants", "." ]
def get_available_tenants(self) -> List[Dict]: """ Returns a list of available tenants. NOTE: this should only be called by users who have provided a USER-scoped API token. Returns: - List[Dict]: a list of dictionaries containing the id, slug, and name of availa...
[ "def", "get_available_tenants", "(", "self", ")", "->", "List", "[", "Dict", "]", ":", "result", "=", "self", ".", "graphql", "(", "{", "\"query\"", ":", "{", "\"tenant(order_by: {slug: asc})\"", ":", "{", "\"id\"", ",", "\"slug\"", ",", "\"name\"", "}", "...
https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/client/client.py#L874-L890
naftaliharris/tauthon
5587ceec329b75f7caf6d65a036db61ac1bae214
Lib/pickletools.py
python
read_unicodestring4
(f)
r""" >>> import StringIO >>> s = u'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc 'abcd\xea\xaf\x8d' >>> n = chr(len(enc)) + chr(0) * 3 # little-endian 4-byte length >>> t = read_unicodestring4(StringIO.StringIO(n + enc + 'junk')) >>> s == t True >>> read_unicodestring4(String...
r""" >>> import StringIO >>> s = u'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc 'abcd\xea\xaf\x8d' >>> n = chr(len(enc)) + chr(0) * 3 # little-endian 4-byte length >>> t = read_unicodestring4(StringIO.StringIO(n + enc + 'junk')) >>> s == t True
[ "r", ">>>", "import", "StringIO", ">>>", "s", "=", "u", "abcd", "\\", "uabcd", ">>>", "enc", "=", "s", ".", "encode", "(", "utf", "-", "8", ")", ">>>", "enc", "abcd", "\\", "xea", "\\", "xaf", "\\", "x8d", ">>>", "n", "=", "chr", "(", "len", ...
def read_unicodestring4(f): r""" >>> import StringIO >>> s = u'abcd\uabcd' >>> enc = s.encode('utf-8') >>> enc 'abcd\xea\xaf\x8d' >>> n = chr(len(enc)) + chr(0) * 3 # little-endian 4-byte length >>> t = read_unicodestring4(StringIO.StringIO(n + enc + 'junk')) >>> s == t True ...
[ "def", "read_unicodestring4", "(", "f", ")", ":", "n", "=", "read_int4", "(", "f", ")", "if", "n", "<", "0", ":", "raise", "ValueError", "(", "\"unicodestring4 byte count < 0: %d\"", "%", "n", ")", "data", "=", "f", ".", "read", "(", "n", ")", "if", ...
https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/pickletools.py#L445-L470
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
sqlalchemy/sql/elements.py
python
ColumnElement.anon_label
(self)
return _anonymous_label( '%%(%d %s)s' % (id(self), getattr(self, 'name', 'anon')) )
provides a constant 'anonymous label' for this ColumnElement. This is a label() expression which will be named at compile time. The same label() is returned each time anon_label is called so that expressions can reference anon_label multiple times, producing the same label name at compi...
provides a constant 'anonymous label' for this ColumnElement.
[ "provides", "a", "constant", "anonymous", "label", "for", "this", "ColumnElement", "." ]
def anon_label(self): """provides a constant 'anonymous label' for this ColumnElement. This is a label() expression which will be named at compile time. The same label() is returned each time anon_label is called so that expressions can reference anon_label multiple times, producing ...
[ "def", "anon_label", "(", "self", ")", ":", "return", "_anonymous_label", "(", "'%%(%d %s)s'", "%", "(", "id", "(", "self", ")", ",", "getattr", "(", "self", ",", "'name'", ",", "'anon'", ")", ")", ")" ]
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/sql/elements.py#L785-L800
spesmilo/electrum
bdbd59300fbd35b01605e66145458e5f396108e8
electrum/wallet_db.py
python
WalletDB._convert_version_37
(self)
[]
def _convert_version_37(self): if not self._is_upgrade_method_needed(36, 36): return payments = self.data.get('lightning_payments', {}) for k, v in list(payments.items()): amount_sat, direction, status = v amount_msat = amount_sat * 1000 if amount_sat is not N...
[ "def", "_convert_version_37", "(", "self", ")", ":", "if", "not", "self", ".", "_is_upgrade_method_needed", "(", "36", ",", "36", ")", ":", "return", "payments", "=", "self", ".", "data", ".", "get", "(", "'lightning_payments'", ",", "{", "}", ")", "for"...
https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/wallet_db.py#L752-L761
ctxis/canape
5f0e03424577296bcc60c2008a60a98ec5307e4b
CANAPE.Scripting/Lib/decimal.py
python
_format_align
(sign, body, spec)
return result
Given an unpadded, non-aligned numeric string 'body' and sign string 'sign', add padding and alignment conforming to the given format specifier dictionary 'spec' (as produced by parse_format_specifier). Also converts result to unicode if necessary.
Given an unpadded, non-aligned numeric string 'body' and sign string 'sign', add padding and alignment conforming to the given format specifier dictionary 'spec' (as produced by parse_format_specifier).
[ "Given", "an", "unpadded", "non", "-", "aligned", "numeric", "string", "body", "and", "sign", "string", "sign", "add", "padding", "and", "alignment", "conforming", "to", "the", "given", "format", "specifier", "dictionary", "spec", "(", "as", "produced", "by", ...
def _format_align(sign, body, spec): """Given an unpadded, non-aligned numeric string 'body' and sign string 'sign', add padding and alignment conforming to the given format specifier dictionary 'spec' (as produced by parse_format_specifier). Also converts result to unicode if necessary. """ ...
[ "def", "_format_align", "(", "sign", ",", "body", ",", "spec", ")", ":", "# how much extra space do we have to play with?", "minimumwidth", "=", "spec", "[", "'minimumwidth'", "]", "fill", "=", "spec", "[", "'fill'", "]", "padding", "=", "fill", "*", "(", "min...
https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/decimal.py#L6003-L6034
tensorflow/tfx
b4a6b83269815ed12ba9df9e9154c7376fef2ea0
tfx/examples/penguin/penguin_utils_cloud_tuner.py
python
_input_fn
(file_pattern: List[str], data_accessor: tfx.components.DataAccessor, tf_transform_output: tft.TFTransformOutput, batch_size: int = 200)
return data_accessor.tf_dataset_factory( file_pattern, tfxio.TensorFlowDatasetOptions( batch_size=batch_size, label_key=_transformed_name(_LABEL_KEY)), tf_transform_output.transformed_metadata.schema).repeat()
Generates features and label for tuning/training. Args: file_pattern: List of paths or patterns of input tfrecord files. data_accessor: DataAccessor for converting input to RecordBatch. tf_transform_output: A `TFTransformOutput` object, containing statistics and metadata from TFTransform component....
Generates features and label for tuning/training.
[ "Generates", "features", "and", "label", "for", "tuning", "/", "training", "." ]
def _input_fn(file_pattern: List[str], data_accessor: tfx.components.DataAccessor, tf_transform_output: tft.TFTransformOutput, batch_size: int = 200) -> tf.data.Dataset: """Generates features and label for tuning/training. Args: file_pattern: List of paths or patterns ...
[ "def", "_input_fn", "(", "file_pattern", ":", "List", "[", "str", "]", ",", "data_accessor", ":", "tfx", ".", "components", ".", "DataAccessor", ",", "tf_transform_output", ":", "tft", ".", "TFTransformOutput", ",", "batch_size", ":", "int", "=", "200", ")",...
https://github.com/tensorflow/tfx/blob/b4a6b83269815ed12ba9df9e9154c7376fef2ea0/tfx/examples/penguin/penguin_utils_cloud_tuner.py#L112-L134
radiac/django-tagulous
90c6ee5ac54ef1127f2edcfac10c5ef3ab09e255
tagulous/models/models.py
python
BaseTagModel.__eq__
(self, obj)
return super(BaseTagModel, self).__eq__(obj)
If comparing to a string, is equal if string value matches Otherwise compares normally
If comparing to a string, is equal if string value matches Otherwise compares normally
[ "If", "comparing", "to", "a", "string", "is", "equal", "if", "string", "value", "matches", "Otherwise", "compares", "normally" ]
def __eq__(self, obj): """ If comparing to a string, is equal if string value matches Otherwise compares normally """ if isinstance(obj, str): return self.name == obj return super(BaseTagModel, self).__eq__(obj)
[ "def", "__eq__", "(", "self", ",", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "str", ")", ":", "return", "self", ".", "name", "==", "obj", "return", "super", "(", "BaseTagModel", ",", "self", ")", ".", "__eq__", "(", "obj", ")" ]
https://github.com/radiac/django-tagulous/blob/90c6ee5ac54ef1127f2edcfac10c5ef3ab09e255/tagulous/models/models.py#L147-L154
karanchahal/distiller
a17ec06cbeafcdd2aea19d7c7663033c951392f5
models/vision/densenet.py
python
densenet161
(pretrained=False, progress=True, **kwargs)
return _densenet('densenet161', 48, (6, 12, 36, 24), 96, pretrained, progress, **kwargs)
r"""Densenet-161 model from `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr memory_efficient (bool) ...
r"""Densenet-161 model from `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_
[ "r", "Densenet", "-", "161", "model", "from", "Densely", "Connected", "Convolutional", "Networks", "<https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1608", ".", "06993", ".", "pdf", ">", "_" ]
def densenet161(pretrained=False, progress=True, **kwargs): r"""Densenet-161 model from `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progres...
[ "def", "densenet161", "(", "pretrained", "=", "False", ",", "progress", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "_densenet", "(", "'densenet161'", ",", "48", ",", "(", "6", ",", "12", ",", "36", ",", "24", ")", ",", "96", ",", "...
https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/models/vision/densenet.py#L243-L254
unknown-horizons/unknown-horizons
7397fb333006d26c3d9fe796c7bd9cb8c3b43a49
horizons/util/checkupdates.py
python
is_system_installed
(uh_path: Optional[PurePath] = None)
Returns whether UH is likely to have been installed with the systems package manager. In typical usage, you don't need to pass any parameters.
Returns whether UH is likely to have been installed with the systems package manager.
[ "Returns", "whether", "UH", "is", "likely", "to", "have", "been", "installed", "with", "the", "systems", "package", "manager", "." ]
def is_system_installed(uh_path: Optional[PurePath] = None) -> bool: """ Returns whether UH is likely to have been installed with the systems package manager. In typical usage, you don't need to pass any parameters. """ if uh_path is None: uh_path = PurePath(os.path.abspath(__file__)) home_directory = get_hom...
[ "def", "is_system_installed", "(", "uh_path", ":", "Optional", "[", "PurePath", "]", "=", "None", ")", "->", "bool", ":", "if", "uh_path", "is", "None", ":", "uh_path", "=", "PurePath", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")",...
https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/util/checkupdates.py#L45-L59
cuthbertLab/music21
bd30d4663e52955ed922c10fdf541419d8c67671
music21/analysis/windowed.py
python
TestMockProcessor.process
(self, subStream)
return len(subStream.flatten().notesAndRests), None
Simply count the number of notes found
Simply count the number of notes found
[ "Simply", "count", "the", "number", "of", "notes", "found" ]
def process(self, subStream): '''Simply count the number of notes found ''' return len(subStream.flatten().notesAndRests), None
[ "def", "process", "(", "self", ",", "subStream", ")", ":", "return", "len", "(", "subStream", ".", "flatten", "(", ")", ".", "notesAndRests", ")", ",", "None" ]
https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/analysis/windowed.py#L358-L361
mme/vergeml
3dc30ba4e0f3d038743b6d468860cbcf3681acc6
vergeml/results.py
python
Results._sync
(self, force=False)
[]
def _sync(self, force=False): now = datetime.datetime.now() if force or (now - self.last_sync).total_seconds() > _SYNC_INTV: self.last_sync = now with open(self.path, "w") as f: json.dump(self.data, f)
[ "def", "_sync", "(", "self", ",", "force", "=", "False", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "if", "force", "or", "(", "now", "-", "self", ".", "last_sync", ")", ".", "total_seconds", "(", ")", ">", "_SYNC_INTV"...
https://github.com/mme/vergeml/blob/3dc30ba4e0f3d038743b6d468860cbcf3681acc6/vergeml/results.py#L27-L32
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/command/bdist_egg.py
python
walk_egg
(egg_dir)
Walk an unpacked egg's contents, skipping the metadata directory
Walk an unpacked egg's contents, skipping the metadata directory
[ "Walk", "an", "unpacked", "egg", "s", "contents", "skipping", "the", "metadata", "directory" ]
def walk_egg(egg_dir): """Walk an unpacked egg's contents, skipping the metadata directory""" walker = sorted_walk(egg_dir) base, dirs, files = next(walker) if 'EGG-INFO' in dirs: dirs.remove('EGG-INFO') yield base, dirs, files for bdf in walker: yield bdf
[ "def", "walk_egg", "(", "egg_dir", ")", ":", "walker", "=", "sorted_walk", "(", "egg_dir", ")", "base", ",", "dirs", ",", "files", "=", "next", "(", "walker", ")", "if", "'EGG-INFO'", "in", "dirs", ":", "dirs", ".", "remove", "(", "'EGG-INFO'", ")", ...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/site-packages/setuptools/command/bdist_egg.py#L358-L366
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/viewer/xls_writer.py
python
XlsWriter.save_workbook_to_file
(self)
return self._file
[]
def save_workbook_to_file(self): self._workbook.save(self._file) return self._file
[ "def", "save_workbook_to_file", "(", "self", ")", ":", "self", ".", "_workbook", ".", "save", "(", "self", ".", "_file", ")", "return", "self", ".", "_file" ]
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/viewer/xls_writer.py#L90-L92
huawei-noah/vega
d9f13deede7f2b584e4b1d32ffdb833856129989
vega/datasets/tensorflow/adapter.py
python
TfAdapter.loader
(self)
return self
Dataloader arrtribute which is a unified interface to generate the data. :return: a batch data :rtype: dict, list, optional
Dataloader arrtribute which is a unified interface to generate the data.
[ "Dataloader", "arrtribute", "which", "is", "a", "unified", "interface", "to", "generate", "the", "data", "." ]
def loader(self): """Dataloader arrtribute which is a unified interface to generate the data. :return: a batch data :rtype: dict, list, optional """ return self
[ "def", "loader", "(", "self", ")", ":", "return", "self" ]
https://github.com/huawei-noah/vega/blob/d9f13deede7f2b584e4b1d32ffdb833856129989/vega/datasets/tensorflow/adapter.py#L230-L236
dipy/dipy
be956a529465b28085f8fc435a756947ddee1c89
dipy/reconst/fwdti.py
python
nls_iter
(design_matrix, sig, S0, Diso=3e-3, mdreg=2.7e-3, min_signal=1.0e-6, cholesky=False, f_transform=True, jac=False, weighting=None, sigma=None)
return params
Applies non linear least squares fit of the water free elimination model to single voxel signals. Parameters ---------- design_matrix : array (g, 7) Design matrix holding the covariants used to solve for the regression coefficients. sig : array (g, ) Diffusion-weighted signa...
Applies non linear least squares fit of the water free elimination model to single voxel signals.
[ "Applies", "non", "linear", "least", "squares", "fit", "of", "the", "water", "free", "elimination", "model", "to", "single", "voxel", "signals", "." ]
def nls_iter(design_matrix, sig, S0, Diso=3e-3, mdreg=2.7e-3, min_signal=1.0e-6, cholesky=False, f_transform=True, jac=False, weighting=None, sigma=None): """ Applies non linear least squares fit of the water free elimination model to single voxel signals. Parameters ---------...
[ "def", "nls_iter", "(", "design_matrix", ",", "sig", ",", "S0", ",", "Diso", "=", "3e-3", ",", "mdreg", "=", "2.7e-3", ",", "min_signal", "=", "1.0e-6", ",", "cholesky", "=", "False", ",", "f_transform", "=", "True", ",", "jac", "=", "False", ",", "w...
https://github.com/dipy/dipy/blob/be956a529465b28085f8fc435a756947ddee1c89/dipy/reconst/fwdti.py#L540-L649
CastagnaIT/plugin.video.netflix
5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a
resources/lib/kodi/library.py
python
Library.import_library
(self, path)
Imports an already existing exported STRM library into the add-on library database, allows you to restore an existing library, by avoiding to recreate it from scratch. This operations also update the missing tv shows seasons and episodes, and automatically converts old STRM format type from add-...
Imports an already existing exported STRM library into the add-on library database, allows you to restore an existing library, by avoiding to recreate it from scratch. This operations also update the missing tv shows seasons and episodes, and automatically converts old STRM format type from add-...
[ "Imports", "an", "already", "existing", "exported", "STRM", "library", "into", "the", "add", "-", "on", "library", "database", "allows", "you", "to", "restore", "an", "existing", "library", "by", "avoiding", "to", "recreate", "it", "from", "scratch", ".", "T...
def import_library(self, path): """ Imports an already existing exported STRM library into the add-on library database, allows you to restore an existing library, by avoiding to recreate it from scratch. This operations also update the missing tv shows seasons and episodes, and automatic...
[ "def", "import_library", "(", "self", ",", "path", ")", ":", "# If set ask to user if want to export NFO files", "nfo_settings", "=", "nfo", ".", "NFOSettings", "(", ")", "nfo_settings", ".", "show_export_dialog", "(", ")", "LOG", ".", "info", "(", "'Start importing...
https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/resources/lib/kodi/library.py#L297-L343
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/inject/thirdparty/odict/odict.py
python
_OrderedDict.sort
(self, *args, **kwargs)
Sort the key order in the OrderedDict. This method takes the same arguments as the ``list.sort`` method on your version of Python. >>> d = OrderedDict(((4, 1), (2, 2), (3, 3), (1, 4))) >>> d.sort() >>> d OrderedDict([(1, 4), (2, 2), (3, 3), (4, 1)])
Sort the key order in the OrderedDict.
[ "Sort", "the", "key", "order", "in", "the", "OrderedDict", "." ]
def sort(self, *args, **kwargs): """ Sort the key order in the OrderedDict. This method takes the same arguments as the ``list.sort`` method on your version of Python. >>> d = OrderedDict(((4, 1), (2, 2), (3, 3), (1, 4))) >>> d.sort() >>> d OrderedDict([...
[ "def", "sort", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_sequence", ".", "sort", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/thirdparty/odict/odict.py#L858-L870
snarfed/granary
ab085de2aef0cff8ac31a99b5e21443a249e8419
granary/reddit.py
python
Reddit.user_to_actor
(self, user)
return util.trim_nulls({ 'objectType': 'person', 'displayName': username, 'image': {'url': image}, 'id': self.tag_uri(username), # numeric_id is our own custom field that always has the source's numeric # user id, if available. 'numeric_id': user.get('id'), 'published': u...
Converts a dict user to an actor. Args: user: JSON user Returns: an ActivityStreams actor dict, ready to be JSON-encoded
Converts a dict user to an actor.
[ "Converts", "a", "dict", "user", "to", "an", "actor", "." ]
def user_to_actor(self, user): """Converts a dict user to an actor. Args: user: JSON user Returns: an ActivityStreams actor dict, ready to be JSON-encoded """ username = user.get('name') if not username: return {} # trying my best to grab all the urls from the profile de...
[ "def", "user_to_actor", "(", "self", ",", "user", ")", ":", "username", "=", "user", ".", "get", "(", "'name'", ")", "if", "not", "username", ":", "return", "{", "}", "# trying my best to grab all the urls from the profile description", "urls", "=", "[", "f'{sel...
https://github.com/snarfed/granary/blob/ab085de2aef0cff8ac31a99b5e21443a249e8419/granary/reddit.py#L94-L134
RiotGames/cloud-inquisitor
29a26c705381fdba3538b4efedb25b9e09b387ed
backend/cloud_inquisitor/plugins/types/resources.py
python
BaseResource.update
(self, data)
Updates the resource object with the information from `data`. The changes will be added to the current db.session but will not be commited. The user will need to perform the commit explicitly to save the changes Returns: True if resource object was updated, else False
Updates the resource object with the information from `data`. The changes will be added to the current db.session but will not be commited. The user will need to perform the commit explicitly to save the changes
[ "Updates", "the", "resource", "object", "with", "the", "information", "from", "data", ".", "The", "changes", "will", "be", "added", "to", "the", "current", "db", ".", "session", "but", "will", "not", "be", "commited", ".", "The", "user", "will", "need", ...
def update(self, data): """Updates the resource object with the information from `data`. The changes will be added to the current db.session but will not be commited. The user will need to perform the commit explicitly to save the changes Returns: True if resource object was updated...
[ "def", "update", "(", "self", ",", "data", ")", ":" ]
https://github.com/RiotGames/cloud-inquisitor/blob/29a26c705381fdba3538b4efedb25b9e09b387ed/backend/cloud_inquisitor/plugins/types/resources.py#L110-L116
alanhamlett/pip-update-requirements
ce875601ef278c8ce00ad586434a978731525561
pur/packages/pip/_vendor/urllib3/contrib/securetransport.py
python
WrappedSocket._set_ciphers
(self)
Sets up the allowed ciphers. By default this matches the set in util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done custom and doesn't allow changing at this time, mostly because parsing OpenSSL cipher strings is going to be a freaking nightmare.
Sets up the allowed ciphers. By default this matches the set in util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done custom and doesn't allow changing at this time, mostly because parsing OpenSSL cipher strings is going to be a freaking nightmare.
[ "Sets", "up", "the", "allowed", "ciphers", ".", "By", "default", "this", "matches", "the", "set", "in", "util", ".", "ssl_", ".", "DEFAULT_CIPHERS", "at", "least", "as", "supported", "by", "macOS", ".", "This", "is", "done", "custom", "and", "doesn", "t"...
def _set_ciphers(self): """ Sets up the allowed ciphers. By default this matches the set in util.ssl_.DEFAULT_CIPHERS, at least as supported by macOS. This is done custom and doesn't allow changing at this time, mostly because parsing OpenSSL cipher strings is going to be a freak...
[ "def", "_set_ciphers", "(", "self", ")", ":", "ciphers", "=", "(", "Security", ".", "SSLCipherSuite", "*", "len", "(", "CIPHER_SUITES", ")", ")", "(", "*", "CIPHER_SUITES", ")", "result", "=", "Security", ".", "SSLSetEnabledCiphers", "(", "self", ".", "con...
https://github.com/alanhamlett/pip-update-requirements/blob/ce875601ef278c8ce00ad586434a978731525561/pur/packages/pip/_vendor/urllib3/contrib/securetransport.py#L335-L346
tcgoetz/GarminDB
55796eb621df9f6ecd92f16b3a53393d23c0b4dc
garmindb/garmindb/monitoring_db.py
python
Monitoring.get_stats
(cls, session, func, start_ts, end_ts)
return { 'steps': func(session, cls.steps, start_ts, end_ts), 'calories_active_avg': ( cls.get_active_calories(session, fitfile.field_enums.ActivityType.running, start_ts, end_ts) + cls.get_active_calories(session, fitfile.field_enums.ActivityType.cycling, start_t...
Return a dict of stats for table entries within the time span.
Return a dict of stats for table entries within the time span.
[ "Return", "a", "dict", "of", "stats", "for", "table", "entries", "within", "the", "time", "span", "." ]
def get_stats(cls, session, func, start_ts, end_ts): """Return a dict of stats for table entries within the time span.""" return { 'steps': func(session, cls.steps, start_ts, end_ts), 'calories_active_avg': ( cls.get_active_calories(session, fitfile.field_enums.Ac...
[ "def", "get_stats", "(", "cls", ",", "session", ",", "func", ",", "start_ts", ",", "end_ts", ")", ":", "return", "{", "'steps'", ":", "func", "(", "session", ",", "cls", ".", "steps", ",", "start_ts", ",", "end_ts", ")", ",", "'calories_active_avg'", "...
https://github.com/tcgoetz/GarminDB/blob/55796eb621df9f6ecd92f16b3a53393d23c0b4dc/garmindb/garmindb/monitoring_db.py#L220-L229
IntelLabs/coach
dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d
rl_coach/architectures/tensorflow_components/architecture.py
python
TensorFlowArchitecture.get_model
(self)
Constructs the model using `network_parameters` and sets `input_embedders`, `middleware`, `output_heads`, `outputs`, `losses`, `total_loss`, `adaptive_learning_rate_scheme`, `current_learning_rate`, and `optimizer`. :return: A list of the model's weights
Constructs the model using `network_parameters` and sets `input_embedders`, `middleware`, `output_heads`, `outputs`, `losses`, `total_loss`, `adaptive_learning_rate_scheme`, `current_learning_rate`, and `optimizer`.
[ "Constructs", "the", "model", "using", "network_parameters", "and", "sets", "input_embedders", "middleware", "output_heads", "outputs", "losses", "total_loss", "adaptive_learning_rate_scheme", "current_learning_rate", "and", "optimizer", "." ]
def get_model(self) -> List: """ Constructs the model using `network_parameters` and sets `input_embedders`, `middleware`, `output_heads`, `outputs`, `losses`, `total_loss`, `adaptive_learning_rate_scheme`, `current_learning_rate`, and `optimizer`. :return: A list of the model's...
[ "def", "get_model", "(", "self", ")", "->", "List", ":", "raise", "NotImplementedError" ]
https://github.com/IntelLabs/coach/blob/dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d/rl_coach/architectures/tensorflow_components/architecture.py#L144-L152
EOA-AILab/NER-Chinese
6df4a63a67936c356c578ac68ad49841ac0c9ebc
bert_ner/bert_ner/bert_base/server/zmq_decor.py
python
_SocketDecorator.process_decorator_args
(self, *args, **kwargs)
return kw_name, args, kwargs
Also grab context_name out of kwargs
Also grab context_name out of kwargs
[ "Also", "grab", "context_name", "out", "of", "kwargs" ]
def process_decorator_args(self, *args, **kwargs): """Also grab context_name out of kwargs""" kw_name, args, kwargs = super(_SocketDecorator, self).process_decorator_args(*args, **kwargs) self.context_name = kwargs.pop('context_name', 'context') return kw_name, args, kwargs
[ "def", "process_decorator_args", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kw_name", ",", "args", ",", "kwargs", "=", "super", "(", "_SocketDecorator", ",", "self", ")", ".", "process_decorator_args", "(", "*", "args", ",", "*", ...
https://github.com/EOA-AILab/NER-Chinese/blob/6df4a63a67936c356c578ac68ad49841ac0c9ebc/bert_ner/bert_ner/bert_base/server/zmq_decor.py#L35-L39
inkandswitch/livebook
93c8d467734787366ad084fc3566bf5cbe249c51
public/pypyjs/modules/cgitb.py
python
reset
()
return '''<!--: spam Content-Type: text/html <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> --> </font> </font> </font> </script> </object> </blockquote> </pre> </table> </table> </table> </table> </table> </font> </font> </font>'''
Return a string that resets the CGI and browser to a known state.
Return a string that resets the CGI and browser to a known state.
[ "Return", "a", "string", "that", "resets", "the", "CGI", "and", "browser", "to", "a", "known", "state", "." ]
def reset(): """Return a string that resets the CGI and browser to a known state.""" return '''<!--: spam Content-Type: text/html <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> <body bgcolor="#f0f0f8"><font color="#f0f0f8" size="-5"> --> --> </font> </font> </font> </script> </object> </blockquot...
[ "def", "reset", "(", ")", ":", "return", "'''<!--: spam\nContent-Type: text/html\n\n<body bgcolor=\"#f0f0f8\"><font color=\"#f0f0f8\" size=\"-5\"> -->\n<body bgcolor=\"#f0f0f8\"><font color=\"#f0f0f8\" size=\"-5\"> --> -->\n</font> </font> </font> </script> </object> </blockquote> </pre>\n</table> </tab...
https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/cgitb.py#L36-L44
django-oscar/django-oscar
ffcc530844d40283b6b1552778a140536b904f5f
src/oscar/apps/payment/bankcards.py
python
luhn
(card_number)
return (sum % 10) == 0
Test whether a bankcard number passes the Luhn algorithm.
Test whether a bankcard number passes the Luhn algorithm.
[ "Test", "whether", "a", "bankcard", "number", "passes", "the", "Luhn", "algorithm", "." ]
def luhn(card_number): """ Test whether a bankcard number passes the Luhn algorithm. """ card_number = str(card_number) sum = 0 num_digits = len(card_number) odd_even = num_digits & 1 for i in range(0, num_digits): digit = int(card_number[i]) if not ((i & 1) ^ odd_even):...
[ "def", "luhn", "(", "card_number", ")", ":", "card_number", "=", "str", "(", "card_number", ")", "sum", "=", "0", "num_digits", "=", "len", "(", "card_number", ")", "odd_even", "=", "num_digits", "&", "1", "for", "i", "in", "range", "(", "0", ",", "n...
https://github.com/django-oscar/django-oscar/blob/ffcc530844d40283b6b1552778a140536b904f5f/src/oscar/apps/payment/bankcards.py#L60-L77
EmuKit/emukit
cdcb0d070d7f1c5585260266160722b636786859
emukit/core/optimization/anchor_points_generator.py
python
ObjectiveAnchorPointsGenerator.get_anchor_point_scores
(self, X: np.ndarray)
return scores
:param X: The samples at which to evaluate the criterion :return:
:param X: The samples at which to evaluate the criterion :return:
[ ":", "param", "X", ":", "The", "samples", "at", "which", "to", "evaluate", "the", "criterion", ":", "return", ":" ]
def get_anchor_point_scores(self, X: np.ndarray) -> np.ndarray: """ :param X: The samples at which to evaluate the criterion :return: """ are_constraints_satisfied = np.all([np.ones(X.shape[0])] + [c.evaluate(X) for c in self.space.constraints], axis=0) scores = np.zeros(...
[ "def", "get_anchor_point_scores", "(", "self", ",", "X", ":", "np", ".", "ndarray", ")", "->", "np", ".", "ndarray", ":", "are_constraints_satisfied", "=", "np", ".", "all", "(", "[", "np", ".", "ones", "(", "X", ".", "shape", "[", "0", "]", ")", "...
https://github.com/EmuKit/emukit/blob/cdcb0d070d7f1c5585260266160722b636786859/emukit/core/optimization/anchor_points_generator.py#L82-L91
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/contextlib.py
python
ExitStack._push_cm_exit
(self, cm, cm_exit)
Helper to correctly register callbacks to __exit__ methods
Helper to correctly register callbacks to __exit__ methods
[ "Helper", "to", "correctly", "register", "callbacks", "to", "__exit__", "methods" ]
def _push_cm_exit(self, cm, cm_exit): """Helper to correctly register callbacks to __exit__ methods""" def _exit_wrapper(*exc_details): return cm_exit(cm, *exc_details) _exit_wrapper.__self__ = cm self.push(_exit_wrapper)
[ "def", "_push_cm_exit", "(", "self", ",", "cm", ",", "cm_exit", ")", ":", "def", "_exit_wrapper", "(", "*", "exc_details", ")", ":", "return", "cm_exit", "(", "cm", ",", "*", "exc_details", ")", "_exit_wrapper", ".", "__self__", "=", "cm", "self", ".", ...
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/contextlib.py#L278-L283
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/db/models/sql/query.py
python
Query.get_loaded_field_names
(self)
return collection
If any fields are marked to be deferred, returns a dictionary mapping models to a set of names in those fields that will be loaded. If a model is not in the returned dictionary, none of it's fields are deferred. If no fields are marked for deferral, returns an empty dictionary.
If any fields are marked to be deferred, returns a dictionary mapping models to a set of names in those fields that will be loaded. If a model is not in the returned dictionary, none of it's fields are deferred.
[ "If", "any", "fields", "are", "marked", "to", "be", "deferred", "returns", "a", "dictionary", "mapping", "models", "to", "a", "set", "of", "names", "in", "those", "fields", "that", "will", "be", "loaded", ".", "If", "a", "model", "is", "not", "in", "th...
def get_loaded_field_names(self): """ If any fields are marked to be deferred, returns a dictionary mapping models to a set of names in those fields that will be loaded. If a model is not in the returned dictionary, none of it's fields are deferred. If no fields are mark...
[ "def", "get_loaded_field_names", "(", "self", ")", ":", "collection", "=", "{", "}", "self", ".", "deferred_to_data", "(", "collection", ",", "self", ".", "get_loaded_field_names_cb", ")", "return", "collection" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/db/models/sql/query.py#L1748-L1759
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/reports/filters/base.py
python
BaseMultipleOptionFilter.get_value
(cls, request, domain)
return request.GET.getlist(cls.slug)
[]
def get_value(cls, request, domain): return request.GET.getlist(cls.slug)
[ "def", "get_value", "(", "cls", ",", "request", ",", "domain", ")", ":", "return", "request", ".", "GET", ".", "getlist", "(", "cls", ".", "slug", ")" ]
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/filters/base.py#L171-L172
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/plat-mac/ic.py
python
IC.launchurl
(self, url, hint="")
[]
def launchurl(self, url, hint=""): # Work around a bug in ICLaunchURL: file:/foo does # not work but file:///foo does. if url[:6] == 'file:/' and url[6] != '/': url = 'file:///' + url[6:] self.ic.ICLaunchURL(hint, url, 0, len(url))
[ "def", "launchurl", "(", "self", ",", "url", ",", "hint", "=", "\"\"", ")", ":", "# Work around a bug in ICLaunchURL: file:/foo does", "# not work but file:///foo does.", "if", "url", "[", ":", "6", "]", "==", "'file:/'", "and", "url", "[", "6", "]", "!=", "'/...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/plat-mac/ic.py#L200-L205
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/gdata/src/gdata/client.py
python
GDClient.client_login
(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=atom.http_core.Uri.parse_uri( 'https://www.google.com/accounts/ClientLogin'), captcha_token=None, captcha_response=None)
return self.auth_token
Performs an auth request using the user's email address and password. In order to modify user specific data and read user private data, your application must be authorized by the user. One way to demonstrage authorization is by including a Client Login token in the Authorization HTTP header of all ...
Performs an auth request using the user's email address and password. In order to modify user specific data and read user private data, your application must be authorized by the user. One way to demonstrage authorization is by including a Client Login token in the Authorization HTTP header of all ...
[ "Performs", "an", "auth", "request", "using", "the", "user", "s", "email", "address", "and", "password", ".", "In", "order", "to", "modify", "user", "specific", "data", "and", "read", "user", "private", "data", "your", "application", "must", "be", "authorize...
def client_login(self, email, password, source, service=None, account_type='HOSTED_OR_GOOGLE', auth_url=atom.http_core.Uri.parse_uri( 'https://www.google.com/accounts/ClientLogin'), captcha_token=None, captcha_response=None): """Perform...
[ "def", "client_login", "(", "self", ",", "email", ",", "password", ",", "source", ",", "service", "=", "None", ",", "account_type", "=", "'HOSTED_OR_GOOGLE'", ",", "auth_url", "=", "atom", ".", "http_core", ".", "Uri", ".", "parse_uri", "(", "'https://www.go...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/client.py#L377-L447
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/paramiko/agent.py
python
Agent.close
(self)
Close the SSH agent connection.
Close the SSH agent connection.
[ "Close", "the", "SSH", "agent", "connection", "." ]
def close(self): """ Close the SSH agent connection. """ self._close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "_close", "(", ")" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/paramiko/agent.py#L365-L369
DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow
cca574844df5fc8bbf380227725a4e3106fbc48c
libs/networks/slim_nets/mobilenet_v1.py
python
_reduced_kernel_size_for_small_input
(input_tensor, kernel_size)
return kernel_size_out
Define kernel size which is automatically reduced for small input. If the shape of the input images is unknown at graph construction time this function assumes that the input images are large enough. Args: input_tensor: input tensor of size [batch_size, height, width, channels]. kernel_size: desired ker...
Define kernel size which is automatically reduced for small input.
[ "Define", "kernel", "size", "which", "is", "automatically", "reduced", "for", "small", "input", "." ]
def _reduced_kernel_size_for_small_input(input_tensor, kernel_size): """Define kernel size which is automatically reduced for small input. If the shape of the input images is unknown at graph construction time this function assumes that the input images are large enough. Args: input_tensor: input tensor o...
[ "def", "_reduced_kernel_size_for_small_input", "(", "input_tensor", ",", "kernel_size", ")", ":", "shape", "=", "input_tensor", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "if", "shape", "[", "1", "]", "is", "None", "or", "shape", "[", "2", "]", ...
https://github.com/DetectionTeamUCAS/RRPN_Faster-RCNN_Tensorflow/blob/cca574844df5fc8bbf380227725a4e3106fbc48c/libs/networks/slim_nets/mobilenet_v1.py#L338-L357
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
itn
(n, digits=8, format=DEFAULT_FORMAT)
return s
Convert a python number to a number field.
Convert a python number to a number field.
[ "Convert", "a", "python", "number", "to", "a", "number", "field", "." ]
def itn(n, digits=8, format=DEFAULT_FORMAT): """Convert a python number to a number field. """ # POSIX 1003.1-1988 requires numbers to be encoded as a string of # octal digits followed by a null-byte, this allows values up to # (8**(digits-1))-1. GNU tar allows storing numbers greater than # tha...
[ "def", "itn", "(", "n", ",", "digits", "=", "8", ",", "format", "=", "DEFAULT_FORMAT", ")", ":", "# POSIX 1003.1-1988 requires numbers to be encoded as a string of", "# octal digits followed by a null-byte, this allows values up to", "# (8**(digits-1))-1. GNU tar allows storing numbe...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L216-L241
LinuxCNC/simple-gcode-generators
d06c2750fe03c41becd6bd5863ace54b52920155
counterbore/counterbore.py
python
Application.__init__
(self, master=None)
[]
def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.createMenu() self.createWidgets()
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ")", ":", "Frame", ".", "__init__", "(", "self", ",", "master", ")", "self", ".", "grid", "(", ")", "self", ".", "createMenu", "(", ")", "self", ".", "createWidgets", "(", ")" ]
https://github.com/LinuxCNC/simple-gcode-generators/blob/d06c2750fe03c41becd6bd5863ace54b52920155/counterbore/counterbore.py#L47-L51
cloudera/impyla
0c736af4cad2bade9b8e313badc08ec50e81c948
impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py
python
get_table_column_statistics_args.__init__
(self, db_name=None, tbl_name=None, col_name=None,)
[]
def __init__(self, db_name=None, tbl_name=None, col_name=None,): self.db_name = db_name self.tbl_name = tbl_name self.col_name = col_name
[ "def", "__init__", "(", "self", ",", "db_name", "=", "None", ",", "tbl_name", "=", "None", ",", "col_name", "=", "None", ",", ")", ":", "self", ".", "db_name", "=", "db_name", "self", ".", "tbl_name", "=", "tbl_name", "self", ".", "col_name", "=", "c...
https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ThriftHiveMetastore.py#L25945-L25948
docker/docker-py
a48a5a9647761406d66e8271f19fab7fa0c5f582
docker/models/plugins.py
python
Plugin.remove
(self, force=False)
return self.client.api.remove_plugin(self.name, force=force)
Remove the plugin from the server. Args: force (bool): Remove even if the plugin is enabled. Default: False Raises: :py:class:`docker.errors.APIError` If the server returns an error.
Remove the plugin from the server.
[ "Remove", "the", "plugin", "from", "the", "server", "." ]
def remove(self, force=False): """ Remove the plugin from the server. Args: force (bool): Remove even if the plugin is enabled. Default: False Raises: :py:class:`docker.errors.APIError` If the server re...
[ "def", "remove", "(", "self", ",", "force", "=", "False", ")", ":", "return", "self", ".", "client", ".", "api", ".", "remove_plugin", "(", "self", ".", "name", ",", "force", "=", "force", ")" ]
https://github.com/docker/docker-py/blob/a48a5a9647761406d66e8271f19fab7fa0c5f582/docker/models/plugins.py#L86-L98
bdarnell/plop
1f026fce98d52508f42e67444c1a3a046f4901db
plop/callgraph.py
python
Node.__repr__
(self)
return 'Node(%s)' % (self.id,)
[]
def __repr__(self): return 'Node(%s)' % (self.id,)
[ "def", "__repr__", "(", "self", ")", ":", "return", "'Node(%s)'", "%", "(", "self", ".", "id", ",", ")" ]
https://github.com/bdarnell/plop/blob/1f026fce98d52508f42e67444c1a3a046f4901db/plop/callgraph.py#L17-L18
kanzure/nanoengineer
874e4c9f8a9190f093625b267f9767e19f82e6c4
cad/src/dna/commands/InsertDna/InsertDna_PropertyManager.py
python
InsertDna_PropertyManager.__init__
( self, command )
Constructor for the DNA Duplex property manager.
Constructor for the DNA Duplex property manager.
[ "Constructor", "for", "the", "DNA", "Duplex", "property", "manager", "." ]
def __init__( self, command ): """ Constructor for the DNA Duplex property manager. """ self.endPoint1 = None self.endPoint2 = None self._conformation = "B-DNA" self._numberOfBases = 0 self._basesPerTurn = getDuplexBasesPerTurn(self._conformation) ...
[ "def", "__init__", "(", "self", ",", "command", ")", ":", "self", ".", "endPoint1", "=", "None", "self", ".", "endPoint2", "=", "None", "self", ".", "_conformation", "=", "\"B-DNA\"", "self", ".", "_numberOfBases", "=", "0", "self", ".", "_basesPerTurn", ...
https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/dna/commands/InsertDna/InsertDna_PropertyManager.py#L78-L97
davidbau/ganseeing
93cea2c8f391aef001ddf9dcb35c43990681a47c
seeing/workerpool.py
python
WorkerPool.__init__
(self, worker=WorkerBase, process_count=None, **initargs)
[]
def __init__(self, worker=WorkerBase, process_count=None, **initargs): global active_pools if process_count is None: process_count = cpu_count() if process_count == 0: # zero process_count uses only main process, for debugging. self.queue = None se...
[ "def", "__init__", "(", "self", ",", "worker", "=", "WorkerBase", ",", "process_count", "=", "None", ",", "*", "*", "initargs", ")", ":", "global", "active_pools", "if", "process_count", "is", "None", ":", "process_count", "=", "cpu_count", "(", ")", "if",...
https://github.com/davidbau/ganseeing/blob/93cea2c8f391aef001ddf9dcb35c43990681a47c/seeing/workerpool.py#L82-L103
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/tkinter/__init__.py
python
Canvas.icursor
(self, *args)
Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.
Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.
[ "Set", "cursor", "at", "position", "POS", "in", "the", "item", "identified", "by", "TAGORID", ".", "In", "ARGS", "TAGORID", "must", "be", "first", "." ]
def icursor(self, *args): """Set cursor at position POS in the item identified by TAGORID. In ARGS TAGORID must be first.""" self.tk.call((self._w, 'icursor') + args)
[ "def", "icursor", "(", "self", ",", "*", "args", ")", ":", "self", ".", "tk", ".", "call", "(", "(", "self", ".", "_w", ",", "'icursor'", ")", "+", "args", ")" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L2395-L2398
Fantomas42/django-blog-zinnia
881101a9d1d455b2fc581d6f4ae0947cdd8126c6
zinnia/feeds.py
python
DiscussionFeed.item_link
(self, item)
return item.get_absolute_url()
URL of the discussion item.
URL of the discussion item.
[ "URL", "of", "the", "discussion", "item", "." ]
def item_link(self, item): """ URL of the discussion item. """ return item.get_absolute_url()
[ "def", "item_link", "(", "self", ",", "item", ")", ":", "return", "item", ".", "get_absolute_url", "(", ")" ]
https://github.com/Fantomas42/django-blog-zinnia/blob/881101a9d1d455b2fc581d6f4ae0947cdd8126c6/zinnia/feeds.py#L364-L368
nosmokingbandit/Watcher3
0217e75158b563bdefc8e01c3be7620008cf3977
lib/sqlalchemy/orm/events.py
python
MapperEvents.before_insert
(self, mapper, connection, target)
Receive an object instance before an INSERT statement is emitted corresponding to that instance. This event is used to modify local, non-object related attributes on the instance before an INSERT occurs, as well as to emit additional SQL statements on the given connection. ...
Receive an object instance before an INSERT statement is emitted corresponding to that instance.
[ "Receive", "an", "object", "instance", "before", "an", "INSERT", "statement", "is", "emitted", "corresponding", "to", "that", "instance", "." ]
def before_insert(self, mapper, connection, target): """Receive an object instance before an INSERT statement is emitted corresponding to that instance. This event is used to modify local, non-object related attributes on the instance before an INSERT occurs, as well as to emit ...
[ "def", "before_insert", "(", "self", ",", "mapper", ",", "connection", ",", "target", ")", ":" ]
https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/sqlalchemy/orm/events.py#L812-L856
theAIGuysCode/yolov3_deepsort
a325e9f93d406b2e137e5e071b4b350ca9380545
deep_sort/kalman_filter.py
python
KalmanFilter.predict
(self, mean, covariance)
return mean, covariance
Run Kalman filter prediction step. Parameters ---------- mean : ndarray The 8 dimensional mean vector of the object state at the previous time step. covariance : ndarray The 8x8 dimensional covariance matrix of the object state at the prev...
Run Kalman filter prediction step.
[ "Run", "Kalman", "filter", "prediction", "step", "." ]
def predict(self, mean, covariance): """Run Kalman filter prediction step. Parameters ---------- mean : ndarray The 8 dimensional mean vector of the object state at the previous time step. covariance : ndarray The 8x8 dimensional covariance ma...
[ "def", "predict", "(", "self", ",", "mean", ",", "covariance", ")", ":", "std_pos", "=", "[", "self", ".", "_std_weight_position", "*", "mean", "[", "3", "]", ",", "self", ".", "_std_weight_position", "*", "mean", "[", "3", "]", ",", "1e-2", ",", "se...
https://github.com/theAIGuysCode/yolov3_deepsort/blob/a325e9f93d406b2e137e5e071b4b350ca9380545/deep_sort/kalman_filter.py#L88-L123
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
windows/Resources/Python/Override/Lib/multiprocessing/sharedctypes.py
python
Value
(typecode_or_type, *args, **kwds)
return synchronized(obj, lock)
Return a synchronization wrapper for a Value
Return a synchronization wrapper for a Value
[ "Return", "a", "synchronization", "wrapper", "for", "a", "Value" ]
def Value(typecode_or_type, *args, **kwds): ''' Return a synchronization wrapper for a Value ''' lock = kwds.pop('lock', None) if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawValue(typecode_or_type, *args) if lock is False: return obj ...
[ "def", "Value", "(", "typecode_or_type", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "lock", "=", "kwds", ".", "pop", "(", "'lock'", ",", "None", ")", "if", "kwds", ":", "raise", "ValueError", "(", "'unrecognized keyword argument(s): %s'", "%", "k...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/windows/Resources/Python/Override/Lib/multiprocessing/sharedctypes.py#L92-L106
boxeehacks/boxeehack
bdfa63187f662b542261dce64aff68548f63ecaf
hack/boxee/scripts/OpenSubtitles/resources/lib/plugins/BeautifulSoup.py
python
BeautifulStoneSoup.handle_decl
(self, data)
Handle DOCTYPEs and the like as Declaration objects.
Handle DOCTYPEs and the like as Declaration objects.
[ "Handle", "DOCTYPEs", "and", "the", "like", "as", "Declaration", "objects", "." ]
def handle_decl(self, data): "Handle DOCTYPEs and the like as Declaration objects." self._toStringSubclass(data, Declaration)
[ "def", "handle_decl", "(", "self", ",", "data", ")", ":", "self", ".", "_toStringSubclass", "(", "data", ",", "Declaration", ")" ]
https://github.com/boxeehacks/boxeehack/blob/bdfa63187f662b542261dce64aff68548f63ecaf/hack/boxee/scripts/OpenSubtitles/resources/lib/plugins/BeautifulSoup.py#L1446-L1448
google-research/mixmatch
1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e
libml/utils.py
python
ilog2
(x)
return int(np.ceil(np.log2(x)))
Integer log2.
Integer log2.
[ "Integer", "log2", "." ]
def ilog2(x): """Integer log2.""" return int(np.ceil(np.log2(x)))
[ "def", "ilog2", "(", "x", ")", ":", "return", "int", "(", "np", ".", "ceil", "(", "np", ".", "log2", "(", "x", ")", ")", ")" ]
https://github.com/google-research/mixmatch/blob/1011a1d51eaa9ca6f5dba02096a848d1fe3fc38e/libml/utils.py#L51-L53
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/groups/generic.py
python
structure_description
(G, latex=False)
return description
r""" Return a string that tries to describe the structure of ``G``. This methods wraps GAP's ``StructureDescription`` method. For full details, including the form of the returned string and the algorithm to build it, see `GAP's documentation <https://www.gap-system.org/Manuals/doc/ref/chap39.html>...
r""" Return a string that tries to describe the structure of ``G``.
[ "r", "Return", "a", "string", "that", "tries", "to", "describe", "the", "structure", "of", "G", "." ]
def structure_description(G, latex=False): r""" Return a string that tries to describe the structure of ``G``. This methods wraps GAP's ``StructureDescription`` method. For full details, including the form of the returned string and the algorithm to build it, see `GAP's documentation <https://...
[ "def", "structure_description", "(", "G", ",", "latex", "=", "False", ")", ":", "import", "re", "def", "correct_dihedral_degree", "(", "match", ")", ":", "return", "\"%sD%d\"", "%", "(", "match", ".", "group", "(", "1", ")", ",", "int", "(", "match", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/groups/generic.py#L1351-L1428
AutodeskRoboticsLab/Mimic
85447f0d346be66988303a6a054473d92f1ed6f4
mFIZ/scripts/mFIZ_extern/serial/serialcli.py
python
Serial.reset_output_buffer
(self)
\ Clear output buffer, aborting the current output and discarding all that is in the buffer.
\ Clear output buffer, aborting the current output and discarding all that is in the buffer.
[ "\\", "Clear", "output", "buffer", "aborting", "the", "current", "output", "and", "discarding", "all", "that", "is", "in", "the", "buffer", "." ]
def reset_output_buffer(self): """\ Clear output buffer, aborting the current output and discarding all that is in the buffer. """ if not self.is_open: raise portNotOpenError self._port_handle.DiscardOutBuffer()
[ "def", "reset_output_buffer", "(", "self", ")", ":", "if", "not", "self", ".", "is_open", ":", "raise", "portNotOpenError", "self", ".", "_port_handle", ".", "DiscardOutBuffer", "(", ")" ]
https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mFIZ/scripts/mFIZ_extern/serial/serialcli.py#L192-L199
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/modulestore/__init__.py
python
BulkOperationsMixin._start_outermost_bulk_operation
(self, bulk_ops_record, course_key, ignore_case=False)
The outermost nested bulk_operation call: do the actual begin of the bulk operation. Implementing classes must override this method; otherwise, the bulk operations are a noop
The outermost nested bulk_operation call: do the actual begin of the bulk operation.
[ "The", "outermost", "nested", "bulk_operation", "call", ":", "do", "the", "actual", "begin", "of", "the", "bulk", "operation", "." ]
def _start_outermost_bulk_operation(self, bulk_ops_record, course_key, ignore_case=False): """ The outermost nested bulk_operation call: do the actual begin of the bulk operation. Implementing classes must override this method; otherwise, the bulk operations are a noop """ pass
[ "def", "_start_outermost_bulk_operation", "(", "self", ",", "bulk_ops_record", ",", "course_key", ",", "ignore_case", "=", "False", ")", ":", "pass" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/__init__.py#L231-L237
CedricGuillemet/Imogen
ee417b42747ed5b46cb11b02ef0c3630000085b3
bin/Lib/http/server.py
python
CGIHTTPRequestHandler.do_POST
(self)
Serve a POST request. This is only implemented for CGI scripts.
Serve a POST request.
[ "Serve", "a", "POST", "request", "." ]
def do_POST(self): """Serve a POST request. This is only implemented for CGI scripts. """ if self.is_cgi(): self.run_cgi() else: self.send_error( HTTPStatus.NOT_IMPLEMENTED, "Can only POST to CGI scripts")
[ "def", "do_POST", "(", "self", ")", ":", "if", "self", ".", "is_cgi", "(", ")", ":", "self", ".", "run_cgi", "(", ")", "else", ":", "self", ".", "send_error", "(", "HTTPStatus", ".", "NOT_IMPLEMENTED", ",", "\"Can only POST to CGI scripts\"", ")" ]
https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/http/server.py#L971-L983
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/addons/account/account_bank_statement.py
python
account_bank_statement_line._get_exchange_lines
(self, cr, uid, st_line, mv_line, currency_diff, currency_id, move_id, context=None)
return (move_line, move_line_counterpart)
Prepare the two lines in company currency due to currency rate difference. :param line: browse record of the voucher.line for which we want to create currency rate difference accounting entries :param move_id: Account move wher the move lines will be. :param currency_diff: Amount to...
Prepare the two lines in company currency due to currency rate difference.
[ "Prepare", "the", "two", "lines", "in", "company", "currency", "due", "to", "currency", "rate", "difference", "." ]
def _get_exchange_lines(self, cr, uid, st_line, mv_line, currency_diff, currency_id, move_id, context=None): ''' Prepare the two lines in company currency due to currency rate difference. :param line: browse record of the voucher.line for which we want to create currency rate difference account...
[ "def", "_get_exchange_lines", "(", "self", ",", "cr", ",", "uid", ",", "st_line", ",", "mv_line", ",", "currency_diff", ",", "currency_id", ",", "move_id", ",", "context", "=", "None", ")", ":", "if", "currency_diff", ">", "0", ":", "exchange_account_id", ...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/account/account_bank_statement.py#L729-L781
hustlzp/Flask-Boost
d0308408ebb248dd752b77123b845f8ec637fab2
flask_boost/project/application/controllers/account.py
python
signup
()
return render_template('account/signup/signup.html', form=form)
Signup
Signup
[ "Signup" ]
def signup(): """Signup""" form = SignupForm() if form.validate_on_submit(): params = form.data.copy() params.pop('repassword') user = User(**params) db.session.add(user) db.session.commit() signin_user(user) return redirect(url_for('site.index')) ...
[ "def", "signup", "(", ")", ":", "form", "=", "SignupForm", "(", ")", "if", "form", ".", "validate_on_submit", "(", ")", ":", "params", "=", "form", ".", "data", ".", "copy", "(", ")", "params", ".", "pop", "(", "'repassword'", ")", "user", "=", "Us...
https://github.com/hustlzp/Flask-Boost/blob/d0308408ebb248dd752b77123b845f8ec637fab2/flask_boost/project/application/controllers/account.py#L24-L35
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/urllib2.py
python
parse_http_list
(s)
return [part.strip() for part in res]
Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes count if they are escaped. O...
Parse lists as described by RFC 2068 Section 2.
[ "Parse", "lists", "as", "described", "by", "RFC", "2068", "Section", "2", "." ]
def parse_http_list(s): """Parse lists as described by RFC 2068 Section 2. In particular, parse comma-separated lists where the elements of the list may include quoted-strings. A quoted-string could contain a comma. A non-quoted string could have quotes in the middle. Neither commas nor quotes c...
[ "def", "parse_http_list", "(", "s", ")", ":", "res", "=", "[", "]", "part", "=", "''", "escape", "=", "quote", "=", "False", "for", "cur", "in", "s", ":", "if", "escape", ":", "part", "+=", "cur", "escape", "=", "False", "continue", "if", "quote", ...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/urllib2.py#L1277-L1318
ehForwarderBot/efb-wechat-slave
36a94c5e5f2fe5dc7247448cf37d5e8b653e8990
efb_wechat_slave/vendor/itchat/core.py
python
Core.set_alias
(self, userName, alias)
set alias for a friend for options - userName: 'UserName' key of info dict - alias: new alias it is defined in components/contact.py
set alias for a friend for options - userName: 'UserName' key of info dict - alias: new alias it is defined in components/contact.py
[ "set", "alias", "for", "a", "friend", "for", "options", "-", "userName", ":", "UserName", "key", "of", "info", "dict", "-", "alias", ":", "new", "alias", "it", "is", "defined", "in", "components", "/", "contact", ".", "py" ]
def set_alias(self, userName, alias): """ set alias for a friend for options - userName: 'UserName' key of info dict - alias: new alias it is defined in components/contact.py """ raise NotImplementedError()
[ "def", "set_alias", "(", "self", ",", "userName", ",", "alias", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/ehForwarderBot/efb-wechat-slave/blob/36a94c5e5f2fe5dc7247448cf37d5e8b653e8990/efb_wechat_slave/vendor/itchat/core.py#L227-L234
facebookresearch/pytext
1a4e184b233856fcfb9997d74f167cbf5bbbfb8d
pytext/models/semantic_parsers/rnng/rnng_parser.py
python
RNNGParserBase.__init__
( self, ablation: Config.AblationParams, constraints: Config.RNNGConstraints, lstm_num_layers: int, lstm_dim: int, max_open_NT: int, dropout: float, actions_vocab, shift_idx: int, reduce_idx: int, ignore_subNTs_roots: List[int], ...
Initialize the model Args: ablation : AblationParams Features/RNNs to use constraints : RNNGConstraints Constraints to use when computing valid actions lstm_num_layers : int number of layers in the LSTMs lstm_dim : int size of LSTM...
Initialize the model
[ "Initialize", "the", "model" ]
def __init__( self, ablation: Config.AblationParams, constraints: Config.RNNGConstraints, lstm_num_layers: int, lstm_dim: int, max_open_NT: int, dropout: float, actions_vocab, shift_idx: int, reduce_idx: int, ignore_subNTs_roots: Li...
[ "def", "__init__", "(", "self", ",", "ablation", ":", "Config", ".", "AblationParams", ",", "constraints", ":", "Config", ".", "RNNGConstraints", ",", "lstm_num_layers", ":", "int", ",", "lstm_dim", ":", "int", ",", "max_open_NT", ":", "int", ",", "dropout",...
https://github.com/facebookresearch/pytext/blob/1a4e184b233856fcfb9997d74f167cbf5bbbfb8d/pytext/models/semantic_parsers/rnng/rnng_parser.py#L166-L293
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
src/transformers/models/albert/modeling_flax_albert.py
python
FlaxAlbertLayer.__call__
( self, hidden_states, attention_mask, deterministic: bool = True, output_attentions: bool = False, )
return outputs
[]
def __call__( self, hidden_states, attention_mask, deterministic: bool = True, output_attentions: bool = False, ): attention_outputs = self.attention( hidden_states, attention_mask, deterministic=deterministic, output_attentions=output_attentions )...
[ "def", "__call__", "(", "self", ",", "hidden_states", ",", "attention_mask", ",", "deterministic", ":", "bool", "=", "True", ",", "output_attentions", ":", "bool", "=", "False", ",", ")", ":", "attention_outputs", "=", "self", ".", "attention", "(", "hidden_...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/albert/modeling_flax_albert.py#L299-L320
beancount/beancount
cb3526a1af95b3b5be70347470c381b5a86055fe
beancount/core/position.py
python
Position.__str__
(self)
return self.to_string()
Return a string representation of the position. Returns: A string, a printable representation of the position.
Return a string representation of the position.
[ "Return", "a", "string", "representation", "of", "the", "position", "." ]
def __str__(self): """Return a string representation of the position. Returns: A string, a printable representation of the position. """ return self.to_string()
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "to_string", "(", ")" ]
https://github.com/beancount/beancount/blob/cb3526a1af95b3b5be70347470c381b5a86055fe/beancount/core/position.py#L192-L198
jlhutch/pylru
6411a3cf50ea96f513784c49b7154e49f54df3e8
pylru.py
python
lrucache.get
(self, key, default=None)
return self[key]
Get an item - return default (None) if not present
Get an item - return default (None) if not present
[ "Get", "an", "item", "-", "return", "default", "(", "None", ")", "if", "not", "present" ]
def get(self, key, default=None): """Get an item - return default (None) if not present""" if key not in self.table: return default return self[key]
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "not", "in", "self", ".", "table", ":", "return", "default", "return", "self", "[", "key", "]" ]
https://github.com/jlhutch/pylru/blob/6411a3cf50ea96f513784c49b7154e49f54df3e8/pylru.py#L101-L106
goace/personal-file-sharing-center
4a5b903b003f2db1306e77c5e51b6660fc5dbc6a
web/webapi.py
python
UnsupportedMediaType.__init__
(self, message=None)
[]
def __init__(self, message=None): status = "415 Unsupported Media Type" headers = {'Content-Type': 'text/html'} HTTPError.__init__(self, status, headers, message or self.message)
[ "def", "__init__", "(", "self", ",", "message", "=", "None", ")", ":", "status", "=", "\"415 Unsupported Media Type\"", "headers", "=", "{", "'Content-Type'", ":", "'text/html'", "}", "HTTPError", ".", "__init__", "(", "self", ",", "status", ",", "headers", ...
https://github.com/goace/personal-file-sharing-center/blob/4a5b903b003f2db1306e77c5e51b6660fc5dbc6a/web/webapi.py#L232-L235
happinesslz/TANet
2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f
second.pytorch_with_TANet/second/kittiviewer/control_panel.py
python
QColorButton.setColor
(self, color)
[]
def setColor(self, color): if color != self._color: self._color = color self.colorChanged.emit() if self._color is not None: self.setStyleSheet(f"background-color: {QColor(self._color).name()};") else: self.setStyleSheet("")
[ "def", "setColor", "(", "self", ",", "color", ")", ":", "if", "color", "!=", "self", ".", "_color", ":", "self", ".", "_color", "=", "color", "self", ".", "colorChanged", ".", "emit", "(", ")", "if", "self", ".", "_color", "is", "not", "None", ":",...
https://github.com/happinesslz/TANet/blob/2d4b2ab99b8e57c03671b0f1531eab7dca8f3c1f/second.pytorch_with_TANet/second/kittiviewer/control_panel.py#L139-L147
F8LEFT/DecLLVM
d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c
python/idaapi.py
python
cfuncptr_t.set_user_cmt
(self, *args)
return _idaapi.cfuncptr_t_set_user_cmt(self, *args)
set_user_cmt(self, loc, cmt)
set_user_cmt(self, loc, cmt)
[ "set_user_cmt", "(", "self", "loc", "cmt", ")" ]
def set_user_cmt(self, *args): """ set_user_cmt(self, loc, cmt) """ return _idaapi.cfuncptr_t_set_user_cmt(self, *args)
[ "def", "set_user_cmt", "(", "self", ",", "*", "args", ")", ":", "return", "_idaapi", ".", "cfuncptr_t_set_user_cmt", "(", "self", ",", "*", "args", ")" ]
https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L34145-L34149
jaraco/irc
19859340b2ad3bffc58d842a7657fae9ec3563f8
irc/client.py
python
ServerConnection.get_server_name
(self)
return self.real_server_name or ""
Get the (real) server name. This method returns the (real) server name, or, more specifically, what the server calls itself.
Get the (real) server name.
[ "Get", "the", "(", "real", ")", "server", "name", "." ]
def get_server_name(self): """Get the (real) server name. This method returns the (real) server name, or, more specifically, what the server calls itself. """ return self.real_server_name or ""
[ "def", "get_server_name", "(", "self", ")", ":", "return", "self", ".", "real_server_name", "or", "\"\"" ]
https://github.com/jaraco/irc/blob/19859340b2ad3bffc58d842a7657fae9ec3563f8/irc/client.py#L217-L223
datactive/bigbang
d4fef7eb41ae04e51f4e369de5a721c66231202b
bigbang/ingress/utils.py
python
get_website_content
( url: str, session: Optional[requests.Session] = None, )
Get HTML code from website Note ---- Servers don't like it when one is sending too many requests from same ip address in short period of time. Therefore we need to: a) catch 'requests.exceptions.RequestException' errors (includes all possible errors to be on the safe side), ...
Get HTML code from website
[ "Get", "HTML", "code", "from", "website" ]
def get_website_content( url: str, session: Optional[requests.Session] = None, ) -> Union[str, BeautifulSoup]: """ Get HTML code from website Note ---- Servers don't like it when one is sending too many requests from same ip address in short period of time. Therefore we need to: ...
[ "def", "get_website_content", "(", "url", ":", "str", ",", "session", ":", "Optional", "[", "requests", ".", "Session", "]", "=", "None", ",", ")", "->", "Union", "[", "str", ",", "BeautifulSoup", "]", ":", "# TODO: include option to change BeautifulSoup args", ...
https://github.com/datactive/bigbang/blob/d4fef7eb41ae04e51f4e369de5a721c66231202b/bigbang/ingress/utils.py#L30-L66
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/permutation.py
python
Permutation.retract_plain
(self, m)
return Permutations(m)(p[:m])
r""" Return the plain retract of the permutation ``self`` in `S_n` to `S_m`, where `m \leq n`. If this retract is undefined, then ``None`` is returned. If `p \in S_n` is a permutation, and `m` is a nonnegative integer less or equal to `n`, then the plain retract of `p` to `S_m` ...
r""" Return the plain retract of the permutation ``self`` in `S_n` to `S_m`, where `m \leq n`. If this retract is undefined, then ``None`` is returned.
[ "r", "Return", "the", "plain", "retract", "of", "the", "permutation", "self", "in", "S_n", "to", "S_m", "where", "m", "\\", "leq", "n", ".", "If", "this", "retract", "is", "undefined", "then", "None", "is", "returned", "." ]
def retract_plain(self, m): r""" Return the plain retract of the permutation ``self`` in `S_n` to `S_m`, where `m \leq n`. If this retract is undefined, then ``None`` is returned. If `p \in S_n` is a permutation, and `m` is a nonnegative integer less or equal to `n`, the...
[ "def", "retract_plain", "(", "self", ",", "m", ")", ":", "n", "=", "len", "(", "self", ")", "p", "=", "list", "(", "self", ")", "for", "i", "in", "range", "(", "m", ",", "n", ")", ":", "if", "p", "[", "i", "]", "!=", "i", "+", "1", ":", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/permutation.py#L4778-L4818
napari/napari
dbf4158e801fa7a429de8ef1cdee73bf6d64c61e
napari/utils/colormaps/vendored/colors.py
python
LightSource.__init__
(self, azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1, hsv_min_sat=1, hsv_max_sat=0)
Specify the azimuth (measured clockwise from south) and altitude (measured up from the plane of the surface) of the light source in degrees. Parameters ---------- azdeg : number, optional The azimuth (0-360, degrees clockwise from North) of the light sour...
Specify the azimuth (measured clockwise from south) and altitude (measured up from the plane of the surface) of the light source in degrees.
[ "Specify", "the", "azimuth", "(", "measured", "clockwise", "from", "south", ")", "and", "altitude", "(", "measured", "up", "from", "the", "plane", "of", "the", "surface", ")", "of", "the", "light", "source", "in", "degrees", "." ]
def __init__(self, azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1, hsv_min_sat=1, hsv_max_sat=0): """ Specify the azimuth (measured clockwise from south) and altitude (measured up from the plane of the surface) of the light source in degrees. Parameters ...
[ "def", "__init__", "(", "self", ",", "azdeg", "=", "315", ",", "altdeg", "=", "45", ",", "hsv_min_val", "=", "0", ",", "hsv_max_val", "=", "1", ",", "hsv_min_sat", "=", "1", ",", "hsv_max_sat", "=", "0", ")", ":", "self", ".", "azdeg", "=", "azdeg"...
https://github.com/napari/napari/blob/dbf4158e801fa7a429de8ef1cdee73bf6d64c61e/napari/utils/colormaps/vendored/colors.py#L1378-L1407
jparkhill/TensorMol
d52104dc7ee46eec8301d332a95d672270ac0bd1
TensorMol/Containers/TensorMolData.py
python
TensorMolData.RawBatch
(self,nmol = 4096)
return Ins,Outs
Shimmy Shimmy Ya Shimmy Ya Shimmy Yay. This type of batch is not built beforehand because there's no real digestion involved. Args: nmol: number of molecules to put in the output. Returns: Ins: a #atomsX4 tensor (AtNum,x,y,z) Outs: output of the digester Keys: (nmol)X(MaxNAtoms) tensor lis...
Shimmy Shimmy Ya Shimmy Ya Shimmy Yay. This type of batch is not built beforehand because there's no real digestion involved.
[ "Shimmy", "Shimmy", "Ya", "Shimmy", "Ya", "Shimmy", "Yay", ".", "This", "type", "of", "batch", "is", "not", "built", "beforehand", "because", "there", "s", "no", "real", "digestion", "involved", "." ]
def RawBatch(self,nmol = 4096): """ Shimmy Shimmy Ya Shimmy Ya Shimmy Yay. This type of batch is not built beforehand because there's no real digestion involved. Args: nmol: number of molecules to put in the output. Returns: Ins: a #atomsX4 tensor (AtNum,x,y,z) Outs: output of the digeste...
[ "def", "RawBatch", "(", "self", ",", "nmol", "=", "4096", ")", ":", "ndone", "=", "0", "natdone", "=", "0", "self", ".", "MaxNAtoms", "=", "self", ".", "set", ".", "MaxNAtoms", "(", ")", "Ins", "=", "np", ".", "zeros", "(", "tuple", "(", "[", "...
https://github.com/jparkhill/TensorMol/blob/d52104dc7ee46eec8301d332a95d672270ac0bd1/TensorMol/Containers/TensorMolData.py#L139-L172
Pymol-Scripts/Pymol-script-repo
bcd7bb7812dc6db1595953dfa4471fa15fb68c77
modules/pdb2pqr/contrib/numpy-1.1.0/numpy/f2py/lib/extgen/setup_py.py
python
SetupPy.execute
(self, *args)
return r
Run generated setup.py file with given arguments.
Run generated setup.py file with given arguments.
[ "Run", "generated", "setup", ".", "py", "file", "with", "given", "arguments", "." ]
def execute(self, *args): """ Run generated setup.py file with given arguments. """ if not args: raise ValueError('need setup.py arguments') self.info(self.generate(dry_run=False)) cmd = [sys.executable,'setup.py'] + list(args) self.info('entering %r d...
[ "def", "execute", "(", "self", ",", "*", "args", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "'need setup.py arguments'", ")", "self", ".", "info", "(", "self", ".", "generate", "(", "dry_run", "=", "False", ")", ")", "cmd", "=", ...
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/contrib/numpy-1.1.0/numpy/f2py/lib/extgen/setup_py.py#L99-L116