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
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_gdi.py
python
IconBundleFromFile
(*args, **kwargs)
return val
IconBundleFromFile(String file, int type=BITMAP_TYPE_ANY) -> IconBundle
IconBundleFromFile(String file, int type=BITMAP_TYPE_ANY) -> IconBundle
[ "IconBundleFromFile", "(", "String", "file", "int", "type", "=", "BITMAP_TYPE_ANY", ")", "-", ">", "IconBundle" ]
def IconBundleFromFile(*args, **kwargs): """IconBundleFromFile(String file, int type=BITMAP_TYPE_ANY) -> IconBundle""" val = _gdi_.new_IconBundleFromFile(*args, **kwargs) return val
[ "def", "IconBundleFromFile", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "val", "=", "_gdi_", ".", "new_IconBundleFromFile", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "val" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1510-L1513
qtumproject/qtum
f5a195cc8c62510336ce4f30b7f74b5fdc445ad7
contrib/devtools/optimize-pngs.py
python
content_hash
(filename)
return hashlib.sha256(data).hexdigest()
Return hash of RGBA contents of image
Return hash of RGBA contents of image
[ "Return", "hash", "of", "RGBA", "contents", "of", "image" ]
def content_hash(filename): '''Return hash of RGBA contents of image''' i = Image.open(filename) i = i.convert('RGBA') data = i.tobytes() return hashlib.sha256(data).hexdigest()
[ "def", "content_hash", "(", "filename", ")", ":", "i", "=", "Image", ".", "open", "(", "filename", ")", "i", "=", "i", ".", "convert", "(", "'RGBA'", ")", "data", "=", "i", ".", "tobytes", "(", ")", "return", "hashlib", ".", "sha256", "(", "data", ...
https://github.com/qtumproject/qtum/blob/f5a195cc8c62510336ce4f30b7f74b5fdc445ad7/contrib/devtools/optimize-pngs.py#L20-L25
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/editor/color/coloreditor.py
python
SyntEditView.EnterKeyEvent
(self, event)
return self.bindings.fire("<<newline-and-indent>>", event)
Handle the enter key with special handling for auto-complete
Handle the enter key with special handling for auto-complete
[ "Handle", "the", "enter", "key", "with", "special", "handling", "for", "auto", "-", "complete" ]
def EnterKeyEvent(self, event): """Handle the enter key with special handling for auto-complete """ # Handle auto-complete first. if self.SCIAutoCActive(): self.SCIAutoCComplete() self.SCIAutoCCancel() # Call the IDLE event. return self.bindings.fire("<<newline-and-indent>>", event)
[ "def", "EnterKeyEvent", "(", "self", ",", "event", ")", ":", "# Handle auto-complete first.", "if", "self", ".", "SCIAutoCActive", "(", ")", ":", "self", ".", "SCIAutoCComplete", "(", ")", "self", ".", "SCIAutoCCancel", "(", ")", "# Call the IDLE event.", "retur...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/editor/color/coloreditor.py#L332-L340
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Pygments/py3/pygments/lexers/__init__.py
python
get_lexer_for_filename
(_fn, code=None, **options)
return res(**options)
Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Raises ClassNotFound if not found.
Get a lexer for a filename.
[ "Get", "a", "lexer", "for", "a", "filename", "." ]
def get_lexer_for_filename(_fn, code=None, **options): """Get a lexer for a filename. If multiple lexers match the filename pattern, use ``analyse_text()`` to figure out which one is more appropriate. Raises ClassNotFound if not found. """ res = find_lexer_class_for_filename(_fn, code) if ...
[ "def", "get_lexer_for_filename", "(", "_fn", ",", "code", "=", "None", ",", "*", "*", "options", ")", ":", "res", "=", "find_lexer_class_for_filename", "(", "_fn", ",", "code", ")", "if", "not", "res", ":", "raise", "ClassNotFound", "(", "'no lexer for filen...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/__init__.py#L199-L210
LiXizhi/NPLRuntime
a42720e5fe9a6960e0a9ce40bbbcd809192906be
Client/trunk/externals/freetype-2.8.1/src/tools/docmaker/content.py
python
ContentProcessor.reset
( self )
Reset the content processor for a new block.
Reset the content processor for a new block.
[ "Reset", "the", "content", "processor", "for", "a", "new", "block", "." ]
def reset( self ): """Reset the content processor for a new block.""" self.markups = [] self.markup = None self.markup_lines = []
[ "def", "reset", "(", "self", ")", ":", "self", ".", "markups", "=", "[", "]", "self", ".", "markup", "=", "None", "self", ".", "markup_lines", "=", "[", "]" ]
https://github.com/LiXizhi/NPLRuntime/blob/a42720e5fe9a6960e0a9ce40bbbcd809192906be/Client/trunk/externals/freetype-2.8.1/src/tools/docmaker/content.py#L427-L431
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py
python
_as_indexed_slices_list
(inputs, optimize=True)
return casted_outputs
Convert all elements of 'inputs' to IndexedSlices. Additionally, homogenize the types of all the indices to either int32 or int64. Args: inputs: List containing either Tensor or IndexedSlices objects. optimize: if true, attempt to optimize the conversion of each input. Returns: A list of IndexedS...
Convert all elements of 'inputs' to IndexedSlices.
[ "Convert", "all", "elements", "of", "inputs", "to", "IndexedSlices", "." ]
def _as_indexed_slices_list(inputs, optimize=True): """Convert all elements of 'inputs' to IndexedSlices. Additionally, homogenize the types of all the indices to either int32 or int64. Args: inputs: List containing either Tensor or IndexedSlices objects. optimize: if true, attempt to optimize the con...
[ "def", "_as_indexed_slices_list", "(", "inputs", ",", "optimize", "=", "True", ")", ":", "if", "not", "isinstance", "(", "inputs", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"Expected a list or tuple, not a %s\"", "%", "type", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L2918-L2950
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/plotting/_matplotlib/converter.py
python
PandasAutoDateLocator.get_locator
(self, dmin, dmax)
return dates.AutoDateLocator.get_locator(self, dmin, dmax)
Pick the best locator based on a distance.
Pick the best locator based on a distance.
[ "Pick", "the", "best", "locator", "based", "on", "a", "distance", "." ]
def get_locator(self, dmin, dmax): """Pick the best locator based on a distance.""" delta = relativedelta(dmax, dmin) num_days = (delta.years * 12.0 + delta.months) * 31.0 + delta.days num_sec = (delta.hours * 60.0 + delta.minutes) * 60.0 + delta.seconds tot_sec = num_days * 864...
[ "def", "get_locator", "(", "self", ",", "dmin", ",", "dmax", ")", ":", "delta", "=", "relativedelta", "(", "dmax", ",", "dmin", ")", "num_days", "=", "(", "delta", ".", "years", "*", "12.0", "+", "delta", ".", "months", ")", "*", "31.0", "+", "delt...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/plotting/_matplotlib/converter.py#L341-L358
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
Tools/ecl_ekf/plotting/data_plots.py
python
ControlModeSummaryPlot.__init__
( self, data_time: np.ndarray, plot_data: dict, variable_names: List[List[str]], x_label: str, y_labels: List[str], annotation_text: List[str], additional_annotation: Optional[List[str]] = None, plot_title: str = '', sub_titles: Optional[List[str]] = None, pdf...
initializes a timeseries plot :param plot_data: :param variable_names: :param xlabels: :param ylabels: :param plot_title: :param sub_titles: :param pdf_handle:
initializes a timeseries plot :param plot_data: :param variable_names: :param xlabels: :param ylabels: :param plot_title: :param sub_titles: :param pdf_handle:
[ "initializes", "a", "timeseries", "plot", ":", "param", "plot_data", ":", ":", "param", "variable_names", ":", ":", "param", "xlabels", ":", ":", "param", "ylabels", ":", ":", "param", "plot_title", ":", ":", "param", "sub_titles", ":", ":", "param", "pdf_...
def __init__( self, data_time: np.ndarray, plot_data: dict, variable_names: List[List[str]], x_label: str, y_labels: List[str], annotation_text: List[str], additional_annotation: Optional[List[str]] = None, plot_title: str = '', sub_titles: Optional[List[str]] = None, ...
[ "def", "__init__", "(", "self", ",", "data_time", ":", "np", ".", "ndarray", ",", "plot_data", ":", "dict", ",", "variable_names", ":", "List", "[", "List", "[", "str", "]", "]", ",", "x_label", ":", "str", ",", "y_labels", ":", "List", "[", "str", ...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/ecl_ekf/plotting/data_plots.py#L260-L281
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
ThirdParty/cinema/paraview/tpl/cinema_python/images/layer_rasters.py
python
LayerRasters.loadImages
(self, store)
Take the queries we've been given and get images for them. Later call get* to get the images out.
Take the queries we've been given and get images for them. Later call get* to get the images out.
[ "Take", "the", "queries", "we", "ve", "been", "given", "and", "get", "images", "for", "them", ".", "Later", "call", "get", "*", "to", "get", "the", "images", "out", "." ]
def loadImages(self, store): """ Take the queries we've been given and get images for them. Later call get* to get the images out. """ nfields = len(self._fields) if nfields == 0: img = store.get(self.dict).data self._addColor(img) else: ...
[ "def", "loadImages", "(", "self", ",", "store", ")", ":", "nfields", "=", "len", "(", "self", ".", "_fields", ")", "if", "nfields", "==", "0", ":", "img", "=", "store", ".", "get", "(", "self", ".", "dict", ")", ".", "data", "self", ".", "_addCol...
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/ThirdParty/cinema/paraview/tpl/cinema_python/images/layer_rasters.py#L27-L54
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/grid.py
python
GridSizeEvent.AltDown
(*args, **kwargs)
return _grid.GridSizeEvent_AltDown(*args, **kwargs)
AltDown(self) -> bool
AltDown(self) -> bool
[ "AltDown", "(", "self", ")", "-", ">", "bool" ]
def AltDown(*args, **kwargs): """AltDown(self) -> bool""" return _grid.GridSizeEvent_AltDown(*args, **kwargs)
[ "def", "AltDown", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridSizeEvent_AltDown", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L2377-L2379
tum-vision/fusenet
a1451be2971b348a01b0f525c2a3a7a0e215a591
scripts/cpp_lint.py
python
CheckVlogArguments
(filename, clean_lines, linenum, error)
Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to ...
Checks that VLOG() is only used for defining a logging level.
[ "Checks", "that", "VLOG", "()", "is", "only", "used", "for", "defining", "a", "logging", "level", "." ]
def CheckVlogArguments(filename, clean_lines, linenum, error): """Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines i...
[ "def", "CheckVlogArguments", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "Search", "(", "r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'", ",", "line", ")", ...
https://github.com/tum-vision/fusenet/blob/a1451be2971b348a01b0f525c2a3a7a0e215a591/scripts/cpp_lint.py#L1708-L1724
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/toolkits/clustering/kmeans.py
python
KmeansModel.predict
(self, dataset, output_type="cluster_id", verbose=True)
Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : SFrame Dataset of new observations. Must include the features used for ...
Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center.
[ "Return", "predicted", "cluster", "label", "for", "instances", "in", "the", "new", "dataset", ".", "K", "-", "means", "predictions", "are", "made", "by", "assigning", "each", "new", "instance", "to", "the", "closest", "cluster", "center", "." ]
def predict(self, dataset, output_type="cluster_id", verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "\"cluster_id\"", ",", "verbose", "=", "True", ")", ":", "## Validate the input dataset.", "_tkutl", ".", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "_tkutl", ".", ...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/clustering/kmeans.py#L226-L309
google/earthenterprise
0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9
earth_enterprise/src/server/wsgi/serve/stream_manager.py
python
StreamManager._UpdateFileStatus
(self, file_path_size_list, db_type, fusion_hostname)
return files_to_transfer
Updates the status for files in files_table. Fixes the status for any files that are really pushed but have an invalid status value in postgres table. Returns the list of files that need to be transferred still. Args: file_path_size_list: the list of files to check (item is (path, size) ...
Updates the status for files in files_table.
[ "Updates", "the", "status", "for", "files", "in", "files_table", "." ]
def _UpdateFileStatus(self, file_path_size_list, db_type, fusion_hostname): """Updates the status for files in files_table. Fixes the status for any files that are really pushed but have an invalid status value in postgres table. Returns the list of files that need to be transferred still. Args: ...
[ "def", "_UpdateFileStatus", "(", "self", ",", "file_path_size_list", ",", "db_type", ",", "fusion_hostname", ")", ":", "logger", ".", "debug", "(", "\"_UpdateFileStatus..\"", ")", "db_path_prefix", "=", "self", ".", "GetDbPublishPathPrefix", "(", "db_type", ",", "...
https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/stream_manager.py#L275-L313
borglab/gtsam
a5bee157efce6a0563704bce6a5d188c29817f39
python/gtsam/utils/visual_isam.py
python
step
(data, isam, result, truth, currPoseIndex)
return isam, newResult
Do one step isam update @param[in] data: measurement data (odometry and visual measurements and their noiseModels) @param[in/out] isam: current isam object, will be updated @param[in/out] result: current result object, will be updated @param[in] truth: ground truth data, used to initialize new variables...
Do one step isam update
[ "Do", "one", "step", "isam", "update" ]
def step(data, isam, result, truth, currPoseIndex): ''' Do one step isam update @param[in] data: measurement data (odometry and visual measurements and their noiseModels) @param[in/out] isam: current isam object, will be updated @param[in/out] result: current result object, will be updated @para...
[ "def", "step", "(", "data", ",", "isam", ",", "result", ",", "truth", ",", "currPoseIndex", ")", ":", "# iSAM expects us to give it a new set of factors", "# along with initial estimates for any new variables introduced.", "newFactors", "=", "gtsam", ".", "NonlinearFactorGrap...
https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/python/gtsam/utils/visual_isam.py#L82-L131
DaFuCoding/MTCNN_Caffe
09c30c3ff391bd9cb6b249c1910afaf147767ab3
scripts/cpp_lint.py
python
CheckForBadCharacters
(filename, lines, error)
Logs an error for each line containing bad characters. Two kinds of bad characters: 1. Unicode replacement characters: These indicate that either the file contained invalid UTF-8 (likely) or Unicode replacement characters (which it shouldn't). Note that it's possible for this to throw off line numbering if...
Logs an error for each line containing bad characters.
[ "Logs", "an", "error", "for", "each", "line", "containing", "bad", "characters", "." ]
def CheckForBadCharacters(filename, lines, error): """Logs an error for each line containing bad characters. Two kinds of bad characters: 1. Unicode replacement characters: These indicate that either the file contained invalid UTF-8 (likely) or Unicode replacement characters (which it shouldn't). Note that...
[ "def", "CheckForBadCharacters", "(", "filename", ",", "lines", ",", "error", ")", ":", "for", "linenum", ",", "line", "in", "enumerate", "(", "lines", ")", ":", "if", "u'\\ufffd'", "in", "line", ":", "error", "(", "filename", ",", "linenum", ",", "'reada...
https://github.com/DaFuCoding/MTCNN_Caffe/blob/09c30c3ff391bd9cb6b249c1910afaf147767ab3/scripts/cpp_lint.py#L1483-L1505
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/column/timedelta.py
python
TimeDeltaColumn.components
(self, index=None)
return cudf.DataFrame( data={ "days": self // cudf.Scalar( np.timedelta64(_numpy_to_pandas_conversion["D"], "ns") ), "hours": ( self % cudf.Scalar( np.timedelta...
Return a Dataframe of the components of the Timedeltas. Returns ------- DataFrame Examples -------- >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='s')) >>> s = cudf.Series([12231312123, 1231231231, 1123236768712, 2135656, ... 3244334234], dtyp...
Return a Dataframe of the components of the Timedeltas.
[ "Return", "a", "Dataframe", "of", "the", "components", "of", "the", "Timedeltas", "." ]
def components(self, index=None) -> "cudf.DataFrame": """ Return a Dataframe of the components of the Timedeltas. Returns ------- DataFrame Examples -------- >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='s')) >>> s = cudf.Series([12231312...
[ "def", "components", "(", "self", ",", "index", "=", "None", ")", "->", "\"cudf.DataFrame\"", ":", "# noqa: E501", "return", "cudf", ".", "DataFrame", "(", "data", "=", "{", "\"days\"", ":", "self", "//", "cudf", ".", "Scalar", "(", "np", ".", "timedelta...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column/timedelta.py#L405-L496
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/propgrid.py
python
PropertyGridManager.IsFrozen
(*args, **kwargs)
return _propgrid.PropertyGridManager_IsFrozen(*args, **kwargs)
IsFrozen(self) -> bool Returns ``True`` if the window has been frozen and not thawed yet. :see: `Freeze` and `Thaw`
IsFrozen(self) -> bool
[ "IsFrozen", "(", "self", ")", "-", ">", "bool" ]
def IsFrozen(*args, **kwargs): """ IsFrozen(self) -> bool Returns ``True`` if the window has been frozen and not thawed yet. :see: `Freeze` and `Thaw` """ return _propgrid.PropertyGridManager_IsFrozen(*args, **kwargs)
[ "def", "IsFrozen", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGridManager_IsFrozen", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3533-L3541
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
EvtHandler.ProcessPendingEvents
(*args, **kwargs)
return _core_.EvtHandler_ProcessPendingEvents(*args, **kwargs)
ProcessPendingEvents(self)
ProcessPendingEvents(self)
[ "ProcessPendingEvents", "(", "self", ")" ]
def ProcessPendingEvents(*args, **kwargs): """ProcessPendingEvents(self)""" return _core_.EvtHandler_ProcessPendingEvents(*args, **kwargs)
[ "def", "ProcessPendingEvents", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "EvtHandler_ProcessPendingEvents", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L4172-L4174
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/model/access.py
python
set_dict
(world,config)
Sets the values in the dictionary config, which maps element names to values which should be set in the world. Note: not secure! Uses exec
Sets the values in the dictionary config, which maps element names to values which should be set in the world. Note: not secure! Uses exec
[ "Sets", "the", "values", "in", "the", "dictionary", "config", "which", "maps", "element", "names", "to", "values", "which", "should", "be", "set", "in", "the", "world", ".", "Note", ":", "not", "secure!", "Uses", "exec" ]
def set_dict(world,config): """Sets the values in the dictionary config, which maps element names to values which should be set in the world. Note: not secure! Uses exec """ for (k,v) in config.items(): set_item(world,k,v)
[ "def", "set_dict", "(", "world", ",", "config", ")", ":", "for", "(", "k", ",", "v", ")", "in", "config", ".", "items", "(", ")", ":", "set_item", "(", "world", ",", "k", ",", "v", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/access.py#L472-L478
lballabio/quantlib-old
136336947ed4fea9ecc1da6edad188700e821739
gensrc/gensrc/serialization/xmlreader.py
python
XmlReader.isTextNode
(self, node)
return node.nodeType == xml.dom.Node.ELEMENT_NODE \ and len(node.childNodes) == 1 \ and node.firstChild.nodeType == xml.dom.Node.TEXT_NODE
Return True for element node with single child text node.
Return True for element node with single child text node.
[ "Return", "True", "for", "element", "node", "with", "single", "child", "text", "node", "." ]
def isTextNode(self, node): """Return True for element node with single child text node.""" return node.nodeType == xml.dom.Node.ELEMENT_NODE \ and len(node.childNodes) == 1 \ and node.firstChild.nodeType == xml.dom.Node.TEXT_NODE
[ "def", "isTextNode", "(", "self", ",", "node", ")", ":", "return", "node", ".", "nodeType", "==", "xml", ".", "dom", ".", "Node", ".", "ELEMENT_NODE", "and", "len", "(", "node", ".", "childNodes", ")", "==", "1", "and", "node", ".", "firstChild", "."...
https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/serialization/xmlreader.py#L240-L244
yun-liu/RCF
91bfb054ad04187dbbe21e539e165ad9bd3ff00b
tools/extra/summarize.py
python
print_table
(table, max_width)
Print a simple nicely-aligned table. table must be a list of (equal-length) lists. Columns are space-separated, and as narrow as possible, but no wider than max_width. Text may overflow columns; note that unlike string.format, this will not affect subsequent columns, if possible.
Print a simple nicely-aligned table.
[ "Print", "a", "simple", "nicely", "-", "aligned", "table", "." ]
def print_table(table, max_width): """Print a simple nicely-aligned table. table must be a list of (equal-length) lists. Columns are space-separated, and as narrow as possible, but no wider than max_width. Text may overflow columns; note that unlike string.format, this will not affect subsequent co...
[ "def", "print_table", "(", "table", ",", "max_width", ")", ":", "max_widths", "=", "[", "max_width", "]", "*", "len", "(", "table", "[", "0", "]", ")", "column_widths", "=", "[", "max", "(", "printed_len", "(", "row", "[", "j", "]", ")", "+", "1", ...
https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/tools/extra/summarize.py#L41-L61
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/ivy_parser.py
python
p_expr_lparen_expr_rparen
(p)
expr : LPAREN expr RPAREN
expr : LPAREN expr RPAREN
[ "expr", ":", "LPAREN", "expr", "RPAREN" ]
def p_expr_lparen_expr_rparen(p): 'expr : LPAREN expr RPAREN' p[0] = p[2]
[ "def", "p_expr_lparen_expr_rparen", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "2", "]" ]
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L2592-L2594
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/aetools.py
python
TalkTo.activate
(self)
Send 'activate' command
Send 'activate' command
[ "Send", "activate", "command" ]
def activate(self): """Send 'activate' command""" self.send('misc', 'actv')
[ "def", "activate", "(", "self", ")", ":", "self", ".", "send", "(", "'misc'", ",", "'actv'", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/plat-mac/aetools.py#L235-L237
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/distributed/ps_instance.py
python
PaddlePSInstance.barrier_worker
(self)
barrier workers
barrier workers
[ "barrier", "workers" ]
def barrier_worker(self): """ barrier workers """ if self.is_worker(): self._comm.barrier() pass
[ "def", "barrier_worker", "(", "self", ")", ":", "if", "self", ".", "is_worker", "(", ")", ":", "self", ".", "_comm", ".", "barrier", "(", ")", "pass" ]
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/distributed/ps_instance.py#L142-L148
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
dom/bindings/Configuration.py
python
Descriptor.isGlobal
(self)
return (self.interface.getExtendedAttribute("Global") or self.interface.getExtendedAttribute("PrimaryGlobal"))
Returns true if this is the primary interface for a global object of some sort.
Returns true if this is the primary interface for a global object of some sort.
[ "Returns", "true", "if", "this", "is", "the", "primary", "interface", "for", "a", "global", "object", "of", "some", "sort", "." ]
def isGlobal(self): """ Returns true if this is the primary interface for a global object of some sort. """ return (self.interface.getExtendedAttribute("Global") or self.interface.getExtendedAttribute("PrimaryGlobal"))
[ "def", "isGlobal", "(", "self", ")", ":", "return", "(", "self", ".", "interface", ".", "getExtendedAttribute", "(", "\"Global\"", ")", "or", "self", ".", "interface", ".", "getExtendedAttribute", "(", "\"PrimaryGlobal\"", ")", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/Configuration.py#L580-L586
msracver/Deep-Image-Analogy
632b9287b42552e32dad64922967c8c9ec7fc4d3
python/caffe/io.py
python
Transformer.preprocess
(self, in_, data)
return caffe_in
Format input for Caffe: - convert to single - resize to input dimensions (preserving number of channels) - transpose dimensions to K x H x W - reorder channels (for instance color to BGR) - scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models) - subtract mean...
Format input for Caffe: - convert to single - resize to input dimensions (preserving number of channels) - transpose dimensions to K x H x W - reorder channels (for instance color to BGR) - scale raw input (e.g. from [0, 1] to [0, 255] for ImageNet models) - subtract mean...
[ "Format", "input", "for", "Caffe", ":", "-", "convert", "to", "single", "-", "resize", "to", "input", "dimensions", "(", "preserving", "number", "of", "channels", ")", "-", "transpose", "dimensions", "to", "K", "x", "H", "x", "W", "-", "reorder", "channe...
def preprocess(self, in_, data): """ Format input for Caffe: - convert to single - resize to input dimensions (preserving number of channels) - transpose dimensions to K x H x W - reorder channels (for instance color to BGR) - scale raw input (e.g. from [0, 1] to ...
[ "def", "preprocess", "(", "self", ",", "in_", ",", "data", ")", ":", "self", ".", "__check_input", "(", "in_", ")", "caffe_in", "=", "data", ".", "astype", "(", "np", ".", "float32", ",", "copy", "=", "False", ")", "transpose", "=", "self", ".", "t...
https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/python/caffe/io.py#L122-L162
lighttransport/nanogi
98cd6b40b8a5b0f96a62e631b51faf4b57c341b3
utils/exporters/blender/io_nanogi/yaml/__init__.py
python
compose
(stream, Loader=Loader)
Parse the first YAML document in a stream and produce the corresponding representation tree.
Parse the first YAML document in a stream and produce the corresponding representation tree.
[ "Parse", "the", "first", "YAML", "document", "in", "a", "stream", "and", "produce", "the", "corresponding", "representation", "tree", "." ]
def compose(stream, Loader=Loader): """ Parse the first YAML document in a stream and produce the corresponding representation tree. """ loader = Loader(stream) try: return loader.get_single_node() finally: loader.dispose()
[ "def", "compose", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "return", "loader", ".", "get_single_node", "(", ")", "finally", ":", "loader", ".", "dispose", "(", ")" ]
https://github.com/lighttransport/nanogi/blob/98cd6b40b8a5b0f96a62e631b51faf4b57c341b3/utils/exporters/blender/io_nanogi/yaml/__init__.py#L42-L51
apple/swift
469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893
utils/gyb_syntax_support/__init__.py
python
check_parsed_child_condition_raw
(child)
return result
Generates a C++ closure to check whether a given raw syntax node can satisfy the requirements of child.
Generates a C++ closure to check whether a given raw syntax node can satisfy the requirements of child.
[ "Generates", "a", "C", "++", "closure", "to", "check", "whether", "a", "given", "raw", "syntax", "node", "can", "satisfy", "the", "requirements", "of", "child", "." ]
def check_parsed_child_condition_raw(child): """ Generates a C++ closure to check whether a given raw syntax node can satisfy the requirements of child. """ result = '[](const ParsedRawSyntaxNode &Raw) {\n' result += ' // check %s\n' % child.name if child.is_optional: result += 'if (...
[ "def", "check_parsed_child_condition_raw", "(", "child", ")", ":", "result", "=", "'[](const ParsedRawSyntaxNode &Raw) {\\n'", "result", "+=", "' // check %s\\n'", "%", "child", ".", "name", "if", "child", ".", "is_optional", ":", "result", "+=", "'if (Raw.isNull()) ret...
https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/gyb_syntax_support/__init__.py#L83-L110
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py
python
X509Name.__getattr__
(self, name)
return result
Find attribute. An X509Name object has the following attributes: countryName (alias C), stateOrProvince (alias ST), locality (alias L), organization (alias O), organizationalUnit (alias OU), commonName (alias CN) and more...
Find attribute. An X509Name object has the following attributes: countryName (alias C), stateOrProvince (alias ST), locality (alias L), organization (alias O), organizationalUnit (alias OU), commonName (alias CN) and more...
[ "Find", "attribute", ".", "An", "X509Name", "object", "has", "the", "following", "attributes", ":", "countryName", "(", "alias", "C", ")", "stateOrProvince", "(", "alias", "ST", ")", "locality", "(", "alias", "L", ")", "organization", "(", "alias", "O", ")...
def __getattr__(self, name): """ Find attribute. An X509Name object has the following attributes: countryName (alias C), stateOrProvince (alias ST), locality (alias L), organization (alias O), organizationalUnit (alias OU), commonName (alias CN) and more... """ ni...
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "nid", "=", "_lib", ".", "OBJ_txt2nid", "(", "_byte_string", "(", "name", ")", ")", "if", "nid", "==", "_lib", ".", "NID_undef", ":", "# This is a bit weird. OBJ_txt2nid indicated failure, but it seems", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py#L579-L617
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/rangeobj.py
python
range_iter_len
(typingctx, val)
An implementation of len(range_iter) for internal use.
An implementation of len(range_iter) for internal use.
[ "An", "implementation", "of", "len", "(", "range_iter", ")", "for", "internal", "use", "." ]
def range_iter_len(typingctx, val): """ An implementation of len(range_iter) for internal use. """ if isinstance(val, types.RangeIteratorType): val_type = val.yield_type def codegen(context, builder, sig, args): (value,) = args iter_type = range_impl_map[val_type]...
[ "def", "range_iter_len", "(", "typingctx", ",", "val", ")", ":", "if", "isinstance", "(", "val", ",", "types", ".", "RangeIteratorType", ")", ":", "val_type", "=", "val", ".", "yield_type", "def", "codegen", "(", "context", ",", "builder", ",", "sig", ",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/rangeobj.py#L183-L214
clementine-player/Clementine
111379dfd027802b59125829fcf87e3e1d0ad73b
dist/cpplint.py
python
IsErrorSuppressedByNolint
(category, linenum)
return (linenum in _error_suppressions.get(category, set()) or linenum in _error_suppressions.get(None, set()))
Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ResetNolintSuppressions. Args: category: str, the category of the error. linenum: int, the current line number. Returns: bool, True iff the error...
Returns true if the specified error category is suppressed on this line.
[ "Returns", "true", "if", "the", "specified", "error", "category", "is", "suppressed", "on", "this", "line", "." ]
def IsErrorSuppressedByNolint(category, linenum): """Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ResetNolintSuppressions. Args: category: str, the category of the error. linenum: int, the curre...
[ "def", "IsErrorSuppressedByNolint", "(", "category", ",", "linenum", ")", ":", "return", "(", "linenum", "in", "_error_suppressions", ".", "get", "(", "category", ",", "set", "(", ")", ")", "or", "linenum", "in", "_error_suppressions", ".", "get", "(", "None...
https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L535-L548
MhLiao/TextBoxes_plusplus
39d4898de1504c53a2ed3d67966a57b3595836d0
scripts/cpp_lint.py
python
Error
(filename, linenum, category, confidence, message)
Logs the fact we've found a lint error. We log where the error was found, and also our confidence in the error, that is, how certain we are this is a legitimate style regression, and not a misidentification or a use that's sometimes justified. False positives can be suppressed by the use of "cpplint(categor...
Logs the fact we've found a lint error.
[ "Logs", "the", "fact", "we", "ve", "found", "a", "lint", "error", "." ]
def Error(filename, linenum, category, confidence, message): """Logs the fact we've found a lint error. We log where the error was found, and also our confidence in the error, that is, how certain we are this is a legitimate style regression, and not a misidentification or a use that's sometimes justified. ...
[ "def", "Error", "(", "filename", ",", "linenum", ",", "category", ",", "confidence", ",", "message", ")", ":", "if", "_ShouldPrintError", "(", "category", ",", "confidence", ",", "linenum", ")", ":", "_cpplint_state", ".", "IncrementErrorCount", "(", "category...
https://github.com/MhLiao/TextBoxes_plusplus/blob/39d4898de1504c53a2ed3d67966a57b3595836d0/scripts/cpp_lint.py#L988-L1020
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
gpu/command_buffer/build_gles2_cmd_buffer.py
python
Argument.WriteGetCode
(self, file)
Writes the code to get an argument from a command structure.
Writes the code to get an argument from a command structure.
[ "Writes", "the", "code", "to", "get", "an", "argument", "from", "a", "command", "structure", "." ]
def WriteGetCode(self, file): """Writes the code to get an argument from a command structure.""" file.Write(" %s %s = static_cast<%s>(c.%s);\n" % (self.type, self.name, self.type, self.name))
[ "def", "WriteGetCode", "(", "self", ",", "file", ")", ":", "file", ".", "Write", "(", "\" %s %s = static_cast<%s>(c.%s);\\n\"", "%", "(", "self", ".", "type", ",", "self", ".", "name", ",", "self", ".", "type", ",", "self", ".", "name", ")", ")" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L4598-L4601
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Utilities/Sphinx/sphinx_apidoc.py
python
create_package_file
(root, master_package, subroot, py_files, opts, subs)
Build the text of the file and write the file.
Build the text of the file and write the file.
[ "Build", "the", "text", "of", "the", "file", "and", "write", "the", "file", "." ]
def create_package_file(root, master_package, subroot, py_files, opts, subs): """Build the text of the file and write the file.""" # **modified** # This function has been modified from the original. We now create a # separate file for each module in the package, rather than adding it to the # same f...
[ "def", "create_package_file", "(", "root", ",", "master_package", ",", "subroot", ",", "py_files", ",", "opts", ",", "subs", ")", ":", "# **modified**", "# This function has been modified from the original. We now create a", "# separate file for each module in the package, rather...
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Utilities/Sphinx/sphinx_apidoc.py#L186-L238
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/targets.py
python
get_process_triple
()
Return a target triple suitable for generating code for the current process. An example when the default triple from ``get_default_triple()`` is not be suitable is when LLVM is compiled for 32-bit but the process is executing in 64-bit mode.
Return a target triple suitable for generating code for the current process. An example when the default triple from ``get_default_triple()`` is not be suitable is when LLVM is compiled for 32-bit but the process is executing in 64-bit mode.
[ "Return", "a", "target", "triple", "suitable", "for", "generating", "code", "for", "the", "current", "process", ".", "An", "example", "when", "the", "default", "triple", "from", "get_default_triple", "()", "is", "not", "be", "suitable", "is", "when", "LLVM", ...
def get_process_triple(): """ Return a target triple suitable for generating code for the current process. An example when the default triple from ``get_default_triple()`` is not be suitable is when LLVM is compiled for 32-bit but the process is executing in 64-bit mode. """ with ffi.OutputS...
[ "def", "get_process_triple", "(", ")", ":", "with", "ffi", ".", "OutputString", "(", ")", "as", "out", ":", "ffi", ".", "lib", ".", "LLVMPY_GetProcessTriple", "(", "out", ")", "return", "str", "(", "out", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/targets.py#L11-L20
macchina-io/macchina.io
ef24ba0e18379c3dd48fb84e6dbf991101cb8db0
platform/JS/V8/tools/gyp/pylib/gyp/generator/analyzer.py
python
_WasGypIncludeFileModified
(params, files)
return False
Returns true if one of the files in |files| is in the set of included files.
Returns true if one of the files in |files| is in the set of included files.
[ "Returns", "true", "if", "one", "of", "the", "files", "in", "|files|", "is", "in", "the", "set", "of", "included", "files", "." ]
def _WasGypIncludeFileModified(params, files): """Returns true if one of the files in |files| is in the set of included files.""" if params['options'].includes: for include in params['options'].includes: if _ToGypPath(os.path.normpath(include)) in files: print 'Include file modified, assuming al...
[ "def", "_WasGypIncludeFileModified", "(", "params", ",", "files", ")", ":", "if", "params", "[", "'options'", "]", ".", "includes", ":", "for", "include", "in", "params", "[", "'options'", "]", ".", "includes", ":", "if", "_ToGypPath", "(", "os", ".", "p...
https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/analyzer.py#L553-L561
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/sessions.py
python
Session.head
(self, url, **kwargs)
return self.request('HEAD', url, **kwargs)
r"""Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response
r"""Sends a HEAD request. Returns :class:`Response` object.
[ "r", "Sends", "a", "HEAD", "request", ".", "Returns", ":", "class", ":", "Response", "object", "." ]
def head(self, url, **kwargs): r"""Sends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. :rtype: requests.Response """ kwargs.setdefault('allow_redirects...
[ "def", "head", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'allow_redirects'", ",", "False", ")", "return", "self", ".", "request", "(", "'HEAD'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/sessions.py#L556-L565
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/plot_widget/raw_pane/raw_pane_model.py
python
RawPaneModel.get_workspace_list_and_indices_to_plot
(self, is_raw, plot_type, detectors:str, run, period=None)
return workspace_list, indices
:return: a list of workspace names to plot
:return: a list of workspace names to plot
[ ":", "return", ":", "a", "list", "of", "workspace", "names", "to", "plot" ]
def get_workspace_list_and_indices_to_plot(self, is_raw, plot_type, detectors:str, run, period=None): """ :return: a list of workspace names to plot """ workspace_list = self.get_workspaces_to_plot(is_raw, plot_type, detectors, run, period) indices = self._generate_run_indices(...
[ "def", "get_workspace_list_and_indices_to_plot", "(", "self", ",", "is_raw", ",", "plot_type", ",", "detectors", ":", "str", ",", "run", ",", "period", "=", "None", ")", ":", "workspace_list", "=", "self", ".", "get_workspaces_to_plot", "(", "is_raw", ",", "pl...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/plot_widget/raw_pane/raw_pane_model.py#L85-L91
p4lang/behavioral-model
81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9
tools/p4dbg.py
python
DebuggerAPI.do_next
(self, line)
Go to next field update: next(n)
Go to next field update: next(n)
[ "Go", "to", "next", "field", "update", ":", "next", "(", "n", ")" ]
def do_next(self, line): "Go to next field update: next(n)" req = Msg_Next(switch_id = 0, req_id = self.get_req_id()) msg = self.continue_or_next(req, True) if msg is None: return if msg.type == MsgType.FIELD_VALUE: if msg.fid in {FIELD_ID_CTR, FIELD_ID_CO...
[ "def", "do_next", "(", "self", ",", "line", ")", ":", "req", "=", "Msg_Next", "(", "switch_id", "=", "0", ",", "req_id", "=", "self", ".", "get_req_id", "(", ")", ")", "msg", "=", "self", ".", "continue_or_next", "(", "req", ",", "True", ")", "if",...
https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/p4dbg.py#L761-L778
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/skia/tools/add_codereview_message.py
python
main
(argv)
main function; see module-level docstring and GetOptionParser help. Args: argv: sys.argv[1:]-type argument list.
main function; see module-level docstring and GetOptionParser help.
[ "main", "function", ";", "see", "module", "-", "level", "docstring", "and", "GetOptionParser", "help", "." ]
def main(argv): """main function; see module-level docstring and GetOptionParser help. Args: argv: sys.argv[1:]-type argument list. """ option_parser = optparse.OptionParser(usage=__doc__) _, arguments = option_parser.parse_args(argv) if len(arguments) > 1: option_parser.error('Extra arguments.'...
[ "def", "main", "(", "argv", ")", ":", "option_parser", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "__doc__", ")", "_", ",", "arguments", "=", "option_parser", ".", "parse_args", "(", "argv", ")", "if", "len", "(", "arguments", ")", ">", "...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/skia/tools/add_codereview_message.py#L49-L64
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/internals/concat.py
python
_concatenate_join_units
( join_units: list[JoinUnit], concat_axis: int, copy: bool )
return concat_values
Concatenate values from several join units along selected axis.
Concatenate values from several join units along selected axis.
[ "Concatenate", "values", "from", "several", "join", "units", "along", "selected", "axis", "." ]
def _concatenate_join_units( join_units: list[JoinUnit], concat_axis: int, copy: bool ) -> ArrayLike: """ Concatenate values from several join units along selected axis. """ if concat_axis == 0 and len(join_units) > 1: # Concatenating join units along ax0 is handled in _merge_blocks. ...
[ "def", "_concatenate_join_units", "(", "join_units", ":", "list", "[", "JoinUnit", "]", ",", "concat_axis", ":", "int", ",", "copy", ":", "bool", ")", "->", "ArrayLike", ":", "if", "concat_axis", "==", "0", "and", "len", "(", "join_units", ")", ">", "1",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/internals/concat.py#L475-L525
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/aui.py
python
AuiToolBarArt.DrawOverflowButton
(*args, **kwargs)
return _aui.AuiToolBarArt_DrawOverflowButton(*args, **kwargs)
DrawOverflowButton(self, DC dc, Window wnd, Rect rect, int state)
DrawOverflowButton(self, DC dc, Window wnd, Rect rect, int state)
[ "DrawOverflowButton", "(", "self", "DC", "dc", "Window", "wnd", "Rect", "rect", "int", "state", ")" ]
def DrawOverflowButton(*args, **kwargs): """DrawOverflowButton(self, DC dc, Window wnd, Rect rect, int state)""" return _aui.AuiToolBarArt_DrawOverflowButton(*args, **kwargs)
[ "def", "DrawOverflowButton", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_aui", ".", "AuiToolBarArt_DrawOverflowButton", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L1950-L1952
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sets.py
python
Set.symmetric_difference_update
(self, other)
Update a set with the symmetric difference of itself and another.
Update a set with the symmetric difference of itself and another.
[ "Update", "a", "set", "with", "the", "symmetric", "difference", "of", "itself", "and", "another", "." ]
def symmetric_difference_update(self, other): """Update a set with the symmetric difference of itself and another.""" data = self._data value = True if not isinstance(other, BaseSet): other = Set(other) if self is other: self.clear() for elt in oth...
[ "def", "symmetric_difference_update", "(", "self", ",", "other", ")", ":", "data", "=", "self", ".", "_data", "value", "=", "True", "if", "not", "isinstance", "(", "other", ",", "BaseSet", ")", ":", "other", "=", "Set", "(", "other", ")", "if", "self",...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sets.py#L457-L469
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/fixer_util.py
python
_is_import_binding
(node, name, package=None)
return None
Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples.
Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples.
[ "Will", "reuturn", "node", "if", "node", "will", "import", "name", "or", "node", "will", "import", "*", "from", "package", ".", "None", "is", "returned", "otherwise", ".", "See", "test", "cases", "for", "examples", "." ]
def _is_import_binding(node, name, package=None): """ Will reuturn node if node will import name, or node will import * from package. None is returned otherwise. See test cases for examples. """ if node.type == syms.import_name and not package: imp = node.children[1] if imp.typ...
[ "def", "_is_import_binding", "(", "node", ",", "name", ",", "package", "=", "None", ")", ":", "if", "node", ".", "type", "==", "syms", ".", "import_name", "and", "not", "package", ":", "imp", "=", "node", ".", "children", "[", "1", "]", "if", "imp", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/fixer_util.py#L393-L432
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/framework/function.py
python
_DefinedFunction._create_definition_if_needed_impl
(self)
This is not what you want, see _create_definition_if_needed.
This is not what you want, see _create_definition_if_needed.
[ "This", "is", "not", "what", "you", "want", "see", "_create_definition_if_needed", "." ]
def _create_definition_if_needed_impl(self): """This is not what you want, see _create_definition_if_needed.""" if self._definition is not None or self._c_func is not None: return # Copy variable collections (by reference) from the parent graph such that # name based variable sharing (e.g. via tf...
[ "def", "_create_definition_if_needed_impl", "(", "self", ")", ":", "if", "self", ".", "_definition", "is", "not", "None", "or", "self", ".", "_c_func", "is", "not", "None", ":", "return", "# Copy variable collections (by reference) from the parent graph such that", "# n...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/function.py#L378-L475
fifengine/fifengine
4b62c42e85bec19893cef8e63e6855927cff2c47
engine/python/fife/extensions/pychan/attrs.py
python
Attr.set
(self,obj,value)
Parses the given value with the L{parse} method and sets it on the given instance with C{setattr}.
Parses the given value with the L{parse} method and sets it on the given instance with C{setattr}.
[ "Parses", "the", "given", "value", "with", "the", "L", "{", "parse", "}", "method", "and", "sets", "it", "on", "the", "given", "instance", "with", "C", "{", "setattr", "}", "." ]
def set(self,obj,value): """ Parses the given value with the L{parse} method and sets it on the given instance with C{setattr}. """ value = self.parse(value) setattr(obj,self.name,value)
[ "def", "set", "(", "self", ",", "obj", ",", "value", ")", ":", "value", "=", "self", ".", "parse", "(", "value", ")", "setattr", "(", "obj", ",", "self", ".", "name", ",", "value", ")" ]
https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/attrs.py#L57-L63
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/session_bundle/exporter.py
python
Exporter.export
(self, export_dir_base, global_step_tensor, sess=None, exports_to_keep=None)
return export_dir
Exports the model. Args: export_dir_base: A string path to the base export dir. global_step_tensor: An Tensor or tensor name providing the global step counter to append to the export directory path and set in the manifest version. sess: A Session to use to save the parameters. ...
Exports the model.
[ "Exports", "the", "model", "." ]
def export(self, export_dir_base, global_step_tensor, sess=None, exports_to_keep=None): """Exports the model. Args: export_dir_base: A string path to the base export dir. global_step_tensor: An Tensor or tensor name providing the global st...
[ "def", "export", "(", "self", ",", "export_dir_base", ",", "global_step_tensor", ",", "sess", "=", "None", ",", "exports_to_keep", "=", "None", ")", ":", "if", "not", "self", ".", "_has_init", ":", "raise", "RuntimeError", "(", "\"init must be called first\"", ...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/session_bundle/exporter.py#L224-L300
facebookincubator/BOLT
88c70afe9d388ad430cc150cc158641701397f70
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
python
PtyProcess.close
(self, force=True)
This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the child ignores SIGHUP and SIGINT).
This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the child ignores SIGHUP and SIGINT).
[ "This", "closes", "the", "connection", "with", "the", "child", "application", ".", "Note", "that", "calling", "close", "()", "more", "than", "once", "is", "valid", ".", "This", "emulates", "standard", "Python", "behavior", "with", "files", ".", "Set", "force...
def close(self, force=True): '''This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python behavior with files. Set force to True if you want to make sure that the child is terminated (SIGKILL is sent if the chi...
[ "def", "close", "(", "self", ",", "force", "=", "True", ")", ":", "if", "not", "self", ".", "closed", ":", "self", ".", "flush", "(", ")", "self", ".", "fileobj", ".", "close", "(", ")", "# Closes the file descriptor", "# Give kernel time to update process s...
https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L387-L402
msftguy/ssh-rd
a5f3a79daeac5844edebf01916c9613563f1c390
_3rd/boost_1_48_0/tools/build/v2/build/virtual_target.py
python
AbstractFileTarget.action
(self)
return self.action_
Returns the action.
Returns the action.
[ "Returns", "the", "action", "." ]
def action (self): """ Returns the action. """ return self.action_
[ "def", "action", "(", "self", ")", ":", "return", "self", ".", "action_" ]
https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/build/virtual_target.py#L407-L410
fatih/subvim
241b6d170597857105da219c9b7d36059e9f11fb
vim/base/YouCompleteMe/third_party/requests/requests/packages/urllib3/fields.py
python
RequestField._render_parts
(self, header_parts)
return '; '.join(parts)
Helper function to format and quote a single header. Useful for single headers that are composed of multiple items. E.g., 'Content-Disposition' fields. :param header_parts: A sequence of (k, v) typles or a :class:`dict` of (k, v) to format as `k1="v1"; k2="v2"; ...`.
Helper function to format and quote a single header.
[ "Helper", "function", "to", "format", "and", "quote", "a", "single", "header", "." ]
def _render_parts(self, header_parts): """ Helper function to format and quote a single header. Useful for single headers that are composed of multiple items. E.g., 'Content-Disposition' fields. :param header_parts: A sequence of (k, v) typles or a :class:`dict` of ...
[ "def", "_render_parts", "(", "self", ",", "header_parts", ")", ":", "parts", "=", "[", "]", "iterable", "=", "header_parts", "if", "isinstance", "(", "header_parts", ",", "dict", ")", ":", "iterable", "=", "header_parts", ".", "items", "(", ")", "for", "...
https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/packages/urllib3/fields.py#L120-L140
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/training/tracking/util.py
python
list_objects
(root_trackable)
return graph_view_lib.ObjectGraphView(root_trackable).list_objects()
Traverse the object graph and list all accessible objects. Looks for `Trackable` objects which are dependencies of `root_trackable`. Includes slot variables only if the variable they are slotting for and the optimizer are dependencies of `root_trackable` (i.e. if they would be saved with a checkpoint). Args...
Traverse the object graph and list all accessible objects.
[ "Traverse", "the", "object", "graph", "and", "list", "all", "accessible", "objects", "." ]
def list_objects(root_trackable): """Traverse the object graph and list all accessible objects. Looks for `Trackable` objects which are dependencies of `root_trackable`. Includes slot variables only if the variable they are slotting for and the optimizer are dependencies of `root_trackable` (i.e. if they wou...
[ "def", "list_objects", "(", "root_trackable", ")", ":", "return", "graph_view_lib", ".", "ObjectGraphView", "(", "root_trackable", ")", ".", "list_objects", "(", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/tracking/util.py#L549-L563
psnonis/FinBERT
c0c555d833a14e2316a3701e59c0b5156f804b4e
bert-gpu/modeling.py
python
BertModel.get_embedding_output
(self)
return self.embedding_output
Gets output of the embedding lookup (i.e., input to the transformer). Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the output of the embedding layer, after summing the word embeddings with the positional embeddings and the token type embeddings, then...
Gets output of the embedding lookup (i.e., input to the transformer).
[ "Gets", "output", "of", "the", "embedding", "lookup", "(", "i", ".", "e", ".", "input", "to", "the", "transformer", ")", "." ]
def get_embedding_output(self): """Gets output of the embedding lookup (i.e., input to the transformer). Returns: float Tensor of shape [batch_size, seq_length, hidden_size] corresponding to the output of the embedding layer, after summing the word embeddings with the positional embeddings an...
[ "def", "get_embedding_output", "(", "self", ")", ":", "return", "self", ".", "embedding_output" ]
https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert-gpu/modeling.py#L257-L266
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_misc.py
python
MimeTypesManager.Initialize
(*args, **kwargs)
return _misc_.MimeTypesManager_Initialize(*args, **kwargs)
Initialize(self, int mailcapStyle=MAILCAP_ALL, String extraDir=EmptyString)
Initialize(self, int mailcapStyle=MAILCAP_ALL, String extraDir=EmptyString)
[ "Initialize", "(", "self", "int", "mailcapStyle", "=", "MAILCAP_ALL", "String", "extraDir", "=", "EmptyString", ")" ]
def Initialize(*args, **kwargs): """Initialize(self, int mailcapStyle=MAILCAP_ALL, String extraDir=EmptyString)""" return _misc_.MimeTypesManager_Initialize(*args, **kwargs)
[ "def", "Initialize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "MimeTypesManager_Initialize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L2661-L2663
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
driver/python/pysequoiadb/collection.py
python
collection.__init__
(self)
create a new collection. Exceptions: pysequoiadb.error.SDBBaseError
create a new collection.
[ "create", "a", "new", "collection", "." ]
def __init__(self): """create a new collection. Exceptions: pysequoiadb.error.SDBBaseError """ try: self._cl = sdb.create_cl() except SystemError: raise SDBSystemError(SDB_OOM, "Failed to alloc collection")
[ "def", "__init__", "(", "self", ")", ":", "try", ":", "self", ".", "_cl", "=", "sdb", ".", "create_cl", "(", ")", "except", "SystemError", ":", "raise", "SDBSystemError", "(", "SDB_OOM", ",", "\"Failed to alloc collection\"", ")" ]
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/collection.py#L74-L83
Samsung/veles
95ed733c2e49bc011ad98ccf2416ecec23fbf352
libVeles/cpplint.py
python
_SetOutputFormat
(output_format)
Sets the module's output format.
Sets the module's output format.
[ "Sets", "the", "module", "s", "output", "format", "." ]
def _SetOutputFormat(output_format): """Sets the module's output format.""" _cpplint_state.SetOutputFormat(output_format)
[ "def", "_SetOutputFormat", "(", "output_format", ")", ":", "_cpplint_state", ".", "SetOutputFormat", "(", "output_format", ")" ]
https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/libVeles/cpplint.py#L636-L638
apiaryio/drafter
4634ebd07f6c6f257cc656598ccd535492fdfb55
tools/gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings.IsUseLibraryDependencyInputs
(self, config)
return uldi == 'true'
Returns whether the target should be linked via Use Library Dependency Inputs (using component .objs of a given .lib).
Returns whether the target should be linked via Use Library Dependency Inputs (using component .objs of a given .lib).
[ "Returns", "whether", "the", "target", "should", "be", "linked", "via", "Use", "Library", "Dependency", "Inputs", "(", "using", "component", ".", "objs", "of", "a", "given", ".", "lib", ")", "." ]
def IsUseLibraryDependencyInputs(self, config): """Returns whether the target should be linked via Use Library Dependency Inputs (using component .objs of a given .lib).""" config = self._TargetConfig(config) uldi = self._Setting(('VCLinkerTool', 'UseLibraryDependencyInputs'), config) return uldi ==...
[ "def", "IsUseLibraryDependencyInputs", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "uldi", "=", "self", ".", "_Setting", "(", "(", "'VCLinkerTool'", ",", "'UseLibraryDependencyInputs'", ")", ",", "conf...
https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/msvs_emulation.py#L757-L762
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py
python
AddrlistClass.getdomainliteral
(self)
return '[%s]' % self.getdelimited('[', ']\r', 0)
Parse an RFC 2822 domain-literal.
Parse an RFC 2822 domain-literal.
[ "Parse", "an", "RFC", "2822", "domain", "-", "literal", "." ]
def getdomainliteral(self): """Parse an RFC 2822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0)
[ "def", "getdomainliteral", "(", "self", ")", ":", "return", "'[%s]'", "%", "self", ".", "getdelimited", "(", "'['", ",", "']\\r'", ",", "0", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py#L724-L726
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
remoting/tools/me2me_virtual_host.py
python
Config.save_and_log_errors
(self)
Calls self.save(), trapping and logging any errors.
Calls self.save(), trapping and logging any errors.
[ "Calls", "self", ".", "save", "()", "trapping", "and", "logging", "any", "errors", "." ]
def save_and_log_errors(self): """Calls self.save(), trapping and logging any errors.""" try: self.save() except (IOError, TypeError) as e: logging.error("Failed to save config: " + str(e))
[ "def", "save_and_log_errors", "(", "self", ")", ":", "try", ":", "self", ".", "save", "(", ")", "except", "(", "IOError", ",", "TypeError", ")", "as", "e", ":", "logging", ".", "error", "(", "\"Failed to save config: \"", "+", "str", "(", "e", ")", ")"...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/remoting/tools/me2me_virtual_host.py#L126-L131
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
TextEntryBase.IsEditable
(*args, **kwargs)
return _core_.TextEntryBase_IsEditable(*args, **kwargs)
IsEditable(self) -> bool
IsEditable(self) -> bool
[ "IsEditable", "(", "self", ")", "-", ">", "bool" ]
def IsEditable(*args, **kwargs): """IsEditable(self) -> bool""" return _core_.TextEntryBase_IsEditable(*args, **kwargs)
[ "def", "IsEditable", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "TextEntryBase_IsEditable", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L13328-L13330
google/mediapipe
e6c19885c6d3c6f410c730952aeed2852790d306
mediapipe/python/solutions/drawing_styles.py
python
get_default_face_mesh_tesselation_style
()
return DrawingSpec(color=_GRAY, thickness=_THICKNESS_TESSELATION)
Returns the default face mesh tesselation drawing style. Returns: A DrawingSpec.
Returns the default face mesh tesselation drawing style.
[ "Returns", "the", "default", "face", "mesh", "tesselation", "drawing", "style", "." ]
def get_default_face_mesh_tesselation_style() -> DrawingSpec: """Returns the default face mesh tesselation drawing style. Returns: A DrawingSpec. """ return DrawingSpec(color=_GRAY, thickness=_THICKNESS_TESSELATION)
[ "def", "get_default_face_mesh_tesselation_style", "(", ")", "->", "DrawingSpec", ":", "return", "DrawingSpec", "(", "color", "=", "_GRAY", ",", "thickness", "=", "_THICKNESS_TESSELATION", ")" ]
https://github.com/google/mediapipe/blob/e6c19885c6d3c6f410c730952aeed2852790d306/mediapipe/python/solutions/drawing_styles.py#L177-L183
fastmachinelearning/hls4ml
58d761006250deed721d85fefea91201708f2165
hls4ml/backends/vivado_accelerator/vivado_accelerator_config.py
python
VivadoAcceleratorConfig._next_factor8_type
(self, p)
Return a new type with the width rounded to the next factor of 8 up to p's width Args: p : IntegerPrecisionType or FixedPrecisionType Returns: An IntegerPrecisionType or FixedPrecisionType with the width rounder up to the next factor of 8 of p's wi...
Return a new type with the width rounded to the next factor of 8 up to p's width Args: p : IntegerPrecisionType or FixedPrecisionType Returns: An IntegerPrecisionType or FixedPrecisionType with the width rounder up to the next factor of 8 of p's wi...
[ "Return", "a", "new", "type", "with", "the", "width", "rounded", "to", "the", "next", "factor", "of", "8", "up", "to", "p", "s", "width", "Args", ":", "p", ":", "IntegerPrecisionType", "or", "FixedPrecisionType", "Returns", ":", "An", "IntegerPrecisionType",...
def _next_factor8_type(self, p): ''' Return a new type with the width rounded to the next factor of 8 up to p's width Args: p : IntegerPrecisionType or FixedPrecisionType Returns: An IntegerPrecisionType or FixedPrecisionType with the width rounder up to t...
[ "def", "_next_factor8_type", "(", "self", ",", "p", ")", ":", "W", "=", "p", ".", "width", "newW", "=", "int", "(", "np", ".", "ceil", "(", "W", "/", "8", ")", "*", "8", ")", "if", "isinstance", "(", "p", ",", "FixedPrecisionType", ")", ":", "r...
https://github.com/fastmachinelearning/hls4ml/blob/58d761006250deed721d85fefea91201708f2165/hls4ml/backends/vivado_accelerator/vivado_accelerator_config.py#L79-L93
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/framework/docs.py
python
Library._write_class_markdown_to_file
(self, f, name, cls)
Write the class doc to `f`. Args: f: File to write to. name: name to use. cls: class object.
Write the class doc to `f`.
[ "Write", "the", "class", "doc", "to", "f", "." ]
def _write_class_markdown_to_file(self, f, name, cls): """Write the class doc to `f`. Args: f: File to write to. name: name to use. cls: class object. """ # Build the list of class methods to document. methods = dict(self.get_class_members(name, cls)) # Used later to check if ...
[ "def", "_write_class_markdown_to_file", "(", "self", ",", "f", ",", "name", ",", "cls", ")", ":", "# Build the list of class methods to document.", "methods", "=", "dict", "(", "self", ".", "get_class_members", "(", "name", ",", "cls", ")", ")", "# Used later to c...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/docs.py#L468-L501
geemaple/leetcode
68bc5032e1ee52c22ef2f2e608053484c487af54
leetcode/231.power-of-two.py
python
Solution2.isPowerOfTwo
(self, n)
return n > 0 and (2 ** 30) % n == 0
:type n: int :rtype: bool
:type n: int :rtype: bool
[ ":", "type", "n", ":", "int", ":", "rtype", ":", "bool" ]
def isPowerOfTwo(self, n): """ :type n: int :rtype: bool """ return n > 0 and (2 ** 30) % n == 0
[ "def", "isPowerOfTwo", "(", "self", ",", "n", ")", ":", "return", "n", ">", "0", "and", "(", "2", "**", "30", ")", "%", "n", "==", "0" ]
https://github.com/geemaple/leetcode/blob/68bc5032e1ee52c22ef2f2e608053484c487af54/leetcode/231.power-of-two.py#L11-L17
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_cfb.py
python
_create_cfb_cipher
(factory, **kwargs)
return CfbMode(cipher_state, iv, segment_size_bytes)
Instantiate a cipher object that performs CFB encryption/decryption. :Parameters: factory : module The underlying block cipher, a module from ``Crypto.Cipher``. :Keywords: iv : bytes/bytearray/memoryview The IV to use for CFB. IV : bytes/bytearray/memoryview Alias fo...
Instantiate a cipher object that performs CFB encryption/decryption.
[ "Instantiate", "a", "cipher", "object", "that", "performs", "CFB", "encryption", "/", "decryption", "." ]
def _create_cfb_cipher(factory, **kwargs): """Instantiate a cipher object that performs CFB encryption/decryption. :Parameters: factory : module The underlying block cipher, a module from ``Crypto.Cipher``. :Keywords: iv : bytes/bytearray/memoryview The IV to use for CFB. ...
[ "def", "_create_cfb_cipher", "(", "factory", ",", "*", "*", "kwargs", ")", ":", "cipher_state", "=", "factory", ".", "_create_base_cipher", "(", "kwargs", ")", "iv", "=", "kwargs", ".", "pop", "(", "\"IV\"", ",", "None", ")", "IV", "=", "kwargs", ".", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_cfb.py#L247-L293
biometrics/openbr
07aa03dc46d2ae041c8b2730696b32daa2fb0dbe
3rdparty/eigen-3.3.9/debug/gdb/printers.py
python
register_eigen_printers
(obj)
Register eigen pretty-printers with objfile Obj
Register eigen pretty-printers with objfile Obj
[ "Register", "eigen", "pretty", "-", "printers", "with", "objfile", "Obj" ]
def register_eigen_printers(obj): "Register eigen pretty-printers with objfile Obj" if obj == None: obj = gdb obj.pretty_printers.append(lookup_function)
[ "def", "register_eigen_printers", "(", "obj", ")", ":", "if", "obj", "==", "None", ":", "obj", "=", "gdb", "obj", ".", "pretty_printers", ".", "append", "(", "lookup_function", ")" ]
https://github.com/biometrics/openbr/blob/07aa03dc46d2ae041c8b2730696b32daa2fb0dbe/3rdparty/eigen-3.3.9/debug/gdb/printers.py#L185-L190
emscripten-core/emscripten
0d413d3c5af8b28349682496edc14656f5700c2f
third_party/ply/example/newclasscalc/calc.py
python
Calc.p_statement_expr
(self, p)
statement : expression
statement : expression
[ "statement", ":", "expression" ]
def p_statement_expr(self, p): 'statement : expression' print(p[1])
[ "def", "p_statement_expr", "(", "self", ",", "p", ")", ":", "print", "(", "p", "[", "1", "]", ")" ]
https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/newclasscalc/calc.py#L113-L115
apple/swift-lldb
d74be846ef3e62de946df343e8c234bde93a8912
scripts/Python/static-binding/lldb.py
python
SBTypeSummary.IsValid
(self)
return _lldb.SBTypeSummary_IsValid(self)
IsValid(SBTypeSummary self) -> bool
IsValid(SBTypeSummary self) -> bool
[ "IsValid", "(", "SBTypeSummary", "self", ")", "-", ">", "bool" ]
def IsValid(self): """IsValid(SBTypeSummary self) -> bool""" return _lldb.SBTypeSummary_IsValid(self)
[ "def", "IsValid", "(", "self", ")", ":", "return", "_lldb", ".", "SBTypeSummary_IsValid", "(", "self", ")" ]
https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L13834-L13836
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/smtplib.py
python
SMTP.has_extn
(self, opt)
return opt.lower() in self.esmtp_features
Does the server support a given SMTP service extension?
Does the server support a given SMTP service extension?
[ "Does", "the", "server", "support", "a", "given", "SMTP", "service", "extension?" ]
def has_extn(self, opt): """Does the server support a given SMTP service extension?""" return opt.lower() in self.esmtp_features
[ "def", "has_extn", "(", "self", ",", "opt", ")", ":", "return", "opt", ".", "lower", "(", ")", "in", "self", ".", "esmtp_features" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/smtplib.py#L485-L487
intel-iot-devkit/how-to-code-samples
b4ea616f36bbfa2e042beb1698f968cfd651d79f
watering-system/python/iot_watering_system/sms.py
python
send_sms
(payload)
Send SMS via Twilio.
Send SMS via Twilio.
[ "Send", "SMS", "via", "Twilio", "." ]
def send_sms(payload): """ Send SMS via Twilio. """ if not TWILIO_CONFIG: return client = TwilioRestClient(TWILIO_CONFIG.account_sid, TWILIO_CONFIG.auth_token) def perform_request(): global last_sms if datetime.utcnow() - last_sms > timedelta(minutes=1): ...
[ "def", "send_sms", "(", "payload", ")", ":", "if", "not", "TWILIO_CONFIG", ":", "return", "client", "=", "TwilioRestClient", "(", "TWILIO_CONFIG", ".", "account_sid", ",", "TWILIO_CONFIG", ".", "auth_token", ")", "def", "perform_request", "(", ")", ":", "globa...
https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/watering-system/python/iot_watering_system/sms.py#L30-L58
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/dataframe.py
python
DataFrame.cov
(self, **kwargs)
return df
Compute the covariance matrix of a DataFrame. Parameters ---------- **kwargs Keyword arguments to be passed to cupy.cov Returns ------- cov : DataFrame
Compute the covariance matrix of a DataFrame.
[ "Compute", "the", "covariance", "matrix", "of", "a", "DataFrame", "." ]
def cov(self, **kwargs): """Compute the covariance matrix of a DataFrame. Parameters ---------- **kwargs Keyword arguments to be passed to cupy.cov Returns ------- cov : DataFrame """ cov = cupy.cov(self.values, rowvar=False) ...
[ "def", "cov", "(", "self", ",", "*", "*", "kwargs", ")", ":", "cov", "=", "cupy", ".", "cov", "(", "self", ".", "values", ",", "rowvar", "=", "False", ")", "df", "=", "DataFrame", "(", "cupy", ".", "asfortranarray", "(", "cov", ")", ")", ".", "...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/dataframe.py#L5737-L5752
commaai/openpilot
4416c21b1e738ab7d04147c5ae52b5135e0cdb40
pyextra/acados_template/acados_ocp.py
python
AcadosOcpConstraints.uphi
(self)
return self.__uphi
:math:`\\bar{\phi}` - upper bound for convex-over-nonlinear inequalities at shooting nodes (0 to N-1). Type: :code:`np.ndarray`; default: :code:`np.array([])`.
:math:`\\bar{\phi}` - upper bound for convex-over-nonlinear inequalities at shooting nodes (0 to N-1). Type: :code:`np.ndarray`; default: :code:`np.array([])`.
[ ":", "math", ":", "\\\\", "bar", "{", "\\", "phi", "}", "-", "upper", "bound", "for", "convex", "-", "over", "-", "nonlinear", "inequalities", "at", "shooting", "nodes", "(", "0", "to", "N", "-", "1", ")", ".", "Type", ":", ":", "code", ":", "np"...
def uphi(self): """:math:`\\bar{\phi}` - upper bound for convex-over-nonlinear inequalities at shooting nodes (0 to N-1). Type: :code:`np.ndarray`; default: :code:`np.array([])`. """ return self.__uphi
[ "def", "uphi", "(", "self", ")", ":", "return", "self", ".", "__uphi" ]
https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/pyextra/acados_template/acados_ocp.py#L1284-L1289
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
PCR_AllocateResponse.__init__
(self, allocationSuccess = 0, maxPCR = 0, sizeNeeded = 0, sizeAvailable = 0)
This command is used to set the desired PCR allocation of PCR and algorithms. This command requires Platform Authorization. Attributes: allocationSuccess (int): YES if the allocation succeeded maxPCR (int): Maximum number of PCR that may be in a bank sizeNeeded (int)...
This command is used to set the desired PCR allocation of PCR and algorithms. This command requires Platform Authorization.
[ "This", "command", "is", "used", "to", "set", "the", "desired", "PCR", "allocation", "of", "PCR", "and", "algorithms", ".", "This", "command", "requires", "Platform", "Authorization", "." ]
def __init__(self, allocationSuccess = 0, maxPCR = 0, sizeNeeded = 0, sizeAvailable = 0): """ This command is used to set the desired PCR allocation of PCR and algorithms. This command requires Platform Authorization. Attributes: allocationSuccess (int): YES if the allocation succee...
[ "def", "__init__", "(", "self", ",", "allocationSuccess", "=", "0", ",", "maxPCR", "=", "0", ",", "sizeNeeded", "=", "0", ",", "sizeAvailable", "=", "0", ")", ":", "self", ".", "allocationSuccess", "=", "allocationSuccess", "self", ".", "maxPCR", "=", "m...
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L13937-L13951
may0324/DeepCompression-caffe
0aff6c1287bda4cfc7f378ed8a16524e1afabd8c
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...
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 contai...
[ "def", "CloseExpression", "(", "clean_lines", ",", "linenum", ",", "pos", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "startchar", "=", "line", "[", "pos", "]", "if", "startchar", "not", "in", "'({[<'", ":", "return", "(", ...
https://github.com/may0324/DeepCompression-caffe/blob/0aff6c1287bda4cfc7f378ed8a16524e1afabd8c/scripts/cpp_lint.py#L1254-L1297
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/evergreen_gen_build_variant.py
python
GenerateBuildVariantOrchestrator.task_def_to_fuzzer_params
(self, task_def: Task, build_variant: str)
return FuzzerGenTaskParams( task_name=remove_gen_suffix(task_def.name), variant=build_variant, suite=run_vars.get("suite"), num_files=int(run_vars.get("num_files")), num_tasks=int(run_vars.get("num_tasks")), resmoke_args=run_vars.get("resmoke_args"...
Build parameters for how a fuzzer task should be generated based on its task definition. :param task_def: Task definition in evergreen project config. :param build_variant: Name of Build Variant being generated. :return: Parameters for how a fuzzer task should be generated.
Build parameters for how a fuzzer task should be generated based on its task definition.
[ "Build", "parameters", "for", "how", "a", "fuzzer", "task", "should", "be", "generated", "based", "on", "its", "task", "definition", "." ]
def task_def_to_fuzzer_params(self, task_def: Task, build_variant: str) -> FuzzerGenTaskParams: """ Build parameters for how a fuzzer task should be generated based on its task definition. :param task_def: Task definition in evergreen project config. :param build_variant: Name of Build ...
[ "def", "task_def_to_fuzzer_params", "(", "self", ",", "task_def", ":", "Task", ",", "build_variant", ":", "str", ")", "->", "FuzzerGenTaskParams", ":", "variant", "=", "self", ".", "evg_project_config", ".", "get_variant", "(", "build_variant", ")", "run_vars", ...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/evergreen_gen_build_variant.py#L234-L263
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/framemanager.py
python
AuiDockingGuideInfo.Assign
(self, other)
Assigns the properties of the `other` :class:`AuiDockingGuideInfo` to `self`. :param `other`: another instance of :class:`AuiDockingGuideInfo`.
Assigns the properties of the `other` :class:`AuiDockingGuideInfo` to `self`.
[ "Assigns", "the", "properties", "of", "the", "other", ":", "class", ":", "AuiDockingGuideInfo", "to", "self", "." ]
def Assign(self, other): """ Assigns the properties of the `other` :class:`AuiDockingGuideInfo` to `self`. :param `other`: another instance of :class:`AuiDockingGuideInfo`. """ self.host = other.host self.dock_direction = other.dock_direction
[ "def", "Assign", "(", "self", ",", "other", ")", ":", "self", ".", "host", "=", "other", ".", "host", "self", ".", "dock_direction", "=", "other", ".", "dock_direction" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L239-L247
rbgirshick/caffe-fast-rcnn
28a579eaf0668850705598b3075b8969f22226d9
python/caffe/draw.py
python
get_edge_label
(layer)
return edge_label
Define edge label based on layer type.
Define edge label based on layer type.
[ "Define", "edge", "label", "based", "on", "layer", "type", "." ]
def get_edge_label(layer): """Define edge label based on layer type. """ if layer.type == 'Data': edge_label = 'Batch ' + str(layer.data_param.batch_size) elif layer.type == 'Convolution': edge_label = str(layer.convolution_param.num_output) elif layer.type == 'InnerProduct': ...
[ "def", "get_edge_label", "(", "layer", ")", ":", "if", "layer", ".", "type", "==", "'Data'", ":", "edge_label", "=", "'Batch '", "+", "str", "(", "layer", ".", "data_param", ".", "batch_size", ")", "elif", "layer", ".", "type", "==", "'Convolution'", ":"...
https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/python/caffe/draw.py#L37-L50
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/io/formats/console.py
python
get_console_size
()
return (display_width or terminal_width, display_height or terminal_height)
Return console size as tuple = (width, height). Returns (None,None) in non-interactive session.
Return console size as tuple = (width, height).
[ "Return", "console", "size", "as", "tuple", "=", "(", "width", "height", ")", "." ]
def get_console_size(): """ Return console size as tuple = (width, height). Returns (None,None) in non-interactive session. """ from pandas import get_option display_width = get_option("display.width") display_height = get_option("display.max_rows") # Consider # interactive shell ...
[ "def", "get_console_size", "(", ")", ":", "from", "pandas", "import", "get_option", "display_width", "=", "get_option", "(", "\"display.width\"", ")", "display_height", "=", "get_option", "(", "\"display.max_rows\"", ")", "# Consider", "# interactive shell terminal, can d...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/console.py#L8-L46
sccn/lsl_archived
2ff44b7a5172b02fe845b1fc72b9ab5578a489ed
LSL/liblsl-Python/pylsl/pylsl.py
python
XMLElement.name
(self)
return lib.lsl_name(self.e).decode('utf-8')
Name of the element.
Name of the element.
[ "Name", "of", "the", "element", "." ]
def name(self): """Name of the element.""" return lib.lsl_name(self.e).decode('utf-8')
[ "def", "name", "(", "self", ")", ":", "return", "lib", ".", "lsl_name", "(", "self", ".", "e", ")", ".", "decode", "(", "'utf-8'", ")" ]
https://github.com/sccn/lsl_archived/blob/2ff44b7a5172b02fe845b1fc72b9ab5578a489ed/LSL/liblsl-Python/pylsl/pylsl.py#L958-L960
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/linalg/_matfuncs_inv_ssq.py
python
_briggs_helper_function
(a, k)
Computes r = a^(1 / (2^k)) - 1. This is algorithm (2) of [1]_. The purpose is to avoid a danger of subtractive cancellation. For more computational efficiency it should probably be cythonized. Parameters ---------- a : complex A complex number. k : integer A nonnegative int...
Computes r = a^(1 / (2^k)) - 1.
[ "Computes", "r", "=", "a^", "(", "1", "/", "(", "2^k", "))", "-", "1", "." ]
def _briggs_helper_function(a, k): """ Computes r = a^(1 / (2^k)) - 1. This is algorithm (2) of [1]_. The purpose is to avoid a danger of subtractive cancellation. For more computational efficiency it should probably be cythonized. Parameters ---------- a : complex A complex nu...
[ "def", "_briggs_helper_function", "(", "a", ",", "k", ")", ":", "if", "k", "<", "0", "or", "int", "(", "k", ")", "!=", "k", ":", "raise", "ValueError", "(", "'expected a nonnegative integer k'", ")", "if", "k", "==", "0", ":", "return", "a", "-", "1"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/linalg/_matfuncs_inv_ssq.py#L156-L208
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
Window.InvalidateBestSize
(*args, **kwargs)
return _core_.Window_InvalidateBestSize(*args, **kwargs)
InvalidateBestSize(self) Reset the cached best size value so it will be recalculated the next time it is needed.
InvalidateBestSize(self)
[ "InvalidateBestSize", "(", "self", ")" ]
def InvalidateBestSize(*args, **kwargs): """ InvalidateBestSize(self) Reset the cached best size value so it will be recalculated the next time it is needed. """ return _core_.Window_InvalidateBestSize(*args, **kwargs)
[ "def", "InvalidateBestSize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_InvalidateBestSize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L9619-L9626
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/operations/nn_ops.py
python
SoftShrink.__init__
(self, lambd=0.5)
Initialize SoftShrink
Initialize SoftShrink
[ "Initialize", "SoftShrink" ]
def __init__(self, lambd=0.5): """Initialize SoftShrink""" validator.check_value_type("lambd", lambd, [float], self.name) validator.check_number("lambd", lambd, 0, Rel.GE, self.name)
[ "def", "__init__", "(", "self", ",", "lambd", "=", "0.5", ")", ":", "validator", ".", "check_value_type", "(", "\"lambd\"", ",", "lambd", ",", "[", "float", "]", ",", "self", ".", "name", ")", "validator", ".", "check_number", "(", "\"lambd\"", ",", "l...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/nn_ops.py#L8572-L8575
sfzhang15/FaceBoxes
b52cc92f9362d3adc08d54666aeb9ebb62fdb7da
scripts/cpp_lint.py
python
CheckBraces
(filename, clean_lines, linenum, error)
Looks for misplaced braces (e.g. at the end of line). 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.
Looks for misplaced braces (e.g. at the end of line).
[ "Looks", "for", "misplaced", "braces", "(", "e", ".", "g", ".", "at", "the", "end", "of", "line", ")", "." ]
def CheckBraces(filename, clean_lines, linenum, error): """Looks for misplaced braces (e.g. at the end of line). 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 er...
[ "def", "CheckBraces", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "# get rid of comments and strings", "if", "Match", "(", "r'\\s*{\\s*$'", ",", "line", ")", ":", ...
https://github.com/sfzhang15/FaceBoxes/blob/b52cc92f9362d3adc08d54666aeb9ebb62fdb7da/scripts/cpp_lint.py#L3073-L3244
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/aui.py
python
AuiToolBarItem.Assign
(*args, **kwargs)
return _aui.AuiToolBarItem_Assign(*args, **kwargs)
Assign(self, AuiToolBarItem c)
Assign(self, AuiToolBarItem c)
[ "Assign", "(", "self", "AuiToolBarItem", "c", ")" ]
def Assign(*args, **kwargs): """Assign(self, AuiToolBarItem c)""" return _aui.AuiToolBarItem_Assign(*args, **kwargs)
[ "def", "Assign", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_aui", ".", "AuiToolBarItem_Assign", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L1725-L1727
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/python/gem5/components/processors/abstract_core.py
python
AbstractCore.connect_dcache
(self, port: Port)
This function should connect the response port from the data cache to the right request port on the core. :param port: The response port from the icache to connect to.
This function should connect the response port from the data cache to the right request port on the core.
[ "This", "function", "should", "connect", "the", "response", "port", "from", "the", "data", "cache", "to", "the", "right", "request", "port", "on", "the", "core", "." ]
def connect_dcache(self, port: Port) -> None: """ This function should connect the response port from the data cache to the right request port on the core. :param port: The response port from the icache to connect to. """ raise NotImplementedError
[ "def", "connect_dcache", "(", "self", ",", "port", ":", "Port", ")", "->", "None", ":", "raise", "NotImplementedError" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/gem5/components/processors/abstract_core.py#L58-L65
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/ndarray/random.py
python
generalized_negative_binomial
(mu=1, alpha=1, shape=_Null, dtype=_Null, ctx=None, out=None, **kwargs)
return _random_helper(_internal._random_generalized_negative_binomial, _internal._sample_generalized_negative_binomial, [mu, alpha], shape, dtype, ctx, out, kwargs)
Draw random samples from a generalized negative binomial distribution. Samples are distributed according to a generalized negative binomial distribution parametrized by *mu* (mean) and *alpha* (dispersion). *alpha* is defined as *1/k* where *k* is the failure limit of the number of unsuccessful experim...
Draw random samples from a generalized negative binomial distribution.
[ "Draw", "random", "samples", "from", "a", "generalized", "negative", "binomial", "distribution", "." ]
def generalized_negative_binomial(mu=1, alpha=1, shape=_Null, dtype=_Null, ctx=None, out=None, **kwargs): """Draw random samples from a generalized negative binomial distribution. Samples are distributed according to a generalized negative binomial distribution parametrize...
[ "def", "generalized_negative_binomial", "(", "mu", "=", "1", ",", "alpha", "=", "1", ",", "shape", "=", "_Null", ",", "dtype", "=", "_Null", ",", "ctx", "=", "None", ",", "out", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "_random_helpe...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/random.py#L495-L550
SpenceKonde/megaTinyCore
1c4a70b18a149fe6bcb551dfa6db11ca50b8997b
megaavr/tools/libs/pyedbglib/protocols/avr32protocol.py
python
Avr32Protocol.jtag_ir
(self, bits, data)
return self.check_response(self.jtagice3_command_response( bytearray([self.CMD_AVR32_TAP, self.CMD_VERSION0, self.AVR32_TAP_IR, bits, data & 0xFF])))
Raw JTAG IR operation :param bits: number of bits to shift :param data: data to shift :return:
Raw JTAG IR operation
[ "Raw", "JTAG", "IR", "operation" ]
def jtag_ir(self, bits, data): """ Raw JTAG IR operation :param bits: number of bits to shift :param data: data to shift :return: """ return self.check_response(self.jtagice3_command_response( bytearray([self.CMD_AVR32_TAP, self.CMD_VERSION0, self.AVR...
[ "def", "jtag_ir", "(", "self", ",", "bits", ",", "data", ")", ":", "return", "self", ".", "check_response", "(", "self", ".", "jtagice3_command_response", "(", "bytearray", "(", "[", "self", ".", "CMD_AVR32_TAP", ",", "self", ".", "CMD_VERSION0", ",", "sel...
https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/protocols/avr32protocol.py#L215-L224
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/grit/grit/node/base.py
python
Node.ActiveChildren
(self)
return [node for node in self.children if not node.WhitelistMarkedAsSkip()]
Returns the children of this node that should be included in the current configuration. Overridden by <if>.
Returns the children of this node that should be included in the current configuration. Overridden by <if>.
[ "Returns", "the", "children", "of", "this", "node", "that", "should", "be", "included", "in", "the", "current", "configuration", ".", "Overridden", "by", "<if", ">", "." ]
def ActiveChildren(self): '''Returns the children of this node that should be included in the current configuration. Overridden by <if>.''' return [node for node in self.children if not node.WhitelistMarkedAsSkip()]
[ "def", "ActiveChildren", "(", "self", ")", ":", "return", "[", "node", "for", "node", "in", "self", ".", "children", "if", "not", "node", ".", "WhitelistMarkedAsSkip", "(", ")", "]" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/node/base.py#L69-L72
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Alignment/MuonAlignment/python/svgfig.py
python
SVG.append
(self, x)
Appends x to the list of sub-elements (drawn last, overlaps other primatives).
Appends x to the list of sub-elements (drawn last, overlaps other primatives).
[ "Appends", "x", "to", "the", "list", "of", "sub", "-", "elements", "(", "drawn", "last", "overlaps", "other", "primatives", ")", "." ]
def append(self, x): """Appends x to the list of sub-elements (drawn last, overlaps other primatives).""" self.sub.append(x)
[ "def", "append", "(", "self", ",", "x", ")", ":", "self", ".", "sub", ".", "append", "(", "x", ")" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MuonAlignment/python/svgfig.py#L182-L185
junhyukoh/caffe-lstm
598d45456fa2a1b127a644f4aa38daa8fb9fc722
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...
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 contai...
[ "def", "CloseExpression", "(", "clean_lines", ",", "linenum", ",", "pos", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "startchar", "=", "line", "[", "pos", "]", "if", "startchar", "not", "in", "'({[<'", ":", "return", "(", ...
https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/scripts/cpp_lint.py#L1254-L1297
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
configs/common/Simulation.py
python
findCptDir
(options, cptdir, testsys)
return cpt_starttick, checkpoint_dir
Figures out the directory from which the checkpointed state is read. There are two different ways in which the directories holding checkpoints can be named -- 1. cpt.<benchmark name>.<instruction count when the checkpoint was taken> 2. cpt.<some number, usually the tick value when the checkpoint was ta...
Figures out the directory from which the checkpointed state is read.
[ "Figures", "out", "the", "directory", "from", "which", "the", "checkpointed", "state", "is", "read", "." ]
def findCptDir(options, cptdir, testsys): """Figures out the directory from which the checkpointed state is read. There are two different ways in which the directories holding checkpoints can be named -- 1. cpt.<benchmark name>.<instruction count when the checkpoint was taken> 2. cpt.<some number, ...
[ "def", "findCptDir", "(", "options", ",", "cptdir", ",", "testsys", ")", ":", "from", "os", ".", "path", "import", "isdir", ",", "exists", "from", "os", "import", "listdir", "import", "re", "if", "not", "isdir", "(", "cptdir", ")", ":", "fatal", "(", ...
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/configs/common/Simulation.py#L114-L201
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Validation/RecoTrack/python/plotting/ntupleDataFormat.py
python
_Collection.__getitem__
(self, index)
return self._objclass(self._tree, index)
Get object 'index' in the collection.
Get object 'index' in the collection.
[ "Get", "object", "index", "in", "the", "collection", "." ]
def __getitem__(self, index): """Get object 'index' in the collection.""" return self._objclass(self._tree, index)
[ "def", "__getitem__", "(", "self", ",", "index", ")", ":", "return", "self", ".", "_objclass", "(", "self", ".", "_tree", ",", "index", ")" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/ntupleDataFormat.py#L37-L39
cryfs/cryfs
5f908c641cd5854b8a347f842b996bfe76a64577
src/gitversion/versioneer.py
python
render_pep440_pre
(pieces)
return rendered
TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE
TAG[.post.devDISTANCE] -- No -dirty.
[ "TAG", "[", ".", "post", ".", "devDISTANCE", "]", "--", "No", "-", "dirty", "." ]
def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exce...
[ "def", "render_pep440_pre", "(", "pieces", ")", ":", "if", "pieces", "[", "\"closest-tag\"", "]", ":", "rendered", "=", "pieces", "[", "\"closest-tag\"", "]", "if", "pieces", "[", "\"distance\"", "]", ":", "rendered", "+=", "\".post.dev%d\"", "%", "pieces", ...
https://github.com/cryfs/cryfs/blob/5f908c641cd5854b8a347f842b996bfe76a64577/src/gitversion/versioneer.py#L1260-L1273
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dis.py
python
_disassemble_str
(source, **kwargs)
Compile the source string, then disassemble the code object.
Compile the source string, then disassemble the code object.
[ "Compile", "the", "source", "string", "then", "disassemble", "the", "code", "object", "." ]
def _disassemble_str(source, **kwargs): """Compile the source string, then disassemble the code object.""" _disassemble_recursive(_try_compile(source, '<dis>'), **kwargs)
[ "def", "_disassemble_str", "(", "source", ",", "*", "*", "kwargs", ")", ":", "_disassemble_recursive", "(", "_try_compile", "(", "source", ",", "'<dis>'", ")", ",", "*", "*", "kwargs", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dis.py#L400-L402
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
Error.line
(self)
return ret
the line number if available
the line number if available
[ "the", "line", "number", "if", "available" ]
def line(self): """the line number if available """ ret = libxml2mod.xmlErrorGetLine(self._o) return ret
[ "def", "line", "(", "self", ")", ":", "ret", "=", "libxml2mod", ".", "xmlErrorGetLine", "(", "self", ".", "_o", ")", "return", "ret" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5833-L5836
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/contrib/layers/nn.py
python
tree_conv
(nodes_vector, edge_set, output_size, num_filters=1, max_depth=2, act='tanh', param_attr=None, bias_attr=None, name=None)
return helper.append_activation(pre_activation)
${comment} Args : nodes_vector(${nodes_vector_type}) : $ { nodes_vector_comment } edge_set(${edge_set_type}) : $ { edge_set_comment } output_size(int): output feature width num_filters(int): number of filters, Default 1 max_depth(int): max depth of filters, Default 2 act(str): activation...
${comment} Args : nodes_vector(${nodes_vector_type}) : $ { nodes_vector_comment } edge_set(${edge_set_type}) : $ { edge_set_comment } output_size(int): output feature width num_filters(int): number of filters, Default 1 max_depth(int): max depth of filters, Default 2 act(str): activation...
[ "$", "{", "comment", "}", "Args", ":", "nodes_vector", "(", "$", "{", "nodes_vector_type", "}", ")", ":", "$", "{", "nodes_vector_comment", "}", "edge_set", "(", "$", "{", "edge_set_type", "}", ")", ":", "$", "{", "edge_set_comment", "}", "output_size", ...
def tree_conv(nodes_vector, edge_set, output_size, num_filters=1, max_depth=2, act='tanh', param_attr=None, bias_attr=None, name=None): """ ${comment} Args : nodes_vector(${nodes_vector_type}) : $ { n...
[ "def", "tree_conv", "(", "nodes_vector", ",", "edge_set", ",", "output_size", ",", "num_filters", "=", "1", ",", "max_depth", "=", "2", ",", "act", "=", "'tanh'", ",", "param_attr", "=", "None", ",", "bias_attr", "=", "None", ",", "name", "=", "None", ...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/layers/nn.py#L402-L470
larroy/clearskies_core
3574ddf0edc8555454c7044126e786a6c29444dc
tools/gyp/pylib/gyp/generator/android.py
python
AndroidMkWriter.WriteSourceFlags
(self, spec, configs)
Write out the flags and include paths used to compile source files for the current target. Args: spec, configs: input from gyp.
Write out the flags and include paths used to compile source files for the current target.
[ "Write", "out", "the", "flags", "and", "include", "paths", "used", "to", "compile", "source", "files", "for", "the", "current", "target", "." ]
def WriteSourceFlags(self, spec, configs): """Write out the flags and include paths used to compile source files for the current target. Args: spec, configs: input from gyp. """ for configname, config in sorted(configs.iteritems()): extracted_includes = [] self.WriteLn('\n# Flags...
[ "def", "WriteSourceFlags", "(", "self", ",", "spec", ",", "configs", ")", ":", "for", "configname", ",", "config", "in", "sorted", "(", "configs", ".", "iteritems", "(", ")", ")", ":", "extracted_includes", "=", "[", "]", "self", ".", "WriteLn", "(", "...
https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/android.py#L464-L506
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/frame.py
python
Frame.nunique
(self, method: builtins.str = "sort", dropna: bool = True)
return { name: col.distinct_count(method=method, dropna=dropna) for name, col in self._data.items() }
Returns a per column mapping with counts of unique values for each column. Parameters ---------- method : builtins.str, default "sort" Method used by cpp_distinct_count dropna : bool, default True Don't include NaN in the counts. Returns ...
Returns a per column mapping with counts of unique values for each column.
[ "Returns", "a", "per", "column", "mapping", "with", "counts", "of", "unique", "values", "for", "each", "column", "." ]
def nunique(self, method: builtins.str = "sort", dropna: bool = True): """ Returns a per column mapping with counts of unique values for each column. Parameters ---------- method : builtins.str, default "sort" Method used by cpp_distinct_count dropna ...
[ "def", "nunique", "(", "self", ",", "method", ":", "builtins", ".", "str", "=", "\"sort\"", ",", "dropna", ":", "bool", "=", "True", ")", ":", "return", "{", "name", ":", "col", ".", "distinct_count", "(", "method", "=", "method", ",", "dropna", "=",...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/frame.py#L6456-L6476
rbgirshick/caffe-fast-rcnn
28a579eaf0668850705598b3075b8969f22226d9
scripts/cpp_lint.py
python
CheckInvalidIncrement
(filename, clean_lines, linenum, error)
Checks for invalid increment *count++. For example following function: void increment_counter(int* count) { *count++; } is invalid, because it effectively does count++, moving pointer, and should be replaced with ++*count, (*count)++ or *count += 1. Args: filename: The name of the current file. ...
Checks for invalid increment *count++.
[ "Checks", "for", "invalid", "increment", "*", "count", "++", "." ]
def CheckInvalidIncrement(filename, clean_lines, linenum, error): """Checks for invalid increment *count++. For example following function: void increment_counter(int* count) { *count++; } is invalid, because it effectively does count++, moving pointer, and should be replaced with ++*count, (*count)++ ...
[ "def", "CheckInvalidIncrement", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "_RE_PATTERN_INVALID_INCREMENT", ".", "match", "(", "line", ")", ":", "error", ...
https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L1733-L1752
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/mantid/simpleapi.py
python
_is_workspace_property
(prop)
Returns true if the property is a workspace property. Currently several properties , i.e WorspaceProperty<EventWorkspace> cannot be recognised by Python so we have to resort to a name test :param prop: A property object :type Property :returns: True if the property is considere...
Returns true if the property is a workspace property.
[ "Returns", "true", "if", "the", "property", "is", "a", "workspace", "property", "." ]
def _is_workspace_property(prop): """ Returns true if the property is a workspace property. Currently several properties , i.e WorspaceProperty<EventWorkspace> cannot be recognised by Python so we have to resort to a name test :param prop: A property object :type Property ...
[ "def", "_is_workspace_property", "(", "prop", ")", ":", "if", "isinstance", "(", "prop", ",", "_api", ".", "IWorkspaceProperty", ")", ":", "return", "True", "if", "type", "(", "prop", ")", "==", "_kernel", ".", "Property", "and", "'Workspace'", "in", "prop...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/simpleapi.py#L704-L721
yun-liu/RCF
91bfb054ad04187dbbe21e539e165ad9bd3ff00b
python/caffe/io.py
python
load_image
(filename, color=True)
return img
Load an image converting from grayscale or alpha as needed. Parameters ---------- filename : string color : boolean flag for color format. True (default) loads as RGB while False loads as intensity (if image is already grayscale). Returns ------- image : an image with type ...
Load an image converting from grayscale or alpha as needed.
[ "Load", "an", "image", "converting", "from", "grayscale", "or", "alpha", "as", "needed", "." ]
def load_image(filename, color=True): """ Load an image converting from grayscale or alpha as needed. Parameters ---------- filename : string color : boolean flag for color format. True (default) loads as RGB while False loads as intensity (if image is already grayscale). R...
[ "def", "load_image", "(", "filename", ",", "color", "=", "True", ")", ":", "img", "=", "skimage", ".", "img_as_float", "(", "skimage", ".", "io", ".", "imread", "(", "filename", ",", "as_grey", "=", "not", "color", ")", ")", ".", "astype", "(", "np",...
https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/python/caffe/io.py#L279-L303