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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/ds/validations.py | python | validate_edition | (value) | return "" | Raise exception if edition not one of the allowed values. | Raise exception if edition not one of the allowed values. | [
"Raise",
"exception",
"if",
"edition",
"not",
"one",
"of",
"the",
"allowed",
"values",
"."
] | def validate_edition(value):
"""Raise exception if edition not one of the allowed values."""
if value and value not in ["Enterprise", "Standard"]:
return "satisfy enum value set: [Enterprise, Standard]"
return "" | [
"def",
"validate_edition",
"(",
"value",
")",
":",
"if",
"value",
"and",
"value",
"not",
"in",
"[",
"\"Enterprise\"",
",",
"\"Standard\"",
"]",
":",
"return",
"\"satisfy enum value set: [Enterprise, Standard]\"",
"return",
"\"\""
] | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/ds/validations.py#L83-L87 | |
barseghyanartur/django-fobi | a998feae007d7fe3637429a80e42952ec7cda79f | examples/simple/factories/page_page.py | python | FobiFormPageFactory.fobi_form_content | (obj, created, extracted, **kwargs) | Create fobi content for the instance created. | Create fobi content for the instance created. | [
"Create",
"fobi",
"content",
"for",
"the",
"instance",
"created",
"."
] | def fobi_form_content(obj, created, extracted, **kwargs):
"""Create fobi content for the instance created."""
if created:
form_entry = create_form_with_entries(is_public=True)
obj.content.item.fobiformwidget_set.model.objects.create(
parent=obj,
r... | [
"def",
"fobi_form_content",
"(",
"obj",
",",
"created",
",",
"extracted",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"created",
":",
"form_entry",
"=",
"create_form_with_entries",
"(",
"is_public",
"=",
"True",
")",
"obj",
".",
"content",
".",
"item",
".",
... | https://github.com/barseghyanartur/django-fobi/blob/a998feae007d7fe3637429a80e42952ec7cda79f/examples/simple/factories/page_page.py#L82-L91 | ||
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/textwrap.py | python | dedent | (text) | return text | Remove any common leading whitespace from every line in `text`.
This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.
Note that tabs and spaces are both treated as whitespace, but they
are not equa... | Remove any common leading whitespace from every line in `text`. | [
"Remove",
"any",
"common",
"leading",
"whitespace",
"from",
"every",
"line",
"in",
"text",
"."
] | def dedent(text):
"""Remove any common leading whitespace from every line in `text`.
This can be used to make triple-quoted strings line up with the left
edge of the display, while still presenting them in the source code
in indented form.
Note that tabs and spaces are both treated as whitespace, ... | [
"def",
"dedent",
"(",
"text",
")",
":",
"# Look for the longest leading string of spaces and tabs common to",
"# all lines.",
"margin",
"=",
"None",
"text",
"=",
"_whitespace_only_re",
".",
"sub",
"(",
"''",
",",
"text",
")",
"indents",
"=",
"_leading_whitespace_re",
... | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/textwrap.py#L374-L424 | |
Dash-Industry-Forum/dash-live-source-simulator | 23cb15c35656a731d9f6d78a30f2713eff2ec20d | dashlivesim/dashlib/mp4.py | python | genc_box.get_sibling | (self, type_) | return None | [] | def get_sibling(self, type_):
box_list = self.parent.children
for box_ in box_list:
if box_.type == type_:
return box_
return None | [
"def",
"get_sibling",
"(",
"self",
",",
"type_",
")",
":",
"box_list",
"=",
"self",
".",
"parent",
".",
"children",
"for",
"box_",
"in",
"box_list",
":",
"if",
"box_",
".",
"type",
"==",
"type_",
":",
"return",
"box_",
"return",
"None"
] | https://github.com/Dash-Industry-Forum/dash-live-source-simulator/blob/23cb15c35656a731d9f6d78a30f2713eff2ec20d/dashlivesim/dashlib/mp4.py#L605-L610 | |||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pip/_vendor/requests/api.py | python | head | (url, **kwargs) | return request('head', url, **kwargs) | Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response | Sends a HEAD request. | [
"Sends",
"a",
"HEAD",
"request",
"."
] | def head(url, **kwargs):
"""Sends a HEAD request.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
kwargs.setdefault('allow_redirects', False)
re... | [
"def",
"head",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"False",
")",
"return",
"request",
"(",
"'head'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/requests/api.py#L86-L96 | |
lepture/flask-oauthlib | d8369c8ae06150d37da2eba951ae9646235f940b | flask_oauthlib/contrib/oauth2.py | python | bind_sqlalchemy | (provider, session, user=None, client=None,
token=None, grant=None, current_user=None) | Configures the given :class:`OAuth2Provider` instance with the
required getters and setters for persistence with SQLAlchemy.
An example of using all models::
oauth = OAuth2Provider(app)
bind_sqlalchemy(oauth, session, user=User, client=Client,
token=Token, grant=Grant,... | Configures the given :class:`OAuth2Provider` instance with the
required getters and setters for persistence with SQLAlchemy. | [
"Configures",
"the",
"given",
":",
"class",
":",
"OAuth2Provider",
"instance",
"with",
"the",
"required",
"getters",
"and",
"setters",
"for",
"persistence",
"with",
"SQLAlchemy",
"."
] | def bind_sqlalchemy(provider, session, user=None, client=None,
token=None, grant=None, current_user=None):
"""Configures the given :class:`OAuth2Provider` instance with the
required getters and setters for persistence with SQLAlchemy.
An example of using all models::
oauth = OA... | [
"def",
"bind_sqlalchemy",
"(",
"provider",
",",
"session",
",",
"user",
"=",
"None",
",",
"client",
"=",
"None",
",",
"token",
"=",
"None",
",",
"grant",
"=",
"None",
",",
"current_user",
"=",
"None",
")",
":",
"if",
"user",
":",
"user_binding",
"=",
... | https://github.com/lepture/flask-oauthlib/blob/d8369c8ae06150d37da2eba951ae9646235f940b/flask_oauthlib/contrib/oauth2.py#L121-L188 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/turtle.py | python | TurtleScreen.listen | (self, xdummy=None, ydummy=None) | Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.listen() | Set focus on TurtleScreen (in order to collect key-events) | [
"Set",
"focus",
"on",
"TurtleScreen",
"(",
"in",
"order",
"to",
"collect",
"key",
"-",
"events",
")"
] | def listen(self, xdummy=None, ydummy=None):
"""Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.... | [
"def",
"listen",
"(",
"self",
",",
"xdummy",
"=",
"None",
",",
"ydummy",
"=",
"None",
")",
":",
"self",
".",
"_listen",
"(",
")"
] | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/turtle.py#L1428-L1438 | ||
tadejmagajna/HereIsWally | eba5274f65c1b9b636aba23942364933a632efc1 | object_detection/utils/np_box_list_ops.py | python | multi_class_non_max_suppression | (boxlist, score_thresh, iou_thresh,
max_output_size) | return sorted_boxes | Multi-class version of non maximum suppression.
This op greedily selects a subset of detection bounding boxes, pruning
away boxes that have high IOU (intersection over union) overlap (> thresh)
with already selected boxes. It operates independently for each class for
which scores are provided (via the scores ... | Multi-class version of non maximum suppression. | [
"Multi",
"-",
"class",
"version",
"of",
"non",
"maximum",
"suppression",
"."
] | def multi_class_non_max_suppression(boxlist, score_thresh, iou_thresh,
max_output_size):
"""Multi-class version of non maximum suppression.
This op greedily selects a subset of detection bounding boxes, pruning
away boxes that have high IOU (intersection over union) overlap (>... | [
"def",
"multi_class_non_max_suppression",
"(",
"boxlist",
",",
"score_thresh",
",",
"iou_thresh",
",",
"max_output_size",
")",
":",
"if",
"not",
"0",
"<=",
"iou_thresh",
"<=",
"1.0",
":",
"raise",
"ValueError",
"(",
"'thresh must be between 0 and 1'",
")",
"if",
"... | https://github.com/tadejmagajna/HereIsWally/blob/eba5274f65c1b9b636aba23942364933a632efc1/object_detection/utils/np_box_list_ops.py#L236-L306 | |
athena-team/athena | e704884ec6a3a947769d892aa267578038e49ecb | athena/data/datasets/base.py | python | BaseDatasetBuilder.reload_config | (self, config) | reload the config | reload the config | [
"reload",
"the",
"config"
] | def reload_config(self, config):
""" reload the config """
if config is not None:
self.hparams.override_from_dict(config) | [
"def",
"reload_config",
"(",
"self",
",",
"config",
")",
":",
"if",
"config",
"is",
"not",
"None",
":",
"self",
".",
"hparams",
".",
"override_from_dict",
"(",
"config",
")"
] | https://github.com/athena-team/athena/blob/e704884ec6a3a947769d892aa267578038e49ecb/athena/data/datasets/base.py#L88-L91 | ||
sqall01/alertR | e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13 | managerClientKeypad/lib/update.py | python | Updater.getInstanceInformation | (self) | return self.instanceInfo | This function returns the instance information data.
:return: instance information data. | This function returns the instance information data. | [
"This",
"function",
"returns",
"the",
"instance",
"information",
"data",
"."
] | def getInstanceInformation(self) -> Dict[str, Any]:
"""
This function returns the instance information data.
:return: instance information data.
"""
self._acquireLock()
utcTimestamp = int(time.time())
if (utcTimestamp - self.lastChecked) > 60 or self.instanceInfo... | [
"def",
"getInstanceInformation",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"self",
".",
"_acquireLock",
"(",
")",
"utcTimestamp",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"if",
"(",
"utcTimestamp",
"-",
"self",
"."... | https://github.com/sqall01/alertR/blob/e1d1a83e54f876cc4cd7bd87387e05cb75d4dc13/managerClientKeypad/lib/update.py#L633-L648 | |
locationtech-labs/geopyspark | 97bcb17a56ed4b4059e2f0dbab97706562cac692 | geopyspark/__init__.py | python | scala_companion | (class_name, gateway_client=None) | return JavaClass(class_name + "$", gateway_client).__getattr__("MODULE$") | Returns referece to Scala companion object | Returns referece to Scala companion object | [
"Returns",
"referece",
"to",
"Scala",
"companion",
"object"
] | def scala_companion(class_name, gateway_client=None):
"""Returns referece to Scala companion object"""
gateway_client = gateway_client or get_spark_context()._gateway._gateway_client
return JavaClass(class_name + "$", gateway_client).__getattr__("MODULE$") | [
"def",
"scala_companion",
"(",
"class_name",
",",
"gateway_client",
"=",
"None",
")",
":",
"gateway_client",
"=",
"gateway_client",
"or",
"get_spark_context",
"(",
")",
".",
"_gateway",
".",
"_gateway_client",
"return",
"JavaClass",
"(",
"class_name",
"+",
"\"$\""... | https://github.com/locationtech-labs/geopyspark/blob/97bcb17a56ed4b4059e2f0dbab97706562cac692/geopyspark/__init__.py#L20-L23 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/utils/filtering.py | python | morlet | (x, sf, f, width=7.0) | return xout | Complex decomposition of a signal x using the morlet wavelet.
Parameters
----------
x : array_like
The signal to use for the complex decomposition. Must be
a vector of length N.
sf : float
Sampling frequency
f : array_like, shape (2,)
Frequency vector
width : flo... | Complex decomposition of a signal x using the morlet wavelet. | [
"Complex",
"decomposition",
"of",
"a",
"signal",
"x",
"using",
"the",
"morlet",
"wavelet",
"."
] | def morlet(x, sf, f, width=7.0):
"""Complex decomposition of a signal x using the morlet wavelet.
Parameters
----------
x : array_like
The signal to use for the complex decomposition. Must be
a vector of length N.
sf : float
Sampling frequency
f : array_like, shape (2,)
... | [
"def",
"morlet",
"(",
"x",
",",
"sf",
",",
"f",
",",
"width",
"=",
"7.0",
")",
":",
"# Get the wavelet :",
"m",
"=",
"_morlet_wlt",
"(",
"sf",
",",
"f",
",",
"width",
")",
"# Compute morlet :",
"y",
"=",
"np",
".",
"convolve",
"(",
"x",
",",
"m",
... | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/utils/filtering.py#L97-L124 | |
matrix-org/synapse | 8e57584a5859a9002759963eb546d523d2498a01 | synapse/server_notices/server_notices_manager.py | python | ServerNoticesManager.get_or_create_notice_room_for_user | (self, user_id: str) | return room_id | Get the room for notices for a given user
If we have not yet created a notice room for this user, create it, but don't
invite the user to it.
Args:
user_id: complete user id for the user we want a room for
Returns:
room id of notice room. | Get the room for notices for a given user | [
"Get",
"the",
"room",
"for",
"notices",
"for",
"a",
"given",
"user"
] | async def get_or_create_notice_room_for_user(self, user_id: str) -> str:
"""Get the room for notices for a given user
If we have not yet created a notice room for this user, create it, but don't
invite the user to it.
Args:
user_id: complete user id for the user we want a r... | [
"async",
"def",
"get_or_create_notice_room_for_user",
"(",
"self",
",",
"user_id",
":",
"str",
")",
"->",
"str",
":",
"if",
"self",
".",
"server_notices_mxid",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Server notices not enabled\"",
")",
"assert",
"self",
... | https://github.com/matrix-org/synapse/blob/8e57584a5859a9002759963eb546d523d2498a01/synapse/server_notices/server_notices_manager.py#L93-L167 | |
googlefonts/nototools | 903a218f62256a286cde48c76b3051703f8a1de5 | nototools/hb_input.py | python | HbInputGenerator._min_permutation | (self, lists, target) | return res | Deterministically select a permutation, containing target list as a
sublist, of items picked one from each input list. | Deterministically select a permutation, containing target list as a
sublist, of items picked one from each input list. | [
"Deterministically",
"select",
"a",
"permutation",
"containing",
"target",
"list",
"as",
"a",
"sublist",
"of",
"items",
"picked",
"one",
"from",
"each",
"input",
"list",
"."
] | def _min_permutation(self, lists, target):
"""Deterministically select a permutation, containing target list as a
sublist, of items picked one from each input list.
"""
if not all(lists):
return []
i = 0
j = 0
res = [None for _ in range(len(lists))]
... | [
"def",
"_min_permutation",
"(",
"self",
",",
"lists",
",",
"target",
")",
":",
"if",
"not",
"all",
"(",
"lists",
")",
":",
"return",
"[",
"]",
"i",
"=",
"0",
"j",
"=",
"0",
"res",
"=",
"[",
"None",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
... | https://github.com/googlefonts/nototools/blob/903a218f62256a286cde48c76b3051703f8a1de5/nototools/hb_input.py#L313-L332 | |
lbryio/lbry-sdk | f78e3825ca0f130834d3876a824f9d380501ced8 | lbry/wallet/server/db/revertable.py | python | RevertableOpStack.__init__ | (self, get_fn: Callable[[bytes], Optional[bytes]], unsafe_prefixes=None) | This represents a sequence of revertable puts and deletes to a key-value database that checks for integrity
violations when applying the puts and deletes. The integrity checks assure that keys that do not exist
are not deleted, and that when keys are deleted the current value is correctly known so that ... | This represents a sequence of revertable puts and deletes to a key-value database that checks for integrity
violations when applying the puts and deletes. The integrity checks assure that keys that do not exist
are not deleted, and that when keys are deleted the current value is correctly known so that ... | [
"This",
"represents",
"a",
"sequence",
"of",
"revertable",
"puts",
"and",
"deletes",
"to",
"a",
"key",
"-",
"value",
"database",
"that",
"checks",
"for",
"integrity",
"violations",
"when",
"applying",
"the",
"puts",
"and",
"deletes",
".",
"The",
"integrity",
... | def __init__(self, get_fn: Callable[[bytes], Optional[bytes]], unsafe_prefixes=None):
"""
This represents a sequence of revertable puts and deletes to a key-value database that checks for integrity
violations when applying the puts and deletes. The integrity checks assure that keys that do not e... | [
"def",
"__init__",
"(",
"self",
",",
"get_fn",
":",
"Callable",
"[",
"[",
"bytes",
"]",
",",
"Optional",
"[",
"bytes",
"]",
"]",
",",
"unsafe_prefixes",
"=",
"None",
")",
":",
"self",
".",
"_get",
"=",
"get_fn",
"self",
".",
"_items",
"=",
"defaultdi... | https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/wallet/server/db/revertable.py#L85-L99 | ||
sefakilic/goodreads | 5187100d66b87c87db8b095bbf576e1b92422a23 | goodreads/group.py | python | GoodreadsGroup.image_url | (self) | return self._group_dict['image_url'] | Image URL for the group | Image URL for the group | [
"Image",
"URL",
"for",
"the",
"group"
] | def image_url(self):
"""Image URL for the group"""
return self._group_dict['image_url'] | [
"def",
"image_url",
"(",
"self",
")",
":",
"return",
"self",
".",
"_group_dict",
"[",
"'image_url'",
"]"
] | https://github.com/sefakilic/goodreads/blob/5187100d66b87c87db8b095bbf576e1b92422a23/goodreads/group.py#L42-L44 | |
aleju/imgaug | 0101108d4fed06bc5056c4a03e2bcb0216dac326 | imgaug/augmenters/color.py | python | change_colorspace_ | (image, to_colorspace, from_colorspace=CSPACE_RGB) | return image_aug | Change the colorspace of an image inplace.
.. note::
All outputs of this function are `uint8`. For some colorspaces this
may not be optimal.
.. note::
Output grayscale images will still have three channels.
**Supported dtypes**:
* ``uint8``: yes; fully tested
* ... | Change the colorspace of an image inplace. | [
"Change",
"the",
"colorspace",
"of",
"an",
"image",
"inplace",
"."
] | def change_colorspace_(image, to_colorspace, from_colorspace=CSPACE_RGB):
"""Change the colorspace of an image inplace.
.. note::
All outputs of this function are `uint8`. For some colorspaces this
may not be optimal.
.. note::
Output grayscale images will still have three channe... | [
"def",
"change_colorspace_",
"(",
"image",
",",
"to_colorspace",
",",
"from_colorspace",
"=",
"CSPACE_RGB",
")",
":",
"# some colorspaces here should use image/255.0 according to",
"# the docs, but at least for conversion to grayscale that",
"# results in errors, ie uint8 is expected",
... | https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/color.py#L177-L299 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/gui/signal/ui_elements/ui_grid.py | python | UiGrid._fcn_reorganize_grid | (self) | Re-organize the grid. | Re-organize the grid. | [
"Re",
"-",
"organize",
"the",
"grid",
"."
] | def _fcn_reorganize_grid(self):
"""Re-organize the grid."""
nshape = (self._grid_nrows.value(), self._grid_ncols.value())
self._grid.set_data(self._data, self._axis, force_shape=nshape) | [
"def",
"_fcn_reorganize_grid",
"(",
"self",
")",
":",
"nshape",
"=",
"(",
"self",
".",
"_grid_nrows",
".",
"value",
"(",
")",
",",
"self",
".",
"_grid_ncols",
".",
"value",
"(",
")",
")",
"self",
".",
"_grid",
".",
"set_data",
"(",
"self",
".",
"_dat... | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/gui/signal/ui_elements/ui_grid.py#L60-L63 | ||
MushroomRL/mushroom-rl | a0eaa2cf8001e433419234a9fc48b64170e3f61c | mushroom_rl/environments/mujoco_envs/humanoid_gait/reward_goals/velocity_profile.py | python | SquareWaveVelocityProfile.__init__ | (self, amplitude, period, timestep, duty=0.5, offset=0,
phase=0) | Constructor.
Args:
amplitude (np.ndarray): amplitude of the square wave;
period (float): time corresponding to one cycle;
timestep (float): time corresponding to each step of simulation;
duty (float, 0.5): value between 0 and 1 and determines the relative
... | Constructor. | [
"Constructor",
"."
] | def __init__(self, amplitude, period, timestep, duty=0.5, offset=0,
phase=0):
"""
Constructor.
Args:
amplitude (np.ndarray): amplitude of the square wave;
period (float): time corresponding to one cycle;
timestep (float): time corresponding t... | [
"def",
"__init__",
"(",
"self",
",",
"amplitude",
",",
"period",
",",
"timestep",
",",
"duty",
"=",
"0.5",
",",
"offset",
"=",
"0",
",",
"phase",
"=",
"0",
")",
":",
"time_array",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"period",
",",
"timestep",
... | https://github.com/MushroomRL/mushroom-rl/blob/a0eaa2cf8001e433419234a9fc48b64170e3f61c/mushroom_rl/environments/mujoco_envs/humanoid_gait/reward_goals/velocity_profile.py#L166-L186 | ||
OCA/account-financial-tools | 98d07b6448530d44bec195ff528b7a9452da1eae | account_chart_update/wizard/wizard_chart_update.py | python | WizardUpdateChartsAccounts._update_taxes | (self) | Process taxes to create/update/deactivate. | Process taxes to create/update/deactivate. | [
"Process",
"taxes",
"to",
"create",
"/",
"update",
"/",
"deactivate",
"."
] | def _update_taxes(self):
"""Process taxes to create/update/deactivate."""
# First create taxes in batch
taxes_to_create = self.tax_ids.filtered(lambda x: x.type == "new")
taxes_to_create.mapped("tax_id")._generate_tax(self.company_id)
for wiz_tax in taxes_to_create:
_... | [
"def",
"_update_taxes",
"(",
"self",
")",
":",
"# First create taxes in batch",
"taxes_to_create",
"=",
"self",
".",
"tax_ids",
".",
"filtered",
"(",
"lambda",
"x",
":",
"x",
".",
"type",
"==",
"\"new\"",
")",
"taxes_to_create",
".",
"mapped",
"(",
"\"tax_id\"... | https://github.com/OCA/account-financial-tools/blob/98d07b6448530d44bec195ff528b7a9452da1eae/account_chart_update/wizard/wizard_chart_update.py#L898-L926 | ||
glumpy/glumpy | 46a7635c08d3a200478397edbe0371a6c59cd9d7 | glumpy/ext/freetype/__init__.py | python | Stroker.export | ( self, outline ) | Call this function after get_border_counts to export all borders to
your own 'Outline' structure.
Note that this function appends the border points and contours to your
outline, but does not try to resize its arrays.
:param outline: The target outline. | Call this function after get_border_counts to export all borders to
your own 'Outline' structure. | [
"Call",
"this",
"function",
"after",
"get_border_counts",
"to",
"export",
"all",
"borders",
"to",
"your",
"own",
"Outline",
"structure",
"."
] | def export( self, outline ):
'''
Call this function after get_border_counts to export all borders to
your own 'Outline' structure.
Note that this function appends the border points and contours to your
outline, but does not try to resize its arrays.
:param outline: The ... | [
"def",
"export",
"(",
"self",
",",
"outline",
")",
":",
"FT_Stroker_Export",
"(",
"self",
".",
"_FT_Stroker",
",",
"outline",
".",
"_FT_Outline",
")"
] | https://github.com/glumpy/glumpy/blob/46a7635c08d3a200478397edbe0371a6c59cd9d7/glumpy/ext/freetype/__init__.py#L1943-L1953 | ||
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/utils.py | python | check_third_party | () | Checks whether third party software is available on the path
Raises
-------
:class:`~montreal_forced_aligner.exceptions.ThirdpartyError` | Checks whether third party software is available on the path | [
"Checks",
"whether",
"third",
"party",
"software",
"is",
"available",
"on",
"the",
"path"
] | def check_third_party():
"""
Checks whether third party software is available on the path
Raises
-------
:class:`~montreal_forced_aligner.exceptions.ThirdpartyError`
"""
bin_path = shutil.which("sox")
if bin_path is None:
raise ThirdpartyError("sox")
bin_path = shutil.which(... | [
"def",
"check_third_party",
"(",
")",
":",
"bin_path",
"=",
"shutil",
".",
"which",
"(",
"\"sox\"",
")",
"if",
"bin_path",
"is",
"None",
":",
"raise",
"ThirdpartyError",
"(",
"\"sox\"",
")",
"bin_path",
"=",
"shutil",
".",
"which",
"(",
"\"fstcompile\"",
"... | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/utils.py#L54-L70 | ||
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | pypy3.6/multiprocess/context.py | python | BaseContext.Value | (self, typecode_or_type, *args, lock=True) | return Value(typecode_or_type, *args, lock=lock,
ctx=self.get_context()) | Returns a synchronized shared object | Returns a synchronized shared object | [
"Returns",
"a",
"synchronized",
"shared",
"object"
] | def Value(self, typecode_or_type, *args, lock=True):
'''Returns a synchronized shared object'''
from .sharedctypes import Value
return Value(typecode_or_type, *args, lock=lock,
ctx=self.get_context()) | [
"def",
"Value",
"(",
"self",
",",
"typecode_or_type",
",",
"*",
"args",
",",
"lock",
"=",
"True",
")",
":",
"from",
".",
"sharedctypes",
"import",
"Value",
"return",
"Value",
"(",
"typecode_or_type",
",",
"*",
"args",
",",
"lock",
"=",
"lock",
",",
"ct... | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/pypy3.6/multiprocess/context.py#L131-L135 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/timer_comparison.py | python | ModuleTester.test_6 | (self) | Tests inplace w/ array | Tests inplace w/ array | [
"Tests",
"inplace",
"w",
"/",
"array"
] | def test_6(self):
"""
Tests inplace w/ array
"""
x = self.arange(10, dtype=float_)
y = self.arange(10)
xm = self.arange(10, dtype=float_)
xm[2] = self.masked
m = xm.mask
a = self.arange(10, dtype=float_)
a[-1] = self.masked
x += a
... | [
"def",
"test_6",
"(",
"self",
")",
":",
"x",
"=",
"self",
".",
"arange",
"(",
"10",
",",
"dtype",
"=",
"float_",
")",
"y",
"=",
"self",
".",
"arange",
"(",
"10",
")",
"xm",
"=",
"self",
".",
"arange",
"(",
"10",
",",
"dtype",
"=",
"float_",
"... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/numpy-1.16.0-py3.7-macosx-10.9-x86_64.egg/numpy/ma/timer_comparison.py#L290-L339 | ||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/cards/properties/beam.py | python | PBEAML.write_card | (self, size: int=8, is_double: bool=False) | return self.comment + print_card_16(card) | .. todo:: having bug with PBEAML | .. todo:: having bug with PBEAML | [
"..",
"todo",
"::",
"having",
"bug",
"with",
"PBEAML"
] | def write_card(self, size: int=8, is_double: bool=False) -> str:
""".. todo:: having bug with PBEAML"""
card = self.repr_fields()
if size == 8:
return self.comment + print_card_8(card)
return self.comment + print_card_16(card) | [
"def",
"write_card",
"(",
"self",
",",
"size",
":",
"int",
"=",
"8",
",",
"is_double",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"card",
"=",
"self",
".",
"repr_fields",
"(",
")",
"if",
"size",
"==",
"8",
":",
"return",
"self",
".",
"comm... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/properties/beam.py#L1733-L1738 | |
google/python-gflags | 4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6 | gflags/argument_parser.py | python | FloatParser.convert | (self, argument) | return float(argument) | Converts argument to a float; raises ValueError on errors. | Converts argument to a float; raises ValueError on errors. | [
"Converts",
"argument",
"to",
"a",
"float",
";",
"raises",
"ValueError",
"on",
"errors",
"."
] | def convert(self, argument):
"""Converts argument to a float; raises ValueError on errors."""
return float(argument) | [
"def",
"convert",
"(",
"self",
",",
"argument",
")",
":",
"return",
"float",
"(",
"argument",
")"
] | https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/argument_parser.py#L213-L215 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/agca/ideals.py | python | Ideal.product | (self, J) | return self._product(J) | Compute the ideal product of ``self`` and ``J``.
That is, compute the ideal generated by products `xy`, for `x` an element
of ``self`` and `y \in J`.
>>> from sympy.abc import x, y
>>> from sympy import QQ
>>> QQ.old_poly_ring(x, y).ideal(x).product(QQ.old_poly_ring(x, y).ideal... | Compute the ideal product of ``self`` and ``J``. | [
"Compute",
"the",
"ideal",
"product",
"of",
"self",
"and",
"J",
"."
] | def product(self, J):
"""
Compute the ideal product of ``self`` and ``J``.
That is, compute the ideal generated by products `xy`, for `x` an element
of ``self`` and `y \in J`.
>>> from sympy.abc import x, y
>>> from sympy import QQ
>>> QQ.old_poly_ring(x, y).ide... | [
"def",
"product",
"(",
"self",
",",
"J",
")",
":",
"self",
".",
"_check_ideal",
"(",
"J",
")",
"return",
"self",
".",
"_product",
"(",
"J",
")"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/polys/agca/ideals.py#L203-L216 | |
intel/CeTune | fdc523971dc6d52cbbefb24ff9504fdc934b31ca | analyzer/analyzer_remote.py | python | Analyzer.getParameters | (self) | return ps | [] | def getParameters(self):
dest_dir = self.cluster["dest_conf_dir"]
ps = ""
try:
with open("%s/vdbench_params.txt" % dest_dir.replace("raw","conf"), 'r') as f:
ps = f.read()
except:
pass
return ps | [
"def",
"getParameters",
"(",
"self",
")",
":",
"dest_dir",
"=",
"self",
".",
"cluster",
"[",
"\"dest_conf_dir\"",
"]",
"ps",
"=",
"\"\"",
"try",
":",
"with",
"open",
"(",
"\"%s/vdbench_params.txt\"",
"%",
"dest_dir",
".",
"replace",
"(",
"\"raw\"",
",",
"\... | https://github.com/intel/CeTune/blob/fdc523971dc6d52cbbefb24ff9504fdc934b31ca/analyzer/analyzer_remote.py#L493-L501 | |||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/mako/parsetree.py | python | ControlLine.is_ternary | (self, keyword) | return keyword in {
'if': set(['else', 'elif']),
'try': set(['except', 'finally']),
'for': set(['else'])
}.get(self.keyword, []) | return true if the given keyword is a ternary keyword
for this ControlLine | return true if the given keyword is a ternary keyword
for this ControlLine | [
"return",
"true",
"if",
"the",
"given",
"keyword",
"is",
"a",
"ternary",
"keyword",
"for",
"this",
"ControlLine"
] | def is_ternary(self, keyword):
"""return true if the given keyword is a ternary keyword
for this ControlLine"""
return keyword in {
'if': set(['else', 'elif']),
'try': set(['except', 'finally']),
'for': set(['else'])
}.get(self.keyword, []) | [
"def",
"is_ternary",
"(",
"self",
",",
"keyword",
")",
":",
"return",
"keyword",
"in",
"{",
"'if'",
":",
"set",
"(",
"[",
"'else'",
",",
"'elif'",
"]",
")",
",",
"'try'",
":",
"set",
"(",
"[",
"'except'",
",",
"'finally'",
"]",
")",
",",
"'for'",
... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/mako/parsetree.py#L96-L104 | |
utiasSTARS/pykitti | d3e1bb81676e831886726cc5ed79ce1f049aef2c | pykitti/raw.py | python | raw.get_cam2 | (self, idx) | return utils.load_image(self.cam2_files[idx], mode='RGB') | Read image file for cam2 (RGB left) at the specified index. | Read image file for cam2 (RGB left) at the specified index. | [
"Read",
"image",
"file",
"for",
"cam2",
"(",
"RGB",
"left",
")",
"at",
"the",
"specified",
"index",
"."
] | def get_cam2(self, idx):
"""Read image file for cam2 (RGB left) at the specified index."""
return utils.load_image(self.cam2_files[idx], mode='RGB') | [
"def",
"get_cam2",
"(",
"self",
",",
"idx",
")",
":",
"return",
"utils",
".",
"load_image",
"(",
"self",
".",
"cam2_files",
"[",
"idx",
"]",
",",
"mode",
"=",
"'RGB'",
")"
] | https://github.com/utiasSTARS/pykitti/blob/d3e1bb81676e831886726cc5ed79ce1f049aef2c/pykitti/raw.py#L65-L67 | |
AutodeskRoboticsLab/Mimic | 85447f0d346be66988303a6a054473d92f1ed6f4 | mimic/scripts/robotmath/transforms.py | python | matrix_by_euler_angles | (a, b, c) | return [x, y, z] | Computes a matrix from Euler angles
:param a: Rotation X
:param b: Rotation Y
:param c: Rotation Z
:return: | Computes a matrix from Euler angles
:param a: Rotation X
:param b: Rotation Y
:param c: Rotation Z
:return: | [
"Computes",
"a",
"matrix",
"from",
"Euler",
"angles",
":",
"param",
"a",
":",
"Rotation",
"X",
":",
"param",
"b",
":",
"Rotation",
"Y",
":",
"param",
"c",
":",
"Rotation",
"Z",
":",
"return",
":"
] | def matrix_by_euler_angles(a, b, c):
"""
Computes a matrix from Euler angles
:param a: Rotation X
:param b: Rotation Y
:param c: Rotation Z
:return:
"""
_a = a * math.pi / -180
_b = b * math.pi / -180
_c = c * math.pi / -180
ca = math.cos(_a)
sa = math.sin(_a)
cb = ma... | [
"def",
"matrix_by_euler_angles",
"(",
"a",
",",
"b",
",",
"c",
")",
":",
"_a",
"=",
"a",
"*",
"math",
".",
"pi",
"/",
"-",
"180",
"_b",
"=",
"b",
"*",
"math",
".",
"pi",
"/",
"-",
"180",
"_c",
"=",
"c",
"*",
"math",
".",
"pi",
"/",
"-",
"... | https://github.com/AutodeskRoboticsLab/Mimic/blob/85447f0d346be66988303a6a054473d92f1ed6f4/mimic/scripts/robotmath/transforms.py#L118-L150 | |
ungarj/mapchete | dc085b4af4bd4101d342e3d08440e165d07f4070 | mapchete/_core.py | python | Mapchete._extract | (self, in_tile=None, in_data=None, out_tile=None) | return self.config.output.extract_subset(
input_data_tiles=[(in_tile, in_data)], out_tile=out_tile
) | Extract data from tile. | Extract data from tile. | [
"Extract",
"data",
"from",
"tile",
"."
] | def _extract(self, in_tile=None, in_data=None, out_tile=None):
"""Extract data from tile."""
return self.config.output.extract_subset(
input_data_tiles=[(in_tile, in_data)], out_tile=out_tile
) | [
"def",
"_extract",
"(",
"self",
",",
"in_tile",
"=",
"None",
",",
"in_data",
"=",
"None",
",",
"out_tile",
"=",
"None",
")",
":",
"return",
"self",
".",
"config",
".",
"output",
".",
"extract_subset",
"(",
"input_data_tiles",
"=",
"[",
"(",
"in_tile",
... | https://github.com/ungarj/mapchete/blob/dc085b4af4bd4101d342e3d08440e165d07f4070/mapchete/_core.py#L683-L687 | |
tgalal/python-axolotl | b8d1a2e04bda38575dc5c0c6daf1b545283e31d7 | axolotl/util/keyhelper.py | python | KeyHelper.generateIdentityKeyPair | () | return identityKeyPair | Generate an identity key pair. Clients should only do this once,
at install time.
@return the generated IdentityKeyPair. | Generate an identity key pair. Clients should only do this once,
at install time. | [
"Generate",
"an",
"identity",
"key",
"pair",
".",
"Clients",
"should",
"only",
"do",
"this",
"once",
"at",
"install",
"time",
"."
] | def generateIdentityKeyPair():
"""
Generate an identity key pair. Clients should only do this once,
at install time.
@return the generated IdentityKeyPair.
"""
keyPair = Curve.generateKeyPair()
publicKey = IdentityKey(keyPair.getPublicKey())
serialized = ... | [
"def",
"generateIdentityKeyPair",
"(",
")",
":",
"keyPair",
"=",
"Curve",
".",
"generateKeyPair",
"(",
")",
"publicKey",
"=",
"IdentityKey",
"(",
"keyPair",
".",
"getPublicKey",
"(",
")",
")",
"serialized",
"=",
"'0a21056e8936e8367f768a7bba008ade7cf58407bdc7a6aae293e2... | https://github.com/tgalal/python-axolotl/blob/b8d1a2e04bda38575dc5c0c6daf1b545283e31d7/axolotl/util/keyhelper.py#L21-L34 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/importlib/_bootstrap_external.py | python | ExtensionFileLoader.create_module | (self, spec) | return module | Create an unitialized extension module | Create an unitialized extension module | [
"Create",
"an",
"unitialized",
"extension",
"module"
] | def create_module(self, spec):
"""Create an unitialized extension module"""
module = _bootstrap._call_with_frames_removed(
_imp.create_dynamic, spec)
_bootstrap._verbose_message('extension module {!r} loaded from {!r}',
spec.name, self.path)
return mo... | [
"def",
"create_module",
"(",
"self",
",",
"spec",
")",
":",
"module",
"=",
"_bootstrap",
".",
"_call_with_frames_removed",
"(",
"_imp",
".",
"create_dynamic",
",",
"spec",
")",
"_bootstrap",
".",
"_verbose_message",
"(",
"'extension module {!r} loaded from {!r}'",
"... | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/importlib/_bootstrap_external.py#L919-L925 | |
eclipse/paho.mqtt.python | 9782ab81fe7ee3a05e74c7f3e1d03d5611ea4be4 | src/paho/mqtt/client.py | python | Client.on_connect_fail | (self, func) | Define the connection failure callback implementation
Expected signature is:
on_connect_fail(client, userdata)
client: the client instance for this callback
userdata: the private user data as set in Client() or userdata_set()
Decorator: @client.connect_fail_callback(... | Define the connection failure callback implementation | [
"Define",
"the",
"connection",
"failure",
"callback",
"implementation"
] | def on_connect_fail(self, func):
""" Define the connection failure callback implementation
Expected signature is:
on_connect_fail(client, userdata)
client: the client instance for this callback
userdata: the private user data as set in Client() or userdata_set()
... | [
"def",
"on_connect_fail",
"(",
"self",
",",
"func",
")",
":",
"with",
"self",
".",
"_callback_mutex",
":",
"self",
".",
"_on_connect_fail",
"=",
"func"
] | https://github.com/eclipse/paho.mqtt.python/blob/9782ab81fe7ee3a05e74c7f3e1d03d5611ea4be4/src/paho/mqtt/client.py#L1910-L1924 | ||
python-security/pyt | f4ec9e127497a7ba7d08d68e8fca8b2f06756679 | pyt/cfg/expr_visitor.py | python | ExprVisitor.save_local_scope | (
self,
line_number,
saved_function_call_index
) | return (saved_variables, first_node) | Save the local scope before entering a function call by saving all the LHS's of assignments so far.
Args:
line_number(int): Of the def of the function call about to be entered into.
saved_function_call_index(int): Unique number for each call.
Returns:
saved_variable... | Save the local scope before entering a function call by saving all the LHS's of assignments so far. | [
"Save",
"the",
"local",
"scope",
"before",
"entering",
"a",
"function",
"call",
"by",
"saving",
"all",
"the",
"LHS",
"s",
"of",
"assignments",
"so",
"far",
"."
] | def save_local_scope(
self,
line_number,
saved_function_call_index
):
"""Save the local scope before entering a function call by saving all the LHS's of assignments so far.
Args:
line_number(int): Of the def of the function call about to be entered into.
... | [
"def",
"save_local_scope",
"(",
"self",
",",
"line_number",
",",
"saved_function_call_index",
")",
":",
"saved_variables",
"=",
"list",
"(",
")",
"saved_variables_so_far",
"=",
"set",
"(",
")",
"first_node",
"=",
"None",
"# Make e.g. save_N_LHS = assignment.LHS for each... | https://github.com/python-security/pyt/blob/f4ec9e127497a7ba7d08d68e8fca8b2f06756679/pyt/cfg/expr_visitor.py#L198-L245 | |
cylc/cylc-flow | 5ec221143476c7c616c156b74158edfbcd83794a | cylc/flow/pathutil.py | python | make_symlink | (path: Union[Path, str], target: Union[Path, str]) | Makes symlinks for directories.
Args:
path: Absolute path of the desired symlink.
target: Absolute path of the symlink's target directory. | Makes symlinks for directories. | [
"Makes",
"symlinks",
"for",
"directories",
"."
] | def make_symlink(path: Union[Path, str], target: Union[Path, str]) -> bool:
"""Makes symlinks for directories.
Args:
path: Absolute path of the desired symlink.
target: Absolute path of the symlink's target directory.
"""
path = Path(path)
target = Path(target)
if path.exists():... | [
"def",
"make_symlink",
"(",
"path",
":",
"Union",
"[",
"Path",
",",
"str",
"]",
",",
"target",
":",
"Union",
"[",
"Path",
",",
"str",
"]",
")",
"->",
"bool",
":",
"path",
"=",
"Path",
"(",
"path",
")",
"target",
"=",
"Path",
"(",
"target",
")",
... | https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/pathutil.py#L216-L255 | ||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/container_service.py | python | KubernetesCluster.node_num_cpu | (self) | return int(stdout) | vCPU of each node in cluster. | vCPU of each node in cluster. | [
"vCPU",
"of",
"each",
"node",
"in",
"cluster",
"."
] | def node_num_cpu(self) -> int:
"""vCPU of each node in cluster."""
stdout, _, _ = RunKubectlCommand(
['get', 'nodes', '-o', 'jsonpath={.items[0].status.capacity.cpu}'])
return int(stdout) | [
"def",
"node_num_cpu",
"(",
"self",
")",
"->",
"int",
":",
"stdout",
",",
"_",
",",
"_",
"=",
"RunKubectlCommand",
"(",
"[",
"'get'",
",",
"'nodes'",
",",
"'-o'",
",",
"'jsonpath={.items[0].status.capacity.cpu}'",
"]",
")",
"return",
"int",
"(",
"stdout",
... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/container_service.py#L910-L914 | |
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/event.py | python | Mouse.getRel | (self) | Returns the new position of the mouse relative to the
last call to getRel or getPos, in the same units as the
:class:`~visual.Window`. | Returns the new position of the mouse relative to the
last call to getRel or getPos, in the same units as the
:class:`~visual.Window`. | [
"Returns",
"the",
"new",
"position",
"of",
"the",
"mouse",
"relative",
"to",
"the",
"last",
"call",
"to",
"getRel",
"or",
"getPos",
"in",
"the",
"same",
"units",
"as",
"the",
":",
"class",
":",
"~visual",
".",
"Window",
"."
] | def getRel(self):
"""Returns the new position of the mouse relative to the
last call to getRel or getPos, in the same units as the
:class:`~visual.Window`.
"""
if usePygame:
relPosPix = numpy.array(mouse.get_rel()) * [1, -1]
return self._pix2windowUnits(re... | [
"def",
"getRel",
"(",
"self",
")",
":",
"if",
"usePygame",
":",
"relPosPix",
"=",
"numpy",
".",
"array",
"(",
"mouse",
".",
"get_rel",
"(",
")",
")",
"*",
"[",
"1",
",",
"-",
"1",
"]",
"return",
"self",
".",
"_pix2windowUnits",
"(",
"relPosPix",
")... | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/event.py#L765-L780 | ||
bentoml/BentoML | af9c68ea2a0c3acdb3deab529b36575533225b5d | bentoml/service/inference_api.py | python | InferenceAPI.user_func | (self) | return wrapped_func | :return: user-defined inference API callback function | :return: user-defined inference API callback function | [
":",
"return",
":",
"user",
"-",
"defined",
"inference",
"API",
"callback",
"function"
] | def user_func(self):
"""
:return: user-defined inference API callback function
"""
# allow user to define handlers without 'tasks' kwargs
_sig = inspect.signature(self._user_func)
if self.batch:
append_arg = "tasks"
else:
append_arg = "tas... | [
"def",
"user_func",
"(",
"self",
")",
":",
"# allow user to define handlers without 'tasks' kwargs",
"_sig",
"=",
"inspect",
".",
"signature",
"(",
"self",
".",
"_user_func",
")",
"if",
"self",
".",
"batch",
":",
"append_arg",
"=",
"\"tasks\"",
"else",
":",
"app... | https://github.com/bentoml/BentoML/blob/af9c68ea2a0c3acdb3deab529b36575533225b5d/bentoml/service/inference_api.py#L151-L203 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/devices.py | python | XBeeDevice._send_expl_data_broadcast | (self, data, src_endpoint, dest_endpoint, cluster_id, profile_id,
transmit_options=TransmitOptions.NONE.value) | return self.send_packet_sync_and_get_response(
self.__build_expldata_packet(None, data, src_endpoint, dest_endpoint,
cluster_id, profile_id, broadcast=True,
transmit_options=transmit_options)) | Sends the provided explicit data to all the XBee nodes of the network
(broadcast) using provided source and destination end points, cluster
and profile ids.
This method blocks until a success or error transmit status arrives or
the configured receive timeout expires. The received timeou... | Sends the provided explicit data to all the XBee nodes of the network
(broadcast) using provided source and destination end points, cluster
and profile ids. | [
"Sends",
"the",
"provided",
"explicit",
"data",
"to",
"all",
"the",
"XBee",
"nodes",
"of",
"the",
"network",
"(",
"broadcast",
")",
"using",
"provided",
"source",
"and",
"destination",
"end",
"points",
"cluster",
"and",
"profile",
"ids",
"."
] | def _send_expl_data_broadcast(self, data, src_endpoint, dest_endpoint, cluster_id, profile_id,
transmit_options=TransmitOptions.NONE.value):
"""
Sends the provided explicit data to all the XBee nodes of the network
(broadcast) using provided source and destinati... | [
"def",
"_send_expl_data_broadcast",
"(",
"self",
",",
"data",
",",
"src_endpoint",
",",
"dest_endpoint",
",",
"cluster_id",
",",
"profile_id",
",",
"transmit_options",
"=",
"TransmitOptions",
".",
"NONE",
".",
"value",
")",
":",
"return",
"self",
".",
"send_pack... | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/devices.py#L3762-L3801 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/source/source/insertdialogcontroller.py | python | InsertDialogController._loadEncodingState | (self) | Заполнение списка кодировок | Заполнение списка кодировок | [
"Заполнение",
"списка",
"кодировок"
] | def _loadEncodingState(self):
"""
Заполнение списка кодировок
"""
self._dialog.encodingComboBox.AppendItems(self.getEncodingList())
self._dialog.encodingComboBox.SetSelection(0) | [
"def",
"_loadEncodingState",
"(",
"self",
")",
":",
"self",
".",
"_dialog",
".",
"encodingComboBox",
".",
"AppendItems",
"(",
"self",
".",
"getEncodingList",
"(",
")",
")",
"self",
".",
"_dialog",
".",
"encodingComboBox",
".",
"SetSelection",
"(",
"0",
")"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/source/source/insertdialogcontroller.py#L293-L298 | ||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/setuptools/command/easy_install.py | python | _update_zipimporter_cache | (normalized_path, cache, updater=None) | Update zipimporter cache data for a given normalized path.
Any sub-path entries are processed as well, i.e. those corresponding to zip
archives embedded in other zip archives.
Given updater is a callable taking a cache entry key and the original entry
(after already removing the entry from the cache),... | Update zipimporter cache data for a given normalized path. | [
"Update",
"zipimporter",
"cache",
"data",
"for",
"a",
"given",
"normalized",
"path",
"."
] | def _update_zipimporter_cache(normalized_path, cache, updater=None):
"""
Update zipimporter cache data for a given normalized path.
Any sub-path entries are processed as well, i.e. those corresponding to zip
archives embedded in other zip archives.
Given updater is a callable taking a cache entry ... | [
"def",
"_update_zipimporter_cache",
"(",
"normalized_path",
",",
"cache",
",",
"updater",
"=",
"None",
")",
":",
"for",
"p",
"in",
"_collect_zipimporter_cache_entries",
"(",
"normalized_path",
",",
"cache",
")",
":",
"# N.B. pypy's custom zipimport._zip_directory_cache im... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/setuptools/command/easy_install.py#L1797-L1826 | ||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | infoxlm/fairseq/examples/speech_recognition/data/asr_dataset.py | python | AsrDataset.size | (self, index) | return (
self.frame_sizes[index],
len(self.tgt[index]) if self.tgt is not None else 0,
) | Return an example's size as a float or tuple. This value is used when
filtering a dataset with ``--max-positions``. | Return an example's size as a float or tuple. This value is used when
filtering a dataset with ``--max-positions``. | [
"Return",
"an",
"example",
"s",
"size",
"as",
"a",
"float",
"or",
"tuple",
".",
"This",
"value",
"is",
"used",
"when",
"filtering",
"a",
"dataset",
"with",
"--",
"max",
"-",
"positions",
"."
] | def size(self, index):
"""Return an example's size as a float or tuple. This value is used when
filtering a dataset with ``--max-positions``."""
return (
self.frame_sizes[index],
len(self.tgt[index]) if self.tgt is not None else 0,
) | [
"def",
"size",
"(",
"self",
",",
"index",
")",
":",
"return",
"(",
"self",
".",
"frame_sizes",
"[",
"index",
"]",
",",
"len",
"(",
"self",
".",
"tgt",
"[",
"index",
"]",
")",
"if",
"self",
".",
"tgt",
"is",
"not",
"None",
"else",
"0",
",",
")"
... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/examples/speech_recognition/data/asr_dataset.py#L99-L105 | |
aim-uofa/AdelaiDet | fffb2ca1fbca88ec4d96e9ebc285bffe5027a947 | adet/modeling/batext/batext.py | python | FCOSHead.__init__ | (self, cfg, input_shape: List[ShapeSpec]) | Arguments:
in_channels (int): number of channels of the input feature | Arguments:
in_channels (int): number of channels of the input feature | [
"Arguments",
":",
"in_channels",
"(",
"int",
")",
":",
"number",
"of",
"channels",
"of",
"the",
"input",
"feature"
] | def __init__(self, cfg, input_shape: List[ShapeSpec]):
"""
Arguments:
in_channels (int): number of channels of the input feature
"""
super().__init__()
# TODO: Implement the sigmoid version first.
self.num_classes = cfg.MODEL.FCOS.NUM_CLASSES
self.fpn_... | [
"def",
"__init__",
"(",
"self",
",",
"cfg",
",",
"input_shape",
":",
"List",
"[",
"ShapeSpec",
"]",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"# TODO: Implement the sigmoid version first.",
"self",
".",
"num_classes",
"=",
"cfg",
".",
"MODEL",
... | https://github.com/aim-uofa/AdelaiDet/blob/fffb2ca1fbca88ec4d96e9ebc285bffe5027a947/adet/modeling/batext/batext.py#L166-L238 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/more_itertools/more.py | python | map_reduce | (iterable, keyfunc, valuefunc=None, reducefunc=None) | return ret | Return a dictionary that maps the items in *iterable* to categories
defined by *keyfunc*, transforms them with *valuefunc*, and
then summarizes them by category with *reducefunc*.
*valuefunc* defaults to the identity function if it is unspecified.
If *reducefunc* is unspecified, no summarization takes ... | Return a dictionary that maps the items in *iterable* to categories
defined by *keyfunc*, transforms them with *valuefunc*, and
then summarizes them by category with *reducefunc*. | [
"Return",
"a",
"dictionary",
"that",
"maps",
"the",
"items",
"in",
"*",
"iterable",
"*",
"to",
"categories",
"defined",
"by",
"*",
"keyfunc",
"*",
"transforms",
"them",
"with",
"*",
"valuefunc",
"*",
"and",
"then",
"summarizes",
"them",
"by",
"category",
"... | def map_reduce(iterable, keyfunc, valuefunc=None, reducefunc=None):
"""Return a dictionary that maps the items in *iterable* to categories
defined by *keyfunc*, transforms them with *valuefunc*, and
then summarizes them by category with *reducefunc*.
*valuefunc* defaults to the identity function if it ... | [
"def",
"map_reduce",
"(",
"iterable",
",",
"keyfunc",
",",
"valuefunc",
"=",
"None",
",",
"reducefunc",
"=",
"None",
")",
":",
"valuefunc",
"=",
"(",
"lambda",
"x",
":",
"x",
")",
"if",
"(",
"valuefunc",
"is",
"None",
")",
"else",
"valuefunc",
"ret",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/more_itertools/more.py#L2040-L2104 | |
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/modes/credits/code/credits.py | python | Credits.mode_start | (self, **kwargs) | Start mode. | Start mode. | [
"Start",
"mode",
"."
] | def mode_start(self, **kwargs):
"""Start mode."""
self.add_mode_event_handler('enable_free_play',
self.enable_free_play)
self.add_mode_event_handler('enable_credit_play',
self.enable_credit_play)
self.add_mode_event_... | [
"def",
"mode_start",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"add_mode_event_handler",
"(",
"'enable_free_play'",
",",
"self",
".",
"enable_free_play",
")",
"self",
".",
"add_mode_event_handler",
"(",
"'enable_credit_play'",
",",
"self",
"."... | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/modes/credits/code/credits.py#L64-L80 | ||
BrewPi/brewpi-script | 85f693ab5e3395cd10cc2d991ebcddc933c7d5cd | backgroundserial.py | python | BackGroundSerial.exit_on_fatal_error | (self) | [] | def exit_on_fatal_error(self):
if self.fatal_error is not None:
self.stop()
logMessage(self.fatal_error)
sys.exit("Terminating due to fatal serial error") | [
"def",
"exit_on_fatal_error",
"(",
"self",
")",
":",
"if",
"self",
".",
"fatal_error",
"is",
"not",
"None",
":",
"self",
".",
"stop",
"(",
")",
"logMessage",
"(",
"self",
".",
"fatal_error",
")",
"sys",
".",
"exit",
"(",
"\"Terminating due to fatal serial er... | https://github.com/BrewPi/brewpi-script/blob/85f693ab5e3395cd10cc2d991ebcddc933c7d5cd/backgroundserial.py#L76-L80 | ||||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/core/configuration/anaconda.py | python | AnacondaConfiguration.set_from_defaults | (self) | Set the configuration from the default configuration files.
Read the current configuration from the temporary config file.
Or load the default configuration file from:
/etc/anaconda/anaconda.conf | Set the configuration from the default configuration files. | [
"Set",
"the",
"configuration",
"from",
"the",
"default",
"configuration",
"files",
"."
] | def set_from_defaults(self):
"""Set the configuration from the default configuration files.
Read the current configuration from the temporary config file.
Or load the default configuration file from:
/etc/anaconda/anaconda.conf
"""
path = os.environ.get("ANACONDA_C... | [
"def",
"set_from_defaults",
"(",
"self",
")",
":",
"path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"ANACONDA_CONFIG_TMP\"",
",",
"ANACONDA_CONFIG_TMP",
")",
"if",
"not",
"path",
"or",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
... | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/configuration/anaconda.py#L240-L255 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/pythontwitter/__init__.py | python | Api.CreateList | (self, name, mode=None, description=None) | return List.NewFromJsonDict(data) | Creates a new list with the give name for the authenticated user.
The twitter.Api instance must be authenticated.
Args:
name:
New name for the list
mode:
'public' or 'private'.
Defaults to 'public'. [Optional]
description:
Description of the list. [Optional]
... | Creates a new list with the give name for the authenticated user. | [
"Creates",
"a",
"new",
"list",
"with",
"the",
"give",
"name",
"for",
"the",
"authenticated",
"user",
"."
] | def CreateList(self, name, mode=None, description=None):
'''Creates a new list with the give name for the authenticated user.
The twitter.Api instance must be authenticated.
Args:
name:
New name for the list
mode:
'public' or 'private'.
Defaults to 'public'. [Optional]
... | [
"def",
"CreateList",
"(",
"self",
",",
"name",
",",
"mode",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"url",
"=",
"'%s/lists/create.json'",
"%",
"self",
".",
"base_url",
"if",
"not",
"self",
".",
"_oauth_consumer",
":",
"raise",
"TwitterError... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/pythontwitter/__init__.py#L3881-L3909 | |
hclhkbu/dlbench | 978b034e9c34e6aaa38782bb1e4a2cea0c01d0f9 | tools/mxnet/symbols/inception-resnet-v2.py | python | block17 | (net, input_num_channels, scale=1.0, with_act=True, act_type='relu', mirror_attr={}) | [] | def block17(net, input_num_channels, scale=1.0, with_act=True, act_type='relu', mirror_attr={}):
tower_conv = ConvFactory(net, 192, (1, 1))
tower_conv1_0 = ConvFactory(net, 129, (1, 1))
tower_conv1_1 = ConvFactory(tower_conv1_0, 160, (1, 7), pad=(1, 2))
tower_conv1_2 = ConvFactory(tower_conv1_1, 192, (7... | [
"def",
"block17",
"(",
"net",
",",
"input_num_channels",
",",
"scale",
"=",
"1.0",
",",
"with_act",
"=",
"True",
",",
"act_type",
"=",
"'relu'",
",",
"mirror_attr",
"=",
"{",
"}",
")",
":",
"tower_conv",
"=",
"ConvFactory",
"(",
"net",
",",
"192",
",",... | https://github.com/hclhkbu/dlbench/blob/978b034e9c34e6aaa38782bb1e4a2cea0c01d0f9/tools/mxnet/symbols/inception-resnet-v2.py#L43-L57 | ||||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.py | python | HTMLTokenizer.scriptDataEscapedEndTagNameState | (self) | return True | [] | def scriptDataEscapedEndTagNameState(self):
appropriate = self.currentToken and self.currentToken["name"].lower() == self.temporaryBuffer.lower()
data = self.stream.char()
if data in spaceCharacters and appropriate:
self.currentToken = {"type": tokenTypes["EndTag"],
... | [
"def",
"scriptDataEscapedEndTagNameState",
"(",
"self",
")",
":",
"appropriate",
"=",
"self",
".",
"currentToken",
"and",
"self",
".",
"currentToken",
"[",
"\"name\"",
"]",
".",
"lower",
"(",
")",
"==",
"self",
".",
"temporaryBuffer",
".",
"lower",
"(",
")",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_vendor/html5lib/_tokenizer.py#L703-L729 | |||
thaines/helit | 04bd36ee0fb6b762c63d746e2cd8813641dceda9 | dhdp/corpus.py | python | Corpus.setCluInstsDNR | (self, val) | False to resample the cluster instances, True to not. Defaults to False, but can be set True to save quite a bit of computation. Its debatable if switching this to True causes the results to degrade in any way, but left on by default as indicated in the paper. | False to resample the cluster instances, True to not. Defaults to False, but can be set True to save quite a bit of computation. Its debatable if switching this to True causes the results to degrade in any way, but left on by default as indicated in the paper. | [
"False",
"to",
"resample",
"the",
"cluster",
"instances",
"True",
"to",
"not",
".",
"Defaults",
"to",
"False",
"but",
"can",
"be",
"set",
"True",
"to",
"save",
"quite",
"a",
"bit",
"of",
"computation",
".",
"Its",
"debatable",
"if",
"switching",
"this",
... | def setCluInstsDNR(self, val):
"""False to resample the cluster instances, True to not. Defaults to False, but can be set True to save quite a bit of computation. Its debatable if switching this to True causes the results to degrade in any way, but left on by default as indicated in the paper."""
self.dnrCluIns... | [
"def",
"setCluInstsDNR",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"dnrCluInsts",
"=",
"val"
] | https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/dhdp/corpus.py#L51-L53 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/asn1crypto/pem.py | python | armor | (type_name, der_bytes, headers=None) | return output.getvalue() | Armors a DER-encoded byte string in PEM
:param type_name:
A unicode string that will be capitalized and placed in the header
and footer of the block. E.g. "CERTIFICATE", "PRIVATE KEY", etc. This
will appear as "-----BEGIN CERTIFICATE-----" and
"-----END CERTIFICATE-----".
:para... | Armors a DER-encoded byte string in PEM | [
"Armors",
"a",
"DER",
"-",
"encoded",
"byte",
"string",
"in",
"PEM"
] | def armor(type_name, der_bytes, headers=None):
"""
Armors a DER-encoded byte string in PEM
:param type_name:
A unicode string that will be capitalized and placed in the header
and footer of the block. E.g. "CERTIFICATE", "PRIVATE KEY", etc. This
will appear as "-----BEGIN CERTIFICAT... | [
"def",
"armor",
"(",
"type_name",
",",
"der_bytes",
",",
"headers",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"der_bytes",
",",
"byte_cls",
")",
":",
"raise",
"TypeError",
"(",
"unwrap",
"(",
"'''\n der_bytes must be a byte string, not %s\n... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/asn1crypto/pem.py#L50-L109 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.2/django/utils/translation/trans_real.py | python | do_translate | (message, translation_function) | return result | Translates 'message' using the given 'translation_function' name -- which
will be either gettext or ugettext. It uses the current thread to find the
translation object to use. If no current translation is activated, the
message will be run through the default translation object. | Translates 'message' using the given 'translation_function' name -- which
will be either gettext or ugettext. It uses the current thread to find the
translation object to use. If no current translation is activated, the
message will be run through the default translation object. | [
"Translates",
"message",
"using",
"the",
"given",
"translation_function",
"name",
"--",
"which",
"will",
"be",
"either",
"gettext",
"or",
"ugettext",
".",
"It",
"uses",
"the",
"current",
"thread",
"to",
"find",
"the",
"translation",
"object",
"to",
"use",
".",... | def do_translate(message, translation_function):
"""
Translates 'message' using the given 'translation_function' name -- which
will be either gettext or ugettext. It uses the current thread to find the
translation object to use. If no current translation is activated, the
message will be run through... | [
"def",
"do_translate",
"(",
"message",
",",
"translation_function",
")",
":",
"eol_message",
"=",
"message",
".",
"replace",
"(",
"'\\r\\n'",
",",
"'\\n'",
")",
".",
"replace",
"(",
"'\\r'",
",",
"'\\n'",
")",
"global",
"_default",
",",
"_active",
"t",
"="... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/utils/translation/trans_real.py#L251-L270 | |
ReactionMechanismGenerator/RMG-Py | 2b7baf51febf27157def58fb3f6cee03fb6a684c | rmgpy/molecule/molecule.py | python | Bond.is_order | (self, other_order) | return abs(self.order - other_order) <= 1e-4 | Return ``True`` if the bond is of order other_order or ``False`` if
not. This compares floats that takes into account floating point error
NOTE: we can replace the absolute value relation with math.isclose when
we swtich to python 3.5+ | Return ``True`` if the bond is of order other_order or ``False`` if
not. This compares floats that takes into account floating point error
NOTE: we can replace the absolute value relation with math.isclose when
we swtich to python 3.5+ | [
"Return",
"True",
"if",
"the",
"bond",
"is",
"of",
"order",
"other_order",
"or",
"False",
"if",
"not",
".",
"This",
"compares",
"floats",
"that",
"takes",
"into",
"account",
"floating",
"point",
"error",
"NOTE",
":",
"we",
"can",
"replace",
"the",
"absolut... | def is_order(self, other_order):
"""
Return ``True`` if the bond is of order other_order or ``False`` if
not. This compares floats that takes into account floating point error
NOTE: we can replace the absolute value relation with math.isclose when
we swtich to python 3.5... | [
"def",
"is_order",
"(",
"self",
",",
"other_order",
")",
":",
"return",
"abs",
"(",
"self",
".",
"order",
"-",
"other_order",
")",
"<=",
"1e-4"
] | https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/molecule/molecule.py#L766-L774 | |
spectacles/CodeComplice | 8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62 | libs/codeintel2/database/langlib.py | python | LangDirsLib.hits_from_lpath | (self, lpath, ctlr=None, curr_buf=None) | return hits | Return all hits of the given lookup path.
I.e. a symbol table lookup across all files in the dirs of this
lib.
"lpath" is a lookup name list, e.g. ['Casper', 'Logging']
or ['dojo', 'animation'].
"ctlr" (optional) is an EvalController instance. If
... | Return all hits of the given lookup path. | [
"Return",
"all",
"hits",
"of",
"the",
"given",
"lookup",
"path",
"."
] | def hits_from_lpath(self, lpath, ctlr=None, curr_buf=None):
"""Return all hits of the given lookup path.
I.e. a symbol table lookup across all files in the dirs of this
lib.
"lpath" is a lookup name list, e.g. ['Casper', 'Logging']
or ['dojo', 'animation'].
... | [
"def",
"hits_from_lpath",
"(",
"self",
",",
"lpath",
",",
"ctlr",
"=",
"None",
",",
"curr_buf",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"lpath",
",",
"tuple",
")",
"# common mistake to pass in a string",
"# Need to have (at least once) scanned all importab... | https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/codeintel2/database/langlib.py#L214-L276 | |
Azure/batch-shipyard | d6da749f9cd678037bd520bc074e40066ea35b56 | slurm/slurm.py | python | Credentials.get_subscription_id | (self) | return next(client.subscriptions.list()).subscription_id | Get subscription id for ARM creds
:param arm_creds: ARM creds
:return: subscription id | Get subscription id for ARM creds
:param arm_creds: ARM creds
:return: subscription id | [
"Get",
"subscription",
"id",
"for",
"ARM",
"creds",
":",
"param",
"arm_creds",
":",
"ARM",
"creds",
":",
"return",
":",
"subscription",
"id"
] | def get_subscription_id(self) -> str:
"""Get subscription id for ARM creds
:param arm_creds: ARM creds
:return: subscription id
"""
client = azure.mgmt.resource.SubscriptionClient(self.arm_creds)
return next(client.subscriptions.list()).subscription_id | [
"def",
"get_subscription_id",
"(",
"self",
")",
"->",
"str",
":",
"client",
"=",
"azure",
".",
"mgmt",
".",
"resource",
".",
"SubscriptionClient",
"(",
"self",
".",
"arm_creds",
")",
"return",
"next",
"(",
"client",
".",
"subscriptions",
".",
"list",
"(",
... | https://github.com/Azure/batch-shipyard/blob/d6da749f9cd678037bd520bc074e40066ea35b56/slurm/slurm.py#L202-L208 | |
vmware/vsphere-automation-sdk-python | ba7d4e0742f58a641dfed9538ecbbb1db4f3891e | samples/vsphere/common/vim/helpers/vim_utils.py | python | get_cluster_name_by_id | (content, name) | [] | def get_cluster_name_by_id(content, name):
cluster_obj = get_obj(content, [vim.ClusterComputeResource], name)
if cluster_obj is not None:
self.mo_id = cluster_obj._GetMoId()
print('Cluster MoId: {0}'.format(self.mo_id))
else:
print('Cluster: {0} not found'.format(self.cluster_name)) | [
"def",
"get_cluster_name_by_id",
"(",
"content",
",",
"name",
")",
":",
"cluster_obj",
"=",
"get_obj",
"(",
"content",
",",
"[",
"vim",
".",
"ClusterComputeResource",
"]",
",",
"name",
")",
"if",
"cluster_obj",
"is",
"not",
"None",
":",
"self",
".",
"mo_id... | https://github.com/vmware/vsphere-automation-sdk-python/blob/ba7d4e0742f58a641dfed9538ecbbb1db4f3891e/samples/vsphere/common/vim/helpers/vim_utils.py#L152-L158 | ||||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/email/generator.py | python | Generator._write | (self, msg) | [] | def _write(self, msg):
# We can't write the headers yet because of the following scenario:
# say a multipart message includes the boundary string somewhere in
# its body. We'd have to calculate the new boundary /before/ we write
# the headers so that we can write the correct Content-Typ... | [
"def",
"_write",
"(",
"self",
",",
"msg",
")",
":",
"# We can't write the headers yet because of the following scenario:",
"# say a multipart message includes the boundary string somewhere in",
"# its body. We'd have to calculate the new boundary /before/ we write",
"# the headers so that we ... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/email/generator.py#L162-L195 | ||||
CouchPotato/CouchPotatoServer | 7260c12f72447ddb6f062367c6dfbda03ecd4e9c | libs/pkg_resources.py | python | find_distributions | (path_item, only=False) | return finder(importer, path_item, only) | Yield distributions accessible via `path_item` | Yield distributions accessible via `path_item` | [
"Yield",
"distributions",
"accessible",
"via",
"path_item"
] | def find_distributions(path_item, only=False):
"""Yield distributions accessible via `path_item`"""
importer = get_importer(path_item)
finder = _find_adapter(_distribution_finders, importer)
return finder(importer, path_item, only) | [
"def",
"find_distributions",
"(",
"path_item",
",",
"only",
"=",
"False",
")",
":",
"importer",
"=",
"get_importer",
"(",
"path_item",
")",
"finder",
"=",
"_find_adapter",
"(",
"_distribution_finders",
",",
"importer",
")",
"return",
"finder",
"(",
"importer",
... | https://github.com/CouchPotato/CouchPotatoServer/blob/7260c12f72447ddb6f062367c6dfbda03ecd4e9c/libs/pkg_resources.py#L1653-L1657 | |
Spacelog/Spacelog | 92df308be5923765607a89b022acb57c041c86b3 | ext/redis-py/redis/client.py | python | Redis.srem | (self, name, value) | return self.execute_command('SREM', name, value) | Remove ``value`` from set ``name`` | Remove ``value`` from set ``name`` | [
"Remove",
"value",
"from",
"set",
"name"
] | def srem(self, name, value):
"Remove ``value`` from set ``name``"
return self.execute_command('SREM', name, value) | [
"def",
"srem",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"'SREM'",
",",
"name",
",",
"value",
")"
] | https://github.com/Spacelog/Spacelog/blob/92df308be5923765607a89b022acb57c041c86b3/ext/redis-py/redis/client.py#L938-L940 | |
ray-project/ray | 703c1610348615dcb8c2d141a0c46675084660f5 | rllib/agents/mbmpo/mbmpo.py | python | post_process_metrics | (prefix, workers, metrics) | return metrics | Update current dataset metrics and filter out specific keys.
Args:
prefix (str): Prefix string to be appended
workers (WorkerSet): Set of workers
metrics (dict): Current metrics dictionary | Update current dataset metrics and filter out specific keys. | [
"Update",
"current",
"dataset",
"metrics",
"and",
"filter",
"out",
"specific",
"keys",
"."
] | def post_process_metrics(prefix, workers, metrics):
"""Update current dataset metrics and filter out specific keys.
Args:
prefix (str): Prefix string to be appended
workers (WorkerSet): Set of workers
metrics (dict): Current metrics dictionary
"""
res = collect_metrics(remote_wo... | [
"def",
"post_process_metrics",
"(",
"prefix",
",",
"workers",
",",
"metrics",
")",
":",
"res",
"=",
"collect_metrics",
"(",
"remote_workers",
"=",
"workers",
".",
"remote_workers",
"(",
")",
")",
"for",
"key",
"in",
"METRICS_KEYS",
":",
"metrics",
"[",
"pref... | https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/rllib/agents/mbmpo/mbmpo.py#L220-L231 | |
homles11/IGCV3 | 83aba2f34702836cc1b82350163909034cd9b553 | detection/demo.py | python | parse_class_names | (class_names) | return class_names | parse # classes and class_names if applicable | parse # classes and class_names if applicable | [
"parse",
"#",
"classes",
"and",
"class_names",
"if",
"applicable"
] | def parse_class_names(class_names):
""" parse # classes and class_names if applicable """
if len(class_names) > 0:
if os.path.isfile(class_names):
# try to open it to read class names
with open(class_names, 'r') as f:
class_names = [l.strip() for l in f.readlines(... | [
"def",
"parse_class_names",
"(",
"class_names",
")",
":",
"if",
"len",
"(",
"class_names",
")",
">",
"0",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"class_names",
")",
":",
"# try to open it to read class names",
"with",
"open",
"(",
"class_names",
"... | https://github.com/homles11/IGCV3/blob/83aba2f34702836cc1b82350163909034cd9b553/detection/demo.py#L86-L99 | |
rowanz/grover | f59a206a8722357c351eae9e937b9f7a53bfda61 | realnews/dedupe_crawl.py | python | _fix_notfound_authors | (article) | # An extra preprocessing step: if author list is empty and article starts with By then let's fix things.
:param article:
:return: | # An extra preprocessing step: if author list is empty and article starts with By then let's fix things.
:param article:
:return: | [
"#",
"An",
"extra",
"preprocessing",
"step",
":",
"if",
"author",
"list",
"is",
"empty",
"and",
"article",
"starts",
"with",
"By",
"then",
"let",
"s",
"fix",
"things",
".",
":",
"param",
"article",
":",
":",
"return",
":"
] | def _fix_notfound_authors(article):
"""
# An extra preprocessing step: if author list is empty and article starts with By then let's fix things.
:param article:
:return:
"""
if len(article['authors']) == 0 and article['text'].startswith('By ') and '\n' in article:
possible_authors, text ... | [
"def",
"_fix_notfound_authors",
"(",
"article",
")",
":",
"if",
"len",
"(",
"article",
"[",
"'authors'",
"]",
")",
"==",
"0",
"and",
"article",
"[",
"'text'",
"]",
".",
"startswith",
"(",
"'By '",
")",
"and",
"'\\n'",
"in",
"article",
":",
"possible_auth... | https://github.com/rowanz/grover/blob/f59a206a8722357c351eae9e937b9f7a53bfda61/realnews/dedupe_crawl.py#L126-L142 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/subprocess.py | python | call | (*popenargs, timeout=None, **kwargs) | Run command with arguments. Wait for command to complete or
timeout, then return the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
retcode = call(["ls", "-l"]) | Run command with arguments. Wait for command to complete or
timeout, then return the returncode attribute. | [
"Run",
"command",
"with",
"arguments",
".",
"Wait",
"for",
"command",
"to",
"complete",
"or",
"timeout",
"then",
"return",
"the",
"returncode",
"attribute",
"."
] | def call(*popenargs, timeout=None, **kwargs):
"""Run command with arguments. Wait for command to complete or
timeout, then return the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
retcode = call(["ls", "-l"])
"""
with Popen(*popenargs, **kwargs) as p... | [
"def",
"call",
"(",
"*",
"popenargs",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"Popen",
"(",
"*",
"popenargs",
",",
"*",
"*",
"kwargs",
")",
"as",
"p",
":",
"try",
":",
"return",
"p",
".",
"wait",
"(",
"timeout",
... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/subprocess.py#L526-L540 | ||
petercorke/robotics-toolbox-python | 51aa8bbb3663a7c815f9880d538d61e7c85bc470 | roboticstoolbox/backends/VPython/common_functions.py | python | get_pose_y_vec | (se3_obj) | return vector(data[0], data[1], data[2]) | Convert SE3 details to VPython vector format
:param se3_obj: SE3 pose and orientation object
:type se3_obj: class:`spatialmath.pose3d.SE3`
:return: VPython vector representation of the Y orientation
:rtype: class:`vpython.vector` | Convert SE3 details to VPython vector format | [
"Convert",
"SE3",
"details",
"to",
"VPython",
"vector",
"format"
] | def get_pose_y_vec(se3_obj): # pragma nocover
"""
Convert SE3 details to VPython vector format
:param se3_obj: SE3 pose and orientation object
:type se3_obj: class:`spatialmath.pose3d.SE3`
:return: VPython vector representation of the Y orientation
:rtype: class:`vpython.vector`
"""
da... | [
"def",
"get_pose_y_vec",
"(",
"se3_obj",
")",
":",
"# pragma nocover",
"data",
"=",
"se3_obj",
".",
"o",
"return",
"vector",
"(",
"data",
"[",
"0",
"]",
",",
"data",
"[",
"1",
"]",
",",
"data",
"[",
"2",
"]",
")"
] | https://github.com/petercorke/robotics-toolbox-python/blob/51aa8bbb3663a7c815f9880d538d61e7c85bc470/roboticstoolbox/backends/VPython/common_functions.py#L33-L43 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/lib/surname.py | python | Surname.set_connector | (self, connector) | Set the connector for the Surname instance. This defines how a
surname connects to the next surname (eg in Spanish names). | Set the connector for the Surname instance. This defines how a
surname connects to the next surname (eg in Spanish names). | [
"Set",
"the",
"connector",
"for",
"the",
"Surname",
"instance",
".",
"This",
"defines",
"how",
"a",
"surname",
"connects",
"to",
"the",
"next",
"surname",
"(",
"eg",
"in",
"Spanish",
"names",
")",
"."
] | def set_connector(self, connector):
"""
Set the connector for the Surname instance. This defines how a
surname connects to the next surname (eg in Spanish names).
"""
self.connector = connector | [
"def",
"set_connector",
"(",
"self",
",",
"connector",
")",
":",
"self",
".",
"connector",
"=",
"connector"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/lib/surname.py#L200-L205 | ||
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | vendor/munin/redis.py | python | MuninRedisPlugin.autoconf | (self) | return True | [] | def autoconf(self):
try:
self.get_info()
except socket.error:
return False
return True | [
"def",
"autoconf",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"get_info",
"(",
")",
"except",
"socket",
".",
"error",
":",
"return",
"False",
"return",
"True"
] | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/vendor/munin/redis.py#L10-L15 | |||
NiaOrg/NiaPy | 08f24ffc79fe324bc9c66ee7186ef98633026005 | niapy/algorithms/basic/pso.py | python | MutatedParticleSwarmOptimization.info | () | return r"""H. Wang, C. Li, Y. Liu, S. Zeng, a hybrid particle swarm algorithm with cauchy mutation, Proceedings of the 2007 IEEE Swarm Intelligence Symposium (2007) 356–360.""" | r"""Get basic information of algorithm.
Returns:
str: Basic information of algorithm.
See Also:
* :func:`niapy.algorithms.Algorithm.info` | r"""Get basic information of algorithm. | [
"r",
"Get",
"basic",
"information",
"of",
"algorithm",
"."
] | def info():
r"""Get basic information of algorithm.
Returns:
str: Basic information of algorithm.
See Also:
* :func:`niapy.algorithms.Algorithm.info`
"""
return r"""H. Wang, C. Li, Y. Liu, S. Zeng, a hybrid particle swarm algorithm with cauchy mutation,... | [
"def",
"info",
"(",
")",
":",
"return",
"r\"\"\"H. Wang, C. Li, Y. Liu, S. Zeng, a hybrid particle swarm algorithm with cauchy mutation, Proceedings of the 2007 IEEE Swarm Intelligence Symposium (2007) 356–360.\"\"\""
] | https://github.com/NiaOrg/NiaPy/blob/08f24ffc79fe324bc9c66ee7186ef98633026005/niapy/algorithms/basic/pso.py#L669-L679 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/PIL/ImageFont.py | python | FreeTypeFont.getmask2 | (
self,
text,
mode="",
fill=Image.core.fill,
direction=None,
features=None,
language=None,
stroke_width=0,
*args,
**kwargs
) | return im, offset | Create a bitmap for the text.
If the font uses antialiasing, the bitmap should have mode ``L`` and use a
maximum value of 255. Otherwise, it should have mode ``1``.
:param text: Text to render.
:param mode: Used by some graphics drivers to indicate what mode the
dr... | Create a bitmap for the text. | [
"Create",
"a",
"bitmap",
"for",
"the",
"text",
"."
] | def getmask2(
self,
text,
mode="",
fill=Image.core.fill,
direction=None,
features=None,
language=None,
stroke_width=0,
*args,
**kwargs
):
"""
Create a bitmap for the text.
If the font uses antialiasing, the bitm... | [
"def",
"getmask2",
"(",
"self",
",",
"text",
",",
"mode",
"=",
"\"\"",
",",
"fill",
"=",
"Image",
".",
"core",
".",
"fill",
",",
"direction",
"=",
"None",
",",
"features",
"=",
"None",
",",
"language",
"=",
"None",
",",
"stroke_width",
"=",
"0",
",... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/ImageFont.py#L408-L477 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/turtle.py | python | TPen.pen | (self, pen=None, **pendict) | Return or set the pen's attributes.
Arguments:
pen -- a dictionary with some or all of the below listed keys.
**pendict -- one or more keyword-arguments with the below
listed keys as keywords.
Return or set the pen's attributes in a 'pen-dictionary'
... | Return or set the pen's attributes. | [
"Return",
"or",
"set",
"the",
"pen",
"s",
"attributes",
"."
] | def pen(self, pen=None, **pendict):
"""Return or set the pen's attributes.
Arguments:
pen -- a dictionary with some or all of the below listed keys.
**pendict -- one or more keyword-arguments with the below
listed keys as keywords.
Return or set... | [
"def",
"pen",
"(",
"self",
",",
"pen",
"=",
"None",
",",
"*",
"*",
"pendict",
")",
":",
"_pd",
"=",
"{",
"\"shown\"",
":",
"self",
".",
"_shown",
",",
"\"pendown\"",
":",
"self",
".",
"_drawing",
",",
"\"pencolor\"",
":",
"self",
".",
"_pencolor",
... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/turtle.py#L2336-L2459 | ||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/click/utils.py | python | LazyFile.close_intelligently | (self) | This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin. | This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin. | [
"This",
"function",
"only",
"closes",
"the",
"file",
"if",
"it",
"was",
"opened",
"by",
"the",
"lazy",
"file",
"wrapper",
".",
"For",
"instance",
"this",
"will",
"never",
"close",
"stdin",
"."
] | def close_intelligently(self) -> None:
"""This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin.
"""
if self.should_close:
self.close() | [
"def",
"close_intelligently",
"(",
"self",
")",
"->",
"None",
":",
"if",
"self",
".",
"should_close",
":",
"self",
".",
"close",
"(",
")"
] | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/click/utils.py#L166-L171 | ||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/modules/pkgconfig.py | python | PkgConfigModule._generate_pkgconfig_file | (self, state, deps, subdirs, name, description,
url, version, pcfile, conflicts, variables,
unescaped_variables, uninstalled=False, dataonly=False) | [] | def _generate_pkgconfig_file(self, state, deps, subdirs, name, description,
url, version, pcfile, conflicts, variables,
unescaped_variables, uninstalled=False, dataonly=False):
coredata = state.environment.get_coredata()
if uninstalled:
... | [
"def",
"_generate_pkgconfig_file",
"(",
"self",
",",
"state",
",",
"deps",
",",
"subdirs",
",",
"name",
",",
"description",
",",
"url",
",",
"version",
",",
"pcfile",
",",
"conflicts",
",",
"variables",
",",
"unescaped_variables",
",",
"uninstalled",
"=",
"F... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/modules/pkgconfig.py#L328-L449 | ||||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pymongo/aggregation.py | python | _DatabaseAggregationCommand._cursor_collection | (self, cursor) | return self._database[collname] | The Collection used for the aggregate command cursor. | The Collection used for the aggregate command cursor. | [
"The",
"Collection",
"used",
"for",
"the",
"aggregate",
"command",
"cursor",
"."
] | def _cursor_collection(self, cursor):
"""The Collection used for the aggregate command cursor."""
# Collection level aggregate may not always return the "ns" field
# according to our MockupDB tests. Let's handle that case for db level
# aggregate too by defaulting to the <db>.$cmd.aggreg... | [
"def",
"_cursor_collection",
"(",
"self",
",",
"cursor",
")",
":",
"# Collection level aggregate may not always return the \"ns\" field",
"# according to our MockupDB tests. Let's handle that case for db level",
"# aggregate too by defaulting to the <db>.$cmd.aggregate namespace.",
"_",
",",... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pymongo/aggregation.py#L221-L227 | |
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/diffviewer/diffutils.py | python | get_filediff_encodings | (filediff, encoding_list=None) | return encodings | Return a list of encodings to try for a FileDiff's source text.
If the FileDiff already has a known encoding stored, then it will take
priority. The provided encoding list, or the repository's list of
configured encodingfs, will be provided as fallbacks.
Args:
filediff (reviewboard.diffviewer.... | Return a list of encodings to try for a FileDiff's source text. | [
"Return",
"a",
"list",
"of",
"encodings",
"to",
"try",
"for",
"a",
"FileDiff",
"s",
"source",
"text",
"."
] | def get_filediff_encodings(filediff, encoding_list=None):
"""Return a list of encodings to try for a FileDiff's source text.
If the FileDiff already has a known encoding stored, then it will take
priority. The provided encoding list, or the repository's list of
configured encodingfs, will be provided a... | [
"def",
"get_filediff_encodings",
"(",
"filediff",
",",
"encoding_list",
"=",
"None",
")",
":",
"filediff_encoding",
"=",
"filediff",
".",
"encoding",
"encodings",
"=",
"[",
"]",
"if",
"encoding_list",
"is",
"None",
":",
"encoding_list",
"=",
"filediff",
".",
"... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/diffviewer/diffutils.py#L587-L623 | |
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/modules/gen_sample_data/gen_sample_data.py | python | GenerateSampleScoresHandler._rearrange_dict_by_field | (self, old_dict, sorted_field) | return sorted_dict | Rearranges and filters a dictionary of questions.
Takes a dictionary of entries of the form
{id1 : { 'val1': _, 'val2': _ }, id2 : { 'val1': _, 'val2': _ }, ...}
and rearranges it so that items that match for the chosen field are
placed.
When we arrange by unit number, the outp... | Rearranges and filters a dictionary of questions. | [
"Rearranges",
"and",
"filters",
"a",
"dictionary",
"of",
"questions",
"."
] | def _rearrange_dict_by_field(self, old_dict, sorted_field):
"""Rearranges and filters a dictionary of questions.
Takes a dictionary of entries of the form
{id1 : { 'val1': _, 'val2': _ }, id2 : { 'val1': _, 'val2': _ }, ...}
and rearranges it so that items that match for the chosen fiel... | [
"def",
"_rearrange_dict_by_field",
"(",
"self",
",",
"old_dict",
",",
"sorted_field",
")",
":",
"# First we need to get the set of ID's for automatically generated",
"# questions, and their graders.",
"question_entities",
"=",
"common_utils",
".",
"iter_all",
"(",
"models",
"."... | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/modules/gen_sample_data/gen_sample_data.py#L282-L324 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/jinja2/nodes.py | python | Node.dump | (self) | return ''.join(buf) | [] | def dump(self):
def _dump(node):
if not isinstance(node, Node):
buf.append(repr(node))
return
buf.append('nodes.%s(' % node.__class__.__name__)
if not node.fields:
buf.append(')')
return
for idx, fie... | [
"def",
"dump",
"(",
"self",
")",
":",
"def",
"_dump",
"(",
"node",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"Node",
")",
":",
"buf",
".",
"append",
"(",
"repr",
"(",
"node",
")",
")",
"return",
"buf",
".",
"append",
"(",
"'nodes.%s(... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/jinja2/nodes.py#L245-L271 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_image.py | python | main | () | ansible oc module for image import | ansible oc module for image import | [
"ansible",
"oc",
"module",
"for",
"image",
"import"
] | def main():
'''
ansible oc module for image import
'''
module = AnsibleModule(
argument_spec=dict(
kubeconfig=dict(default='/etc/origin/master/admin.kubeconfig', type='str'),
state=dict(default='present', type='str',
choices=['present', 'list']),
... | [
"def",
"main",
"(",
")",
":",
"module",
"=",
"AnsibleModule",
"(",
"argument_spec",
"=",
"dict",
"(",
"kubeconfig",
"=",
"dict",
"(",
"default",
"=",
"'/etc/origin/master/admin.kubeconfig'",
",",
"type",
"=",
"'str'",
")",
",",
"state",
"=",
"dict",
"(",
"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_image.py#L1558-L1584 | ||
facebookresearch/ReAgent | 52f666670a7fa03206812ef48949f6b934d400f7 | reagent/preprocessing/normalization.py | python | get_feature_start_indices | (
sorted_features: List[int],
normalization_parameters: Dict[int, NormalizationParameters],
) | return start_indices | Returns the starting index for each feature in the output feature vector | Returns the starting index for each feature in the output feature vector | [
"Returns",
"the",
"starting",
"index",
"for",
"each",
"feature",
"in",
"the",
"output",
"feature",
"vector"
] | def get_feature_start_indices(
sorted_features: List[int],
normalization_parameters: Dict[int, NormalizationParameters],
):
"""Returns the starting index for each feature in the output feature vector"""
start_indices = []
cur_idx = 0
for feature in sorted_features:
np = normalization_par... | [
"def",
"get_feature_start_indices",
"(",
"sorted_features",
":",
"List",
"[",
"int",
"]",
",",
"normalization_parameters",
":",
"Dict",
"[",
"int",
",",
"NormalizationParameters",
"]",
",",
")",
":",
"start_indices",
"=",
"[",
"]",
"cur_idx",
"=",
"0",
"for",
... | https://github.com/facebookresearch/ReAgent/blob/52f666670a7fa03206812ef48949f6b934d400f7/reagent/preprocessing/normalization.py#L196-L212 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_obj.py | python | Utils.find_result | (results, _name) | return rval | Find the specified result by name | Find the specified result by name | [
"Find",
"the",
"specified",
"result",
"by",
"name"
] | def find_result(results, _name):
''' Find the specified result by name'''
rval = None
for result in results:
if 'metadata' in result and result['metadata']['name'] == _name:
rval = result
break
return rval | [
"def",
"find_result",
"(",
"results",
",",
"_name",
")",
":",
"rval",
"=",
"None",
"for",
"result",
"in",
"results",
":",
"if",
"'metadata'",
"in",
"result",
"and",
"result",
"[",
"'metadata'",
"]",
"[",
"'name'",
"]",
"==",
"_name",
":",
"rval",
"=",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_vendored_deps/library/oc_obj.py#L1273-L1281 | |
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/parse/nonprojectivedependencyparser.py | python | ProbabilisticNonprojectiveParser.parse | (self, tokens, tags) | Parses a list of tokens in accordance to the MST parsing algorithm
for non-projective dependency parses. Assumes that the tokens to
be parsed have already been tagged and those tags are provided. Various
scoring methods can be used by implementing the ``DependencyScorerI``
interface an... | Parses a list of tokens in accordance to the MST parsing algorithm
for non-projective dependency parses. Assumes that the tokens to
be parsed have already been tagged and those tags are provided. Various
scoring methods can be used by implementing the ``DependencyScorerI``
interface an... | [
"Parses",
"a",
"list",
"of",
"tokens",
"in",
"accordance",
"to",
"the",
"MST",
"parsing",
"algorithm",
"for",
"non",
"-",
"projective",
"dependency",
"parses",
".",
"Assumes",
"that",
"the",
"tokens",
"to",
"be",
"parsed",
"have",
"already",
"been",
"tagged"... | def parse(self, tokens, tags):
"""
Parses a list of tokens in accordance to the MST parsing algorithm
for non-projective dependency parses. Assumes that the tokens to
be parsed have already been tagged and those tags are provided. Various
scoring methods can be used by implemen... | [
"def",
"parse",
"(",
"self",
",",
"tokens",
",",
"tags",
")",
":",
"self",
".",
"inner_nodes",
"=",
"{",
"}",
"# Initialize g_graph",
"g_graph",
"=",
"DependencyGraph",
"(",
")",
"for",
"index",
",",
"token",
"in",
"enumerate",
"(",
"tokens",
")",
":",
... | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/parse/nonprojectivedependencyparser.py#L436-L552 | ||
ktbyers/netmiko | 4c3732346eea1a4a608abd9e09d65eeb2f577810 | netmiko/ericsson/ericsson_ipos.py | python | EricssonIposSSH.send_config_set | (
self,
config_commands: Union[str, Sequence[str], TextIO, None] = None,
exit_config_mode: bool = False,
**kwargs: Any,
) | return super().send_config_set(
config_commands=config_commands, exit_config_mode=exit_config_mode, **kwargs
) | Ericsson IPOS requires you not exit from configuration mode. | Ericsson IPOS requires you not exit from configuration mode. | [
"Ericsson",
"IPOS",
"requires",
"you",
"not",
"exit",
"from",
"configuration",
"mode",
"."
] | def send_config_set(
self,
config_commands: Union[str, Sequence[str], TextIO, None] = None,
exit_config_mode: bool = False,
**kwargs: Any,
) -> str:
"""Ericsson IPOS requires you not exit from configuration mode."""
return super().send_config_set(
config_c... | [
"def",
"send_config_set",
"(",
"self",
",",
"config_commands",
":",
"Union",
"[",
"str",
",",
"Sequence",
"[",
"str",
"]",
",",
"TextIO",
",",
"None",
"]",
"=",
"None",
",",
"exit_config_mode",
":",
"bool",
"=",
"False",
",",
"*",
"*",
"kwargs",
":",
... | https://github.com/ktbyers/netmiko/blob/4c3732346eea1a4a608abd9e09d65eeb2f577810/netmiko/ericsson/ericsson_ipos.py#L53-L62 | |
faucetsdn/ryu | 537f35f4b2bc634ef05e3f28373eb5e24609f989 | ryu/app/rest_vtep.py | python | RestVtepController.add_client | (self, **kwargs) | return Response(content_type='application/json',
body=json.dumps(body)) | Registers a new client to the specified network.
Usage:
======= =============================
Method URI
======= =============================
POST /vtep/networks/{vni}/clients
======= =============================
Request parameters:
... | Registers a new client to the specified network. | [
"Registers",
"a",
"new",
"client",
"to",
"the",
"specified",
"network",
"."
] | def add_client(self, **kwargs):
"""
Registers a new client to the specified network.
Usage:
======= =============================
Method URI
======= =============================
POST /vtep/networks/{vni}/clients
======= =========... | [
"def",
"add_client",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"body",
"=",
"self",
".",
"vtep_app",
".",
"add_client",
"(",
"*",
"*",
"kwargs",
")",
"except",
"(",
"BGPSpeakerNotFound",
",",
"DatapathNotFound",
",",
"VniNotFound",
",",... | https://github.com/faucetsdn/ryu/blob/537f35f4b2bc634ef05e3f28373eb5e24609f989/ryu/app/rest_vtep.py#L1732-L1788 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py | python | rv_continuous.isf | (self, q, *args, **kwds) | return output | Inverse survival function at q of the given RV.
Parameters
----------
q : array_like
upper tail probability
arg1, arg2, arg3,... : array_like
The shape parameter(s) for the distribution (see docstring of the
instance object for more information)
... | Inverse survival function at q of the given RV. | [
"Inverse",
"survival",
"function",
"at",
"q",
"of",
"the",
"given",
"RV",
"."
] | def isf(self, q, *args, **kwds):
"""
Inverse survival function at q of the given RV.
Parameters
----------
q : array_like
upper tail probability
arg1, arg2, arg3,... : array_like
The shape parameter(s) for the distribution (see docstring of the
... | [
"def",
"isf",
"(",
"self",
",",
"q",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"args",
",",
"loc",
",",
"scale",
"=",
"self",
".",
"_parse_args",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
"q",
",",
"loc",
",",
"scale",
"=",
"ma... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/scipy/stats/_distn_infrastructure.py#L1825-L1868 | |
translate/translate | 72816df696b5263abfe80ab59129b299b85ae749 | translate/misc/ourdom.py | python | searchElementsByTagName_helper | (parent, name, onlysearch) | limits the search to within tags occuring in onlysearch | limits the search to within tags occuring in onlysearch | [
"limits",
"the",
"search",
"to",
"within",
"tags",
"occuring",
"in",
"onlysearch"
] | def searchElementsByTagName_helper(parent, name, onlysearch):
"""limits the search to within tags occuring in onlysearch"""
for node in parent.childNodes:
if node.nodeType == minidom.Node.ELEMENT_NODE and (
name == "*" or node.tagName == name
):
yield node
if node... | [
"def",
"searchElementsByTagName_helper",
"(",
"parent",
",",
"name",
",",
"onlysearch",
")",
":",
"for",
"node",
"in",
"parent",
".",
"childNodes",
":",
"if",
"node",
".",
"nodeType",
"==",
"minidom",
".",
"Node",
".",
"ELEMENT_NODE",
"and",
"(",
"name",
"... | https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/translate/misc/ourdom.py#L96-L105 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/kubernetes/client/models/v1beta1_api_service_spec.py | python | V1beta1APIServiceSpec.service | (self) | return self._service | Gets the service of this V1beta1APIServiceSpec.
Service is a reference to the service for this API server. It must communicate on port 443 If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be f... | Gets the service of this V1beta1APIServiceSpec.
Service is a reference to the service for this API server. It must communicate on port 443 If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply delegate to the normal handler chain to be f... | [
"Gets",
"the",
"service",
"of",
"this",
"V1beta1APIServiceSpec",
".",
"Service",
"is",
"a",
"reference",
"to",
"the",
"service",
"for",
"this",
"API",
"server",
".",
"It",
"must",
"communicate",
"on",
"port",
"443",
"If",
"the",
"Service",
"is",
"nil",
"th... | def service(self):
"""
Gets the service of this V1beta1APIServiceSpec.
Service is a reference to the service for this API server. It must communicate on port 443 If the Service is nil, that means the handling for the API groupversion is handled locally on this server. The call will simply deleg... | [
"def",
"service",
"(",
"self",
")",
":",
"return",
"self",
".",
"_service"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1beta1_api_service_spec.py#L158-L166 | |
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/androiddriver/androiddriver.py | python | AndroidDriver.call_static_method | (
self, class_name, method_name, control=None, ret_type="", *args
) | return result["Result"] | 调用静态方法 | 调用静态方法 | [
"调用静态方法"
] | def call_static_method(
self, class_name, method_name, control=None, ret_type="", *args
):
"""调用静态方法
"""
kwargs = {}
if control:
kwargs["Control"] = control
result = self.send_command(
EnumCommand.CmdCallStaticMethod,
ClassName=clas... | [
"def",
"call_static_method",
"(",
"self",
",",
"class_name",
",",
"method_name",
",",
"control",
"=",
"None",
",",
"ret_type",
"=",
"\"\"",
",",
"*",
"args",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"control",
":",
"kwargs",
"[",
"\"Control\"",
"]",
"=... | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androiddriver/androiddriver.py#L1017-L1033 | |
mnot/redbot | 53428a3c512b0ba1ee1b10c2a2fe79fd3f187444 | redbot/message/headers/via.py | python | via.evaluate | (self, add_note: AddNoteMethodType) | [] | def evaluate(self, add_note: AddNoteMethodType) -> None:
via_list = (
"<ul>"
+ "\n".join(["<li><code>%s</code></li>" % v for v in self.value])
+ "</ul>"
)
add_note(VIA_PRESENT, via_list=via_list) | [
"def",
"evaluate",
"(",
"self",
",",
"add_note",
":",
"AddNoteMethodType",
")",
"->",
"None",
":",
"via_list",
"=",
"(",
"\"<ul>\"",
"+",
"\"\\n\"",
".",
"join",
"(",
"[",
"\"<li><code>%s</code></li>\"",
"%",
"v",
"for",
"v",
"in",
"self",
".",
"value",
... | https://github.com/mnot/redbot/blob/53428a3c512b0ba1ee1b10c2a2fe79fd3f187444/redbot/message/headers/via.py#L22-L28 | ||||
travisgoodspeed/goodfet | 1750cc1e8588af5470385e52fa098ca7364c2863 | client/GoodFETCC.py | python | GoodFETCC.ishalted | (self) | return self.CCstatus()&0x20 | [] | def ishalted(self):
return self.CCstatus()&0x20; | [
"def",
"ishalted",
"(",
"self",
")",
":",
"return",
"self",
".",
"CCstatus",
"(",
")",
"&",
"0x20"
] | https://github.com/travisgoodspeed/goodfet/blob/1750cc1e8588af5470385e52fa098ca7364c2863/client/GoodFETCC.py#L227-L228 | |||
rowliny/DiffHelper | ab3a96f58f9579d0023aed9ebd785f4edf26f8af | Tool/SitePackages/nltk/twitter/twitter_demo.py | python | tracktoscreen_demo | (track="taylor swift", limit=10) | Track keywords from the public Streaming API and send output to terminal. | Track keywords from the public Streaming API and send output to terminal. | [
"Track",
"keywords",
"from",
"the",
"public",
"Streaming",
"API",
"and",
"send",
"output",
"to",
"terminal",
"."
] | def tracktoscreen_demo(track="taylor swift", limit=10):
"""
Track keywords from the public Streaming API and send output to terminal.
"""
oauth = credsfromfile()
client = Streamer(**oauth)
client.register(TweetViewer(limit=limit))
client.filter(track=track) | [
"def",
"tracktoscreen_demo",
"(",
"track",
"=",
"\"taylor swift\"",
",",
"limit",
"=",
"10",
")",
":",
"oauth",
"=",
"credsfromfile",
"(",
")",
"client",
"=",
"Streamer",
"(",
"*",
"*",
"oauth",
")",
"client",
".",
"register",
"(",
"TweetViewer",
"(",
"l... | https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/nltk/twitter/twitter_demo.py#L119-L126 | ||
tensorflow/lattice | 784eca50cbdfedf39f183cc7d298c9fe376b69c0 | tensorflow_lattice/python/categorical_calibration_layer.py | python | CategoricalCalibration.get_config | (self) | return config | Standard Keras config for serialization. | Standard Keras config for serialization. | [
"Standard",
"Keras",
"config",
"for",
"serialization",
"."
] | def get_config(self):
"""Standard Keras config for serialization."""
config = {
"num_buckets": self.num_buckets,
"units": self.units,
"output_min": self.output_min,
"output_max": self.output_max,
"monotonicities": self.monotonicities,
"kernel_initializer":
... | [
"def",
"get_config",
"(",
"self",
")",
":",
"config",
"=",
"{",
"\"num_buckets\"",
":",
"self",
".",
"num_buckets",
",",
"\"units\"",
":",
"self",
".",
"units",
",",
"\"output_min\"",
":",
"self",
".",
"output_min",
",",
"\"output_max\"",
":",
"self",
".",... | https://github.com/tensorflow/lattice/blob/784eca50cbdfedf39f183cc7d298c9fe376b69c0/tensorflow_lattice/python/categorical_calibration_layer.py#L243-L259 | |
arsaboo/homeassistant-config | 53c998986fbe84d793a0b174757154ab30e676e4 | custom_components/alexa_media/notify.py | python | AlexaNotificationService.__init__ | (self, hass) | Initialize the service. | Initialize the service. | [
"Initialize",
"the",
"service",
"."
] | def __init__(self, hass):
"""Initialize the service."""
self.hass = hass | [
"def",
"__init__",
"(",
"self",
",",
"hass",
")",
":",
"self",
".",
"hass",
"=",
"hass"
] | https://github.com/arsaboo/homeassistant-config/blob/53c998986fbe84d793a0b174757154ab30e676e4/custom_components/alexa_media/notify.py#L74-L76 | ||
mozilla/MozDef | d7d4dd1cd898bb4eeb59d014bd5bcfe96554a10f | alerts/plugins/ipaddr.py | python | addError | (message, error) | add an error note to a message | add an error note to a message | [
"add",
"an",
"error",
"note",
"to",
"a",
"message"
] | def addError(message, error):
'''add an error note to a message'''
if 'errors' not in message:
message['errors'] = list()
if isinstance(message['errors'], list):
message['errors'].append(error) | [
"def",
"addError",
"(",
"message",
",",
"error",
")",
":",
"if",
"'errors'",
"not",
"in",
"message",
":",
"message",
"[",
"'errors'",
"]",
"=",
"list",
"(",
")",
"if",
"isinstance",
"(",
"message",
"[",
"'errors'",
"]",
",",
"list",
")",
":",
"messag... | https://github.com/mozilla/MozDef/blob/d7d4dd1cd898bb4eeb59d014bd5bcfe96554a10f/alerts/plugins/ipaddr.py#L23-L28 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/fb303/FacebookService.py | python | Client.getOption | (self, key) | return self.recv_getOption() | Gets an option
Parameters:
- key | Gets an option | [
"Gets",
"an",
"option"
] | def getOption(self, key):
"""
Gets an option
Parameters:
- key
"""
self.send_getOption(key)
return self.recv_getOption() | [
"def",
"getOption",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"send_getOption",
"(",
"key",
")",
"return",
"self",
".",
"recv_getOption",
"(",
")"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/fb303/FacebookService.py#L340-L348 | |
google/cauliflowervest | d3f52501ebed8b9a392350c8e177bbc602a6a09d | cauliflowervest/client/mac/apfs.py | python | APFSStorage.GetStateAndVolumeIds | (self) | return state, encrypted_volume_ids, volume_ids | Determine the state of APFS and the volume IDs (if any).
In the case that APFS is enabled, it is required that every present
volume is encrypted, to return "encrypted" status (i.e. the entire drive is
encrypted, for all present drives). Otherwise ENABLED or FAILED state is
returned.
Returns:
... | Determine the state of APFS and the volume IDs (if any). | [
"Determine",
"the",
"state",
"of",
"APFS",
"and",
"the",
"volume",
"IDs",
"(",
"if",
"any",
")",
"."
] | def GetStateAndVolumeIds(self):
"""Determine the state of APFS and the volume IDs (if any).
In the case that APFS is enabled, it is required that every present
volume is encrypted, to return "encrypted" status (i.e. the entire drive is
encrypted, for all present drives). Otherwise ENABLED or FAILED st... | [
"def",
"GetStateAndVolumeIds",
"(",
"self",
")",
":",
"state",
"=",
"State",
".",
"NONE",
"volume_ids",
"=",
"[",
"]",
"encrypted_volume_ids",
"=",
"[",
"]",
"failed_volume_ids",
"=",
"[",
"]",
"volumes",
"=",
"self",
".",
"_GetAPFSVolumes",
"(",
")",
"if"... | https://github.com/google/cauliflowervest/blob/d3f52501ebed8b9a392350c8e177bbc602a6a09d/cauliflowervest/client/mac/apfs.py#L128-L175 | |
openstack/swift | b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100 | swift/common/utils.py | python | non_negative_int | (value) | return int_value | Check that the value casts to an int and is a whole number.
:param value: value to check
:raises ValueError: if the value cannot be cast to an int or does not
represent a whole number.
:return: an int | Check that the value casts to an int and is a whole number. | [
"Check",
"that",
"the",
"value",
"casts",
"to",
"an",
"int",
"and",
"is",
"a",
"whole",
"number",
"."
] | def non_negative_int(value):
"""
Check that the value casts to an int and is a whole number.
:param value: value to check
:raises ValueError: if the value cannot be cast to an int or does not
represent a whole number.
:return: an int
"""
int_value = int(value)
if int_value != no... | [
"def",
"non_negative_int",
"(",
"value",
")",
":",
"int_value",
"=",
"int",
"(",
"value",
")",
"if",
"int_value",
"!=",
"non_negative_float",
"(",
"value",
")",
":",
"raise",
"ValueError",
"return",
"int_value"
] | https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/common/utils.py#L442-L454 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/algebras/quatalg/quaternion_algebra.py | python | QuaternionOrder.unit_ideal | (self) | Return the unit ideal in this quaternion order.
EXAMPLES::
sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: I = R.unit_ideal(); I
Fractional ideal (1/2 + 1/2*i, 1/2*j - 1/2*k, i, -k) | Return the unit ideal in this quaternion order. | [
"Return",
"the",
"unit",
"ideal",
"in",
"this",
"quaternion",
"order",
"."
] | def unit_ideal(self):
"""
Return the unit ideal in this quaternion order.
EXAMPLES::
sage: R = QuaternionAlgebra(-11,-1).maximal_order()
sage: I = R.unit_ideal(); I
Fractional ideal (1/2 + 1/2*i, 1/2*j - 1/2*k, i, -k)
"""
if self.base_ring() ... | [
"def",
"unit_ideal",
"(",
"self",
")",
":",
"if",
"self",
".",
"base_ring",
"(",
")",
"==",
"ZZ",
":",
"return",
"QuaternionFractionalIdeal_rational",
"(",
"self",
".",
"quaternion_algebra",
"(",
")",
",",
"self",
".",
"basis",
"(",
")",
",",
"left_order",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/algebras/quatalg/quaternion_algebra.py#L1731-L1744 | ||
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/gui/openapi.py | python | _add_cookie_auth | (check_dict) | Add the cookie authentication schema to the SPEC.
We do this here, because every site has a different cookie name and such can't be predicted
before this code here actually runs. | Add the cookie authentication schema to the SPEC. | [
"Add",
"the",
"cookie",
"authentication",
"schema",
"to",
"the",
"SPEC",
"."
] | def _add_cookie_auth(check_dict):
"""Add the cookie authentication schema to the SPEC.
We do this here, because every site has a different cookie name and such can't be predicted
before this code here actually runs.
"""
schema_name = "cookieAuth"
add_once(check_dict["security"], {schema_name: [... | [
"def",
"_add_cookie_auth",
"(",
"check_dict",
")",
":",
"schema_name",
"=",
"\"cookieAuth\"",
"add_once",
"(",
"check_dict",
"[",
"\"security\"",
"]",
",",
"{",
"schema_name",
":",
"[",
"]",
"}",
")",
"check_dict",
"[",
"\"components\"",
"]",
"[",
"\"securityS... | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/openapi.py#L85-L101 | ||
achael/eht-imaging | bbd3aeb06bef52bf89fa1c06de71e5509a5b0015 | ehtim/plotting/comp_plots.py | python | plotall_compare | (obslist, imlist, field1, field2,
conj=False, debias=False, sgrscat=False,
ang_unit='deg', timetype='UTC', ttype='nfft',
axis=False, rangex=False, rangey=False, snrcut=0.,
clist=COLORLIST, legendlabels=None, markersize=ehc.MARKERSIZE,
... | return axis | Plot data from observations compared to ground truth from an image on the same axes.
Args:
obslist (list): list of observations to plot
imlist (list): list of ground truth images to compare to
field1 (str): x-axis field (from FIELDS)
field2 (str): y-axis field (from F... | Plot data from observations compared to ground truth from an image on the same axes. | [
"Plot",
"data",
"from",
"observations",
"compared",
"to",
"ground",
"truth",
"from",
"an",
"image",
"on",
"the",
"same",
"axes",
"."
] | def plotall_compare(obslist, imlist, field1, field2,
conj=False, debias=False, sgrscat=False,
ang_unit='deg', timetype='UTC', ttype='nfft',
axis=False, rangex=False, rangey=False, snrcut=0.,
clist=COLORLIST, legendlabels=None, markersize=eh... | [
"def",
"plotall_compare",
"(",
"obslist",
",",
"imlist",
",",
"field1",
",",
"field2",
",",
"conj",
"=",
"False",
",",
"debias",
"=",
"False",
",",
"sgrscat",
"=",
"False",
",",
"ang_unit",
"=",
"'deg'",
",",
"timetype",
"=",
"'UTC'",
",",
"ttype",
"="... | https://github.com/achael/eht-imaging/blob/bbd3aeb06bef52bf89fa1c06de71e5509a5b0015/ehtim/plotting/comp_plots.py#L42-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.