nwo
stringlengths
5
86
sha
stringlengths
40
40
path
stringlengths
4
189
language
stringclasses
1 value
identifier
stringlengths
1
94
parameters
stringlengths
2
4.03k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
11.5k
docstring
stringlengths
1
33.2k
docstring_summary
stringlengths
0
5.15k
docstring_tokens
list
function
stringlengths
34
151k
function_tokens
list
url
stringlengths
90
278
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/configparser.py
python
RawConfigParser.sections
(self)
return list(self._sections.keys())
Return a list of section names, excluding [DEFAULT]
Return a list of section names, excluding [DEFAULT]
[ "Return", "a", "list", "of", "section", "names", "excluding", "[", "DEFAULT", "]" ]
def sections(self): """Return a list of section names, excluding [DEFAULT]""" # self._sections will never have [DEFAULT] in it return list(self._sections.keys())
[ "def", "sections", "(", "self", ")", ":", "# self._sections will never have [DEFAULT] in it", "return", "list", "(", "self", ".", "_sections", ".", "keys", "(", ")", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/configparser.py#L643-L646
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/data-stream-as-disjoint-intervals.py
python
SummaryRanges.__init__
(self)
Initialize your data structure here.
Initialize your data structure here.
[ "Initialize", "your", "data", "structure", "here", "." ]
def __init__(self): """ Initialize your data structure here. """ self.__intervals = []
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "__intervals", "=", "[", "]" ]
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/data-stream-as-disjoint-intervals.py#L12-L16
mingchen/protobuf-ios
0958df34558cd54cb7b6e6ca5c8855bf3d475046
compiler/python/google/protobuf/internal/containers.py
python
RepeatedScalarFieldContainer.__getslice__
(self, start, stop)
return self._values[start:stop]
Retrieves the subset of items from between the specified indices.
Retrieves the subset of items from between the specified indices.
[ "Retrieves", "the", "subset", "of", "items", "from", "between", "the", "specified", "indices", "." ]
def __getslice__(self, start, stop): """Retrieves the subset of items from between the specified indices.""" return self._values[start:stop]
[ "def", "__getslice__", "(", "self", ",", "start", ",", "stop", ")", ":", "return", "self", ".", "_values", "[", "start", ":", "stop", "]" ]
https://github.com/mingchen/protobuf-ios/blob/0958df34558cd54cb7b6e6ca5c8855bf3d475046/compiler/python/google/protobuf/internal/containers.py#L138-L140
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/most-common-word.py
python
Solution.mostCommonWord
(self, paragraph, banned)
return result
:type paragraph: str :type banned: List[str] :rtype: str
:type paragraph: str :type banned: List[str] :rtype: str
[ ":", "type", "paragraph", ":", "str", ":", "type", "banned", ":", "List", "[", "str", "]", ":", "rtype", ":", "str" ]
def mostCommonWord(self, paragraph, banned): """ :type paragraph: str :type banned: List[str] :rtype: str """ lookup = set(banned) counts = collections.Counter(word.strip("!?',.") for word in paragraph.lower().split()) result = '' for word in counts: if (not result or counts[word] > counts[result]) and \ word not in lookup: result = word return result
[ "def", "mostCommonWord", "(", "self", ",", "paragraph", ",", "banned", ")", ":", "lookup", "=", "set", "(", "banned", ")", "counts", "=", "collections", ".", "Counter", "(", "word", ".", "strip", "(", "\"!?',.\"", ")", "for", "word", "in", "paragraph", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/most-common-word.py#L8-L23
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/preprocessor.py
python
Preprocessor.clone
(self)
return rv
Create a clone of the current processor, including line ending settings, marker, variable definitions, output stream.
Create a clone of the current processor, including line ending settings, marker, variable definitions, output stream.
[ "Create", "a", "clone", "of", "the", "current", "processor", "including", "line", "ending", "settings", "marker", "variable", "definitions", "output", "stream", "." ]
def clone(self): """ Create a clone of the current processor, including line ending settings, marker, variable definitions, output stream. """ rv = Preprocessor() rv.context.update(self.context) rv.setMarker(self.marker) rv.LE = self.LE rv.out = self.out return rv
[ "def", "clone", "(", "self", ")", ":", "rv", "=", "Preprocessor", "(", ")", "rv", ".", "context", ".", "update", "(", "self", ".", "context", ")", "rv", ".", "setMarker", "(", "self", ".", "marker", ")", "rv", ".", "LE", "=", "self", ".", "LE", ...
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/preprocessor.py#L369-L379
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/devil/devil/android/apk_helper.py
python
GetInstrumentationName
(apk_path)
return ApkHelper(apk_path).GetInstrumentationName()
Returns the name of the Instrumentation in the apk.
Returns the name of the Instrumentation in the apk.
[ "Returns", "the", "name", "of", "the", "Instrumentation", "in", "the", "apk", "." ]
def GetInstrumentationName(apk_path): """Returns the name of the Instrumentation in the apk.""" return ApkHelper(apk_path).GetInstrumentationName()
[ "def", "GetInstrumentationName", "(", "apk_path", ")", ":", "return", "ApkHelper", "(", "apk_path", ")", ".", "GetInstrumentationName", "(", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/android/apk_helper.py#L25-L27
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
third_party/tlslite/tlslite/integration/AsyncStateMachine.py
python
AsyncStateMachine.outConnectEvent
(self)
Called when a handshake operation completes. May be overridden in subclass.
Called when a handshake operation completes.
[ "Called", "when", "a", "handshake", "operation", "completes", "." ]
def outConnectEvent(self): """Called when a handshake operation completes. May be overridden in subclass. """ pass
[ "def", "outConnectEvent", "(", "self", ")", ":", "pass" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/tlslite/tlslite/integration/AsyncStateMachine.py#L92-L97
vnpy/vnpy
f50f2535ed39dd33272e0985ed40c7078e4c19f6
vnpy/trader/utility.py
python
ArrayManager.dx
(self, n: int, array: bool = False)
return result[-1]
DX.
DX.
[ "DX", "." ]
def dx(self, n: int, array: bool = False) -> Union[float, np.ndarray]: """ DX. """ result = talib.DX(self.high, self.low, self.close, n) if array: return result return result[-1]
[ "def", "dx", "(", "self", ",", "n", ":", "int", ",", "array", ":", "bool", "=", "False", ")", "->", "Union", "[", "float", ",", "np", ".", "ndarray", "]", ":", "result", "=", "talib", ".", "DX", "(", "self", ".", "high", ",", "self", ".", "lo...
https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/trader/utility.py#L750-L757
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
GBSpan.GetRowspan
(*args, **kwargs)
return _core_.GBSpan_GetRowspan(*args, **kwargs)
GetRowspan(self) -> int
GetRowspan(self) -> int
[ "GetRowspan", "(", "self", ")", "-", ">", "int" ]
def GetRowspan(*args, **kwargs): """GetRowspan(self) -> int""" return _core_.GBSpan_GetRowspan(*args, **kwargs)
[ "def", "GetRowspan", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "GBSpan_GetRowspan", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L15652-L15654
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/training/tracking/data_structures.py
python
_DictWrapper._trackable_children
(self, save_type=base.SaveType.CHECKPOINT, **kwargs)
return children
Check that the object is saveable before listing its dependencies.
Check that the object is saveable before listing its dependencies.
[ "Check", "that", "the", "object", "is", "saveable", "before", "listing", "its", "dependencies", "." ]
def _trackable_children(self, save_type=base.SaveType.CHECKPOINT, **kwargs): """Check that the object is saveable before listing its dependencies.""" self._check_self_external_modification() if self._self_non_string_key: raise ValueError( f"Unable to save the object {self} (a dictionary wrapper constructed " "automatically on attribute assignment). The wrapped dictionary " "contains a non-string key which maps to a trackable object or " "mutable data structure.\n\nIf you don't need this dictionary " "checkpointed, wrap it in a non-trackable " "object; it will be subsequently ignored.") if self._self_external_modification: raise ValueError( f"Unable to save the object {self} (a dictionary wrapper constructed " "automatically on attribute assignment). The wrapped dictionary was " f"modified outside the wrapper (its final value was {self}, its value" " when a checkpoint dependency was added was " f"{self._self_last_wrapped_dict_snapshot}), which breaks " "restoration on object creation.\n\nIf you don't need this " "dictionary checkpointed, wrap it in a " "non-trackable object; it will be subsequently ignored.") assert not self._dirty # Any reason for dirtiness should have an exception. children = super(_DictWrapper, self)._trackable_children(save_type, **kwargs) if save_type == base.SaveType.SAVEDMODEL: # Add functions to be serialized. children.update( {key: value for key, value in self.items() if _is_function(value)}) return children
[ "def", "_trackable_children", "(", "self", ",", "save_type", "=", "base", ".", "SaveType", ".", "CHECKPOINT", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_check_self_external_modification", "(", ")", "if", "self", ".", "_self_non_string_key", ":", "raise"...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/tracking/data_structures.py#L854-L884
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/internals/managers.py
python
BlockManager.consolidate
(self)
return bm
Join together blocks having same dtype Returns ------- y : BlockManager
Join together blocks having same dtype
[ "Join", "together", "blocks", "having", "same", "dtype" ]
def consolidate(self): """ Join together blocks having same dtype Returns ------- y : BlockManager """ if self.is_consolidated(): return self bm = type(self)(self.blocks, self.axes) bm._is_consolidated = False bm._consolidate_inplace() return bm
[ "def", "consolidate", "(", "self", ")", ":", "if", "self", ".", "is_consolidated", "(", ")", ":", "return", "self", "bm", "=", "type", "(", "self", ")", "(", "self", ".", "blocks", ",", "self", ".", "axes", ")", "bm", ".", "_is_consolidated", "=", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/internals/managers.py#L927-L941
domino-team/openwrt-cc
8b181297c34d14d3ca521cc9f31430d561dbc688
package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/release/releases.py
python
FilterDuplicatesAndReverse
(cr_releases)
return result
Returns the chromium releases in reverse order filtered by v8 revision duplicates. cr_releases is a list of [cr_rev, v8_hsh] reverse-sorted by cr_rev.
Returns the chromium releases in reverse order filtered by v8 revision duplicates.
[ "Returns", "the", "chromium", "releases", "in", "reverse", "order", "filtered", "by", "v8", "revision", "duplicates", "." ]
def FilterDuplicatesAndReverse(cr_releases): """Returns the chromium releases in reverse order filtered by v8 revision duplicates. cr_releases is a list of [cr_rev, v8_hsh] reverse-sorted by cr_rev. """ last = "" result = [] for release in reversed(cr_releases): if last == release[1]: continue last = release[1] result.append(release) return result
[ "def", "FilterDuplicatesAndReverse", "(", "cr_releases", ")", ":", "last", "=", "\"\"", "result", "=", "[", "]", "for", "release", "in", "reversed", "(", "cr_releases", ")", ":", "if", "last", "==", "release", "[", "1", "]", ":", "continue", "last", "=",...
https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8/tools/release/releases.py#L70-L83
microsoft/clang
86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5
bindings/python/clang/cindex.py
python
Type.get_align
(self)
return conf.lib.clang_Type_getAlignOf(self)
Retrieve the alignment of the record.
Retrieve the alignment of the record.
[ "Retrieve", "the", "alignment", "of", "the", "record", "." ]
def get_align(self): """ Retrieve the alignment of the record. """ return conf.lib.clang_Type_getAlignOf(self)
[ "def", "get_align", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_Type_getAlignOf", "(", "self", ")" ]
https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/bindings/python/clang/cindex.py#L2357-L2361
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/cmd.py
python
Cmd.precmd
(self, line)
return line
Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued.
Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued.
[ "Hook", "method", "executed", "just", "before", "the", "command", "line", "is", "interpreted", "but", "after", "the", "input", "prompt", "is", "generated", "and", "issued", "." ]
def precmd(self, line): """Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued. """ return line
[ "def", "precmd", "(", "self", ",", "line", ")", ":", "return", "line" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cmd.py#L154-L159
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mpl2dgraphicsview.py
python
Qt4Mpl2dCanvas.y_min
(self)
return self._yLimit[0]
minimum y :return:
minimum y :return:
[ "minimum", "y", ":", "return", ":" ]
def y_min(self): """ minimum y :return: """ return self._yLimit[0]
[ "def", "y_min", "(", "self", ")", ":", "return", "self", ".", "_yLimit", "[", "0", "]" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/mpl2dgraphicsview.py#L367-L371
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/aui.py
python
AuiTabContainer.GetFlags
(*args, **kwargs)
return _aui.AuiTabContainer_GetFlags(*args, **kwargs)
GetFlags(self) -> int
GetFlags(self) -> int
[ "GetFlags", "(", "self", ")", "-", ">", "int" ]
def GetFlags(*args, **kwargs): """GetFlags(self) -> int""" return _aui.AuiTabContainer_GetFlags(*args, **kwargs)
[ "def", "GetFlags", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_aui", ".", "AuiTabContainer_GetFlags", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L1141-L1143
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/tpu/python/tpu/tpu_estimator.py
python
_EvalMetrics.to_metric_metric_ops_for_tpu
(self, dummy_update_op)
return eval_metric_ops, eval_update_ops
Creates the eval_metric_ops now based on the TPU outfeed. `eval_metric_ops` is defined in `EstimatorSpec`. From all shards, tensors are dequeued from outfeed and then concatenated (along batch size dimension) to form global-like tensors. All global-like tensors are passed to the metric fn. Args: dummy_update_op: A dummy update op. Returns: A tuple of (`eval_metric_ops` and `update_ops`), where `update_ops` should be invoked in Outfeed dequeue thread, which drive the outfeed dequeue and update the state of metrics. Raises: RuntimeError: If outfeed tensor is scalar.
Creates the eval_metric_ops now based on the TPU outfeed.
[ "Creates", "the", "eval_metric_ops", "now", "based", "on", "the", "TPU", "outfeed", "." ]
def to_metric_metric_ops_for_tpu(self, dummy_update_op): """Creates the eval_metric_ops now based on the TPU outfeed. `eval_metric_ops` is defined in `EstimatorSpec`. From all shards, tensors are dequeued from outfeed and then concatenated (along batch size dimension) to form global-like tensors. All global-like tensors are passed to the metric fn. Args: dummy_update_op: A dummy update op. Returns: A tuple of (`eval_metric_ops` and `update_ops`), where `update_ops` should be invoked in Outfeed dequeue thread, which drive the outfeed dequeue and update the state of metrics. Raises: RuntimeError: If outfeed tensor is scalar. """ num_cores = self._ctx.num_cores # For each i, dequeue_ops[i] is a list containing the tensors from all # shards. This list is concatenated later. dequeue_ops = [] for i in xrange(len(self._tensors)): dequeue_ops.append([]) # Outfeed ops execute on each JF node. tpu_device_placement_fn = self._ctx.tpu_device_placement_function for i in xrange(num_cores): with ops.device(tpu_device_placement_fn(i)): outfeed_tensors = tpu_ops.outfeed_dequeue_tuple( dtypes=self._tensor_dtypes, shapes=self._tensor_shapes) for j, item in enumerate(outfeed_tensors): dequeue_ops[j].append(item) # It is assumed evaluation always happends on single host TPU system. So, # place all ops on tpu host if possible. with ops.device(self._ctx.tpu_host_placement_function(core_id=0)): for i, item in enumerate(dequeue_ops): if dequeue_ops[i][0].shape.ndims == 0: raise RuntimeError( 'All tensors outfed from TPU should preseve batch size ' 'dimension, but got scalar {}'.format(dequeue_ops[i][0])) # TODO(xiejw): Allow users to specify the axis for batch size dimension. dequeue_ops[i] = array_ops.concat(dequeue_ops[i], axis=0) if self._is_dict: dequeue_ops = dict(zip(self._tensor_keys, dequeue_ops)) try: eval_metric_ops = self._metric_fn(**dequeue_ops) except TypeError as e: logging.warning( 'Exception while calling metric_fn for evalution: %s. ' 'It is likely the tensors (eval_metrics[1]) do not match the ' 'metric_fn arguments', e) raise e else: eval_metric_ops = self._metric_fn(*dequeue_ops) eval_update_ops = [] for k, v in eval_metric_ops.items(): eval_metric_ops[k] = (v[0], dummy_update_op) eval_update_ops.append(v[1]) return eval_metric_ops, eval_update_ops
[ "def", "to_metric_metric_ops_for_tpu", "(", "self", ",", "dummy_update_op", ")", ":", "num_cores", "=", "self", ".", "_ctx", ".", "num_cores", "# For each i, dequeue_ops[i] is a list containing the tensors from all", "# shards. This list is concatenated later.", "dequeue_ops", "=...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/tpu/python/tpu/tpu_estimator.py#L1168-L1234
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/python2_version/klampt/vis/visualization.py
python
setViewport
(viewport)
Sets the current window to use a given GLViewport (see klampt.vis.glprogram.GLViewport)
Sets the current window to use a given GLViewport (see klampt.vis.glprogram.GLViewport)
[ "Sets", "the", "current", "window", "to", "use", "a", "given", "GLViewport", "(", "see", "klampt", ".", "vis", ".", "glprogram", ".", "GLViewport", ")" ]
def setViewport(viewport): """Sets the current window to use a given GLViewport (see klampt.vis.glprogram.GLViewport)""" _frontend.set_view(viewport)
[ "def", "setViewport", "(", "viewport", ")", ":", "_frontend", ".", "set_view", "(", "viewport", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/visualization.py#L662-L664
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/sized_controls.py
python
SizedDialog.__init__
(self, *args, **kwargs)
A sized dialog Controls added to its content pane will automatically be added to the panes sizer. Usage: 'self' is a SizedDialog instance pane = self.GetContentsPane() pane.SetSizerType("horizontal") b1 = wx.Button(pane, wx.ID_ANY) t1 = wx.TextCtrl(pane, wx.ID_ANY) t1.SetSizerProps(expand=True)
A sized dialog Controls added to its content pane will automatically be added to the panes sizer. Usage: 'self' is a SizedDialog instance pane = self.GetContentsPane() pane.SetSizerType("horizontal") b1 = wx.Button(pane, wx.ID_ANY) t1 = wx.TextCtrl(pane, wx.ID_ANY) t1.SetSizerProps(expand=True)
[ "A", "sized", "dialog", "Controls", "added", "to", "its", "content", "pane", "will", "automatically", "be", "added", "to", "the", "panes", "sizer", ".", "Usage", ":", "self", "is", "a", "SizedDialog", "instance", "pane", "=", "self", ".", "GetContentsPane", ...
def __init__(self, *args, **kwargs): """A sized dialog Controls added to its content pane will automatically be added to the panes sizer. Usage: 'self' is a SizedDialog instance pane = self.GetContentsPane() pane.SetSizerType("horizontal") b1 = wx.Button(pane, wx.ID_ANY) t1 = wx.TextCtrl(pane, wx.ID_ANY) t1.SetSizerProps(expand=True) """ wx.Dialog.__init__(self, *args, **kwargs) self.SetExtraStyle(wx.WS_EX_VALIDATE_RECURSIVELY) self.borderLen = 12 self.mainPanel = SizedPanel(self, -1) mysizer = wx.BoxSizer(wx.VERTICAL) mysizer.Add(self.mainPanel, 1, wx.EXPAND | wx.ALL, self.GetDialogBorder()) self.SetSizer(mysizer) self.SetAutoLayout(True)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "wx", ".", "Dialog", ".", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "SetExtraStyle", "(", "wx", ".", "WS_EX_VALIDATE_RE...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/sized_controls.py#L666-L694
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/pydocview.py
python
DocApp.DoBackgroundListenAndLoad
(self)
Open any files specified in the given command line argument passed in via shared memory
Open any files specified in the given command line argument passed in via shared memory
[ "Open", "any", "files", "specified", "in", "the", "given", "command", "line", "argument", "passed", "in", "via", "shared", "memory" ]
def DoBackgroundListenAndLoad(self): """ Open any files specified in the given command line argument passed in via shared memory """ self._timer.Stop() self._sharedMemory.seek(0) if self._sharedMemory.read_byte() == '+': # available data data = self._sharedMemory.read(1024-1) self._sharedMemory.seek(0) self._sharedMemory.write_byte("*") # finished reading, set buffer free marker self._sharedMemory.flush() args = pickle.loads(data) for arg in args: if (wx.Platform != "__WXMSW__" or arg[0] != "/") and arg[0] != '-' and os.path.exists(arg): self.GetDocumentManager().CreateDocument(os.path.normpath(arg), wx.lib.docview.DOC_SILENT) # force display of running app topWindow = wx.GetApp().GetTopWindow() if topWindow.IsIconized(): topWindow.Iconize(False) else: topWindow.Raise() self._timer.Start(1000)
[ "def", "DoBackgroundListenAndLoad", "(", "self", ")", ":", "self", ".", "_timer", ".", "Stop", "(", ")", "self", ".", "_sharedMemory", ".", "seek", "(", "0", ")", "if", "self", ".", "_sharedMemory", ".", "read_byte", "(", ")", "==", "'+'", ":", "# avai...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pydocview.py#L1741-L1766
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2class.py
python
uCSIsKannada
(code)
return ret
Check whether the character is part of Kannada UCS Block
Check whether the character is part of Kannada UCS Block
[ "Check", "whether", "the", "character", "is", "part", "of", "Kannada", "UCS", "Block" ]
def uCSIsKannada(code): """Check whether the character is part of Kannada UCS Block """ ret = libxml2mod.xmlUCSIsKannada(code) return ret
[ "def", "uCSIsKannada", "(", "code", ")", ":", "ret", "=", "libxml2mod", ".", "xmlUCSIsKannada", "(", "code", ")", "return", "ret" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1850-L1853
llvm-mirror/lldb
d01083a850f577b85501a0902b52fd0930de72c7
third_party/Python/module/six/six.py
python
add_move
(move)
Add an item to six.moves.
Add an item to six.moves.
[ "Add", "an", "item", "to", "six", ".", "moves", "." ]
def add_move(move): """Add an item to six.moves.""" setattr(_MovedItems, move.name, move)
[ "def", "add_move", "(", "move", ")", ":", "setattr", "(", "_MovedItems", ",", "move", ".", "name", ",", "move", ")" ]
https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/six/six.py#L505-L507
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/layers/python/layers/feature_column.py
python
_SparseColumn.insert_transformed_feature
(self, columns_to_tensors)
Handles sparse column to id conversion.
Handles sparse column to id conversion.
[ "Handles", "sparse", "column", "to", "id", "conversion", "." ]
def insert_transformed_feature(self, columns_to_tensors): """Handles sparse column to id conversion.""" input_tensor = self._get_input_sparse_tensor(columns_to_tensors[self.name]) columns_to_tensors[self] = self._do_transform(input_tensor)
[ "def", "insert_transformed_feature", "(", "self", ",", "columns_to_tensors", ")", ":", "input_tensor", "=", "self", ".", "_get_input_sparse_tensor", "(", "columns_to_tensors", "[", "self", ".", "name", "]", ")", "columns_to_tensors", "[", "self", "]", "=", "self",...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/layers/python/layers/feature_column.py#L469-L472
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/robotsim.py
python
RobotModel.randomizeConfig
(self, unboundedScale: float=1.0)
return _robotsim.RobotModel_randomizeConfig(self, unboundedScale)
r""" Samples a random configuration and updates the robot's pose. Properly handles non-normal joints and handles DOFs with infinite bounds using a centered Laplacian distribution with the given scaling term. Args: unboundedScale (float, optional): default value 1.0 .. note:: Python random module seeding does not affect the result.
r""" Samples a random configuration and updates the robot's pose. Properly handles non-normal joints and handles DOFs with infinite bounds using a centered Laplacian distribution with the given scaling term.
[ "r", "Samples", "a", "random", "configuration", "and", "updates", "the", "robot", "s", "pose", ".", "Properly", "handles", "non", "-", "normal", "joints", "and", "handles", "DOFs", "with", "infinite", "bounds", "using", "a", "centered", "Laplacian", "distribut...
def randomizeConfig(self, unboundedScale: float=1.0) ->None: r""" Samples a random configuration and updates the robot's pose. Properly handles non-normal joints and handles DOFs with infinite bounds using a centered Laplacian distribution with the given scaling term. Args: unboundedScale (float, optional): default value 1.0 .. note:: Python random module seeding does not affect the result. """ return _robotsim.RobotModel_randomizeConfig(self, unboundedScale)
[ "def", "randomizeConfig", "(", "self", ",", "unboundedScale", ":", "float", "=", "1.0", ")", "->", "None", ":", "return", "_robotsim", ".", "RobotModel_randomizeConfig", "(", "self", ",", "unboundedScale", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L5109-L5123
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Jinja2/py2/jinja2/runtime.py
python
Context.derived
(self, locals=None)
return context
Internal helper function to create a derived context. This is used in situations where the system needs a new context in the same template that is independent.
Internal helper function to create a derived context. This is used in situations where the system needs a new context in the same template that is independent.
[ "Internal", "helper", "function", "to", "create", "a", "derived", "context", ".", "This", "is", "used", "in", "situations", "where", "the", "system", "needs", "a", "new", "context", "in", "the", "same", "template", "that", "is", "independent", "." ]
def derived(self, locals=None): """Internal helper function to create a derived context. This is used in situations where the system needs a new context in the same template that is independent. """ context = new_context( self.environment, self.name, {}, self.get_all(), True, None, locals ) context.eval_ctx = self.eval_ctx context.blocks.update((k, list(v)) for k, v in iteritems(self.blocks)) return context
[ "def", "derived", "(", "self", ",", "locals", "=", "None", ")", ":", "context", "=", "new_context", "(", "self", ".", "environment", ",", "self", ".", "name", ",", "{", "}", ",", "self", ".", "get_all", "(", ")", ",", "True", ",", "None", ",", "l...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/runtime.py#L298-L308
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/ExportSpectraMask.py
python
writeISISmasks
(filename,masks,nSpectraInRow=8)
Function writes input array in the form of ISSI mask file array This is the helper function for export_mask procedure, which can be used separately namely, if one have array 1,2,3,4, 20, 30,31,32 file will have the following ASCII stings: 1-4 20 30-32 nSpectaInRow indicates the number of the separate spectra ID (numbers) which the program needs to fit into one row. For the example above the number has to be 5 or more to fit all spectra into a single row. Setting it to one will produce 8 rows with single number in each. Usage: >>writeISISmasks(fileName,masks) where: fileName -- the name of the output file masks -- the array with data
Function writes input array in the form of ISSI mask file array This is the helper function for export_mask procedure, which can be used separately
[ "Function", "writes", "input", "array", "in", "the", "form", "of", "ISSI", "mask", "file", "array", "This", "is", "the", "helper", "function", "for", "export_mask", "procedure", "which", "can", "be", "used", "separately" ]
def writeISISmasks(filename,masks,nSpectraInRow=8): """Function writes input array in the form of ISSI mask file array This is the helper function for export_mask procedure, which can be used separately namely, if one have array 1,2,3,4, 20, 30,31,32 file will have the following ASCII stings: 1-4 20 30-32 nSpectaInRow indicates the number of the separate spectra ID (numbers) which the program needs to fit into one row. For the example above the number has to be 5 or more to fit all spectra into a single row. Setting it to one will produce 8 rows with single number in each. Usage: >>writeISISmasks(fileName,masks) where: fileName -- the name of the output file masks -- the array with data """ ext = os.path.splitext(filename)[1] if len(ext) == 0 : filename=filename+'.msk' OutString = '' LastSpectraN= '' BlockSize = 0 iDash = 0 im1=masks[0] with open(filename,'w') as f: # prepare and write mask data in conventional msk format # where adjusted spectra are separated by "-" sign for i in masks: if len(OutString)== 0: OutString = str(i) (f,BlockSize,OutString) = flushOutString(f,OutString,BlockSize,nSpectraInRow) im1 = i continue # if the current spectra is different from the previous one by 1 only, we may want to skip it if im1+1 == i : LastSpectraN = str(i) iDash += 1 else : # it is different and should be dealt separately if iDash > 0 : OutString = OutString+'-'+LastSpectraN iDash = 0 LastSpectraN='' # write the string if it is finished (f,BlockSize,OutString) = flushOutString(f,OutString,BlockSize,nSpectraInRow) if len(OutString) == 0: OutString = str(i) else: OutString = OutString + ' ' + str(i) # write the string if it is finished (f,BlockSize,OutString) = flushOutString(f,OutString,BlockSize,nSpectraInRow) #endif # current spectra is the previous now im1 = i # end masks loop if iDash > 0 : OutString = OutString+'-'+LastSpectraN (f,OutString,BlockSize)=flushOutString(f,OutString,BlockSize,0)
[ "def", "writeISISmasks", "(", "filename", ",", "masks", ",", "nSpectraInRow", "=", "8", ")", ":", "ext", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", "if", "len", "(", "ext", ")", "==", "0", ":", "filename", "=", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/ExportSpectraMask.py#L98-L161
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
uCSIsHangulCompatibilityJamo
(code)
return ret
Check whether the character is part of HangulCompatibilityJamo UCS Block
Check whether the character is part of HangulCompatibilityJamo UCS Block
[ "Check", "whether", "the", "character", "is", "part", "of", "HangulCompatibilityJamo", "UCS", "Block" ]
def uCSIsHangulCompatibilityJamo(code): """Check whether the character is part of HangulCompatibilityJamo UCS Block """ ret = libxml2mod.xmlUCSIsHangulCompatibilityJamo(code) return ret
[ "def", "uCSIsHangulCompatibilityJamo", "(", "code", ")", ":", "ret", "=", "libxml2mod", ".", "xmlUCSIsHangulCompatibilityJamo", "(", "code", ")", "return", "ret" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L2571-L2575
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py
python
HighPage.set_color_sample
(self)
Set the color of the frame background to reflect the selected target. Instance variables accessed: theme_elements highlight_target fg_bg_toggle highlight_sample Attributes updated: frame_color_set
Set the color of the frame background to reflect the selected target.
[ "Set", "the", "color", "of", "the", "frame", "background", "to", "reflect", "the", "selected", "target", "." ]
def set_color_sample(self): """Set the color of the frame background to reflect the selected target. Instance variables accessed: theme_elements highlight_target fg_bg_toggle highlight_sample Attributes updated: frame_color_set """ # Set the color sample area. tag = self.theme_elements[self.highlight_target.get()][0] plane = 'foreground' if self.fg_bg_toggle.get() else 'background' color = self.highlight_sample.tag_cget(tag, plane) self.style.configure('frame_color_set.TFrame', background=color)
[ "def", "set_color_sample", "(", "self", ")", ":", "# Set the color sample area.", "tag", "=", "self", ".", "theme_elements", "[", "self", ".", "highlight_target", ".", "get", "(", ")", "]", "[", "0", "]", "plane", "=", "'foreground'", "if", "self", ".", "f...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py#L1224-L1240
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/linalg/_interpolative_backend.py
python
idd_frmi
(m)
return _id.idd_frmi(m)
Initialize data for :func:`idd_frm`. :param m: Length of vector to be transformed. :type m: int :return: Greatest power-of-two integer `n` satisfying `n <= m`. :rtype: int :return: Initialization array to be used by :func:`idd_frm`. :rtype: :class:`numpy.ndarray`
Initialize data for :func:`idd_frm`.
[ "Initialize", "data", "for", ":", "func", ":", "idd_frm", "." ]
def idd_frmi(m): """ Initialize data for :func:`idd_frm`. :param m: Length of vector to be transformed. :type m: int :return: Greatest power-of-two integer `n` satisfying `n <= m`. :rtype: int :return: Initialization array to be used by :func:`idd_frm`. :rtype: :class:`numpy.ndarray` """ return _id.idd_frmi(m)
[ "def", "idd_frmi", "(", "m", ")", ":", "return", "_id", ".", "idd_frmi", "(", "m", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/linalg/_interpolative_backend.py#L142-L157
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/file_util.py
python
eval_file
(src)
return eval(read_file(src), {'__builtins__': None}, None)
Loads and evaluates the contents of the specified file.
Loads and evaluates the contents of the specified file.
[ "Loads", "and", "evaluates", "the", "contents", "of", "the", "specified", "file", "." ]
def eval_file(src): """ Loads and evaluates the contents of the specified file. """ return eval(read_file(src), {'__builtins__': None}, None)
[ "def", "eval_file", "(", "src", ")", ":", "return", "eval", "(", "read_file", "(", "src", ")", ",", "{", "'__builtins__'", ":", "None", "}", ",", "None", ")" ]
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/file_util.py#L192-L194
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/indexes/base.py
python
Index.values
(self)
return self._data
Return an array representing the data in the Index. .. warning:: We recommend using :attr:`Index.array` or :meth:`Index.to_numpy`, depending on whether you need a reference to the underlying data or a NumPy array. Returns ------- array: numpy.ndarray or ExtensionArray See Also -------- Index.array : Reference to the underlying data. Index.to_numpy : A NumPy array representing the underlying data.
Return an array representing the data in the Index.
[ "Return", "an", "array", "representing", "the", "data", "in", "the", "Index", "." ]
def values(self) -> ArrayLike: """ Return an array representing the data in the Index. .. warning:: We recommend using :attr:`Index.array` or :meth:`Index.to_numpy`, depending on whether you need a reference to the underlying data or a NumPy array. Returns ------- array: numpy.ndarray or ExtensionArray See Also -------- Index.array : Reference to the underlying data. Index.to_numpy : A NumPy array representing the underlying data. """ return self._data
[ "def", "values", "(", "self", ")", "->", "ArrayLike", ":", "return", "self", ".", "_data" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L4348-L4367
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_misc.py
python
DateTime.FormatDate
(*args, **kwargs)
return _misc_.DateTime_FormatDate(*args, **kwargs)
FormatDate(self) -> String
FormatDate(self) -> String
[ "FormatDate", "(", "self", ")", "-", ">", "String" ]
def FormatDate(*args, **kwargs): """FormatDate(self) -> String""" return _misc_.DateTime_FormatDate(*args, **kwargs)
[ "def", "FormatDate", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "DateTime_FormatDate", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4166-L4168
google/earthenterprise
0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9
earth_enterprise/src/fusion/portableglobe/servers/stub_search.py
python
StubDatabase.ClearSearchTables
(self)
Clear search tables stub.
Clear search tables stub.
[ "Clear", "search", "tables", "stub", "." ]
def ClearSearchTables(self): """Clear search tables stub.""" self.search_tables_ = []
[ "def", "ClearSearchTables", "(", "self", ")", ":", "self", ".", "search_tables_", "=", "[", "]" ]
https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/stub_search.py#L25-L27
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Build.py
python
BuildContext.get_group_name
(self, g)
return ''
name for the group g (utility)
name for the group g (utility)
[ "name", "for", "the", "group", "g", "(", "utility", ")" ]
def get_group_name(self, g): """name for the group g (utility)""" if not isinstance(g, list): g = self.groups[g] for x in self.group_names: if id(self.group_names[x]) == id(g): return x return ''
[ "def", "get_group_name", "(", "self", ",", "g", ")", ":", "if", "not", "isinstance", "(", "g", ",", "list", ")", ":", "g", "=", "self", ".", "groups", "[", "g", "]", "for", "x", "in", "self", ".", "group_names", ":", "if", "id", "(", "self", "....
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Build.py#L630-L637
libornovax/master_thesis_code
6eca474ed3cae673afde010caef338cf7349f839
caffe/scripts/cpp_lint.py
python
ParseArguments
(args)
return filenames
Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint.
Parses the command line arguments.
[ "Parses", "the", "command", "line", "arguments", "." ]
def ParseArguments(args): """Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint. """ try: (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=', 'counting=', 'filter=', 'root=', 'linelength=', 'extensions=']) except getopt.GetoptError: PrintUsage('Invalid arguments.') verbosity = _VerboseLevel() output_format = _OutputFormat() filters = '' counting_style = '' for (opt, val) in opts: if opt == '--help': PrintUsage(None) elif opt == '--output': if val not in ('emacs', 'vs7', 'eclipse'): PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.') output_format = val elif opt == '--verbose': verbosity = int(val) elif opt == '--filter': filters = val if not filters: PrintCategories() elif opt == '--counting': if val not in ('total', 'toplevel', 'detailed'): PrintUsage('Valid counting options are total, toplevel, and detailed') counting_style = val elif opt == '--root': global _root _root = val elif opt == '--linelength': global _line_length try: _line_length = int(val) except ValueError: PrintUsage('Line length must be digits.') elif opt == '--extensions': global _valid_extensions try: _valid_extensions = set(val.split(',')) except ValueError: PrintUsage('Extensions must be comma separated list.') if not filenames: PrintUsage('No files were specified.') _SetOutputFormat(output_format) _SetVerboseLevel(verbosity) _SetFilters(filters) _SetCountingStyle(counting_style) return filenames
[ "def", "ParseArguments", "(", "args", ")", ":", "try", ":", "(", "opts", ",", "filenames", ")", "=", "getopt", ".", "getopt", "(", "args", ",", "''", ",", "[", "'help'", ",", "'output='", ",", "'verbose='", ",", "'counting='", ",", "'filter='", ",", ...
https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/caffe/scripts/cpp_lint.py#L4779-L4846
libornovax/master_thesis_code
6eca474ed3cae673afde010caef338cf7349f839
scripts/show_bb3txt_detections.py
python
DetectionBrowser.__init__
(self, path_detections, detections_mapping, confidence, path_gt=None, gt_mapping=None, path_datasets=None, path_pgp=None)
Input: path_detections: Path to the BB3TXT file with detections detections_mapping: Name of the mapping of the path_detections BB3TXT file confidence: Minimum confidence of a detection to be displayed path_gt: Path to the BB3TXT file with ground truth (optional) gt_mapping: Name of the mapping of the path_gt BB3TXT file (optional) path_datasets: Path to the "datasets" folder on this machine, replaces the path that is in the BB3TXT files if provided path_pgp: Path to the PGP file with image projection matrices and ground plane equations
Input: path_detections: Path to the BB3TXT file with detections detections_mapping: Name of the mapping of the path_detections BB3TXT file confidence: Minimum confidence of a detection to be displayed path_gt: Path to the BB3TXT file with ground truth (optional) gt_mapping: Name of the mapping of the path_gt BB3TXT file (optional) path_datasets: Path to the "datasets" folder on this machine, replaces the path that is in the BB3TXT files if provided path_pgp: Path to the PGP file with image projection matrices and ground plane equations
[ "Input", ":", "path_detections", ":", "Path", "to", "the", "BB3TXT", "file", "with", "detections", "detections_mapping", ":", "Name", "of", "the", "mapping", "of", "the", "path_detections", "BB3TXT", "file", "confidence", ":", "Minimum", "confidence", "of", "a",...
def __init__(self, path_detections, detections_mapping, confidence, path_gt=None, gt_mapping=None, path_datasets=None, path_pgp=None): """ Input: path_detections: Path to the BB3TXT file with detections detections_mapping: Name of the mapping of the path_detections BB3TXT file confidence: Minimum confidence of a detection to be displayed path_gt: Path to the BB3TXT file with ground truth (optional) gt_mapping: Name of the mapping of the path_gt BB3TXT file (optional) path_datasets: Path to the "datasets" folder on this machine, replaces the path that is in the BB3TXT files if provided path_pgp: Path to the PGP file with image projection matrices and ground plane equations """ super(DetectionBrowser, self).__init__() self.confidence = confidence self.path_datasets = path_datasets print('-- Loading detections: ' + path_detections) self.iml_detections = load_bb3txt(path_detections) self.detections_mapping = LMM.get_mapping(detections_mapping) self._create_file_list() if path_gt is not None and gt_mapping is not None: print('-- Loading ground truth: ' + path_gt) self.iml_gt = load_bb3txt(path_gt) self.gt_mapping = LMM.get_mapping(gt_mapping) else: self.iml_gt = None self.gt_mapping = None if path_pgp is not None: print('-- Loading PGP: ' + path_pgp) self.pgps = load_pgp(path_pgp) else: self.pgps = None # Initialize the cursor to the first image self.cursor = 0
[ "def", "__init__", "(", "self", ",", "path_detections", ",", "detections_mapping", ",", "confidence", ",", "path_gt", "=", "None", ",", "gt_mapping", "=", "None", ",", "path_datasets", "=", "None", ",", "path_pgp", "=", "None", ")", ":", "super", "(", "Det...
https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/scripts/show_bb3txt_detections.py#L61-L102
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/backends/_nnapi/serializer.py
python
_NnapiSerializer._do_add_binary
(self, node, opcode, fuse_code, *, qparams=None)
Helper for pointwise binary broadcast ops with superfluous extra args
Helper for pointwise binary broadcast ops with superfluous extra args
[ "Helper", "for", "pointwise", "binary", "broadcast", "ops", "with", "superfluous", "extra", "args" ]
def _do_add_binary(self, node, opcode, fuse_code, *, qparams=None): """Helper for pointwise binary broadcast ops with superfluous extra args""" assert node.outputsSize() == 1 assert node.inputsAt(0).type().kind() == "TensorType" assert node.inputsAt(1).type().kind() == "TensorType" if self.has_operand_for_jitval(node.inputsAt(0)): in0_id, in0_oper = self.get_tensor_operand_by_jitval(node.inputsAt(0)) in1_id, in1_oper = self.get_tensor_operand_or_constant(node.inputsAt(1), in0_oper.dim_order) elif self.has_operand_for_jitval(node.inputsAt(1)): in1_id, in1_oper = self.get_tensor_operand_by_jitval(node.inputsAt(1)) in0_id, in0_oper = self.get_tensor_operand_or_constant(node.inputsAt(0), in1_oper.dim_order) else: raise Exception(f"Can't do a NNAPI binary op: {opcode} on two constants") assert in0_oper.op_type == in1_oper.op_type in0_id, in0_oper, in1_id, in1_oper = self.transpose_for_broadcast( in0_id, in0_oper, in1_id, in1_oper) # NOTE: PyTorch and NNAPI have the same broadcast semantics. out_shape = broadcast_shapes(in0_oper.shape, in1_oper.shape) out_oper = in0_oper._replace(shape=out_shape) if qparams is not None: scale, zp = qparams out_oper = out_oper._replace(scale=scale, zero_point=zp) out_id = self.add_tensor_operand(node.outputsAt(0), out_oper) for idx, (d0, d1) in enumerate(zip(in0_oper.shape, in1_oper.shape)): if d0 == 1 and d1 == 0: self.forward_operand_shape(out_id, idx, in1_id, idx) elif d0 == 0 and d1 == 1: self.forward_operand_shape(out_id, idx, in0_id, idx) elif d0 == 0 and d1 == 0: self.flexible_shape_computation_lines.append( f"assert {flex_name(in0_id, idx)} == {flex_name(in1_id, idx)}" ) self.forward_operand_shape(out_id, idx, in0_id, idx) inputs = [None] * 3 inputs[0] = in0_id inputs[1] = in1_id inputs[2] = self.add_immediate_int_scalar(fuse_code) outputs = [None] * 1 outputs[0] = out_id self.add_operation(opcode, inputs, outputs)
[ "def", "_do_add_binary", "(", "self", ",", "node", ",", "opcode", ",", "fuse_code", ",", "*", ",", "qparams", "=", "None", ")", ":", "assert", "node", ".", "outputsSize", "(", ")", "==", "1", "assert", "node", ".", "inputsAt", "(", "0", ")", ".", "...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/backends/_nnapi/serializer.py#L1293-L1339
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/menus.py
python
MultiColumnCompletionMenuControl.preferred_width
(self, max_available_width: int)
return result + self._required_margin
Preferred width: prefer to use at least min_rows, but otherwise as much as possible horizontally.
Preferred width: prefer to use at least min_rows, but otherwise as much as possible horizontally.
[ "Preferred", "width", ":", "prefer", "to", "use", "at", "least", "min_rows", "but", "otherwise", "as", "much", "as", "possible", "horizontally", "." ]
def preferred_width(self, max_available_width: int) -> Optional[int]: """ Preferred width: prefer to use at least min_rows, but otherwise as much as possible horizontally. """ complete_state = get_app().current_buffer.complete_state if complete_state is None: return 0 column_width = self._get_column_width(complete_state) result = int( column_width * math.ceil(len(complete_state.completions) / float(self.min_rows)) ) # When the desired width is still more than the maximum available, # reduce by removing columns until we are less than the available # width. while ( result > column_width and result > max_available_width - self._required_margin ): result -= column_width return result + self._required_margin
[ "def", "preferred_width", "(", "self", ",", "max_available_width", ":", "int", ")", "->", "Optional", "[", "int", "]", ":", "complete_state", "=", "get_app", "(", ")", ".", "current_buffer", ".", "complete_state", "if", "complete_state", "is", "None", ":", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/menus.py#L350-L373
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_gdi.py
python
NativePixelData_Accessor.IsOk
(*args, **kwargs)
return _gdi_.NativePixelData_Accessor_IsOk(*args, **kwargs)
IsOk(self) -> bool
IsOk(self) -> bool
[ "IsOk", "(", "self", ")", "-", ">", "bool" ]
def IsOk(*args, **kwargs): """IsOk(self) -> bool""" return _gdi_.NativePixelData_Accessor_IsOk(*args, **kwargs)
[ "def", "IsOk", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "NativePixelData_Accessor_IsOk", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1121-L1123
apache/qpid-proton
6bcdfebb55ea3554bc29b1901422532db331a591
python/proton/_utils.py
python
SyncRequestResponse.on_message
(self, event: 'Event')
Called when we receive a message for our receiver. :param event: The event which occurs when a message is received.
Called when we receive a message for our receiver.
[ "Called", "when", "we", "receive", "a", "message", "for", "our", "receiver", "." ]
def on_message(self, event: 'Event') -> None: """ Called when we receive a message for our receiver. :param event: The event which occurs when a message is received. """ self.response = event.message self.connection.container.yield_()
[ "def", "on_message", "(", "self", ",", "event", ":", "'Event'", ")", "->", "None", ":", "self", ".", "response", "=", "event", ".", "message", "self", ".", "connection", ".", "container", ".", "yield_", "(", ")" ]
https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_utils.py#L633-L640
panda3d/panda3d
833ad89ebad58395d0af0b7ec08538e5e4308265
direct/src/actor/Actor.py
python
Actor.getGeomNode
(self)
return self.__geomNode
Return the node that contains all actor geometry
Return the node that contains all actor geometry
[ "Return", "the", "node", "that", "contains", "all", "actor", "geometry" ]
def getGeomNode(self): """ Return the node that contains all actor geometry """ return self.__geomNode
[ "def", "getGeomNode", "(", "self", ")", ":", "return", "self", ".", "__geomNode" ]
https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/actor/Actor.py#L623-L627
maidsafe-archive/MaidSafe
defd65e1c8cfb6a1cbdeaaa0eee31d065421792d
tools/cpplint.py
python
_BlockInfo.CheckBegin
(self, filename, clean_lines, linenum, error)
Run checks that applies to text up to the opening brace. This is mostly for checking the text after the class identifier and the "{", usually where the base class is specified. For other blocks, there isn't much to check, so we always pass. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Run checks that applies to text up to the opening brace.
[ "Run", "checks", "that", "applies", "to", "text", "up", "to", "the", "opening", "brace", "." ]
def CheckBegin(self, filename, clean_lines, linenum, error): """Run checks that applies to text up to the opening brace. This is mostly for checking the text after the class identifier and the "{", usually where the base class is specified. For other blocks, there isn't much to check, so we always pass. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found. """ pass
[ "def", "CheckBegin", "(", "self", ",", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "pass" ]
https://github.com/maidsafe-archive/MaidSafe/blob/defd65e1c8cfb6a1cbdeaaa0eee31d065421792d/tools/cpplint.py#L1374-L1387
verilog-to-routing/vtr-verilog-to-routing
d9719cf7374821156c3cee31d66991cb85578562
vtr_flow/scripts/run_vtr_flow.py
python
format_human_readable_memory
(num_kbytes)
return value
format the number of bytes given as a human readable value
format the number of bytes given as a human readable value
[ "format", "the", "number", "of", "bytes", "given", "as", "a", "human", "readable", "value" ]
def format_human_readable_memory(num_kbytes): """format the number of bytes given as a human readable value""" if num_kbytes < 1024: value = "%.2f KiB" % (num_kbytes) elif num_kbytes < (1024 ** 2): value = "%.2f MiB" % (num_kbytes / (1024 ** 1)) else: value = "%.2f GiB" % (num_kbytes / (1024 ** 2)) return value
[ "def", "format_human_readable_memory", "(", "num_kbytes", ")", ":", "if", "num_kbytes", "<", "1024", ":", "value", "=", "\"%.2f KiB\"", "%", "(", "num_kbytes", ")", "elif", "num_kbytes", "<", "(", "1024", "**", "2", ")", ":", "value", "=", "\"%.2f MiB\"", ...
https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/d9719cf7374821156c3cee31d66991cb85578562/vtr_flow/scripts/run_vtr_flow.py#L427-L435
v8/v8
fee3bf095260bf657a3eea4d3d41f90c42c6c857
tools/cppgc/gen_cmake.py
python
V8GNTransformer._Expr
(self, expr)
Post-order traverse expression trees
Post-order traverse expression trees
[ "Post", "-", "order", "traverse", "expression", "trees" ]
def _Expr(self, expr): 'Post-order traverse expression trees' if isinstance(expr, lark.Token): if expr.type == 'IDENTIFIER': return self.builder.BuildIdentifier(str(expr)) elif expr.type == 'INTEGER': return self.builder.BuildInteger(str(expr)) else: return self.builder.BuildString(str(expr)) if expr.data == 'par_expr': return self.builder.BuildParenthesizedOperation( self._Expr(*expr.children)) if expr.data not in OPS: raise UnsupportedOperation( f'The operator "{expr.data}" is not supported') if len(expr.children) == 1: return self._UnaryExpr(expr.data, *expr.children) if len(expr.children) == 2: return self._BinaryExpr(expr.data, *expr.children) raise UnsupportedOperation(f'Unsupported arity {len(expr.children)}')
[ "def", "_Expr", "(", "self", ",", "expr", ")", ":", "if", "isinstance", "(", "expr", ",", "lark", ".", "Token", ")", ":", "if", "expr", ".", "type", "==", "'IDENTIFIER'", ":", "return", "self", ".", "builder", ".", "BuildIdentifier", "(", "str", "(",...
https://github.com/v8/v8/blob/fee3bf095260bf657a3eea4d3d41f90c42c6c857/tools/cppgc/gen_cmake.py#L171-L190
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/dashboard/dashboard/utils.py
python
GetIpWhitelist
()
return stored_object.Get(IP_WHITELIST_KEY)
Returns a list of IP address strings in the whitelist.
Returns a list of IP address strings in the whitelist.
[ "Returns", "a", "list", "of", "IP", "address", "strings", "in", "the", "whitelist", "." ]
def GetIpWhitelist(): """Returns a list of IP address strings in the whitelist.""" return stored_object.Get(IP_WHITELIST_KEY)
[ "def", "GetIpWhitelist", "(", ")", ":", "return", "stored_object", ".", "Get", "(", "IP_WHITELIST_KEY", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/utils.py#L359-L361
larroy/clearskies_core
3574ddf0edc8555454c7044126e786a6c29444dc
tools/gyp/pylib/gyp/MSVSVersion.py
python
VisualStudioVersion.ProjectVersion
(self)
return self.project_version
Get the version number of the vcproj or vcxproj files.
Get the version number of the vcproj or vcxproj files.
[ "Get", "the", "version", "number", "of", "the", "vcproj", "or", "vcxproj", "files", "." ]
def ProjectVersion(self): """Get the version number of the vcproj or vcxproj files.""" return self.project_version
[ "def", "ProjectVersion", "(", "self", ")", ":", "return", "self", ".", "project_version" ]
https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/MSVSVersion.py#L43-L45
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_gdi.py
python
Font.GetStrikethrough
(*args, **kwargs)
return _gdi_.Font_GetStrikethrough(*args, **kwargs)
GetStrikethrough(self) -> bool
GetStrikethrough(self) -> bool
[ "GetStrikethrough", "(", "self", ")", "-", ">", "bool" ]
def GetStrikethrough(*args, **kwargs): """GetStrikethrough(self) -> bool""" return _gdi_.Font_GetStrikethrough(*args, **kwargs)
[ "def", "GetStrikethrough", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "Font_GetStrikethrough", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L2331-L2333
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
xmlDoc.freeDoc
(self)
Free up all the structures used by a document, tree included.
Free up all the structures used by a document, tree included.
[ "Free", "up", "all", "the", "structures", "used", "by", "a", "document", "tree", "included", "." ]
def freeDoc(self): """Free up all the structures used by a document, tree included. """ libxml2mod.xmlFreeDoc(self._o)
[ "def", "freeDoc", "(", "self", ")", ":", "libxml2mod", ".", "xmlFreeDoc", "(", "self", ".", "_o", ")" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L4283-L4286
Tencent/Pebble
68315f176d9e328a233ace29b7579a829f89879f
thirdparty/gflags/gflags.py
python
FlagValues.RegisteredFlags
(self)
return self.FlagDict().keys()
Returns: a list of the names and short names of all registered flags.
Returns: a list of the names and short names of all registered flags.
[ "Returns", ":", "a", "list", "of", "the", "names", "and", "short", "names", "of", "all", "registered", "flags", "." ]
def RegisteredFlags(self): """Returns: a list of the names and short names of all registered flags.""" return self.FlagDict().keys()
[ "def", "RegisteredFlags", "(", "self", ")", ":", "return", "self", ".", "FlagDict", "(", ")", ".", "keys", "(", ")" ]
https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/thirdparty/gflags/gflags.py#L1273-L1275
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
PhysicsTools/HeppyCore/python/utils/eostools.py
python
runEOSCommand
(path, cmd, *args)
return runner.runCommand(command)
Run an eos command. !!! Will, when the EOS command fails, it passes silently... I think we should really try and raise an exception in case of problems. should be possible as the return code is provided in the tuple returned by runner.
Run an eos command.
[ "Run", "an", "eos", "command", "." ]
def runEOSCommand(path, cmd, *args): """Run an eos command. !!! Will, when the EOS command fails, it passes silently... I think we should really try and raise an exception in case of problems. should be possible as the return code is provided in the tuple returned by runner.""" lfn = eosToLFN(path) pfn = lfnToPFN(lfn) tokens = cmsIO.splitPFN(pfn) #obviously, this is not nice command = [eos_select, cmd] command.extend(args) command.append(tokens[2]) runner = cmsIO.cmsFileManip() return runner.runCommand(command)
[ "def", "runEOSCommand", "(", "path", ",", "cmd", ",", "*", "args", ")", ":", "lfn", "=", "eosToLFN", "(", "path", ")", "pfn", "=", "lfnToPFN", "(", "lfn", ")", "tokens", "=", "cmsIO", ".", "splitPFN", "(", "pfn", ")", "#obviously, this is not nice", "c...
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/HeppyCore/python/utils/eostools.py#L39-L55
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py
python
Image.putpixel
(self, xy, value)
return self.im.putpixel(xy, value)
Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images. Note that this method is relatively slow. For more extensive changes, use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw` module instead. See: * :py:meth:`~PIL.Image.Image.paste` * :py:meth:`~PIL.Image.Image.putdata` * :py:mod:`~PIL.ImageDraw` :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :param value: The pixel value.
Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images.
[ "Modifies", "the", "pixel", "at", "the", "given", "position", ".", "The", "color", "is", "given", "as", "a", "single", "numerical", "value", "for", "single", "-", "band", "images", "and", "a", "tuple", "for", "multi", "-", "band", "images", ".", "In", ...
def putpixel(self, xy, value): """ Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P images. Note that this method is relatively slow. For more extensive changes, use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw` module instead. See: * :py:meth:`~PIL.Image.Image.paste` * :py:meth:`~PIL.Image.Image.putdata` * :py:mod:`~PIL.ImageDraw` :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :param value: The pixel value. """ if self.readonly: self._copy() self.load() if self.pyaccess: return self.pyaccess.putpixel(xy, value) if ( self.mode == "P" and isinstance(value, (list, tuple)) and len(value) in [3, 4] ): # RGB or RGBA value for a P image value = self.palette.getcolor(value) return self.im.putpixel(xy, value)
[ "def", "putpixel", "(", "self", ",", "xy", ",", "value", ")", ":", "if", "self", ".", "readonly", ":", "self", ".", "_copy", "(", ")", "self", ".", "load", "(", ")", "if", "self", ".", "pyaccess", ":", "return", "self", ".", "pyaccess", ".", "put...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py#L1684-L1720
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
driver/python/pysequoiadb/collection.py
python
collection.open_lob
(self, oid, mode=LOB_READ)
return obj
open the specified lob to read or write. Parameters: Name Type Info: oid str/bson.ObjectId The specified oid mode int The open mode: lob.LOB_READ lob.LOB_WRITE Return values: a lob object Exceptions: pysequoiadb.error.SDBBaseError
open the specified lob to read or write.
[ "open", "the", "specified", "lob", "to", "read", "or", "write", "." ]
def open_lob(self, oid, mode=LOB_READ): """open the specified lob to read or write. Parameters: Name Type Info: oid str/bson.ObjectId The specified oid mode int The open mode: lob.LOB_READ lob.LOB_WRITE Return values: a lob object Exceptions: pysequoiadb.error.SDBBaseError """ if not isinstance(oid, bson.ObjectId) and not isinstance(oid, str_type): raise SDBTypeError("oid must be bson.ObjectId or string") if isinstance(oid, bson.ObjectId): str_id = str(oid) else: str_id = oid if len(oid) != 24: raise SDBInvalidArgument(SDB_INVALIDARG, "invalid oid: '%s'" % oid) if not isinstance(mode, int): raise SDBTypeError("mode must be an instance of int") if mode != LOB_READ and mode != LOB_WRITE: raise SDBTypeError("mode must be lob.LOB_READ or lob.LOB_WRITE") obj = lob() try: rc = sdb.cl_open_lob(self._cl, obj._handle, str_id, mode) raise_if_error(rc, "Failed to get specified lob") except SDBBaseError: del obj raise return obj
[ "def", "open_lob", "(", "self", ",", "oid", ",", "mode", "=", "LOB_READ", ")", ":", "if", "not", "isinstance", "(", "oid", ",", "bson", ".", "ObjectId", ")", "and", "not", "isinstance", "(", "oid", ",", "str_type", ")", ":", "raise", "SDBTypeError", ...
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/collection.py#L1071-L1108
SpaceNetChallenge/BuildingDetectors
3def3c44b5847c744cd2f3356182892d92496579
qinhaifang/src/caffe-mnc/scripts/cpp_lint.py
python
CloseExpression
(clean_lines, linenum, pos)
return (line, clean_lines.NumLines(), -1)
If input points to ( or { or [ or <, finds the position that closes it. If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the linenum/pos that correspond to the closing of the expression. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. pos: A position on the line. Returns: A tuple (line, linenum, pos) pointer *past* the closing brace, or (line, len(lines), -1) if we never find a close. Note we ignore strings and comments when matching; and the line we return is the 'cleansed' line at linenum.
If input points to ( or { or [ or <, finds the position that closes it.
[ "If", "input", "points", "to", "(", "or", "{", "or", "[", "or", "<", "finds", "the", "position", "that", "closes", "it", "." ]
def CloseExpression(clean_lines, linenum, pos): """If input points to ( or { or [ or <, finds the position that closes it. If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the linenum/pos that correspond to the closing of the expression. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. pos: A position on the line. Returns: A tuple (line, linenum, pos) pointer *past* the closing brace, or (line, len(lines), -1) if we never find a close. Note we ignore strings and comments when matching; and the line we return is the 'cleansed' line at linenum. """ line = clean_lines.elided[linenum] startchar = line[pos] if startchar not in '({[<': return (line, clean_lines.NumLines(), -1) if startchar == '(': endchar = ')' if startchar == '[': endchar = ']' if startchar == '{': endchar = '}' if startchar == '<': endchar = '>' # Check first line (end_pos, num_open) = FindEndOfExpressionInLine( line, pos, 0, startchar, endchar) if end_pos > -1: return (line, linenum, end_pos) # Continue scanning forward while linenum < clean_lines.NumLines() - 1: linenum += 1 line = clean_lines.elided[linenum] (end_pos, num_open) = FindEndOfExpressionInLine( line, 0, num_open, startchar, endchar) if end_pos > -1: return (line, linenum, end_pos) # Did not find endchar before end of file, give up return (line, clean_lines.NumLines(), -1)
[ "def", "CloseExpression", "(", "clean_lines", ",", "linenum", ",", "pos", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "startchar", "=", "line", "[", "pos", "]", "if", "startchar", "not", "in", "'({[<'", ":", "return", "(", ...
https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/scripts/cpp_lint.py#L1254-L1297
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/dataview.py
python
DataViewModel.HasContainerColumns
(*args, **kwargs)
return _dataview.DataViewModel_HasContainerColumns(*args, **kwargs)
HasContainerColumns(self, DataViewItem item) -> bool Override this method to indicate if a container item merely acts as a headline (such as for categorisation) or if it also acts a normal item with entries for the other columns. The default implementation returns ``False``.
HasContainerColumns(self, DataViewItem item) -> bool
[ "HasContainerColumns", "(", "self", "DataViewItem", "item", ")", "-", ">", "bool" ]
def HasContainerColumns(*args, **kwargs): """ HasContainerColumns(self, DataViewItem item) -> bool Override this method to indicate if a container item merely acts as a headline (such as for categorisation) or if it also acts a normal item with entries for the other columns. The default implementation returns ``False``. """ return _dataview.DataViewModel_HasContainerColumns(*args, **kwargs)
[ "def", "HasContainerColumns", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewModel_HasContainerColumns", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L546-L554
spring/spring
553a21526b144568b608a0507674b076ec80d9f9
buildbot/stacktrace_translator/stacktrace_translator.py
python
get_modules
(dbgfile)
return files
returns a list of all available files in a 7z archive >>> get_modules(TESTFILE) ['AI/Interfaces/C/0.1/AIInterface.dbg', 'AI/Interfaces/Java/0.1/AIInterface.dbg', 'AI/Skirmish/AAI/0.9/SkirmishAI.dbg', 'AI/Skirmish/CircuitAI/stable/SkirmishAI.dbg', 'AI/Skirmish/CppTestAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/KAIK/0.13/SkirmishAI.dbg', 'AI/Skirmish/NullAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/Shard/dev/SkirmishAI.dbg', 'mapcompile.dbg', 'mapdecompile.dbg', 'spring.dbg', 'unitsync.dbg']
returns a list of all available files in a 7z archive >>> get_modules(TESTFILE) ['AI/Interfaces/C/0.1/AIInterface.dbg', 'AI/Interfaces/Java/0.1/AIInterface.dbg', 'AI/Skirmish/AAI/0.9/SkirmishAI.dbg', 'AI/Skirmish/CircuitAI/stable/SkirmishAI.dbg', 'AI/Skirmish/CppTestAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/KAIK/0.13/SkirmishAI.dbg', 'AI/Skirmish/NullAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/Shard/dev/SkirmishAI.dbg', 'mapcompile.dbg', 'mapdecompile.dbg', 'spring.dbg', 'unitsync.dbg']
[ "returns", "a", "list", "of", "all", "available", "files", "in", "a", "7z", "archive", ">>>", "get_modules", "(", "TESTFILE", ")", "[", "AI", "/", "Interfaces", "/", "C", "/", "0", ".", "1", "/", "AIInterface", ".", "dbg", "AI", "/", "Interfaces", "/...
def get_modules(dbgfile): ''' returns a list of all available files in a 7z archive >>> get_modules(TESTFILE) ['AI/Interfaces/C/0.1/AIInterface.dbg', 'AI/Interfaces/Java/0.1/AIInterface.dbg', 'AI/Skirmish/AAI/0.9/SkirmishAI.dbg', 'AI/Skirmish/CircuitAI/stable/SkirmishAI.dbg', 'AI/Skirmish/CppTestAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/KAIK/0.13/SkirmishAI.dbg', 'AI/Skirmish/NullAI/0.1/SkirmishAI.dbg', 'AI/Skirmish/Shard/dev/SkirmishAI.dbg', 'mapcompile.dbg', 'mapdecompile.dbg', 'spring.dbg', 'unitsync.dbg'] ''' sevenzip = Popen([SEVENZIP, 'l', dbgfile], stdout = PIPE, stderr = PIPE, universal_newlines=True) stdout, stderr = sevenzip.communicate() if stderr: log.debug('%s stderr: %s' % (SEVENZIP, stderr)) if sevenzip.returncode != 0: fatal('%s exited with status %s %s %s' % (SEVENZIP, sevenzip.returncode, stdout, stderr)) files = [] for line in stdout.split('\n'): match = re.match("^.* ([a-zA-Z\/0-9\.]+dbg)$", line) if match: files.append(match.group(1)) return files
[ "def", "get_modules", "(", "dbgfile", ")", ":", "sevenzip", "=", "Popen", "(", "[", "SEVENZIP", ",", "'l'", ",", "dbgfile", "]", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ",", "universal_newlines", "=", "True", ")", "stdout", ",", "stderr...
https://github.com/spring/spring/blob/553a21526b144568b608a0507674b076ec80d9f9/buildbot/stacktrace_translator/stacktrace_translator.py#L209-L227
aimerykong/Low-Rank-Bilinear-Pooling
487eb2c857fd9c95357a5166b0c15ad0fe135b28
caffe-20160312/scripts/cpp_lint.py
python
_NestingState.InnermostClass
(self)
return None
Get class info on the top of the stack. Returns: A _ClassInfo object if we are inside a class, or None otherwise.
Get class info on the top of the stack.
[ "Get", "class", "info", "on", "the", "top", "of", "the", "stack", "." ]
def InnermostClass(self): """Get class info on the top of the stack. Returns: A _ClassInfo object if we are inside a class, or None otherwise. """ for i in range(len(self.stack), 0, -1): classinfo = self.stack[i - 1] if isinstance(classinfo, _ClassInfo): return classinfo return None
[ "def", "InnermostClass", "(", "self", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "stack", ")", ",", "0", ",", "-", "1", ")", ":", "classinfo", "=", "self", ".", "stack", "[", "i", "-", "1", "]", "if", "isinstance", "(", ...
https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L2160-L2170
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/boost/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py
python
in_comment
(regex)
return '^[ \t]*//[ \t]*' + regex + '[ \t]*$'
Builds a regex matching "regex" in a comment
Builds a regex matching "regex" in a comment
[ "Builds", "a", "regex", "matching", "regex", "in", "a", "comment" ]
def in_comment(regex): """Builds a regex matching "regex" in a comment""" return '^[ \t]*//[ \t]*' + regex + '[ \t]*$'
[ "def", "in_comment", "(", "regex", ")", ":", "return", "'^[ \\t]*//[ \\t]*'", "+", "regex", "+", "'[ \\t]*$'" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L45-L47
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/operator.py
python
pos
(a)
return +a
Same as +a.
Same as +a.
[ "Same", "as", "+", "a", "." ]
def pos(a): "Same as +a." return +a
[ "def", "pos", "(", "a", ")", ":", "return", "+", "a" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/operator.py#L120-L122
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/distutils/misc_util.py
python
filter_sources
(sources)
return c_sources, cxx_sources, f_sources, fmodule_sources
Return four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively.
Return four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively.
[ "Return", "four", "lists", "of", "filenames", "containing", "C", "C", "++", "Fortran", "and", "Fortran", "90", "module", "sources", "respectively", "." ]
def filter_sources(sources): """Return four lists of filenames containing C, C++, Fortran, and Fortran 90 module sources, respectively. """ c_sources = [] cxx_sources = [] f_sources = [] fmodule_sources = [] for source in sources: if fortran_ext_match(source): modules = _get_f90_modules(source) if modules: fmodule_sources.append(source) else: f_sources.append(source) elif cxx_ext_match(source): cxx_sources.append(source) else: c_sources.append(source) return c_sources, cxx_sources, f_sources, fmodule_sources
[ "def", "filter_sources", "(", "sources", ")", ":", "c_sources", "=", "[", "]", "cxx_sources", "=", "[", "]", "f_sources", "=", "[", "]", "fmodule_sources", "=", "[", "]", "for", "source", "in", "sources", ":", "if", "fortran_ext_match", "(", "source", ")...
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/misc_util.py#L460-L480
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_controls.py
python
ScrollBar.IsVertical
(*args, **kwargs)
return _controls_.ScrollBar_IsVertical(*args, **kwargs)
IsVertical(self) -> bool
IsVertical(self) -> bool
[ "IsVertical", "(", "self", ")", "-", ">", "bool" ]
def IsVertical(*args, **kwargs): """IsVertical(self) -> bool""" return _controls_.ScrollBar_IsVertical(*args, **kwargs)
[ "def", "IsVertical", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "ScrollBar_IsVertical", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L2172-L2174
D-X-Y/caffe-faster-rcnn
eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb
scripts/cpp_lint.py
python
CheckForFunctionLengths
(filename, clean_lines, linenum, function_state, error)
Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. Only checks unindented functions, so class members are unchecked. Trivial bodies are unchecked, so constructors with huge initializer lists may be missed. Blank/comment lines are not counted so as to avoid encouraging the removal of vertical space and comments just to get through a lint check. NOLINT *on the last line of a function* disables this check. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. function_state: Current function name and lines in body so far. error: The function to call with any errors found.
Reports for long function bodies.
[ "Reports", "for", "long", "function", "bodies", "." ]
def CheckForFunctionLengths(filename, clean_lines, linenum, function_state, error): """Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. Only checks unindented functions, so class members are unchecked. Trivial bodies are unchecked, so constructors with huge initializer lists may be missed. Blank/comment lines are not counted so as to avoid encouraging the removal of vertical space and comments just to get through a lint check. NOLINT *on the last line of a function* disables this check. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. function_state: Current function name and lines in body so far. error: The function to call with any errors found. """ lines = clean_lines.lines line = lines[linenum] raw = clean_lines.raw_lines raw_line = raw[linenum] joined_line = '' starting_func = False regexp = r'(\w(\w|::|\*|\&|\s)*)\(' # decls * & space::name( ... match_result = Match(regexp, line) if match_result: # If the name is all caps and underscores, figure it's a macro and # ignore it, unless it's TEST or TEST_F. function_name = match_result.group(1).split()[-1] if function_name == 'TEST' or function_name == 'TEST_F' or ( not Match(r'[A-Z_]+$', function_name)): starting_func = True if starting_func: body_found = False for start_linenum in xrange(linenum, clean_lines.NumLines()): start_line = lines[start_linenum] joined_line += ' ' + start_line.lstrip() if Search(r'(;|})', start_line): # Declarations and trivial functions body_found = True break # ... ignore elif Search(r'{', start_line): body_found = True function = Search(r'((\w|:)*)\(', line).group(1) if Match(r'TEST', function): # Handle TEST... macros parameter_regexp = Search(r'(\(.*\))', joined_line) if parameter_regexp: # Ignore bad syntax function += parameter_regexp.group(1) else: function += '()' function_state.Begin(function) break if not body_found: # No body for the function (or evidence of a non-function) was found. error(filename, linenum, 'readability/fn_size', 5, 'Lint failed to find start of function body.') elif Match(r'^\}\s*$', line): # function end function_state.Check(error, filename, linenum) function_state.End() elif not Match(r'^\s*$', line): function_state.Count()
[ "def", "CheckForFunctionLengths", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "function_state", ",", "error", ")", ":", "lines", "=", "clean_lines", ".", "lines", "line", "=", "lines", "[", "linenum", "]", "raw", "=", "clean_lines", ".", "raw_l...
https://github.com/D-X-Y/caffe-faster-rcnn/blob/eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb/scripts/cpp_lint.py#L2388-L2455
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/pool.py
python
Pool.map
(self, func, iterable, chunksize=None)
return self.map_async(func, iterable, chunksize).get()
Equivalent of `map()` builtin
Equivalent of `map()` builtin
[ "Equivalent", "of", "map", "()", "builtin" ]
def map(self, func, iterable, chunksize=None): ''' Equivalent of `map()` builtin ''' assert self._state == RUN return self.map_async(func, iterable, chunksize).get()
[ "def", "map", "(", "self", ",", "func", ",", "iterable", ",", "chunksize", "=", "None", ")", ":", "assert", "self", ".", "_state", "==", "RUN", "return", "self", ".", "map_async", "(", "func", ",", "iterable", ",", "chunksize", ")", ".", "get", "(", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/multiprocessing/pool.py#L245-L250
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/isapi/simple.py
python
SimpleFilter.TerminateFilter
(self, status)
Called by the ISAPI framework as the filter terminates.
Called by the ISAPI framework as the filter terminates.
[ "Called", "by", "the", "ISAPI", "framework", "as", "the", "filter", "terminates", "." ]
def TerminateFilter(self, status): """Called by the ISAPI framework as the filter terminates. """ pass
[ "def", "TerminateFilter", "(", "self", ",", "status", ")", ":", "pass" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/isapi/simple.py#L65-L68
DmitryUlyanov/Multicore-TSNE
443731a47134d14653cfea526227a27cc3b38702
tsne-embedding.py
python
imscatter
(images, positions)
return scatter_image
Creates a scatter plot, where each plot is shown by corresponding image
Creates a scatter plot, where each plot is shown by corresponding image
[ "Creates", "a", "scatter", "plot", "where", "each", "plot", "is", "shown", "by", "corresponding", "image" ]
def imscatter(images, positions): ''' Creates a scatter plot, where each plot is shown by corresponding image ''' positions = np.array(positions) bottoms = positions[:, 1] - np.array([im.shape[1] / 2.0 for im in images]) tops = bottoms + np.array([im.shape[1] for im in images]) lefts = positions[:, 0] - np.array([im.shape[0] / 2.0 for im in images]) rigths = lefts + np.array([im.shape[0] for im in images]) most_bottom = int(np.floor(bottoms.min())) most_top = int(np.ceil(tops.max())) most_left = int(np.floor(lefts.min())) most_right = int(np.ceil(rigths.max())) scatter_image = np.zeros( [most_right - most_left, most_top - most_bottom, 3], dtype=imgs[0].dtype) # shift, now all from zero positions -= [most_left, most_bottom] for im, pos in zip(images, positions): xl = int(pos[0] - im.shape[0] / 2) xr = xl + im.shape[0] yb = int(pos[1] - im.shape[1] / 2) yt = yb + im.shape[1] scatter_image[xl:xr, yb:yt, :] = im return scatter_image
[ "def", "imscatter", "(", "images", ",", "positions", ")", ":", "positions", "=", "np", ".", "array", "(", "positions", ")", "bottoms", "=", "positions", "[", ":", ",", "1", "]", "-", "np", ".", "array", "(", "[", "im", ".", "shape", "[", "1", "]"...
https://github.com/DmitryUlyanov/Multicore-TSNE/blob/443731a47134d14653cfea526227a27cc3b38702/tsne-embedding.py#L9-L42
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/factorization/python/ops/gmm_ops.py
python
GmmAlgorithm._define_diag_covariance_probs
(self, shard_id, shard)
Defines the diagonal covariance probabilities per example in a class. Args: shard_id: id of the current shard. shard: current data shard, 1 X num_examples X dimensions. Returns a matrix num_examples * num_classes.
Defines the diagonal covariance probabilities per example in a class.
[ "Defines", "the", "diagonal", "covariance", "probabilities", "per", "example", "in", "a", "class", "." ]
def _define_diag_covariance_probs(self, shard_id, shard): """Defines the diagonal covariance probabilities per example in a class. Args: shard_id: id of the current shard. shard: current data shard, 1 X num_examples X dimensions. Returns a matrix num_examples * num_classes. """ # num_classes X 1 # TODO(xavigonzalvo): look into alternatives to log for # reparametrization of variance parameters. det_expanded = tf.reduce_sum(tf.log(self._covs + 1e-3), 1, keep_dims=True) diff = shard - self._means x2 = tf.square(diff) cov_expanded = tf.expand_dims(1.0 / (self._covs + 1e-3), 2) # num_classes X num_examples x2_cov = tf.batch_matmul(x2, cov_expanded) x2_cov = tf.transpose(tf.squeeze(x2_cov, [2])) self._probs[shard_id] = -0.5 * ( tf.to_float(self._dimensions) * tf.log(2.0 * np.pi) + tf.transpose(det_expanded) + x2_cov)
[ "def", "_define_diag_covariance_probs", "(", "self", ",", "shard_id", ",", "shard", ")", ":", "# num_classes X 1", "# TODO(xavigonzalvo): look into alternatives to log for", "# reparametrization of variance parameters.", "det_expanded", "=", "tf", ".", "reduce_sum", "(", "tf", ...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L241-L263
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/models/transaction.py
python
Transaction.tx
(self)
return self._tx
Gets the tx of this Transaction. # noqa: E501 :return: The tx of this Transaction. # noqa: E501 :rtype: str
Gets the tx of this Transaction. # noqa: E501
[ "Gets", "the", "tx", "of", "this", "Transaction", ".", "#", "noqa", ":", "E501" ]
def tx(self): """Gets the tx of this Transaction. # noqa: E501 :return: The tx of this Transaction. # noqa: E501 :rtype: str """ return self._tx
[ "def", "tx", "(", "self", ")", ":", "return", "self", ".", "_tx" ]
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/transaction.py#L275-L282
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py
python
Checkbutton.select
(self)
Put the button in on-state.
Put the button in on-state.
[ "Put", "the", "button", "in", "on", "-", "state", "." ]
def select(self): """Put the button in on-state.""" self.tk.call(self._w, 'select')
[ "def", "select", "(", "self", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'select'", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L2656-L2658
baldurk/renderdoc
ec5c14dee844b18dc545b52c4bd705ae20cba5d7
docs/pycharm_helpers/plugins/python-ce/helpers/generator3/module_redeclarator.py
python
ModuleRedeclarator.output_import_froms
(self, out, imports_list)
Mention all imported names known within the module, wrapping as per PEP.
Mention all imported names known within the module, wrapping as per PEP.
[ "Mention", "all", "imported", "names", "known", "within", "the", "module", "wrapping", "as", "per", "PEP", "." ]
def output_import_froms(self, out, imports_list): """Mention all imported names known within the module, wrapping as per PEP.""" if imports_list: self.add_import_header_if_needed() for mod_name in sorted_no_case(imports_list.keys()): import_names = imports_list[mod_name] if mod_name == '.': # if this is a local import, we need to treat it specially to import # the class inside the referenced module for n in import_names: out(0, "from .%s import %s" % (n, n)) # empty line after group out(0, "") # empty line after group elif import_names: self._defined[mod_name] = True right_pos = 0 # tracks width of list to fold it at right margin import_heading = "from % s import (" % mod_name right_pos += len(import_heading) names_pack = [import_heading] indent_level = 0 import_names = list(import_names) import_names.sort() for n in import_names: self._defined[n] = True len_n = len(n) if right_pos + len_n >= 78: out(indent_level, *names_pack) names_pack = [n, ", "] if indent_level == 0: indent_level = 1 # all but first line is indented right_pos = self.indent_size + len_n + 2 else: names_pack.append(n) names_pack.append(", ") right_pos += (len_n + 2) # last line is... if indent_level == 0: # one line names_pack[0] = names_pack[0][:-1] # cut off lpar names_pack[-1] = "" # cut last comma else: # last line of multiline names_pack[-1] = ")" # last comma -> rpar out(indent_level, *names_pack) out(0, "")
[ "def", "output_import_froms", "(", "self", ",", "out", ",", "imports_list", ")", ":", "if", "imports_list", ":", "self", ".", "add_import_header_if_needed", "(", ")", "for", "mod_name", "in", "sorted_no_case", "(", "imports_list", ".", "keys", "(", ")", ")", ...
https://github.com/baldurk/renderdoc/blob/ec5c14dee844b18dc545b52c4bd705ae20cba5d7/docs/pycharm_helpers/plugins/python-ce/helpers/generator3/module_redeclarator.py#L1277-L1319
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
KeyboardState.ShiftDown
(*args, **kwargs)
return _core_.KeyboardState_ShiftDown(*args, **kwargs)
ShiftDown(self) -> bool Returns ``True`` if the Shift key was down at the time of the event.
ShiftDown(self) -> bool
[ "ShiftDown", "(", "self", ")", "-", ">", "bool" ]
def ShiftDown(*args, **kwargs): """ ShiftDown(self) -> bool Returns ``True`` if the Shift key was down at the time of the event. """ return _core_.KeyboardState_ShiftDown(*args, **kwargs)
[ "def", "ShiftDown", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "KeyboardState_ShiftDown", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L4345-L4351
baidu/lac
3e10dbed9bfd87bea927c84a6627a167c17b5617
python/LAC/nets.py
python
do_train
(args, dataset, segment_tool)
return test_program, train_ret['crf_decode']
执行训练过程 Args: args: DefaultArgs对象,在utils.py中定义, 存储模型训练的所有参数, Returns: 训练产出的program及模型输出变量
执行训练过程
[ "执行训练过程" ]
def do_train(args, dataset, segment_tool): """执行训练过程 Args: args: DefaultArgs对象,在utils.py中定义, 存储模型训练的所有参数, Returns: 训练产出的program及模型输出变量 """ train_program = fluid.Program() startup_program = fluid.Program() # init executor if args.use_cuda: place = fluid.CUDAPlace(int(os.getenv('FLAGS_selected_gpus', '0'))) dev_count = fluid.core.get_cuda_device_count() else: dev_count = min(multiprocessing.cpu_count(), args.cpu_num) os.environ['CPU_NUM'] = str(dev_count) place = fluid.CPUPlace() dataset.args = args dataset.dev_count = dev_count dataset.segment_tool = segment_tool with fluid.program_guard(train_program, startup_program): train_program.random_seed = args.random_seed startup_program.random_seed = args.random_seed with fluid.unique_name.guard(): train_ret = create_model( args, dataset.vocab_size, dataset.num_labels, mode='train') test_program = train_program.clone(for_test=True) optimizer = fluid.optimizer.Adam( learning_rate=args.base_learning_rate) optimizer.minimize(train_ret["avg_cost"]) train_reader = create_pyreader(args, file_name=args.train_data, feed_list=train_ret['feed_list'], place=place, reader=dataset) if args.test_data: test_reader = create_pyreader(args, file_name=args.test_data, feed_list=train_ret['feed_list'], place=place, reader=dataset, iterable=True) exe = fluid.Executor(place) exe.run(startup_program) if args.init_checkpoint: utils.init_pretraining_params(exe, args.init_checkpoint, train_program) if args.test_data: test_process(exe, test_program, test_reader, train_ret) if dev_count > 1: # multi cpu/gpu config exec_strategy = fluid.ExecutionStrategy() build_strategy = fluid.compiler.BuildStrategy() compiled_prog = fluid.compiler.CompiledProgram(train_program).with_data_parallel( loss_name=train_ret['avg_cost'].name, build_strategy=build_strategy, exec_strategy=exec_strategy ) else: compiled_prog = fluid.compiler.CompiledProgram(train_program) fetch_list = [] for epoch_id in range(args.epoch): for data in train_reader(): outputs = exe.run( compiled_prog, fetch_list=fetch_list, feed=data[0], ) if args.test_data: test_process(exe, test_program, test_reader, train_ret) return test_program, train_ret['crf_decode']
[ "def", "do_train", "(", "args", ",", "dataset", ",", "segment_tool", ")", ":", "train_program", "=", "fluid", ".", "Program", "(", ")", "startup_program", "=", "fluid", ".", "Program", "(", ")", "# init executor", "if", "args", ".", "use_cuda", ":", "place...
https://github.com/baidu/lac/blob/3e10dbed9bfd87bea927c84a6627a167c17b5617/python/LAC/nets.py#L276-L359
epiqc/ScaffCC
66a79944ee4cd116b27bc1a69137276885461db8
clang/bindings/python/clang/cindex.py
python
Cursor.is_converting_constructor
(self)
return conf.lib.clang_CXXConstructor_isConvertingConstructor(self)
Returns True if the cursor refers to a C++ converting constructor.
Returns True if the cursor refers to a C++ converting constructor.
[ "Returns", "True", "if", "the", "cursor", "refers", "to", "a", "C", "++", "converting", "constructor", "." ]
def is_converting_constructor(self): """Returns True if the cursor refers to a C++ converting constructor. """ return conf.lib.clang_CXXConstructor_isConvertingConstructor(self)
[ "def", "is_converting_constructor", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_CXXConstructor_isConvertingConstructor", "(", "self", ")" ]
https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/clang/bindings/python/clang/cindex.py#L1450-L1453
nasa/fprime
595cf3682d8365943d86c1a6fe7c78f0a116acf0
Autocoders/Python/src/fprime_ac/models/CompFactory.py
python
CompFactory.create
( self, the_parsed_component_xml, parsed_port_xml_list, parsed_serializable_list )
return the_component
Create a component model here.
Create a component model here.
[ "Create", "a", "component", "model", "here", "." ]
def create( self, the_parsed_component_xml, parsed_port_xml_list, parsed_serializable_list ): """ Create a component model here. """ x = the_parsed_component_xml comp_obj = x.get_component() comp_port_obj_list = x.get_ports() comp_command_obj_list = x.get_commands() comp_channel_obj_list = x.get_channels() comp_parameter_obj_list = x.get_parameters() comp_event_obj_list = x.get_events() comp_internal_interface_obj_list = x.get_internal_interfaces() comp_included_enums_list = x.get_enum_type_files() # comp_namespace = comp_obj.get_namespace() comp_name = comp_obj.get_name() comp_kind = comp_obj.get_kind() comp_comment = comp_obj.get_comment() comp_modeler = comp_obj.get_modeler() if comp_namespace is None: comp_full_name = comp_name else: comp_full_name = comp_namespace + "::" + comp_name # get original filename here... comp_xml_filename = x.get_xml_filename() # comp_xml_port_files = x.get_port_type_files() comp_c_header_files = x.get_header_files() has_guarded_ports = False num_async_ports = 0 num_sync_ports = 0 # includes guarded ports # # print ("Component: %s"%comp_name) incl_list = [] # # Create list of ports with all ports of the component. # port_obj_list = [] for port_obj in comp_port_obj_list: n = port_obj.get_name() t = port_obj.get_type() d = port_obj.get_direction() s = port_obj.get_sync() r = port_obj.get_role() if s == "sync" or s == "guarded": num_sync_ports += 1 if s == "async": num_async_ports += 1 p = port_obj.get_priority() if s == "guarded": has_guarded_ports = True c = port_obj.get_comment() m = port_obj.get_max_number() f = port_obj.get_full() port_obj_list.append(Port.Port(n, t, d, s, p, f, c, max_number=m, role=r)) command_obj_list = [] for command_obj in comp_command_obj_list: m = command_obj.get_mnemonic() o = command_obj.get_opcodes() s = command_obj.get_sync() p = command_obj.get_priority() f = command_obj.get_full() if s == "guarded": has_guarded_ports = True if s == "sync" or s == "guarded": num_sync_ports += 1 if s == "async": num_async_ports += 1 c = command_obj.get_comment() arg_obj_list = [] for a in command_obj.get_args(): name = a.get_name() atype = a.get_type() comment = a.get_comment() size = a.get_size() arg_obj_list.append(Arg.Arg(name, atype, None, size, comment)) command_obj_list.append( Command.Command( m, o, arg_obj_list, s, p, c, comp_xml_filename, comp_full_name, component_base_name=comp_name, base_opcode=command_obj.get_base_opcode(), full=f, ) ) channel_obj_list = [] for channel_obj in comp_channel_obj_list: i = channel_obj.get_ids() n = channel_obj.get_name() t = channel_obj.get_type() s = channel_obj.get_size() c = channel_obj.get_comment() a = channel_obj.get_abbrev() f = channel_obj.get_format_string() u = channel_obj.get_update() l = channel_obj.get_limits() channel_obj_list.append( Channel.Channel( ids=i, name=n, ctype=t, size=s, abbrev=a, format_string=f, update=u, limits=l, comment=c, xml_filename=comp_xml_filename, component_name=comp_full_name, component_base_name=comp_name, ) ) event_obj_list = [] for event_obj in comp_event_obj_list: i = event_obj.get_ids() n = event_obj.get_name() s = event_obj.get_severity() f = event_obj.get_format_string() t = event_obj.get_throttle() c = event_obj.get_comment() arg_obj_list = [] for a in event_obj.get_args(): name = a.get_name() atype = a.get_type() size = a.get_size() comment = a.get_comment() arg_obj_list.append(Arg.Arg(name, atype, None, size, comment)) event_obj_list.append( Event.Event( i, n, s, f, t, arg_obj_list, c, comp_xml_filename, comp_full_name, component_base_name=comp_name, ) ) internal_interface_obj_list = [] for internal_interface_obj in comp_internal_interface_obj_list: # borrow this for check num_async_ports += 1 n = internal_interface_obj.get_name() p = internal_interface_obj.get_priority() f = internal_interface_obj.get_full() c = internal_interface_obj.get_comment() arg_obj_list = [] for a in internal_interface_obj.get_args(): name = a.get_name() atype = a.get_type() size = a.get_size() comment = a.get_comment() arg_obj_list.append(Arg.Arg(name, atype, None, size, comment)) internal_interface_obj_list.append( InternalInterface.InternalInterface( n, p, f, arg_obj_list, c, comp_xml_filename, comp_full_name ) ) parameter_obj_list = [] for parameter_obj in comp_parameter_obj_list: i = parameter_obj.get_ids() n = parameter_obj.get_name() t = parameter_obj.get_type() set_ops = parameter_obj.get_set_opcodes() save_ops = parameter_obj.get_save_opcodes() d = parameter_obj.get_default() s = parameter_obj.get_size() c = parameter_obj.get_comment() parameter_obj_list.append( Parameter.Parameter( i, n, t, set_ops, save_ops, d, s, c, comp_xml_filename, comp_full_name, base_setop=parameter_obj.get_base_setop(), base_saveop=parameter_obj.get_base_saveop(), ) ) serializable_obj_list = [] for serializable_obj in parsed_serializable_list: f = serializable_obj.get_xml_filename() n = serializable_obj.get_name() ns = serializable_obj.get_namespace() c = serializable_obj.get_comment() x = serializable_obj.get_includes() # shouldn't be c includes m = serializable_obj.get_members() t = serializable_obj.get_typeid() serializable_obj_list.append( Serialize.Serialize(f, n, ns, c, x, None, m, t) ) # # Check here to make sure all the port types in the component XML # exist in the port XMLs # interface_xml_list = [ parsed_port_obj.get_interface().get_name() for parsed_port_obj in parsed_port_xml_list ] for port_obj in port_obj_list: t = port_obj.get_type() ## Skip if special port. (If there role) ## Namespaces for special ports are set above if ( (t not in interface_xml_list) and (t.lower() != "serial") and (port_obj.get_role() is None) ): PRINT.info( "ERROR: Missing port type definition in component XML (name: %s, type: %s)" % (port_obj.get_name(), t) ) sys.exit(-1) # # Check here to make sure all the port types in the component XML # exist in the port XMLs # # interface_xml_list = [parsed_command_obj.get_interface().get_name() for parsed_command_obj in parsed_command_xml_list] # print interface_xml_list # for command_obj in command_obj_list: # t = command_obj.get_type() # if (t not in interface_xml_list): # PRINT.info("ERROR: Missing command type definition in component XML (name: %s, type: %s)" % (command_obj.get_type(),t)) # sys.exit(-1) # # # Add port type specifics to port object. # Specifics are things like: args, includes, etc. for port_obj in port_obj_list: for parsed_port_obj in parsed_port_xml_list: # print "Meta: Name: %s, Type: %s" % (port_obj.get_name(), port_obj.get_type()) # print "Meta: Port Type: %s, Port Interface: %s" % (port_obj.get_type(),parsed_port_obj.get_interface().get_name()) if port_obj.get_type() == parsed_port_obj.get_interface().get_name(): arg_obj_list = [] incl_list = parsed_port_obj.get_include_header_files() namespace = parsed_port_obj.get_interface().get_namespace() if_comment = parsed_port_obj.get_interface().get_comment() return_type = parsed_port_obj.get_interface().get_return_type() return_modifier = ( parsed_port_obj.get_interface().get_return_modifier() ) for a in parsed_port_obj.get_args(): name = a.get_name() atype = a.get_type() comment = a.get_comment() modifier = a.get_modifier() size = a.get_size() arg_obj_list.append( Arg.Arg(name, atype, modifier, size, comment) ) port_obj.set( namespace, arg_obj_list, incl_list, None, None, if_comment ) port_obj.set_return(return_type, return_modifier) # check some rules # 1) No return values for async ports if (port_obj.get_sync() == "async") and (return_type is not None): PRINT.info( 'ERROR: %s: Port "%s" cannot be asynchronous and have a return value' % ( the_parsed_component_xml.get_xml_filename(), port_obj.get_name(), ) ) sys.exit(-1) # 2) Serial ports can't have roles if (port_obj.get_type() == "Serial") and ( port_obj.get_role() is not None ): PRINT.info( 'ERROR: %s: Port "%s" cannot have a role and be a serialized port' % ( the_parsed_component_xml.get_xml_filename(), port_obj.get_name(), ) ) sys.exit(-1) # check some component/port rules # 1) Active or queued need at least one async port/command if (comp_kind == "active") or (comp_kind == "queued"): if num_async_ports == 0 and len(parameter_obj_list) == 0: PRINT.info( 'ERROR: %s: Active/Queued component "%s" needs at least one async port, command, or interface' % (the_parsed_component_xml.get_xml_filename(), comp_name) ) sys.exit(-1) # 2) Queued component needs at least one sync port/command if comp_kind == "queued": if num_sync_ports == 0: PRINT.info( 'ERROR: %s: Queued component "%s" needs at least one sync/guarded port or command' % (the_parsed_component_xml.get_xml_filename(), comp_name) ) sys.exit(-1) parsed_array_list = [] for array_file in the_parsed_component_xml.get_array_type_files(): parsed_array_list.append(array_file.replace("Ai.xml", "Ac.hpp")) # # Instance the component here... # the_component = Component.Component( comp_namespace, comp_name, comp_kind, comp_comment, comp_modeler, port_obj_list, command_obj_list, channel_obj_list, parameter_obj_list, event_obj_list, internal_interface_obj_list, serializable_obj_list, comp_xml_filename, comp_included_enums_list, ) the_component.set_xml_port_files(comp_xml_port_files + parsed_array_list) the_component.set_xml_serializable_files( the_parsed_component_xml.get_serializable_type_files() ) the_component.set_c_header_files(comp_c_header_files) if has_guarded_ports: the_component.set_has_guarded_ports() # for p in the_component.get_ports(): # print p.get_name(), p.get_namespace() # for a in p.get_args(): # print a.get_name(), a.get_type(), a.get_modifier() return the_component
[ "def", "create", "(", "self", ",", "the_parsed_component_xml", ",", "parsed_port_xml_list", ",", "parsed_serializable_list", ")", ":", "x", "=", "the_parsed_component_xml", "comp_obj", "=", "x", ".", "get_component", "(", ")", "comp_port_obj_list", "=", "x", ".", ...
https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/models/CompFactory.py#L70-L431
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/email/mime/application.py
python
MIMEApplication.__init__
(self, _data, _subtype='octet-stream', _encoder=encoders.encode_base64, **_params)
Create an application/* type MIME document. _data is a string containing the raw application data. _subtype is the MIME content type subtype, defaulting to 'octet-stream'. _encoder is a function which will perform the actual encoding for transport of the application data, defaulting to base64 encoding. Any additional keyword arguments are passed to the base class constructor, which turns them into parameters on the Content-Type header.
Create an application/* type MIME document.
[ "Create", "an", "application", "/", "*", "type", "MIME", "document", "." ]
def __init__(self, _data, _subtype='octet-stream', _encoder=encoders.encode_base64, **_params): """Create an application/* type MIME document. _data is a string containing the raw application data. _subtype is the MIME content type subtype, defaulting to 'octet-stream'. _encoder is a function which will perform the actual encoding for transport of the application data, defaulting to base64 encoding. Any additional keyword arguments are passed to the base class constructor, which turns them into parameters on the Content-Type header. """ if _subtype is None: raise TypeError('Invalid application MIME subtype') MIMENonMultipart.__init__(self, 'application', _subtype, **_params) self.set_payload(_data) _encoder(self)
[ "def", "__init__", "(", "self", ",", "_data", ",", "_subtype", "=", "'octet-stream'", ",", "_encoder", "=", "encoders", ".", "encode_base64", ",", "*", "*", "_params", ")", ":", "if", "_subtype", "is", "None", ":", "raise", "TypeError", "(", "'Invalid appl...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/email/mime/application.py#L16-L36
turi-code/SFrame
796b9bdfb2fa1b881d82080754643c7e68629cd2
oss_src/unity/python/sframe/data_structures/sgraph.py
python
_dataframe_to_edge_list
(df)
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
[ "Convert", "dataframe", "into", "list", "of", "edges", "assuming", "that", "source", "and", "target", "ids", "are", "stored", "in", "_SRC_VID_COLUMN", "and", "_DST_VID_COLUMN", "respectively", "." ]
def _dataframe_to_edge_list(df): """ Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively. """ cols = df.columns if len(cols): assert _SRC_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _SRC_VID_COLUMN assert _DST_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _DST_VID_COLUMN df = df[cols].T ret = [Edge(None, None, _series=df[col]) for col in df] return ret else: return []
[ "def", "_dataframe_to_edge_list", "(", "df", ")", ":", "cols", "=", "df", ".", "columns", "if", "len", "(", "cols", ")", ":", "assert", "_SRC_VID_COLUMN", "in", "cols", ",", "\"Vertex DataFrame must contain column %s\"", "%", "_SRC_VID_COLUMN", "assert", "_DST_VID...
https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sgraph.py#L1440-L1452
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/contrib/pyopenssl.py
python
inject_into_urllib3
()
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
Monkey-patch urllib3 with PyOpenSSL-backed SSL-support.
[ "Monkey", "-", "patch", "urllib3", "with", "PyOpenSSL", "-", "backed", "SSL", "-", "support", "." ]
def inject_into_urllib3(): "Monkey-patch urllib3 with PyOpenSSL-backed SSL-support." _validate_dependencies_met() util.SSLContext = PyOpenSSLContext util.ssl_.SSLContext = PyOpenSSLContext util.HAS_SNI = HAS_SNI util.ssl_.HAS_SNI = HAS_SNI util.IS_PYOPENSSL = True util.ssl_.IS_PYOPENSSL = True
[ "def", "inject_into_urllib3", "(", ")", ":", "_validate_dependencies_met", "(", ")", "util", ".", "SSLContext", "=", "PyOpenSSLContext", "util", ".", "ssl_", ".", "SSLContext", "=", "PyOpenSSLContext", "util", ".", "HAS_SNI", "=", "HAS_SNI", "util", ".", "ssl_",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/contrib/pyopenssl.py#L115-L125
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TStrV.Reserve
(self, *args)
return _snap.TStrV_Reserve(self, *args)
Reserve(TStrV self, int const & _MxVals) Parameters: _MxVals: int const & Reserve(TStrV self, int const & _MxVals, int const & _Vals) Parameters: _MxVals: int const & _Vals: int const &
Reserve(TStrV self, int const & _MxVals)
[ "Reserve", "(", "TStrV", "self", "int", "const", "&", "_MxVals", ")" ]
def Reserve(self, *args): """ Reserve(TStrV self, int const & _MxVals) Parameters: _MxVals: int const & Reserve(TStrV self, int const & _MxVals, int const & _Vals) Parameters: _MxVals: int const & _Vals: int const & """ return _snap.TStrV_Reserve(self, *args)
[ "def", "Reserve", "(", "self", ",", "*", "args", ")", ":", "return", "_snap", ".", "TStrV_Reserve", "(", "self", ",", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L19283-L19297
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/applications/workbench/workbench/plotting/globalfiguremanager.py
python
GlobalFigureManager.figure_title_changed
(cls, figure_number)
Notify the observers that a figure title was changed :param figure_number: The unique number in GlobalFigureManager
Notify the observers that a figure title was changed :param figure_number: The unique number in GlobalFigureManager
[ "Notify", "the", "observers", "that", "a", "figure", "title", "was", "changed", ":", "param", "figure_number", ":", "The", "unique", "number", "in", "GlobalFigureManager" ]
def figure_title_changed(cls, figure_number): """ Notify the observers that a figure title was changed :param figure_number: The unique number in GlobalFigureManager """ cls.notify_observers(FigureAction.Renamed, figure_number)
[ "def", "figure_title_changed", "(", "cls", ",", "figure_number", ")", ":", "cls", ".", "notify_observers", "(", "FigureAction", ".", "Renamed", ",", "figure_number", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/plotting/globalfiguremanager.py#L273-L278
xbmc/xbmc
091211a754589fc40a2a1f239b0ce9f4ee138268
addons/metadata.tvshows.themoviedb.org.python/libs/data_utils.py
python
_set_cast
(cast_info, list_item)
return list_item
Save cast info to list item
Save cast info to list item
[ "Save", "cast", "info", "to", "list", "item" ]
def _set_cast(cast_info, list_item): # type: (InfoType, ListItem) -> ListItem """Save cast info to list item""" cast = [] for item in cast_info: data = { 'name': item['name'], 'role': item.get('character', item.get('character_name', '')), 'order': item['order'], } thumb = None if safe_get(item, 'profile_path') is not None: thumb = settings.IMAGEROOTURL + item['profile_path'] if thumb: data['thumbnail'] = thumb cast.append(data) list_item.setCast(cast) return list_item
[ "def", "_set_cast", "(", "cast_info", ",", "list_item", ")", ":", "# type: (InfoType, ListItem) -> ListItem", "cast", "=", "[", "]", "for", "item", "in", "cast_info", ":", "data", "=", "{", "'name'", ":", "item", "[", "'name'", "]", ",", "'role'", ":", "it...
https://github.com/xbmc/xbmc/blob/091211a754589fc40a2a1f239b0ce9f4ee138268/addons/metadata.tvshows.themoviedb.org.python/libs/data_utils.py#L72-L89
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py
python
_multi_value_loss
( activations, labels, sequence_length, target_column, features)
Maps `activations` from the RNN to loss for multi value models. Args: activations: Output from an RNN. Should have dtype `float32` and shape `[batch_size, padded_length, ?]`. labels: A `Tensor` with length `[batch_size, padded_length]`. sequence_length: A `Tensor` with shape `[batch_size]` and dtype `int32` containing the length of each sequence in the batch. If `None`, sequences are assumed to be unpadded. target_column: An initialized `TargetColumn`, calculate predictions. features: A `dict` containing the input and (optionally) sequence length information and initial state. Returns: A scalar `Tensor` containing the loss.
Maps `activations` from the RNN to loss for multi value models.
[ "Maps", "activations", "from", "the", "RNN", "to", "loss", "for", "multi", "value", "models", "." ]
def _multi_value_loss( activations, labels, sequence_length, target_column, features): """Maps `activations` from the RNN to loss for multi value models. Args: activations: Output from an RNN. Should have dtype `float32` and shape `[batch_size, padded_length, ?]`. labels: A `Tensor` with length `[batch_size, padded_length]`. sequence_length: A `Tensor` with shape `[batch_size]` and dtype `int32` containing the length of each sequence in the batch. If `None`, sequences are assumed to be unpadded. target_column: An initialized `TargetColumn`, calculate predictions. features: A `dict` containing the input and (optionally) sequence length information and initial state. Returns: A scalar `Tensor` containing the loss. """ with ops.name_scope('MultiValueLoss'): activations_masked, labels_masked = rnn_common.mask_activations_and_labels( activations, labels, sequence_length) return target_column.loss(activations_masked, labels_masked, features)
[ "def", "_multi_value_loss", "(", "activations", ",", "labels", ",", "sequence_length", ",", "target_column", ",", "features", ")", ":", "with", "ops", ".", "name_scope", "(", "'MultiValueLoss'", ")", ":", "activations_masked", ",", "labels_masked", "=", "rnn_commo...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/dynamic_rnn_estimator.py#L302-L322
apple/swift-clang
d7403439fc6641751840b723e7165fb02f52db95
tools/scan-build-py/libscanbuild/shell.py
python
encode
(command)
return " ".join([escape(arg) for arg in command])
Takes a command as list and returns a string.
Takes a command as list and returns a string.
[ "Takes", "a", "command", "as", "list", "and", "returns", "a", "string", "." ]
def encode(command): """ Takes a command as list and returns a string. """ def needs_quote(word): """ Returns true if arguments needs to be protected by quotes. Previous implementation was shlex.split method, but that's not good for this job. Currently is running through the string with a basic state checking. """ reserved = {' ', '$', '%', '&', '(', ')', '[', ']', '{', '}', '*', '|', '<', '>', '@', '?', '!'} state = 0 for current in word: if state == 0 and current in reserved: return True elif state == 0 and current == '\\': state = 1 elif state == 1 and current in reserved | {'\\'}: state = 0 elif state == 0 and current == '"': state = 2 elif state == 2 and current == '"': state = 0 elif state == 0 and current == "'": state = 3 elif state == 3 and current == "'": state = 0 return state != 0 def escape(word): """ Do protect argument if that's needed. """ table = {'\\': '\\\\', '"': '\\"'} escaped = ''.join([table.get(c, c) for c in word]) return '"' + escaped + '"' if needs_quote(word) else escaped return " ".join([escape(arg) for arg in command])
[ "def", "encode", "(", "command", ")", ":", "def", "needs_quote", "(", "word", ")", ":", "\"\"\" Returns true if arguments needs to be protected by quotes.\n\n Previous implementation was shlex.split method, but that's not good\n for this job. Currently is running through the st...
https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/tools/scan-build-py/libscanbuild/shell.py#L13-L51
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/threading.py
python
Event.clear
(self)
Reset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again.
Reset the internal flag to false.
[ "Reset", "the", "internal", "flag", "to", "false", "." ]
def clear(self): """Reset the internal flag to false. Subsequently, threads calling wait() will block until set() is called to set the internal flag to true again. """ with self._cond: self._flag = False
[ "def", "clear", "(", "self", ")", ":", "with", "self", ".", "_cond", ":", "self", ".", "_flag", "=", "False" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/threading.py#L524-L532
Tencent/CMONGO
c40380caa14e05509f46993aa8b8da966b09b0b5
src/third_party/wiredtiger/tools/wtstats/wtstats.py
python
parse_wtstats_file
(file, result)
parse wtstats file, one stat per line, example format: Dec 05 14:43:14 0 /data/b block-manager: mapped bytes read
parse wtstats file, one stat per line, example format: Dec 05 14:43:14 0 /data/b block-manager: mapped bytes read
[ "parse", "wtstats", "file", "one", "stat", "per", "line", "example", "format", ":", "Dec", "05", "14", ":", "43", ":", "14", "0", "/", "data", "/", "b", "block", "-", "manager", ":", "mapped", "bytes", "read" ]
def parse_wtstats_file(file, result): """ parse wtstats file, one stat per line, example format: Dec 05 14:43:14 0 /data/b block-manager: mapped bytes read """ print 'Processing wtstats file: ' + file # Parse file for line in open(file, 'rU'): month, day, time, v, title = line.strip('\n').split(" ", 4) result[title].append((month + " " + day + " " + time, v))
[ "def", "parse_wtstats_file", "(", "file", ",", "result", ")", ":", "print", "'Processing wtstats file: '", "+", "file", "# Parse file", "for", "line", "in", "open", "(", "file", ",", "'rU'", ")", ":", "month", ",", "day", ",", "time", ",", "v", ",", "tit...
https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/wiredtiger/tools/wtstats/wtstats.py#L109-L118
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/contrib/distributions/python/ops/shape.py
python
_ShapeUtil.event_ndims
(self)
return self._event_ndims
Returns number of dimensions needed to index a sample's coordinates.
Returns number of dimensions needed to index a sample's coordinates.
[ "Returns", "number", "of", "dimensions", "needed", "to", "index", "a", "sample", "s", "coordinates", "." ]
def event_ndims(self): """Returns number of dimensions needed to index a sample's coordinates.""" return self._event_ndims
[ "def", "event_ndims", "(", "self", ")", ":", "return", "self", ".", "_event_ndims" ]
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/shape.py#L162-L164
Cisco-Talos/moflow
ed71dfb0540d9e0d7a4c72f0881b58958d573728
BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/cpp_message.py
python
GetDescriptorPool
()
return _net_proto2___python.NewCDescriptorPool()
Creates a new DescriptorPool C++ object.
Creates a new DescriptorPool C++ object.
[ "Creates", "a", "new", "DescriptorPool", "C", "++", "object", "." ]
def GetDescriptorPool(): """Creates a new DescriptorPool C++ object.""" return _net_proto2___python.NewCDescriptorPool()
[ "def", "GetDescriptorPool", "(", ")", ":", "return", "_net_proto2___python", ".", "NewCDescriptorPool", "(", ")" ]
https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/cpp_message.py#L48-L50
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/filedialog.py
python
askopenfilename
(**options)
return Open(**options).show()
Ask for a filename to open
Ask for a filename to open
[ "Ask", "for", "a", "filename", "to", "open" ]
def askopenfilename(**options): "Ask for a filename to open" return Open(**options).show()
[ "def", "askopenfilename", "(", "*", "*", "options", ")", ":", "return", "Open", "(", "*", "*", "options", ")", ".", "show", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/filedialog.py#L372-L375
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/src/robotsim.py
python
SimJoint.addForce
(self, force: "double")
return _robotsim.SimJoint_addForce(self, force)
r""" addForce(SimJoint self, double force) Adds a torque for the hinge joint and a force for a slider joint.
r""" addForce(SimJoint self, double force)
[ "r", "addForce", "(", "SimJoint", "self", "double", "force", ")" ]
def addForce(self, force: "double") -> "void": r""" addForce(SimJoint self, double force) Adds a torque for the hinge joint and a force for a slider joint. """ return _robotsim.SimJoint_addForce(self, force)
[ "def", "addForce", "(", "self", ",", "force", ":", "\"double\"", ")", "->", "\"void\"", ":", "return", "_robotsim", ".", "SimJoint_addForce", "(", "self", ",", "force", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L8140-L8148
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
third_party/jinja2/bccache.py
python
BytecodeCache.get_bucket
(self, environment, name, filename, source)
return bucket
Return a cache bucket for the given template. All arguments are mandatory but filename may be `None`.
Return a cache bucket for the given template. All arguments are mandatory but filename may be `None`.
[ "Return", "a", "cache", "bucket", "for", "the", "given", "template", ".", "All", "arguments", "are", "mandatory", "but", "filename", "may", "be", "None", "." ]
def get_bucket(self, environment, name, filename, source): """Return a cache bucket for the given template. All arguments are mandatory but filename may be `None`. """ key = self.get_cache_key(name, filename) checksum = self.get_source_checksum(source) bucket = Bucket(environment, key, checksum) self.load_bytecode(bucket) return bucket
[ "def", "get_bucket", "(", "self", ",", "environment", ",", "name", ",", "filename", ",", "source", ")", ":", "key", "=", "self", ".", "get_cache_key", "(", "name", ",", "filename", ")", "checksum", "=", "self", ".", "get_source_checksum", "(", "source", ...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/bccache.py#L172-L180
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/data.py
python
CoverageData.add_arc_data
(self, arc_data)
Add measured arc data. `arc_data` is { filename: { (l1,l2): None, ... }, ...}
Add measured arc data.
[ "Add", "measured", "arc", "data", "." ]
def add_arc_data(self, arc_data): """Add measured arc data. `arc_data` is { filename: { (l1,l2): None, ... }, ...} """ for filename, arcs in arc_data.items(): self.arcs.setdefault(filename, {}).update(arcs)
[ "def", "add_arc_data", "(", "self", ",", "arc_data", ")", ":", "for", "filename", ",", "arcs", "in", "arc_data", ".", "items", "(", ")", ":", "self", ".", "arcs", ".", "setdefault", "(", "filename", ",", "{", "}", ")", ".", "update", "(", "arcs", "...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/data.py#L208-L215
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
example/rcnn/rcnn/dataset/coco.py
python
coco.evaluate_detections
(self, detections)
detections_val2014_results.json
detections_val2014_results.json
[ "detections_val2014_results", ".", "json" ]
def evaluate_detections(self, detections): """ detections_val2014_results.json """ res_folder = os.path.join(self.cache_path, 'results') if not os.path.exists(res_folder): os.makedirs(res_folder) res_file = os.path.join(res_folder, 'detections_%s_results.json' % self.image_set) self._write_coco_results(detections, res_file) if 'test' not in self.image_set: self._do_python_eval(res_file, res_folder)
[ "def", "evaluate_detections", "(", "self", ",", "detections", ")", ":", "res_folder", "=", "os", ".", "path", ".", "join", "(", "self", ".", "cache_path", ",", "'results'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "res_folder", ")", ":"...
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/rcnn/rcnn/dataset/coco.py#L154-L162
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBSymbol.__ne__
(self, *args)
return _lldb.SBSymbol___ne__(self, *args)
__ne__(self, SBSymbol rhs) -> bool
__ne__(self, SBSymbol rhs) -> bool
[ "__ne__", "(", "self", "SBSymbol", "rhs", ")", "-", ">", "bool" ]
def __ne__(self, *args): """__ne__(self, SBSymbol rhs) -> bool""" return _lldb.SBSymbol___ne__(self, *args)
[ "def", "__ne__", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBSymbol___ne__", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L8147-L8149
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/dataset/vision/py_transforms_util.py
python
invert_color
(img)
return ImageOps.invert(img)
Invert colors of input PIL image. Args: img (PIL image): Image to be color inverted. Returns: img (PIL image), Color inverted image.
Invert colors of input PIL image.
[ "Invert", "colors", "of", "input", "PIL", "image", "." ]
def invert_color(img): """ Invert colors of input PIL image. Args: img (PIL image): Image to be color inverted. Returns: img (PIL image), Color inverted image. """ if not is_pil(img): raise TypeError(augment_error_message.format(type(img))) return ImageOps.invert(img)
[ "def", "invert_color", "(", "img", ")", ":", "if", "not", "is_pil", "(", "img", ")", ":", "raise", "TypeError", "(", "augment_error_message", ".", "format", "(", "type", "(", "img", ")", ")", ")", "return", "ImageOps", ".", "invert", "(", "img", ")" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms_util.py#L1554-L1569
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/gslib/copy_helper.py
python
_DoParallelCompositeUpload
(fp, src_url, dst_url, dst_obj_metadata, canned_acl, file_size, preconditions, gsutil_api, command_obj, copy_exception_handler)
return elapsed_time, composed_object
Uploads a local file to a cloud object using parallel composite upload. The file is partitioned into parts, and then the parts are uploaded in parallel, composed to form the original destination object, and deleted. Args: fp: The file object to be uploaded. src_url: FileUrl representing the local file. dst_url: CloudUrl representing the destination file. dst_obj_metadata: apitools Object describing the destination object. canned_acl: The canned acl to apply to the object, if any. file_size: The size of the source file in bytes. preconditions: Cloud API Preconditions for the final object. gsutil_api: gsutil Cloud API instance to use. command_obj: Command object (for calling Apply). copy_exception_handler: Copy exception handler (for use in Apply). Returns: Elapsed upload time, uploaded Object with generation, crc32c, and size fields populated.
Uploads a local file to a cloud object using parallel composite upload.
[ "Uploads", "a", "local", "file", "to", "a", "cloud", "object", "using", "parallel", "composite", "upload", "." ]
def _DoParallelCompositeUpload(fp, src_url, dst_url, dst_obj_metadata, canned_acl, file_size, preconditions, gsutil_api, command_obj, copy_exception_handler): """Uploads a local file to a cloud object using parallel composite upload. The file is partitioned into parts, and then the parts are uploaded in parallel, composed to form the original destination object, and deleted. Args: fp: The file object to be uploaded. src_url: FileUrl representing the local file. dst_url: CloudUrl representing the destination file. dst_obj_metadata: apitools Object describing the destination object. canned_acl: The canned acl to apply to the object, if any. file_size: The size of the source file in bytes. preconditions: Cloud API Preconditions for the final object. gsutil_api: gsutil Cloud API instance to use. command_obj: Command object (for calling Apply). copy_exception_handler: Copy exception handler (for use in Apply). Returns: Elapsed upload time, uploaded Object with generation, crc32c, and size fields populated. """ start_time = time.time() dst_bucket_url = StorageUrlFromString(dst_url.bucket_url_string) api_selector = gsutil_api.GetApiSelector(provider=dst_url.scheme) # Determine which components, if any, have already been successfully # uploaded. tracker_file = GetTrackerFilePath(dst_url, TrackerFileType.PARALLEL_UPLOAD, api_selector, src_url) tracker_file_lock = CreateLock() (random_prefix, existing_components) = ( _ParseParallelUploadTrackerFile(tracker_file, tracker_file_lock)) # Create the initial tracker file for the upload. _CreateParallelUploadTrackerFile(tracker_file, random_prefix, existing_components, tracker_file_lock) # Get the set of all components that should be uploaded. dst_args = _PartitionFile( fp, file_size, src_url, dst_obj_metadata.contentType, canned_acl, dst_bucket_url, random_prefix, tracker_file, tracker_file_lock) (components_to_upload, existing_components, existing_objects_to_delete) = ( FilterExistingComponents(dst_args, existing_components, dst_bucket_url, gsutil_api)) # In parallel, copy all of the file parts that haven't already been # uploaded to temporary objects. cp_results = command_obj.Apply( _PerformParallelUploadFileToObject, components_to_upload, copy_exception_handler, ('op_failure_count', 'total_bytes_transferred'), arg_checker=gslib.command.DummyArgChecker, parallel_operations_override=True, should_return_results=True) uploaded_components = [] for cp_result in cp_results: uploaded_components.append(cp_result[2]) components = uploaded_components + existing_components if len(components) == len(dst_args): # Only try to compose if all of the components were uploaded successfully. def _GetComponentNumber(component): return int(component.object_name[component.object_name.rfind('_')+1:]) # Sort the components so that they will be composed in the correct order. components = sorted(components, key=_GetComponentNumber) request_components = [] for component_url in components: src_obj_metadata = ( apitools_messages.ComposeRequest.SourceObjectsValueListEntry( name=component_url.object_name)) if component_url.HasGeneration(): src_obj_metadata.generation = long(component_url.generation) request_components.append(src_obj_metadata) composed_object = gsutil_api.ComposeObject( request_components, dst_obj_metadata, preconditions=preconditions, provider=dst_url.scheme, fields=['generation', 'crc32c', 'size']) try: # Make sure only to delete things that we know were successfully # uploaded (as opposed to all of the objects that we attempted to # create) so that we don't delete any preexisting objects, except for # those that were uploaded by a previous, failed run and have since # changed (but still have an old generation lying around). objects_to_delete = components + existing_objects_to_delete command_obj.Apply( _DeleteTempComponentObjectFn, objects_to_delete, _RmExceptionHandler, arg_checker=gslib.command.DummyArgChecker, parallel_operations_override=True) except Exception: # pylint: disable=broad-except # If some of the delete calls fail, don't cause the whole command to # fail. The copy was successful iff the compose call succeeded, so # reduce this to a warning. logging.warning( 'Failed to delete some of the following temporary objects:\n' + '\n'.join(dst_args.keys())) finally: with tracker_file_lock: if os.path.exists(tracker_file): os.unlink(tracker_file) else: # Some of the components failed to upload. In this case, we want to exit # without deleting the objects. raise CommandException( 'Some temporary components were not uploaded successfully. ' 'Please retry this upload.') elapsed_time = time.time() - start_time return elapsed_time, composed_object
[ "def", "_DoParallelCompositeUpload", "(", "fp", ",", "src_url", ",", "dst_url", ",", "dst_obj_metadata", ",", "canned_acl", ",", "file_size", ",", "preconditions", ",", "gsutil_api", ",", "command_obj", ",", "copy_exception_handler", ")", ":", "start_time", "=", "...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/copy_helper.py#L926-L1037
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exomerge2.py
python
ExodusModel._get_unreferenced_nodes
(self)
return unused_nodes
Return a list of node indices which are not used by any element.
Return a list of node indices which are not used by any element.
[ "Return", "a", "list", "of", "node", "indices", "which", "are", "not", "used", "by", "any", "element", "." ]
def _get_unreferenced_nodes(self): """Return a list of node indices which are not used by any element.""" used_node = [False] * len(self.nodes) for id_ in self.get_element_block_ids(): connectivity = self.get_connectivity(id_) for node_index in connectivity: used_node[node_index] = True unused_nodes = [index for index, used in enumerate(used_node) if not used] return unused_nodes
[ "def", "_get_unreferenced_nodes", "(", "self", ")", ":", "used_node", "=", "[", "False", "]", "*", "len", "(", "self", ".", "nodes", ")", "for", "id_", "in", "self", ".", "get_element_block_ids", "(", ")", ":", "connectivity", "=", "self", ".", "get_conn...
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge2.py#L5690-L5700
vgteam/vg
cf4d516a5e9ee5163c783e4437ddf16b18a4b561
vgci/vgci.py
python
VGCITest.test_map_mhc_snp1kg
(self)
Indexing, mapping and calling bakeoff F1 test for MHC snp1kg graph
Indexing, mapping and calling bakeoff F1 test for MHC snp1kg graph
[ "Indexing", "mapping", "and", "calling", "bakeoff", "F1", "test", "for", "MHC", "snp1kg", "graph" ]
def test_map_mhc_snp1kg(self): """ Indexing, mapping and calling bakeoff F1 test for MHC snp1kg graph """ log.info("Test start at {}".format(datetime.now())) self._test_bakeoff('MHC', 'snp1kg', True)
[ "def", "test_map_mhc_snp1kg", "(", "self", ")", ":", "log", ".", "info", "(", "\"Test start at {}\"", ".", "format", "(", "datetime", ".", "now", "(", ")", ")", ")", "self", ".", "_test_bakeoff", "(", "'MHC'", ",", "'snp1kg'", ",", "True", ")" ]
https://github.com/vgteam/vg/blob/cf4d516a5e9ee5163c783e4437ddf16b18a4b561/vgci/vgci.py#L1448-L1451
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdataset.py
python
Rdataset.update
(self, other)
Add all rdatas in other to self. @param other: The rdataset from which to update @type other: dns.rdataset.Rdataset object
Add all rdatas in other to self.
[ "Add", "all", "rdatas", "in", "other", "to", "self", "." ]
def update(self, other): """Add all rdatas in other to self. @param other: The rdataset from which to update @type other: dns.rdataset.Rdataset object""" self.update_ttl(other.ttl) super(Rdataset, self).update(other)
[ "def", "update", "(", "self", ",", "other", ")", ":", "self", ".", "update_ttl", "(", "other", ".", "ttl", ")", "super", "(", "Rdataset", ",", "self", ")", ".", "update", "(", "other", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdataset.py#L134-L141
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
Window.SetLabel
(*args, **kwargs)
return _core_.Window_SetLabel(*args, **kwargs)
SetLabel(self, String label) Set the text which the window shows in its label if applicable.
SetLabel(self, String label)
[ "SetLabel", "(", "self", "String", "label", ")" ]
def SetLabel(*args, **kwargs): """ SetLabel(self, String label) Set the text which the window shows in its label if applicable. """ return _core_.Window_SetLabel(*args, **kwargs)
[ "def", "SetLabel", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_SetLabel", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L9201-L9207
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py
python
locatedExpr
(expr)
return Group(locator("locn_start") + expr("value") + locator.copy().leaveWhitespace()("locn_end"))
Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the actual parsed results Be careful if the input text contains ``<TAB>`` characters, you may want to call :class:`ParserElement.parseWithTabs` Example:: wd = Word(alphas) for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"): print(match) prints:: [[0, 'ljsdf', 5]] [[8, 'lksdjjf', 15]] [[18, 'lkkjj', 23]]
Helper to decorate a returned token with its starting and ending
[ "Helper", "to", "decorate", "a", "returned", "token", "with", "its", "starting", "and", "ending" ]
def locatedExpr(expr): """Helper to decorate a returned token with its starting and ending locations in the input string. This helper adds the following results names: - locn_start = location where matched expression begins - locn_end = location where matched expression ends - value = the actual parsed results Be careful if the input text contains ``<TAB>`` characters, you may want to call :class:`ParserElement.parseWithTabs` Example:: wd = Word(alphas) for match in locatedExpr(wd).searchString("ljsdf123lksdjjf123lkkjj1222"): print(match) prints:: [[0, 'ljsdf', 5]] [[8, 'lksdjjf', 15]] [[18, 'lkkjj', 23]] """ locator = Empty().setParseAction(lambda s, l, t: l) return Group(locator("locn_start") + expr("value") + locator.copy().leaveWhitespace()("locn_end"))
[ "def", "locatedExpr", "(", "expr", ")", ":", "locator", "=", "Empty", "(", ")", ".", "setParseAction", "(", "lambda", "s", ",", "l", ",", "t", ":", "l", ")", "return", "Group", "(", "locator", "(", "\"locn_start\"", ")", "+", "expr", "(", "\"value\""...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/pyparsing.py#L11271-L11323
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/training_util.py
python
_get_global_step_read
(graph=None)
return None
Gets global step read tensor in graph. Args: graph: The graph in which to create the global step read tensor. If missing, use default graph. Returns: Global step read tensor. Raises: RuntimeError: if multiple items found in collection GLOBAL_STEP_READ_KEY.
Gets global step read tensor in graph.
[ "Gets", "global", "step", "read", "tensor", "in", "graph", "." ]
def _get_global_step_read(graph=None): """Gets global step read tensor in graph. Args: graph: The graph in which to create the global step read tensor. If missing, use default graph. Returns: Global step read tensor. Raises: RuntimeError: if multiple items found in collection GLOBAL_STEP_READ_KEY. """ graph = graph or ops.get_default_graph() global_step_read_tensors = graph.get_collection(GLOBAL_STEP_READ_KEY) if len(global_step_read_tensors) > 1: raise RuntimeError('There are multiple items in collection {}. ' 'There should be only one.'.format(GLOBAL_STEP_READ_KEY)) if len(global_step_read_tensors) == 1: return global_step_read_tensors[0] return None
[ "def", "_get_global_step_read", "(", "graph", "=", "None", ")", ":", "graph", "=", "graph", "or", "ops", ".", "get_default_graph", "(", ")", "global_step_read_tensors", "=", "graph", ".", "get_collection", "(", "GLOBAL_STEP_READ_KEY", ")", "if", "len", "(", "g...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/training_util.py#L188-L209
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/dataview.py
python
DataViewCtrl.AppendProgressColumn
(*args, **kwargs)
return _dataview.DataViewCtrl_AppendProgressColumn(*args, **kwargs)
AppendProgressColumn(self, PyObject label_or_bitmap, unsigned int model_column, int mode=DATAVIEW_CELL_INERT, int width=DVC_DEFAULT_WIDTH, int align=ALIGN_CENTER, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
AppendProgressColumn(self, PyObject label_or_bitmap, unsigned int model_column, int mode=DATAVIEW_CELL_INERT, int width=DVC_DEFAULT_WIDTH, int align=ALIGN_CENTER, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn
[ "AppendProgressColumn", "(", "self", "PyObject", "label_or_bitmap", "unsigned", "int", "model_column", "int", "mode", "=", "DATAVIEW_CELL_INERT", "int", "width", "=", "DVC_DEFAULT_WIDTH", "int", "align", "=", "ALIGN_CENTER", "int", "flags", "=", "DATAVIEW_COL_RESIZABLE"...
def AppendProgressColumn(*args, **kwargs): """ AppendProgressColumn(self, PyObject label_or_bitmap, unsigned int model_column, int mode=DATAVIEW_CELL_INERT, int width=DVC_DEFAULT_WIDTH, int align=ALIGN_CENTER, int flags=DATAVIEW_COL_RESIZABLE) -> DataViewColumn """ return _dataview.DataViewCtrl_AppendProgressColumn(*args, **kwargs)
[ "def", "AppendProgressColumn", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "DataViewCtrl_AppendProgressColumn", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L1663-L1669
llvm-mirror/lldb
d01083a850f577b85501a0902b52fd0930de72c7
utils/vim-lldb/python-vim-lldb/vim_panes.py
python
get_selected_frame
(target)
return (frame, "")
Returns a tuple with (frame, error) where frame == None if error occurs
Returns a tuple with (frame, error) where frame == None if error occurs
[ "Returns", "a", "tuple", "with", "(", "frame", "error", ")", "where", "frame", "==", "None", "if", "error", "occurs" ]
def get_selected_frame(target): """ Returns a tuple with (frame, error) where frame == None if error occurs """ (thread, error) = get_selected_thread(target) if thread is None: return (None, error) frame = thread.GetSelectedFrame() if frame is None or not frame.IsValid(): return (None, VimPane.MSG_NO_FRAME) return (frame, "")
[ "def", "get_selected_frame", "(", "target", ")", ":", "(", "thread", ",", "error", ")", "=", "get_selected_thread", "(", "target", ")", "if", "thread", "is", "None", ":", "return", "(", "None", ",", "error", ")", "frame", "=", "thread", ".", "GetSelected...
https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/utils/vim-lldb/python-vim-lldb/vim_panes.py#L89-L98