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
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/functions/special/polynomials.py
python
gegenbauer._eval_conjugate
(self)
return self.func(n, a.conjugate(), x.conjugate())
[]
def _eval_conjugate(self): n, a, x = self.args return self.func(n, a.conjugate(), x.conjugate())
[ "def", "_eval_conjugate", "(", "self", ")", ":", "n", ",", "a", ",", "x", "=", "self", ".", "args", "return", "self", ".", "func", "(", "n", ",", "a", ".", "conjugate", "(", ")", ",", "x", ".", "conjugate", "(", ")", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/functions/special/polynomials.py#L402-L404
OfflineIMAP/offlineimap
e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2
offlineimap/folder/Maildir.py
python
MaildirFolder.getfullname
(self)
return self._fullname
Return the absolute file path to the Maildir folder (sans cur|new)
Return the absolute file path to the Maildir folder (sans cur|new)
[ "Return", "the", "absolute", "file", "path", "to", "the", "Maildir", "folder", "(", "sans", "cur|new", ")" ]
def getfullname(self): """Return the absolute file path to the Maildir folder (sans cur|new)""" return self._fullname
[ "def", "getfullname", "(", "self", ")", ":", "return", "self", ".", "_fullname" ]
https://github.com/OfflineIMAP/offlineimap/blob/e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2/offlineimap/folder/Maildir.py#L91-L93
GluuFederation/community-edition-setup
d0c9427ed9e3ea3d95691677b73c1402ed9ca4db
pylib/Properties.py
python
Properties.__parse
(self, lines)
Parse a list of lines and create an internal property dictionary
Parse a list of lines and create an internal property dictionary
[ "Parse", "a", "list", "of", "lines", "and", "create", "an", "internal", "property", "dictionary" ]
def __parse(self, lines): """ Parse a list of lines and create an internal property dictionary """ # Every line in the file must consist of either a comment # or a key-value pair. A key-value pair is a line consisting # of a key which is a combination of non-white space characte...
[ "def", "__parse", "(", "self", ",", "lines", ")", ":", "# Every line in the file must consist of either a comment", "# or a key-value pair. A key-value pair is a line consisting", "# of a key which is a combination of non-white space characters", "# The separator character between key-value pa...
https://github.com/GluuFederation/community-edition-setup/blob/d0c9427ed9e3ea3d95691677b73c1402ed9ca4db/pylib/Properties.py#L55-L161
prompt-toolkit/python-prompt-toolkit
e9eac2eb59ec385e81742fa2ac623d4b8de00925
prompt_toolkit/buffer.py
python
Buffer.validate_and_handle
(self)
Validate buffer and handle the accept action.
Validate buffer and handle the accept action.
[ "Validate", "buffer", "and", "handle", "the", "accept", "action", "." ]
def validate_and_handle(self) -> None: """ Validate buffer and handle the accept action. """ valid = self.validate(set_cursor=True) # When the validation succeeded, accept the input. if valid: if self.accept_handler: keep_text = self.accept_ha...
[ "def", "validate_and_handle", "(", "self", ")", "->", "None", ":", "valid", "=", "self", ".", "validate", "(", "set_cursor", "=", "True", ")", "# When the validation succeeded, accept the input.", "if", "valid", ":", "if", "self", ".", "accept_handler", ":", "ke...
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/e9eac2eb59ec385e81742fa2ac623d4b8de00925/prompt_toolkit/buffer.py#L1864-L1880
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/commands/default/account.py
python
CmdColorTest.func
(self)
Show color tables
Show color tables
[ "Show", "color", "tables" ]
def func(self): """Show color tables""" if self.args.startswith("a"): # show ansi 16-color table from evennia.utils import ansi ap = ansi.ANSI_PARSER # ansi colors # show all ansi color-related codes bright_fg = [ ...
[ "def", "func", "(", "self", ")", ":", "if", "self", ".", "args", ".", "startswith", "(", "\"a\"", ")", ":", "# show ansi 16-color table", "from", "evennia", ".", "utils", "import", "ansi", "ap", "=", "ansi", ".", "ANSI_PARSER", "# ansi colors", "# show all a...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/commands/default/account.py#L867-L944
oaubert/python-vlc
908ffdbd0844dc1849728c456e147788798c99da
generated/dev/vlc.py
python
libvlc_media_player_set_rate
(p_mi, rate)
return f(p_mi, rate)
Set movie play rate. @param p_mi: the Media Player. @param rate: movie play rate to set. @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol).
Set movie play rate.
[ "Set", "movie", "play", "rate", "." ]
def libvlc_media_player_set_rate(p_mi, rate): '''Set movie play rate. @param p_mi: the Media Player. @param rate: movie play rate to set. @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol). ''' f = _Cfunctions....
[ "def", "libvlc_media_player_set_rate", "(", "p_mi", ",", "rate", ")", ":", "f", "=", "_Cfunctions", ".", "get", "(", "'libvlc_media_player_set_rate'", ",", "None", ")", "or", "_Cfunction", "(", "'libvlc_media_player_set_rate'", ",", "(", "(", "1", ",", ")", ",...
https://github.com/oaubert/python-vlc/blob/908ffdbd0844dc1849728c456e147788798c99da/generated/dev/vlc.py#L6731-L6740
googledatalab/pydatalab
1c86e26a0d24e3bc8097895ddeab4d0607be4c40
datalab/storage/commands/_storage.py
python
_storage_get_key_names
(bucket, pattern)
return [item.metadata.name for item in _storage_get_keys(bucket, pattern)]
Get names of all storage keys in a specified bucket that match a pattern.
Get names of all storage keys in a specified bucket that match a pattern.
[ "Get", "names", "of", "all", "storage", "keys", "in", "a", "specified", "bucket", "that", "match", "a", "pattern", "." ]
def _storage_get_key_names(bucket, pattern): """ Get names of all storage keys in a specified bucket that match a pattern. """ return [item.metadata.name for item in _storage_get_keys(bucket, pattern)]
[ "def", "_storage_get_key_names", "(", "bucket", ",", "pattern", ")", ":", "return", "[", "item", ".", "metadata", ".", "name", "for", "item", "in", "_storage_get_keys", "(", "bucket", ",", "pattern", ")", "]" ]
https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/datalab/storage/commands/_storage.py#L289-L291
VIDA-NYU/reprozip
67bbe8d2e22e0493ba0ccc78521729b49dd70a1d
reprounzip/reprounzip/unpackers/graph.py
python
graph_json
(target, runs, packages, other_files, package_map, edges, inputs_outputs, inputs_outputs_map, level_pkgs, level_processes, level_other_files)
Writes a JSON file suitable for further processing.
Writes a JSON file suitable for further processing.
[ "Writes", "a", "JSON", "file", "suitable", "for", "further", "processing", "." ]
def graph_json(target, runs, packages, other_files, package_map, edges, inputs_outputs, inputs_outputs_map, level_pkgs, level_processes, level_other_files): """Writes a JSON file suitable for further processing. """ # Packages if level_pkgs in (LVL_PKG_IGNORE, LVL_PKG_DROP)...
[ "def", "graph_json", "(", "target", ",", "runs", ",", "packages", ",", "other_files", ",", "package_map", ",", "edges", ",", "inputs_outputs", ",", "inputs_outputs_map", ",", "level_pkgs", ",", "level_processes", ",", "level_other_files", ")", ":", "# Packages", ...
https://github.com/VIDA-NYU/reprozip/blob/67bbe8d2e22e0493ba0ccc78521729b49dd70a1d/reprounzip/reprounzip/unpackers/graph.py#L667-L729
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/pandas/core/panel.py
python
Panel._add_aggregate_operations
(cls, use_numexpr=True)
add the operations to the cls; evaluate the doc strings again
add the operations to the cls; evaluate the doc strings again
[ "add", "the", "operations", "to", "the", "cls", ";", "evaluate", "the", "doc", "strings", "again" ]
def _add_aggregate_operations(cls, use_numexpr=True): """ add the operations to the cls; evaluate the doc strings again """ # doc strings substitors _agg_doc = """ Wrapper method for %%s Parameters ---------- other : %s or %s""" % (cls._constructor_sliced.__name__, cls.__name__) + """ axis : {...
[ "def", "_add_aggregate_operations", "(", "cls", ",", "use_numexpr", "=", "True", ")", ":", "# doc strings substitors", "_agg_doc", "=", "\"\"\"\nWrapper method for %%s\n\nParameters\n----------\nother : %s or %s\"\"\"", "%", "(", "cls", ".", "_constructor_sliced", ".", "__nam...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/panel.py#L1485-L1559
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
python
Distribution.requires
(self, extras=())
return deps
List of Requirements needed for this distro if `extras` are used
List of Requirements needed for this distro if `extras` are used
[ "List", "of", "Requirements", "needed", "for", "this", "distro", "if", "extras", "are", "used" ]
def requires(self, extras=()): """List of Requirements needed for this distro if `extras` are used""" dm = self._dep_map deps = [] deps.extend(dm.get(None, ())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except KeyError: ...
[ "def", "requires", "(", "self", ",", "extras", "=", "(", ")", ")", ":", "dm", "=", "self", ".", "_dep_map", "deps", "=", "[", "]", "deps", ".", "extend", "(", "dm", ".", "get", "(", "None", ",", "(", ")", ")", ")", "for", "ext", "in", "extras...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L2633-L2645
Yelp/detect-secrets
b914bb656f71a9baf7c6b3a713d4a8a1eb8f4436
detect_secrets/audit/common.py
python
LineGetter.open_file
(self)
This is split up into a different function, so it can be overridden if necessary.
This is split up into a different function, so it can be overridden if necessary.
[ "This", "is", "split", "up", "into", "a", "different", "function", "so", "it", "can", "be", "overridden", "if", "necessary", "." ]
def open_file(self) -> Iterator[NamedIO]: """This is split up into a different function, so it can be overridden if necessary.""" with open(self.filename) as f: yield cast(NamedIO, f)
[ "def", "open_file", "(", "self", ")", "->", "Iterator", "[", "NamedIO", "]", ":", "with", "open", "(", "self", ".", "filename", ")", "as", "f", ":", "yield", "cast", "(", "NamedIO", ",", "f", ")" ]
https://github.com/Yelp/detect-secrets/blob/b914bb656f71a9baf7c6b3a713d4a8a1eb8f4436/detect_secrets/audit/common.py#L146-L149
FSecureLABS/Jandroid
e31d0dab58a2bfd6ed8e0a387172b8bd7c893436
libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/tools/provision_devices.py
python
CheckExternalStorage
(device)
Checks that storage is writable and if not makes it writable. Arguments: device: The device to check.
Checks that storage is writable and if not makes it writable.
[ "Checks", "that", "storage", "is", "writable", "and", "if", "not", "makes", "it", "writable", "." ]
def CheckExternalStorage(device): """Checks that storage is writable and if not makes it writable. Arguments: device: The device to check. """ try: with device_temp_file.DeviceTempFile( device.adb, suffix='.sh', dir=device.GetExternalStoragePath()) as f: device.WriteFile(f.name, 'test') ...
[ "def", "CheckExternalStorage", "(", "device", ")", ":", "try", ":", "with", "device_temp_file", ".", "DeviceTempFile", "(", "device", ".", "adb", ",", "suffix", "=", "'.sh'", ",", "dir", "=", "device", ".", "GetExternalStoragePath", "(", ")", ")", "as", "f...
https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/libs/platform-tools/platform-tools_darwin/systrace/catapult/devil/devil/android/tools/provision_devices.py#L519-L536
openstack/barbican
a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce
barbican/model/repositories.py
python
_auto_generate_tables
(engine, tables)
[]
def _auto_generate_tables(engine, tables): if tables and 'alembic_version' in tables: # Upgrade the database to the latest version. LOG.info('Updating schema to latest version') commands.upgrade() else: # Create database tables from our models. LOG.info('Auto-creating bar...
[ "def", "_auto_generate_tables", "(", "engine", ",", "tables", ")", ":", "if", "tables", "and", "'alembic_version'", "in", "tables", ":", "# Upgrade the database to the latest version.", "LOG", ".", "info", "(", "'Updating schema to latest version'", ")", "commands", "."...
https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/model/repositories.py#L256-L267
sabnzbd/sabnzbd
52d21e94d3cc6e30764a833fe2a256783d1a8931
builder/package.py
python
run_external_command
(command)
return output
Wrapper to ease the use of calling external programs
Wrapper to ease the use of calling external programs
[ "Wrapper", "to", "ease", "the", "use", "of", "calling", "external", "programs" ]
def run_external_command(command): """Wrapper to ease the use of calling external programs""" process = subprocess.Popen(command, text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) output, _ = process.communicate() ret = process.wait() if output: print(output) if ret != 0: ...
[ "def", "run_external_command", "(", "command", ")", ":", "process", "=", "subprocess", ".", "Popen", "(", "command", ",", "text", "=", "True", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "output", ...
https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/builder/package.py#L78-L87
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
ansible/roles/lib_oa_openshift/library/oc_pvc.py
python
Utils.get_resource_file
(sfile, sfile_type='yaml')
return contents
return the service file
return the service file
[ "return", "the", "service", "file" ]
def get_resource_file(sfile, sfile_type='yaml'): ''' return the service file ''' contents = None with open(sfile) as sfd: contents = sfd.read() if sfile_type == 'yaml': # AUDIT:no-member makes sense here due to ruamel.YAML/PyYAML usage # pylint: disab...
[ "def", "get_resource_file", "(", "sfile", ",", "sfile_type", "=", "'yaml'", ")", ":", "contents", "=", "None", "with", "open", "(", "sfile", ")", "as", "sfd", ":", "contents", "=", "sfd", ".", "read", "(", ")", "if", "sfile_type", "==", "'yaml'", ":", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_pvc.py#L1273-L1289
openstack/heat
ea6633c35b04bb49c4a2858edc9df0a82d039478
heat/common/identifier.py
python
HeatIdentifier.stack_path
(self)
return '%s/%s' % (urlparse.quote(self.stack_name, ''), urlparse.quote(self.stack_id, ''))
Return a URL-encoded path segment of a URL without a tenant. Returned in the form: <stack_name>/<stack_id>
Return a URL-encoded path segment of a URL without a tenant.
[ "Return", "a", "URL", "-", "encoded", "path", "segment", "of", "a", "URL", "without", "a", "tenant", "." ]
def stack_path(self): """Return a URL-encoded path segment of a URL without a tenant. Returned in the form: <stack_name>/<stack_id> """ return '%s/%s' % (urlparse.quote(self.stack_name, ''), urlparse.quote(self.stack_id, ''))
[ "def", "stack_path", "(", "self", ")", ":", "return", "'%s/%s'", "%", "(", "urlparse", ".", "quote", "(", "self", ".", "stack_name", ",", "''", ")", ",", "urlparse", ".", "quote", "(", "self", ".", "stack_id", ",", "''", ")", ")" ]
https://github.com/openstack/heat/blob/ea6633c35b04bb49c4a2858edc9df0a82d039478/heat/common/identifier.py#L123-L130
kvazis/homeassistant
aca227a780f806d861342e3611025a52a3bb4366
custom_components/localtuya/fan.py
python
LocaltuyaFan.is_on
(self)
return self._is_on
Check if Tuya fan is on.
Check if Tuya fan is on.
[ "Check", "if", "Tuya", "fan", "is", "on", "." ]
def is_on(self): """Check if Tuya fan is on.""" return self._is_on
[ "def", "is_on", "(", "self", ")", ":", "return", "self", ".", "_is_on" ]
https://github.com/kvazis/homeassistant/blob/aca227a780f806d861342e3611025a52a3bb4366/custom_components/localtuya/fan.py#L68-L70
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/optparse.py
python
TitledHelpFormatter.format_usage
(self, usage)
return "%s %s\n" % (self.format_heading(_("Usage")), usage)
[]
def format_usage(self, usage): return "%s %s\n" % (self.format_heading(_("Usage")), usage)
[ "def", "format_usage", "(", "self", ",", "usage", ")", ":", "return", "\"%s %s\\n\"", "%", "(", "self", ".", "format_heading", "(", "_", "(", "\"Usage\"", ")", ")", ",", "usage", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/optparse.py#L398-L399
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/gui/popups.py
python
CopyOrMovePopup._return_action
(self, new_ret)
Callback for the move/copy buttons.
Callback for the move/copy buttons.
[ "Callback", "for", "the", "move", "/", "copy", "buttons", "." ]
def _return_action(self, new_ret): """Callback for the move/copy buttons.""" self._ret_action = new_ret self.accept_modal()
[ "def", "_return_action", "(", "self", ",", "new_ret", ")", ":", "self", ".", "_ret_action", "=", "new_ret", "self", ".", "accept_modal", "(", ")" ]
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/gui/popups.py#L68-L71
femtotrader/pandas_talib
49f773a0d0f25c6b47ea68ca660e62c8894f8a24
pandas_talib/__init__.py
python
STOK
(df)
return out(SETTINGS, df, result)
Stochastic oscillator %K
Stochastic oscillator %K
[ "Stochastic", "oscillator", "%K" ]
def STOK(df): """ Stochastic oscillator %K """ result = pd.Series((df['Close'] - df['Low']) / (df['High'] - df['Low']), name='SO%k') return out(SETTINGS, df, result)
[ "def", "STOK", "(", "df", ")", ":", "result", "=", "pd", ".", "Series", "(", "(", "df", "[", "'Close'", "]", "-", "df", "[", "'Low'", "]", ")", "/", "(", "df", "[", "'High'", "]", "-", "df", "[", "'Low'", "]", ")", ",", "name", "=", "'SO%k'...
https://github.com/femtotrader/pandas_talib/blob/49f773a0d0f25c6b47ea68ca660e62c8894f8a24/pandas_talib/__init__.py#L147-L152
agiliq/Django-Socialauth
b0b1acb180dd955edcc9b9b9d086470b8c332de6
socialauth/lib/twitter.py
python
User.GetFollowersCount
(self)
return self._followers_count
Get the follower count for this user. Returns: The number of users following this user.
Get the follower count for this user. Returns: The number of users following this user.
[ "Get", "the", "follower", "count", "for", "this", "user", ".", "Returns", ":", "The", "number", "of", "users", "following", "this", "user", "." ]
def GetFollowersCount(self): '''Get the follower count for this user. Returns: The number of users following this user. ''' return self._followers_count
[ "def", "GetFollowersCount", "(", "self", ")", ":", "return", "self", ".", "_followers_count" ]
https://github.com/agiliq/Django-Socialauth/blob/b0b1acb180dd955edcc9b9b9d086470b8c332de6/socialauth/lib/twitter.py#L763-L769
google/clusterfuzz
f358af24f414daa17a3649b143e71ea71871ef59
src/clusterfuzz/_internal/build_management/revisions.py
python
_git_commit_position_to_git_hash_for_chromium
(revision, repository)
return result_dict['git_sha']
Return git hash for a git commit position using cr-rev.appspot.com.
Return git hash for a git commit position using cr-rev.appspot.com.
[ "Return", "git", "hash", "for", "a", "git", "commit", "position", "using", "cr", "-", "rev", ".", "appspot", ".", "com", "." ]
def _git_commit_position_to_git_hash_for_chromium(revision, repository): """Return git hash for a git commit position using cr-rev.appspot.com.""" request_variables = { 'number': revision, 'numbering_identifier': 'refs/heads/main', 'numbering_type': 'COMMIT_POSITION', 'project': 'chromium', ...
[ "def", "_git_commit_position_to_git_hash_for_chromium", "(", "revision", ",", "repository", ")", ":", "request_variables", "=", "{", "'number'", ":", "revision", ",", "'numbering_identifier'", ":", "'refs/heads/main'", ",", "'numbering_type'", ":", "'COMMIT_POSITION'", ",...
https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/build_management/revisions.py#L232-L254
fronzbot/blinkpy
21f29ad302072d16efdc8205aaba826013e69176
blinkpy/camera.py
python
BlinkCamera.update_images
(self, config, force_cache=False)
Update images for camera.
Update images for camera.
[ "Update", "images", "for", "camera", "." ]
def update_images(self, config, force_cache=False): """Update images for camera.""" new_thumbnail = None thumb_addr = None if config.get("thumbnail", False): thumb_addr = config["thumbnail"] else: _LOGGER.warning("Could not find thumbnail for camera %s", s...
[ "def", "update_images", "(", "self", ",", "config", ",", "force_cache", "=", "False", ")", ":", "new_thumbnail", "=", "None", "thumb_addr", "=", "None", "if", "config", ".", "get", "(", "\"thumbnail\"", ",", "False", ")", ":", "thumb_addr", "=", "config", ...
https://github.com/fronzbot/blinkpy/blob/21f29ad302072d16efdc8205aaba826013e69176/blinkpy/camera.py#L160-L199
facelessuser/ColorHelper
cfed17c35dbae4db49a14165ef222407c48a3014
custom/st_colormod.py
python
validate_vars
(var, good_vars)
Validate variables. We will blindly replace values, but if we are fairly confident they follow the pattern of a valid, complete unit, if you replace them in a bad place, it will break the color (as it should) and if not, it is likely to parse fine, unless it breaks the syntax of the color being evaluat...
Validate variables.
[ "Validate", "variables", "." ]
def validate_vars(var, good_vars): """ Validate variables. We will blindly replace values, but if we are fairly confident they follow the pattern of a valid, complete unit, if you replace them in a bad place, it will break the color (as it should) and if not, it is likely to parse fine, unless ...
[ "def", "validate_vars", "(", "var", ",", "good_vars", ")", ":", "for", "k", ",", "v", "in", "var", ".", "items", "(", ")", ":", "v", "=", "v", ".", "strip", "(", ")", "start", "=", "0", "need_sep", "=", "False", "length", "=", "len", "(", "v", ...
https://github.com/facelessuser/ColorHelper/blob/cfed17c35dbae4db49a14165ef222407c48a3014/custom/st_colormod.py#L83-L141
sightmachine/SimpleCV
6c4d61b6d1d9d856b471910107cad0838954d2b2
SimpleCV/LineScan.py
python
LineScan.fillLUT
(self,lut,idxs,value=255)
return lut
**SUMMARY** Fill up an existing LUT (look up table) at the indexes specified by idxs with the value specified by value. This is useful for picking out specific values. **PARAMETERS** * *lut* - An existing LUT (just a list of 255 values). * *idxs* - The indexes of the ...
**SUMMARY**
[ "**", "SUMMARY", "**" ]
def fillLUT(self,lut,idxs,value=255): """ **SUMMARY** Fill up an existing LUT (look up table) at the indexes specified by idxs with the value specified by value. This is useful for picking out specific values. **PARAMETERS** * *lut* - An existing LUT (just a li...
[ "def", "fillLUT", "(", "self", ",", "lut", ",", "idxs", ",", "value", "=", "255", ")", ":", "# for the love of god keep this small", "# for some reason isInstance is being persnickety", "if", "(", "idxs", ".", "__class__", ".", "__name__", "==", "'Image'", ")", ":...
https://github.com/sightmachine/SimpleCV/blob/6c4d61b6d1d9d856b471910107cad0838954d2b2/SimpleCV/LineScan.py#L713-L755
hctomkins/caffe-gui-tool
4037259d37691a203385edebf8630a4d54ae947a
IOwriteprototxt.py
python
SolveFunction
(context, operatorself=None)
return [[i + '\n' for i in protoandsolver], Isize], os.path.join(configpath,'train_%s.sh' % solvername)
[]
def SolveFunction(context, operatorself=None): graph = [] extra_paths = [] DataNode = False for space in bpy.context.area.spaces: if space.type == 'NODE_EDITOR': tree = space.edit_tree bpy.ops.node.select_all() if len(context.selected_nodes) == 0: bpy.ops.node.select_...
[ "def", "SolveFunction", "(", "context", ",", "operatorself", "=", "None", ")", ":", "graph", "=", "[", "]", "extra_paths", "=", "[", "]", "DataNode", "=", "False", "for", "space", "in", "bpy", ".", "context", ".", "area", ".", "spaces", ":", "if", "s...
https://github.com/hctomkins/caffe-gui-tool/blob/4037259d37691a203385edebf8630a4d54ae947a/IOwriteprototxt.py#L615-L782
joxeankoret/cosa-nostra
787987a32330e2a948b4a60270d98acd602e76d0
web/net.py
python
validip6addr
(address)
return True
Returns True if `address` is a valid IPv6 address. >>> validip6addr('::') True >>> validip6addr('aaaa:bbbb:cccc:dddd::1') True >>> validip6addr('1:2:3:4:5:6:7:8:9:10') False >>> validip6addr('12:10') False
Returns True if `address` is a valid IPv6 address.
[ "Returns", "True", "if", "address", "is", "a", "valid", "IPv6", "address", "." ]
def validip6addr(address): """ Returns True if `address` is a valid IPv6 address. >>> validip6addr('::') True >>> validip6addr('aaaa:bbbb:cccc:dddd::1') True >>> validip6addr('1:2:3:4:5:6:7:8:9:10') False >>> validip6addr('12:10') False """ ...
[ "def", "validip6addr", "(", "address", ")", ":", "try", ":", "socket", ".", "inet_pton", "(", "socket", ".", "AF_INET6", ",", "address", ")", "except", "(", "socket", ".", "error", ",", "AttributeError", ",", "ValueError", ")", ":", "return", "False", "r...
https://github.com/joxeankoret/cosa-nostra/blob/787987a32330e2a948b4a60270d98acd602e76d0/web/net.py#L32-L50
unknown-horizons/unknown-horizons
7397fb333006d26c3d9fe796c7bd9cb8c3b43a49
horizons/world/building/buildable.py
python
Buildable._check_rotation
(cls, session, position, rotation)
return rotation
Returns a possible rotation for this building. @param position: Rect or Point instance, position and size @param rotation: The preferred rotation @return: integer, an available rotation in degrees
Returns a possible rotation for this building.
[ "Returns", "a", "possible", "rotation", "for", "this", "building", "." ]
def _check_rotation(cls, session, position, rotation): """Returns a possible rotation for this building. @param position: Rect or Point instance, position and size @param rotation: The preferred rotation @return: integer, an available rotation in degrees""" return rotation
[ "def", "_check_rotation", "(", "cls", ",", "session", ",", "position", ",", "rotation", ")", ":", "return", "rotation" ]
https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/world/building/buildable.py#L251-L256
AdamLaurie/RFIDIOt
88f2ef9f8e02d0b1e4a03fcd5aa52e3c6ab0dc73
rfidiot/RFIDIOt.py
python
rfidiot.TRANSITIDEncode
(self,data)
return out
Encode TRANSIT ID
Encode TRANSIT ID
[ "Encode", "TRANSIT", "ID" ]
def TRANSITIDEncode(self,data): "Encode TRANSIT ID" # start sentinel out= '0000000000000000' # UID out += self.ToBinaryString(self.ToBinary(data)) # LRC lrc= self.TRANSITLRC(out[16:48]) out += self.ToBinaryString(chr(lrc)) # end sentinel out += self.ToBinaryString(chr(0xf2)) return out
[ "def", "TRANSITIDEncode", "(", "self", ",", "data", ")", ":", "# start sentinel", "out", "=", "'0000000000000000'", "# UID", "out", "+=", "self", ".", "ToBinaryString", "(", "self", ".", "ToBinary", "(", "data", ")", ")", "# LRC", "lrc", "=", "self", ".", ...
https://github.com/AdamLaurie/RFIDIOt/blob/88f2ef9f8e02d0b1e4a03fcd5aa52e3c6ab0dc73/rfidiot/RFIDIOt.py#L2253-L2264
falconry/falcon
ee97769eab6a951864876202474133446aa50297
falcon/asgi/request.py
python
Request.get_header
(self, name, required=False, default=None, _name_cache={})
Retrieve the raw string value for the given header. Args: name (str): Header name, case-insensitive (e.g., 'Content-Type') Keyword Args: required (bool): Set to ``True`` to raise ``HTTPBadRequest`` instead of returning gracefully when the header ...
Retrieve the raw string value for the given header.
[ "Retrieve", "the", "raw", "string", "value", "for", "the", "given", "header", "." ]
def get_header(self, name, required=False, default=None, _name_cache={}): """Retrieve the raw string value for the given header. Args: name (str): Header name, case-insensitive (e.g., 'Content-Type') Keyword Args: required (bool): Set to ``True`` to raise ...
[ "def", "get_header", "(", "self", ",", "name", ",", "required", "=", "False", ",", "default", "=", "None", ",", "_name_cache", "=", "{", "}", ")", ":", "try", ":", "asgi_name", "=", "_name_cache", "[", "name", "]", "except", "KeyError", ":", "asgi_name...
https://github.com/falconry/falcon/blob/ee97769eab6a951864876202474133446aa50297/falcon/asgi/request.py#L877-L919
GalSim-developers/GalSim
a05d4ec3b8d8574f99d3b0606ad882cbba53f345
galsim/wcs.py
python
JacobianWCS.getMatrix
(self)
return np.array([[ self._dudx, self._dudy ], [ self._dvdx, self._dvdy ]], dtype=float)
Get the Jacobian as a NumPy matrix: numpy.array( [[ dudx, dudy ], [ dvdx, dvdy ]] )
Get the Jacobian as a NumPy matrix:
[ "Get", "the", "Jacobian", "as", "a", "NumPy", "matrix", ":" ]
def getMatrix(self): """Get the Jacobian as a NumPy matrix: numpy.array( [[ dudx, dudy ], [ dvdx, dvdy ]] ) """ return np.array([[ self._dudx, self._dudy ], [ self._dvdx, self._dvdy ]], dtype=float)
[ "def", "getMatrix", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "[", "self", ".", "_dudx", ",", "self", ".", "_dudy", "]", ",", "[", "self", ".", "_dvdx", ",", "self", ".", "_dvdy", "]", "]", ",", "dtype", "=", "float", ")" ]
https://github.com/GalSim-developers/GalSim/blob/a05d4ec3b8d8574f99d3b0606ad882cbba53f345/galsim/wcs.py#L1767-L1774
AntreasAntoniou/HowToTrainYourMAMLPytorch
86964701651c06e490271365fedb8789a72ef3f0
inner_loop_optimizers.py
python
LSLRGradientDescentLearningRule.__init__
(self, device, total_num_inner_loop_steps, use_learnable_learning_rates, init_learning_rate=1e-3)
Creates a new learning rule object. Args: init_learning_rate: A postive scalar to scale gradient updates to the parameters by. This needs to be carefully set - if too large the learning dynamic will be unstable and may diverge, while if set too small l...
Creates a new learning rule object. Args: init_learning_rate: A postive scalar to scale gradient updates to the parameters by. This needs to be carefully set - if too large the learning dynamic will be unstable and may diverge, while if set too small l...
[ "Creates", "a", "new", "learning", "rule", "object", ".", "Args", ":", "init_learning_rate", ":", "A", "postive", "scalar", "to", "scale", "gradient", "updates", "to", "the", "parameters", "by", ".", "This", "needs", "to", "be", "carefully", "set", "-", "i...
def __init__(self, device, total_num_inner_loop_steps, use_learnable_learning_rates, init_learning_rate=1e-3): """Creates a new learning rule object. Args: init_learning_rate: A postive scalar to scale gradient updates to the parameters by. This needs to be carefully set - if...
[ "def", "__init__", "(", "self", ",", "device", ",", "total_num_inner_loop_steps", ",", "use_learnable_learning_rates", ",", "init_learning_rate", "=", "1e-3", ")", ":", "super", "(", "LSLRGradientDescentLearningRule", ",", "self", ")", ".", "__init__", "(", ")", "...
https://github.com/AntreasAntoniou/HowToTrainYourMAMLPytorch/blob/86964701651c06e490271365fedb8789a72ef3f0/inner_loop_optimizers.py#L69-L84
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/voice/v1/dialing_permissions/country/__init__.py
python
CountryContext.fetch
(self)
return CountryInstance(self._version, payload, iso_code=self._solution['iso_code'], )
Fetch the CountryInstance :returns: The fetched CountryInstance :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance
Fetch the CountryInstance
[ "Fetch", "the", "CountryInstance" ]
def fetch(self): """ Fetch the CountryInstance :returns: The fetched CountryInstance :rtype: twilio.rest.voice.v1.dialing_permissions.country.CountryInstance """ payload = self._version.fetch(method='GET', uri=self._uri, ) return CountryInstance(self._version, p...
[ "def", "fetch", "(", "self", ")", ":", "payload", "=", "self", ".", "_version", ".", "fetch", "(", "method", "=", "'GET'", ",", "uri", "=", "self", ".", "_uri", ",", ")", "return", "CountryInstance", "(", "self", ".", "_version", ",", "payload", ",",...
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/voice/v1/dialing_permissions/country/__init__.py#L268-L277
s3prl/s3prl
185e4b060cd96ce5911e258c2fde74a2e8246308
s3prl/upstream/vq_wav2vec/hubconf.py
python
vq_wav2vec_kmeans
(refresh=False, *args, **kwargs)
return vq_wav2vec_url(refresh=refresh, *args, **kwargs)
The K-means model refresh (bool): whether to download ckpt/config again if existed
The K-means model refresh (bool): whether to download ckpt/config again if existed
[ "The", "K", "-", "means", "model", "refresh", "(", "bool", ")", ":", "whether", "to", "download", "ckpt", "/", "config", "again", "if", "existed" ]
def vq_wav2vec_kmeans(refresh=False, *args, **kwargs): """ The K-means model refresh (bool): whether to download ckpt/config again if existed """ kwargs['ckpt'] = 'https://dl.fbaipublicfiles.com/fairseq/wav2vec/vq-wav2vec_kmeans.pt' return vq_wav2vec_url(refresh=refresh, *args, **kwa...
[ "def", "vq_wav2vec_kmeans", "(", "refresh", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'ckpt'", "]", "=", "'https://dl.fbaipublicfiles.com/fairseq/wav2vec/vq-wav2vec_kmeans.pt'", "return", "vq_wav2vec_url", "(", "refresh", "="...
https://github.com/s3prl/s3prl/blob/185e4b060cd96ce5911e258c2fde74a2e8246308/s3prl/upstream/vq_wav2vec/hubconf.py#L51-L57
StanfordVL/taskonomy
9f814867b5fe4165860862211e8e99b0f200144d
code/lib/models/encoder_decoder_cgan_softmax.py
python
EDWithSoftmaxRegenerationCGAN._build_metrics
( self, scope='metrics' )
Run after self.get_losses.
Run after self.get_losses.
[ "Run", "after", "self", ".", "get_losses", "." ]
def _build_metrics( self, scope='metrics' ): ''' Run after self.get_losses. ''' if not self.losses_built: raise RuntimeError( "Cannot _build_metrics until 'get_losses' is run" ) with tf.variable_scope( scope ) as sc: is_real_label_greater = self.real_label > self.fake_la...
[ "def", "_build_metrics", "(", "self", ",", "scope", "=", "'metrics'", ")", ":", "if", "not", "self", ".", "losses_built", ":", "raise", "RuntimeError", "(", "\"Cannot _build_metrics until 'get_losses' is run\"", ")", "with", "tf", ".", "variable_scope", "(", "scop...
https://github.com/StanfordVL/taskonomy/blob/9f814867b5fe4165860862211e8e99b0f200144d/code/lib/models/encoder_decoder_cgan_softmax.py#L395-L407
Dman95/SASM
7e3ae6da1c219a68e26d38939338567e5c27151a
Windows/MinGW64/share/gdb/python/gdb/printing.py
python
register_pretty_printer
(obj, printer, replace=False)
Register pretty-printer PRINTER with OBJ. The printer is added to the front of the search list, thus one can override an existing printer if one needs to. Use a different name when overriding an existing printer, otherwise an exception will be raised; multiple printers with the same name are disallowe...
Register pretty-printer PRINTER with OBJ.
[ "Register", "pretty", "-", "printer", "PRINTER", "with", "OBJ", "." ]
def register_pretty_printer(obj, printer, replace=False): """Register pretty-printer PRINTER with OBJ. The printer is added to the front of the search list, thus one can override an existing printer if one needs to. Use a different name when overriding an existing printer, otherwise an exception will ...
[ "def", "register_pretty_printer", "(", "obj", ",", "printer", ",", "replace", "=", "False", ")", ":", "# Watch for both __name__ and name.", "# Functions get the former for free, but we don't want to use an", "# attribute named __foo__ for pretty-printers-as-objects.", "# If printer ha...
https://github.com/Dman95/SASM/blob/7e3ae6da1c219a68e26d38939338567e5c27151a/Windows/MinGW64/share/gdb/python/gdb/printing.py#L76-L149
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v8/services/services/shared_set_service/transports/grpc.py
python
SharedSetServiceGrpcTransport.create_channel
( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, )
return grpc_helpers.create_channel( host, credentials=credentials, scopes=scopes or cls.AUTH_SCOPES, **kwargs, )
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
Create and return a gRPC channel object. Args: address (Optionsl[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service....
[ "Create", "and", "return", "a", "gRPC", "channel", "object", ".", "Args", ":", "address", "(", "Optionsl", "[", "str", "]", ")", ":", "The", "host", "for", "the", "channel", "to", "use", ".", "credentials", "(", "Optional", "[", "~", ".", "Credentials"...
def create_channel( cls, host: str = "googleads.googleapis.com", credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: """Create and return a gRPC channel object. Args: address (Options...
[ "def", "create_channel", "(", "cls", ",", "host", ":", "str", "=", "\"googleads.googleapis.com\"", ",", "credentials", ":", "ga_credentials", ".", "Credentials", "=", "None", ",", "scopes", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None",...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/shared_set_service/transports/grpc.py#L176-L204
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/physics/vector/point.py
python
Point.v2pt_theory
(self, otherpoint, outframe, fixedframe)
return self.vel(outframe)
Sets the velocity of this point with the 2-point theory. The 2-point theory for point velocity looks like this: ^N v^P = ^N v^O + ^N omega^B x r^OP where O and P are both points fixed in frame B, which is rotating in frame N. Parameters ========== otherpoint ...
Sets the velocity of this point with the 2-point theory.
[ "Sets", "the", "velocity", "of", "this", "point", "with", "the", "2", "-", "point", "theory", "." ]
def v2pt_theory(self, otherpoint, outframe, fixedframe): """Sets the velocity of this point with the 2-point theory. The 2-point theory for point velocity looks like this: ^N v^P = ^N v^O + ^N omega^B x r^OP where O and P are both points fixed in frame B, which is rotating in ...
[ "def", "v2pt_theory", "(", "self", ",", "otherpoint", ",", "outframe", ",", "fixedframe", ")", ":", "_check_frame", "(", "outframe", ")", "_check_frame", "(", "fixedframe", ")", "self", ".", "_check_point", "(", "otherpoint", ")", "dist", "=", "self", ".", ...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/physics/vector/point.py#L385-L428
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/cloud/clouds/vmware.py
python
_iter_disk_unit_number
(unit_number)
return unit_number
Apparently vmware reserves ID 7 for SCSI controllers, so we cannot specify hard drives for 7. Skip 7 to make sure.
Apparently vmware reserves ID 7 for SCSI controllers, so we cannot specify hard drives for 7.
[ "Apparently", "vmware", "reserves", "ID", "7", "for", "SCSI", "controllers", "so", "we", "cannot", "specify", "hard", "drives", "for", "7", "." ]
def _iter_disk_unit_number(unit_number): """ Apparently vmware reserves ID 7 for SCSI controllers, so we cannot specify hard drives for 7. Skip 7 to make sure. """ unit_number += 1 if unit_number == 7: unit_number += 1 return unit_number
[ "def", "_iter_disk_unit_number", "(", "unit_number", ")", ":", "unit_number", "+=", "1", "if", "unit_number", "==", "7", ":", "unit_number", "+=", "1", "return", "unit_number" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/cloud/clouds/vmware.py#L777-L787
cronyo/cronyo
cd5abab0871b68bf31b18aac934303928130a441
cronyo/vendor/urllib3/util/url.py
python
split_first
(s, delims)
return s[:min_idx], s[min_idx + 1 :], min_delim
.. deprecated:: 1.25 Given a string and an iterable of delimiters, split on the first found delimiter. Return two split parts and the matched delimiter. If not found, then the first part is the full input string. Example:: >>> split_first('foo/bar?baz', '?/=') ('foo', 'bar?baz', '/')...
.. deprecated:: 1.25
[ "..", "deprecated", "::", "1", ".", "25" ]
def split_first(s, delims): """ .. deprecated:: 1.25 Given a string and an iterable of delimiters, split on the first found delimiter. Return two split parts and the matched delimiter. If not found, then the first part is the full input string. Example:: >>> split_first('foo/bar?baz'...
[ "def", "split_first", "(", "s", ",", "delims", ")", ":", "min_idx", "=", "None", "min_delim", "=", "None", "for", "d", "in", "delims", ":", "idx", "=", "s", ".", "find", "(", "d", ")", "if", "idx", "<", "0", ":", "continue", "if", "min_idx", "is"...
https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/urllib3/util/url.py#L175-L207
tegaki/tegaki
eceec69fe651d0733c8c8752dae569d2283d0f3c
tegaki-python/tegaki/character.py
python
Writing.normalize_position
(self)
Translate character so as to have the same amount of space to each side of the drawing box. It improves the quality of characters by making them more centered on the drawing box.
Translate character so as to have the same amount of space to each side of the drawing box.
[ "Translate", "character", "so", "as", "to", "have", "the", "same", "amount", "of", "space", "to", "each", "side", "of", "the", "drawing", "box", "." ]
def normalize_position(self): """ Translate character so as to have the same amount of space to each side of the drawing box. It improves the quality of characters by making them more centered on the drawing box. """ x, y, width, height = self.size() dx ...
[ "def", "normalize_position", "(", "self", ")", ":", "x", ",", "y", ",", "width", ",", "height", "=", "self", ".", "size", "(", ")", "dx", "=", "(", "self", ".", "_width", "-", "width", ")", "/", "2", "-", "x", "dy", "=", "(", "self", ".", "_h...
https://github.com/tegaki/tegaki/blob/eceec69fe651d0733c8c8752dae569d2283d0f3c/tegaki-python/tegaki/character.py#L726-L739
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/shutil.py
python
_make_zipfile
(base_name, base_dir, verbose=0, dry_run=0, logger=None)
return zip_filename
Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises ExecError. Retu...
Create a zip file from all the files under 'base_dir'.
[ "Create", "a", "zip", "file", "from", "all", "the", "files", "under", "base_dir", "." ]
def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on th...
[ "def", "_make_zipfile", "(", "base_name", ",", "base_dir", ",", "verbose", "=", "0", ",", "dry_run", "=", "0", ",", "logger", "=", "None", ")", ":", "import", "zipfile", "zip_filename", "=", "base_name", "+", "\".zip\"", "archive_dir", "=", "os", ".", "p...
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/shutil.py#L655-L699
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/random.py
python
SystemRandom.getrandbits
(self, k)
return x >> (bytes * 8 - k)
getrandbits(k) -> x. Generates a long int with k random bits.
getrandbits(k) -> x. Generates a long int with k random bits.
[ "getrandbits", "(", "k", ")", "-", ">", "x", ".", "Generates", "a", "long", "int", "with", "k", "random", "bits", "." ]
def getrandbits(self, k): """getrandbits(k) -> x. Generates a long int with k random bits.""" if k <= 0: raise ValueError('number of bits must be greater than zero') if k != int(k): raise TypeError('number of bits should be an integer') bytes = (k + 7) // 8 ...
[ "def", "getrandbits", "(", "self", ",", "k", ")", ":", "if", "k", "<=", "0", ":", "raise", "ValueError", "(", "'number of bits must be greater than zero'", ")", "if", "k", "!=", "int", "(", "k", ")", ":", "raise", "TypeError", "(", "'number of bits should be...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/random.py#L819-L827
p2pool/p2pool
53c438bbada06b9d4a9a465bc13f7694a7a322b7
wstools/XMLSchema.py
python
SchemaReader.addSchemaByNamespace
(self, schema)
provide reader with schema document for a targetNamespace.
provide reader with schema document for a targetNamespace.
[ "provide", "reader", "with", "schema", "document", "for", "a", "targetNamespace", "." ]
def addSchemaByNamespace(self, schema): """provide reader with schema document for a targetNamespace. """ self._imports[schema.targetNamespace] = schema
[ "def", "addSchemaByNamespace", "(", "self", ",", "schema", ")", ":", "self", ".", "_imports", "[", "schema", ".", "targetNamespace", "]", "=", "schema" ]
https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/wstools/XMLSchema.py#L88-L91
nextml/NEXT
4c8f4d5a66376a18c047f4c9409f73c75925bf07
apps/PoolBasedTripletMDS/algs/CrowdKernel/utilsCrowdKernel.py
python
computeEmbeddingWithEpochSGD
(n,d,S,mu, max_num_passes=0,max_norm=0,epsilon=0.01,a0=0.1,verbose=False)
return X,rel_max_grad
Performs epochSGD where step size is constant across each epoch, epochs are doubling in size, and step sizes are getting cut in half after each epoch. This has the effect of having a step size decreasing like 1/T. a0 defines the initial step size on the first epoch. S is a list of triplets such that...
Performs epochSGD where step size is constant across each epoch, epochs are doubling in size, and step sizes are getting cut in half after each epoch. This has the effect of having a step size decreasing like 1/T. a0 defines the initial step size on the first epoch.
[ "Performs", "epochSGD", "where", "step", "size", "is", "constant", "across", "each", "epoch", "epochs", "are", "doubling", "in", "size", "and", "step", "sizes", "are", "getting", "cut", "in", "half", "after", "each", "epoch", ".", "This", "has", "the", "ef...
def computeEmbeddingWithEpochSGD(n,d,S,mu, max_num_passes=0,max_norm=0,epsilon=0.01,a0=0.1,verbose=False): """ Performs epochSGD where step size is constant across each epoch, epochs are doubling in size, and step sizes are getting cut in half after each epoch. This has the effect of having a step size...
[ "def", "computeEmbeddingWithEpochSGD", "(", "n", ",", "d", ",", "S", ",", "mu", ",", "max_num_passes", "=", "0", ",", "max_norm", "=", "0", ",", "epsilon", "=", "0.01", ",", "a0", "=", "0.1", ",", "verbose", "=", "False", ")", ":", "m", "=", "len",...
https://github.com/nextml/NEXT/blob/4c8f4d5a66376a18c047f4c9409f73c75925bf07/apps/PoolBasedTripletMDS/algs/CrowdKernel/utilsCrowdKernel.py#L317-L416
openslide/openslide-python
fc14e86577a6f1be3d6b1118d839f1e2d70a0197
openslide/__init__.py
python
ImageSlide.detect_format
(cls, filename)
Return a string describing the format of the specified file. If the file format is not recognized, return None.
Return a string describing the format of the specified file.
[ "Return", "a", "string", "describing", "the", "format", "of", "the", "specified", "file", "." ]
def detect_format(cls, filename): """Return a string describing the format of the specified file. If the file format is not recognized, return None.""" try: img = Image.open(filename) format = img.format if hasattr(img, 'close'): # Pillow >= 2...
[ "def", "detect_format", "(", "cls", ",", "filename", ")", ":", "try", ":", "img", "=", "Image", ".", "open", "(", "filename", ")", "format", "=", "img", ".", "format", "if", "hasattr", "(", "img", ",", "'close'", ")", ":", "# Pillow >= 2.5.0", "img", ...
https://github.com/openslide/openslide-python/blob/fc14e86577a6f1be3d6b1118d839f1e2d70a0197/openslide/__init__.py#L287-L299
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/elliptic_curves/ell_number_field.py
python
EllipticCurve_number_field.is_Q_curve
(self, maxp=100, certificate=False, verbose=False)
return isQ(self, maxp, certificate, verbose)
r""" Return ``True`` if this is a `\QQ`-curve, with optional certificate. INPUT: - ``maxp`` (int, default 100): bound on primes used for checking necessary local conditions. The result will not depend on this, but using a larger value may return ``False`` faster....
r""" Return ``True`` if this is a `\QQ`-curve, with optional certificate.
[ "r", "Return", "True", "if", "this", "is", "a", "\\", "QQ", "-", "curve", "with", "optional", "certificate", "." ]
def is_Q_curve(self, maxp=100, certificate=False, verbose=False): r""" Return ``True`` if this is a `\QQ`-curve, with optional certificate. INPUT: - ``maxp`` (int, default 100): bound on primes used for checking necessary local conditions. The result will not depen...
[ "def", "is_Q_curve", "(", "self", ",", "maxp", "=", "100", ",", "certificate", "=", "False", ",", "verbose", "=", "False", ")", ":", "from", "sage", ".", "schemes", ".", "elliptic_curves", ".", "Qcurves", "import", "is_Q_curve", "as", "isQ", "return", "i...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/elliptic_curves/ell_number_field.py#L3762-L3905
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/modular/dirichlet.py
python
DirichletCharacter.lmfdb_page
(self)
r""" Open the LMFDB web page of the character in a browser. See https://www.lmfdb.org EXAMPLES:: sage: E = DirichletGroup(4).gen() sage: E.lmfdb_page() # optional -- webbrowser
r""" Open the LMFDB web page of the character in a browser.
[ "r", "Open", "the", "LMFDB", "web", "page", "of", "the", "character", "in", "a", "browser", "." ]
def lmfdb_page(self): r""" Open the LMFDB web page of the character in a browser. See https://www.lmfdb.org EXAMPLES:: sage: E = DirichletGroup(4).gen() sage: E.lmfdb_page() # optional -- webbrowser """ import webbrowser lmfdb_url = 'ht...
[ "def", "lmfdb_page", "(", "self", ")", ":", "import", "webbrowser", "lmfdb_url", "=", "'https://www.lmfdb.org/Character/Dirichlet/{}/{}'", "url", "=", "lmfdb_url", ".", "format", "(", "self", ".", "modulus", "(", ")", ",", "self", ".", "conrey_number", "(", ")",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/modular/dirichlet.py#L1205-L1219
AntreasAntoniou/DAGAN
6f1a5035df62da8c1459fd7eca61cf74d4a1b4a4
dagan_networks_wgan.py
python
DAGAN.rotate_batch
(self, batch_images_a, batch_images_b)
Rotate two batches such that every element from set a with the same index as an element from set b are rotated by an equal amount of degrees :param batch_images_a: A batch of images to be rotated :param batch_images_b: A batch of images to be rotated :return: A batch of images that are r...
Rotate two batches such that every element from set a with the same index as an element from set b are rotated by an equal amount of degrees :param batch_images_a: A batch of images to be rotated :param batch_images_b: A batch of images to be rotated :return: A batch of images that are r...
[ "Rotate", "two", "batches", "such", "that", "every", "element", "from", "set", "a", "with", "the", "same", "index", "as", "an", "element", "from", "set", "b", "are", "rotated", "by", "an", "equal", "amount", "of", "degrees", ":", "param", "batch_images_a",...
def rotate_batch(self, batch_images_a, batch_images_b): """ Rotate two batches such that every element from set a with the same index as an element from set b are rotated by an equal amount of degrees :param batch_images_a: A batch of images to be rotated :param batch_images_b: A...
[ "def", "rotate_batch", "(", "self", ",", "batch_images_a", ",", "batch_images_b", ")", ":", "shapes", "=", "map", "(", "int", ",", "list", "(", "batch_images_a", ".", "get_shape", "(", ")", ")", ")", "batch_size", ",", "x", ",", "y", ",", "c", "=", "...
https://github.com/AntreasAntoniou/DAGAN/blob/6f1a5035df62da8c1459fd7eca61cf74d4a1b4a4/dagan_networks_wgan.py#L60-L84
googleapis/google-auth-library-python
87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b
google/auth/transport/urllib3.py
python
_Response.headers
(self)
return self._response.headers
[]
def headers(self): return self._response.headers
[ "def", "headers", "(", "self", ")", ":", "return", "self", ".", "_response", ".", "headers" ]
https://github.com/googleapis/google-auth-library-python/blob/87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b/google/auth/transport/urllib3.py#L71-L72
django-cms/django-cms
272d62ced15a86c9d34eb21700e6358bb08388ea
cms/models/pluginmodel.py
python
CMSPlugin.notify_on_autoadd_children
(self, request, conf, children)
Method called when we auto add children to this plugin via default_plugins/<plugin>/children in CMS_PLACEHOLDER_CONF. Some specific plugins may have some special stuff to do when we add children to them. ie : TextPlugin must update its content to add HTML tags to be able to see his child...
Method called when we auto add children to this plugin via default_plugins/<plugin>/children in CMS_PLACEHOLDER_CONF. Some specific plugins may have some special stuff to do when we add children to them. ie : TextPlugin must update its content to add HTML tags to be able to see his child...
[ "Method", "called", "when", "we", "auto", "add", "children", "to", "this", "plugin", "via", "default_plugins", "/", "<plugin", ">", "/", "children", "in", "CMS_PLACEHOLDER_CONF", ".", "Some", "specific", "plugins", "may", "have", "some", "special", "stuff", "t...
def notify_on_autoadd_children(self, request, conf, children): """ Method called when we auto add children to this plugin via default_plugins/<plugin>/children in CMS_PLACEHOLDER_CONF. Some specific plugins may have some special stuff to do when we add children to them. ie : Text...
[ "def", "notify_on_autoadd_children", "(", "self", ",", "request", ",", "conf", ",", "children", ")", ":", "pass" ]
https://github.com/django-cms/django-cms/blob/272d62ced15a86c9d34eb21700e6358bb08388ea/cms/models/pluginmodel.py#L471-L479
sametmax/Django--an-app-at-a-time
99eddf12ead76e6dfbeb09ce0bae61e282e22f8a
ignore_this_directory/django/db/utils.py
python
ConnectionHandler.ensure_defaults
(self, alias)
Put the defaults into the settings dictionary for a given connection where no settings is provided.
Put the defaults into the settings dictionary for a given connection where no settings is provided.
[ "Put", "the", "defaults", "into", "the", "settings", "dictionary", "for", "a", "given", "connection", "where", "no", "settings", "is", "provided", "." ]
def ensure_defaults(self, alias): """ Put the defaults into the settings dictionary for a given connection where no settings is provided. """ try: conn = self.databases[alias] except KeyError: raise ConnectionDoesNotExist("The connection %s doesn't...
[ "def", "ensure_defaults", "(", "self", ",", "alias", ")", ":", "try", ":", "conn", "=", "self", ".", "databases", "[", "alias", "]", "except", "KeyError", ":", "raise", "ConnectionDoesNotExist", "(", "\"The connection %s doesn't exist\"", "%", "alias", ")", "c...
https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/db/utils.py#L160-L179
tgrosinger/aenea-grammars
796757dec74f941e727ba8cb643490eb1e31f743
format.py
python
snake_case_text
(text)
Formats dictated text to snake case. Example: "'snake case my new variable'" => "my_new_variable".
Formats dictated text to snake case.
[ "Formats", "dictated", "text", "to", "snake", "case", "." ]
def snake_case_text(text): """Formats dictated text to snake case. Example: "'snake case my new variable'" => "my_new_variable". """ newText = format_snake_case(text) Text("%(text)s").execute({"text": newText})
[ "def", "snake_case_text", "(", "text", ")", ":", "newText", "=", "format_snake_case", "(", "text", ")", "Text", "(", "\"%(text)s\"", ")", ".", "execute", "(", "{", "\"text\"", ":", "newText", "}", ")" ]
https://github.com/tgrosinger/aenea-grammars/blob/796757dec74f941e727ba8cb643490eb1e31f743/format.py#L233-L241
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/auth/auth_store.py
python
AuthStore.async_create_user
( self, name: str | None, is_owner: bool | None = None, is_active: bool | None = None, system_generated: bool | None = None, credentials: models.Credentials | None = None, group_ids: list[str] | None = None, local_only: bool | None = None, )
return new_user
Create a new user.
Create a new user.
[ "Create", "a", "new", "user", "." ]
async def async_create_user( self, name: str | None, is_owner: bool | None = None, is_active: bool | None = None, system_generated: bool | None = None, credentials: models.Credentials | None = None, group_ids: list[str] | None = None, local_only: bool | No...
[ "async", "def", "async_create_user", "(", "self", ",", "name", ":", "str", "|", "None", ",", "is_owner", ":", "bool", "|", "None", "=", "None", ",", "is_active", ":", "bool", "|", "None", "=", "None", ",", "system_generated", ":", "bool", "|", "None", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/auth/auth_store.py#L84-L134
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/db/backends/mysql/operations.py
python
DatabaseOperations.last_executed_query
(self, cursor, sql, params)
return force_text(getattr(cursor, '_last_executed', None), errors='replace')
[]
def last_executed_query(self, cursor, sql, params): # With MySQLdb, cursor objects have an (undocumented) "_last_executed" # attribute where the exact query sent to the database is saved. # See MySQLdb/cursors.py in the source distribution. return force_text(getattr(cursor, '_last_execut...
[ "def", "last_executed_query", "(", "self", ",", "cursor", ",", "sql", ",", "params", ")", ":", "# With MySQLdb, cursor objects have an (undocumented) \"_last_executed\"", "# attribute where the exact query sent to the database is saved.", "# See MySQLdb/cursors.py in the source distribut...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/backends/mysql/operations.py#L98-L102
mental32/spotify.py
c52a8d05cc48f02ebcf76afdd4eda893c1ce0855
spotify/models/library.py
python
Library.contains_tracks
(self, *tracks: Sequence[Union[str, Track]])
return await self.user.http.is_saved_track(_tracks)
Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- tracks : Union[Track, str] A sequence of track objects or spotify IDs
Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library.
[ "Check", "if", "one", "or", "more", "tracks", "is", "already", "saved", "in", "the", "current", "Spotify", "user’s", "‘Your", "Music’", "library", "." ]
async def contains_tracks(self, *tracks: Sequence[Union[str, Track]]) -> List[bool]: """Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- tracks : Union[Track, str] A sequence of track objects or spotify ID...
[ "async", "def", "contains_tracks", "(", "self", ",", "*", "tracks", ":", "Sequence", "[", "Union", "[", "str", ",", "Track", "]", "]", ")", "->", "List", "[", "bool", "]", ":", "_tracks", "=", "[", "str", "(", "obj", ")", "for", "obj", "in", "tra...
https://github.com/mental32/spotify.py/blob/c52a8d05cc48f02ebcf76afdd4eda893c1ce0855/spotify/models/library.py#L45-L54
HazyResearch/fonduer
c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd
src/fonduer/supervision/labeler.py
python
Labeler.apply
( # type: ignore self, docs: Collection[Document] = None, split: int = 0, train: bool = False, lfs: List[List[Callable]] = None, clear: bool = True, parallelism: int = None, progress_bar: bool = True, table: Table = Label, )
Apply the labels of the specified candidates based on the provided LFs. :param docs: If provided, apply the LFs to all the candidates in these documents. :param split: If docs is None, apply the LFs to the candidates in this particular split. :param train: Whether or not...
Apply the labels of the specified candidates based on the provided LFs.
[ "Apply", "the", "labels", "of", "the", "specified", "candidates", "based", "on", "the", "provided", "LFs", "." ]
def apply( # type: ignore self, docs: Collection[Document] = None, split: int = 0, train: bool = False, lfs: List[List[Callable]] = None, clear: bool = True, parallelism: int = None, progress_bar: bool = True, table: Table = Label, ) -> None: ...
[ "def", "apply", "(", "# type: ignore", "self", ",", "docs", ":", "Collection", "[", "Document", "]", "=", "None", ",", "split", ":", "int", "=", "0", ",", "train", ":", "bool", "=", "False", ",", "lfs", ":", "List", "[", "List", "[", "Callable", "]...
https://github.com/HazyResearch/fonduer/blob/c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd/src/fonduer/supervision/labeler.py#L117-L192
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/essbasic/v20201222/models.py
python
DescribeSealsResponse.__init__
(self)
r""" :param Seals: 印章信息 :type Seals: list of Seal :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param Seals: 印章信息 :type Seals: list of Seal :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "Seals", ":", "印章信息", ":", "type", "Seals", ":", "list", "of", "Seal", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param Seals: 印章信息 :type Seals: list of Seal :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Seals = None self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Seals", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/essbasic/v20201222/models.py#L2943-L2951
TesterlifeRaymond/doraemon
d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333
venv/lib/python3.6/site-packages/pip/_vendor/ipaddress.py
python
collapse_addresses
(addresses)
return _collapse_addresses_internal(addrs + nets)
Collapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network or IPv6Network objects. Returns: ...
Collapse a list of IP objects.
[ "Collapse", "a", "list", "of", "IP", "objects", "." ]
def collapse_addresses(addresses): """Collapse a list of IP objects. Example: collapse_addresses([IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]) -> [IPv4Network('192.0.2.0/24')] Args: addresses: An iterator of IPv4Network...
[ "def", "collapse_addresses", "(", "addresses", ")", ":", "addrs", "=", "[", "]", "ips", "=", "[", "]", "nets", "=", "[", "]", "# split IP addresses and networks", "for", "ip", "in", "addresses", ":", "if", "isinstance", "(", "ip", ",", "_BaseAddress", ")",...
https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/ipaddress.py#L424-L475
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/click/core.py
python
Context.find_object
(self, object_type)
Finds the closest object of a given type.
Finds the closest object of a given type.
[ "Finds", "the", "closest", "object", "of", "a", "given", "type", "." ]
def find_object(self, object_type): """Finds the closest object of a given type.""" node = self while node is not None: if isinstance(node.obj, object_type): return node.obj node = node.parent
[ "def", "find_object", "(", "self", ",", "object_type", ")", ":", "node", "=", "self", "while", "node", "is", "not", "None", ":", "if", "isinstance", "(", "node", ".", "obj", ",", "object_type", ")", ":", "return", "node", ".", "obj", "node", "=", "no...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/click/core.py#L463-L469
libertysoft3/saidit
271c7d03adb369f82921d811360b00812e42da24
r2/r2/models/comment_tree.py
python
CommentTreePermacache.rebuild
(cls, link, comments)
Generate a tree from comments and overwrite any existing tree.
Generate a tree from comments and overwrite any existing tree.
[ "Generate", "a", "tree", "from", "comments", "and", "overwrite", "any", "existing", "tree", "." ]
def rebuild(cls, link, comments): """Generate a tree from comments and overwrite any existing tree.""" with cls._mutation_context(link) as lock: # not reading, but we should block other read-modify-write # operations to avoid being clobbered by their write tree = {} ...
[ "def", "rebuild", "(", "cls", ",", "link", ",", "comments", ")", ":", "with", "cls", ".", "_mutation_context", "(", "link", ")", "as", "lock", ":", "# not reading, but we should block other read-modify-write", "# operations to avoid being clobbered by their write", "tree"...
https://github.com/libertysoft3/saidit/blob/271c7d03adb369f82921d811360b00812e42da24/r2/r2/models/comment_tree.py#L150-L159
getnikola/nikola
2da876e9322e42a93f8295f950e336465c6a4ee5
nikola/plugins/template/mako.py
python
MakoTemplates.render_template_to_string
(self, template, context)
return Template(template, lookup=self.lookup).render(**context)
Render template to a string using context.
Render template to a string using context.
[ "Render", "template", "to", "a", "string", "using", "context", "." ]
def render_template_to_string(self, template, context): """Render template to a string using context.""" context.update(self.filters) return Template(template, lookup=self.lookup).render(**context)
[ "def", "render_template_to_string", "(", "self", ",", "template", ",", "context", ")", ":", "context", ".", "update", "(", "self", ".", "filters", ")", "return", "Template", "(", "template", ",", "lookup", "=", "self", ".", "lookup", ")", ".", "render", ...
https://github.com/getnikola/nikola/blob/2da876e9322e42a93f8295f950e336465c6a4ee5/nikola/plugins/template/mako.py#L125-L128
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/drm/v20181115/models.py
python
DescribeAllKeysResponse.__init__
(self)
r""" :param Keys: 加密密钥列表。 注意:此字段可能返回 null,表示取不到有效值。 :type Keys: list of Key :param SessionKey: 用来加密密钥。 如果入参中带有RsaPublicKey,则SessionKey为使用Rsa公钥加密后的二进制数据,Base64编码字符串。 如果入参中没有RsaPublicKey,则SessionKey为原始数据的字符串形式。 注意:此字段可能返回 null,表示取不到有效值。 :type SessionKey: str :param ContentId: 内容ID ...
r""" :param Keys: 加密密钥列表。 注意:此字段可能返回 null,表示取不到有效值。 :type Keys: list of Key :param SessionKey: 用来加密密钥。 如果入参中带有RsaPublicKey,则SessionKey为使用Rsa公钥加密后的二进制数据,Base64编码字符串。 如果入参中没有RsaPublicKey,则SessionKey为原始数据的字符串形式。 注意:此字段可能返回 null,表示取不到有效值。 :type SessionKey: str :param ContentId: 内容ID ...
[ "r", ":", "param", "Keys", ":", "加密密钥列表。", "注意:此字段可能返回", "null,表示取不到有效值。", ":", "type", "Keys", ":", "list", "of", "Key", ":", "param", "SessionKey", ":", "用来加密密钥。", "如果入参中带有RsaPublicKey,则SessionKey为使用Rsa公钥加密后的二进制数据,Base64编码字符串。", "如果入参中没有RsaPublicKey,则SessionKey为原始数据的字符串形式...
def __init__(self): r""" :param Keys: 加密密钥列表。 注意:此字段可能返回 null,表示取不到有效值。 :type Keys: list of Key :param SessionKey: 用来加密密钥。 如果入参中带有RsaPublicKey,则SessionKey为使用Rsa公钥加密后的二进制数据,Base64编码字符串。 如果入参中没有RsaPublicKey,则SessionKey为原始数据的字符串形式。 注意:此字段可能返回 null,表示取不到有效值。 :type SessionKey: str ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Keys", "=", "None", "self", ".", "SessionKey", "=", "None", "self", ".", "ContentId", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/drm/v20181115/models.py#L307-L326
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/ipaddress.py
python
IPv6Address.is_loopback
(self)
return self._ip == 1
Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3.
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 address as defined in RFC 2373 2.5.3. """ return self._ip == 1
[ "def", "is_loopback", "(", "self", ")", ":", "return", "self", ".", "_ip", "==", "1" ]
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/ipaddress.py#L2038-L2046
Karmenzind/fp-server
931fca8fab9d7397c52cf9e76a76b1c60e190403
src/utils/time_ext.py
python
get_date_str
(dt: datetime.date = None)
return dt.isoformat()
@param dt 为None时,返回当前日期
[]
def get_date_str(dt: datetime.date = None): """ @param dt 为None时,返回当前日期 """ if not dt: dt = datetime.date.today() return dt.isoformat()
[ "def", "get_date_str", "(", "dt", ":", "datetime", ".", "date", "=", "None", ")", ":", "if", "not", "dt", ":", "dt", "=", "datetime", ".", "date", ".", "today", "(", ")", "return", "dt", ".", "isoformat", "(", ")" ]
https://github.com/Karmenzind/fp-server/blob/931fca8fab9d7397c52cf9e76a76b1c60e190403/src/utils/time_ext.py#L124-L130
pytorch/text
a5ca19407b844e49679d87c94003e08c5efd6d78
torchtext/utils.py
python
validate_file
(file_obj, hash_value, hash_type="sha256")
return hash_func.hexdigest() == hash_value
Validate a given file object with its hash. Args: file_obj: File object to read from. hash_value (str): Hash for url. hash_type (str, optional): Hash type, among "sha256" and "md5" (Default: ``"sha256"``). Returns: bool: return True if its a valid file, else False.
Validate a given file object with its hash.
[ "Validate", "a", "given", "file", "object", "with", "its", "hash", "." ]
def validate_file(file_obj, hash_value, hash_type="sha256"): """Validate a given file object with its hash. Args: file_obj: File object to read from. hash_value (str): Hash for url. hash_type (str, optional): Hash type, among "sha256" and "md5" (Default: ``"sha256"``). Returns: ...
[ "def", "validate_file", "(", "file_obj", ",", "hash_value", ",", "hash_type", "=", "\"sha256\"", ")", ":", "if", "hash_type", "==", "\"sha256\"", ":", "hash_func", "=", "hashlib", ".", "sha256", "(", ")", "elif", "hash_type", "==", "\"md5\"", ":", "hash_func...
https://github.com/pytorch/text/blob/a5ca19407b844e49679d87c94003e08c5efd6d78/torchtext/utils.py#L36-L61
zvtvz/zvt
054bf8a3e7a049df7087c324fa87e8effbaf5bdc
src/zvt/factors/algorithm.py
python
MaAndVolumeTransformer.__init__
(self, windows=None, vol_windows=None, kdata_overlap=0)
[]
def __init__(self, windows=None, vol_windows=None, kdata_overlap=0) -> None: super().__init__() if vol_windows is None: vol_windows = [30] if windows is None: windows = [5, 10] self.windows = windows self.vol_windows = vol_windows self.kdata_overla...
[ "def", "__init__", "(", "self", ",", "windows", "=", "None", ",", "vol_windows", "=", "None", ",", "kdata_overlap", "=", "0", ")", "->", "None", ":", "super", "(", ")", ".", "__init__", "(", ")", "if", "vol_windows", "is", "None", ":", "vol_windows", ...
https://github.com/zvtvz/zvt/blob/054bf8a3e7a049df7087c324fa87e8effbaf5bdc/src/zvt/factors/algorithm.py#L220-L228
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib/cookielib.py
python
split_header_words
(header_values)
return result
r"""Parse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_values passed as argument contains multiple val...
r"""Parse header values into a list of lists containing key,value pairs.
[ "r", "Parse", "header", "values", "into", "a", "list", "of", "lists", "containing", "key", "value", "pairs", "." ]
def split_header_words(header_values): r"""Parse header values into a list of lists containing key,value pairs. The function knows how to deal with ",", ";" and "=" as well as quoted values after "=". A list of space separated tokens are parsed as if they were separated by ";". If the header_valu...
[ "def", "split_header_words", "(", "header_values", ")", ":", "assert", "not", "isinstance", "(", "header_values", ",", "basestring", ")", "result", "=", "[", "]", "for", "text", "in", "header_values", ":", "orig_text", "=", "text", "pairs", "=", "[", "]", ...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/cookielib.py#L326-L409
ilius/pyglossary
d599b3beda3ae17642af5debd83bb991148e6425
pyglossary/plugins/gettext_po.py
python
Writer.finish
(self)
[]
def finish(self): self._filename = None if self._file: self._file.close() self._file = None
[ "def", "finish", "(", "self", ")", ":", "self", ".", "_filename", "=", "None", "if", "self", ".", "_file", ":", "self", ".", "_file", ".", "close", "(", ")", "self", ".", "_file", "=", "None" ]
https://github.com/ilius/pyglossary/blob/d599b3beda3ae17642af5debd83bb991148e6425/pyglossary/plugins/gettext_po.py#L127-L131
mapnik/python-mapnik
a2c2a86eec954b42d7f00093da03807d0834b1b4
mapnik/__init__.py
python
PgRaster
(**keywords)
return CreateDatasource(keywords)
Create a PgRaster Datasource. Required keyword arguments: dbname -- database name to connect to table -- table name or subselect query *Note: if using subselects for the 'table' value consider also passing the 'raster_field' and 'srid' and 'extent_from_subquery' options and/or spec...
Create a PgRaster Datasource.
[ "Create", "a", "PgRaster", "Datasource", "." ]
def PgRaster(**keywords): """Create a PgRaster Datasource. Required keyword arguments: dbname -- database name to connect to table -- table name or subselect query *Note: if using subselects for the 'table' value consider also passing the 'raster_field' and 'srid' and 'extent_from_sub...
[ "def", "PgRaster", "(", "*", "*", "keywords", ")", ":", "keywords", "[", "'type'", "]", "=", "'pgraster'", "return", "CreateDatasource", "(", "keywords", ")" ]
https://github.com/mapnik/python-mapnik/blob/a2c2a86eec954b42d7f00093da03807d0834b1b4/mapnik/__init__.py#L461-L505
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/mpmath/calculus/differentiation.py
python
diffs_exp
(ctx, fdiffs)
r""" Given an iterable or generator yielding `f(x), f'(x), f''(x), \ldots` generate `g(x), g'(x), g''(x), \ldots` where `g(x) = \exp(f(x))`. At high precision and for large orders, this is typically more efficient than numerical differentiation if the derivatives of `f(x)` admit direct computation....
r""" Given an iterable or generator yielding `f(x), f'(x), f''(x), \ldots` generate `g(x), g'(x), g''(x), \ldots` where `g(x) = \exp(f(x))`.
[ "r", "Given", "an", "iterable", "or", "generator", "yielding", "f", "(", "x", ")", "f", "(", "x", ")", "f", "(", "x", ")", "\\", "ldots", "generate", "g", "(", "x", ")", "g", "(", "x", ")", "g", "(", "x", ")", "\\", "ldots", "where", "g", "...
def diffs_exp(ctx, fdiffs): r""" Given an iterable or generator yielding `f(x), f'(x), f''(x), \ldots` generate `g(x), g'(x), g''(x), \ldots` where `g(x) = \exp(f(x))`. At high precision and for large orders, this is typically more efficient than numerical differentiation if the derivatives of `f(x...
[ "def", "diffs_exp", "(", "ctx", ",", "fdiffs", ")", ":", "fn", "=", "iterable_to_function", "(", "fdiffs", ")", "f0", "=", "ctx", ".", "exp", "(", "fn", "(", "0", ")", ")", "yield", "f0", "i", "=", "1", "while", "1", ":", "s", "=", "ctx", ".", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/mpmath/calculus/differentiation.py#L394-L446
FenTechSolutions/CausalDiscoveryToolbox
073b13a5076390147e95763bab73775c59e6d891
cdt/causality/graph/SAMv1.py
python
CNormalized_Linear.__init__
(self, in_features, out_features, bias=False)
Initialize the layer.
Initialize the layer.
[ "Initialize", "the", "layer", "." ]
def __init__(self, in_features, out_features, bias=False): """Initialize the layer.""" super(CNormalized_Linear, self).__init__() self.in_features = in_features self.out_features = out_features self.weight = th.nn.Parameter(th.Tensor(out_features, in_features)) if bias: ...
[ "def", "__init__", "(", "self", ",", "in_features", ",", "out_features", ",", "bias", "=", "False", ")", ":", "super", "(", "CNormalized_Linear", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "in_features", "=", "in_features", "self", ".", "o...
https://github.com/FenTechSolutions/CausalDiscoveryToolbox/blob/073b13a5076390147e95763bab73775c59e6d891/cdt/causality/graph/SAMv1.py#L42-L52
vertexproject/synapse
8173f43cb5fba5ca2648d12a659afb432139b0a7
synapse/axon.py
python
AxonApi.iterMpkFile
(self, sha256)
Yield items from a MsgPack (.mpk) file in the Axon. Args: sha256 (bytes): The sha256 hash of the file in bytes. Yields: Unpacked items from the bytes.
Yield items from a MsgPack (.mpk) file in the Axon.
[ "Yield", "items", "from", "a", "MsgPack", "(", ".", "mpk", ")", "file", "in", "the", "Axon", "." ]
async def iterMpkFile(self, sha256): ''' Yield items from a MsgPack (.mpk) file in the Axon. Args: sha256 (bytes): The sha256 hash of the file in bytes. Yields: Unpacked items from the bytes. ''' await self._reqUserAllowed(('axon', 'get')) ...
[ "async", "def", "iterMpkFile", "(", "self", ",", "sha256", ")", ":", "await", "self", ".", "_reqUserAllowed", "(", "(", "'axon'", ",", "'get'", ")", ")", "async", "for", "item", "in", "self", ".", "cell", ".", "iterMpkFile", "(", "sha256", ")", ":", ...
https://github.com/vertexproject/synapse/blob/8173f43cb5fba5ca2648d12a659afb432139b0a7/synapse/axon.py#L520-L532
pyvisa/pyvisa-py
91e3475883b0f6e20dd308f0925f9940fcf818ea
pyvisa_py/protocols/vxi11.py
python
CoreClient.device_trigger
(self, link, flags, lock_timeout, io_timeout)
return self.make_call( DEVICE_TRIGGER, params, self.packer.pack_device_generic_parms, self.unpacker.unpack_device_error, )
[]
def device_trigger(self, link, flags, lock_timeout, io_timeout): params = (link, flags, lock_timeout, io_timeout) return self.make_call( DEVICE_TRIGGER, params, self.packer.pack_device_generic_parms, self.unpacker.unpack_device_error, )
[ "def", "device_trigger", "(", "self", ",", "link", ",", "flags", ",", "lock_timeout", ",", "io_timeout", ")", ":", "params", "=", "(", "link", ",", "flags", ",", "lock_timeout", ",", "io_timeout", ")", "return", "self", ".", "make_call", "(", "DEVICE_TRIGG...
https://github.com/pyvisa/pyvisa-py/blob/91e3475883b0f6e20dd308f0925f9940fcf818ea/pyvisa_py/protocols/vxi11.py#L253-L260
hynek/structlog
3932475b444e2bd9e94a167eaceb87380e0e326e
src/structlog/contextvars.py
python
merge_contextvars
( logger: WrappedLogger, method_name: str, event_dict: EventDict )
return event_dict
A processor that merges in a global (context-local) context. Use this as your first processor in :func:`structlog.configure` to ensure context-local context is included in all log calls. .. versionadded:: 20.1.0 .. versionchanged:: 21.1.0 See toplevel note.
A processor that merges in a global (context-local) context.
[ "A", "processor", "that", "merges", "in", "a", "global", "(", "context", "-", "local", ")", "context", "." ]
def merge_contextvars( logger: WrappedLogger, method_name: str, event_dict: EventDict ) -> EventDict: """ A processor that merges in a global (context-local) context. Use this as your first processor in :func:`structlog.configure` to ensure context-local context is included in all log calls. ....
[ "def", "merge_contextvars", "(", "logger", ":", "WrappedLogger", ",", "method_name", ":", "str", ",", "event_dict", ":", "EventDict", ")", "->", "EventDict", ":", "ctx", "=", "contextvars", ".", "copy_context", "(", ")", "for", "k", "in", "ctx", ":", "if",...
https://github.com/hynek/structlog/blob/3932475b444e2bd9e94a167eaceb87380e0e326e/src/structlog/contextvars.py#L66-L84
mayank93/Twitter-Sentiment-Analysis
f095c6ca6bf69787582b5dabb140fefaf278eb37
front-end/web2py/gluon/contrib/qdb.py
python
Frontend.do_list
(self, arg=None)
return self.call('do_list', arg)
List source code for the current file
List source code for the current file
[ "List", "source", "code", "for", "the", "current", "file" ]
def do_list(self, arg=None): "List source code for the current file" return self.call('do_list', arg)
[ "def", "do_list", "(", "self", ",", "arg", "=", "None", ")", ":", "return", "self", ".", "call", "(", "'do_list'", ",", "arg", ")" ]
https://github.com/mayank93/Twitter-Sentiment-Analysis/blob/f095c6ca6bf69787582b5dabb140fefaf278eb37/front-end/web2py/gluon/contrib/qdb.py#L656-L658
RediSearch/redisearch-py
33c70efd6d13c9cc9cc66ca2e66edfe194e304a5
redisearch/auto_complete.py
python
AutoCompleter.add_suggestions
(self, *suggestions, **kwargs)
return pipe.execute()[-1]
Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string. If kwargs['increment'] is true and the terms are already in the server's dictionary, we increment their scores
Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string.
[ "Add", "suggestion", "terms", "to", "the", "AutoCompleter", "engine", ".", "Each", "suggestion", "has", "a", "score", "and", "string", "." ]
def add_suggestions(self, *suggestions, **kwargs): """ Add suggestion terms to the AutoCompleter engine. Each suggestion has a score and string. If kwargs['increment'] is true and the terms are already in the server's dictionary, we increment their scores """ # If Transaction i...
[ "def", "add_suggestions", "(", "self", ",", "*", "suggestions", ",", "*", "*", "kwargs", ")", ":", "# If Transaction is not set to false it will attempt a MULTI/EXEC which will error", "pipe", "=", "self", ".", "redis", ".", "pipeline", "(", "transaction", "=", "False...
https://github.com/RediSearch/redisearch-py/blob/33c70efd6d13c9cc9cc66ca2e66edfe194e304a5/redisearch/auto_complete.py#L81-L99
myaooo/RNNVis
3bb2b099f236648d77885cc19e6cda5d85d6db28
rnnvis/state_processor.py
python
get_co_cluster
(data_name, model_name, state_name, n_clusters, layer=-1, top_k=100, mode='positive', seed=0, method='cocluster')
return raw_data, row_labels, col_labels, word_ids
:param data_name: :param model_name: :param state_name: :param n_clusters: :param layer: :param top_k: :param mode: 'positive' or 'negative' or 'abs' :param seed: random seed :param method: 'cocluster' or 'bicluster' :return:
[]
def get_co_cluster(data_name, model_name, state_name, n_clusters, layer=-1, top_k=100, mode='positive', seed=0, method='cocluster'): """ :param data_name: :param model_name: :param state_name: :param n_clusters: :param layer: :param top_k: :param mode: 'positive' or '...
[ "def", "get_co_cluster", "(", "data_name", ",", "model_name", ",", "state_name", ",", "n_clusters", ",", "layer", "=", "-", "1", ",", "top_k", "=", "100", ",", "mode", "=", "'positive'", ",", "seed", "=", "0", ",", "method", "=", "'cocluster'", ")", ":...
https://github.com/myaooo/RNNVis/blob/3bb2b099f236648d77885cc19e6cda5d85d6db28/rnnvis/state_processor.py#L299-L345
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
plexpy/webserve.py
python
WebInterface.get_full_users_list
(self, **kwargs)
Get a list of all users that have access to your server. ``` Required parameters: None Optional parameters: None Returns: json: [{"allow_guest": 1, "do_notify": 1, ...
Get a list of all users that have access to your server.
[ "Get", "a", "list", "of", "all", "users", "that", "have", "access", "to", "your", "server", "." ]
def get_full_users_list(self, **kwargs): """ Get a list of all users that have access to your server. ``` Required parameters: None Optional parameters: None Returns: json: [{"allow_guest": 1, ...
[ "def", "get_full_users_list", "(", "self", ",", "*", "*", "kwargs", ")", ":", "user_data", "=", "users", ".", "Users", "(", ")", "result", "=", "user_data", ".", "get_users", "(", ")", "if", "result", ":", "return", "result", "else", ":", "logger", "."...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/plexpy/webserve.py#L6101-L6146
pyparallel/pyparallel
11e8c6072d48c8f13641925d17b147bf36ee0ba3
Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/distlib/util.py
python
FileOperator.commit
(self)
return result
Commit recorded changes, turn off recording, return changes.
Commit recorded changes, turn off recording, return changes.
[ "Commit", "recorded", "changes", "turn", "off", "recording", "return", "changes", "." ]
def commit(self): """ Commit recorded changes, turn off recording, return changes. """ assert self.record result = self.files_written, self.dirs_created self._init_record() return result
[ "def", "commit", "(", "self", ")", ":", "assert", "self", ".", "record", "result", "=", "self", ".", "files_written", ",", "self", ".", "dirs_created", "self", ".", "_init_record", "(", ")", "return", "result" ]
https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/pip-7.1.2-py3.3.egg/pip/_vendor/distlib/util.py#L472-L480
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/shelly/entity.py
python
ShellyRestAttributeEntity.icon
(self)
return self.description.icon
Icon of sensor.
Icon of sensor.
[ "Icon", "of", "sensor", "." ]
def icon(self) -> str | None: """Icon of sensor.""" return self.description.icon
[ "def", "icon", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "description", ".", "icon" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/shelly/entity.py#L533-L535
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/ipythonconsole/widgets/shell.py
python
ShellWidget.set_in_prompt
(self, in_prompt)
Set appereance of the In prompt.
Set appereance of the In prompt.
[ "Set", "appereance", "of", "the", "In", "prompt", "." ]
def set_in_prompt(self, in_prompt): """Set appereance of the In prompt.""" self.in_prompt = in_prompt
[ "def", "set_in_prompt", "(", "self", ",", "in_prompt", ")", ":", "self", ".", "in_prompt", "=", "in_prompt" ]
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/ipythonconsole/widgets/shell.py#L361-L363
open-cogsci/OpenSesame
c4a3641b097a80a76937edbd8c365f036bcc9705
libqtopensesame/items/qtplugin.py
python
qtplugin.add_control
(self, label, widget, tooltip=None, min_width=200, info=None)
desc: Adds a generic control QWidget. arguments: label: A text label. widget: A QWidget. keywords: tooltip: A tooltip text. min_width: A minimum width for the widget. info: Additional info, to be presented to the right of the control.
desc: Adds a generic control QWidget.
[ "desc", ":", "Adds", "a", "generic", "control", "QWidget", "." ]
def add_control(self, label, widget, tooltip=None, min_width=200, info=None): """ desc: Adds a generic control QWidget. arguments: label: A text label. widget: A QWidget. keywords: tooltip: A tooltip text. min_width: A minimum width for the widget. info: Additional info, to be presented ...
[ "def", "add_control", "(", "self", ",", "label", ",", "widget", ",", "tooltip", "=", "None", ",", "min_width", "=", "200", ",", "info", "=", "None", ")", ":", "if", "tooltip", "is", "not", "None", ":", "try", ":", "widget", ".", "setToolTip", "(", ...
https://github.com/open-cogsci/OpenSesame/blob/c4a3641b097a80a76937edbd8c365f036bcc9705/libqtopensesame/items/qtplugin.py#L114-L155
JacquesLucke/animation_nodes
b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1
animation_nodes/nodes/boolean/logic_operators.py
python
LogicOperatorsNode.create
(self)
[]
def create(self): self.newInput("Boolean", "A", "a") self.newInput("Boolean", "B", "b") self.newOutput("Boolean", "Result", "result")
[ "def", "create", "(", "self", ")", ":", "self", ".", "newInput", "(", "\"Boolean\"", ",", "\"A\"", ",", "\"a\"", ")", "self", ".", "newInput", "(", "\"Boolean\"", ",", "\"B\"", ",", "\"b\"", ")", "self", ".", "newOutput", "(", "\"Boolean\"", ",", "\"Re...
https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/boolean/logic_operators.py#L23-L26
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/function_field/place.py
python
FunctionFieldPlace.__radd__
(self, other)
Return the prime divisor of the place if ``other`` is zero. This is only to support the ``sum`` function, that adds the argument to initial (int) zero. EXAMPLES:: sage: k.<a>=GF(2) sage: K.<x>=FunctionField(k) sage: sum(K.places_finite()) Place ...
Return the prime divisor of the place if ``other`` is zero.
[ "Return", "the", "prime", "divisor", "of", "the", "place", "if", "other", "is", "zero", "." ]
def __radd__(self, other): """ Return the prime divisor of the place if ``other`` is zero. This is only to support the ``sum`` function, that adds the argument to initial (int) zero. EXAMPLES:: sage: k.<a>=GF(2) sage: K.<x>=FunctionField(k) ...
[ "def", "__radd__", "(", "self", ",", "other", ")", ":", "if", "other", "==", "0", ":", "from", ".", "divisor", "import", "prime_divisor", "return", "prime_divisor", "(", "self", ".", "function_field", "(", ")", ",", "self", ")", "raise", "NotImplementedErr...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/function_field/place.py#L234-L261
jython/jython3
def4f8ec47cb7a9c799ea4c745f12badf92c5769
lib-python/3.5.1/tkinter/__init__.py
python
Canvas.type
(self, tagOrId)
return self.tk.call(self._w, 'type', tagOrId) or None
Return the type of the item TAGORID.
Return the type of the item TAGORID.
[ "Return", "the", "type", "of", "the", "item", "TAGORID", "." ]
def type(self, tagOrId): """Return the type of the item TAGORID.""" return self.tk.call(self._w, 'type', tagOrId) or None
[ "def", "type", "(", "self", ",", "tagOrId", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'type'", ",", "tagOrId", ")", "or", "None" ]
https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/tkinter/__init__.py#L2469-L2471
tdamdouni/Pythonista
3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad
scenes/mazecraze.py
python
MazeScene.initgame
(self)
initialize system options and start a new game.
initialize system options and start a new game.
[ "initialize", "system", "options", "and", "start", "a", "new", "game", "." ]
def initgame(self): '''initialize system options and start a new game.''' global cellsize global offset global cols global rows #Size of maze based on difficulty level. # of rows increases by 2 per level. rows = defrow + (2 * self.optionscreen.difficulty) #If on IPhone. if not IPad...
[ "def", "initgame", "(", "self", ")", ":", "global", "cellsize", "global", "offset", "global", "cols", "global", "rows", "#Size of maze based on difficulty level. # of rows increases by 2 per level.", "rows", "=", "defrow", "+", "(", "2", "*", "self", ".", "optionscree...
https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/scenes/mazecraze.py#L681-L706
CGCookie/retopoflow
3d8b3a47d1d661f99ab0aeb21d31370bf15de35e
retopoflow/rf/rf_target.py
python
RetopoFlow_Target.set2D_crawl_vert
(self, vert:RFVert, xy:Point2D)
[]
def set2D_crawl_vert(self, vert:RFVert, xy:Point2D): hits = self.raycast_sources_Point2D_all(xy) if not hits: return # find closest co = vert.co p,n,_,_ = min(hits, key=lambda hit:(hit[0]-co).length) vert.co = p vert.normal = n
[ "def", "set2D_crawl_vert", "(", "self", ",", "vert", ":", "RFVert", ",", "xy", ":", "Point2D", ")", ":", "hits", "=", "self", ".", "raycast_sources_Point2D_all", "(", "xy", ")", "if", "not", "hits", ":", "return", "# find closest", "co", "=", "vert", "."...
https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rf/rf_target.py#L565-L572
wwqgtxx/wwqLyParse
33136508e52821babd9294fdecffbdf02d73a6fc
wwqLyParse/lib/flask_lib/jinja2/environment.py
python
Environment.from_string
(self, source, globals=None, template_class=None)
return cls.from_code(self, self.compile(source), globals, None)
Load a template from a string. This parses the source given and returns a :class:`Template` object.
Load a template from a string. This parses the source given and returns a :class:`Template` object.
[ "Load", "a", "template", "from", "a", "string", ".", "This", "parses", "the", "source", "given", "and", "returns", "a", ":", "class", ":", "Template", "object", "." ]
def from_string(self, source, globals=None, template_class=None): """Load a template from a string. This parses the source given and returns a :class:`Template` object. """ globals = self.make_globals(globals) cls = template_class or self.template_class return cls.from_c...
[ "def", "from_string", "(", "self", ",", "source", ",", "globals", "=", "None", ",", "template_class", "=", "None", ")", ":", "globals", "=", "self", ".", "make_globals", "(", "globals", ")", "cls", "=", "template_class", "or", "self", ".", "template_class"...
https://github.com/wwqgtxx/wwqLyParse/blob/33136508e52821babd9294fdecffbdf02d73a6fc/wwqLyParse/lib/flask_lib/jinja2/environment.py#L874-L880
shaneshixiang/rllabplusplus
4d55f96ec98e3fe025b7991945e3e6a54fd5449f
rllab/rllab_mujoco_py/glfw.py
python
get_gamma_ramp
(monitor)
return gammaramp.unwrap()
Retrieves the current gamma ramp for the specified monitor. Wrapper for: const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
Retrieves the current gamma ramp for the specified monitor.
[ "Retrieves", "the", "current", "gamma", "ramp", "for", "the", "specified", "monitor", "." ]
def get_gamma_ramp(monitor): ''' Retrieves the current gamma ramp for the specified monitor. Wrapper for: const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor); ''' gammaramp = _glfw.glfwGetGammaRamp(monitor).contents return gammaramp.unwrap()
[ "def", "get_gamma_ramp", "(", "monitor", ")", ":", "gammaramp", "=", "_glfw", ".", "glfwGetGammaRamp", "(", "monitor", ")", ".", "contents", "return", "gammaramp", ".", "unwrap", "(", ")" ]
https://github.com/shaneshixiang/rllabplusplus/blob/4d55f96ec98e3fe025b7991945e3e6a54fd5449f/rllab/rllab_mujoco_py/glfw.py#L731-L739
evennia/evennia
fa79110ba6b219932f22297838e8ac72ebc0be0e
evennia/accounts/accounts.py
python
AccountSessionHandler.get
(self, sessid=None)
Get the sessions linked to this object. Args: sessid (int, optional): Specify a given session by session id. Returns: sessions (list): A list of Session objects. If `sessid` is given, this is a list with one (or zero) elements.
Get the sessions linked to this object.
[ "Get", "the", "sessions", "linked", "to", "this", "object", "." ]
def get(self, sessid=None): """ Get the sessions linked to this object. Args: sessid (int, optional): Specify a given session by session id. Returns: sessions (list): A list of Session objects. If `sessid` is given, this is a list...
[ "def", "get", "(", "self", ",", "sessid", "=", "None", ")", ":", "global", "_SESSIONS", "if", "not", "_SESSIONS", ":", "from", "evennia", ".", "server", ".", "sessionhandler", "import", "SESSIONS", "as", "_SESSIONS", "if", "sessid", ":", "return", "make_it...
https://github.com/evennia/evennia/blob/fa79110ba6b219932f22297838e8ac72ebc0be0e/evennia/accounts/accounts.py#L78-L97
TheSouthFrog/stylealign
910632d2fccc9db61b00c265ae18a88913113c1d
pytorch_code/utils.py
python
get_data_loader_list
(root, file_list, batch_size, train, new_size=None, height=256, width=256, num_workers=4, crop=True)
return loader
[]
def get_data_loader_list(root, file_list, batch_size, train, new_size=None, height=256, width=256, num_workers=4, crop=True): transform_list = [transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))] ...
[ "def", "get_data_loader_list", "(", "root", ",", "file_list", ",", "batch_size", ",", "train", ",", "new_size", "=", "None", ",", "height", "=", "256", ",", "width", "=", "256", ",", "num_workers", "=", "4", ",", "crop", "=", "True", ")", ":", "transfo...
https://github.com/TheSouthFrog/stylealign/blob/910632d2fccc9db61b00c265ae18a88913113c1d/pytorch_code/utils.py#L74-L85
uvemas/ViTables
2ce8ec26f85c7392677cf0c7c83ad1ddd7d071e0
vitables/utils.py
python
getSelectedNodes
()
return [getModel().nodeFromIndex(index).node for index in getSelectedIndexes()]
Return list of selected nodes.
Return list of selected nodes.
[ "Return", "list", "of", "selected", "nodes", "." ]
def getSelectedNodes(): """Return list of selected nodes.""" return [getModel().nodeFromIndex(index).node for index in getSelectedIndexes()]
[ "def", "getSelectedNodes", "(", ")", ":", "return", "[", "getModel", "(", ")", ".", "nodeFromIndex", "(", "index", ")", ".", "node", "for", "index", "in", "getSelectedIndexes", "(", ")", "]" ]
https://github.com/uvemas/ViTables/blob/2ce8ec26f85c7392677cf0c7c83ad1ddd7d071e0/vitables/utils.py#L101-L104
uvemas/ViTables
2ce8ec26f85c7392677cf0c7c83ad1ddd7d071e0
vitables/calculator/calculator.py
python
CalculatorDialog.on_buttons_clicked
(self, button)
Slot for apply button, run and store saved expressions.
Slot for apply button, run and store saved expressions.
[ "Slot", "for", "apply", "button", "run", "and", "store", "saved", "expressions", "." ]
def on_buttons_clicked(self, button): """Slot for apply button, run and store saved expressions.""" button_id = self.buttons.standardButton(button) if button_id == QtWidgets.QDialogButtonBox.Apply: if self._execute_expression(): self._store_expressions() ...
[ "def", "on_buttons_clicked", "(", "self", ",", "button", ")", ":", "button_id", "=", "self", ".", "buttons", ".", "standardButton", "(", "button", ")", "if", "button_id", "==", "QtWidgets", ".", "QDialogButtonBox", ".", "Apply", ":", "if", "self", ".", "_e...
https://github.com/uvemas/ViTables/blob/2ce8ec26f85c7392677cf0c7c83ad1ddd7d071e0/vitables/calculator/calculator.py#L153-L159
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/distutils/command/build_ext.py
python
build_ext.get_export_symbols
(self, ext)
return ext.export_symbols
Return the list of symbols that a shared extension has to export. This either uses 'ext.export_symbols' or, if it's not provided, "PyInit_" + module_name. Only relevant on Windows, where the .pyd file (DLL) must export the module "PyInit_" function.
Return the list of symbols that a shared extension has to export. This either uses 'ext.export_symbols' or, if it's not provided, "PyInit_" + module_name. Only relevant on Windows, where the .pyd file (DLL) must export the module "PyInit_" function.
[ "Return", "the", "list", "of", "symbols", "that", "a", "shared", "extension", "has", "to", "export", ".", "This", "either", "uses", "ext", ".", "export_symbols", "or", "if", "it", "s", "not", "provided", "PyInit_", "+", "module_name", ".", "Only", "relevan...
def get_export_symbols(self, ext): """Return the list of symbols that a shared extension has to export. This either uses 'ext.export_symbols' or, if it's not provided, "PyInit_" + module_name. Only relevant on Windows, where the .pyd file (DLL) must export the module "PyInit_" function...
[ "def", "get_export_symbols", "(", "self", ",", "ext", ")", ":", "initfunc_name", "=", "\"PyInit_\"", "+", "ext", ".", "name", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", "if", "initfunc_name", "not", "in", "ext", ".", "export_symbols", ":", "ext...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/distutils/command/build_ext.py#L684-L693
mwaskom/seaborn
77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b
seaborn/external/husl.py
python
rgb_to_lch
(r, g, b)
return luv_to_lch(xyz_to_luv(rgb_to_xyz([r, g, b])))
[]
def rgb_to_lch(r, g, b): return luv_to_lch(xyz_to_luv(rgb_to_xyz([r, g, b])))
[ "def", "rgb_to_lch", "(", "r", ",", "g", ",", "b", ")", ":", "return", "luv_to_lch", "(", "xyz_to_luv", "(", "rgb_to_xyz", "(", "[", "r", ",", "g", ",", "b", "]", ")", ")", ")" ]
https://github.com/mwaskom/seaborn/blob/77e3b6b03763d24cc99a8134ee9a6f43b32b8e7b/seaborn/external/husl.py#L67-L68
bitcraze/crazyflie-clients-python
65d433a945b097333e5681a937354045dd4b66f4
src/cfclient/ui/tabs/locopositioning_tab.py
python
Anchor.get_position
(self)
return (self.x, self.y, self.z)
Returns the position as a vector
Returns the position as a vector
[ "Returns", "the", "position", "as", "a", "vector" ]
def get_position(self): """Returns the position as a vector""" return (self.x, self.y, self.z)
[ "def", "get_position", "(", "self", ")", ":", "return", "(", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "z", ")" ]
https://github.com/bitcraze/crazyflie-clients-python/blob/65d433a945b097333e5681a937354045dd4b66f4/src/cfclient/ui/tabs/locopositioning_tab.py#L86-L88
blackfeather-wang/ISDA-for-Deep-Networks
b66a594482557dada126211d65a4e9b6f4328423
Image classification on CIFAR/networks/se_wideresnet.py
python
NetworkBlock.forward
(self, x)
return self.layer(x)
[]
def forward(self, x): return self.layer(x)
[ "def", "forward", "(", "self", ",", "x", ")", ":", "return", "self", ".", "layer", "(", "x", ")" ]
https://github.com/blackfeather-wang/ISDA-for-Deep-Networks/blob/b66a594482557dada126211d65a4e9b6f4328423/Image classification on CIFAR/networks/se_wideresnet.py#L50-L51
mikedh/trimesh
6b1e05616b44e6dd708d9bc748b211656ebb27ec
trimesh/exchange/obj.py
python
_parse_vertices
(text)
return v, vn, vt, vc
Parse raw OBJ text into vertices, vertex normals, vertex colors, and vertex textures. Parameters ------------- text : str Full text of an OBJ file Returns ------------- v : (n, 3) float Vertices in space vn : (m, 3) float or None Vertex normals vt : (p, 2) float o...
Parse raw OBJ text into vertices, vertex normals, vertex colors, and vertex textures.
[ "Parse", "raw", "OBJ", "text", "into", "vertices", "vertex", "normals", "vertex", "colors", "and", "vertex", "textures", "." ]
def _parse_vertices(text): """ Parse raw OBJ text into vertices, vertex normals, vertex colors, and vertex textures. Parameters ------------- text : str Full text of an OBJ file Returns ------------- v : (n, 3) float Vertices in space vn : (m, 3) float or None ...
[ "def", "_parse_vertices", "(", "text", ")", ":", "# the first position of a vertex in the text blob", "# we only really need to search from the start of the file", "# up to the location of out our first vertex but we", "# are going to use this check for \"do we have texture\"", "# determination ...
https://github.com/mikedh/trimesh/blob/6b1e05616b44e6dd708d9bc748b211656ebb27ec/trimesh/exchange/obj.py#L519-L626
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/gpio/zeroborg/__init__.py
python
GpioZeroborgPlugin.__init__
(self, directions: Dict[str, List[float]] = None, **kwargs)
:param directions: Configuration for the motor directions. A direction is basically a configuration of the power delivered to each motor to allow whichever object you're controlling (wheels, robotic arms etc.) to move in a certain direction. In my experience the ZeroBorg always needs a bit of ca...
:param directions: Configuration for the motor directions. A direction is basically a configuration of the power delivered to each motor to allow whichever object you're controlling (wheels, robotic arms etc.) to move in a certain direction. In my experience the ZeroBorg always needs a bit of ca...
[ ":", "param", "directions", ":", "Configuration", "for", "the", "motor", "directions", ".", "A", "direction", "is", "basically", "a", "configuration", "of", "the", "power", "delivered", "to", "each", "motor", "to", "allow", "whichever", "object", "you", "re", ...
def __init__(self, directions: Dict[str, List[float]] = None, **kwargs): """ :param directions: Configuration for the motor directions. A direction is basically a configuration of the power delivered to each motor to allow whichever object you're controlling (wheels, robotic arms etc.) to ...
[ "def", "__init__", "(", "self", ",", "directions", ":", "Dict", "[", "str", ",", "List", "[", "float", "]", "]", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "directions", "is", "None", ":", "directions", "=", "{", "}", "import", "platypus...
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/gpio/zeroborg/__init__.py#L33-L85