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
django/django
0a17666045de6739ae1c2ac695041823d5f827f7
django/contrib/gis/geos/collections.py
python
GeometryCollection._set_list
(self, length, items)
Create a new collection, and destroy the contents of the previous pointer.
Create a new collection, and destroy the contents of the previous pointer.
[ "Create", "a", "new", "collection", "and", "destroy", "the", "contents", "of", "the", "previous", "pointer", "." ]
def _set_list(self, length, items): "Create a new collection, and destroy the contents of the previous pointer." prev_ptr = self.ptr srid = self.srid self.ptr = self._create_collection(length, items) if srid: self.srid = srid capi.destroy_geom(prev_ptr)
[ "def", "_set_list", "(", "self", ",", "length", ",", "items", ")", ":", "prev_ptr", "=", "self", ".", "ptr", "srid", "=", "self", ".", "srid", "self", ".", "ptr", "=", "self", ".", "_create_collection", "(", "length", ",", "items", ")", "if", "srid",...
https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/contrib/gis/geos/collections.py#L64-L71
Xilinx/finn
d1cc9cf94f1c33354cc169c5a6517314d0e94e3b
src/finn/transformation/fpgadataflow/annotate_cycles.py
python
AnnotateCycles.apply
(self, model)
return (model, False)
[]
def apply(self, model): graph = model.graph # annotate node cycles for node in graph.node: if _is_fpgadataflow_node(node): op_inst = registry.getCustomOp(node) cycles = op_inst.get_exp_cycles() op_inst.set_nodeattr("cycles_estimate", cy...
[ "def", "apply", "(", "self", ",", "model", ")", ":", "graph", "=", "model", ".", "graph", "# annotate node cycles", "for", "node", "in", "graph", ".", "node", ":", "if", "_is_fpgadataflow_node", "(", "node", ")", ":", "op_inst", "=", "registry", ".", "ge...
https://github.com/Xilinx/finn/blob/d1cc9cf94f1c33354cc169c5a6517314d0e94e3b/src/finn/transformation/fpgadataflow/annotate_cycles.py#L44-L59
jmcnamara/XlsxWriter
fd30f221bf4326ca7814cec0d3a87a89b9e3edd5
xlsxwriter/worksheet.py
python
Worksheet.hide
(self)
Hide the current worksheet. Args: None. Returns: Nothing.
Hide the current worksheet.
[ "Hide", "the", "current", "worksheet", "." ]
def hide(self): """ Hide the current worksheet. Args: None. Returns: Nothing. """ self.hidden = 1 # A hidden worksheet shouldn't be active or selected. self.selected = 0
[ "def", "hide", "(", "self", ")", ":", "self", ".", "hidden", "=", "1", "# A hidden worksheet shouldn't be active or selected.", "self", ".", "selected", "=", "0" ]
https://github.com/jmcnamara/XlsxWriter/blob/fd30f221bf4326ca7814cec0d3a87a89b9e3edd5/xlsxwriter/worksheet.py#L1681-L1695
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/utils/appdirs.py
python
_get_win_folder_with_ctypes
(csidl_name)
return buf.value
[]
def _get_win_folder_with_ctypes(csidl_name): csidl_const = { "CSIDL_APPDATA": 26, "CSIDL_COMMON_APPDATA": 35, "CSIDL_LOCAL_APPDATA": 28, }[csidl_name] buf = ctypes.create_unicode_buffer(1024) ctypes.windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf) # Downgrad...
[ "def", "_get_win_folder_with_ctypes", "(", "csidl_name", ")", ":", "csidl_const", "=", "{", "\"CSIDL_APPDATA\"", ":", "26", ",", "\"CSIDL_COMMON_APPDATA\"", ":", "35", ",", "\"CSIDL_LOCAL_APPDATA\"", ":", "28", ",", "}", "[", "csidl_name", "]", "buf", "=", "ctyp...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/utils/appdirs.py#L201-L223
python-control/python-control
df6b35212f8f657469627c227c893a175a6902cc
control/descfcn.py
python
describing_function_plot
( H, F, A, omega=None, refine=True, label="%5.2g @ %-5.2g", **kwargs)
return intersections
Plot a Nyquist plot with a describing function for a nonlinear system. This function generates a Nyquist plot for a closed loop system consisting of a linear system with a static nonlinear function in the feedback path. Parameters ---------- H : LTI system Linear time-invariant (LTI) syste...
Plot a Nyquist plot with a describing function for a nonlinear system.
[ "Plot", "a", "Nyquist", "plot", "with", "a", "describing", "function", "for", "a", "nonlinear", "system", "." ]
def describing_function_plot( H, F, A, omega=None, refine=True, label="%5.2g @ %-5.2g", **kwargs): """Plot a Nyquist plot with a describing function for a nonlinear system. This function generates a Nyquist plot for a closed loop system consisting of a linear system with a static nonlinear function...
[ "def", "describing_function_plot", "(", "H", ",", "F", ",", "A", ",", "omega", "=", "None", ",", "refine", "=", "True", ",", "label", "=", "\"%5.2g @ %-5.2g\"", ",", "*", "*", "kwargs", ")", ":", "# Start by drawing a Nyquist curve", "count", ",", "contour",...
https://github.com/python-control/python-control/blob/df6b35212f8f657469627c227c893a175a6902cc/control/descfcn.py#L201-L299
sopel-irc/sopel
787baa6e39f9dad57d94600c92e10761c41b21ef
sopel/modules/isup.py
python
handle_isup
(bot, trigger, secure=True)
Handle the ``bot`` command from ``trigger`` :param bot: Sopel instance :type bot: :class:`sopel.bot.SopelWrapper` :param trigger: Command's trigger instance :type trigger: :class:`sopel.trigger.Trigger` :param bool secure: Check SSL error if ``True`` (the default)
Handle the ``bot`` command from ``trigger``
[ "Handle", "the", "bot", "command", "from", "trigger" ]
def handle_isup(bot, trigger, secure=True): """Handle the ``bot`` command from ``trigger`` :param bot: Sopel instance :type bot: :class:`sopel.bot.SopelWrapper` :param trigger: Command's trigger instance :type trigger: :class:`sopel.trigger.Trigger` :param bool secure: Check SSL error if ``True...
[ "def", "handle_isup", "(", "bot", ",", "trigger", ",", "secure", "=", "True", ")", ":", "try", ":", "site", "=", "get_site_url", "(", "trigger", ".", "group", "(", "2", ")", ")", "except", "ValueError", "as", "error", ":", "bot", ".", "reply", "(", ...
https://github.com/sopel-irc/sopel/blob/787baa6e39f9dad57d94600c92e10761c41b21ef/sopel/modules/isup.py#L51-L93
Axelrod-Python/Axelrod
00e18323c1b1af74df873773e44f31e1b9a299c6
axelrod/result_set.py
python
ResultSet.__ne__
(self, other)
return not self.__eq__(other)
Check inequality of results set Parameters ---------- other : axelrod.ResultSet Another results set against which to check inequality
Check inequality of results set
[ "Check", "inequality", "of", "results", "set" ]
def __ne__(self, other): """ Check inequality of results set Parameters ---------- other : axelrod.ResultSet Another results set against which to check inequality """ return not self.__eq__(other)
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "return", "not", "self", ".", "__eq__", "(", "other", ")" ]
https://github.com/Axelrod-Python/Axelrod/blob/00e18323c1b1af74df873773e44f31e1b9a299c6/axelrod/result_set.py#L683-L692
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/apigateway/v20180808/models.py
python
BindEnvironmentRequest.__init__
(self)
r""" :param UsagePlanIds: 待绑定的使用计划唯一 ID 列表。 :type UsagePlanIds: list of str :param BindType: 绑定类型,取值为API、SERVICE,默认值为SERVICE。 :type BindType: str :param Environment: 待绑定的环境。 :type Environment: str :param ServiceId: 待绑定的服务唯一 ID。 :type ServiceId: str ...
r""" :param UsagePlanIds: 待绑定的使用计划唯一 ID 列表。 :type UsagePlanIds: list of str :param BindType: 绑定类型,取值为API、SERVICE,默认值为SERVICE。 :type BindType: str :param Environment: 待绑定的环境。 :type Environment: str :param ServiceId: 待绑定的服务唯一 ID。 :type ServiceId: str ...
[ "r", ":", "param", "UsagePlanIds", ":", "待绑定的使用计划唯一", "ID", "列表。", ":", "type", "UsagePlanIds", ":", "list", "of", "str", ":", "param", "BindType", ":", "绑定类型,取值为API、SERVICE,默认值为SERVICE。", ":", "type", "BindType", ":", "str", ":", "param", "Environment", ":", ...
def __init__(self): r""" :param UsagePlanIds: 待绑定的使用计划唯一 ID 列表。 :type UsagePlanIds: list of str :param BindType: 绑定类型,取值为API、SERVICE,默认值为SERVICE。 :type BindType: str :param Environment: 待绑定的环境。 :type Environment: str :param ServiceId: 待绑定的服务唯一 ID。 ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "UsagePlanIds", "=", "None", "self", ".", "BindType", "=", "None", "self", ".", "Environment", "=", "None", "self", ".", "ServiceId", "=", "None", "self", ".", "ApiIds", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/apigateway/v20180808/models.py#L1447-L1464
ambakick/Person-Detection-and-Tracking
f925394ac29b5cf321f1ce89a71b193381519a0b
utils/ops.py
python
retain_groundtruth_with_positive_classes
(tensor_dict)
return retain_groundtruth(tensor_dict, keep_indices)
Retains only groundtruth with positive class ids. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundtruth_keypoints fields.InputDataFields.groundtruth_instance...
Retains only groundtruth with positive class ids.
[ "Retains", "only", "groundtruth", "with", "positive", "class", "ids", "." ]
def retain_groundtruth_with_positive_classes(tensor_dict): """Retains only groundtruth with positive class ids. Args: tensor_dict: a dictionary of following groundtruth tensors - fields.InputDataFields.groundtruth_boxes fields.InputDataFields.groundtruth_classes fields.InputDataFields.groundt...
[ "def", "retain_groundtruth_with_positive_classes", "(", "tensor_dict", ")", ":", "if", "fields", ".", "InputDataFields", ".", "groundtruth_classes", "not", "in", "tensor_dict", ":", "raise", "ValueError", "(", "'`groundtruth classes` not in tensor_dict.'", ")", "keep_indice...
https://github.com/ambakick/Person-Detection-and-Tracking/blob/f925394ac29b5cf321f1ce89a71b193381519a0b/utils/ops.py#L372-L397
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3db/inv.py
python
InventoryRequisitionItemModel.req_item_ondelete_cascade
(row)
On-delete Cascade actions for requested items: - delete any reservations (putting items back into stock)
On-delete Cascade actions for requested items: - delete any reservations (putting items back into stock)
[ "On", "-", "delete", "Cascade", "actions", "for", "requested", "items", ":", "-", "delete", "any", "reservations", "(", "putting", "items", "back", "into", "stock", ")" ]
def req_item_ondelete_cascade(row): """ On-delete Cascade actions for requested items: - delete any reservations (putting items back into stock) """ db = current.db s3db = current.db #settings = current.deployment_settings record_id = row.id ...
[ "def", "req_item_ondelete_cascade", "(", "row", ")", ":", "db", "=", "current", ".", "db", "s3db", "=", "current", ".", "db", "#settings = current.deployment_settings", "record_id", "=", "row", ".", "id", "#if settings.get_inv_req_reserve_items():", "# Remove any old re...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/inv.py#L4429-L4462
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/database/database_client.py
python
DatabaseClient.get_database_upgrade_history_entry
(self, database_id, upgrade_history_entry_id, **kwargs)
gets the upgrade history for a specified database. :param str database_id: (required) The database `OCID`__. __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm :param str upgrade_history_entry_id: (required) The database/db system upgrade Hi...
gets the upgrade history for a specified database.
[ "gets", "the", "upgrade", "history", "for", "a", "specified", "database", "." ]
def get_database_upgrade_history_entry(self, database_id, upgrade_history_entry_id, **kwargs): """ gets the upgrade history for a specified database. :param str database_id: (required) The database `OCID`__. __ https://docs.cloud.oracle.com/Content/General/Concepts/ide...
[ "def", "get_database_upgrade_history_entry", "(", "self", ",", "database_id", ",", "upgrade_history_entry_id", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/databases/{databaseId}/upgradeHistoryEntries/{upgradeHistoryEntryId}\"", "method", "=", "\"GET\"", "# Do...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/database/database_client.py#L10497-L10582
glue-viz/glue
840b4c1364b0fa63bf67c914540c93dd71df41e1
glue/utils/array.py
python
find_chunk_shape
(shape, n_max=None)
return tuple(block_shape[::-1])
Given the shape of an n-dimensional array, and the maximum number of elements in a chunk, return the largest chunk shape to use for iteration. This currently assumes the optimal chunk shape to return is for C-contiguous arrays.
Given the shape of an n-dimensional array, and the maximum number of elements in a chunk, return the largest chunk shape to use for iteration.
[ "Given", "the", "shape", "of", "an", "n", "-", "dimensional", "array", "and", "the", "maximum", "number", "of", "elements", "in", "a", "chunk", "return", "the", "largest", "chunk", "shape", "to", "use", "for", "iteration", "." ]
def find_chunk_shape(shape, n_max=None): """ Given the shape of an n-dimensional array, and the maximum number of elements in a chunk, return the largest chunk shape to use for iteration. This currently assumes the optimal chunk shape to return is for C-contiguous arrays. """ if n_max is N...
[ "def", "find_chunk_shape", "(", "shape", ",", "n_max", "=", "None", ")", ":", "if", "n_max", "is", "None", ":", "return", "tuple", "(", "shape", ")", "block_shape", "=", "[", "]", "max_repeat_remaining", "=", "n_max", "for", "size", "in", "shape", "[", ...
https://github.com/glue-viz/glue/blob/840b4c1364b0fa63bf67c914540c93dd71df41e1/glue/utils/array.py#L192-L217
samuelclay/NewsBlur
2c45209df01a1566ea105e04d499367f32ac9ad2
apps/profile/middleware.py
python
DBProfilerMiddleware.process_response
(self, request, response)
return response
[]
def process_response(self, request, response): if hasattr(request, 'sql_times_elapsed'): # middleware = SQLLogToConsoleMiddleware() # middleware.process_celery(self) # logging.debug(" ---> ~FGProfiling~FB app: %s" % request.sql_times_elapsed) self._save_times(requ...
[ "def", "process_response", "(", "self", ",", "request", ",", "response", ")", ":", "if", "hasattr", "(", "request", ",", "'sql_times_elapsed'", ")", ":", "# middleware = SQLLogToConsoleMiddleware()", "# middleware.process_celery(self)", "# logging.debug(\" ---> ~FGProfiling~F...
https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/profile/middleware.py#L80-L86
corelan/mona
fab15136880c62f4e8e8c39830e2b31ef8421c48
mona.py
python
toUnicode
(input)
return unicodebytes
Converts a series of bytes to unicode (UTF-16) bytes Arguments : input - the source bytes Return: the unicode expanded version of the input
Converts a series of bytes to unicode (UTF-16) bytes Arguments : input - the source bytes Return: the unicode expanded version of the input
[ "Converts", "a", "series", "of", "bytes", "to", "unicode", "(", "UTF", "-", "16", ")", "bytes", "Arguments", ":", "input", "-", "the", "source", "bytes", "Return", ":", "the", "unicode", "expanded", "version", "of", "the", "input" ]
def toUnicode(input): """ Converts a series of bytes to unicode (UTF-16) bytes Arguments : input - the source bytes Return: the unicode expanded version of the input """ unicodebytes = "" # try/except, just in case .encode bails out try: unicodebytes = input.encode('UTF-16LE') except: inputlst = list...
[ "def", "toUnicode", "(", "input", ")", ":", "unicodebytes", "=", "\"\"", "# try/except, just in case .encode bails out", "try", ":", "unicodebytes", "=", "input", ".", "encode", "(", "'UTF-16LE'", ")", "except", ":", "inputlst", "=", "list", "(", "input", ")", ...
https://github.com/corelan/mona/blob/fab15136880c62f4e8e8c39830e2b31ef8421c48/mona.py#L920-L938
bendmorris/static-python
2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473
Lib/multiprocessing/managers.py
python
RebuildProxy
(func, token, serializer, kwds)
Function used for unpickling proxy objects. If possible the shared object is returned, or otherwise a proxy for it.
Function used for unpickling proxy objects.
[ "Function", "used", "for", "unpickling", "proxy", "objects", "." ]
def RebuildProxy(func, token, serializer, kwds): ''' Function used for unpickling proxy objects. If possible the shared object is returned, or otherwise a proxy for it. ''' server = getattr(process.current_process(), '_manager_server', None) if server and server.address == token.address: ...
[ "def", "RebuildProxy", "(", "func", ",", "token", ",", "serializer", ",", "kwds", ")", ":", "server", "=", "getattr", "(", "process", ".", "current_process", "(", ")", ",", "'_manager_server'", ",", "None", ")", "if", "server", "and", "server", ".", "add...
https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/multiprocessing/managers.py#L834-L849
microsoft/nni
31f11f51249660930824e888af0d4e022823285c
examples/trials/weight_sharing/ga_squad/graph.py
python
Layer.set_size
(self, graph_id, size)
return True
Set size.
Set size.
[ "Set", "size", "." ]
def set_size(self, graph_id, size): ''' Set size. ''' if self.graph_type == LayerType.attention.value: if self.input[0] == graph_id: self.size = size if self.graph_type == LayerType.rnn.value: self.size = size if self.graph_type == ...
[ "def", "set_size", "(", "self", ",", "graph_id", ",", "size", ")", ":", "if", "self", ".", "graph_type", "==", "LayerType", ".", "attention", ".", "value", ":", "if", "self", ".", "input", "[", "0", "]", "==", "graph_id", ":", "self", ".", "size", ...
https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/examples/trials/weight_sharing/ga_squad/graph.py#L98-L112
openstack/manila
142990edc027e14839d5deaf4954dd6fc88de15e
manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py
python
NetAppCmodeFileStorageLibrary._check_string_extra_specs_validity
(self, share, extra_specs)
Check if the string_extra_specs have valid values.
Check if the string_extra_specs have valid values.
[ "Check", "if", "the", "string_extra_specs", "have", "valid", "values", "." ]
def _check_string_extra_specs_validity(self, share, extra_specs): """Check if the string_extra_specs have valid values.""" if 'netapp:max_files' in extra_specs: self._check_if_max_files_is_valid(share, extra_specs['netapp:max_files']) if ...
[ "def", "_check_string_extra_specs_validity", "(", "self", ",", "share", ",", "extra_specs", ")", ":", "if", "'netapp:max_files'", "in", "extra_specs", ":", "self", ".", "_check_if_max_files_is_valid", "(", "share", ",", "extra_specs", "[", "'netapp:max_files'", "]", ...
https://github.com/openstack/manila/blob/142990edc027e14839d5deaf4954dd6fc88de15e/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py#L1251-L1258
munificent/magpie
f5138e3d316ec1a664b5eadba1bcc8573d3faca3
dep/gyp/pylib/gyp/xcodeproj_file.py
python
XCBuildPhase._AddPathToDict
(self, pbxbuildfile, path)
Adds path to the dict tracking paths belonging to this build phase. If the path is already a member of this build phase, raises an exception.
Adds path to the dict tracking paths belonging to this build phase.
[ "Adds", "path", "to", "the", "dict", "tracking", "paths", "belonging", "to", "this", "build", "phase", "." ]
def _AddPathToDict(self, pbxbuildfile, path): """Adds path to the dict tracking paths belonging to this build phase. If the path is already a member of this build phase, raises an exception. """ if path in self._files_by_path: raise ValueError, 'Found multiple build files with path ' + path ...
[ "def", "_AddPathToDict", "(", "self", ",", "pbxbuildfile", ",", "path", ")", ":", "if", "path", "in", "self", ".", "_files_by_path", ":", "raise", "ValueError", ",", "'Found multiple build files with path '", "+", "path", "self", ".", "_files_by_path", "[", "pat...
https://github.com/munificent/magpie/blob/f5138e3d316ec1a664b5eadba1bcc8573d3faca3/dep/gyp/pylib/gyp/xcodeproj_file.py#L1763-L1771
wizyoung/googletranslate.popclipext
a3c465685a5a75213e2ec8517eb98d336984bc50
src/httpcore/_sync/http11.py
python
SyncHTTP11Connection._send_request_body
( self, stream: SyncByteStream, timeout: TimeoutDict )
Send the request body.
Send the request body.
[ "Send", "the", "request", "body", "." ]
def _send_request_body( self, stream: SyncByteStream, timeout: TimeoutDict ) -> None: """ Send the request body. """ # Send the request body. for chunk in stream: logger.trace("send_data=Data(<%d bytes>)", len(chunk)) event = h11.Data(data=chun...
[ "def", "_send_request_body", "(", "self", ",", "stream", ":", "SyncByteStream", ",", "timeout", ":", "TimeoutDict", ")", "->", "None", ":", "# Send the request body.", "for", "chunk", "in", "stream", ":", "logger", ".", "trace", "(", "\"send_data=Data(<%d bytes>)\...
https://github.com/wizyoung/googletranslate.popclipext/blob/a3c465685a5a75213e2ec8517eb98d336984bc50/src/httpcore/_sync/http11.py#L84-L98
toddlerya/NebulaSolarDash
286ff86f0ad3550c1c92323d45e24f01c5c6fcd5
lib/bottle.py
python
_file_iter_range
(fp, offset, bytes, maxread=1024 * 1024)
Yield chunks from a range in a file. No chunk is bigger than maxread.
Yield chunks from a range in a file. No chunk is bigger than maxread.
[ "Yield", "chunks", "from", "a", "range", "in", "a", "file", ".", "No", "chunk", "is", "bigger", "than", "maxread", "." ]
def _file_iter_range(fp, offset, bytes, maxread=1024 * 1024): """ Yield chunks from a range in a file. No chunk is bigger than maxread.""" fp.seek(offset) while bytes > 0: part = fp.read(min(bytes, maxread)) if not part: break bytes -= len(part) yield part
[ "def", "_file_iter_range", "(", "fp", ",", "offset", ",", "bytes", ",", "maxread", "=", "1024", "*", "1024", ")", ":", "fp", ".", "seek", "(", "offset", ")", "while", "bytes", ">", "0", ":", "part", "=", "fp", ".", "read", "(", "min", "(", "bytes...
https://github.com/toddlerya/NebulaSolarDash/blob/286ff86f0ad3550c1c92323d45e24f01c5c6fcd5/lib/bottle.py#L2641-L2648
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/plot/graphics.py
python
Graphics.tick_label_color
(self, c=None)
Set the color of the axes tick labels. INPUT: - ``c`` - an RGB 3-tuple of numbers between 0 and 1 If called with no input, return the current tick_label_color setting. EXAMPLES:: sage: p = plot(cos, (-3,3)) sage: p.tick_label_color() (0...
Set the color of the axes tick labels.
[ "Set", "the", "color", "of", "the", "axes", "tick", "labels", "." ]
def tick_label_color(self, c=None): """ Set the color of the axes tick labels. INPUT: - ``c`` - an RGB 3-tuple of numbers between 0 and 1 If called with no input, return the current tick_label_color setting. EXAMPLES:: sage: p = plot(cos, (-3,3...
[ "def", "tick_label_color", "(", "self", ",", "c", "=", "None", ")", ":", "if", "c", "is", "None", ":", "try", ":", "return", "self", ".", "_tick_label_color", "except", "AttributeError", ":", "self", ".", "_tick_label_color", "=", "(", "0", ",", "0", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/plot/graphics.py#L895-L925
networkx/networkx
1620568e36702b1cfeaf1c0277b167b6cb93e48d
examples/graph/plot_roget.py
python
roget_graph
()
return G
Return the thesaurus graph from the roget.dat example in the Stanford Graph Base.
Return the thesaurus graph from the roget.dat example in the Stanford Graph Base.
[ "Return", "the", "thesaurus", "graph", "from", "the", "roget", ".", "dat", "example", "in", "the", "Stanford", "Graph", "Base", "." ]
def roget_graph(): """Return the thesaurus graph from the roget.dat example in the Stanford Graph Base. """ # open file roget_dat.txt.gz fh = gzip.open("roget_dat.txt.gz", "r") G = nx.DiGraph() for line in fh.readlines(): line = line.decode() if line.startswith("*"): # ski...
[ "def", "roget_graph", "(", ")", ":", "# open file roget_dat.txt.gz", "fh", "=", "gzip", ".", "open", "(", "\"roget_dat.txt.gz\"", ",", "\"r\"", ")", "G", "=", "nx", ".", "DiGraph", "(", ")", "for", "line", "in", "fh", ".", "readlines", "(", ")", ":", "...
https://github.com/networkx/networkx/blob/1620568e36702b1cfeaf1c0277b167b6cb93e48d/examples/graph/plot_roget.py#L31-L63
Sprytile/Sprytile
6b68d0069aef5bfed6ab40d1d5a94a3382b41619
rx/linq/observable/distinct.py
python
distinct
(self, key_selector=None, comparer=None)
return AnonymousObservable(subscribe)
Returns an observable sequence that contains only distinct elements according to the key_selector and the comparer. Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. Example: res = obs = xs.distinct() obs = xs.dist...
Returns an observable sequence that contains only distinct elements according to the key_selector and the comparer. Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
[ "Returns", "an", "observable", "sequence", "that", "contains", "only", "distinct", "elements", "according", "to", "the", "key_selector", "and", "the", "comparer", ".", "Usage", "of", "this", "operator", "should", "be", "considered", "carefully", "due", "to", "th...
def distinct(self, key_selector=None, comparer=None): """Returns an observable sequence that contains only distinct elements according to the key_selector and the comparer. Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large. ...
[ "def", "distinct", "(", "self", ",", "key_selector", "=", "None", ",", "comparer", "=", "None", ")", ":", "source", "=", "self", "comparer", "=", "comparer", "or", "default_comparer", "def", "subscribe", "(", "observer", ")", ":", "hashset", "=", "HashSet"...
https://github.com/Sprytile/Sprytile/blob/6b68d0069aef5bfed6ab40d1d5a94a3382b41619/rx/linq/observable/distinct.py#L24-L64
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
src/codeintel/lib/codeintel2/database/catalog.py
python
CatalogsZone.toplevelname_index
(self)
return self._toplevelname_index
Load and return the top-level name index (toplevelname_index).
Load and return the top-level name index (toplevelname_index).
[ "Load", "and", "return", "the", "top", "-", "level", "name", "index", "(", "toplevelname_index", ")", "." ]
def toplevelname_index(self): """Load and return the top-level name index (toplevelname_index).""" if self._toplevelname_index is None: idxpath = join(self.base_dir, "toplevelname_index") self._toplevelname_index = self.db.load_pickle(idxpath, {}) return self._toplevelnam...
[ "def", "toplevelname_index", "(", "self", ")", ":", "if", "self", ".", "_toplevelname_index", "is", "None", ":", "idxpath", "=", "join", "(", "self", ".", "base_dir", ",", "\"toplevelname_index\"", ")", "self", ".", "_toplevelname_index", "=", "self", ".", "...
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/lib/codeintel2/database/catalog.py#L228-L233
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/inference/api.py
python
ProverCommandDecorator.__init__
(self, proverCommand)
:param proverCommand: ``ProverCommand`` to decorate
:param proverCommand: ``ProverCommand`` to decorate
[ ":", "param", "proverCommand", ":", "ProverCommand", "to", "decorate" ]
def __init__(self, proverCommand): """ :param proverCommand: ``ProverCommand`` to decorate """ TheoremToolCommandDecorator.__init__(self, proverCommand) #The decorator has its own versions of 'result' and 'proof' #because they may be different from the underlying command...
[ "def", "__init__", "(", "self", ",", "proverCommand", ")", ":", "TheoremToolCommandDecorator", ".", "__init__", "(", "self", ",", "proverCommand", ")", "#The decorator has its own versions of 'result' and 'proof'", "#because they may be different from the underlying command", "se...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/inference/api.py#L398-L406
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/pip/_vendor/pyparsing.py
python
ParseResults.asDict
( self )
return dict((k,toItem(v)) for k,v in item_fn())
Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') print(type(result), repr(result)) # -> <clas...
Returns the named parse results as a nested dictionary.
[ "Returns", "the", "named", "parse", "results", "as", "a", "nested", "dictionary", "." ]
def asDict( self ): """ Returns the named parse results as a nested dictionary. Example:: integer = Word(nums) date_str = integer("year") + '/' + integer("month") + '/' + integer("day") result = date_str.parseString('12/31/1999') prin...
[ "def", "asDict", "(", "self", ")", ":", "if", "PY_3", ":", "item_fn", "=", "self", ".", "items", "else", ":", "item_fn", "=", "self", ".", "iteritems", "def", "toItem", "(", "obj", ")", ":", "if", "isinstance", "(", "obj", ",", "ParseResults", ")", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L697-L730
knitmesh/servos-framework
45fdc04580890c3aac039c023f104ce8dc00af08
servos/core/commands.py
python
CommandManager.execute
(self, callback=None)
Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it.
Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it.
[ "Given", "the", "command", "-", "line", "arguments", "this", "figures", "out", "which", "subcommand", "is", "being", "run", "creates", "a", "parser", "appropriate", "to", "that", "command", "and", "runs", "it", "." ]
def execute(self, callback=None): """ Given the command-line arguments, this figures out which subcommand is being run, creates a parser appropriate to that command, and runs it. """ # Preprocess options to extract --settings and --pythonpath. # These options could affect...
[ "def", "execute", "(", "self", ",", "callback", "=", "None", ")", ":", "# Preprocess options to extract --settings and --pythonpath.", "# These options could affect the commands that are available, so they", "# must be processed early.", "parser", "=", "NewOptionParser", "(", "prog...
https://github.com/knitmesh/servos-framework/blob/45fdc04580890c3aac039c023f104ce8dc00af08/servos/core/commands.py#L277-L350
anymail/django-anymail
dc0a46a815d062d52660b9237627b22f89093bce
anymail/utils.py
python
parse_single_address
(address, field=None)
Parses a single EmailAddress from str address, or raises AnymailInvalidAddress :param str address: the fully-formatted email str to parse :param str|None field: optional description of the source of this address, for error message :return :class:`EmailAddress`: if address contains a single email :raise...
Parses a single EmailAddress from str address, or raises AnymailInvalidAddress
[ "Parses", "a", "single", "EmailAddress", "from", "str", "address", "or", "raises", "AnymailInvalidAddress" ]
def parse_single_address(address, field=None): """Parses a single EmailAddress from str address, or raises AnymailInvalidAddress :param str address: the fully-formatted email str to parse :param str|None field: optional description of the source of this address, for error message :return :class:`EmailA...
[ "def", "parse_single_address", "(", "address", ",", "field", "=", "None", ")", ":", "parsed", "=", "parse_address_list", "(", "[", "address", "]", ",", "field", "=", "field", ")", "count", "=", "len", "(", "parsed", ")", "if", "count", ">", "1", ":", ...
https://github.com/anymail/django-anymail/blob/dc0a46a815d062d52660b9237627b22f89093bce/anymail/utils.py#L164-L179
onnx/onnx-coreml
141fc33d7217674ea8bda36494fa8089a543a3f3
onnx_coreml/_operators_nd.py
python
_convert_constant
(builder, node, graph, err)
convert to CoreML Load Constant ND Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3596
convert to CoreML Load Constant ND Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3596
[ "convert", "to", "CoreML", "Load", "Constant", "ND", "Layer", ":", "https", ":", "//", "github", ".", "com", "/", "apple", "/", "coremltools", "/", "blob", "/", "655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492", "/", "mlmodel", "/", "format", "/", "NeuralNetwork", "....
def _convert_constant(builder, node, graph, err): ''' convert to CoreML Load Constant ND Layer: https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L3596 ''' value = node.attrs['value'] # HACK: If Value is 0-Rank then make it 1-Ra...
[ "def", "_convert_constant", "(", "builder", ",", "node", ",", "graph", ",", "err", ")", ":", "value", "=", "node", ".", "attrs", "[", "'value'", "]", "# HACK: If Value is 0-Rank then make it 1-Rank", "builder", ".", "add_load_constant_nd", "(", "name", "=", "nod...
https://github.com/onnx/onnx-coreml/blob/141fc33d7217674ea8bda36494fa8089a543a3f3/onnx_coreml/_operators_nd.py#L426-L439
turicas/brasil.io
f1c371fe828a090510259a5027b49e2e651936b4
traffic_control/blocked_list.py
python
BlockedRequestList.__len__
(self)
[]
def __len__(self): if self.redis_conn: return self.redis_conn.llen(settings.RQ_BLOCKED_REQUESTS_LIST) else: return len(self._requests_data)
[ "def", "__len__", "(", "self", ")", ":", "if", "self", ".", "redis_conn", ":", "return", "self", ".", "redis_conn", ".", "llen", "(", "settings", ".", "RQ_BLOCKED_REQUESTS_LIST", ")", "else", ":", "return", "len", "(", "self", ".", "_requests_data", ")" ]
https://github.com/turicas/brasil.io/blob/f1c371fe828a090510259a5027b49e2e651936b4/traffic_control/blocked_list.py#L38-L42
arizvisa/ida-minsc
8627a60f047b5e55d3efeecde332039cd1a16eea
base/_utils.py
python
character.unicodeQ
(cls, ch)
return cat[0] != 'C'
Returns whether a unicode character is printable or not.
Returns whether a unicode character is printable or not.
[ "Returns", "whether", "a", "unicode", "character", "is", "printable", "or", "not", "." ]
def unicodeQ(cls, ch): '''Returns whether a unicode character is printable or not.''' cat = cls.const._unicodedata.category(ch) return cat[0] != 'C'
[ "def", "unicodeQ", "(", "cls", ",", "ch", ")", ":", "cat", "=", "cls", ".", "const", ".", "_unicodedata", ".", "category", "(", "ch", ")", "return", "cat", "[", "0", "]", "!=", "'C'" ]
https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/_utils.py#L799-L802
eyounx/ZOOpt
49c750daf842639ee6407848a867091689571810
zoopt/algos/opt_algorithms/racos/sracos.py
python
SRacosTune.strategy_rr
(self, iset, x)
return replace_ele
Replace a random solution in iset. :param iset: a solution set :param x: a Solution object :return: the replaced solution
Replace a random solution in iset.
[ "Replace", "a", "random", "solution", "in", "iset", "." ]
def strategy_rr(self, iset, x): """ Replace a random solution in iset. :param iset: a solution set :param x: a Solution object :return: the replaced solution """ len_iset = len(iset) replace_index = np.random.randint(0, len_iset) replace_ele = ise...
[ "def", "strategy_rr", "(", "self", ",", "iset", ",", "x", ")", ":", "len_iset", "=", "len", "(", "iset", ")", "replace_index", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "len_iset", ")", "replace_ele", "=", "iset", "[", "replace_index", ...
https://github.com/eyounx/ZOOpt/blob/49c750daf842639ee6407848a867091689571810/zoopt/algos/opt_algorithms/racos/sracos.py#L390-L402
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/btoe/v20210514/models.py
python
VerifyEvidenceHashResponse.__init__
(self)
r""" :param Result: 核验结果,true为核验成功,false为核验失败 :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param Result: 核验结果,true为核验成功,false为核验失败 :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "Result", ":", "核验结果,true为核验成功,false为核验失败", ":", "type", "Result", ":", "bool", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param Result: 核验结果,true为核验成功,false为核验失败 :type Result: bool :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.Result = None self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "Result", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/btoe/v20210514/models.py#L796-L804
getalp/Flaubert
ded1cf89820a22dbf885c85ba3dccc8ab360681b
xlm/optim.py
python
AdamCosineWithWarmup.step
(self, closure=None)
[]
def step(self, closure=None): super().step(closure) for param_group in self.param_groups: param_group['num_updates'] += 1 param_group['lr'] = self.get_lr_for_step(param_group['num_updates'])
[ "def", "step", "(", "self", ",", "closure", "=", "None", ")", ":", "super", "(", ")", ".", "step", "(", "closure", ")", "for", "param_group", "in", "self", ".", "param_groups", ":", "param_group", "[", "'num_updates'", "]", "+=", "1", "param_group", "[...
https://github.com/getalp/Flaubert/blob/ded1cf89820a22dbf885c85ba3dccc8ab360681b/xlm/optim.py#L204-L208
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/imaplib.py
python
IMAP4.setquota
(self, root, limits)
return self._untagged_response(typ, dat, 'QUOTA')
Set the quota root's resource limits. (typ, [data]) = <instance>.setquota(root, limits)
Set the quota root's resource limits.
[ "Set", "the", "quota", "root", "s", "resource", "limits", "." ]
def setquota(self, root, limits): """Set the quota root's resource limits. (typ, [data]) = <instance>.setquota(root, limits) """ typ, dat = self._simple_command('SETQUOTA', root, limits) return self._untagged_response(typ, dat, 'QUOTA')
[ "def", "setquota", "(", "self", ",", "root", ",", "limits", ")", ":", "typ", ",", "dat", "=", "self", ".", "_simple_command", "(", "'SETQUOTA'", ",", "root", ",", "limits", ")", "return", "self", ".", "_untagged_response", "(", "typ", ",", "dat", ",", ...
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/imaplib.py#L692-L698
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/mpl_toolkits/mplot3d/axes3d.py
python
Axes3D.zaxis_inverted
(self)
return top < bottom
Returns True if the z-axis is inverted. .. versionadded :: 1.1.0 This function was added, but not tested. Please report any bugs.
Returns True if the z-axis is inverted.
[ "Returns", "True", "if", "the", "z", "-", "axis", "is", "inverted", "." ]
def zaxis_inverted(self): ''' Returns True if the z-axis is inverted. .. versionadded :: 1.1.0 This function was added, but not tested. Please report any bugs. ''' bottom, top = self.get_zlim() return top < bottom
[ "def", "zaxis_inverted", "(", "self", ")", ":", "bottom", ",", "top", "=", "self", ".", "get_zlim", "(", ")", "return", "top", "<", "bottom" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/mpl_toolkits/mplot3d/axes3d.py#L1519-L1527
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/internet/_sslverify.py
python
_handleattrhelper
(Class, transport, methodName)
return Class(cert)
(private) Helper for L{Certificate.peerFromTransport} and L{Certificate.hostFromTransport} which checks for incompatible handle types and null certificates and raises the appropriate exception or returns the appropriate certificate object.
(private) Helper for L{Certificate.peerFromTransport} and L{Certificate.hostFromTransport} which checks for incompatible handle types and null certificates and raises the appropriate exception or returns the appropriate certificate object.
[ "(", "private", ")", "Helper", "for", "L", "{", "Certificate", ".", "peerFromTransport", "}", "and", "L", "{", "Certificate", ".", "hostFromTransport", "}", "which", "checks", "for", "incompatible", "handle", "types", "and", "null", "certificates", "and", "rai...
def _handleattrhelper(Class, transport, methodName): """ (private) Helper for L{Certificate.peerFromTransport} and L{Certificate.hostFromTransport} which checks for incompatible handle types and null certificates and raises the appropriate exception or returns the appropriate certificate object. ...
[ "def", "_handleattrhelper", "(", "Class", ",", "transport", ",", "methodName", ")", ":", "method", "=", "getattr", "(", "transport", ".", "getHandle", "(", ")", ",", "f\"get_{methodName}_certificate\"", ",", "None", ")", "if", "method", "is", "None", ":", "r...
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/internet/_sslverify.py#L404-L425
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
doc/tutorials/card_game/solitaire_11.py
python
MyGame.on_mouse_motion
(self, x: float, y: float, dx: float, dy: float)
User moves mouse
User moves mouse
[ "User", "moves", "mouse" ]
def on_mouse_motion(self, x: float, y: float, dx: float, dy: float): """ User moves mouse """ # If we are holding cards, move them with the mouse for card in self.held_cards: card.center_x += dx card.center_y += dy
[ "def", "on_mouse_motion", "(", "self", ",", "x", ":", "float", ",", "y", ":", "float", ",", "dx", ":", "float", ",", "dy", ":", "float", ")", ":", "# If we are holding cards, move them with the mouse", "for", "card", "in", "self", ".", "held_cards", ":", "...
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/doc/tutorials/card_game/solitaire_11.py#L387-L393
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/core/leoFrame.py
python
frame_cmd
(name)
return g.new_cmd_decorator(name, ['c', 'frame',])
Command decorator for the LeoFrame class.
Command decorator for the LeoFrame class.
[ "Command", "decorator", "for", "the", "LeoFrame", "class", "." ]
def frame_cmd(name): """Command decorator for the LeoFrame class.""" return g.new_cmd_decorator(name, ['c', 'frame',])
[ "def", "frame_cmd", "(", "name", ")", ":", "return", "g", ".", "new_cmd_decorator", "(", "name", ",", "[", "'c'", ",", "'frame'", ",", "]", ")" ]
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/leoFrame.py#L55-L57
google/rekall
55d1925f2df9759a989b35271b4fa48fc54a1c86
rekall-core/rekall/cache.py
python
Cache.Flush
(self)
Called to sync the cache to external storage if required.
Called to sync the cache to external storage if required.
[ "Called", "to", "sync", "the", "cache", "to", "external", "storage", "if", "required", "." ]
def Flush(self): """Called to sync the cache to external storage if required."""
[ "def", "Flush", "(", "self", ")", ":" ]
https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/cache.py#L103-L104
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/util/_decorators.py
python
deprecate
(name, alternative, version, alt_name=None, klass=None, stacklevel=2, msg=None)
return wrapper
Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated function will emit a deprecation warning, and in the docstring it will contain the deprecation directive with th...
Return a new function that emits a deprecation warning on use.
[ "Return", "a", "new", "function", "that", "emits", "a", "deprecation", "warning", "on", "use", "." ]
def deprecate(name, alternative, version, alt_name=None, klass=None, stacklevel=2, msg=None): """Return a new function that emits a deprecation warning on use. To use this method for a deprecated function, another function `alternative` with the same signature must exist. The deprecated f...
[ "def", "deprecate", "(", "name", ",", "alternative", ",", "version", ",", "alt_name", "=", "None", ",", "klass", "=", "None", ",", "stacklevel", "=", "2", ",", "msg", "=", "None", ")", ":", "alt_name", "=", "alt_name", "or", "alternative", ".", "__name...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/util/_decorators.py#L10-L74
Pylons/pyramid
0b24ac16cc04746b25cf460f1497c157f6d3d6f4
src/pyramid/config/__init__.py
python
Configurator.end
(self)
return self.manager.pop()
Indicate that application or test configuration has ended. This pops the last value pushed onto the :term:`thread local` stack (usually by the ``begin`` method) and returns that value.
Indicate that application or test configuration has ended. This pops the last value pushed onto the :term:`thread local` stack (usually by the ``begin`` method) and returns that value.
[ "Indicate", "that", "application", "or", "test", "configuration", "has", "ended", ".", "This", "pops", "the", "last", "value", "pushed", "onto", "the", ":", "term", ":", "thread", "local", "stack", "(", "usually", "by", "the", "begin", "method", ")", "and"...
def end(self): """Indicate that application or test configuration has ended. This pops the last value pushed onto the :term:`thread local` stack (usually by the ``begin`` method) and returns that value. """ return self.manager.pop()
[ "def", "end", "(", "self", ")", ":", "return", "self", ".", "manager", ".", "pop", "(", ")" ]
https://github.com/Pylons/pyramid/blob/0b24ac16cc04746b25cf460f1497c157f6d3d6f4/src/pyramid/config/__init__.py#L783-L789
spender-sandbox/cuckoo-modified
eb93ef3d41b8fee51b4330306dcd315d8101e021
lib/cuckoo/common/abstracts.py
python
Machinery.shutdown
(self)
Shutdown the machine manager. Kills all alive machines. @raise CuckooMachineError: if unable to stop machine.
Shutdown the machine manager. Kills all alive machines.
[ "Shutdown", "the", "machine", "manager", ".", "Kills", "all", "alive", "machines", "." ]
def shutdown(self): """Shutdown the machine manager. Kills all alive machines. @raise CuckooMachineError: if unable to stop machine. """ if len(self.running()) > 0: log.info("Still %s guests alive. Shutting down...", len(self.running())) for m...
[ "def", "shutdown", "(", "self", ")", ":", "if", "len", "(", "self", ".", "running", "(", ")", ")", ">", "0", ":", "log", ".", "info", "(", "\"Still %s guests alive. Shutting down...\"", ",", "len", "(", "self", ".", "running", "(", ")", ")", ")", "fo...
https://github.com/spender-sandbox/cuckoo-modified/blob/eb93ef3d41b8fee51b4330306dcd315d8101e021/lib/cuckoo/common/abstracts.py#L230-L242
imageworks/OpenColorIO-Configs
0bb079c08be410030669cbf5f19ff869b88af953
aces_1.0.2/python/aces_ocio/colorspaces/general.py
python
create_matrix_plus_transfer_colorspace
( name='matrix_plus_transfer', transfer_function_name='transfer_function', transfer_function=lambda x: x, lut_directory='/tmp', lut_resolution_1d=1024, from_reference_values=None, to_reference_values=None, aliases=None)
return cs
Creates a ColorSpace that uses transfer functions encoded as 1D LUTs and matrice Parameters ---------- name : str, optional Aliases for this colorspace transfer_function_name : str, optional The name of the transfer function transfer_function : function, optional The tra...
Creates a ColorSpace that uses transfer functions encoded as 1D LUTs and matrice
[ "Creates", "a", "ColorSpace", "that", "uses", "transfer", "functions", "encoded", "as", "1D", "LUTs", "and", "matrice" ]
def create_matrix_plus_transfer_colorspace( name='matrix_plus_transfer', transfer_function_name='transfer_function', transfer_function=lambda x: x, lut_directory='/tmp', lut_resolution_1d=1024, from_reference_values=None, to_reference_values=None, aliases=...
[ "def", "create_matrix_plus_transfer_colorspace", "(", "name", "=", "'matrix_plus_transfer'", ",", "transfer_function_name", "=", "'transfer_function'", ",", "transfer_function", "=", "lambda", "x", ":", "x", ",", "lut_directory", "=", "'/tmp'", ",", "lut_resolution_1d", ...
https://github.com/imageworks/OpenColorIO-Configs/blob/0bb079c08be410030669cbf5f19ff869b88af953/aces_1.0.2/python/aces_ocio/colorspaces/general.py#L183-L287
tensorflow/tensor2tensor
2a33b152d7835af66a6d20afe7961751047e28dd
tensor2tensor/utils/cloud_mlengine.py
python
configure_job
()
return job_spec
Construct jobSpec for ML Engine job.
Construct jobSpec for ML Engine job.
[ "Construct", "jobSpec", "for", "ML", "Engine", "job", "." ]
def configure_job(): """Construct jobSpec for ML Engine job.""" # See documentation: # https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs#traininginput training_input = { "pythonModule": "tensor2tensor.bin.t2t_trainer", "args": flags_as_args(), "region": text_encoder.native_to_...
[ "def", "configure_job", "(", ")", ":", "# See documentation:", "# https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs#traininginput", "training_input", "=", "{", "\"pythonModule\"", ":", "\"tensor2tensor.bin.t2t_trainer\"", ",", "\"args\"", ":", "flags_as_args", "(",...
https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/utils/cloud_mlengine.py#L130-L170
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/packets/devicecloud.py
python
SendDataRequestPacket.path
(self)
return self.__path
Returns the path of the file to upload to Device Cloud. Returns: String: the path of the file to upload to Device Cloud.
Returns the path of the file to upload to Device Cloud.
[ "Returns", "the", "path", "of", "the", "file", "to", "upload", "to", "Device", "Cloud", "." ]
def path(self): """ Returns the path of the file to upload to Device Cloud. Returns: String: the path of the file to upload to Device Cloud. """ return self.__path
[ "def", "path", "(", "self", ")", ":", "return", "self", ".", "__path" ]
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/packets/devicecloud.py#L822-L829
collinsctk/PyQYT
7af3673955f94ff1b2df2f94220cd2dab2e252af
ExtentionPackages/pysnmp/hlapi/twisted/ntforg.py
python
sendNotification
(snmpEngine, authData, transportTarget, contextData, notifyType, varBinds, **options)
return deferred
Sends SNMP notification. Based on passed parameters, prepares SNMP TRAP or INFORM message (:RFC:`1905#section-4.2.6`) and schedules its transmission by :mod:`twisted` I/O framework at a later point of time. Parameters ---------- snmpEngine : :py:class:`~pysnmp.hlapi.SnmpEngine` Class i...
Sends SNMP notification.
[ "Sends", "SNMP", "notification", "." ]
def sendNotification(snmpEngine, authData, transportTarget, contextData, notifyType, varBinds, **options): """Sends SNMP notification. Based on passed parameters, prepares SNMP TRAP or INFORM message (:RFC:`1905#section-4.2.6`) and schedules its transmission by :mod:`twisted` I/O f...
[ "def", "sendNotification", "(", "snmpEngine", ",", "authData", ",", "transportTarget", ",", "contextData", ",", "notifyType", ",", "varBinds", ",", "*", "*", "options", ")", ":", "def", "__cbFun", "(", "snmpEngine", ",", "sendRequestHandle", ",", "errorIndicatio...
https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/pysnmp/hlapi/twisted/ntforg.py#L23-L153
seveas/python-networkmanager
0c2e4334293fc4f5d79a449b3779004d26a44195
NetworkManager.py
python
SignalDispatcher.setup_signals
(self)
[]
def setup_signals(self): if not self.setup: bus = dbus.SystemBus() for interface in self.interfaces: bus.add_signal_receiver(self.handle_signal, dbus_interface=interface, interface_keyword='interface', member_keyword='signal', path_keyword='path') self.setup =...
[ "def", "setup_signals", "(", "self", ")", ":", "if", "not", "self", ".", "setup", ":", "bus", "=", "dbus", ".", "SystemBus", "(", ")", "for", "interface", "in", "self", ".", "interfaces", ":", "bus", ".", "add_signal_receiver", "(", "self", ".", "handl...
https://github.com/seveas/python-networkmanager/blob/0c2e4334293fc4f5d79a449b3779004d26a44195/NetworkManager.py#L32-L38
sabri-zaki/EasY_HaCk
2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9
.modules/.sqlmap/thirdparty/odict/odict.py
python
_OrderedDict.setvalues
(self, values)
You can pass in a list of values, which will replace the current list. The value list must be the same len as the OrderedDict. (Or a ``ValueError`` is raised.) >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> d.setvalues((1, 2, 3)) >>> d OrderedDict([(1, 1), (3, 2), (2...
You can pass in a list of values, which will replace the current list. The value list must be the same len as the OrderedDict.
[ "You", "can", "pass", "in", "a", "list", "of", "values", "which", "will", "replace", "the", "current", "list", ".", "The", "value", "list", "must", "be", "the", "same", "len", "as", "the", "OrderedDict", "." ]
def setvalues(self, values): """ You can pass in a list of values, which will replace the current list. The value list must be the same len as the OrderedDict. (Or a ``ValueError`` is raised.) >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> d.setvalues((1, 2, 3)) ...
[ "def", "setvalues", "(", "self", ",", "values", ")", ":", "if", "len", "(", "values", ")", "!=", "len", "(", "self", ")", ":", "# FIXME: correct error to raise?", "raise", "ValueError", "(", "'Value list is not the same length as the '", "'OrderedDict.'", ")", "se...
https://github.com/sabri-zaki/EasY_HaCk/blob/2a39ac384dd0d6fc51c0dd22e8d38cece683fdb9/.modules/.sqlmap/thirdparty/odict/odict.py#L787-L806
cooelf/SemBERT
f849452f864b5dd47f94e2911cffc15e9f6a5a2a
run_classifier.py
python
SstProcessor.get_dev_examples
(self, data_dir)
return self._create_examples( self._read_tsv(os.path.join(data_dir, "dev.tsv_tag")), "dev")
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_dev_examples(self, data_dir): """See base class.""" return self._create_examples( self._read_tsv(os.path.join(data_dir, "dev.tsv_tag")), "dev")
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "self", ".", "_read_tsv", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"dev.tsv_tag\"", ")", ")", ",", "\"dev\"", ")" ]
https://github.com/cooelf/SemBERT/blob/f849452f864b5dd47f94e2911cffc15e9f6a5a2a/run_classifier.py#L188-L191
tobyyouup/conv_seq2seq
78a6e4e62a4c57a5caa9d584033a85e810fd726e
seq2seq/data/input_pipeline.py
python
make_input_pipeline_from_def
(def_dict, mode, **kwargs)
return pipeline_class(params=params, mode=mode)
Creates an InputPipeline object from a dictionary definition. Args: def_dict: A dictionary defining the input pipeline. It must have "class" and "params" that correspond to the class name and constructor parameters of an InputPipeline, respectively. mode: A value in tf.contrib.learn.ModeKeys R...
Creates an InputPipeline object from a dictionary definition.
[ "Creates", "an", "InputPipeline", "object", "from", "a", "dictionary", "definition", "." ]
def make_input_pipeline_from_def(def_dict, mode, **kwargs): """Creates an InputPipeline object from a dictionary definition. Args: def_dict: A dictionary defining the input pipeline. It must have "class" and "params" that correspond to the class name and constructor parameters of an InputPipeline, ...
[ "def", "make_input_pipeline_from_def", "(", "def_dict", ",", "mode", ",", "*", "*", "kwargs", ")", ":", "if", "not", "\"class\"", "in", "def_dict", ":", "raise", "ValueError", "(", "\"Input Pipeline definition must have a class property.\"", ")", "class_", "=", "def...
https://github.com/tobyyouup/conv_seq2seq/blob/78a6e4e62a4c57a5caa9d584033a85e810fd726e/seq2seq/data/input_pipeline.py#L39-L66
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/process_group_dto.py
python
ProcessGroupDTO.locally_modified_count
(self, locally_modified_count)
Sets the locally_modified_count of this ProcessGroupDTO. The number of locally modified versioned process groups in the process group. :param locally_modified_count: The locally_modified_count of this ProcessGroupDTO. :type: int
Sets the locally_modified_count of this ProcessGroupDTO. The number of locally modified versioned process groups in the process group.
[ "Sets", "the", "locally_modified_count", "of", "this", "ProcessGroupDTO", ".", "The", "number", "of", "locally", "modified", "versioned", "process", "groups", "in", "the", "process", "group", "." ]
def locally_modified_count(self, locally_modified_count): """ Sets the locally_modified_count of this ProcessGroupDTO. The number of locally modified versioned process groups in the process group. :param locally_modified_count: The locally_modified_count of this ProcessGroupDTO. ...
[ "def", "locally_modified_count", "(", "self", ",", "locally_modified_count", ")", ":", "self", ".", "_locally_modified_count", "=", "locally_modified_count" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_dto.py#L713-L722
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/datetime.py
python
datetime.timetz
(self)
return time(self.hour, self.minute, self.second, self.microsecond, self._tzinfo)
Return the time part, with same tzinfo.
Return the time part, with same tzinfo.
[ "Return", "the", "time", "part", "with", "same", "tzinfo", "." ]
def timetz(self): "Return the time part, with same tzinfo." return time(self.hour, self.minute, self.second, self.microsecond, self._tzinfo)
[ "def", "timetz", "(", "self", ")", ":", "return", "time", "(", "self", ".", "hour", ",", "self", ".", "minute", ",", "self", ".", "second", ",", "self", ".", "microsecond", ",", "self", ".", "_tzinfo", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/datetime.py#L1487-L1490
Juniper/py-junos-eznc
fd81d476e37ac1a234b503ab77f76ec658d04590
lib/jnpr/junos/utils/fs.py
python
FS.tgz
(self, from_path, tgz_path)
return rsp.text
Create a file called **tgz_path** that is the tar-gzip of the given directory specified **from_path**. :param str from_path: file-path to directory of files :param str tgz_path: file-path name of tgz file to create :returns: ``True`` if OK, error-msg (str) otherwise
Create a file called **tgz_path** that is the tar-gzip of the given directory specified **from_path**.
[ "Create", "a", "file", "called", "**", "tgz_path", "**", "that", "is", "the", "tar", "-", "gzip", "of", "the", "given", "directory", "specified", "**", "from_path", "**", "." ]
def tgz(self, from_path, tgz_path): """ Create a file called **tgz_path** that is the tar-gzip of the given directory specified **from_path**. :param str from_path: file-path to directory of files :param str tgz_path: file-path name of tgz file to create :returns: ``Tru...
[ "def", "tgz", "(", "self", ",", "from_path", ",", "tgz_path", ")", ":", "rsp", "=", "self", ".", "_dev", ".", "rpc", ".", "file_archive", "(", "compress", "=", "True", ",", "source", "=", "from_path", ",", "destination", "=", "tgz_path", ")", "# if the...
https://github.com/Juniper/py-junos-eznc/blob/fd81d476e37ac1a234b503ab77f76ec658d04590/lib/jnpr/junos/utils/fs.py#L433-L452
scikit-learn/scikit-learn
1d1aadd0711b87d2a11c80aad15df6f8cf156712
sklearn/neural_network/_multilayer_perceptron.py
python
BaseMultilayerPerceptron._forward_pass
(self, activations)
return activations
Perform a forward pass on the network by computing the values of the neurons in the hidden layers and the output layer. Parameters ---------- activations : list, length = n_layers - 1 The ith element of the list holds the values of the ith layer.
Perform a forward pass on the network by computing the values of the neurons in the hidden layers and the output layer.
[ "Perform", "a", "forward", "pass", "on", "the", "network", "by", "computing", "the", "values", "of", "the", "neurons", "in", "the", "hidden", "layers", "and", "the", "output", "layer", "." ]
def _forward_pass(self, activations): """Perform a forward pass on the network by computing the values of the neurons in the hidden layers and the output layer. Parameters ---------- activations : list, length = n_layers - 1 The ith element of the list holds the valu...
[ "def", "_forward_pass", "(", "self", ",", "activations", ")", ":", "hidden_activation", "=", "ACTIVATIONS", "[", "self", ".", "activation", "]", "# Iterate over the hidden layers", "for", "i", "in", "range", "(", "self", ".", "n_layers_", "-", "1", ")", ":", ...
https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/neural_network/_multilayer_perceptron.py#L118-L141
tensorflow/federated
5a60a032360087b8f4c7fcfd97ed1c0131c3eac3
tensorflow_federated/python/core/backends/iree/executor.py
python
IreeExecutor.create_value
(self, value, type_spec=None)
return IreeValue(value, type_spec, self._backend_info)
Embeds `value` of type `type_spec` within this executor. Args: value: An object that represents the value to embed within the executor. type_spec: The `tff.Type` of the value represented by this object, or something convertible to it. Can optionally be `None` if `value` is an instance o...
Embeds `value` of type `type_spec` within this executor.
[ "Embeds", "value", "of", "type", "type_spec", "within", "this", "executor", "." ]
async def create_value(self, value, type_spec=None): """Embeds `value` of type `type_spec` within this executor. Args: value: An object that represents the value to embed within the executor. type_spec: The `tff.Type` of the value represented by this object, or something convertible to it. ...
[ "async", "def", "create_value", "(", "self", ",", "value", ",", "type_spec", "=", "None", ")", ":", "return", "IreeValue", "(", "value", ",", "type_spec", ",", "self", ".", "_backend_info", ")" ]
https://github.com/tensorflow/federated/blob/5a60a032360087b8f4c7fcfd97ed1c0131c3eac3/tensorflow_federated/python/core/backends/iree/executor.py#L161-L178
nats-io/nats.py
49635bf58b1c888c66fa37569a9248b1a83a6c0a
benchmark/parser_perf.py
python
parse_msgs
(max_msgs=1, nbytes=1)
[]
def parse_msgs(max_msgs=1, nbytes=1): buf = b''.join([generate_msg("foo", nbytes) for i in range(0, max_msgs)]) print("--- buffer size: {}".format(len(buf))) loop = asyncio.get_event_loop() ps = Parser(DummyNatsClient()) loop.run_until_complete(ps.parse(buf)) print("--- stats: ", ps.nc.stats)
[ "def", "parse_msgs", "(", "max_msgs", "=", "1", ",", "nbytes", "=", "1", ")", ":", "buf", "=", "b''", ".", "join", "(", "[", "generate_msg", "(", "\"foo\"", ",", "nbytes", ")", "for", "i", "in", "range", "(", "0", ",", "max_msgs", ")", "]", ")", ...
https://github.com/nats-io/nats.py/blob/49635bf58b1c888c66fa37569a9248b1a83a6c0a/benchmark/parser_perf.py#L47-L53
crits/crits_services
c7abf91f1865d913cffad4b966599da204f8ae43
passivetotal_service/__init__.py
python
PassiveTotalService.get_config_details
(config)
return display_config
[]
def get_config_details(config): display_config = {} fields = forms.PassiveTotalConfigForm().fields for name, field in iteritems(fields): display_config[field.label] = config[name] return display_config
[ "def", "get_config_details", "(", "config", ")", ":", "display_config", "=", "{", "}", "fields", "=", "forms", ".", "PassiveTotalConfigForm", "(", ")", ".", "fields", "for", "name", ",", "field", "in", "iteritems", "(", "fields", ")", ":", "display_config", ...
https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/passivetotal_service/__init__.py#L79-L84
trainindata/deploying-machine-learning-models
aaeb3e65d0a58ad583289aaa39b089f11d06a4eb
section-07-ci-and-publishing/model-package/regression_model/processing/features.py
python
Mapper.__init__
(self, variables: List[str], mappings: dict)
[]
def __init__(self, variables: List[str], mappings: dict): if not isinstance(variables, list): raise ValueError("variables should be a list") self.variables = variables self.mappings = mappings
[ "def", "__init__", "(", "self", ",", "variables", ":", "List", "[", "str", "]", ",", "mappings", ":", "dict", ")", ":", "if", "not", "isinstance", "(", "variables", ",", "list", ")", ":", "raise", "ValueError", "(", "\"variables should be a list\"", ")", ...
https://github.com/trainindata/deploying-machine-learning-models/blob/aaeb3e65d0a58ad583289aaa39b089f11d06a4eb/section-07-ci-and-publishing/model-package/regression_model/processing/features.py#L36-L42
zykls/whynot
86fd2349a83cd43c614b55f5bf2dfc9ece143081
whynot/simulators/zika/environments.py
python
observation_space
()
return spaces.Box(state_space_low, state_space_high, dtype=np.float64)
Return observation space, the positive orthant.
Return observation space, the positive orthant.
[ "Return", "observation", "space", "the", "positive", "orthant", "." ]
def observation_space(): """Return observation space, the positive orthant.""" state_dim = State.num_variables() state_space_low = np.zeros(state_dim) state_space_high = np.inf * np.ones(state_dim) return spaces.Box(state_space_low, state_space_high, dtype=np.float64)
[ "def", "observation_space", "(", ")", ":", "state_dim", "=", "State", ".", "num_variables", "(", ")", "state_space_low", "=", "np", ".", "zeros", "(", "state_dim", ")", "state_space_high", "=", "np", ".", "inf", "*", "np", ".", "ones", "(", "state_dim", ...
https://github.com/zykls/whynot/blob/86fd2349a83cd43c614b55f5bf2dfc9ece143081/whynot/simulators/zika/environments.py#L49-L54
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/nest/media_source.py
python
NestEventMediaStore._get_devices
(self)
return devices
Return a mapping of nest device id to home assistant device id.
Return a mapping of nest device id to home assistant device id.
[ "Return", "a", "mapping", "of", "nest", "device", "id", "to", "home", "assistant", "device", "id", "." ]
async def _get_devices(self) -> Mapping[str, str]: """Return a mapping of nest device id to home assistant device id.""" device_registry = dr.async_get(self._hass) device_manager = await self._subscriber.async_get_device_manager() devices = {} for device in device_manager.devices...
[ "async", "def", "_get_devices", "(", "self", ")", "->", "Mapping", "[", "str", ",", "str", "]", ":", "device_registry", "=", "dr", ".", "async_get", "(", "self", ".", "_hass", ")", "device_manager", "=", "await", "self", ".", "_subscriber", ".", "async_g...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nest/media_source.py#L253-L263
Blizzard/s2protocol
4bfe857bb832eee12cc6307dd699e3b74bd7e1b2
s2protocol/versions/protocol77661.py
python
decode_replay_attributes_events
(contents)
return attributes
Decodes and yields each attribute from the contents byte string.
Decodes and yields each attribute from the contents byte string.
[ "Decodes", "and", "yields", "each", "attribute", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_attributes_events(contents): """Decodes and yields each attribute from the contents byte string.""" buffer = BitPackedBuffer(contents, 'little') attributes = {} if not buffer.done(): attributes['source'] = buffer.read_bits(8) attributes['mapNamespace'] = buffer.read_bit...
[ "def", "decode_replay_attributes_events", "(", "contents", ")", ":", "buffer", "=", "BitPackedBuffer", "(", "contents", ",", "'little'", ")", "attributes", "=", "{", "}", "if", "not", "buffer", ".", "done", "(", ")", ":", "attributes", "[", "'source'", "]", ...
https://github.com/Blizzard/s2protocol/blob/4bfe857bb832eee12cc6307dd699e3b74bd7e1b2/s2protocol/versions/protocol77661.py#L490-L510
geopandas/geopandas
8e7133aef9e6c0d2465e07e92d954e95dedd3881
geopandas/base.py
python
GeoPandasBase.intersection
(self, other, align=True)
return _binary_geo("intersection", self, other, align)
Returns a ``GeoSeries`` of the intersection of points in each aligned geometry with `other`. .. image:: ../../../_static/binary_geo-intersection.svg :align: center The operation works on a 1-to-1 row-wise manner: .. image:: ../../../_static/binary_op-01.svg :alig...
Returns a ``GeoSeries`` of the intersection of points in each aligned geometry with `other`.
[ "Returns", "a", "GeoSeries", "of", "the", "intersection", "of", "points", "in", "each", "aligned", "geometry", "with", "other", "." ]
def intersection(self, other, align=True): """Returns a ``GeoSeries`` of the intersection of points in each aligned geometry with `other`. .. image:: ../../../_static/binary_geo-intersection.svg :align: center The operation works on a 1-to-1 row-wise manner: .. imag...
[ "def", "intersection", "(", "self", ",", "other", ",", "align", "=", "True", ")", ":", "return", "_binary_geo", "(", "\"intersection\"", ",", "self", ",", "other", ",", "align", ")" ]
https://github.com/geopandas/geopandas/blob/8e7133aef9e6c0d2465e07e92d954e95dedd3881/geopandas/base.py#L2426-L2537
PaddlePaddle/PaddleX
2bab73f81ab54e328204e7871e6ae4a82e719f5d
static/paddlex/cv/nets/hrnet.py
python
HRNet.net
(self, input)
return st4[-1]
[]
def net(self, input): width = self.width channels_1, channels_2, channels_3, channels_4 = self.channels[str( width)] num_modules_1, num_modules_2, num_modules_3, num_modules_4 = self.num_modules[ str(width)] num_blocks_1, num_blocks_2, num_blocks_3, num_blocks_4 =...
[ "def", "net", "(", "self", ",", "input", ")", ":", "width", "=", "self", ".", "width", "channels_1", ",", "channels_2", ",", "channels_3", ",", "channels_4", "=", "self", ".", "channels", "[", "str", "(", "width", ")", "]", "num_modules_1", ",", "num_m...
https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/nets/hrnet.py#L97-L170
gevent/gevent
ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31
src/gevent/pywsgi.py
python
WSGIHandler.start_response
(self, status, headers, exc_info=None)
return self.write
.. versionchanged:: 1.2a1 Avoid HTTP header injection by raising a :exc:`ValueError` if *status* or any *header* name or value contains a carriage return or newline. .. versionchanged:: 1.1b5 Pro-actively handle checking the encoding of the status line ...
.. versionchanged:: 1.2a1 Avoid HTTP header injection by raising a :exc:`ValueError` if *status* or any *header* name or value contains a carriage return or newline. .. versionchanged:: 1.1b5 Pro-actively handle checking the encoding of the status line ...
[ "..", "versionchanged", "::", "1", ".", "2a1", "Avoid", "HTTP", "header", "injection", "by", "raising", "a", ":", "exc", ":", "ValueError", "if", "*", "status", "*", "or", "any", "*", "header", "*", "name", "or", "value", "contains", "a", "carriage", "...
def start_response(self, status, headers, exc_info=None): """ .. versionchanged:: 1.2a1 Avoid HTTP header injection by raising a :exc:`ValueError` if *status* or any *header* name or value contains a carriage return or newline. .. versionchanged:: 1.1b5 ...
[ "def", "start_response", "(", "self", ",", "status", ",", "headers", ",", "exc_info", "=", "None", ")", ":", "# pylint:disable=too-many-branches,too-many-statements", "if", "exc_info", ":", "try", ":", "if", "self", ".", "headers_sent", ":", "# Re-raise original exc...
https://github.com/gevent/gevent/blob/ae2cb5aeb2aea8987efcb90a4c50ca4e1ee12c31/src/gevent/pywsgi.py#L802-L905
Fizzadar/pyinfra
ff0913d6a172966760b63fe59e55dff9ea852e0d
pyinfra/api/facts.py
python
get_short_facts
(state, short_fact, **kwargs)
return { host: short_fact.process_data(data) for host, data in six.iteritems(facts) }
[]
def get_short_facts(state, short_fact, **kwargs): facts = get_facts(state, short_fact.fact.name, **kwargs) return { host: short_fact.process_data(data) for host, data in six.iteritems(facts) }
[ "def", "get_short_facts", "(", "state", ",", "short_fact", ",", "*", "*", "kwargs", ")", ":", "facts", "=", "get_facts", "(", "state", ",", "short_fact", ".", "fact", ".", "name", ",", "*", "*", "kwargs", ")", "return", "{", "host", ":", "short_fact", ...
https://github.com/Fizzadar/pyinfra/blob/ff0913d6a172966760b63fe59e55dff9ea852e0d/pyinfra/api/facts.py#L114-L120
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/_pyio.py
python
TextIOWrapper.close
(self)
[]
def close(self): if self.buffer is not None and not self.closed: try: self.flush() finally: self.buffer.close()
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "buffer", "is", "not", "None", "and", "not", "self", ".", "closed", ":", "try", ":", "self", ".", "flush", "(", ")", "finally", ":", "self", ".", "buffer", ".", "close", "(", ")" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/_pyio.py#L2174-L2179
Project-MONAI/MONAI
83f8b06372a3803ebe9281300cb794a1f3395018
monai/data/csv_saver.py
python
CSVSaver.save
(self, data: Union[torch.Tensor, np.ndarray], meta_data: Optional[Dict] = None)
Save data into the cache dictionary. The metadata should have the following key: - ``'filename_or_obj'`` -- save the data corresponding to file name or object. If meta_data is None, use the default index from 0 to save data instead. Args: data: target data content that save into...
Save data into the cache dictionary. The metadata should have the following key: - ``'filename_or_obj'`` -- save the data corresponding to file name or object. If meta_data is None, use the default index from 0 to save data instead.
[ "Save", "data", "into", "the", "cache", "dictionary", ".", "The", "metadata", "should", "have", "the", "following", "key", ":", "-", "filename_or_obj", "--", "save", "the", "data", "corresponding", "to", "file", "name", "or", "object", ".", "If", "meta_data"...
def save(self, data: Union[torch.Tensor, np.ndarray], meta_data: Optional[Dict] = None) -> None: """Save data into the cache dictionary. The metadata should have the following key: - ``'filename_or_obj'`` -- save the data corresponding to file name or object. If meta_data is None, use the de...
[ "def", "save", "(", "self", ",", "data", ":", "Union", "[", "torch", ".", "Tensor", ",", "np", ".", "ndarray", "]", ",", "meta_data", ":", "Optional", "[", "Dict", "]", "=", "None", ")", "->", "None", ":", "save_key", "=", "meta_data", "[", "Key", ...
https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/data/csv_saver.py#L80-L94
apple/coremltools
141a83af482fcbdd5179807c9eaff9a7999c2c49
coremltools/models/neural_network/builder.py
python
NeuralNetworkBuilder.add_copy
(self, name, input_name, output_name)
return spec_layer
Add a copy layer to the model that copies its input tensor to the output tensor. Input tensor and output tensor must have distinct names. Refer to the ``CopyLayerParams`` message in the specification (NeuralNetwork.proto) for more details. Parameters ---------- name: str ...
Add a copy layer to the model that copies its input tensor to the output tensor. Input tensor and output tensor must have distinct names. Refer to the ``CopyLayerParams`` message in the specification (NeuralNetwork.proto) for more details.
[ "Add", "a", "copy", "layer", "to", "the", "model", "that", "copies", "its", "input", "tensor", "to", "the", "output", "tensor", ".", "Input", "tensor", "and", "output", "tensor", "must", "have", "distinct", "names", ".", "Refer", "to", "the", "CopyLayerPar...
def add_copy(self, name, input_name, output_name): """ Add a copy layer to the model that copies its input tensor to the output tensor. Input tensor and output tensor must have distinct names. Refer to the ``CopyLayerParams`` message in the specification (NeuralNetwork.proto) for more de...
[ "def", "add_copy", "(", "self", ",", "name", ",", "input_name", ",", "output_name", ")", ":", "spec_layer", "=", "self", ".", "_add_generic_layer", "(", "name", ",", "[", "input_name", "]", ",", "[", "output_name", "]", ")", "spec_layer", ".", "copy", "....
https://github.com/apple/coremltools/blob/141a83af482fcbdd5179807c9eaff9a7999c2c49/coremltools/models/neural_network/builder.py#L6153-L6179
natanielruiz/disrupting-deepfakes
c5b4373a54693139ae4c408b1fcca2de745355e0
stargan/logger.py
python
Logger.__init__
(self, log_dir)
Initialize summary writer.
Initialize summary writer.
[ "Initialize", "summary", "writer", "." ]
def __init__(self, log_dir): """Initialize summary writer.""" self.writer = tf.summary.FileWriter(log_dir)
[ "def", "__init__", "(", "self", ",", "log_dir", ")", ":", "self", ".", "writer", "=", "tf", ".", "summary", ".", "FileWriter", "(", "log_dir", ")" ]
https://github.com/natanielruiz/disrupting-deepfakes/blob/c5b4373a54693139ae4c408b1fcca2de745355e0/stargan/logger.py#L7-L9
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/mako/runtime.py
python
LoopContext.reverse_index
(self)
return len(self) - self.index - 1
[]
def reverse_index(self): return len(self) - self.index - 1
[ "def", "reverse_index", "(", "self", ")", ":", "return", "len", "(", "self", ")", "-", "self", ".", "index", "-", "1" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/mako/runtime.py#L322-L323
memray/seq2seq-keyphrase
9145c63ebdc4c3bc431f8091dc52547a46804012
emolga/models/covc_encdec.py
python
DecoderAtt.build_sampler
(self)
Build a sampler which only steps once. Typically it only works for one word a time?
Build a sampler which only steps once. Typically it only works for one word a time?
[ "Build", "a", "sampler", "which", "only", "steps", "once", ".", "Typically", "it", "only", "works", "for", "one", "word", "a", "time?" ]
def build_sampler(self): """ Build a sampler which only steps once. Typically it only works for one word a time? """ logger.info("build sampler ...") if self.config['sample_stoch'] and self.config['sample_argmax']: logger.info("use argmax search!") eli...
[ "def", "build_sampler", "(", "self", ")", ":", "logger", ".", "info", "(", "\"build sampler ...\"", ")", "if", "self", ".", "config", "[", "'sample_stoch'", "]", "and", "self", ".", "config", "[", "'sample_argmax'", "]", ":", "logger", ".", "info", "(", ...
https://github.com/memray/seq2seq-keyphrase/blob/9145c63ebdc4c3bc431f8091dc52547a46804012/emolga/models/covc_encdec.py#L1155-L1202
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/imgcorruptlike.py
python
Spatter.__init__
(self, severity=(1, 5), seed=None, name=None, random_state="deprecated", deterministic="deprecated")
[]
def __init__(self, severity=(1, 5), seed=None, name=None, random_state="deprecated", deterministic="deprecated"): super(Spatter, self).__init__( apply_spatter, severity, seed=seed, name=name, random_state=random_state, deterministic=determini...
[ "def", "__init__", "(", "self", ",", "severity", "=", "(", "1", ",", "5", ")", ",", "seed", "=", "None", ",", "name", "=", "None", ",", "random_state", "=", "\"deprecated\"", ",", "deterministic", "=", "\"deprecated\"", ")", ":", "super", "(", "Spatter...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/imgcorruptlike.py#L1809-L1815
ntoll/drogulus
d74b78d0bf0220b91f075dbd3f9a06c2663b474e
drogulus/version.py
python
get_version
()
return '.'.join([str(i) for i in VERSION])
Returns a string representation of the version information of this project.
Returns a string representation of the version information of this project.
[ "Returns", "a", "string", "representation", "of", "the", "version", "information", "of", "this", "project", "." ]
def get_version(): """ Returns a string representation of the version information of this project. """ return '.'.join([str(i) for i in VERSION])
[ "def", "get_version", "(", ")", ":", "return", "'.'", ".", "join", "(", "[", "str", "(", "i", ")", "for", "i", "in", "VERSION", "]", ")" ]
https://github.com/ntoll/drogulus/blob/d74b78d0bf0220b91f075dbd3f9a06c2663b474e/drogulus/version.py#L12-L16
nerdvegas/rez
d392c65bf63b4bca8106f938cec49144ba54e770
src/rez/vendor/distlib/locators.py
python
JSONLocator.get_distribution_names
(self)
Return all the distribution names known to this locator.
Return all the distribution names known to this locator.
[ "Return", "all", "the", "distribution", "names", "known", "to", "this", "locator", "." ]
def get_distribution_names(self): """ Return all the distribution names known to this locator. """ raise NotImplementedError('Not available from this locator')
[ "def", "get_distribution_names", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Not available from this locator'", ")" ]
https://github.com/nerdvegas/rez/blob/d392c65bf63b4bca8106f938cec49144ba54e770/src/rez/vendor/distlib/locators.py#L900-L904
spyder-ide/spyder
55da47c032dfcf519600f67f8b30eab467f965e7
spyder/plugins/onlinehelp/widgets.py
python
PydocBrowser.url_to_text
(self, url)
return osp.splitext(str(url.path()))[0][1:]
Convert QUrl object to displayed text in combo box. Parameters ---------- url: QUrl Url address.
Convert QUrl object to displayed text in combo box.
[ "Convert", "QUrl", "object", "to", "displayed", "text", "in", "combo", "box", "." ]
def url_to_text(self, url): """ Convert QUrl object to displayed text in combo box. Parameters ---------- url: QUrl Url address. """ string_url = url.toString() if 'about:blank' in string_url: return 'about:blank' elif 'get...
[ "def", "url_to_text", "(", "self", ",", "url", ")", ":", "string_url", "=", "url", ".", "toString", "(", ")", "if", "'about:blank'", "in", "string_url", ":", "return", "'about:blank'", "elif", "'get?key='", "in", "string_url", "or", "'search?key='", "in", "s...
https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/onlinehelp/widgets.py#L387-L402
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/varLib/instancer/names.py
python
updateNameTable
(varfont, axisLimits)
Update instatiated variable font's name table using STAT AxisValues. Raises ValueError if the STAT table is missing or an Axis Value table is missing for requested axis locations. First, collect all STAT AxisValues that match the new default axis locations (excluding "elided" ones); concatenate the st...
Update instatiated variable font's name table using STAT AxisValues.
[ "Update", "instatiated", "variable", "font", "s", "name", "table", "using", "STAT", "AxisValues", "." ]
def updateNameTable(varfont, axisLimits): """Update instatiated variable font's name table using STAT AxisValues. Raises ValueError if the STAT table is missing or an Axis Value table is missing for requested axis locations. First, collect all STAT AxisValues that match the new default axis locations ...
[ "def", "updateNameTable", "(", "varfont", ",", "axisLimits", ")", ":", "from", ".", "import", "AxisRange", ",", "axisValuesFromAxisLimits", "if", "\"STAT\"", "not", "in", "varfont", ":", "raise", "ValueError", "(", "\"Cannot update name table since there is no STAT tabl...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/varLib/instancer/names.py#L70-L130
trakt/Plex-Trakt-Scrobbler
aeb0bfbe62fad4b06c164f1b95581da7f35dce0b
Trakttv.bundle/Contents/Libraries/MacOSX/i386/ucs2/cryptography/hazmat/primitives/serialization.py
python
_ssh_read_next_mpint
(data)
return ( utils.int_from_bytes(mpint_data, byteorder='big', signed=False), rest )
Reads the next mpint from the data. Currently, all mpints are interpreted as unsigned.
Reads the next mpint from the data.
[ "Reads", "the", "next", "mpint", "from", "the", "data", "." ]
def _ssh_read_next_mpint(data): """ Reads the next mpint from the data. Currently, all mpints are interpreted as unsigned. """ mpint_data, rest = _ssh_read_next_string(data) return ( utils.int_from_bytes(mpint_data, byteorder='big', signed=False), rest )
[ "def", "_ssh_read_next_mpint", "(", "data", ")", ":", "mpint_data", ",", "rest", "=", "_ssh_read_next_string", "(", "data", ")", "return", "(", "utils", ".", "int_from_bytes", "(", "mpint_data", ",", "byteorder", "=", "'big'", ",", "signed", "=", "False", ")...
https://github.com/trakt/Plex-Trakt-Scrobbler/blob/aeb0bfbe62fad4b06c164f1b95581da7f35dce0b/Trakttv.bundle/Contents/Libraries/MacOSX/i386/ucs2/cryptography/hazmat/primitives/serialization.py#L140-L150
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/verify/v2/service/entity/factor.py
python
FactorInstance.config
(self)
return self._properties['config']
:returns: Configurations for a `factor_type`. :rtype: dict
:returns: Configurations for a `factor_type`. :rtype: dict
[ ":", "returns", ":", "Configurations", "for", "a", "factor_type", ".", ":", "rtype", ":", "dict" ]
def config(self): """ :returns: Configurations for a `factor_type`. :rtype: dict """ return self._properties['config']
[ "def", "config", "(", "self", ")", ":", "return", "self", ".", "_properties", "[", "'config'", "]" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/verify/v2/service/entity/factor.py#L460-L465
getsentry/sentry
83b1f25aac3e08075e0e2495bc29efaf35aca18a
src/sentry/eventstore/base.py
python
EventStorage.get_unfetched_events
( self, snuba_filter, orderby=None, limit=100, offset=0, referrer="eventstore.get_unfetched_events", # NOQA )
Same as get_events but returns events without their node datas loaded. Only the event ID, projectID, groupID and timestamp field will be present without an additional fetch to nodestore. Used for fetching large volumes of events that do not need data loaded from nodestore. Currently thi...
Same as get_events but returns events without their node datas loaded. Only the event ID, projectID, groupID and timestamp field will be present without an additional fetch to nodestore.
[ "Same", "as", "get_events", "but", "returns", "events", "without", "their", "node", "datas", "loaded", ".", "Only", "the", "event", "ID", "projectID", "groupID", "and", "timestamp", "field", "will", "be", "present", "without", "an", "additional", "fetch", "to"...
def get_unfetched_events( self, snuba_filter, orderby=None, limit=100, offset=0, referrer="eventstore.get_unfetched_events", # NOQA ): """ Same as get_events but returns events without their node datas loaded. Only the event ID, projectID, gro...
[ "def", "get_unfetched_events", "(", "self", ",", "snuba_filter", ",", "orderby", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "referrer", "=", "\"eventstore.get_unfetched_events\"", ",", "# NOQA", ")", ":", "raise", "NotImplementedError" ...
https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/eventstore/base.py#L161-L185
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/pandas/computation/pytables.py
python
BinOp.is_in_table
(self)
return self.queryables.get(self.lhs) is not None
return True if this is a valid column name for generation (e.g. an actual column in the table)
return True if this is a valid column name for generation (e.g. an actual column in the table)
[ "return", "True", "if", "this", "is", "a", "valid", "column", "name", "for", "generation", "(", "e", ".", "g", ".", "an", "actual", "column", "in", "the", "table", ")" ]
def is_in_table(self): """ return True if this is a valid column name for generation (e.g. an actual column in the table) """ return self.queryables.get(self.lhs) is not None
[ "def", "is_in_table", "(", "self", ")", ":", "return", "self", ".", "queryables", ".", "get", "(", "self", ".", "lhs", ")", "is", "not", "None" ]
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/computation/pytables.py#L144-L147
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/tkinter/font.py
python
Font.copy
(self)
return Font(self._root, **self.actual())
Return a distinct copy of the current font
Return a distinct copy of the current font
[ "Return", "a", "distinct", "copy", "of", "the", "current", "font" ]
def copy(self): "Return a distinct copy of the current font" return Font(self._root, **self.actual())
[ "def", "copy", "(", "self", ")", ":", "return", "Font", "(", "self", ".", "_root", ",", "*", "*", "self", ".", "actual", "(", ")", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/font.py#L117-L119
vlachoudis/bCNC
67126b4894dabf6579baf47af8d0f9b7de35e6e3
bCNC/lib/tkExtra.py
python
InPlaceText.resize
(self, event=None)
[]
def resize(self, event=None): if self.frame is None: return bbox = self.listbox.bbox(self.item) if bbox is None: return x, y, w, h = bbox x += self.listbox.winfo_rootx() y += self.listbox.winfo_rooty() w = self.listbox.winfo_width() try: self.toplevel.wm_geometry("+%d+%d" % (x,y)) except TclError:...
[ "def", "resize", "(", "self", ",", "event", "=", "None", ")", ":", "if", "self", ".", "frame", "is", "None", ":", "return", "bbox", "=", "self", ".", "listbox", ".", "bbox", "(", "self", ".", "item", ")", "if", "bbox", "is", "None", ":", "return"...
https://github.com/vlachoudis/bCNC/blob/67126b4894dabf6579baf47af8d0f9b7de35e6e3/bCNC/lib/tkExtra.py#L2656-L2667
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/codecs.py
python
StreamReader.readlines
(self, sizehint=None, keepends=True)
return data.splitlines(keepends)
Read all lines available on the input stream and return them as a list. Line breaks are implemented using the codec's decoder method and are included in the list entries. sizehint, if given, is ignored since there is no efficient way to finding the true end-...
Read all lines available on the input stream and return them as a list.
[ "Read", "all", "lines", "available", "on", "the", "input", "stream", "and", "return", "them", "as", "a", "list", "." ]
def readlines(self, sizehint=None, keepends=True): """ Read all lines available on the input stream and return them as a list. Line breaks are implemented using the codec's decoder method and are included in the list entries. sizehint, if given, is ignored sinc...
[ "def", "readlines", "(", "self", ",", "sizehint", "=", "None", ",", "keepends", "=", "True", ")", ":", "data", "=", "self", ".", "read", "(", ")", "return", "data", ".", "splitlines", "(", "keepends", ")" ]
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter5-LogisticRegression/venv/Lib/codecs.py#L603-L616
CvvT/dumpDex
92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1
python/idaapi.py
python
is_commutative
(*args)
return _idaapi.is_commutative(*args)
is_commutative(op) -> bool
is_commutative(op) -> bool
[ "is_commutative", "(", "op", ")", "-", ">", "bool" ]
def is_commutative(*args): """ is_commutative(op) -> bool """ return _idaapi.is_commutative(*args)
[ "def", "is_commutative", "(", "*", "args", ")", ":", "return", "_idaapi", ".", "is_commutative", "(", "*", "args", ")" ]
https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L36818-L36822
exodrifter/unity-python
bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d
Lib/nntplib.py
python
NNTP.group
(self, name)
return resp, count, first, last, name
Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if successful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: the group name
Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if successful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: the group name
[ "Process", "a", "GROUP", "command", ".", "Argument", ":", "-", "group", ":", "the", "group", "name", "Returns", ":", "-", "resp", ":", "server", "response", "if", "successful", "-", "count", ":", "number", "of", "articles", "(", "string", ")", "-", "fi...
def group(self, name): """Process a GROUP command. Argument: - group: the group name Returns: - resp: server response if successful - count: number of articles (string) - first: first article number (string) - last: last article number (string) - name: th...
[ "def", "group", "(", "self", ",", "name", ")", ":", "resp", "=", "self", ".", "shortcmd", "(", "'GROUP '", "+", "name", ")", "if", "resp", "[", ":", "3", "]", "!=", "'211'", ":", "raise", "NNTPReplyError", "(", "resp", ")", "words", "=", "resp", ...
https://github.com/exodrifter/unity-python/blob/bef6e4e9ddfbbf1eaf7acbbb973e9aa3dd64a20d/Lib/nntplib.py#L344-L368
Terrance/SkPy
055a24f2087a79552f5ffebc8b2da28951313015
skpy/core.py
python
SkypeObj.rawToFields
(cls, raw={})
return {}
Convert the raw properties of an API response into class fields. Override to process additional values. Args: raw (dict): raw object, as provided by the API Returns: dict: a collection of fields, with keys matching :attr:`attrs`
Convert the raw properties of an API response into class fields. Override to process additional values.
[ "Convert", "the", "raw", "properties", "of", "an", "API", "response", "into", "class", "fields", ".", "Override", "to", "process", "additional", "values", "." ]
def rawToFields(cls, raw={}): """ Convert the raw properties of an API response into class fields. Override to process additional values. Args: raw (dict): raw object, as provided by the API Returns: dict: a collection of fields, with keys matching :attr:`attrs...
[ "def", "rawToFields", "(", "cls", ",", "raw", "=", "{", "}", ")", ":", "return", "{", "}" ]
https://github.com/Terrance/SkPy/blob/055a24f2087a79552f5ffebc8b2da28951313015/skpy/core.py#L35-L45
whoosh-community/whoosh
5421f1ab3bb802114105b3181b7ce4f44ad7d0bb
src/whoosh/writing.py
python
IndexWriter.delete_by_term
(self, fieldname, text, searcher=None)
return self.delete_by_query(q, searcher=searcher)
Deletes any documents containing "term" in the "fieldname" field. This is useful when you have an indexed field containing a unique ID (such as "pathname") for each document. :returns: the number of documents deleted.
Deletes any documents containing "term" in the "fieldname" field. This is useful when you have an indexed field containing a unique ID (such as "pathname") for each document.
[ "Deletes", "any", "documents", "containing", "term", "in", "the", "fieldname", "field", ".", "This", "is", "useful", "when", "you", "have", "an", "indexed", "field", "containing", "a", "unique", "ID", "(", "such", "as", "pathname", ")", "for", "each", "doc...
def delete_by_term(self, fieldname, text, searcher=None): """Deletes any documents containing "term" in the "fieldname" field. This is useful when you have an indexed field containing a unique ID (such as "pathname") for each document. :returns: the number of documents deleted. ...
[ "def", "delete_by_term", "(", "self", ",", "fieldname", ",", "text", ",", "searcher", "=", "None", ")", ":", "from", "whoosh", ".", "query", "import", "Term", "q", "=", "Term", "(", "fieldname", ",", "text", ")", "return", "self", ".", "delete_by_query",...
https://github.com/whoosh-community/whoosh/blob/5421f1ab3bb802114105b3181b7ce4f44ad7d0bb/src/whoosh/writing.py#L298-L309
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/sympy/sympy/polys/factortools.py
python
dup_ext_factor
(f, K)
return lc, factors
Factor univariate polynomials over algebraic number fields.
Factor univariate polynomials over algebraic number fields.
[ "Factor", "univariate", "polynomials", "over", "algebraic", "number", "fields", "." ]
def dup_ext_factor(f, K): """Factor univariate polynomials over algebraic number fields. """ n, lc = dup_degree(f), dup_LC(f, K) f = dup_monic(f, K) if n <= 0: return lc, [] if n == 1: return lc, [(f, 1)] f, F = dup_sqf_part(f, K), f s, g, r = dup_sqf_norm(f, K) facto...
[ "def", "dup_ext_factor", "(", "f", ",", "K", ")", ":", "n", ",", "lc", "=", "dup_degree", "(", "f", ")", ",", "dup_LC", "(", "f", ",", "K", ")", "f", "=", "dup_monic", "(", "f", ",", "K", ")", "if", "n", "<=", "0", ":", "return", "lc", ",",...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/factortools.py#L1100-L1128
nipy/nipy
d16d268938dcd5c15748ca051532c21f57cf8a22
nipy/externals/configobj.py
python
ConfigObj._a_to_u
(self, aString)
Decode ASCII strings to unicode if a self.encoding is specified.
Decode ASCII strings to unicode if a self.encoding is specified.
[ "Decode", "ASCII", "strings", "to", "unicode", "if", "a", "self", ".", "encoding", "is", "specified", "." ]
def _a_to_u(self, aString): """Decode ASCII strings to unicode if a self.encoding is specified.""" if isinstance(aString, six.binary_type) and self.encoding: return aString.decode(self.encoding) else: return aString
[ "def", "_a_to_u", "(", "self", ",", "aString", ")", ":", "if", "isinstance", "(", "aString", ",", "six", ".", "binary_type", ")", "and", "self", ".", "encoding", ":", "return", "aString", ".", "decode", "(", "self", ".", "encoding", ")", "else", ":", ...
https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/externals/configobj.py#L1490-L1495
djblets/djblets
0496e1ec49e43d43d776768c9fc5b6f8af56ec2c
djblets/mail/message.py
python
EmailMessage.message
(self)
return msg
Construct an outgoing message for the e-mail. This will construct a message based on the data provided to the constructor. This represents the e-mail that will later be sent using :py:meth:`send`. After calling this method, the message's ID will be stored in the :py:attr:`messa...
Construct an outgoing message for the e-mail.
[ "Construct", "an", "outgoing", "message", "for", "the", "e", "-", "mail", "." ]
def message(self): """Construct an outgoing message for the e-mail. This will construct a message based on the data provided to the constructor. This represents the e-mail that will later be sent using :py:meth:`send`. After calling this method, the message's ID will be stored ...
[ "def", "message", "(", "self", ")", ":", "msg", "=", "super", "(", "EmailMessage", ",", "self", ")", ".", "message", "(", ")", "self", ".", "message_id", "=", "msg", "[", "'Message-ID'", "]", "for", "name", ",", "value_list", "in", "six", ".", "iterl...
https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/mail/message.py#L285-L312
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
source/openerp/__init__.py
python
registry
(database_name=None)
return modules.registry.RegistryManager.get(database_name)
Return the model registry for the given database, or the database mentioned on the current thread. If the registry does not exist yet, it is created on the fly.
Return the model registry for the given database, or the database mentioned on the current thread. If the registry does not exist yet, it is created on the fly.
[ "Return", "the", "model", "registry", "for", "the", "given", "database", "or", "the", "database", "mentioned", "on", "the", "current", "thread", ".", "If", "the", "registry", "does", "not", "exist", "yet", "it", "is", "created", "on", "the", "fly", "." ]
def registry(database_name=None): """ Return the model registry for the given database, or the database mentioned on the current thread. If the registry does not exist yet, it is created on the fly. """ if database_name is None: import threading database_name = threading.currentT...
[ "def", "registry", "(", "database_name", "=", "None", ")", ":", "if", "database_name", "is", "None", ":", "import", "threading", "database_name", "=", "threading", ".", "currentThread", "(", ")", ".", "dbname", "return", "modules", ".", "registry", ".", "Reg...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/openerp/__init__.py#L59-L68
stackimpact/stackimpact-python
4d0a415b790c89e7bee1d70216f948b7fec11540
stackimpact/profilers/cpu_profiler.py
python
CPUProfiler.process_sample
(self, signal_frame)
[]
def process_sample(self, signal_frame): if self.profile: start = time.clock() if signal_frame: stack = self.recover_stack(signal_frame) if stack: self.update_profile(self.profile, stack) stack = None
[ "def", "process_sample", "(", "self", ",", "signal_frame", ")", ":", "if", "self", ".", "profile", ":", "start", "=", "time", ".", "clock", "(", ")", "if", "signal_frame", ":", "stack", "=", "self", ".", "recover_stack", "(", "signal_frame", ")", "if", ...
https://github.com/stackimpact/stackimpact-python/blob/4d0a415b790c89e7bee1d70216f948b7fec11540/stackimpact/profilers/cpu_profiler.py#L94-L102
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/timeit.py
python
timeit
(stmt="pass", setup="pass", timer=default_timer, number=default_number, globals=None)
return Timer(stmt, setup, timer, globals).timeit(number)
Convenience function to create Timer object and call timeit method.
Convenience function to create Timer object and call timeit method.
[ "Convenience", "function", "to", "create", "Timer", "object", "and", "call", "timeit", "method", "." ]
def timeit(stmt="pass", setup="pass", timer=default_timer, number=default_number, globals=None): """Convenience function to create Timer object and call timeit method.""" return Timer(stmt, setup, timer, globals).timeit(number)
[ "def", "timeit", "(", "stmt", "=", "\"pass\"", ",", "setup", "=", "\"pass\"", ",", "timer", "=", "default_timer", ",", "number", "=", "default_number", ",", "globals", "=", "None", ")", ":", "return", "Timer", "(", "stmt", ",", "setup", ",", "timer", "...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/timeit.py#L231-L234
erikdubois/Aureola
005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef
lazuli8core/dropbox.py
python
running
(argv)
return int(is_dropbox_running())
u"""return whether dropbox is running dropbox running Returns 1 if running 0 if not running.
u"""return whether dropbox is running dropbox running
[ "u", "return", "whether", "dropbox", "is", "running", "dropbox", "running" ]
def running(argv): u"""return whether dropbox is running dropbox running Returns 1 if running 0 if not running. """ return int(is_dropbox_running())
[ "def", "running", "(", "argv", ")", ":", "return", "int", "(", "is_dropbox_running", "(", ")", ")" ]
https://github.com/erikdubois/Aureola/blob/005fb14b3cab0ba1929ebf9ac3ac68d2c6e1c0ef/lazuli8core/dropbox.py#L1200-L1206
overhangio/tutor
d45b36394af46de29d7817e2b45694d226d5677d
tutor/jobs.py
python
BaseJobRunner.run_job
(self, service: str, command: str)
Given a (potentially large) string command, run it with the corresponding service. Implementations will differ depending on the deployment strategy.
Given a (potentially large) string command, run it with the corresponding service. Implementations will differ depending on the deployment strategy.
[ "Given", "a", "(", "potentially", "large", ")", "string", "command", "run", "it", "with", "the", "corresponding", "service", ".", "Implementations", "will", "differ", "depending", "on", "the", "deployment", "strategy", "." ]
def run_job(self, service: str, command: str) -> int: """ Given a (potentially large) string command, run it with the corresponding service. Implementations will differ depending on the deployment strategy. """ raise NotImplementedError
[ "def", "run_job", "(", "self", ",", "service", ":", "str", ",", "command", ":", "str", ")", "->", "int", ":", "raise", "NotImplementedError" ]
https://github.com/overhangio/tutor/blob/d45b36394af46de29d7817e2b45694d226d5677d/tutor/jobs.py#L31-L37
python-zk/kazoo
f585d605eea0a37a08aae95a8cc259b80da2ecf0
kazoo/handlers/gevent.py
python
SequentialGeventHandler.async_result
(self)
return AsyncResult()
Create a :class:`AsyncResult` instance The :class:`AsyncResult` instance will have its completion callbacks executed in the thread the :class:`SequentialGeventHandler` is created in (which should be the gevent/main thread).
Create a :class:`AsyncResult` instance
[ "Create", "a", ":", "class", ":", "AsyncResult", "instance" ]
def async_result(self): """Create a :class:`AsyncResult` instance The :class:`AsyncResult` instance will have its completion callbacks executed in the thread the :class:`SequentialGeventHandler` is created in (which should be the gevent/main thread). """ return ...
[ "def", "async_result", "(", "self", ")", ":", "return", "AsyncResult", "(", ")" ]
https://github.com/python-zk/kazoo/blob/f585d605eea0a37a08aae95a8cc259b80da2ecf0/kazoo/handlers/gevent.py#L148-L157
WenmuZhou/PytorchOCR
0b2b3a67814ae40b20f3814d6793f5d75d644e38
torchocr/datasets/det_modules/augment.py
python
HorizontalFlip.__call__
(self, data: dict)
return data
从scales中随机选择一个尺度,对图片和文本框进行缩放 :param data: {'img':,'text_polys':,'texts':,'ignore_tags':} :return:
从scales中随机选择一个尺度,对图片和文本框进行缩放 :param data: {'img':,'text_polys':,'texts':,'ignore_tags':} :return:
[ "从scales中随机选择一个尺度,对图片和文本框进行缩放", ":", "param", "data", ":", "{", "img", ":", "text_polys", ":", "texts", ":", "ignore_tags", ":", "}", ":", "return", ":" ]
def __call__(self, data: dict) -> dict: """ 从scales中随机选择一个尺度,对图片和文本框进行缩放 :param data: {'img':,'text_polys':,'texts':,'ignore_tags':} :return: """ if random.random() > self.random_rate: return data im = data['img'] text_polys = data['text_polys'...
[ "def", "__call__", "(", "self", ",", "data", ":", "dict", ")", "->", "dict", ":", "if", "random", ".", "random", "(", ")", ">", "self", ".", "random_rate", ":", "return", "data", "im", "=", "data", "[", "'img'", "]", "text_polys", "=", "data", "[",...
https://github.com/WenmuZhou/PytorchOCR/blob/0b2b3a67814ae40b20f3814d6793f5d75d644e38/torchocr/datasets/det_modules/augment.py#L250-L268
PyMVPA/PyMVPA
76c476b3de8264b0bb849bf226da5674d659564e
mvpa2/measures/irelief.py
python
IterativeReliefOnline.__init__
(self, a=10.0, permute=True, max_iter=3, **kwargs)
Constructor of the IRELIEF class.
Constructor of the IRELIEF class.
[ "Constructor", "of", "the", "IRELIEF", "class", "." ]
def __init__(self, a=10.0, permute=True, max_iter=3, **kwargs): """Constructor of the IRELIEF class. """ # init base classes first IterativeRelief.__init__(self, **kwargs) self.a = a # parameter of the learning rate self.permute = permute # shuffle data when running I-R...
[ "def", "__init__", "(", "self", ",", "a", "=", "10.0", ",", "permute", "=", "True", ",", "max_iter", "=", "3", ",", "*", "*", "kwargs", ")", ":", "# init base classes first", "IterativeRelief", ".", "__init__", "(", "self", ",", "*", "*", "kwargs", ")"...
https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/measures/irelief.py#L390-L399
tualatrix/ubuntu-tweak
24ee3575da39622d8ff1ae2db8630846436772d4
ubuntutweak/modules/__init__.py
python
TweakModule.reparent
(self, widget)
If module use glade, it must call this method to reparent the main frame
If module use glade, it must call this method to reparent the main frame
[ "If", "module", "use", "glade", "it", "must", "call", "this", "method", "to", "reparent", "the", "main", "frame" ]
def reparent(self, widget): ''' If module use glade, it must call this method to reparent the main frame ''' widget.reparent(self.inner_vbox)
[ "def", "reparent", "(", "self", ",", "widget", ")", ":", "widget", ".", "reparent", "(", "self", ".", "inner_vbox", ")" ]
https://github.com/tualatrix/ubuntu-tweak/blob/24ee3575da39622d8ff1ae2db8630846436772d4/ubuntutweak/modules/__init__.py#L311-L315