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
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/view/relview.py
python
RelationshipView.build_widget
(self)
return container
Build the widget that contains the view, see :class:`~gui.views.pageview.PageView
Build the widget that contains the view, see :class:`~gui.views.pageview.PageView
[ "Build", "the", "widget", "that", "contains", "the", "view", "see", ":", "class", ":", "~gui", ".", "views", ".", "pageview", ".", "PageView" ]
def build_widget(self): """ Build the widget that contains the view, see :class:`~gui.views.pageview.PageView """ container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) container.set_border_width(12) self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) ...
[ "def", "build_widget", "(", "self", ")", ":", "container", "=", "Gtk", ".", "Box", "(", "orientation", "=", "Gtk", ".", "Orientation", ".", "VERTICAL", ")", "container", ".", "set_border_width", "(", "12", ")", "self", ".", "vbox", "=", "Gtk", ".", "Bo...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/view/relview.py#L336-L369
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/idlelib/SearchDialogBase.py
python
SearchDialogBase.create_option_buttons
(self)
return frame, options
Return (filled frame, options) for testing. Options is a list of SearchEngine booleanvar, label pairs. A gridded frame from make_frame is filled with a Checkbutton for each pair, bound to the var, with the corresponding label.
Return (filled frame, options) for testing.
[ "Return", "(", "filled", "frame", "options", ")", "for", "testing", "." ]
def create_option_buttons(self): '''Return (filled frame, options) for testing. Options is a list of SearchEngine booleanvar, label pairs. A gridded frame from make_frame is filled with a Checkbutton for each pair, bound to the var, with the corresponding label. ''' fram...
[ "def", "create_option_buttons", "(", "self", ")", ":", "frame", "=", "self", ".", "make_frame", "(", "\"Options\"", ")", "[", "0", "]", "engine", "=", "self", ".", "engine", "options", "=", "[", "(", "engine", ".", "revar", ",", "\"Regular expression\"", ...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/idlelib/SearchDialogBase.py#L127-L146
jeffgortmaker/pyblp
33ad24d8a800b8178aafa47304a822077a607558
pyblp/results/simulation_results.py
python
SimulationResults._combine_arrays
( self, compute_market_results: Callable, market_ids: Array, fixed_args: Sequence = (), market_args: Sequence = (), agent_data: Optional[Mapping] = None, integration: Optional[Integration] = None)
return combined
Compute arrays for one or all markets and stack them into a single array. An array for a single market is computed by passing fixed_args (identical for all markets) and market_args (matrices with as many rows as there are products that are restricted to the market) to compute_market_results, a ResultsMa...
Compute arrays for one or all markets and stack them into a single array. An array for a single market is computed by passing fixed_args (identical for all markets) and market_args (matrices with as many rows as there are products that are restricted to the market) to compute_market_results, a ResultsMa...
[ "Compute", "arrays", "for", "one", "or", "all", "markets", "and", "stack", "them", "into", "a", "single", "array", ".", "An", "array", "for", "a", "single", "market", "is", "computed", "by", "passing", "fixed_args", "(", "identical", "for", "all", "markets...
def _combine_arrays( self, compute_market_results: Callable, market_ids: Array, fixed_args: Sequence = (), market_args: Sequence = (), agent_data: Optional[Mapping] = None, integration: Optional[Integration] = None) -> Array: """Compute arrays for one or all markets and stack...
[ "def", "_combine_arrays", "(", "self", ",", "compute_market_results", ":", "Callable", ",", "market_ids", ":", "Array", ",", "fixed_args", ":", "Sequence", "=", "(", ")", ",", "market_args", ":", "Sequence", "=", "(", ")", ",", "agent_data", ":", "Optional",...
https://github.com/jeffgortmaker/pyblp/blob/33ad24d8a800b8178aafa47304a822077a607558/pyblp/results/simulation_results.py#L203-L279
mne-tools/mne-python
f90b303ce66a8415e64edd4605b09ac0179c1ebf
mne/filter.py
python
notch_filter
(x, Fs, freqs, filter_length='auto', notch_widths=None, trans_bandwidth=1, method='fir', iir_params=None, mt_bandwidth=None, p_value=0.05, picks=None, n_jobs=1, copy=True, phase='zero', fir_window='hamming', fir_design='firwin', pad='reflect_limited', ...
return xf
r"""Notch filter for the signal x. Applies a zero-phase notch filter to the signal x, operating on the last dimension. Parameters ---------- x : array Signal to filter. Fs : float Sampling rate in Hz. freqs : float | array of float | None Frequencies to notch filter...
r"""Notch filter for the signal x.
[ "r", "Notch", "filter", "for", "the", "signal", "x", "." ]
def notch_filter(x, Fs, freqs, filter_length='auto', notch_widths=None, trans_bandwidth=1, method='fir', iir_params=None, mt_bandwidth=None, p_value=0.05, picks=None, n_jobs=1, copy=True, phase='zero', fir_window='hamming', fir_design='firwin', pad='re...
[ "def", "notch_filter", "(", "x", ",", "Fs", ",", "freqs", ",", "filter_length", "=", "'auto'", ",", "notch_widths", "=", "None", ",", "trans_bandwidth", "=", "1", ",", "method", "=", "'fir'", ",", "iir_params", "=", "None", ",", "mt_bandwidth", "=", "Non...
https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/filter.py#L1072-L1197
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/iotvideo/v20201215/models.py
python
ModifyForwardRuleRequest.__init__
(self)
r""" :param ProductID: 产品ID :type ProductID: str :param MsgType: 消息类型 :type MsgType: int :param Skey: 控制台Skey :type Skey: str :param QueueRegion: 队列区域 :type QueueRegion: str :param QueueType: 队列类型 0.CMQ 1.CKafka :type QueueType: int ...
r""" :param ProductID: 产品ID :type ProductID: str :param MsgType: 消息类型 :type MsgType: int :param Skey: 控制台Skey :type Skey: str :param QueueRegion: 队列区域 :type QueueRegion: str :param QueueType: 队列类型 0.CMQ 1.CKafka :type QueueType: int ...
[ "r", ":", "param", "ProductID", ":", "产品ID", ":", "type", "ProductID", ":", "str", ":", "param", "MsgType", ":", "消息类型", ":", "type", "MsgType", ":", "int", ":", "param", "Skey", ":", "控制台Skey", ":", "type", "Skey", ":", "str", ":", "param", "QueueRe...
def __init__(self): r""" :param ProductID: 产品ID :type ProductID: str :param MsgType: 消息类型 :type MsgType: int :param Skey: 控制台Skey :type Skey: str :param QueueRegion: 队列区域 :type QueueRegion: str :param QueueType: 队列类型 0.CMQ 1.CKafka ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "ProductID", "=", "None", "self", ".", "MsgType", "=", "None", "self", ".", "Skey", "=", "None", "self", ".", "QueueRegion", "=", "None", "self", ".", "QueueType", "=", "None", "self", ".", "Cons...
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/iotvideo/v20201215/models.py#L4905-L4937
newfies-dialer/newfies-dialer
8168b3dd43e9f5ce73a2645b3229def1b2815d47
newfies/appointment/utils.py
python
OccurrenceReplacer.get_occurrence
(self, occ)
return self.lookup.pop( (occ.event, occ.original_start, occ.original_end), occ)
Return a persisted occurrences matching the occ and remove it from lookup since it has already been matched
Return a persisted occurrences matching the occ and remove it from lookup since it has already been matched
[ "Return", "a", "persisted", "occurrences", "matching", "the", "occ", "and", "remove", "it", "from", "lookup", "since", "it", "has", "already", "been", "matched" ]
def get_occurrence(self, occ): """ Return a persisted occurrences matching the occ and remove it from lookup since it has already been matched """ return self.lookup.pop( (occ.event, occ.original_start, occ.original_end), occ)
[ "def", "get_occurrence", "(", "self", ",", "occ", ")", ":", "return", "self", ".", "lookup", ".", "pop", "(", "(", "occ", ".", "event", ",", "occ", ".", "original_start", ",", "occ", ".", "original_end", ")", ",", "occ", ")" ]
https://github.com/newfies-dialer/newfies-dialer/blob/8168b3dd43e9f5ce73a2645b3229def1b2815d47/newfies/appointment/utils.py#L21-L28
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/algo/conformance/alignments/decomposed/variants/recompos_maximal.py
python
get_acache
(cons_nets)
return ret
Calculates the A-Cache of the given decomposition Parameters -------------- cons_nets List of considered nets Returns -------------- acache A-Cache
Calculates the A-Cache of the given decomposition
[ "Calculates", "the", "A", "-", "Cache", "of", "the", "given", "decomposition" ]
def get_acache(cons_nets): """ Calculates the A-Cache of the given decomposition Parameters -------------- cons_nets List of considered nets Returns -------------- acache A-Cache """ ret = {} for index, el in enumerate(cons_nets): for lab in el[0].lv...
[ "def", "get_acache", "(", "cons_nets", ")", ":", "ret", "=", "{", "}", "for", "index", ",", "el", "in", "enumerate", "(", "cons_nets", ")", ":", "for", "lab", "in", "el", "[", "0", "]", ".", "lvis_labels", ":", "if", "lab", "not", "in", "ret", ":...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/algo/conformance/alignments/decomposed/variants/recompos_maximal.py#L222-L243
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/s3/key.py
python
Key.compute_md5
(self, fp, size=None)
return (hex_digest, b64_digest)
:type fp: file :param fp: File pointer to the file to MD5 hash. The file pointer will be reset to the same position before the method returns. :type size: int :param size: (optional) The Maximum number of bytes to read from the file pointer (fp). This is use...
:type fp: file :param fp: File pointer to the file to MD5 hash. The file pointer will be reset to the same position before the method returns.
[ ":", "type", "fp", ":", "file", ":", "param", "fp", ":", "File", "pointer", "to", "the", "file", "to", "MD5", "hash", ".", "The", "file", "pointer", "will", "be", "reset", "to", "the", "same", "position", "before", "the", "method", "returns", "." ]
def compute_md5(self, fp, size=None): """ :type fp: file :param fp: File pointer to the file to MD5 hash. The file pointer will be reset to the same position before the method returns. :type size: int :param size: (optional) The Maximum number of bytes t...
[ "def", "compute_md5", "(", "self", ",", "fp", ",", "size", "=", "None", ")", ":", "hex_digest", ",", "b64_digest", ",", "data_size", "=", "compute_md5", "(", "fp", ",", "size", "=", "size", ")", "# Returned values are MD5 hash, base64 encoded MD5 hash, and data si...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/s3/key.py#L1013-L1035
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
lib-python/2.7/os2emxpath.py
python
basename
(p)
return split(p)[1]
Returns the final component of a pathname
Returns the final component of a pathname
[ "Returns", "the", "final", "component", "of", "a", "pathname" ]
def basename(p): """Returns the final component of a pathname""" return split(p)[1]
[ "def", "basename", "(", "p", ")", ":", "return", "split", "(", "p", ")", "[", "1", "]" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/lib-python/2.7/os2emxpath.py#L89-L91
ptrblck/prog_gans_pytorch_inference
10c4a2c5248394043c5154a33830e2fa53388859
pygame_interp_demo.py
python
run
(args)
[]
def run(args): global use_cuda # Init PYGame pygame.init() display = pygame.display.set_mode((args.size, args.size), 0) print('Loading Generator') model = Generator() model.load_state_dict(torch.load(args.weights)) if use_cuda: model = model.cuda() pin_memory = True ...
[ "def", "run", "(", "args", ")", ":", "global", "use_cuda", "# Init PYGame", "pygame", ".", "init", "(", ")", "display", "=", "pygame", ".", "display", ".", "set_mode", "(", "(", "args", ".", "size", ",", "args", ".", "size", ")", ",", "0", ")", "pr...
https://github.com/ptrblck/prog_gans_pytorch_inference/blob/10c4a2c5248394043c5154a33830e2fa53388859/pygame_interp_demo.py#L65-L111
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/broadlink/entity.py
python
BroadlinkEntity.async_update
(self)
Update the state of the entity.
Update the state of the entity.
[ "Update", "the", "state", "of", "the", "entity", "." ]
async def async_update(self): """Update the state of the entity.""" await self._coordinator.async_request_refresh()
[ "async", "def", "async_update", "(", "self", ")", ":", "await", "self", ".", "_coordinator", ".", "async_request_refresh", "(", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/broadlink/entity.py#L23-L25
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tencentcloud/cr/v20180321/models.py
python
DescribeTaskStatusResponse.__init__
(self)
:param TaskResult: 任务结果 :type TaskResult: str :param TaskType: 任务类型,010代表上传任务 :type TaskType: str :param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str
:param TaskResult: 任务结果 :type TaskResult: str :param TaskType: 任务类型,010代表上传任务 :type TaskType: str :param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str
[ ":", "param", "TaskResult", ":", "任务结果", ":", "type", "TaskResult", ":", "str", ":", "param", "TaskType", ":", "任务类型,010代表上传任务", ":", "type", "TaskType", ":", "str", ":", "param", "RequestId", ":", "唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。", ":", "type", "Reques...
def __init__(self): """ :param TaskResult: 任务结果 :type TaskResult: str :param TaskType: 任务类型,010代表上传任务 :type TaskType: str :param RequestId: 唯一请求ID,每次请求都会返回。定位问题时需要提供该次请求的RequestId。 :type RequestId: str """ self.TaskResult = None self.TaskTy...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TaskResult", "=", "None", "self", ".", "TaskType", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/cr/v20180321/models.py#L49-L60
facebookresearch/pyrobot
27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f
src/pyrobot/vrep_locobot/base.py
python
LoCoBotBase.get_full_state
(self)
return self.agent.get_state()
[]
def get_full_state(self): # Returns habitat_sim.agent.AgentState # temp_state = self.agent.get_state() # temp_state.position = habUtils.quat_rotate_vector(self._fix_transform().inverse(), temp_state.position) # temp_state.rotation = self._fix_transform() * temp_state.rotation ret...
[ "def", "get_full_state", "(", "self", ")", ":", "# Returns habitat_sim.agent.AgentState", "# temp_state = self.agent.get_state()", "# temp_state.position = habUtils.quat_rotate_vector(self._fix_transform().inverse(), temp_state.position)", "# temp_state.rotation = self._fix_transform() * temp_stat...
https://github.com/facebookresearch/pyrobot/blob/27ffd64bbb7ce3ff6ec4b2122d84b438d5641d0f/src/pyrobot/vrep_locobot/base.py#L20-L25
SySS-Research/outis
ef9b720fa12e8e0748a826354f138eabc33747fe
syhelpers/log.py
python
isactivated
(module)
return False
checks whether the given module is active for debugging :param module: the module name to check :return: True iff the given module is active for debugging
checks whether the given module is active for debugging :param module: the module name to check :return: True iff the given module is active for debugging
[ "checks", "whether", "the", "given", "module", "is", "active", "for", "debugging", ":", "param", "module", ":", "the", "module", "name", "to", "check", ":", "return", ":", "True", "iff", "the", "given", "module", "is", "active", "for", "debugging" ]
def isactivated(module): """ checks whether the given module is active for debugging :param module: the module name to check :return: True iff the given module is active for debugging """ module = str(module) if module not in AVAILABLE_DEBUG_MODULES: print_error("debug module '{}' i...
[ "def", "isactivated", "(", "module", ")", ":", "module", "=", "str", "(", "module", ")", "if", "module", "not", "in", "AVAILABLE_DEBUG_MODULES", ":", "print_error", "(", "\"debug module '{}' is unknown, cannot check it\"", ".", "format", "(", "module", ")", ")", ...
https://github.com/SySS-Research/outis/blob/ef9b720fa12e8e0748a826354f138eabc33747fe/syhelpers/log.py#L44-L57
tahoe-lafs/tahoe-lafs
766a53b5208c03c45ca0a98e97eee76870276aa1
src/allmydata/interfaces.py
python
IAddressFamily.get_listener
()
Return a string endpoint description or an ``IStreamServerEndpoint``. This would be named ``get_server_endpoint`` if not for historical reasons.
Return a string endpoint description or an ``IStreamServerEndpoint``.
[ "Return", "a", "string", "endpoint", "description", "or", "an", "IStreamServerEndpoint", "." ]
def get_listener(): """ Return a string endpoint description or an ``IStreamServerEndpoint``. This would be named ``get_server_endpoint`` if not for historical reasons. """
[ "def", "get_listener", "(", ")", ":" ]
https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/interfaces.py#L3094-L3100
tribe29/checkmk
6260f2512e159e311f426e16b84b19d0b8e9ad0c
cmk/ec/rule_packs.py
python
override_rule_pack_proxy
(rule_pack_nr: str, rule_packs: Dict[str, Any])
Replaces a MkpRulePackProxy by a working copy of the underlying rule pack.
Replaces a MkpRulePackProxy by a working copy of the underlying rule pack.
[ "Replaces", "a", "MkpRulePackProxy", "by", "a", "working", "copy", "of", "the", "underlying", "rule", "pack", "." ]
def override_rule_pack_proxy(rule_pack_nr: str, rule_packs: Dict[str, Any]) -> None: """ Replaces a MkpRulePackProxy by a working copy of the underlying rule pack. """ proxy = rule_packs[rule_pack_nr] if not isinstance(proxy, MkpRulePackProxy): raise TypeError( "Expected an insta...
[ "def", "override_rule_pack_proxy", "(", "rule_pack_nr", ":", "str", ",", "rule_packs", ":", "Dict", "[", "str", ",", "Any", "]", ")", "->", "None", ":", "proxy", "=", "rule_packs", "[", "rule_pack_nr", "]", "if", "not", "isinstance", "(", "proxy", ",", "...
https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/ec/rule_packs.py#L352-L362
crits/crits_services
c7abf91f1865d913cffad4b966599da204f8ae43
ratdecoder_service/decoders/SmallNet.py
python
ver_52
(data)
return config_dict
[]
def ver_52(data): config_dict = {} config_parts = data.split('!!<3SAFIA<3!!') config_dict['Domain'] = config_parts[1] config_dict['Port'] = config_parts[2] config_dict['Disbale Registry'] = config_parts[3] config_dict['Disbale TaskManager'] = config_parts[4] config_dict['Install Server'] = c...
[ "def", "ver_52", "(", "data", ")", ":", "config_dict", "=", "{", "}", "config_parts", "=", "data", ".", "split", "(", "'!!<3SAFIA<3!!'", ")", "config_dict", "[", "'Domain'", "]", "=", "config_parts", "[", "1", "]", "config_dict", "[", "'Port'", "]", "=",...
https://github.com/crits/crits_services/blob/c7abf91f1865d913cffad4b966599da204f8ae43/ratdecoder_service/decoders/SmallNet.py#L1-L55
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/sandpiles/sandpile.py
python
Sandpile.max_stable_div
(self)
return deepcopy(self._max_stable_div)
r""" The maximal stable divisor. OUTPUT: SandpileDivisor (the maximal stable divisor) EXAMPLES:: sage: s = sandpiles.Diamond() sage: s.max_stable_div() {0: 1, 1: 2, 2: 2, 3: 1} sage: s.out_degree() {0: 2, 1: 3, 2: 3, 3: 2}
r""" The maximal stable divisor.
[ "r", "The", "maximal", "stable", "divisor", "." ]
def max_stable_div(self): r""" The maximal stable divisor. OUTPUT: SandpileDivisor (the maximal stable divisor) EXAMPLES:: sage: s = sandpiles.Diamond() sage: s.max_stable_div() {0: 1, 1: 2, 2: 2, 3: 1} sage: s.out_degree() ...
[ "def", "max_stable_div", "(", "self", ")", ":", "return", "deepcopy", "(", "self", ".", "_max_stable_div", ")" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sandpiles/sandpile.py#L974-L990
QCoDeS/Qcodes
3cda2cef44812e2aa4672781f2423bf5f816f9f9
qcodes/actions.py
python
Task.snapshot
(self, update=False)
return {'type': 'Task', 'func': repr(self.func)}
Snapshots task Args: update (bool): TODO not in use Returns: dict: snapshot
Snapshots task Args: update (bool): TODO not in use
[ "Snapshots", "task", "Args", ":", "update", "(", "bool", ")", ":", "TODO", "not", "in", "use" ]
def snapshot(self, update=False): """ Snapshots task Args: update (bool): TODO not in use Returns: dict: snapshot """ return {'type': 'Task', 'func': repr(self.func)}
[ "def", "snapshot", "(", "self", ",", "update", "=", "False", ")", ":", "return", "{", "'type'", ":", "'Task'", ",", "'func'", ":", "repr", "(", "self", ".", "func", ")", "}" ]
https://github.com/QCoDeS/Qcodes/blob/3cda2cef44812e2aa4672781f2423bf5f816f9f9/qcodes/actions.py#L57-L66
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/ocr/v20181119/models.py
python
GeneralFastOCRResponse.__init__
(self)
r""" :param TextDetections: 检测到的文本信息,具体内容请点击左侧链接。 :type TextDetections: list of TextDetection :param Language: 检测到的语言,目前支持的语种范围为:简体中文、繁体中文、英文、日文、韩文。未来将陆续新增对更多语种的支持。 返回结果含义为:zh - 中英混合,jap - 日文,kor - 韩文。 :type Language: str :param Angel: 图片旋转角度(角度制),文本的水平方向为0°;顺时针为正,逆时针为负 :...
r""" :param TextDetections: 检测到的文本信息,具体内容请点击左侧链接。 :type TextDetections: list of TextDetection :param Language: 检测到的语言,目前支持的语种范围为:简体中文、繁体中文、英文、日文、韩文。未来将陆续新增对更多语种的支持。 返回结果含义为:zh - 中英混合,jap - 日文,kor - 韩文。 :type Language: str :param Angel: 图片旋转角度(角度制),文本的水平方向为0°;顺时针为正,逆时针为负 :...
[ "r", ":", "param", "TextDetections", ":", "检测到的文本信息,具体内容请点击左侧链接。", ":", "type", "TextDetections", ":", "list", "of", "TextDetection", ":", "param", "Language", ":", "检测到的语言,目前支持的语种范围为:简体中文、繁体中文、英文、日文、韩文。未来将陆续新增对更多语种的支持。", "返回结果含义为:zh", "-", "中英混合,jap", "-", "日文,kor", "-...
def __init__(self): r""" :param TextDetections: 检测到的文本信息,具体内容请点击左侧链接。 :type TextDetections: list of TextDetection :param Language: 检测到的语言,目前支持的语种范围为:简体中文、繁体中文、英文、日文、韩文。未来将陆续新增对更多语种的支持。 返回结果含义为:zh - 中英混合,jap - 日文,kor - 韩文。 :type Language: str :param Angel: 图片旋转角度(角度制),文本的水...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TextDetections", "=", "None", "self", ".", "Language", "=", "None", "self", ".", "Angel", "=", "None", "self", ".", "PdfPageSize", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/ocr/v20181119/models.py#L2398-L2416
bsolomon1124/pyfinance
c6fd88ba4fb5c9f083ebc3ff60960a1b4df76c55
pyfinance/utils.py
python
random_weights
(size, sumto=1.0)
return w
Generate an array of random weights that sum to `sumto`. The result may be of arbitrary dimensions. `size` is passed to the `size` parameter of `np.random.random`, which acts as a shape parameter in this case. Note that `sumto` is subject to typical Python floating point limitations. This functio...
Generate an array of random weights that sum to `sumto`.
[ "Generate", "an", "array", "of", "random", "weights", "that", "sum", "to", "sumto", "." ]
def random_weights(size, sumto=1.0): """Generate an array of random weights that sum to `sumto`. The result may be of arbitrary dimensions. `size` is passed to the `size` parameter of `np.random.random`, which acts as a shape parameter in this case. Note that `sumto` is subject to typical Python ...
[ "def", "random_weights", "(", "size", ",", "sumto", "=", "1.0", ")", ":", "w", "=", "np", ".", "random", ".", "random", "(", "size", ")", "if", "w", ".", "ndim", "==", "2", ":", "if", "isinstance", "(", "sumto", ",", "(", "np", ".", "ndarray", ...
https://github.com/bsolomon1124/pyfinance/blob/c6fd88ba4fb5c9f083ebc3ff60960a1b4df76c55/pyfinance/utils.py#L678-L710
translate/translate
72816df696b5263abfe80ab59129b299b85ae749
tools/mozilla/mozcronbuild.py
python
check_potpacks
()
Copy new and check available POT-packs.
Copy new and check available POT-packs.
[ "Copy", "new", "and", "check", "available", "POT", "-", "packs", "." ]
def check_potpacks(): """Copy new and check available POT-packs.""" pass
[ "def", "check_potpacks", "(", ")", ":", "pass" ]
https://github.com/translate/translate/blob/72816df696b5263abfe80ab59129b299b85ae749/tools/mozilla/mozcronbuild.py#L48-L50
kabkabm/defensegan
7e3feaebf7b9bbf08b1364e400119ef596cd78fd
tflib/checkpoint.py
python
load_model
(saver,sess,checkpoint_dir=None)
Loads the saved model :param checkpoint_dir: root of all the checkpoints :return:
Loads the saved model :param checkpoint_dir: root of all the checkpoints :return:
[ "Loads", "the", "saved", "model", ":", "param", "checkpoint_dir", ":", "root", "of", "all", "the", "checkpoints", ":", "return", ":" ]
def load_model(saver,sess,checkpoint_dir=None): ''' Loads the saved model :param checkpoint_dir: root of all the checkpoints :return: ''' FLAGS = tf.app.flags.FLAGS def load_from_path(ckpt_path): ckpt_name = os.path.basename(ckpt_path) sav...
[ "def", "load_model", "(", "saver", ",", "sess", ",", "checkpoint_dir", "=", "None", ")", ":", "FLAGS", "=", "tf", ".", "app", ".", "flags", ".", "FLAGS", "def", "load_from_path", "(", "ckpt_path", ")", ":", "ckpt_name", "=", "os", ".", "path", ".", "...
https://github.com/kabkabm/defensegan/blob/7e3feaebf7b9bbf08b1364e400119ef596cd78fd/tflib/checkpoint.py#L17-L45
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/google/net/proto2/python/internal/python_message.py
python
_AddHasExtensionMethod
(cls)
Helper for _AddMessageMethods().
Helper for _AddMessageMethods().
[ "Helper", "for", "_AddMessageMethods", "()", "." ]
def _AddHasExtensionMethod(cls): """Helper for _AddMessageMethods().""" def HasExtension(self, extension_handle): _VerifyExtensionHandle(self, extension_handle) if extension_handle.label == _FieldDescriptor.LABEL_REPEATED: raise KeyError('"%s" is repeated.' % extension_handle.full_name) if extens...
[ "def", "_AddHasExtensionMethod", "(", "cls", ")", ":", "def", "HasExtension", "(", "self", ",", "extension_handle", ")", ":", "_VerifyExtensionHandle", "(", "self", ",", "extension_handle", ")", "if", "extension_handle", ".", "label", "==", "_FieldDescriptor", "."...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/net/proto2/python/internal/python_message.py#L641-L653
brython-dev/brython
9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3
www/src/Lib/tarfile.py
python
TarFile.makefile
(self, tarinfo, targetpath)
Make a file called targetpath.
Make a file called targetpath.
[ "Make", "a", "file", "called", "targetpath", "." ]
def makefile(self, tarinfo, targetpath): """Make a file called targetpath. """ source = self.fileobj source.seek(tarinfo.offset_data) bufsize = self.copybufsize with bltn_open(targetpath, "wb") as target: if tarinfo.sparse is not None: for offs...
[ "def", "makefile", "(", "self", ",", "tarinfo", ",", "targetpath", ")", ":", "source", "=", "self", ".", "fileobj", "source", ".", "seek", "(", "tarinfo", ".", "offset_data", ")", "bufsize", "=", "self", ".", "copybufsize", "with", "bltn_open", "(", "tar...
https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/tarfile.py#L2189-L2203
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/django/db/models/base.py
python
Model.validate_unique
(self, exclude=None)
Checks unique constraints on the model and raises ``ValidationError`` if any failed.
Checks unique constraints on the model and raises ``ValidationError`` if any failed.
[ "Checks", "unique", "constraints", "on", "the", "model", "and", "raises", "ValidationError", "if", "any", "failed", "." ]
def validate_unique(self, exclude=None): """ Checks unique constraints on the model and raises ``ValidationError`` if any failed. """ unique_checks, date_checks = self._get_unique_checks(exclude=exclude) errors = self._perform_unique_checks(unique_checks) date_er...
[ "def", "validate_unique", "(", "self", ",", "exclude", "=", "None", ")", ":", "unique_checks", ",", "date_checks", "=", "self", ".", "_get_unique_checks", "(", "exclude", "=", "exclude", ")", "errors", "=", "self", ".", "_perform_unique_checks", "(", "unique_c...
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/django/db/models/base.py#L724-L738
bleachbit/bleachbit
88fc4452936d02b56a76f07ce2142306bb47262b
bleachbit/FileUtilities.py
python
OpenFiles.file_qualifies
(self, filename)
return not filename.startswith("/dev") and \ not filename.startswith("/proc")
Return boolean whether filename qualifies to enter cache (check \ against blacklist)
Return boolean whether filename qualifies to enter cache (check \ against blacklist)
[ "Return", "boolean", "whether", "filename", "qualifies", "to", "enter", "cache", "(", "check", "\\", "against", "blacklist", ")" ]
def file_qualifies(self, filename): """Return boolean whether filename qualifies to enter cache (check \ against blacklist)""" return not filename.startswith("/dev") and \ not filename.startswith("/proc")
[ "def", "file_qualifies", "(", "self", ",", "filename", ")", ":", "return", "not", "filename", ".", "startswith", "(", "\"/dev\"", ")", "and", "not", "filename", ".", "startswith", "(", "\"/proc\"", ")" ]
https://github.com/bleachbit/bleachbit/blob/88fc4452936d02b56a76f07ce2142306bb47262b/bleachbit/FileUtilities.py#L153-L157
piwheels/piwheels
ff0b306fc7b6754fe8d73f1ddfae884e54ce6c8a
piwheels/monitor/sense/controls.py
python
Control.history
(self)
Yields copies of the control showing its state over successive minutes. Note that this method actually just yields the instance with modified attributes. Hence, caching the instances yielded will not provide the expected result; cache the attributes required instead.
Yields copies of the control showing its state over successive minutes.
[ "Yields", "copies", "of", "the", "control", "showing", "its", "state", "over", "successive", "minutes", "." ]
def history(self): """ Yields copies of the control showing its state over successive minutes. Note that this method actually just yields the instance with modified attributes. Hence, caching the instances yielded will not provide the expected result; cache the attributes requir...
[ "def", "history", "(", "self", ")", ":", "yield", "self" ]
https://github.com/piwheels/piwheels/blob/ff0b306fc7b6754fe8d73f1ddfae884e54ce6c8a/piwheels/monitor/sense/controls.py#L157-L165
fedora-infra/anitya
cc01878ac023790646a76eb4cbef45d639e2372c
anitya/lib/backends/__init__.py
python
BaseBackend.expand_subdirs
(self, url, last_change=None, glob_char="*")
return url
Expand dirs containing ``glob_char`` in the given URL with the latest Example URL: ``https://www.example.com/foo/*/`` The globbing char can be bundled with other characters enclosed within the same slashes in the URL like ``/rel*/``. Code originally from Till Maas as part of `c...
Expand dirs containing ``glob_char`` in the given URL with the latest Example URL: ``https://www.example.com/foo/*/``
[ "Expand", "dirs", "containing", "glob_char", "in", "the", "given", "URL", "with", "the", "latest", "Example", "URL", ":", "https", ":", "//", "www", ".", "example", ".", "com", "/", "foo", "/", "*", "/" ]
def expand_subdirs(self, url, last_change=None, glob_char="*"): """Expand dirs containing ``glob_char`` in the given URL with the latest Example URL: ``https://www.example.com/foo/*/`` The globbing char can be bundled with other characters enclosed within the same slashes in the URL lik...
[ "def", "expand_subdirs", "(", "self", ",", "url", ",", "last_change", "=", "None", ",", "glob_char", "=", "\"*\"", ")", ":", "glob_pattern", "=", "\"/([^/]*%s[^/]*)/\"", "%", "re", ".", "escape", "(", "glob_char", ")", "glob_match", "=", "re", ".", "search...
https://github.com/fedora-infra/anitya/blob/cc01878ac023790646a76eb4cbef45d639e2372c/anitya/lib/backends/__init__.py#L92-L141
PowerScript/KatanaFramework
0f6ad90a88de865d58ec26941cb4460501e75496
lib/future/src/future/utils/__init__.py
python
python_2_unicode_compatible
(cls)
return cls
A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3, this decorator is a no-op. To support Python 2 and 3 with a single code base, define a __str__ method returning unicode text and apply this decorator to the class, like this:: >>> from future.utils import pyth...
A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3, this decorator is a no-op.
[ "A", "decorator", "that", "defines", "__unicode__", "and", "__str__", "methods", "under", "Python", "2", ".", "Under", "Python", "3", "this", "decorator", "is", "a", "no", "-", "op", "." ]
def python_2_unicode_compatible(cls): """ A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3, this decorator is a no-op. To support Python 2 and 3 with a single code base, define a __str__ method returning unicode text and apply this decorator to the class, like...
[ "def", "python_2_unicode_compatible", "(", "cls", ")", ":", "if", "not", "PY3", ":", "cls", ".", "__unicode__", "=", "cls", ".", "__str__", "cls", ".", "__str__", "=", "lambda", "self", ":", "self", ".", "__unicode__", "(", ")", ".", "encode", "(", "'u...
https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/future/src/future/utils/__init__.py#L65-L103
ahmetcemturan/SFACT
7576e29ba72b33e5058049b77b7b558875542747
skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/gcode_step.py
python
GcodeStepSkein.addStringToLine
(self, lineStringIO, wordString)
Add a character and integer to line string.
Add a character and integer to line string.
[ "Add", "a", "character", "and", "integer", "to", "line", "string", "." ]
def addStringToLine(self, lineStringIO, wordString): 'Add a character and integer to line string.' if wordString == '': return if self.repository.addSpaceBetweenWords.value: lineStringIO.write(' ') lineStringIO.write(wordString)
[ "def", "addStringToLine", "(", "self", ",", "lineStringIO", ",", "wordString", ")", ":", "if", "wordString", "==", "''", ":", "return", "if", "self", ".", "repository", ".", "addSpaceBetweenWords", ".", "value", ":", "lineStringIO", ".", "write", "(", "' '",...
https://github.com/ahmetcemturan/SFACT/blob/7576e29ba72b33e5058049b77b7b558875542747/skeinforge_application/skeinforge_plugins/craft_plugins/export_plugins/gcode_step.py#L185-L191
markovmodel/PyEMMA
e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3
pyemma/util/annotators.py
python
get_culprit
(omit_top_frames=1)
return filename, lineno
get the filename and line number calling this. Parameters ---------- omit_top_frames: int, default=1 omit n frames from top of stack stack. Purpose is to get the real culprit and not intermediate functions on the stack. Returns ------- (filename: str, fileno: int) filename a...
get the filename and line number calling this.
[ "get", "the", "filename", "and", "line", "number", "calling", "this", "." ]
def get_culprit(omit_top_frames=1): """get the filename and line number calling this. Parameters ---------- omit_top_frames: int, default=1 omit n frames from top of stack stack. Purpose is to get the real culprit and not intermediate functions on the stack. Returns ------- ...
[ "def", "get_culprit", "(", "omit_top_frames", "=", "1", ")", ":", "try", ":", "caller_stack", "=", "stack", "(", ")", "[", "omit_top_frames", ":", "]", "while", "len", "(", "caller_stack", ")", ">", "0", ":", "frame", "=", "caller_stack", ".", "pop", "...
https://github.com/markovmodel/PyEMMA/blob/e9d08d715dde17ceaa96480a9ab55d5e87d3a4b3/pyemma/util/annotators.py#L164-L193
robotlearn/pyrobolearn
9cd7c060723fda7d2779fa255ac998c2c82b8436
pyrobolearn/tools/bridges/mouse_keyboard/bridge_spacemouse_manipulator.py
python
BridgeSpaceMouseManipulator.simulator
(self)
return self._manipulator.simulator
Return the simulator instance.
Return the simulator instance.
[ "Return", "the", "simulator", "instance", "." ]
def simulator(self): """Return the simulator instance.""" return self._manipulator.simulator
[ "def", "simulator", "(", "self", ")", ":", "return", "self", ".", "_manipulator", ".", "simulator" ]
https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/tools/bridges/mouse_keyboard/bridge_spacemouse_manipulator.py#L138-L140
Zulko/easyAI
a5cbd0b600ebbeadc3730df9e7a211d7643cff8b
easyAI/games/Knights-Kivy.py
python
KnightsKivyApp.reset_board
(self, btn)
[]
def reset_board(self, btn): self.game = Knights([Human_Player(), AI_Player(AI)], BOARD_SIZE) self.refresh_board()
[ "def", "reset_board", "(", "self", ",", "btn", ")", ":", "self", ".", "game", "=", "Knights", "(", "[", "Human_Player", "(", ")", ",", "AI_Player", "(", "AI", ")", "]", ",", "BOARD_SIZE", ")", "self", ".", "refresh_board", "(", ")" ]
https://github.com/Zulko/easyAI/blob/a5cbd0b600ebbeadc3730df9e7a211d7643cff8b/easyAI/games/Knights-Kivy.py#L149-L151
aiidateam/aiida-core
c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2
aiida/tools/archive/implementations/sqlite/migrations/legacy_to_new.py
python
_create_directory
(top_level: File, path: PurePosixPath)
return directory
Create a new directory with the given path. :param path: the relative path of the directory. :return: the created directory.
Create a new directory with the given path.
[ "Create", "a", "new", "directory", "with", "the", "given", "path", "." ]
def _create_directory(top_level: File, path: PurePosixPath) -> File: """Create a new directory with the given path. :param path: the relative path of the directory. :return: the created directory. """ directory = top_level for part in path.parts: if part not in directory.objects: ...
[ "def", "_create_directory", "(", "top_level", ":", "File", ",", "path", ":", "PurePosixPath", ")", "->", "File", ":", "directory", "=", "top_level", "for", "part", "in", "path", ".", "parts", ":", "if", "part", "not", "in", "directory", ".", "objects", "...
https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/tools/archive/implementations/sqlite/migrations/legacy_to_new.py#L261-L275
psychopy/psychopy
01b674094f38d0e0bd51c45a6f66f671d7041696
psychopy/visual/rift.py
python
Rift.hmdPresent
(self)
return self._sessionStatus.hmdPresent
`True` if the HMD is present.
`True` if the HMD is present.
[ "True", "if", "the", "HMD", "is", "present", "." ]
def hmdPresent(self): """`True` if the HMD is present. """ return self._sessionStatus.hmdPresent
[ "def", "hmdPresent", "(", "self", ")", ":", "return", "self", ".", "_sessionStatus", ".", "hmdPresent" ]
https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/visual/rift.py#L1214-L1217
ztgrace/changeme
89f59d476a07affece2736b9d74abffe25fd2ce5
changeme/core.py
python
which
(program)
return None
[]
def which(program): import os def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) fpath, fname = os.path.split(program) if fpath: if is_exe(program): return program else: for path in os.environ["PATH"].split(os.pathsep): pat...
[ "def", "which", "(", "program", ")", ":", "import", "os", "def", "is_exe", "(", "fpath", ")", ":", "return", "os", ".", "path", ".", "isfile", "(", "fpath", ")", "and", "os", ".", "access", "(", "fpath", ",", "os", ".", "X_OK", ")", "fpath", ",",...
https://github.com/ztgrace/changeme/blob/89f59d476a07affece2736b9d74abffe25fd2ce5/changeme/core.py#L473-L490
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/filters.py
python
do_list
(value)
return list(value)
Convert the value into a list. If it was a string the returned list will be a list of characters.
Convert the value into a list. If it was a string the returned list will be a list of characters.
[ "Convert", "the", "value", "into", "a", "list", ".", "If", "it", "was", "a", "string", "the", "returned", "list", "will", "be", "a", "list", "of", "characters", "." ]
def do_list(value): """Convert the value into a list. If it was a string the returned list will be a list of characters. """ return list(value)
[ "def", "do_list", "(", "value", ")", ":", "return", "list", "(", "value", ")" ]
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/filters.py#L622-L626
kitplummer/clikan
e81f81e425dc642b6226b246fbd1098aacd9b950
clikan.py
python
add
(task)
Add a task in todo
Add a task in todo
[ "Add", "a", "task", "in", "todo" ]
def add(task): """Add a task in todo""" if len(task) > 40: click.echo('Task must be shorter than 40 chars. Brevity counts.') else: config = read_config_yaml() dd = read_data(config) todos, inprogs, dones = split_items(config, dd) if ('limits' in config and 'todo' in ...
[ "def", "add", "(", "task", ")", ":", "if", "len", "(", "task", ")", ">", "40", ":", "click", ".", "echo", "(", "'Task must be shorter than 40 chars. Brevity counts.'", ")", "else", ":", "config", "=", "read_config_yaml", "(", ")", "dd", "=", "read_data", "...
https://github.com/kitplummer/clikan/blob/e81f81e425dc642b6226b246fbd1098aacd9b950/clikan.py#L106-L128
tensorflow/models
6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3
research/object_detection/inputs.py
python
train_input
(train_config, train_input_config, model_config, model=None, params=None, input_context=None)
return dataset
Returns `features` and `labels` tensor dictionaries for training. Args: train_config: A train_pb2.TrainConfig. train_input_config: An input_reader_pb2.InputReader. model_config: A model_pb2.DetectionModel. model: A pre-constructed Detection Model. If None, one will be created from the config. ...
Returns `features` and `labels` tensor dictionaries for training.
[ "Returns", "features", "and", "labels", "tensor", "dictionaries", "for", "training", "." ]
def train_input(train_config, train_input_config, model_config, model=None, params=None, input_context=None): """Returns `features` and `labels` tensor dictionaries for training. Args: train_config: A train_pb2.TrainConfig. train_input_config: An input_reader_pb2.InputReader. model_conf...
[ "def", "train_input", "(", "train_config", ",", "train_input_config", ",", "model_config", ",", "model", "=", "None", ",", "params", "=", "None", ",", "input_context", "=", "None", ")", ":", "if", "not", "isinstance", "(", "train_config", ",", "train_pb2", "...
https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/object_detection/inputs.py#L769-L908
makerbot/ReplicatorG
d6f2b07785a5a5f1e172fb87cb4303b17c575d5d
skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py
python
getLowerLeftCorner
(nestedRings)
return lowerLeftCorner
Get the lower left corner from the nestedRings.
Get the lower left corner from the nestedRings.
[ "Get", "the", "lower", "left", "corner", "from", "the", "nestedRings", "." ]
def getLowerLeftCorner(nestedRings): 'Get the lower left corner from the nestedRings.' lowerLeftCorner = Vector3() lowestRealPlusImaginary = 987654321.0 for nestedRing in nestedRings: for point in nestedRing.boundary: realPlusImaginary = point.real + point.imag if realPlusImaginary < lowestRealPlusImaginary...
[ "def", "getLowerLeftCorner", "(", "nestedRings", ")", ":", "lowerLeftCorner", "=", "Vector3", "(", ")", "lowestRealPlusImaginary", "=", "987654321.0", "for", "nestedRing", "in", "nestedRings", ":", "for", "point", "in", "nestedRing", ".", "boundary", ":", "realPlu...
https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L436-L446
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/__init__.py
python
file_ns_handler
(importer, path_item, packageName, module)
Compute an ns-package subpath for a filesystem or zipfile importer
Compute an ns-package subpath for a filesystem or zipfile importer
[ "Compute", "an", "ns", "-", "package", "subpath", "for", "a", "filesystem", "or", "zipfile", "importer" ]
def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item) =...
[ "def", "file_ns_handler", "(", "importer", ",", "path_item", ",", "packageName", ",", "module", ")", ":", "subpath", "=", "os", ".", "path", ".", "join", "(", "path_item", ",", "packageName", ".", "split", "(", "'.'", ")", "[", "-", "1", "]", ")", "n...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter4-NaiveBayes/venv/Lib/site-packages/pkg_resources/__init__.py#L2278-L2288
tensorlayer/tensorlayer
cb4eb896dd063e650ef22533ed6fa6056a71cad5
examples/reinforcement_learning/tutorial_TRPO.py
python
GAE_Buffer.finish_path
(self, last_val=0)
Call this at the end of a trajectory, or when one gets cut off by an epoch ending. This looks back in the buffer to where the trajectory started, and uses rewards and value estimates from the whole trajectory to compute advantage estimates with GAE-lambda, as well as compute the rewards-...
Call this at the end of a trajectory, or when one gets cut off by an epoch ending. This looks back in the buffer to where the trajectory started, and uses rewards and value estimates from the whole trajectory to compute advantage estimates with GAE-lambda, as well as compute the rewards-...
[ "Call", "this", "at", "the", "end", "of", "a", "trajectory", "or", "when", "one", "gets", "cut", "off", "by", "an", "epoch", "ending", ".", "This", "looks", "back", "in", "the", "buffer", "to", "where", "the", "trajectory", "started", "and", "uses", "r...
def finish_path(self, last_val=0): """ Call this at the end of a trajectory, or when one gets cut off by an epoch ending. This looks back in the buffer to where the trajectory started, and uses rewards and value estimates from the whole trajectory to compute advantage estimates w...
[ "def", "finish_path", "(", "self", ",", "last_val", "=", "0", ")", ":", "path_slice", "=", "slice", "(", "self", ".", "path_start_idx", ",", "self", ".", "ptr", ")", "rews", "=", "np", ".", "append", "(", "self", ".", "rew_buf", "[", "path_slice", "]...
https://github.com/tensorlayer/tensorlayer/blob/cb4eb896dd063e650ef22533ed6fa6056a71cad5/examples/reinforcement_learning/tutorial_TRPO.py#L113-L138
xyuanmu/XX-Mini
5daf3a3d741566bfd18655ea9eb94f546bd0c70a
lib/hyper/packages/rfc3986/uri.py
python
URIReference.path_is_valid
(self, require=False)
return self._is_valid(self.path, PATH_MATCHER, require)
Determines if the path component is valid. :param str require: Set to ``True`` to require the presence of this component. :returns: ``True`` if the path is valid. ``False`` otherwise. :rtype: bool
Determines if the path component is valid.
[ "Determines", "if", "the", "path", "component", "is", "valid", "." ]
def path_is_valid(self, require=False): """Determines if the path component is valid. :param str require: Set to ``True`` to require the presence of this component. :returns: ``True`` if the path is valid. ``False`` otherwise. :rtype: bool """ return self._is...
[ "def", "path_is_valid", "(", "self", ",", "require", "=", "False", ")", ":", "return", "self", ".", "_is_valid", "(", "self", ".", "path", ",", "PATH_MATCHER", ",", "require", ")" ]
https://github.com/xyuanmu/XX-Mini/blob/5daf3a3d741566bfd18655ea9eb94f546bd0c70a/lib/hyper/packages/rfc3986/uri.py#L222-L230
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/core/parser/base_parser.py
python
BaseEnamlParser.p_old_test2
(self, p)
old_test : old_lambdef
old_test : old_lambdef
[ "old_test", ":", "old_lambdef" ]
def p_old_test2(self, p): ''' old_test : old_lambdef ''' p[0] = p[1]
[ "def", "p_old_test2", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/parser/base_parser.py#L3094-L3096
malwaredllc/byob
3924dd6aea6d0421397cdf35f692933b340bfccf
web-gui/buildyourownbotnet/users/forms.py
python
RegistrationForm.validate_username
(self, username)
[]
def validate_username(self, username): if User.query.filter_by(username=username.data).first(): raise ValidationError("That username is taken. Please choose a different one.")
[ "def", "validate_username", "(", "self", ",", "username", ")", ":", "if", "User", ".", "query", ".", "filter_by", "(", "username", "=", "username", ".", "data", ")", ".", "first", "(", ")", ":", "raise", "ValidationError", "(", "\"That username is taken. Ple...
https://github.com/malwaredllc/byob/blob/3924dd6aea6d0421397cdf35f692933b340bfccf/web-gui/buildyourownbotnet/users/forms.py#L23-L25
RoyalVane/CLAN
c40ab0bb088cfe6a6024350310ec60570abf4238
model/CLAN_G.py
python
ResNet.get_1x_lr_params_NOscale
(self)
This generator returns all the parameters of the net except for the last classification layer. Note that for each batchnorm layer, requires_grad is set to False in deeplab_resnet.py, therefore this function does not return any batchnorm parameter
This generator returns all the parameters of the net except for the last classification layer. Note that for each batchnorm layer, requires_grad is set to False in deeplab_resnet.py, therefore this function does not return any batchnorm parameter
[ "This", "generator", "returns", "all", "the", "parameters", "of", "the", "net", "except", "for", "the", "last", "classification", "layer", ".", "Note", "that", "for", "each", "batchnorm", "layer", "requires_grad", "is", "set", "to", "False", "in", "deeplab_res...
def get_1x_lr_params_NOscale(self): """ This generator returns all the parameters of the net except for the last classification layer. Note that for each batchnorm layer, requires_grad is set to False in deeplab_resnet.py, therefore this function does not return any batchnorm par...
[ "def", "get_1x_lr_params_NOscale", "(", "self", ")", ":", "b", "=", "[", "]", "b", ".", "append", "(", "self", ".", "conv1", ")", "b", ".", "append", "(", "self", ".", "bn1", ")", "b", ".", "append", "(", "self", ".", "layer1", ")", "b", ".", "...
https://github.com/RoyalVane/CLAN/blob/c40ab0bb088cfe6a6024350310ec60570abf4238/model/CLAN_G.py#L179-L201
theotherp/nzbhydra
4b03d7f769384b97dfc60dade4806c0fc987514e
libs/future/backports/datetime.py
python
datetime.dst
(self)
return offset
Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unless you're interested in dis...
Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect.
[ "Return", "0", "if", "DST", "is", "not", "in", "effect", "or", "the", "DST", "offset", "(", "in", "minutes", "eastward", ")", "if", "DST", "is", "in", "effect", "." ]
def dst(self): """Return 0 if DST is not in effect, or the DST offset (in minutes eastward) if DST is in effect. This is purely informational; the DST offset has already been added to the UTC offset returned by utcoffset() if applicable, so there's no need to consult dst() unles...
[ "def", "dst", "(", "self", ")", ":", "if", "self", ".", "_tzinfo", "is", "None", ":", "return", "None", "offset", "=", "self", ".", "_tzinfo", ".", "dst", "(", "self", ")", "_check_utc_offset", "(", "\"dst\"", ",", "offset", ")", "return", "offset" ]
https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/future/backports/datetime.py#L1625-L1638
MDAnalysis/mdanalysis
3488df3cdb0c29ed41c4fb94efe334b541e31b21
package/MDAnalysis/coordinates/LAMMPS.py
python
DATAWriter._write_dimensions
(self, dimensions)
Convert dimensions to triclinic vectors, convert lengths to native units and then write the dimensions section
Convert dimensions to triclinic vectors, convert lengths to native units and then write the dimensions section
[ "Convert", "dimensions", "to", "triclinic", "vectors", "convert", "lengths", "to", "native", "units", "and", "then", "write", "the", "dimensions", "section" ]
def _write_dimensions(self, dimensions): """Convert dimensions to triclinic vectors, convert lengths to native units and then write the dimensions section """ if self.convert_units: triv = self.convert_pos_to_native(mdamath.triclinic_vectors( ...
[ "def", "_write_dimensions", "(", "self", ",", "dimensions", ")", ":", "if", "self", ".", "convert_units", ":", "triv", "=", "self", ".", "convert_pos_to_native", "(", "mdamath", ".", "triclinic_vectors", "(", "dimensions", ")", ",", "inplace", "=", "False", ...
https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/coordinates/LAMMPS.py#L348-L362
jymcheong/AutoTTP
617128fe71537de4579176d7170a3e8f1680b6a6
pymetasploit/msfrpc.py
python
MsfModule.required
(self)
return self._roptions
The required module options.
The required module options.
[ "The", "required", "module", "options", "." ]
def required(self): """ The required module options. """ return self._roptions
[ "def", "required", "(", "self", ")", ":", "return", "self", ".", "_roptions" ]
https://github.com/jymcheong/AutoTTP/blob/617128fe71537de4579176d7170a3e8f1680b6a6/pymetasploit/msfrpc.py#L1379-L1383
lightforever/mlcomp
c78fdb77ec9c4ec8ff11beea50b90cab20903ad9
mlcomp/db/providers/dag.py
python
DagProvider.count
(self)
return self.query(Dag).count()
[]
def count(self): return self.query(Dag).count()
[ "def", "count", "(", "self", ")", ":", "return", "self", ".", "query", "(", "Dag", ")", ".", "count", "(", ")" ]
https://github.com/lightforever/mlcomp/blob/c78fdb77ec9c4ec8ff11beea50b90cab20903ad9/mlcomp/db/providers/dag.py#L233-L234
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/data_catalog/data_catalog_client.py
python
DataCatalogClient.import_glossary
(self, catalog_id, glossary_key, import_glossary_details, **kwargs)
Import the glossary and the terms from csv or json files and return the imported glossary resource. :param str catalog_id: (required) Unique catalog identifier. :param str glossary_key: (required) Unique glossary key. :param oci.data_catalog.models.ImportGlossaryDetai...
Import the glossary and the terms from csv or json files and return the imported glossary resource.
[ "Import", "the", "glossary", "and", "the", "terms", "from", "csv", "or", "json", "files", "and", "return", "the", "imported", "glossary", "resource", "." ]
def import_glossary(self, catalog_id, glossary_key, import_glossary_details, **kwargs): """ Import the glossary and the terms from csv or json files and return the imported glossary resource. :param str catalog_id: (required) Unique catalog identifier. :param str glossary_...
[ "def", "import_glossary", "(", "self", ",", "catalog_id", ",", "glossary_key", ",", "import_glossary_details", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/catalogs/{catalogId}/glossaries/{glossaryKey}/actions/import\"", "method", "=", "\"POST\"", "# Don't...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/data_catalog/data_catalog_client.py#L7821-L7926
mitmproxy/mitmproxy
1abb8f69217910c8623bd1339da2502aed98ff0d
mitmproxy/addons/tlsconfig.py
python
TlsConfig.get_cert
(self, conn_context: context.Context)
return self.certstore.get_cert(altnames[0], altnames, organization)
This function determines the Common Name (CN), Subject Alternative Names (SANs) and Organization Name our certificate should have and then fetches a matching cert from the certstore.
This function determines the Common Name (CN), Subject Alternative Names (SANs) and Organization Name our certificate should have and then fetches a matching cert from the certstore.
[ "This", "function", "determines", "the", "Common", "Name", "(", "CN", ")", "Subject", "Alternative", "Names", "(", "SANs", ")", "and", "Organization", "Name", "our", "certificate", "should", "have", "and", "then", "fetches", "a", "matching", "cert", "from", ...
def get_cert(self, conn_context: context.Context) -> certs.CertStoreEntry: """ This function determines the Common Name (CN), Subject Alternative Names (SANs) and Organization Name our certificate should have and then fetches a matching cert from the certstore. """ altnames: List...
[ "def", "get_cert", "(", "self", ",", "conn_context", ":", "context", ".", "Context", ")", "->", "certs", ".", "CertStoreEntry", ":", "altnames", ":", "List", "[", "str", "]", "=", "[", "]", "organization", ":", "Optional", "[", "str", "]", "=", "None",...
https://github.com/mitmproxy/mitmproxy/blob/1abb8f69217910c8623bd1339da2502aed98ff0d/mitmproxy/addons/tlsconfig.py#L282-L315
django-cms/django-filer
c71e4d3de80c08d47f11e879594760aa9ed60a4d
filer/utils/filer_easy_thumbnails.py
python
ActionThumbnailerMixin.get_thumbnail_name
(self, thumbnail_options, transparent=False)
return os.path.join(basedir, path, subdir, filename)
A version of ``Thumbnailer.get_thumbnail_name`` that returns the original filename to resize.
A version of ``Thumbnailer.get_thumbnail_name`` that returns the original filename to resize.
[ "A", "version", "of", "Thumbnailer", ".", "get_thumbnail_name", "that", "returns", "the", "original", "filename", "to", "resize", "." ]
def get_thumbnail_name(self, thumbnail_options, transparent=False): """ A version of ``Thumbnailer.get_thumbnail_name`` that returns the original filename to resize. """ path, filename = os.path.split(self.name) basedir = self.thumbnail_basedir subdir = self.thum...
[ "def", "get_thumbnail_name", "(", "self", ",", "thumbnail_options", ",", "transparent", "=", "False", ")", ":", "path", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "self", ".", "name", ")", "basedir", "=", "self", ".", "thumbnail_basedir", ...
https://github.com/django-cms/django-filer/blob/c71e4d3de80c08d47f11e879594760aa9ed60a4d/filer/utils/filer_easy_thumbnails.py#L75-L85
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/number_field/number_field.py
python
NumberField_cyclotomic.different
(self)
Return the different ideal of the cyclotomic field self. EXAMPLES:: sage: C20 = CyclotomicField(20) sage: C20.different() Fractional ideal (10, 2*zeta20^6 - 4*zeta20^4 - 4*zeta20^2 + 2) sage: C18 = CyclotomicField(18) sage: D = C18.different().norm()...
Return the different ideal of the cyclotomic field self.
[ "Return", "the", "different", "ideal", "of", "the", "cyclotomic", "field", "self", "." ]
def different(self): """ Return the different ideal of the cyclotomic field self. EXAMPLES:: sage: C20 = CyclotomicField(20) sage: C20.different() Fractional ideal (10, 2*zeta20^6 - 4*zeta20^4 - 4*zeta20^2 + 2) sage: C18 = CyclotomicField(18) ...
[ "def", "different", "(", "self", ")", ":", "try", ":", "return", "self", ".", "__different", "except", "AttributeError", ":", "z", "=", "self", ".", "gen", "(", ")", "n", "=", "self", ".", "_n", "(", ")", "D", "=", "self", ".", "ideal", "(", "1",...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/number_field.py#L11428-L11457
fluentpython/example-code-2e
80f7f84274a47579e59c29a4657691525152c9d5
21-async/mojifinder/bottle.py
python
Router.build
(self, _name, *anons, **query)
Build an URL by filling the wildcards in a rule.
Build an URL by filling the wildcards in a rule.
[ "Build", "an", "URL", "by", "filling", "the", "wildcards", "in", "a", "rule", "." ]
def build(self, _name, *anons, **query): ''' Build an URL by filling the wildcards in a rule. ''' builder = self.builder.get(_name) if not builder: raise RouteBuildError("No route with that name.", _name) try: for i, value in enumerate(anons): query['anon%d'%i] = value ...
[ "def", "build", "(", "self", ",", "_name", ",", "*", "anons", ",", "*", "*", "query", ")", ":", "builder", "=", "self", ".", "builder", ".", "get", "(", "_name", ")", "if", "not", "builder", ":", "raise", "RouteBuildError", "(", "\"No route with that n...
https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/21-async/mojifinder/bottle.py#L406-L415
tianzhi0549/FCOS
0eb8ee0b7114a3ca42ad96cd89e0ac63a205461e
fcos_core/modeling/rpn/fcos/fcos.py
python
FCOSModule.forward
(self, images, features, targets=None)
Arguments: images (ImageList): images for which we want to compute the predictions features (list[Tensor]): features computed from the images that are used for computing the predictions. Each tensor in the list correspond to different feature levels ta...
Arguments: images (ImageList): images for which we want to compute the predictions features (list[Tensor]): features computed from the images that are used for computing the predictions. Each tensor in the list correspond to different feature levels ta...
[ "Arguments", ":", "images", "(", "ImageList", ")", ":", "images", "for", "which", "we", "want", "to", "compute", "the", "predictions", "features", "(", "list", "[", "Tensor", "]", ")", ":", "features", "computed", "from", "the", "images", "that", "are", ...
def forward(self, images, features, targets=None): """ Arguments: images (ImageList): images for which we want to compute the predictions features (list[Tensor]): features computed from the images that are used for computing the predictions. Each tensor in the lis...
[ "def", "forward", "(", "self", ",", "images", ",", "features", ",", "targets", "=", "None", ")", ":", "box_cls", ",", "box_regression", ",", "centerness", "=", "self", ".", "head", "(", "features", ")", "locations", "=", "self", ".", "compute_locations", ...
https://github.com/tianzhi0549/FCOS/blob/0eb8ee0b7114a3ca42ad96cd89e0ac63a205461e/fcos_core/modeling/rpn/fcos/fcos.py#L137-L165
mars-project/mars
6afd7ed86db77f29cc9470485698ef192ecc6d33
mars/learn/ensemble/_bagging.py
python
BaggingClassifier.predict_proba
(self, X, session=None, run_kwargs=None)
return execute(probas, session=session, **(run_kwargs or dict()))
Predict class probabilities for X. The predicted class probabilities of an input sample is computed as the mean predicted class probabilities of the base estimators in the ensemble. If base estimators do not implement a ``predict_proba`` method, then it resorts to voting and the predict...
Predict class probabilities for X.
[ "Predict", "class", "probabilities", "for", "X", "." ]
def predict_proba(self, X, session=None, run_kwargs=None): """ Predict class probabilities for X. The predicted class probabilities of an input sample is computed as the mean predicted class probabilities of the base estimators in the ensemble. If base estimators do not implemen...
[ "def", "predict_proba", "(", "self", ",", "X", ",", "session", "=", "None", ",", "run_kwargs", "=", "None", ")", ":", "probas", "=", "self", ".", "_predict_proba", "(", "X", ")", "return", "execute", "(", "probas", ",", "session", "=", "session", ",", ...
https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/learn/ensemble/_bagging.py#L1495-L1519
NervanaSystems/neon
8c3fb8a93b4a89303467b25817c60536542d08bd
neon/backends/backend.py
python
Tensor.__eq__
(self, other)
return OpTreeNode.build("eq", self, other)
[]
def __eq__(self, other): return OpTreeNode.build("eq", self, other)
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "return", "OpTreeNode", ".", "build", "(", "\"eq\"", ",", "self", ",", "other", ")" ]
https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/backends/backend.py#L410-L411
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/optimize/nonlin.py
python
LowRankMatrix.svd_reduce
(self, max_rank, to_retain=None)
Reduce the rank of the matrix by retaining some SVD components. This corresponds to the \"Broyden Rank Reduction Inverse\" algorithm described in [1]_. Note that the SVD decomposition can be done by solving only a problem whose size is the effective rank of this matrix, which i...
Reduce the rank of the matrix by retaining some SVD components.
[ "Reduce", "the", "rank", "of", "the", "matrix", "by", "retaining", "some", "SVD", "components", "." ]
def svd_reduce(self, max_rank, to_retain=None): """ Reduce the rank of the matrix by retaining some SVD components. This corresponds to the \"Broyden Rank Reduction Inverse\" algorithm described in [1]_. Note that the SVD decomposition can be done by solving only a prob...
[ "def", "svd_reduce", "(", "self", ",", "max_rank", ",", "to_retain", "=", "None", ")", ":", "if", "self", ".", "collapsed", "is", "not", "None", ":", "return", "p", "=", "max_rank", "if", "to_retain", "is", "not", "None", ":", "q", "=", "to_retain", ...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/optimize/nonlin.py#L820-L883
shakedzy/dython
7cf1581f3ca025add53150ebcba817910953fdcc
dython/sampling.py
python
weighted_sampling
(numbers, k=1, with_replacement=False)
return _w_sampling(numbers, k, with_replacement, force_to_list=False)
Return k numbers from a weighted-sampling over the supplied numbers Parameters: ----------- numbers : List or np.ndarray numbers to sample k : int, default = 1 How many numbers to sample. Choosing `k=None` will yield a single number with_replacement : Boolean, default = Fals...
Return k numbers from a weighted-sampling over the supplied numbers
[ "Return", "k", "numbers", "from", "a", "weighted", "-", "sampling", "over", "the", "supplied", "numbers" ]
def weighted_sampling(numbers, k=1, with_replacement=False): """ Return k numbers from a weighted-sampling over the supplied numbers Parameters: ----------- numbers : List or np.ndarray numbers to sample k : int, default = 1 How many numbers to sample. Choosing `k=None` will yie...
[ "def", "weighted_sampling", "(", "numbers", ",", "k", "=", "1", ",", "with_replacement", "=", "False", ")", ":", "return", "_w_sampling", "(", "numbers", ",", "k", ",", "with_replacement", ",", "force_to_list", "=", "False", ")" ]
https://github.com/shakedzy/dython/blob/7cf1581f3ca025add53150ebcba817910953fdcc/dython/sampling.py#L16-L34
Pagure/pagure
512f23f5cd1f965276969747792edeb1215cba68
pagure/api/project.py
python
api_project_create_api_token
(repo, namespace=None, username=None)
return jsonout
Create API project Token ------------------------ Create a project token API for the caller user This is restricted to project admins. :: POST /api/0/<repo>/token/new POST /api/0/<namespace>/<repo>/token/new :: POST /api/0/fork/<username>/<repo>/token/new POST /a...
Create API project Token ------------------------ Create a project token API for the caller user
[ "Create", "API", "project", "Token", "------------------------", "Create", "a", "project", "token", "API", "for", "the", "caller", "user" ]
def api_project_create_api_token(repo, namespace=None, username=None): """ Create API project Token ------------------------ Create a project token API for the caller user This is restricted to project admins. :: POST /api/0/<repo>/token/new POST /api/0/<namespace>/<repo>/toke...
[ "def", "api_project_create_api_token", "(", "repo", ",", "namespace", "=", "None", ",", "username", "=", "None", ")", ":", "output", "=", "{", "}", "project", "=", "_get_repo", "(", "repo", ",", "username", ",", "namespace", ")", "_check_token", "(", "proj...
https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/api/project.py#L3130-L3213
tracim/tracim
a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21
backend/tracim_backend/views/core_api/account_controller.py
python
AccountController.bind
(self, configurator: Configurator)
Create all routes and views using pyramid configurator for this controller
Create all routes and views using pyramid configurator for this controller
[ "Create", "all", "routes", "and", "views", "using", "pyramid", "configurator", "for", "this", "controller" ]
def bind(self, configurator: Configurator) -> None: """ Create all routes and views using pyramid configurator for this controller """ # account workspace configurator.add_route( "account_routes_get", "/users/me{path_suffix:.*}", request_method="GET" ...
[ "def", "bind", "(", "self", ",", "configurator", ":", "Configurator", ")", "->", "None", ":", "# account workspace", "configurator", ".", "add_route", "(", "\"account_routes_get\"", ",", "\"/users/me{path_suffix:.*}\"", ",", "request_method", "=", "\"GET\"", ")", "c...
https://github.com/tracim/tracim/blob/a0e9746fde5a4c45b4e0f0bfa2caf9522b8c4e21/backend/tracim_backend/views/core_api/account_controller.py#L51-L66
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/geometric.py
python
PerspectiveTransform._order_points
(cls, pts)
return pts_ordered
[]
def _order_points(cls, pts): # initialzie a list of coordinates that will be ordered # such that the first entry in the list is the top-left, # the second entry is the top-right, the third is the # bottom-right, and the fourth is the bottom-left pts_ordered = np.zeros((4, 2), dty...
[ "def", "_order_points", "(", "cls", ",", "pts", ")", ":", "# initialzie a list of coordinates that will be ordered", "# such that the first entry in the list is the top-left,", "# the second entry is the top-right, the third is the", "# bottom-right, and the fourth is the bottom-left", "pts_...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/geometric.py#L4064-L4085
deepgram/kur
fd0c120e50815c1e5be64e5dde964dcd47234556
kur/utils/cuda.py
python
locked
(lock)
return wrapper
Wrap function in a thread-safe lock. This is similar to Java's `synchronized(this)`.
Wrap function in a thread-safe lock. This is similar to Java's `synchronized(this)`.
[ "Wrap", "function", "in", "a", "thread", "-", "safe", "lock", ".", "This", "is", "similar", "to", "Java", "s", "synchronized", "(", "this", ")", "." ]
def locked(lock): """ Wrap function in a thread-safe lock. This is similar to Java's `synchronized(this)`. """ ########################################################################### def wrapper(func): """ Closure for the actual decorator. """ ##########################################################...
[ "def", "locked", "(", "lock", ")", ":", "###########################################################################", "def", "wrapper", "(", "func", ")", ":", "\"\"\" Closure for the actual decorator.\n\t\t\"\"\"", "#######################################################################...
https://github.com/deepgram/kur/blob/fd0c120e50815c1e5be64e5dde964dcd47234556/kur/utils/cuda.py#L25-L44
makehumancommunity/makehuman
8006cf2cc851624619485658bb933a4244bbfd7c
makehuman/core/managed_file.py
python
File.extension
(self)
return os.path.splitext(self.path)[1] if self.path else None
Get the extension of the associated file.
Get the extension of the associated file.
[ "Get", "the", "extension", "of", "the", "associated", "file", "." ]
def extension(self): """Get the extension of the associated file.""" return os.path.splitext(self.path)[1] if self.path else None
[ "def", "extension", "(", "self", ")", ":", "return", "os", ".", "path", ".", "splitext", "(", "self", ".", "path", ")", "[", "1", "]", "if", "self", ".", "path", "else", "None" ]
https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/core/managed_file.py#L225-L227
mme/vergeml
3dc30ba4e0f3d038743b6d468860cbcf3681acc6
vergeml/datasets/mnist.py
python
download
(env)
The MNIST database of handwritten digits. The MNIST database of handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. It is a good database for people who...
The MNIST database of handwritten digits.
[ "The", "MNIST", "database", "of", "handwritten", "digits", "." ]
def download(env): """The MNIST database of handwritten digits. The MNIST database of handwritten digits has a training set of 60,000 examples, and a test set of 10,000 examples. It is a subset of a larger set available from NIST. The digits have been size-normalized and centered in a fixed-size image. It is a go...
[ "def", "download", "(", "env", ")", ":", "urls", "=", "[", "\"http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz\"", ",", "\"http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz\"", ",", "\"http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz\"", ",", "\"http://ya...
https://github.com/mme/vergeml/blob/3dc30ba4e0f3d038743b6d468860cbcf3681acc6/vergeml/datasets/mnist.py#L9-L44
yinhm/datafeed
62193278212c2441d8e49b45d71b8d9d79aab31c
datafeed/providers/dzh.py
python
DzhDay.read_block
(self, block, timestamps, ohlcs)
return True
read ohlc data rows for a symbol data length ----------- 8KB each symbol, 256 * 32bytes ohlc记录格式 ----------- 41000 - 41003 80 47 B2 2B 日期 int 41004 - 41007 B9 1E 25 41 开盘价 float 41008 - 4100B CD CC 4C 41 最高价 ...
read ohlc data rows for a symbol
[ "read", "ohlc", "data", "rows", "for", "a", "symbol" ]
def read_block(self, block, timestamps, ohlcs): """read ohlc data rows for a symbol data length ----------- 8KB each symbol, 256 * 32bytes ohlc记录格式 ----------- 41000 - 41003 80 47 B2 2B 日期 int 41004 - 41007 B9 1E 25 41 开盘价 ...
[ "def", "read_block", "(", "self", ",", "block", ",", "timestamps", ",", "ohlcs", ")", ":", "try", ":", "self", ".", "f", ".", "seek", "(", "self", ".", "_BLOCK_START", "+", "self", ".", "_BLOCK_SIZE", "*", "block", ",", "0", ")", "# reseek to block hea...
https://github.com/yinhm/datafeed/blob/62193278212c2441d8e49b45d71b8d9d79aab31c/datafeed/providers/dzh.py#L173-L220
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
modules/s3db/cms.py
python
cms_documentation
(r, default_page, default_url)
return {"bypass": True, "output": {"title": row.title, "contents": S3XMLContents(row.body), }, }
Render an online documentation page, to be called from prep Args: r: the S3Request default_page: the default page name default_url: the default URL if no contents found
Render an online documentation page, to be called from prep
[ "Render", "an", "online", "documentation", "page", "to", "be", "called", "from", "prep" ]
def cms_documentation(r, default_page, default_url): """ Render an online documentation page, to be called from prep Args: r: the S3Request default_page: the default page name default_url: the default URL if no contents found """ row = r.record if no...
[ "def", "cms_documentation", "(", "r", ",", "default_page", ",", "default_url", ")", ":", "row", "=", "r", ".", "record", "if", "not", "row", ":", "# Find the CMS page", "name", "=", "r", ".", "get_vars", ".", "get", "(", "\"name\"", ",", "default_page", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/cms.py#L1455-L1494
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/api/events_v1_api.py
python
EventsV1Api.list_event_for_all_namespaces
(self, **kwargs)
return self.list_event_for_all_namespaces_with_http_info(**kwargs)
list_event_for_all_namespaces # noqa: E501 list or watch objects of kind Event # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_event_for_all_namespaces(async_req=True) ...
list_event_for_all_namespaces # noqa: E501
[ "list_event_for_all_namespaces", "#", "noqa", ":", "E501" ]
def list_event_for_all_namespaces(self, **kwargs): # noqa: E501 """list_event_for_all_namespaces # noqa: E501 list or watch objects of kind Event # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True ...
[ "def", "list_event_for_all_namespaces", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "return", "self", ".", "list_event_for_all_namespaces_with_http_info", "(", "*", "*", "kwargs", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/api/events_v1_api.py#L614-L646
CouchPotato/CouchPotatoV1
135b3331d1b88ef645e29b76f2d4cc4a732c9232
library/hachoir_core/memory.py
python
clearCaches
()
Try to clear all caches: call gc.collect() (Python garbage collector).
Try to clear all caches: call gc.collect() (Python garbage collector).
[ "Try", "to", "clear", "all", "caches", ":", "call", "gc", ".", "collect", "()", "(", "Python", "garbage", "collector", ")", "." ]
def clearCaches(): """ Try to clear all caches: call gc.collect() (Python garbage collector). """ gc.collect()
[ "def", "clearCaches", "(", ")", ":", "gc", ".", "collect", "(", ")" ]
https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/hachoir_core/memory.py#L36-L40
numba/numba
bf480b9e0da858a65508c2b17759a72ee6a44c51
numba/core/types/containers.py
python
StructRef.get_data_type
(self)
return StructRefPayload( typename=self.__class__.__name__, fields=self._fields, )
Get the payload type for the actual underlying structure referred to by this struct reference. See also: `ClassInstanceType.get_data_type`
Get the payload type for the actual underlying structure referred to by this struct reference.
[ "Get", "the", "payload", "type", "for", "the", "actual", "underlying", "structure", "referred", "to", "by", "this", "struct", "reference", "." ]
def get_data_type(self): """Get the payload type for the actual underlying structure referred to by this struct reference. See also: `ClassInstanceType.get_data_type` """ return StructRefPayload( typename=self.__class__.__name__, fields=self._fields, )
[ "def", "get_data_type", "(", "self", ")", ":", "return", "StructRefPayload", "(", "typename", "=", "self", ".", "__class__", ".", "__name__", ",", "fields", "=", "self", ".", "_fields", ",", ")" ]
https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/core/types/containers.py#L934-L942
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py
python
TaskScheduler.available_engines
(self)
return available
return a list of available engine indices based on HWM
return a list of available engine indices based on HWM
[ "return", "a", "list", "of", "available", "engine", "indices", "based", "on", "HWM" ]
def available_engines(self): """return a list of available engine indices based on HWM""" if not self.hwm: return list(range(len(self.targets))) available = [] for idx in range(len(self.targets)): if self.loads[idx] < self.hwm: available.append(idx...
[ "def", "available_engines", "(", "self", ")", ":", "if", "not", "self", ".", "hwm", ":", "return", "list", "(", "range", "(", "len", "(", "self", ".", "targets", ")", ")", ")", "available", "=", "[", "]", "for", "idx", "in", "range", "(", "len", ...
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/parallel/controller/scheduler.py#L514-L522
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/FlashpointFeed/Integrations/FlashpointFeed/FlashpointFeed.py
python
Client.create_indicators_from_response
(self, response: Any, last_fetch: str, params: dict, is_get: bool)
return indicators
Function to create indicators from the response :param response: response received from the API. :param last_fetch: Last fetched time stamp :param params: dictionary of parameters :param is_get: Whether this request is from flashpoint-get-indicators command or not :return: List...
Function to create indicators from the response
[ "Function", "to", "create", "indicators", "from", "the", "response" ]
def create_indicators_from_response(self, response: Any, last_fetch: str, params: dict, is_get: bool) -> List: """ Function to create indicators from the response :param response: response received from the API. :param last_fetch: Last fetched time stamp :param params: dictionar...
[ "def", "create_indicators_from_response", "(", "self", ",", "response", ":", "Any", ",", "last_fetch", ":", "str", ",", "params", ":", "dict", ",", "is_get", ":", "bool", ")", "->", "List", ":", "indicators", "=", "[", "]", "fetch_time", "=", "last_fetch",...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/FlashpointFeed/Integrations/FlashpointFeed/FlashpointFeed.py#L175-L228
redhat-cop/openshift-toolkit
16bf5b054fd5bdfb5018c1f4e06b80470fde716f
custom-autoscaler/scale.py
python
scale_up
(app_name, pod_count)
[]
def scale_up(app_name, pod_count): print Popen(["oc", "scale", "--replicas={}".format(pod_count+1), "dc/{}".format(app_name)], stdout=PIPE).stdout.read()
[ "def", "scale_up", "(", "app_name", ",", "pod_count", ")", ":", "print", "Popen", "(", "[", "\"oc\"", ",", "\"scale\"", ",", "\"--replicas={}\"", ".", "format", "(", "pod_count", "+", "1", ")", ",", "\"dc/{}\"", ".", "format", "(", "app_name", ")", "]", ...
https://github.com/redhat-cop/openshift-toolkit/blob/16bf5b054fd5bdfb5018c1f4e06b80470fde716f/custom-autoscaler/scale.py#L136-L137
zim-desktop-wiki/zim-desktop-wiki
fe717d7ee64e5c06d90df90eb87758e5e72d25c5
zim/plugins/tableeditor.py
python
TableViewWidget.on_focus_in
(self, treeview, event, toolbar)
After a table is selected, this function will be triggered
After a table is selected, this function will be triggered
[ "After", "a", "table", "is", "selected", "this", "function", "will", "be", "triggered" ]
def on_focus_in(self, treeview, event, toolbar): '''After a table is selected, this function will be triggered''' self._keep_toolbar_open = False if self._timer: GObject.source_remove(self._timer) if self._toolbar_enabled: toolbar.show()
[ "def", "on_focus_in", "(", "self", ",", "treeview", ",", "event", ",", "toolbar", ")", ":", "self", ".", "_keep_toolbar_open", "=", "False", "if", "self", ".", "_timer", ":", "GObject", ".", "source_remove", "(", "self", ".", "_timer", ")", "if", "self",...
https://github.com/zim-desktop-wiki/zim-desktop-wiki/blob/fe717d7ee64e5c06d90df90eb87758e5e72d25c5/zim/plugins/tableeditor.py#L428-L435
Cog-Creators/Red-DiscordBot
b05933274a11fb097873ab0d1b246d37b06aa306
redbot/core/core_commands.py
python
CoreLogic._version_info
(cls)
return {"redbot": __version__, "discordpy": discord.__version__}
Version information for Red and discord.py Returns ------- dict `redbot` and `discordpy` keys containing version information for both.
Version information for Red and discord.py
[ "Version", "information", "for", "Red", "and", "discord", ".", "py" ]
async def _version_info(cls) -> Dict[str, str]: """ Version information for Red and discord.py Returns ------- dict `redbot` and `discordpy` keys containing version information for both. """ return {"redbot": __version__, "discordpy": discord.__versio...
[ "async", "def", "_version_info", "(", "cls", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "return", "{", "\"redbot\"", ":", "__version__", ",", "\"discordpy\"", ":", "discord", ".", "__version__", "}" ]
https://github.com/Cog-Creators/Red-DiscordBot/blob/b05933274a11fb097873ab0d1b246d37b06aa306/redbot/core/core_commands.py#L345-L354
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/text.py
python
TextWithDash.set_dashdirection
(self, dd)
Set the direction of the dash following the text. 1 is before the text and 0 is after. The default is 0, which is what you'd want for the typical case of ticks below and on the left of the figure. ACCEPTS: int (1 is before, 0 is after)
Set the direction of the dash following the text. 1 is before the text and 0 is after. The default is 0, which is what you'd want for the typical case of ticks below and on the left of the figure.
[ "Set", "the", "direction", "of", "the", "dash", "following", "the", "text", ".", "1", "is", "before", "the", "text", "and", "0", "is", "after", ".", "The", "default", "is", "0", "which", "is", "what", "you", "d", "want", "for", "the", "typical", "cas...
def set_dashdirection(self, dd): """ Set the direction of the dash following the text. 1 is before the text and 0 is after. The default is 0, which is what you'd want for the typical case of ticks below and on the left of the figure. ACCEPTS: int (1 is before, 0 is after...
[ "def", "set_dashdirection", "(", "self", ",", "dd", ")", ":", "self", ".", "_dashdirection", "=", "dd" ]
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/text.py#L1281-L1290
qutip/qutip
52d01da181a21b810c3407812c670f35fdc647e8
qutip/qip/pulse.py
python
Pulse.qobj
(self)
return self.ideal_pulse.qobj
See parameter `qobj`.
See parameter `qobj`.
[ "See", "parameter", "qobj", "." ]
def qobj(self): """ See parameter `qobj`. """ return self.ideal_pulse.qobj
[ "def", "qobj", "(", "self", ")", ":", "return", "self", ".", "ideal_pulse", ".", "qobj" ]
https://github.com/qutip/qutip/blob/52d01da181a21b810c3407812c670f35fdc647e8/qutip/qip/pulse.py#L232-L236
git-cola/git-cola
b48b8028e0c3baf47faf7b074b9773737358163d
cola/cmds.py
python
difftool_run
(context)
Start a default difftool session
Start a default difftool session
[ "Start", "a", "default", "difftool", "session" ]
def difftool_run(context): """Start a default difftool session""" selection = context.selection files = selection.group() if not files: return s = selection.selection() head = context.model.head difftool_launch_with_head(context, files, bool(s.staged), head)
[ "def", "difftool_run", "(", "context", ")", ":", "selection", "=", "context", ".", "selection", "files", "=", "selection", ".", "group", "(", ")", "if", "not", "files", ":", "return", "s", "=", "selection", ".", "selection", "(", ")", "head", "=", "con...
https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/cmds.py#L2952-L2960
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
DemoPrograms/Demo_Matplotlib_Image_Elem_Spetrogram_Animated_Threaded.py
python
your_matplotlib_code
()
return fig
[]
def your_matplotlib_code(): # The animated part of this is the t_lower, t_upper terms as well as the entire dataset that's graphed. # An entirely new graph is created from scratch every time... implying here that optimization is possible. if not hasattr(your_matplotlib_code, 't_lower'): your_matplot...
[ "def", "your_matplotlib_code", "(", ")", ":", "# The animated part of this is the t_lower, t_upper terms as well as the entire dataset that's graphed.", "# An entirely new graph is created from scratch every time... implying here that optimization is possible.", "if", "not", "hasattr", "(", "y...
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/DemoPrograms/Demo_Matplotlib_Image_Elem_Spetrogram_Animated_Threaded.py#L56-L87
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/db/models/query.py
python
ValuesQuerySet._clone
(self, klass=None, setup=False, **kwargs)
return c
Cloning a ValuesQuerySet preserves the current fields.
Cloning a ValuesQuerySet preserves the current fields.
[ "Cloning", "a", "ValuesQuerySet", "preserves", "the", "current", "fields", "." ]
def _clone(self, klass=None, setup=False, **kwargs): """ Cloning a ValuesQuerySet preserves the current fields. """ c = super(ValuesQuerySet, self)._clone(klass, **kwargs) if not hasattr(c, '_fields'): # Only clone self._fields if _fields wasn't passed into the clonin...
[ "def", "_clone", "(", "self", ",", "klass", "=", "None", ",", "setup", "=", "False", ",", "*", "*", "kwargs", ")", ":", "c", "=", "super", "(", "ValuesQuerySet", ",", "self", ")", ".", "_clone", "(", "klass", ",", "*", "*", "kwargs", ")", "if", ...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/db/models/query.py#L1069-L1083
mgedmin/profilehooks
ed625e621aabfa9232317ddc44aeeda528578f42
profilehooks.py
python
TraceFuncCoverage.__call__
(self, *args, **kw)
Profile a singe call to the function.
Profile a singe call to the function.
[ "Profile", "a", "singe", "call", "to", "the", "function", "." ]
def __call__(self, *args, **kw): """Profile a singe call to the function.""" self.ncalls += 1 if TraceFuncCoverage.tracing: # pragma: nocover return self.fn(*args, **kw) old_trace = sys.gettrace() try: TraceFuncCoverage.tracing = True return s...
[ "def", "__call__", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "self", ".", "ncalls", "+=", "1", "if", "TraceFuncCoverage", ".", "tracing", ":", "# pragma: nocover", "return", "self", ".", "fn", "(", "*", "args", ",", "*", "*", "k...
https://github.com/mgedmin/profilehooks/blob/ed625e621aabfa9232317ddc44aeeda528578f42/profilehooks.py#L597-L608
giswqs/whitebox-python
b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe
whitebox/whitebox_tools.py
python
WhiteboxTools.majority_filter
(self, i, output, filterx=11, filtery=11, callback=None)
return self.run_tool('majority_filter', args, callback)
Assigns each cell in the output grid the most frequently occurring value (mode) in a moving window centred on each grid cell in the input raster. Keyword arguments: i -- Input raster file. output -- Output raster file. filterx -- Size of the filter kernel in the x-direction. ...
Assigns each cell in the output grid the most frequently occurring value (mode) in a moving window centred on each grid cell in the input raster.
[ "Assigns", "each", "cell", "in", "the", "output", "grid", "the", "most", "frequently", "occurring", "value", "(", "mode", ")", "in", "a", "moving", "window", "centred", "on", "each", "grid", "cell", "in", "the", "input", "raster", "." ]
def majority_filter(self, i, output, filterx=11, filtery=11, callback=None): """Assigns each cell in the output grid the most frequently occurring value (mode) in a moving window centred on each grid cell in the input raster. Keyword arguments: i -- Input raster file. output -- Output...
[ "def", "majority_filter", "(", "self", ",", "i", ",", "output", ",", "filterx", "=", "11", ",", "filtery", "=", "11", ",", "callback", "=", "None", ")", ":", "args", "=", "[", "]", "args", ".", "append", "(", "\"--input='{}'\"", ".", "format", "(", ...
https://github.com/giswqs/whitebox-python/blob/b4df0bbb10a1dee3bd0f6b3482511f7c829b38fe/whitebox/whitebox_tools.py#L5801-L5817
andresriancho/w3af
cd22e5252243a87aaa6d0ddea47cf58dacfe00a9
w3af/plugins/attack/db/sqlmap/thirdparty/clientform/clientform.py
python
_AbstractFormParser.end_optgroup
(self)
[]
def end_optgroup(self): debug("") if self._optgroup is None: raise ParseError("end of OPTGROUP before start") self._optgroup = None
[ "def", "end_optgroup", "(", "self", ")", ":", "debug", "(", "\"\"", ")", "if", "self", ".", "_optgroup", "is", "None", ":", "raise", "ParseError", "(", "\"end of OPTGROUP before start\"", ")", "self", ".", "_optgroup", "=", "None" ]
https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/thirdparty/clientform/clientform.py#L574-L578
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
script/hassfest/manifest.py
python
validate
(integrations: dict[str, Integration], config: Config)
Handle all integrations manifests.
Handle all integrations manifests.
[ "Handle", "all", "integrations", "manifests", "." ]
def validate(integrations: dict[str, Integration], config: Config) -> None: """Handle all integrations manifests.""" core_components_dir = config.root / "homeassistant/components" for integration in integrations.values(): validate_manifest(integration, core_components_dir)
[ "def", "validate", "(", "integrations", ":", "dict", "[", "str", ",", "Integration", "]", ",", "config", ":", "Config", ")", "->", "None", ":", "core_components_dir", "=", "config", ".", "root", "/", "\"homeassistant/components\"", "for", "integration", "in", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/script/hassfest/manifest.py#L311-L315
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/autoscaling/v20180419/models.py
python
CreateNotificationConfigurationResponse.__init__
(self)
r""" :param AutoScalingNotificationId: 通知ID。 :type AutoScalingNotificationId: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param AutoScalingNotificationId: 通知ID。 :type AutoScalingNotificationId: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "AutoScalingNotificationId", ":", "通知ID。", ":", "type", "AutoScalingNotificationId", ":", "str", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的", "RequestId。", ":", "type", "RequestId", ":", "str" ]
def __init__(self): r""" :param AutoScalingNotificationId: 通知ID。 :type AutoScalingNotificationId: str :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.AutoScalingNotificationId = None self.RequestId = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "AutoScalingNotificationId", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/autoscaling/v20180419/models.py#L1218-L1226
jpadilla/pyjwt
77d791681fa3d0ba65a648de42dd3d671138cb95
jwt/api_jws.py
python
PyJWS._load
(self, jwt)
return (payload, signing_input, header, signature)
[]
def _load(self, jwt): if isinstance(jwt, str): jwt = jwt.encode("utf-8") if not isinstance(jwt, bytes): raise DecodeError(f"Invalid token type. Token must be a {bytes}") try: signing_input, crypto_segment = jwt.rsplit(b".", 1) header_segment, pay...
[ "def", "_load", "(", "self", ",", "jwt", ")", ":", "if", "isinstance", "(", "jwt", ",", "str", ")", ":", "jwt", "=", "jwt", ".", "encode", "(", "\"utf-8\"", ")", "if", "not", "isinstance", "(", "jwt", ",", "bytes", ")", ":", "raise", "DecodeError",...
https://github.com/jpadilla/pyjwt/blob/77d791681fa3d0ba65a648de42dd3d671138cb95/jwt/api_jws.py#L182-L218
timonwong/OmniMarkupPreviewer
21921ac7a99d2b5924a2219b33679a5b53621392
OmniMarkupLib/Renderers/libs/python3/docutils/writers/html4css1/__init__.py
python
HTMLTranslator.attval
(self, text, whitespace=re.compile('[\n\r\t\v\f]'))
return encoded
Cleanse, HTML encode, and return attribute value text.
Cleanse, HTML encode, and return attribute value text.
[ "Cleanse", "HTML", "encode", "and", "return", "attribute", "value", "text", "." ]
def attval(self, text, whitespace=re.compile('[\n\r\t\v\f]')): """Cleanse, HTML encode, and return attribute value text.""" encoded = self.encode(whitespace.sub(' ', text)) if self.in_mailto and self.settings.cloak_email_addresses: # Cloak at-signs ("%40") and periods ...
[ "def", "attval", "(", "self", ",", "text", ",", "whitespace", "=", "re", ".", "compile", "(", "'[\\n\\r\\t\\v\\f]'", ")", ")", ":", "encoded", "=", "self", ".", "encode", "(", "whitespace", ".", "sub", "(", "' '", ",", "text", ")", ")", "if", "self",...
https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/Renderers/libs/python3/docutils/writers/html4css1/__init__.py#L367-L375
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/taskrouter/v1/workspace/__init__.py
python
WorkspaceInstance.activities
(self)
return self._proxy.activities
Access the activities :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList
Access the activities
[ "Access", "the", "activities" ]
def activities(self): """ Access the activities :returns: twilio.rest.taskrouter.v1.workspace.activity.ActivityList :rtype: twilio.rest.taskrouter.v1.workspace.activity.ActivityList """ return self._proxy.activities
[ "def", "activities", "(", "self", ")", ":", "return", "self", ".", "_proxy", ".", "activities" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/taskrouter/v1/workspace/__init__.py#L667-L674
Xunius/Menotexport
01d1ac7c9ee01a67ffeeebc9dcbc1ff684a9c95f
menotexport.py
python
getOtherCanonicalDocs
(db,alldocids,annodocids,verbose=True)
return result
Get a list of doc meta-data not in annotation list. <annodocids>: list, doc documentId. Deprecated, no longer in use.
Get a list of doc meta-data not in annotation list.
[ "Get", "a", "list", "of", "doc", "meta", "-", "data", "not", "in", "annotation", "list", "." ]
def getOtherCanonicalDocs(db,alldocids,annodocids,verbose=True): '''Get a list of doc meta-data not in annotation list. <annodocids>: list, doc documentId. Deprecated, no longer in use. ''' #------Docids in folder and not in annodocids------ otherdocids=set(alldocids).difference((annodocids)) ...
[ "def", "getOtherCanonicalDocs", "(", "db", ",", "alldocids", ",", "annodocids", ",", "verbose", "=", "True", ")", ":", "#------Docids in folder and not in annodocids------", "otherdocids", "=", "set", "(", "alldocids", ")", ".", "difference", "(", "(", "annodocids",...
https://github.com/Xunius/Menotexport/blob/01d1ac7c9ee01a67ffeeebc9dcbc1ff684a9c95f/menotexport.py#L813-L832
dictation-toolbox/aenea
dfd679720b90f92340d4a8cbd4603cab37f18804
server/core.py
python
AbstractAeneaPlatformRpcs.server_info
(self)
Return arbitrary server information to the aenea client. :return: :rtype: dict
Return arbitrary server information to the aenea client. :return: :rtype: dict
[ "Return", "arbitrary", "server", "information", "to", "the", "aenea", "client", ".", ":", "return", ":", ":", "rtype", ":", "dict" ]
def server_info(self): """ Return arbitrary server information to the aenea client. :return: :rtype: dict """ raise NotImplementedError()
[ "def", "server_info", "(", "self", ")", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/dictation-toolbox/aenea/blob/dfd679720b90f92340d4a8cbd4603cab37f18804/server/core.py#L202-L208
wxWidgets/Phoenix
b2199e299a6ca6d866aa6f3d0888499136ead9d6
wx/lib/agw/ultimatelistctrl.py
python
UltimateListCtrl.SetStringItem
(self, index, col, label, imageIds=[], it_kind=0)
return index
Sets a string or image at the given location. :param `index`: the item index; :param `col`: the column to which the item belongs to; :param `label`: the item text; :param `imageIds`: a Python list containing the image indexes for the images associated to this item; :par...
Sets a string or image at the given location.
[ "Sets", "a", "string", "or", "image", "at", "the", "given", "location", "." ]
def SetStringItem(self, index, col, label, imageIds=[], it_kind=0): """ Sets a string or image at the given location. :param `index`: the item index; :param `col`: the column to which the item belongs to; :param `label`: the item text; :param `imageIds`: a Python list co...
[ "def", "SetStringItem", "(", "self", ",", "index", ",", "col", ",", "label", ",", "imageIds", "=", "[", "]", ",", "it_kind", "=", "0", ")", ":", "info", "=", "UltimateListItem", "(", ")", "info", ".", "_text", "=", "label", "info", ".", "_mask", "=...
https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L11296-L11336
facebook/prophet
ed0dc7a3fdca00e2f3bcd62b490093e3d123b70c
python/prophet/diagnostics.py
python
smape
(df, w)
return rolling_mean_by_h( x=sape.values, h=df['horizon'].values, w=w, name='smape' )
Symmetric mean absolute percentage error based on Chen and Yang (2004) formula Parameters ---------- df: Cross-validation results dataframe. w: Aggregation window size. Returns ------- Dataframe with columns horizon and smape.
Symmetric mean absolute percentage error based on Chen and Yang (2004) formula
[ "Symmetric", "mean", "absolute", "percentage", "error", "based", "on", "Chen", "and", "Yang", "(", "2004", ")", "formula" ]
def smape(df, w): """Symmetric mean absolute percentage error based on Chen and Yang (2004) formula Parameters ---------- df: Cross-validation results dataframe. w: Aggregation window size. Returns ------- Dataframe with columns horizon and smape. """ sape = np.abs(df['y'] ...
[ "def", "smape", "(", "df", ",", "w", ")", ":", "sape", "=", "np", ".", "abs", "(", "df", "[", "'y'", "]", "-", "df", "[", "'yhat'", "]", ")", "/", "(", "(", "np", ".", "abs", "(", "df", "[", "'y'", "]", ")", "+", "np", ".", "abs", "(", ...
https://github.com/facebook/prophet/blob/ed0dc7a3fdca00e2f3bcd62b490093e3d123b70c/python/prophet/diagnostics.py#L608-L626
kbandla/ImmunityDebugger
2abc03fb15c8f3ed0914e1175c4d8933977c73e3
1.85/Libs/x86smt/prettysolver.py
python
Expression.__nonzero__
(self)
We use VALID queries here (instead of SAT) because python uses shortcircuit boolean checks on "if" statements, so it checks the conditions one by one and not all together. for example, in a SAT query, this: if a < 10 and a > 20: print "BLA" would actually return SAT, because it ...
We use VALID queries here (instead of SAT) because python uses shortcircuit boolean checks on "if" statements, so it checks the conditions one by one and not all together. for example, in a SAT query, this: if a < 10 and a > 20: print "BLA" would actually return SAT, because it ...
[ "We", "use", "VALID", "queries", "here", "(", "instead", "of", "SAT", ")", "because", "python", "uses", "shortcircuit", "boolean", "checks", "on", "if", "statements", "so", "it", "checks", "the", "conditions", "one", "by", "one", "and", "not", "all", "toge...
def __nonzero__(self): """ We use VALID queries here (instead of SAT) because python uses shortcircuit boolean checks on "if" statements, so it checks the conditions one by one and not all together. for example, in a SAT query, this: if a < 10 and a > 20: print "BLA" ...
[ "def", "__nonzero__", "(", "self", ")", ":", "if", "self", ".", "isBoolean", "(", ")", ":", "return", "self", ".", "isVALID", "(", ")", "else", ":", "return", "(", "self", "!=", "0", ")", ".", "isVALID", "(", ")" ]
https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.85/Libs/x86smt/prettysolver.py#L196-L217
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/ttLib/woff2.py
python
WOFF2Writer._calcSFNTChecksumsLengthsAndOffsets
(self)
return offset
Compute the 'original' SFNT checksums, lengths and offsets for checksum adjustment calculation. Return the total size of the uncompressed font.
Compute the 'original' SFNT checksums, lengths and offsets for checksum adjustment calculation. Return the total size of the uncompressed font.
[ "Compute", "the", "original", "SFNT", "checksums", "lengths", "and", "offsets", "for", "checksum", "adjustment", "calculation", ".", "Return", "the", "total", "size", "of", "the", "uncompressed", "font", "." ]
def _calcSFNTChecksumsLengthsAndOffsets(self): """ Compute the 'original' SFNT checksums, lengths and offsets for checksum adjustment calculation. Return the total size of the uncompressed font. """ offset = sfntDirectorySize + sfntDirectoryEntrySize * len(self.tables) for tag, entry in self.tables.items(): ...
[ "def", "_calcSFNTChecksumsLengthsAndOffsets", "(", "self", ")", ":", "offset", "=", "sfntDirectorySize", "+", "sfntDirectoryEntrySize", "*", "len", "(", "self", ".", "tables", ")", "for", "tag", ",", "entry", "in", "self", ".", "tables", ".", "items", "(", "...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/woff2.py#L308-L322
aaronportnoy/toolbag
2d39457a7617b2f334d203d8c8cf88a5a25ef1fa
toolbag/agent/dbg/envi/registers.py
python
addLocalEnums
(l, regdef)
Update a dictionary (or module locals) with REG_FOO index values for all the base registers defined in regdef.
Update a dictionary (or module locals) with REG_FOO index values for all the base registers defined in regdef.
[ "Update", "a", "dictionary", "(", "or", "module", "locals", ")", "with", "REG_FOO", "index", "values", "for", "all", "the", "base", "registers", "defined", "in", "regdef", "." ]
def addLocalEnums(l, regdef): """ Update a dictionary (or module locals) with REG_FOO index values for all the base registers defined in regdef. """ for i,(rname,width) in enumerate(regdef): l["REG_%s" % rname.upper()] = i
[ "def", "addLocalEnums", "(", "l", ",", "regdef", ")", ":", "for", "i", ",", "(", "rname", ",", "width", ")", "in", "enumerate", "(", "regdef", ")", ":", "l", "[", "\"REG_%s\"", "%", "rname", ".", "upper", "(", ")", "]", "=", "i" ]
https://github.com/aaronportnoy/toolbag/blob/2d39457a7617b2f334d203d8c8cf88a5a25ef1fa/toolbag/agent/dbg/envi/registers.py#L350-L356
gdraheim/docker-systemctl-replacement
9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c
files/docker/systemctl.py
python
Systemctl.scan_unit_sysd_files
(self, module = None)
return list(self._file_for_unit_sysd.keys())
reads all unit files, returns the first filename for the unit given
reads all unit files, returns the first filename for the unit given
[ "reads", "all", "unit", "files", "returns", "the", "first", "filename", "for", "the", "unit", "given" ]
def scan_unit_sysd_files(self, module = None): # -> [ unit-names,... ] """ reads all unit files, returns the first filename for the unit given """ if self._file_for_unit_sysd is None: self._file_for_unit_sysd = {} for folder in self.sysd_folders(): if not folder: ...
[ "def", "scan_unit_sysd_files", "(", "self", ",", "module", "=", "None", ")", ":", "# -> [ unit-names,... ]", "if", "self", ".", "_file_for_unit_sysd", "is", "None", ":", "self", ".", "_file_for_unit_sysd", "=", "{", "}", "for", "folder", "in", "self", ".", "...
https://github.com/gdraheim/docker-systemctl-replacement/blob/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl.py#L1291-L1309
enthought/traitsui
b7c38c7a47bf6ae7971f9ddab70c8a358647dd25
traitsui/extras/saving.py
python
SaveHandler.save
(self, info)
Saves the object to its current filepath. If this is not specified, opens a dialog to select this path. Returns whether the save actually occurred.
Saves the object to its current filepath. If this is not specified, opens a dialog to select this path. Returns whether the save actually occurred.
[ "Saves", "the", "object", "to", "its", "current", "filepath", ".", "If", "this", "is", "not", "specified", "opens", "a", "dialog", "to", "select", "this", "path", ".", "Returns", "whether", "the", "save", "actually", "occurred", "." ]
def save(self, info): """Saves the object to its current filepath. If this is not specified, opens a dialog to select this path. Returns whether the save actually occurred. """ if self.saveObject.filepath == "": return self.saveAs(info) else: retur...
[ "def", "save", "(", "self", ",", "info", ")", ":", "if", "self", ".", "saveObject", ".", "filepath", "==", "\"\"", ":", "return", "self", ".", "saveAs", "(", "info", ")", "else", ":", "return", "self", ".", "_validateAndSave", "(", ")" ]
https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/extras/saving.py#L164-L172
sony/nnabla-examples
068be490aacf73740502a1c3b10f8b2d15a52d32
language-modeling/BERT-finetuning/external/tokenization_bert.py
python
BasicTokenizer.tokenize
(self, text, never_split=None)
return output_tokens
Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer. Args: **never_split**: (`optional`) list of str Kept for backward compatibility purposes. Now implemented directly at the base class lev...
Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer. Args: **never_split**: (`optional`) list of str Kept for backward compatibility purposes. Now implemented directly at the base class lev...
[ "Basic", "Tokenization", "of", "a", "piece", "of", "text", ".", "Split", "on", "white", "spaces", "only", "for", "sub", "-", "word", "tokenization", "see", "WordPieceTokenizer", ".", "Args", ":", "**", "never_split", "**", ":", "(", "optional", ")", "list"...
def tokenize(self, text, never_split=None): """ Basic Tokenization of a piece of text. Split on "white spaces" only, for sub-word tokenization, see WordPieceTokenizer. Args: **never_split**: (`optional`) list of str Kept for backward compatibility purposes. ...
[ "def", "tokenize", "(", "self", ",", "text", ",", "never_split", "=", "None", ")", ":", "never_split", "=", "self", ".", "never_split", "+", "(", "never_split", "if", "never_split", "is", "not", "None", "else", "[", "]", ")", "text", "=", "self", ".", ...
https://github.com/sony/nnabla-examples/blob/068be490aacf73740502a1c3b10f8b2d15a52d32/language-modeling/BERT-finetuning/external/tokenization_bert.py#L296-L325