repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
elsampsa/valkka-live
valkka/mvision/tools.py
genH264
def genH264(infile, outfile, T): """Generate H264 stream Input image, output video file, time in seconds Example: :: genH264("/home/sampsa/python3/tests/lprtest/RealImages/IMG_20170308_093511.jpg","testi.mkv", 10) """ x264opts="-x264opts keyint=10:min-keyint=10:b...
python
def genH264(infile, outfile, T): """Generate H264 stream Input image, output video file, time in seconds Example: :: genH264("/home/sampsa/python3/tests/lprtest/RealImages/IMG_20170308_093511.jpg","testi.mkv", 10) """ x264opts="-x264opts keyint=10:min-keyint=10:b...
[ "def", "genH264", "(", "infile", ",", "outfile", ",", "T", ")", ":", "x264opts", "=", "\"-x264opts keyint=10:min-keyint=10:bframes=0\"", "h264_dummystream_flavor", "=", "\"-pix_fmt yuv420p -vprofile main\"", "opts", "=", "\"-vcodec h264 \"", "+", "h264_dummystream_flavor", ...
Generate H264 stream Input image, output video file, time in seconds Example: :: genH264("/home/sampsa/python3/tests/lprtest/RealImages/IMG_20170308_093511.jpg","testi.mkv", 10)
[ "Generate", "H264", "stream", "Input", "image", "output", "video", "file", "time", "in", "seconds", "Example", ":", "::", "genH264", "(", "/", "home", "/", "sampsa", "/", "python3", "/", "tests", "/", "lprtest", "/", "RealImages", "/", "IMG_20170308_093511",...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/tools.py#L31-L49
elsampsa/valkka-live
valkka/live/cameralist.py
TreeModel.index
def index(self, row, column, parent): """ Returns the index of the item in the model specified by the given row, column and parent index. row, column == int, parent == QModelIndex """ if not self.hasIndex(row, column, parent): return QtCore.QModelIndex() if not pare...
python
def index(self, row, column, parent): """ Returns the index of the item in the model specified by the given row, column and parent index. row, column == int, parent == QModelIndex """ if not self.hasIndex(row, column, parent): return QtCore.QModelIndex() if not pare...
[ "def", "index", "(", "self", ",", "row", ",", "column", ",", "parent", ")", ":", "if", "not", "self", ".", "hasIndex", "(", "row", ",", "column", ",", "parent", ")", ":", "return", "QtCore", ".", "QModelIndex", "(", ")", "if", "not", "parent", ".",...
Returns the index of the item in the model specified by the given row, column and parent index. row, column == int, parent == QModelIndex
[ "Returns", "the", "index", "of", "the", "item", "in", "the", "model", "specified", "by", "the", "given", "row", "column", "and", "parent", "index", ".", "row", "column", "==", "int", "parent", "==", "QModelIndex" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/cameralist.py#L52-L80
elsampsa/valkka-live
valkka/live/cameralist.py
TreeModel.parent
def parent(self, index): """ Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned. """ if not index.isValid(): return QtCore.QModelIndex() childItem = index.internalPointer() # the only place where t...
python
def parent(self, index): """ Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned. """ if not index.isValid(): return QtCore.QModelIndex() childItem = index.internalPointer() # the only place where t...
[ "def", "parent", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "QtCore", ".", "QModelIndex", "(", ")", "childItem", "=", "index", ".", "internalPointer", "(", ")", "# the only place where the parent item ...
Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned.
[ "Returns", "the", "parent", "of", "the", "model", "item", "with", "the", "given", "index", ".", "If", "the", "item", "has", "no", "parent", "an", "invalid", "QModelIndex", "is", "returned", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/cameralist.py#L82-L95
elsampsa/valkka-live
valkka/live/cameralist.py
TreeModel.columnCount
def columnCount(self, parent): """ Returns the number of columns for the children of the given parent. """ # print("columnCount:",self) if parent.isValid(): return parent.internalPointer().columnCount() else: return self.root.columnCount()
python
def columnCount(self, parent): """ Returns the number of columns for the children of the given parent. """ # print("columnCount:",self) if parent.isValid(): return parent.internalPointer().columnCount() else: return self.root.columnCount()
[ "def", "columnCount", "(", "self", ",", "parent", ")", ":", "# print(\"columnCount:\",self)", "if", "parent", ".", "isValid", "(", ")", ":", "return", "parent", ".", "internalPointer", "(", ")", ".", "columnCount", "(", ")", "else", ":", "return", "self", ...
Returns the number of columns for the children of the given parent.
[ "Returns", "the", "number", "of", "columns", "for", "the", "children", "of", "the", "given", "parent", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/cameralist.py#L97-L104
elsampsa/valkka-live
valkka/live/cameralist.py
TreeModel.rowCount
def rowCount(self, parent): """ Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent. """ if parent.column() > 0: return 0 if not parent.isValid(): parentItem = self.root...
python
def rowCount(self, parent): """ Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent. """ if parent.column() > 0: return 0 if not parent.isValid(): parentItem = self.root...
[ "def", "rowCount", "(", "self", ",", "parent", ")", ":", "if", "parent", ".", "column", "(", ")", ">", "0", ":", "return", "0", "if", "not", "parent", ".", "isValid", "(", ")", ":", "parentItem", "=", "self", ".", "root", "else", ":", "parentItem",...
Returns the number of rows under the given parent. When the parent is valid it means that rowCount is returning the number of children of parent.
[ "Returns", "the", "number", "of", "rows", "under", "the", "given", "parent", ".", "When", "the", "parent", "is", "valid", "it", "means", "that", "rowCount", "is", "returning", "the", "number", "of", "children", "of", "parent", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/cameralist.py#L106-L118
elsampsa/valkka-live
valkka/live/cameralist.py
TreeModel.flags
def flags(self, index): """ Returns the item flags for the given index. """ if not index.isValid(): return QtCore.Qt.NoItemFlags item = index.internalPointer() # return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | # QtCore.Qt.ItemIsDragEnabled ...
python
def flags(self, index): """ Returns the item flags for the given index. """ if not index.isValid(): return QtCore.Qt.NoItemFlags item = index.internalPointer() # return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | # QtCore.Qt.ItemIsDragEnabled ...
[ "def", "flags", "(", "self", ",", "index", ")", ":", "if", "not", "index", ".", "isValid", "(", ")", ":", "return", "QtCore", ".", "Qt", ".", "NoItemFlags", "item", "=", "index", ".", "internalPointer", "(", ")", "# return QtCore.Qt.ItemIsEnabled | QtCore.Qt...
Returns the item flags for the given index.
[ "Returns", "the", "item", "flags", "for", "the", "given", "index", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/cameralist.py#L129-L140
Jaymon/pout
pout/interface.py
BaseInterface.full_value
def full_value(self): """Returns the full value with the path also (ie, name = value (path)) :returns: String """ s = self.name_value() s += self.path_value() s += "\n\n" return s
python
def full_value(self): """Returns the full value with the path also (ie, name = value (path)) :returns: String """ s = self.name_value() s += self.path_value() s += "\n\n" return s
[ "def", "full_value", "(", "self", ")", ":", "s", "=", "self", ".", "name_value", "(", ")", "s", "+=", "self", ".", "path_value", "(", ")", "s", "+=", "\"\\n\\n\"", "return", "s" ]
Returns the full value with the path also (ie, name = value (path)) :returns: String
[ "Returns", "the", "full", "value", "with", "the", "path", "also", "(", "ie", "name", "=", "value", "(", "path", "))" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L48-L56
Jaymon/pout
pout/interface.py
BaseInterface._printstr
def _printstr(self, args, call_info=None): """this gets all the args ready to be printed, see self._print()""" # unicode sandwich, everything printed should be a byte string s = "\n" for arg in args: #s += arg.encode('utf-8', 'pout.replace') s += arg if ...
python
def _printstr(self, args, call_info=None): """this gets all the args ready to be printed, see self._print()""" # unicode sandwich, everything printed should be a byte string s = "\n" for arg in args: #s += arg.encode('utf-8', 'pout.replace') s += arg if ...
[ "def", "_printstr", "(", "self", ",", "args", ",", "call_info", "=", "None", ")", ":", "# unicode sandwich, everything printed should be a byte string", "s", "=", "\"\\n\"", "for", "arg", "in", "args", ":", "#s += arg.encode('utf-8', 'pout.replace')", "s", "+=", "arg"...
this gets all the args ready to be printed, see self._print()
[ "this", "gets", "all", "the", "args", "ready", "to", "be", "printed", "see", "self", ".", "_print", "()" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L91-L103
Jaymon/pout
pout/interface.py
BaseInterface._str
def _str(self, name, val): ''' return a string version of name = val that can be printed example -- _str('foo', 'bar') # foo = bar name -- string -- the variable name that was passed into one of the public methods val -- mixed -- the variable at name's value ...
python
def _str(self, name, val): ''' return a string version of name = val that can be printed example -- _str('foo', 'bar') # foo = bar name -- string -- the variable name that was passed into one of the public methods val -- mixed -- the variable at name's value ...
[ "def", "_str", "(", "self", ",", "name", ",", "val", ")", ":", "s", "=", "''", "v", "=", "Value", "(", "val", ")", "if", "name", ":", "logger", ".", "debug", "(", "\"{} is type {}\"", ".", "format", "(", "name", ",", "v", ".", "typename", ")", ...
return a string version of name = val that can be printed example -- _str('foo', 'bar') # foo = bar name -- string -- the variable name that was passed into one of the public methods val -- mixed -- the variable at name's value return -- string
[ "return", "a", "string", "version", "of", "name", "=", "val", "that", "can", "be", "printed" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L106-L134
Jaymon/pout
pout/interface.py
LoggingInterface.loggers
def loggers(self): """Return all the loggers that should be activated""" ret = [] if self.logger_name: if isinstance(self.logger_name, logging.Logger): ret.append((self.logger_name.name, self.logger_name)) else: ret.append((self.logger_name...
python
def loggers(self): """Return all the loggers that should be activated""" ret = [] if self.logger_name: if isinstance(self.logger_name, logging.Logger): ret.append((self.logger_name.name, self.logger_name)) else: ret.append((self.logger_name...
[ "def", "loggers", "(", "self", ")", ":", "ret", "=", "[", "]", "if", "self", ".", "logger_name", ":", "if", "isinstance", "(", "self", ".", "logger_name", ",", "logging", ".", "Logger", ")", ":", "ret", ".", "append", "(", "(", "self", ".", "logger...
Return all the loggers that should be activated
[ "Return", "all", "the", "loggers", "that", "should", "be", "activated" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L516-L528
Jaymon/pout
pout/interface.py
TraceInterface._get_backtrace
def _get_backtrace(self, frames, inspect_packages=False, depth=0): ''' get a nicely formatted backtrace since -- 7-6-12 frames -- list -- the frame_tuple frames to format inpsect_packages -- boolean -- by default, this only prints code of packages that are not in t...
python
def _get_backtrace(self, frames, inspect_packages=False, depth=0): ''' get a nicely formatted backtrace since -- 7-6-12 frames -- list -- the frame_tuple frames to format inpsect_packages -- boolean -- by default, this only prints code of packages that are not in t...
[ "def", "_get_backtrace", "(", "self", ",", "frames", ",", "inspect_packages", "=", "False", ",", "depth", "=", "0", ")", ":", "calls", "=", "[", "]", "#count = 1", "#for count, f in enumerate(frames[1:], 1):", "for", "count", ",", "f", "in", "enumerate", "(", ...
get a nicely formatted backtrace since -- 7-6-12 frames -- list -- the frame_tuple frames to format inpsect_packages -- boolean -- by default, this only prints code of packages that are not in the pythonN directories, that cuts out a lot of the noise, set this to True if you ...
[ "get", "a", "nicely", "formatted", "backtrace" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L587-L620
Jaymon/pout
pout/interface.py
TraceInterface._get_call_summary
def _get_call_summary(self, call, index=0, inspect_packages=True): ''' get a call summary a call summary is a nicely formatted string synopsis of the call handy for backtraces since -- 7-6-12 call_info -- dict -- the dict returned from _get_call_info() index -...
python
def _get_call_summary(self, call, index=0, inspect_packages=True): ''' get a call summary a call summary is a nicely formatted string synopsis of the call handy for backtraces since -- 7-6-12 call_info -- dict -- the dict returned from _get_call_info() index -...
[ "def", "_get_call_summary", "(", "self", ",", "call", ",", "index", "=", "0", ",", "inspect_packages", "=", "True", ")", ":", "call_info", "=", "call", ".", "info", "inspect_regex", "=", "re", ".", "compile", "(", "r'[\\\\\\\\/]python\\d(?:\\.\\d+)?'", ",", ...
get a call summary a call summary is a nicely formatted string synopsis of the call handy for backtraces since -- 7-6-12 call_info -- dict -- the dict returned from _get_call_info() index -- integer -- set to something above 0 if you would like the summary to be numbered ...
[ "get", "a", "call", "summary" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/interface.py#L622-L664
elsampsa/valkka-live
valkka/live/container/mvision.py
MVisionContainer.setDevice
def setDevice(self, device): """Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice. """ self.report("setDevice :", device) if (self.mvision_process == None): return if (...
python
def setDevice(self, device): """Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice. """ self.report("setDevice :", device) if (self.mvision_process == None): return if (...
[ "def", "setDevice", "(", "self", ",", "device", ")", ":", "self", ".", "report", "(", "\"setDevice :\"", ",", "device", ")", "if", "(", "self", ".", "mvision_process", "==", "None", ")", ":", "return", "if", "(", "not", "device", "and", "not", "self", ...
Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice.
[ "Sets", "the", "video", "stream", ":", "param", "device", ":", "A", "rather", "generic", "device", "class", ".", "In", "this", "case", "DataModel", ".", "RTSPCameraDevice", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/mvision.py#L88-L139
elsampsa/valkka-live
valkka/live/container/mvision.py
MVisionContainer.clearDevice
def clearDevice(self): """Remove the current stream """ print(self.pre, "clearDevice: ") self.report("clearDevice") if not self.device: return if (self.mvision_process==None): return self.filterchain.delViewPort(self.viewp...
python
def clearDevice(self): """Remove the current stream """ print(self.pre, "clearDevice: ") self.report("clearDevice") if not self.device: return if (self.mvision_process==None): return self.filterchain.delViewPort(self.viewp...
[ "def", "clearDevice", "(", "self", ")", ":", "print", "(", "self", ".", "pre", ",", "\"clearDevice: \"", ")", "self", ".", "report", "(", "\"clearDevice\"", ")", "if", "not", "self", ".", "device", ":", "return", "if", "(", "self", ".", "mvision_process"...
Remove the current stream
[ "Remove", "the", "current", "stream" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/mvision.py#L149-L170
veripress/veripress
veripress/model/parsers.py
parser
def parser(format_name, ext_names=None): """ Decorate a parser class to register it. :param format_name: standard format name :param ext_names: supported extension name """ def decorator(cls): format_name_lower = format_name.lower() if ext_names is None: _ext_format...
python
def parser(format_name, ext_names=None): """ Decorate a parser class to register it. :param format_name: standard format name :param ext_names: supported extension name """ def decorator(cls): format_name_lower = format_name.lower() if ext_names is None: _ext_format...
[ "def", "parser", "(", "format_name", ",", "ext_names", "=", "None", ")", ":", "def", "decorator", "(", "cls", ")", ":", "format_name_lower", "=", "format_name", ".", "lower", "(", ")", "if", "ext_names", "is", "None", ":", "_ext_format_mapping", "[", "form...
Decorate a parser class to register it. :param format_name: standard format name :param ext_names: supported extension name
[ "Decorate", "a", "parser", "class", "to", "register", "it", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/parsers.py#L100-L118
veripress/veripress
veripress/model/parsers.py
Parser.parse_preview
def parse_preview(self, raw_content): """ Parse the preview part of the content, and return the parsed string and whether there is more content or not. If the preview part is equal to the whole part, the second element of the returned tuple will be False, else True. :pa...
python
def parse_preview(self, raw_content): """ Parse the preview part of the content, and return the parsed string and whether there is more content or not. If the preview part is equal to the whole part, the second element of the returned tuple will be False, else True. :pa...
[ "def", "parse_preview", "(", "self", ",", "raw_content", ")", ":", "if", "self", ".", "_read_more_exp", "is", "None", ":", "return", "self", ".", "parse_whole", "(", "raw_content", ")", ",", "False", "sp", "=", "self", ".", "_read_more_exp", ".", "split", ...
Parse the preview part of the content, and return the parsed string and whether there is more content or not. If the preview part is equal to the whole part, the second element of the returned tuple will be False, else True. :param raw_content: raw content :return: tuple(parsed...
[ "Parse", "the", "preview", "part", "of", "the", "content", "and", "return", "the", "parsed", "string", "and", "whether", "there", "is", "more", "content", "or", "not", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/parsers.py#L26-L49
veripress/veripress
veripress/model/parsers.py
Parser.remove_read_more_sep
def remove_read_more_sep(self, raw_content): """ Removes the first read_more_sep that occurs in raw_content. Subclasses should call this method to preprocess raw_content. """ if self._read_more_exp is None: return raw_content sp = self._read_more_exp.split(ra...
python
def remove_read_more_sep(self, raw_content): """ Removes the first read_more_sep that occurs in raw_content. Subclasses should call this method to preprocess raw_content. """ if self._read_more_exp is None: return raw_content sp = self._read_more_exp.split(ra...
[ "def", "remove_read_more_sep", "(", "self", ",", "raw_content", ")", ":", "if", "self", ".", "_read_more_exp", "is", "None", ":", "return", "raw_content", "sp", "=", "self", ".", "_read_more_exp", ".", "split", "(", "raw_content", ",", "maxsplit", "=", "1", ...
Removes the first read_more_sep that occurs in raw_content. Subclasses should call this method to preprocess raw_content.
[ "Removes", "the", "first", "read_more_sep", "that", "occurs", "in", "raw_content", ".", "Subclasses", "should", "call", "this", "method", "to", "preprocess", "raw_content", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/parsers.py#L58-L71
elsampsa/valkka-live
valkka/mvision/yolo3tiny/base.py
MVisionProcess.postActivate_
def postActivate_(self): """Whatever you need to do after creating the shmem client """ if (self.requiredGPU_MB(self.required_mb)): self.analyzer = YoloV3TinyAnalyzer(verbose = self.verbose) else: self.warning_message = "WARNING: not enough GPU memory!" ...
python
def postActivate_(self): """Whatever you need to do after creating the shmem client """ if (self.requiredGPU_MB(self.required_mb)): self.analyzer = YoloV3TinyAnalyzer(verbose = self.verbose) else: self.warning_message = "WARNING: not enough GPU memory!" ...
[ "def", "postActivate_", "(", "self", ")", ":", "if", "(", "self", ".", "requiredGPU_MB", "(", "self", ".", "required_mb", ")", ")", ":", "self", ".", "analyzer", "=", "YoloV3TinyAnalyzer", "(", "verbose", "=", "self", ".", "verbose", ")", "else", ":", ...
Whatever you need to do after creating the shmem client
[ "Whatever", "you", "need", "to", "do", "after", "creating", "the", "shmem", "client" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/yolo3tiny/base.py#L71-L78
Jaymon/pout
pout/__init__.py
tofile
def tofile(path=""): """Instead of printing to a screen print to a file :Example: with pout.tofile("/path/to/file.txt"): # all pout calls in this with block will print to file.txt pout.v("a string") pout.b() pout.h() :param path: str, a path to the f...
python
def tofile(path=""): """Instead of printing to a screen print to a file :Example: with pout.tofile("/path/to/file.txt"): # all pout calls in this with block will print to file.txt pout.v("a string") pout.b() pout.h() :param path: str, a path to the f...
[ "def", "tofile", "(", "path", "=", "\"\"", ")", ":", "if", "not", "path", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "\"{}.txt\"", ".", "format", "(", "__name__", ")", ")", "global", "stream", "orig...
Instead of printing to a screen print to a file :Example: with pout.tofile("/path/to/file.txt"): # all pout calls in this with block will print to file.txt pout.v("a string") pout.b() pout.h() :param path: str, a path to the file you want to write to
[ "Instead", "of", "printing", "to", "a", "screen", "print", "to", "a", "file" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L97-L120
Jaymon/pout
pout/__init__.py
v
def v(*args, **kwargs): ''' print the name = values of any passed in variables this prints out the passed in name, the value, and the file:line where the v() method was called so you can easily find it and remove it later example -- foo = 1 bar = [1, 2, 3] out.v(foo, bar) ...
python
def v(*args, **kwargs): ''' print the name = values of any passed in variables this prints out the passed in name, the value, and the file:line where the v() method was called so you can easily find it and remove it later example -- foo = 1 bar = [1, 2, 3] out.v(foo, bar) ...
[ "def", "v", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "a...
print the name = values of any passed in variables this prints out the passed in name, the value, and the file:line where the v() method was called so you can easily find it and remove it later example -- foo = 1 bar = [1, 2, 3] out.v(foo, bar) """ prints out: foo ...
[ "print", "the", "name", "=", "values", "of", "any", "passed", "in", "variables" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L124-L155
Jaymon/pout
pout/__init__.py
vs
def vs(*args, **kwargs): """ exactly like v, but doesn't print variable names or file positions .. seealso:: ss() """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = V_CLASS(r, stream, **kwargs) ...
python
def vs(*args, **kwargs): """ exactly like v, but doesn't print variable names or file positions .. seealso:: ss() """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = V_CLASS(r, stream, **kwargs) ...
[ "def", "vs", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "...
exactly like v, but doesn't print variable names or file positions .. seealso:: ss()
[ "exactly", "like", "v", "but", "doesn", "t", "print", "variable", "names", "or", "file", "positions" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L158-L169
Jaymon/pout
pout/__init__.py
s
def s(*args, **kwargs): """ exactly like v() but returns the string instead of printing it out since -- 10-15-2015 return -- str """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = V_CLASS(r, ...
python
def s(*args, **kwargs): """ exactly like v() but returns the string instead of printing it out since -- 10-15-2015 return -- str """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = V_CLASS(r, ...
[ "def", "s", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "a...
exactly like v() but returns the string instead of printing it out since -- 10-15-2015 return -- str
[ "exactly", "like", "v", "()", "but", "returns", "the", "string", "instead", "of", "printing", "it", "out" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L173-L185
Jaymon/pout
pout/__init__.py
ss
def ss(*args, **kwargs): """ exactly like s, but doesn't return variable names or file positions (useful for logging) since -- 10-15-2015 return -- str """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: ...
python
def ss(*args, **kwargs): """ exactly like s, but doesn't return variable names or file positions (useful for logging) since -- 10-15-2015 return -- str """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: ...
[ "def", "ss", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "...
exactly like s, but doesn't return variable names or file positions (useful for logging) since -- 10-15-2015 return -- str
[ "exactly", "like", "s", "but", "doesn", "t", "return", "variable", "names", "or", "file", "positions", "(", "useful", "for", "logging", ")" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L188-L200
Jaymon/pout
pout/__init__.py
r
def r(*args, **kwargs): """Similar to pout.v() but gets rid of name and file information so it can be used in loops and stuff, it will print out where the calls came from at the end of execution this just makes it nicer when you're printing a bunch of stuff each iteration :Example: for x i...
python
def r(*args, **kwargs): """Similar to pout.v() but gets rid of name and file information so it can be used in loops and stuff, it will print out where the calls came from at the end of execution this just makes it nicer when you're printing a bunch of stuff each iteration :Example: for x i...
[ "def", "r", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "<=", "0", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", ...
Similar to pout.v() but gets rid of name and file information so it can be used in loops and stuff, it will print out where the calls came from at the end of execution this just makes it nicer when you're printing a bunch of stuff each iteration :Example: for x in range(x): pout.r(...
[ "Similar", "to", "pout", ".", "v", "()", "but", "gets", "rid", "of", "name", "and", "file", "information", "so", "it", "can", "be", "used", "in", "loops", "and", "stuff", "it", "will", "print", "out", "where", "the", "calls", "came", "from", "at", "t...
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L212-L229
Jaymon/pout
pout/__init__.py
x
def x(*args, **kwargs): ''' same as sys.exit(1) but prints out where it was called from before exiting I just find this really handy for debugging sometimes since -- 2013-5-9 exit_code -- int -- if you want it something other than 1 ''' with Reflect.context(args, **kwargs) as r: i...
python
def x(*args, **kwargs): ''' same as sys.exit(1) but prints out where it was called from before exiting I just find this really handy for debugging sometimes since -- 2013-5-9 exit_code -- int -- if you want it something other than 1 ''' with Reflect.context(args, **kwargs) as r: i...
[ "def", "x", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "as", "r", ":", "instance", "=", "V_CLASS", "(", "r", ",", "stream", ",", "*", "*", "kwargs", ")", ...
same as sys.exit(1) but prints out where it was called from before exiting I just find this really handy for debugging sometimes since -- 2013-5-9 exit_code -- int -- if you want it something other than 1
[ "same", "as", "sys", ".", "exit", "(", "1", ")", "but", "prints", "out", "where", "it", "was", "called", "from", "before", "exiting" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L232-L254
Jaymon/pout
pout/__init__.py
h
def h(count=0, **kwargs): ''' prints "here count" example -- h(1) # here 1 (/file:line) h() # here line (/file:line) count -- integer -- the number you want to put after "here" ''' with Reflect.context(**kwargs) as r: kwargs["count"] = count instance = H_CLASS(...
python
def h(count=0, **kwargs): ''' prints "here count" example -- h(1) # here 1 (/file:line) h() # here line (/file:line) count -- integer -- the number you want to put after "here" ''' with Reflect.context(**kwargs) as r: kwargs["count"] = count instance = H_CLASS(...
[ "def", "h", "(", "count", "=", "0", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "*", "*", "kwargs", ")", "as", "r", ":", "kwargs", "[", "\"count\"", "]", "=", "count", "instance", "=", "H_CLASS", "(", "r", ",", "s...
prints "here count" example -- h(1) # here 1 (/file:line) h() # here line (/file:line) count -- integer -- the number you want to put after "here"
[ "prints", "here", "count" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L257-L270
Jaymon/pout
pout/__init__.py
b
def b(*args, **kwargs): ''' create a big text break, you just kind of have to run it and see since -- 2013-5-9 *args -- 1 arg = title if string, rows if int 2 args = title, int 3 args = title, int, sep ''' with Reflect.context(**kwargs) as r: kwargs["args"] = args ...
python
def b(*args, **kwargs): ''' create a big text break, you just kind of have to run it and see since -- 2013-5-9 *args -- 1 arg = title if string, rows if int 2 args = title, int 3 args = title, int, sep ''' with Reflect.context(**kwargs) as r: kwargs["args"] = args ...
[ "def", "b", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "*", "*", "kwargs", ")", "as", "r", ":", "kwargs", "[", "\"args\"", "]", "=", "args", "instance", "=", "B_CLASS", "(", "r", ",", "stream", ...
create a big text break, you just kind of have to run it and see since -- 2013-5-9 *args -- 1 arg = title if string, rows if int 2 args = title, int 3 args = title, int, sep
[ "create", "a", "big", "text", "break", "you", "just", "kind", "of", "have", "to", "run", "it", "and", "see" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L273-L286
Jaymon/pout
pout/__init__.py
c
def c(*args, **kwargs): ''' kind of like od -c on the command line, basically it dumps each character and info about that char since -- 2013-5-9 *args -- tuple -- one or more strings to dump ''' with Reflect.context(**kwargs) as r: kwargs["args"] = args instance = C_CLASS(r...
python
def c(*args, **kwargs): ''' kind of like od -c on the command line, basically it dumps each character and info about that char since -- 2013-5-9 *args -- tuple -- one or more strings to dump ''' with Reflect.context(**kwargs) as r: kwargs["args"] = args instance = C_CLASS(r...
[ "def", "c", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "*", "*", "kwargs", ")", "as", "r", ":", "kwargs", "[", "\"args\"", "]", "=", "args", "instance", "=", "C_CLASS", "(", "r", ",", "stream", ...
kind of like od -c on the command line, basically it dumps each character and info about that char since -- 2013-5-9 *args -- tuple -- one or more strings to dump
[ "kind", "of", "like", "od", "-", "c", "on", "the", "command", "line", "basically", "it", "dumps", "each", "character", "and", "info", "about", "that", "char" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L289-L301
Jaymon/pout
pout/__init__.py
j
def j(*args, **kwargs): """ dump json since -- 2013-9-10 *args -- tuple -- one or more json strings to dump """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = J_CLASS(r, stream, **kwargs) ...
python
def j(*args, **kwargs): """ dump json since -- 2013-9-10 *args -- tuple -- one or more json strings to dump """ if not args: raise ValueError("you didn't pass any arguments to print out") with Reflect.context(args, **kwargs) as r: instance = J_CLASS(r, stream, **kwargs) ...
[ "def", "j", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", ":", "raise", "ValueError", "(", "\"you didn't pass any arguments to print out\"", ")", "with", "Reflect", ".", "context", "(", "args", ",", "*", "*", "kwargs", ")", "a...
dump json since -- 2013-9-10 *args -- tuple -- one or more json strings to dump
[ "dump", "json" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L304-L317
Jaymon/pout
pout/__init__.py
m
def m(name='', **kwargs): """ Print out memory usage at this point in time http://docs.python.org/2/library/resource.html http://stackoverflow.com/a/15448600/5006 http://stackoverflow.com/questions/110259/which-python-memory-profiler-is-recommended """ with Reflect.context(**kwargs) as r: ...
python
def m(name='', **kwargs): """ Print out memory usage at this point in time http://docs.python.org/2/library/resource.html http://stackoverflow.com/a/15448600/5006 http://stackoverflow.com/questions/110259/which-python-memory-profiler-is-recommended """ with Reflect.context(**kwargs) as r: ...
[ "def", "m", "(", "name", "=", "''", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "*", "*", "kwargs", ")", "as", "r", ":", "kwargs", "[", "\"name\"", "]", "=", "name", "instance", "=", "M_CLASS", "(", "r", ",", "str...
Print out memory usage at this point in time http://docs.python.org/2/library/resource.html http://stackoverflow.com/a/15448600/5006 http://stackoverflow.com/questions/110259/which-python-memory-profiler-is-recommended
[ "Print", "out", "memory", "usage", "at", "this", "point", "in", "time" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L320-L331
Jaymon/pout
pout/__init__.py
p
def p(name="", **kwargs): ''' really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of how your fast...
python
def p(name="", **kwargs): ''' really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of how your fast...
[ "def", "p", "(", "name", "=", "\"\"", ",", "*", "*", "kwargs", ")", ":", "with", "Reflect", ".", "context", "(", "*", "*", "kwargs", ")", "as", "r", ":", "if", "name", ":", "instance", "=", "P_CLASS", "(", "r", ",", "stream", ",", "name", ",", ...
really quick and dirty profiling you start a profile by passing in name, you stop the top profiling by not passing in a name. You can also call this method using a with statement This is for when you just want to get a really back of envelope view of how your fast your code is, super handy, not super ...
[ "really", "quick", "and", "dirty", "profiling" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L334-L371
Jaymon/pout
pout/__init__.py
sleep
def sleep(seconds, **kwargs): ''' same as time.sleep(seconds) but prints out where it was called before sleeping and then again after finishing sleeping I just find this really handy for debugging sometimes since -- 2017-4-27 :param seconds: float|int, how many seconds to sleep ''' if...
python
def sleep(seconds, **kwargs): ''' same as time.sleep(seconds) but prints out where it was called before sleeping and then again after finishing sleeping I just find this really handy for debugging sometimes since -- 2017-4-27 :param seconds: float|int, how many seconds to sleep ''' if...
[ "def", "sleep", "(", "seconds", ",", "*", "*", "kwargs", ")", ":", "if", "seconds", "<=", "0.0", ":", "raise", "ValueError", "(", "\"Invalid seconds {}\"", ".", "format", "(", "seconds", ")", ")", "with", "Reflect", ".", "context", "(", "*", "*", "kwar...
same as time.sleep(seconds) but prints out where it was called before sleeping and then again after finishing sleeping I just find this really handy for debugging sometimes since -- 2017-4-27 :param seconds: float|int, how many seconds to sleep
[ "same", "as", "time", ".", "sleep", "(", "seconds", ")", "but", "prints", "out", "where", "it", "was", "called", "before", "sleeping", "and", "then", "again", "after", "finishing", "sleeping" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L374-L397
Jaymon/pout
pout/__init__.py
t
def t(inspect_packages=False, depth=0, **kwargs): ''' print a backtrace since -- 7-6-12 inpsect_packages -- boolean -- by default, this only prints code of packages that are not in the pythonN directories, that cuts out a lot of the noise, set this to True if you want a full stacktrac...
python
def t(inspect_packages=False, depth=0, **kwargs): ''' print a backtrace since -- 7-6-12 inpsect_packages -- boolean -- by default, this only prints code of packages that are not in the pythonN directories, that cuts out a lot of the noise, set this to True if you want a full stacktrac...
[ "def", "t", "(", "inspect_packages", "=", "False", ",", "depth", "=", "0", ",", "*", "*", "kwargs", ")", ":", "#frame = inspect.currentframe()", "try", ":", "frames", "=", "inspect", ".", "stack", "(", ")", "kwargs", "[", "\"frames\"", "]", "=", "frames"...
print a backtrace since -- 7-6-12 inpsect_packages -- boolean -- by default, this only prints code of packages that are not in the pythonN directories, that cuts out a lot of the noise, set this to True if you want a full stacktrace depth -- integer -- how deep you want the stack trace to...
[ "print", "a", "backtrace" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L420-L447
Jaymon/pout
pout/__init__.py
inject
def inject(): """Injects pout into the builtins module so it can be called from anywhere without having to be explicitely imported, this is really just for convenience when debugging https://stackoverflow.com/questions/142545/python-how-to-make-a-cross-module-variable """ try: from .com...
python
def inject(): """Injects pout into the builtins module so it can be called from anywhere without having to be explicitely imported, this is really just for convenience when debugging https://stackoverflow.com/questions/142545/python-how-to-make-a-cross-module-variable """ try: from .com...
[ "def", "inject", "(", ")", ":", "try", ":", "from", ".", "compat", "import", "builtins", "module", "=", "sys", ".", "modules", "[", "__name__", "]", "setattr", "(", "builtins", ",", "__name__", ",", "module", ")", "#builtins.pout = pout", "except", "Import...
Injects pout into the builtins module so it can be called from anywhere without having to be explicitely imported, this is really just for convenience when debugging https://stackoverflow.com/questions/142545/python-how-to-make-a-cross-module-variable
[ "Injects", "pout", "into", "the", "builtins", "module", "so", "it", "can", "be", "called", "from", "anywhere", "without", "having", "to", "be", "explicitely", "imported", "this", "is", "really", "just", "for", "convenience", "when", "debugging" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__init__.py#L450-L465
elsampsa/valkka-live
valkka/live/tools.py
getH264V4l2
def getH264V4l2(verbose=False): """Find all V4l2 cameras with H264 encoding, and returns a list of tuples with .. (device file, device name), e.g. ("/dev/video2", "HD Pro Webcam C920 (/dev/video2)") """ import glob from subprocess import Popen, PIPE cams=[] for device in glob.glob...
python
def getH264V4l2(verbose=False): """Find all V4l2 cameras with H264 encoding, and returns a list of tuples with .. (device file, device name), e.g. ("/dev/video2", "HD Pro Webcam C920 (/dev/video2)") """ import glob from subprocess import Popen, PIPE cams=[] for device in glob.glob...
[ "def", "getH264V4l2", "(", "verbose", "=", "False", ")", ":", "import", "glob", "from", "subprocess", "import", "Popen", ",", "PIPE", "cams", "=", "[", "]", "for", "device", "in", "glob", ".", "glob", "(", "\"/sys/class/video4linux/*\"", ")", ":", "devname...
Find all V4l2 cameras with H264 encoding, and returns a list of tuples with .. (device file, device name), e.g. ("/dev/video2", "HD Pro Webcam C920 (/dev/video2)")
[ "Find", "all", "V4l2", "cameras", "with", "H264", "encoding", "and", "returns", "a", "list", "of", "tuples", "with", "..", "(", "device", "file", "device", "name", ")", "e", ".", "g", ".", "(", "/", "dev", "/", "video2", "HD", "Pro", "Webcam", "C920"...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/tools.py#L125-L160
veripress/veripress
veripress/__init__.py
create_app
def create_app(config_filename, instance_path=None): """ Factory function to create Flask application object. :param config_filename: absolute or relative filename of the config file :param instance_path: instance path to initialize or run a VeriPress app :return: a Flask app object """ app...
python
def create_app(config_filename, instance_path=None): """ Factory function to create Flask application object. :param config_filename: absolute or relative filename of the config file :param instance_path: instance path to initialize or run a VeriPress app :return: a Flask app object """ app...
[ "def", "create_app", "(", "config_filename", ",", "instance_path", "=", "None", ")", ":", "app_", "=", "CustomFlask", "(", "__name__", ",", "instance_path", "=", "instance_path", "or", "os", ".", "environ", ".", "get", "(", "'VERIPRESS_INSTANCE_PATH'", ")", "o...
Factory function to create Flask application object. :param config_filename: absolute or relative filename of the config file :param instance_path: instance path to initialize or run a VeriPress app :return: a Flask app object
[ "Factory", "function", "to", "create", "Flask", "application", "object", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/__init__.py#L30-L66
veripress/veripress
veripress/__init__.py
CustomFlask.send_static_file
def send_static_file(self, filename): """ Send static files from the static folder in the current selected theme prior to the global static folder. :param filename: static filename :return: response object """ if self.config['MODE'] == 'api-only': # i...
python
def send_static_file(self, filename): """ Send static files from the static folder in the current selected theme prior to the global static folder. :param filename: static filename :return: response object """ if self.config['MODE'] == 'api-only': # i...
[ "def", "send_static_file", "(", "self", ",", "filename", ")", ":", "if", "self", ".", "config", "[", "'MODE'", "]", "==", "'api-only'", ":", "# if 'api-only' mode is set, we should not send static files", "abort", "(", "404", ")", "theme_static_folder", "=", "getatt...
Send static files from the static folder in the current selected theme prior to the global static folder. :param filename: static filename :return: response object
[ "Send", "static", "files", "from", "the", "static", "folder", "in", "the", "current", "selected", "theme", "prior", "to", "the", "global", "static", "folder", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/__init__.py#L9-L27
elsampsa/valkka-live
valkka/live/container/video.py
VideoContainer.setDevice
def setDevice(self, device): """Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice. """ print(self.pre, "setDevice :", device) if (not device and not self.device): # None can be passed as an argumen...
python
def setDevice(self, device): """Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice. """ print(self.pre, "setDevice :", device) if (not device and not self.device): # None can be passed as an argumen...
[ "def", "setDevice", "(", "self", ",", "device", ")", ":", "print", "(", "self", ".", "pre", ",", "\"setDevice :\"", ",", "device", ")", "if", "(", "not", "device", "and", "not", "self", ".", "device", ")", ":", "# None can be passed as an argument when the d...
Sets the video stream :param device: A rather generic device class. In this case DataModel.RTSPCameraDevice.
[ "Sets", "the", "video", "stream", ":", "param", "device", ":", "A", "rather", "generic", "device", "class", ".", "In", "this", "case", "DataModel", ".", "RTSPCameraDevice", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/video.py#L234-L261
elsampsa/valkka-live
valkka/live/container/video.py
VideoContainer.clearDevice
def clearDevice(self): """Remove the current stream """ print(self.pre, "clearDevice") if not self.device: return self.filterchain.delViewPort(self.viewport) self.filterchain = None self.device = None self.video.updat...
python
def clearDevice(self): """Remove the current stream """ print(self.pre, "clearDevice") if not self.device: return self.filterchain.delViewPort(self.viewport) self.filterchain = None self.device = None self.video.updat...
[ "def", "clearDevice", "(", "self", ")", ":", "print", "(", "self", ".", "pre", ",", "\"clearDevice\"", ")", "if", "not", "self", ".", "device", ":", "return", "self", ".", "filterchain", ".", "delViewPort", "(", "self", ".", "viewport", ")", "self", "....
Remove the current stream
[ "Remove", "the", "current", "stream" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/video.py#L264-L276
elsampsa/valkka-live
valkka/live/container/video.py
VideoContainer.mouseGestureHandler
def mouseGestureHandler(self, info): """This is the callback for MouseClickContext. Passed to VideoWidget as a parameter """ print(self.pre, ": mouseGestureHandler: ") # *** single click events *** if (info.fsingle): print(self.pre, ": mouseGestureHandler: single cli...
python
def mouseGestureHandler(self, info): """This is the callback for MouseClickContext. Passed to VideoWidget as a parameter """ print(self.pre, ": mouseGestureHandler: ") # *** single click events *** if (info.fsingle): print(self.pre, ": mouseGestureHandler: single cli...
[ "def", "mouseGestureHandler", "(", "self", ",", "info", ")", ":", "print", "(", "self", ".", "pre", ",", "\": mouseGestureHandler: \"", ")", "# *** single click events ***", "if", "(", "info", ".", "fsingle", ")", ":", "print", "(", "self", ".", "pre", ",", ...
This is the callback for MouseClickContext. Passed to VideoWidget as a parameter
[ "This", "is", "the", "callback", "for", "MouseClickContext", ".", "Passed", "to", "VideoWidget", "as", "a", "parameter" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/video.py#L283-L305
elsampsa/valkka-live
valkka/live/container/video.py
VideoContainer.handle_left_double_click
def handle_left_double_click(self, info): """Whatever we want to do, when the VideoWidget has been double-clicked with the left button """ if (self.double_click_focus == False): # turn focus on print(self.pre, "handle_left_double_click: focus on") self.cb_focus() ...
python
def handle_left_double_click(self, info): """Whatever we want to do, when the VideoWidget has been double-clicked with the left button """ if (self.double_click_focus == False): # turn focus on print(self.pre, "handle_left_double_click: focus on") self.cb_focus() ...
[ "def", "handle_left_double_click", "(", "self", ",", "info", ")", ":", "if", "(", "self", ".", "double_click_focus", "==", "False", ")", ":", "# turn focus on", "print", "(", "self", ".", "pre", ",", "\"handle_left_double_click: focus on\"", ")", "self", ".", ...
Whatever we want to do, when the VideoWidget has been double-clicked with the left button
[ "Whatever", "we", "want", "to", "do", "when", "the", "VideoWidget", "has", "been", "double", "-", "clicked", "with", "the", "left", "button" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/video.py#L309-L319
veripress/veripress
veripress/model/__init__.py
get_storage
def get_storage(): """ Get storage object of current app context, will create a new one if not exists. :return: a storage object :raise: ConfigurationError: storage type in config is not supported """ storage_ = getattr(g, '_storage', None) if storage_ is None: storage_type = cu...
python
def get_storage(): """ Get storage object of current app context, will create a new one if not exists. :return: a storage object :raise: ConfigurationError: storage type in config is not supported """ storage_ = getattr(g, '_storage', None) if storage_ is None: storage_type = cu...
[ "def", "get_storage", "(", ")", ":", "storage_", "=", "getattr", "(", "g", ",", "'_storage'", ",", "None", ")", "if", "storage_", "is", "None", ":", "storage_type", "=", "current_app", ".", "config", "[", "'STORAGE_TYPE'", "]", "if", "storage_type", "==", ...
Get storage object of current app context, will create a new one if not exists. :return: a storage object :raise: ConfigurationError: storage type in config is not supported
[ "Get", "storage", "object", "of", "current", "app", "context", "will", "create", "a", "new", "one", "if", "not", "exists", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/__init__.py#L11-L27
elsampsa/valkka-live
valkka/live/form.py
SlotFormSet.chooseForm_slot
def chooseForm_slot(self, element, element_old): """Calling this slot chooses the form to be shown :param element: an object that has *_id* and *classname* attributes :param element_old: an object that has *_id* and *classname* attributes This slot is typically connected to List ...
python
def chooseForm_slot(self, element, element_old): """Calling this slot chooses the form to be shown :param element: an object that has *_id* and *classname* attributes :param element_old: an object that has *_id* and *classname* attributes This slot is typically connected to List ...
[ "def", "chooseForm_slot", "(", "self", ",", "element", ",", "element_old", ")", ":", "self", ".", "current_slot", "=", "None", "if", "(", "verbose", ")", ":", "# enable this if you're unsure what's coming here..", "print", "(", "self", ".", "pre", ",", "\"choose...
Calling this slot chooses the form to be shown :param element: an object that has *_id* and *classname* attributes :param element_old: an object that has *_id* and *classname* attributes This slot is typically connected to List classes, widget attribute's, currentItemChanged method (List...
[ "Calling", "this", "slot", "chooses", "the", "form", "to", "be", "shown" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/form.py#L74-L112
elsampsa/valkka-live
valkka/live/form.py
SlotFormSet.update_dropdown_list_slot
def update_dropdown_list_slot(self): """Keep updating the dropdown list. Say, don't let the user choose USB devices if none is available """ self.dropdown_widget.clear() # this will trigger dropdown_changed_slot self.row_instance_by_index = [] for i, key in enumerate(self.row_in...
python
def update_dropdown_list_slot(self): """Keep updating the dropdown list. Say, don't let the user choose USB devices if none is available """ self.dropdown_widget.clear() # this will trigger dropdown_changed_slot self.row_instance_by_index = [] for i, key in enumerate(self.row_in...
[ "def", "update_dropdown_list_slot", "(", "self", ")", ":", "self", ".", "dropdown_widget", ".", "clear", "(", ")", "# this will trigger dropdown_changed_slot", "self", ".", "row_instance_by_index", "=", "[", "]", "for", "i", ",", "key", "in", "enumerate", "(", "...
Keep updating the dropdown list. Say, don't let the user choose USB devices if none is available
[ "Keep", "updating", "the", "dropdown", "list", ".", "Say", "don", "t", "let", "the", "user", "choose", "USB", "devices", "if", "none", "is", "available" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/form.py#L190-L201
elsampsa/valkka-live
valkka/live/filterchain.py
FilterChainGroup.read
def read(self): """Reads all devices from the database and creates filterchains TODO: we can, of course, just modify the added / removed cameras """ self.reset() for dic in self.datamodel.camera_collection.get(): # TODO: search directly for RTSPCameraRow if (...
python
def read(self): """Reads all devices from the database and creates filterchains TODO: we can, of course, just modify the added / removed cameras """ self.reset() for dic in self.datamodel.camera_collection.get(): # TODO: search directly for RTSPCameraRow if (...
[ "def", "read", "(", "self", ")", ":", "self", ".", "reset", "(", ")", "for", "dic", "in", "self", ".", "datamodel", ".", "camera_collection", ".", "get", "(", ")", ":", "# TODO: search directly for RTSPCameraRow", "if", "(", "self", ".", "verbose", ")", ...
Reads all devices from the database and creates filterchains TODO: we can, of course, just modify the added / removed cameras
[ "Reads", "all", "devices", "from", "the", "database", "and", "creates", "filterchains", "TODO", ":", "we", "can", "of", "course", "just", "modify", "the", "added", "/", "removed", "cameras" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/filterchain.py#L74-L143
elsampsa/valkka-live
valkka/live/filterchain.py
FilterChainGroup.update
def update(self): """Reads all devices from the database. Creates new filterchains and removes old ones TODO: currently this is broken: if user changes any other field than the ip address, the cameras don't get updated """ raise(AssertionError("out of date")) n...
python
def update(self): """Reads all devices from the database. Creates new filterchains and removes old ones TODO: currently this is broken: if user changes any other field than the ip address, the cameras don't get updated """ raise(AssertionError("out of date")) n...
[ "def", "update", "(", "self", ")", ":", "raise", "(", "AssertionError", "(", "\"out of date\"", ")", ")", "new_ids", "=", "[", "]", "old_ids", "=", "[", "]", "# collect old ip addresses", "for", "chain", "in", "self", ".", "chains", ":", "if", "(", "self...
Reads all devices from the database. Creates new filterchains and removes old ones TODO: currently this is broken: if user changes any other field than the ip address, the cameras don't get updated
[ "Reads", "all", "devices", "from", "the", "database", ".", "Creates", "new", "filterchains", "and", "removes", "old", "ones", "TODO", ":", "currently", "this", "is", "broken", ":", "if", "user", "changes", "any", "other", "field", "than", "the", "ip", "add...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/filterchain.py#L148-L209
elsampsa/valkka-live
valkka/live/filterchain.py
FilterChainGroup.get
def get(self, **kwargs): """Find correct filterchain based on generic variables """ for chain in self.chains: for key in kwargs: getter_name = "get_"+key # scan all possible getters if (hasattr(chain, getter_name)): ...
python
def get(self, **kwargs): """Find correct filterchain based on generic variables """ for chain in self.chains: for key in kwargs: getter_name = "get_"+key # scan all possible getters if (hasattr(chain, getter_name)): ...
[ "def", "get", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "chain", "in", "self", ".", "chains", ":", "for", "key", "in", "kwargs", ":", "getter_name", "=", "\"get_\"", "+", "key", "# scan all possible getters", "if", "(", "hasattr", "(", "ch...
Find correct filterchain based on generic variables
[ "Find", "correct", "filterchain", "based", "on", "generic", "variables" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/filterchain.py#L214-L225
elsampsa/valkka-live
valkka/live/filterchain.py
FilterChainGroup.getDevice
def getDevice(self, **kwargs): """Like get, but returns a Device instance (RTSPCameraDevice, etc.) """ filterchain = self.get(**kwargs) if not filterchain: return None # get filterchain init parameters that are compatible with RTSPCameraDevice input...
python
def getDevice(self, **kwargs): """Like get, but returns a Device instance (RTSPCameraDevice, etc.) """ filterchain = self.get(**kwargs) if not filterchain: return None # get filterchain init parameters that are compatible with RTSPCameraDevice input...
[ "def", "getDevice", "(", "self", ",", "*", "*", "kwargs", ")", ":", "filterchain", "=", "self", ".", "get", "(", "*", "*", "kwargs", ")", "if", "not", "filterchain", ":", "return", "None", "# get filterchain init parameters that are compatible with RTSPCameraDevic...
Like get, but returns a Device instance (RTSPCameraDevice, etc.)
[ "Like", "get", "but", "returns", "a", "Device", "instance", "(", "RTSPCameraDevice", "etc", ".", ")" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/filterchain.py#L229-L244
veripress/veripress
veripress/model/models.py
Base.to_dict
def to_dict(self): """ Convert attributes and properties to a dict, so that it can be serialized. """ return {k: getattr(self, k) for k in filter( lambda k: not k.startswith('_') and k != 'to_dict', dir(self))}
python
def to_dict(self): """ Convert attributes and properties to a dict, so that it can be serialized. """ return {k: getattr(self, k) for k in filter( lambda k: not k.startswith('_') and k != 'to_dict', dir(self))}
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "k", ":", "getattr", "(", "self", ",", "k", ")", "for", "k", "in", "filter", "(", "lambda", "k", ":", "not", "k", ".", "startswith", "(", "'_'", ")", "and", "k", "!=", "'to_dict'", ",", "d...
Convert attributes and properties to a dict, so that it can be serialized.
[ "Convert", "attributes", "and", "properties", "to", "a", "dict", "so", "that", "it", "can", "be", "serialized", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/models.py#L30-L36
veripress/veripress
veripress/model/toc.py
_HtmlHeaderNode.to_dict
def to_dict(self): """Convert self to a dict object for serialization.""" return { 'level': self.level, 'id': self.id, 'text': self.text, 'inner_html': self.inner_html, 'children': [child.to_dict() for child in self.children] }
python
def to_dict(self): """Convert self to a dict object for serialization.""" return { 'level': self.level, 'id': self.id, 'text': self.text, 'inner_html': self.inner_html, 'children': [child.to_dict() for child in self.children] }
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "'level'", ":", "self", ".", "level", ",", "'id'", ":", "self", ".", "id", ",", "'text'", ":", "self", ".", "text", ",", "'inner_html'", ":", "self", ".", "inner_html", ",", "'children'", ":", ...
Convert self to a dict object for serialization.
[ "Convert", "self", "to", "a", "dict", "object", "for", "serialization", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/toc.py#L24-L32
veripress/veripress
veripress/model/toc.py
HtmlTocParser.toc
def toc(self, depth=6, lowest_level=6): """ Get table of content of currently fed HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: a list representing the TOC """ depth = min(max(depth, 0), 6) ...
python
def toc(self, depth=6, lowest_level=6): """ Get table of content of currently fed HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: a list representing the TOC """ depth = min(max(depth, 0), 6) ...
[ "def", "toc", "(", "self", ",", "depth", "=", "6", ",", "lowest_level", "=", "6", ")", ":", "depth", "=", "min", "(", "max", "(", "depth", ",", "0", ")", ",", "6", ")", "depth", "=", "6", "if", "depth", "==", "0", "else", "depth", "lowest_level...
Get table of content of currently fed HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: a list representing the TOC
[ "Get", "table", "of", "content", "of", "currently", "fed", "HTML", "string", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/toc.py#L61-L90
veripress/veripress
veripress/model/toc.py
HtmlTocParser.toc_html
def toc_html(self, depth=6, lowest_level=6): """ Get TOC of currently fed HTML string in form of HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: an HTML string """ toc = self.toc(depth=depth, lowest...
python
def toc_html(self, depth=6, lowest_level=6): """ Get TOC of currently fed HTML string in form of HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: an HTML string """ toc = self.toc(depth=depth, lowest...
[ "def", "toc_html", "(", "self", ",", "depth", "=", "6", ",", "lowest_level", "=", "6", ")", ":", "toc", "=", "self", ".", "toc", "(", "depth", "=", "depth", ",", "lowest_level", "=", "lowest_level", ")", "if", "not", "toc", ":", "return", "''", "de...
Get TOC of currently fed HTML string in form of HTML string. :param depth: the depth of TOC :param lowest_level: the allowed lowest level of header tag :return: an HTML string
[ "Get", "TOC", "of", "currently", "fed", "HTML", "string", "in", "form", "of", "HTML", "string", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/toc.py#L92-L119
veripress/veripress
veripress/model/toc.py
HtmlTocParser._get_level
def _get_level(tag): """ Match the header level in the given tag name, or None if it's not a header tag. """ m = re.match(r'^h([123456])$', tag, flags=re.IGNORECASE) if not m: return None return int(m.group(1))
python
def _get_level(tag): """ Match the header level in the given tag name, or None if it's not a header tag. """ m = re.match(r'^h([123456])$', tag, flags=re.IGNORECASE) if not m: return None return int(m.group(1))
[ "def", "_get_level", "(", "tag", ")", ":", "m", "=", "re", ".", "match", "(", "r'^h([123456])$'", ",", "tag", ",", "flags", "=", "re", ".", "IGNORECASE", ")", "if", "not", "m", ":", "return", "None", "return", "int", "(", "m", ".", "group", "(", ...
Match the header level in the given tag name, or None if it's not a header tag.
[ "Match", "the", "header", "level", "in", "the", "given", "tag", "name", "or", "None", "if", "it", "s", "not", "a", "header", "tag", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/model/toc.py#L136-L144
elsampsa/valkka-live
valkka/mvision/yolo3/base.py
MVisionProcess.requiredGPU_MB
def requiredGPU_MB(self, n): """Required GPU memory in MBytes """ from darknet.core import darknet_with_cuda if (darknet_with_cuda()): # its using cuda free = getFreeGPU_MB() print("Yolo: requiredGPU_MB: required, free", n, free) if (free == -1): # cou...
python
def requiredGPU_MB(self, n): """Required GPU memory in MBytes """ from darknet.core import darknet_with_cuda if (darknet_with_cuda()): # its using cuda free = getFreeGPU_MB() print("Yolo: requiredGPU_MB: required, free", n, free) if (free == -1): # cou...
[ "def", "requiredGPU_MB", "(", "self", ",", "n", ")", ":", "from", "darknet", ".", "core", "import", "darknet_with_cuda", "if", "(", "darknet_with_cuda", "(", ")", ")", ":", "# its using cuda", "free", "=", "getFreeGPU_MB", "(", ")", "print", "(", "\"Yolo: re...
Required GPU memory in MBytes
[ "Required", "GPU", "memory", "in", "MBytes" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/yolo3/base.py#L149-L160
elsampsa/valkka-live
valkka/mvision/yolo3/base.py
MVisionProcess.postActivate_
def postActivate_(self): """Whatever you need to do after creating the shmem client """ if (self.requiredGPU_MB(self.required_mb)): self.analyzer = YoloV3Analyzer(verbose = self.verbose) else: self.warning_message = "WARNING: not enough GPU memory!" se...
python
def postActivate_(self): """Whatever you need to do after creating the shmem client """ if (self.requiredGPU_MB(self.required_mb)): self.analyzer = YoloV3Analyzer(verbose = self.verbose) else: self.warning_message = "WARNING: not enough GPU memory!" se...
[ "def", "postActivate_", "(", "self", ")", ":", "if", "(", "self", ".", "requiredGPU_MB", "(", "self", ".", "required_mb", ")", ")", ":", "self", ".", "analyzer", "=", "YoloV3Analyzer", "(", "verbose", "=", "self", ".", "verbose", ")", "else", ":", "sel...
Whatever you need to do after creating the shmem client
[ "Whatever", "you", "need", "to", "do", "after", "creating", "the", "shmem", "client" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/yolo3/base.py#L162-L169
elsampsa/valkka-live
valkka/mvision/yolo3/base.py
MVisionProcess.getWidget
def getWidget(self): """Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to s...
python
def getWidget(self): """Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to s...
[ "def", "getWidget", "(", "self", ")", ":", "self", ".", "widget", "=", "QtWidgets", ".", "QTextEdit", "(", ")", "self", ".", "widget", ".", "setStyleSheet", "(", "style", ".", "detector_test", ")", "self", ".", "widget", ".", "setReadOnly", "(", "True", ...
Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to see how the analyzer proceeds
[ "Some", "ideas", "for", "your", "widget", ":", "-", "Textual", "information", "(", "alert", "license", "place", "number", ")", "-", "Check", "boxes", ":", "if", "checked", "send", "e", "-", "mail", "to", "your", "mom", "when", "the", "analyzer", "spots",...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/yolo3/base.py#L249-L260
Jaymon/pout
pout/value.py
Inspect.typename
def typename(self): ''' get the type of val there are multiple places where we want to know if val is an object, or a string, or whatever, this method allows us to find out that information since -- 7-10-12 val -- mixed -- the value to check return -- string -...
python
def typename(self): ''' get the type of val there are multiple places where we want to know if val is an object, or a string, or whatever, this method allows us to find out that information since -- 7-10-12 val -- mixed -- the value to check return -- string -...
[ "def", "typename", "(", "self", ")", ":", "t", "=", "'DEFAULT'", "# http://docs.python.org/2/library/types.html", "# func_types = (", "# types.FunctionType,", "# types.BuiltinFunctionType,", "# types.MethodType,", "# types.UnboundMe...
get the type of val there are multiple places where we want to know if val is an object, or a string, or whatever, this method allows us to find out that information since -- 7-10-12 val -- mixed -- the value to check return -- string -- the type
[ "get", "the", "type", "of", "val" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L41-L130
Jaymon/pout
pout/value.py
Inspect.is_primitive
def is_primitive(self): """is the value a built-in type?""" if is_py2: return isinstance( self.val, ( types.NoneType, types.BooleanType, types.IntType, types.LongType, ...
python
def is_primitive(self): """is the value a built-in type?""" if is_py2: return isinstance( self.val, ( types.NoneType, types.BooleanType, types.IntType, types.LongType, ...
[ "def", "is_primitive", "(", "self", ")", ":", "if", "is_py2", ":", "return", "isinstance", "(", "self", ".", "val", ",", "(", "types", ".", "NoneType", ",", "types", ".", "BooleanType", ",", "types", ".", "IntType", ",", "types", ".", "LongType", ",", ...
is the value a built-in type?
[ "is", "the", "value", "a", "built", "-", "in", "type?" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L145-L168
Jaymon/pout
pout/value.py
Value._str_iterator
def _str_iterator(self, iterator, name_callback=None, prefix="\n", left_paren='[', right_paren=']', depth=0): ''' turn an iteratable value into a string representation iterator -- iterator -- the value to be iterated through name_callback -- callback -- if not None, a function that will...
python
def _str_iterator(self, iterator, name_callback=None, prefix="\n", left_paren='[', right_paren=']', depth=0): ''' turn an iteratable value into a string representation iterator -- iterator -- the value to be iterated through name_callback -- callback -- if not None, a function that will...
[ "def", "_str_iterator", "(", "self", ",", "iterator", ",", "name_callback", "=", "None", ",", "prefix", "=", "\"\\n\"", ",", "left_paren", "=", "'['", ",", "right_paren", "=", "']'", ",", "depth", "=", "0", ")", ":", "indent", "=", "1", "if", "depth", ...
turn an iteratable value into a string representation iterator -- iterator -- the value to be iterated through name_callback -- callback -- if not None, a function that will take the key of each iteration prefix -- string -- what will be prepended to the generated value left_paren -- st...
[ "turn", "an", "iteratable", "value", "into", "a", "string", "representation" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L346-L391
Jaymon/pout
pout/value.py
Value._add_indent
def _add_indent(self, val, indent_count): ''' add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of each l...
python
def _add_indent(self, val, indent_count): ''' add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of each l...
[ "def", "_add_indent", "(", "self", ",", "val", ",", "indent_count", ")", ":", "if", "isinstance", "(", "val", ",", "Value", ")", ":", "val", "=", "val", ".", "string_value", "(", ")", "return", "String", "(", "val", ")", ".", "indent", "(", "indent_c...
add whitespace to the beginning of each line of val link -- http://code.activestate.com/recipes/66055-changing-the-indentation-of-a-multi-line-string/ val -- string indent -- integer -- how much whitespace we want in front of each line of val return -- string -- val with more whitespa...
[ "add", "whitespace", "to", "the", "beginning", "of", "each", "line", "of", "val" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L393-L407
Jaymon/pout
pout/value.py
ObjectValue._getattr
def _getattr(self, val, key, default_val): """wrapper around global getattr(...) method that suppresses any exception raised""" try: ret = getattr(val, key, default_val) except Exception as e: logger.exception(e) ret = default_val return ret
python
def _getattr(self, val, key, default_val): """wrapper around global getattr(...) method that suppresses any exception raised""" try: ret = getattr(val, key, default_val) except Exception as e: logger.exception(e) ret = default_val return ret
[ "def", "_getattr", "(", "self", ",", "val", ",", "key", ",", "default_val", ")", ":", "try", ":", "ret", "=", "getattr", "(", "val", ",", "key", ",", "default_val", ")", "except", "Exception", "as", "e", ":", "logger", ".", "exception", "(", "e", "...
wrapper around global getattr(...) method that suppresses any exception raised
[ "wrapper", "around", "global", "getattr", "(", "...", ")", "method", "that", "suppresses", "any", "exception", "raised" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L549-L558
Jaymon/pout
pout/value.py
ObjectValue._get_name
def _get_name(self, val, src_file, default='Unknown'): ''' get the full namespaced (module + class) name of the val object since -- 6-28-12 val -- mixed -- the value (everything is an object) object default -- string -- the default name if a decent name can't be found programma...
python
def _get_name(self, val, src_file, default='Unknown'): ''' get the full namespaced (module + class) name of the val object since -- 6-28-12 val -- mixed -- the value (everything is an object) object default -- string -- the default name if a decent name can't be found programma...
[ "def", "_get_name", "(", "self", ",", "val", ",", "src_file", ",", "default", "=", "'Unknown'", ")", ":", "module_name", "=", "''", "if", "src_file", ":", "module_name", "=", "'{}.'", ".", "format", "(", "self", ".", "_getattr", "(", "val", ",", "'__mo...
get the full namespaced (module + class) name of the val object since -- 6-28-12 val -- mixed -- the value (everything is an object) object default -- string -- the default name if a decent name can't be found programmatically return -- string -- the full.module.Name
[ "get", "the", "full", "namespaced", "(", "module", "+", "class", ")", "name", "of", "the", "val", "object" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L560-L584
Jaymon/pout
pout/value.py
ObjectValue._get_src_file
def _get_src_file(self, val, default='Unknown'): ''' return the source file path since -- 7-19-12 val -- mixed -- the value whose path you want return -- string -- the path, or something like 'Unknown' if you can't find the path ''' path = default try:...
python
def _get_src_file(self, val, default='Unknown'): ''' return the source file path since -- 7-19-12 val -- mixed -- the value whose path you want return -- string -- the path, or something like 'Unknown' if you can't find the path ''' path = default try:...
[ "def", "_get_src_file", "(", "self", ",", "val", ",", "default", "=", "'Unknown'", ")", ":", "path", "=", "default", "try", ":", "# http://stackoverflow.com/questions/6761337/inspect-getfile-vs-inspect-getsourcefile", "# first try and get the actual source file", "source_file",...
return the source file path since -- 7-19-12 val -- mixed -- the value whose path you want return -- string -- the path, or something like 'Unknown' if you can't find the path
[ "return", "the", "source", "file", "path" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/value.py#L586-L612
Jaymon/pout
pout/environ.py
handle_decode_replace
def handle_decode_replace(e): """this handles replacing bad characters when printing out http://www.programcreek.com/python/example/3643/codecs.register_error http://bioportal.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/codecs/index.html https://pymotw.com/2/codecs/ """ count = e.end - e.st...
python
def handle_decode_replace(e): """this handles replacing bad characters when printing out http://www.programcreek.com/python/example/3643/codecs.register_error http://bioportal.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/codecs/index.html https://pymotw.com/2/codecs/ """ count = e.end - e.st...
[ "def", "handle_decode_replace", "(", "e", ")", ":", "count", "=", "e", ".", "end", "-", "e", ".", "start", "#return \".\" * count, e.end", "global", "ENCODING_REPLACE_CHAR", "return", "ENCODING_REPLACE_CHAR", "*", "count", ",", "e", ".", "end" ]
this handles replacing bad characters when printing out http://www.programcreek.com/python/example/3643/codecs.register_error http://bioportal.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/codecs/index.html https://pymotw.com/2/codecs/
[ "this", "handles", "replacing", "bad", "characters", "when", "printing", "out" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/environ.py#L40-L51
elsampsa/valkka-live
valkka/live/container/root.py
RootVideoContainer.makeWidget
def makeWidget(self, qscreen: QtGui.QScreen): # (re)create the widget, do the same for children # how children are placed on the parent widget, depends on the subclass self.window = self.ContainerWindow( self.signals, self.title, self.parent) # send to correct x-screen ...
python
def makeWidget(self, qscreen: QtGui.QScreen): # (re)create the widget, do the same for children # how children are placed on the parent widget, depends on the subclass self.window = self.ContainerWindow( self.signals, self.title, self.parent) # send to correct x-screen ...
[ "def", "makeWidget", "(", "self", ",", "qscreen", ":", "QtGui", ".", "QScreen", ")", ":", "# (re)create the widget, do the same for children", "# how children are placed on the parent widget, depends on the subclass", "self", ".", "window", "=", "self", ".", "ContainerWindow"...
TODO: activate after gpu-hopping has been debugged self.screenmenu = ScreenMenu(self.window) self.screenmenu.screen_1.triggered.connect(self.test_slot) self.screenmenu.screen_2.triggered.connect(self.test_slot)
[ "TODO", ":", "activate", "after", "gpu", "-", "hopping", "has", "been", "debugged", "self", ".", "screenmenu", "=", "ScreenMenu", "(", "self", ".", "window", ")", "self", ".", "screenmenu", ".", "screen_1", ".", "triggered", ".", "connect", "(", "self", ...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/root.py#L107-L160
elsampsa/valkka-live
valkka/live/container/root.py
RootVideoContainer.close
def close(self): """Called by the main gui to close the containers. Called also when the container widget is closed Closed by clicking the window: goes through self.close_slot Closed programmatically: use this method directly """ if (self.closed): r...
python
def close(self): """Called by the main gui to close the containers. Called also when the container widget is closed Closed by clicking the window: goes through self.close_slot Closed programmatically: use this method directly """ if (self.closed): r...
[ "def", "close", "(", "self", ")", ":", "if", "(", "self", ".", "closed", ")", ":", "return", "print", "(", "self", ".", "pre", ",", "\"close\"", ")", "for", "child", "in", "self", ".", "children", ":", "child", ".", "close", "(", ")", "self", "."...
Called by the main gui to close the containers. Called also when the container widget is closed Closed by clicking the window: goes through self.close_slot Closed programmatically: use this method directly
[ "Called", "by", "the", "main", "gui", "to", "close", "the", "containers", ".", "Called", "also", "when", "the", "container", "widget", "is", "closed", "Closed", "by", "clicking", "the", "window", ":", "goes", "through", "self", ".", "close_slot", "Closed", ...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/root.py#L180-L196
elsampsa/valkka-live
valkka/live/container/root.py
RootVideoContainer.serialize
def serialize(self): """Serialize information about the widget: coordinates, size, which cameras are selected. """ ids = [] for child in self.children: device = child.getDevice() if device: ids.append(device._id) # e.g. DataModel.RTSPCameraDevice._...
python
def serialize(self): """Serialize information about the widget: coordinates, size, which cameras are selected. """ ids = [] for child in self.children: device = child.getDevice() if device: ids.append(device._id) # e.g. DataModel.RTSPCameraDevice._...
[ "def", "serialize", "(", "self", ")", ":", "ids", "=", "[", "]", "for", "child", "in", "self", ".", "children", ":", "device", "=", "child", ".", "getDevice", "(", ")", "if", "device", ":", "ids", ".", "append", "(", "device", ".", "_id", ")", "#...
Serialize information about the widget: coordinates, size, which cameras are selected.
[ "Serialize", "information", "about", "the", "widget", ":", "coordinates", "size", "which", "cameras", "are", "selected", "." ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/container/root.py#L201-L229
elsampsa/valkka-live
valkka/mvision/movement/base.py
MovementDetector.reset
def reset(self): """Reset analyzer state """ self.prevframe = None self.wasmoving = False self.t0 = 0 self.ismoving = False
python
def reset(self): """Reset analyzer state """ self.prevframe = None self.wasmoving = False self.t0 = 0 self.ismoving = False
[ "def", "reset", "(", "self", ")", ":", "self", ".", "prevframe", "=", "None", "self", ".", "wasmoving", "=", "False", "self", ".", "t0", "=", "0", "self", ".", "ismoving", "=", "False" ]
Reset analyzer state
[ "Reset", "analyzer", "state" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/movement/base.py#L68-L74
elsampsa/valkka-live
valkka/mvision/movement/base.py
MVisionProcess.getWidget
def getWidget(self): """Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to s...
python
def getWidget(self): """Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to s...
[ "def", "getWidget", "(", "self", ")", ":", "widget", "=", "QtWidgets", ".", "QLabel", "(", "\"NO MOVEMENT YET\"", ")", "widget", ".", "setStyleSheet", "(", "style", ".", "detector_test", ")", "self", ".", "signals", ".", "start_move", ".", "connect", "(", ...
Some ideas for your widget: - Textual information (alert, license place number) - Check boxes : if checked, send e-mail to your mom when the analyzer spots something - .. or send an sms to yourself - You can include the cv2.imshow window to the widget to see how the analyzer proceeds
[ "Some", "ideas", "for", "your", "widget", ":", "-", "Textual", "information", "(", "alert", "license", "place", "number", ")", "-", "Check", "boxes", ":", "if", "checked", "send", "e", "-", "mail", "to", "your", "mom", "when", "the", "analyzer", "spots",...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/mvision/movement/base.py#L306-L317
veripress/veripress
veripress/api/__init__.py
rule
def rule(rules, strict_slashes=False, api_func=None, *args, **kwargs): """ Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable object ...
python
def rule(rules, strict_slashes=False, api_func=None, *args, **kwargs): """ Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable object ...
[ "def", "rule", "(", "rules", ",", "strict_slashes", "=", "False", ",", "api_func", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "url_rule", "(", "api_blueprint", ",", "rules", ",", "strict_slashes", "=", "strict_slashes", "...
Add a API route to the 'api' blueprint. :param rules: rule string or string list :param strict_slashes: same to Blueprint.route, but default value is False :param api_func: a function that returns a JSON serializable object or a Flask Response, or raises ApiException :param args: o...
[ "Add", "a", "API", "route", "to", "the", "api", "blueprint", "." ]
train
https://github.com/veripress/veripress/blob/9e3df3a10eb1db32da596bf52118fe6acbe4b14a/veripress/api/__init__.py#L80-L94
elsampsa/valkka-live
valkka/live/gpuhandler.py
GPUHandler.findXScreens
def findXScreens(self): qapp = QtCore.QCoreApplication.instance() if not qapp: # QApplication has not been started return screens = qapp.screens() """ let's find out which screens are virtual screen, siblings: One big virtual desktop: ...
python
def findXScreens(self): qapp = QtCore.QCoreApplication.instance() if not qapp: # QApplication has not been started return screens = qapp.screens() """ let's find out which screens are virtual screen, siblings: One big virtual desktop: ...
[ "def", "findXScreens", "(", "self", ")", ":", "qapp", "=", "QtCore", ".", "QCoreApplication", ".", "instance", "(", ")", "if", "not", "qapp", ":", "# QApplication has not been started", "return", "screens", "=", "qapp", ".", "screens", "(", ")", "virtual_scree...
let's find out which screens are virtual screen, siblings: One big virtual desktop: A [A, B, C] B [A, B, C] C [A, B, C] A & B in one xscreen, C in another: A [A, B] B [A, B] C [C]
[ "let", "s", "find", "out", "which", "screens", "are", "virtual" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gpuhandler.py#L82-L123
elsampsa/valkka-live
valkka/live/gui.py
MyGui.readDB
def readDB(self): """Datamodel includes the following files: config.dat, devices.dat """ self.dm = DataModel(directory = tools.getConfigDir()) if (self.first_start): print(pre, "readDB : first start") self.dm.clearAll() self.dm.saveAll() # If ...
python
def readDB(self): """Datamodel includes the following files: config.dat, devices.dat """ self.dm = DataModel(directory = tools.getConfigDir()) if (self.first_start): print(pre, "readDB : first start") self.dm.clearAll() self.dm.saveAll() # If ...
[ "def", "readDB", "(", "self", ")", ":", "self", ".", "dm", "=", "DataModel", "(", "directory", "=", "tools", ".", "getConfigDir", "(", ")", ")", "if", "(", "self", ".", "first_start", ")", ":", "print", "(", "pre", ",", "\"readDB : first start\"", ")",...
Datamodel includes the following files: config.dat, devices.dat
[ "Datamodel", "includes", "the", "following", "files", ":", "config", ".", "dat", "devices", ".", "dat" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L109-L120
elsampsa/valkka-live
valkka/live/gui.py
MyGui.generateMethods
def generateMethods(self): """Generate some member functions """ for i in range(1, 5): # adds member function grid_ixi_slot(self) self.make_grid_slot(i, i) for cl in self.mvision_classes: self.make_mvision_slot(cl)
python
def generateMethods(self): """Generate some member functions """ for i in range(1, 5): # adds member function grid_ixi_slot(self) self.make_grid_slot(i, i) for cl in self.mvision_classes: self.make_mvision_slot(cl)
[ "def", "generateMethods", "(", "self", ")", ":", "for", "i", "in", "range", "(", "1", ",", "5", ")", ":", "# adds member function grid_ixi_slot(self)", "self", ".", "make_grid_slot", "(", "i", ",", "i", ")", "for", "cl", "in", "self", ".", "mvision_classes...
Generate some member functions
[ "Generate", "some", "member", "functions" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L123-L131
elsampsa/valkka-live
valkka/live/gui.py
MyGui.QCapsulate
def QCapsulate(self, widget, name, blocking = False, nude = False): """Helper function that encapsulates QWidget into a QMainWindow """ class QuickWindow(QtWidgets.QMainWindow): class Signals(QtCore.QObject): close = QtCore.Signal() show = QtCore.Si...
python
def QCapsulate(self, widget, name, blocking = False, nude = False): """Helper function that encapsulates QWidget into a QMainWindow """ class QuickWindow(QtWidgets.QMainWindow): class Signals(QtCore.QObject): close = QtCore.Signal() show = QtCore.Si...
[ "def", "QCapsulate", "(", "self", ",", "widget", ",", "name", ",", "blocking", "=", "False", ",", "nude", "=", "False", ")", ":", "class", "QuickWindow", "(", "QtWidgets", ".", "QMainWindow", ")", ":", "class", "Signals", "(", "QtCore", ".", "QObject", ...
Helper function that encapsulates QWidget into a QMainWindow
[ "Helper", "function", "that", "encapsulates", "QWidget", "into", "a", "QMainWindow" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L134-L180
elsampsa/valkka-live
valkka/live/gui.py
MyGui.QTabCapsulate
def QTabCapsulate(self, name, widget_list, blocking = False): """Helper function that encapsulates QWidget into a QMainWindow :param widget_list: List of tuples : [(widget,"name"), (widget,"name"), ..] """ class QuickWindow(QtWidgets.QMainWindow): clas...
python
def QTabCapsulate(self, name, widget_list, blocking = False): """Helper function that encapsulates QWidget into a QMainWindow :param widget_list: List of tuples : [(widget,"name"), (widget,"name"), ..] """ class QuickWindow(QtWidgets.QMainWindow): clas...
[ "def", "QTabCapsulate", "(", "self", ",", "name", ",", "widget_list", ",", "blocking", "=", "False", ")", ":", "class", "QuickWindow", "(", "QtWidgets", ".", "QMainWindow", ")", ":", "class", "Signals", "(", "QtCore", ".", "QObject", ")", ":", "close", "...
Helper function that encapsulates QWidget into a QMainWindow :param widget_list: List of tuples : [(widget,"name"), (widget,"name"), ..]
[ "Helper", "function", "that", "encapsulates", "QWidget", "into", "a", "QMainWindow", ":", "param", "widget_list", ":", "List", "of", "tuples", ":", "[", "(", "widget", "name", ")", "(", "widget", "name", ")", "..", "]" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L183-L229
elsampsa/valkka-live
valkka/live/gui.py
MyGui.updateCameraTree
def updateCameraTree(self): self.treelist.reset_() self.server = ServerListItem( name = "Localhost", ip = "127.0.0.1", parent = self.root) """ self.server1 = ServerListItem( name="First Server", ip="192.168.1.20", parent=self.root) """ """ ...
python
def updateCameraTree(self): self.treelist.reset_() self.server = ServerListItem( name = "Localhost", ip = "127.0.0.1", parent = self.root) """ self.server1 = ServerListItem( name="First Server", ip="192.168.1.20", parent=self.root) """ """ ...
[ "def", "updateCameraTree", "(", "self", ")", ":", "self", ".", "treelist", ".", "reset_", "(", ")", "self", ".", "server", "=", "ServerListItem", "(", "name", "=", "\"Localhost\"", ",", "ip", "=", "\"127.0.0.1\"", ",", "parent", "=", "self", ".", "root",...
self.server1 = ServerListItem( name="First Server", ip="192.168.1.20", parent=self.root)
[ "self", ".", "server1", "=", "ServerListItem", "(", "name", "=", "First", "Server", "ip", "=", "192", ".", "168", ".", "1", ".", "20", "parent", "=", "self", ".", "root", ")" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L312-L349
elsampsa/valkka-live
valkka/live/gui.py
MyGui.makeLogic
def makeLogic(self): # *** When camera list has been closed, re-create the cameralist tree and update filterchains *** # self.manage_cameras_win.signals.close.connect(self.updateCameraTree) # now put into save_camera_config_slot # self.manage_cameras_win.signals.close.connect(self.filte...
python
def makeLogic(self): # *** When camera list has been closed, re-create the cameralist tree and update filterchains *** # self.manage_cameras_win.signals.close.connect(self.updateCameraTree) # now put into save_camera_config_slot # self.manage_cameras_win.signals.close.connect(self.filte...
[ "def", "makeLogic", "(", "self", ")", ":", "# *** When camera list has been closed, re-create the cameralist tree and update filterchains ***", "# self.manage_cameras_win.signals.close.connect(self.updateCameraTree) # now put into save_camera_config_slot", "# self.manage_cameras_win.signals.close.co...
self.configmenu.manage_cameras. triggered.connect( self.manage_cameras_slot) self.configmenu.memory_usage. triggered.connect( self.memory_usage_slot)
[ "self", ".", "configmenu", ".", "manage_cameras", ".", "triggered", ".", "connect", "(", "self", ".", "manage_cameras_slot", ")", "self", ".", "configmenu", ".", "memory_usage", ".", "triggered", ".", "connect", "(", "self", ".", "memory_usage_slot", ")" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L352-L395
elsampsa/valkka-live
valkka/live/gui.py
MyGui.serializeContainers
def serializeContainers(self): """Serializes the current view of open video grids (i.e. the view) """ """ each serialized container looks like this: dic={# these are used when re-instantiating the view "classname" : self.__class__.__name__, "kwargs" : {}, # ...
python
def serializeContainers(self): """Serializes the current view of open video grids (i.e. the view) """ """ each serialized container looks like this: dic={# these are used when re-instantiating the view "classname" : self.__class__.__name__, "kwargs" : {}, # ...
[ "def", "serializeContainers", "(", "self", ")", ":", "\"\"\" each serialized container looks like this:\n dic={# these are used when re-instantiating the view\n \"classname\" : self.__class__.__name__,\n \"kwargs\" : {}, # parameters that we're used to instantiate this ...
Serializes the current view of open video grids (i.e. the view)
[ "Serializes", "the", "current", "view", "of", "open", "video", "grids", "(", "i", ".", "e", ".", "the", "view", ")" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L414-L440
elsampsa/valkka-live
valkka/live/gui.py
MyGui.startProcesses
def startProcesses(self): """Create and start python multiprocesses Starting a multiprocess creates a process fork. In theory, there should be no problem in first starting the multithreading environment and after that perform forks (only the thread requestin the fork is copied)...
python
def startProcesses(self): """Create and start python multiprocesses Starting a multiprocess creates a process fork. In theory, there should be no problem in first starting the multithreading environment and after that perform forks (only the thread requestin the fork is copied)...
[ "def", "startProcesses", "(", "self", ")", ":", "self", ".", "process_map", "=", "{", "}", "# each key is a list of started multiprocesses", "# self.process_avail = {} # count instances", "for", "mvision_class", "in", "self", ".", "mvision_classes", ":", "name", "=", "m...
Create and start python multiprocesses Starting a multiprocess creates a process fork. In theory, there should be no problem in first starting the multithreading environment and after that perform forks (only the thread requestin the fork is copied), but in practice, all kinds of weird...
[ "Create", "and", "start", "python", "multiprocesses", "Starting", "a", "multiprocess", "creates", "a", "process", "fork", ".", "In", "theory", "there", "should", "be", "no", "problem", "in", "first", "starting", "the", "multithreading", "environment", "and", "af...
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L487-L509
elsampsa/valkka-live
valkka/live/gui.py
MyGui.make_grid_slot
def make_grid_slot(self, n, m): """Create a n x m video grid, show it and add it to the list of video containers """ def slot_func(): cont = container.VideoContainerNxM(gpu_handler=self.gpu_handler, filterchain_group=self.filtercha...
python
def make_grid_slot(self, n, m): """Create a n x m video grid, show it and add it to the list of video containers """ def slot_func(): cont = container.VideoContainerNxM(gpu_handler=self.gpu_handler, filterchain_group=self.filtercha...
[ "def", "make_grid_slot", "(", "self", ",", "n", ",", "m", ")", ":", "def", "slot_func", "(", ")", ":", "cont", "=", "container", ".", "VideoContainerNxM", "(", "gpu_handler", "=", "self", ".", "gpu_handler", ",", "filterchain_group", "=", "self", ".", "f...
Create a n x m video grid, show it and add it to the list of video containers
[ "Create", "a", "n", "x", "m", "video", "grid", "show", "it", "and", "add", "it", "to", "the", "list", "of", "video", "containers" ]
train
https://github.com/elsampsa/valkka-live/blob/218bb2ecf71c516c85b1b6e075454bba13090cd8/valkka/live/gui.py#L650-L660
Jaymon/pout
pout/__main__.py
main_inject
def main_inject(args): """ mapped to pout.inject on the command line, makes it easy to make pout global without having to actually import it in your python environment .. since:: 2018-08-13 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return c...
python
def main_inject(args): """ mapped to pout.inject on the command line, makes it easy to make pout global without having to actually import it in your python environment .. since:: 2018-08-13 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return c...
[ "def", "main_inject", "(", "args", ")", ":", "ret", "=", "0", "try", ":", "filepath", "=", "SiteCustomizeFile", "(", ")", "if", "filepath", ".", "is_injected", "(", ")", ":", "logger", ".", "info", "(", "\"Pout has already been injected into {}\"", ".", "for...
mapped to pout.inject on the command line, makes it easy to make pout global without having to actually import it in your python environment .. since:: 2018-08-13 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return code of the CLI
[ "mapped", "to", "pout", ".", "inject", "on", "the", "command", "line", "makes", "it", "easy", "to", "make", "pout", "global", "without", "having", "to", "actually", "import", "it", "in", "your", "python", "environment" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__main__.py#L68-L95
Jaymon/pout
pout/__main__.py
main_info
def main_info(args): """Just prints out info about the pout installation .. since:: 2018-08-20 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return code of the CLI """ if args.site_packages: logger.info(SitePackagesDir()) else: ...
python
def main_info(args): """Just prints out info about the pout installation .. since:: 2018-08-20 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return code of the CLI """ if args.site_packages: logger.info(SitePackagesDir()) else: ...
[ "def", "main_info", "(", "args", ")", ":", "if", "args", ".", "site_packages", ":", "logger", ".", "info", "(", "SitePackagesDir", "(", ")", ")", "else", ":", "logger", ".", "info", "(", "\"Python executable: {}\"", ".", "format", "(", "sys", ".", "execu...
Just prints out info about the pout installation .. since:: 2018-08-20 :param args: Namespace, the parsed CLI arguments passed into the application :returns: int, the return code of the CLI
[ "Just", "prints", "out", "info", "about", "the", "pout", "installation" ]
train
https://github.com/Jaymon/pout/blob/fa71b64384ddeb3b538855ed93e785d9985aad05/pout/__main__.py#L98-L120
benjamin-hodgson/Contexts
src/contexts/tools.py
catch
def catch(func, *args, **kwargs): """ Call the supplied function with the supplied arguments, catching and returning any exception that it throws. Arguments: func: the function to run. *args: positional arguments to pass into the function. **kwargs: keyword arguments to pass int...
python
def catch(func, *args, **kwargs): """ Call the supplied function with the supplied arguments, catching and returning any exception that it throws. Arguments: func: the function to run. *args: positional arguments to pass into the function. **kwargs: keyword arguments to pass int...
[ "def", "catch", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "Exception", "as", "e", ":", "return", "e" ]
Call the supplied function with the supplied arguments, catching and returning any exception that it throws. Arguments: func: the function to run. *args: positional arguments to pass into the function. **kwargs: keyword arguments to pass into the function. Returns: If the fu...
[ "Call", "the", "supplied", "function", "with", "the", "supplied", "arguments", "catching", "and", "returning", "any", "exception", "that", "it", "throws", "." ]
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/tools.py#L6-L22
benjamin-hodgson/Contexts
src/contexts/tools.py
time
def time(func, *args, **kwargs): """ Call the supplied function with the supplied arguments, and return the total execution time as a float in seconds. The precision of the returned value depends on the precision of `time.time()` on your platform. Arguments: func: the function to run. ...
python
def time(func, *args, **kwargs): """ Call the supplied function with the supplied arguments, and return the total execution time as a float in seconds. The precision of the returned value depends on the precision of `time.time()` on your platform. Arguments: func: the function to run. ...
[ "def", "time", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start_time", "=", "time_module", ".", "time", "(", ")", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "end_time", "=", "time_module", ".", "time", "(", ")...
Call the supplied function with the supplied arguments, and return the total execution time as a float in seconds. The precision of the returned value depends on the precision of `time.time()` on your platform. Arguments: func: the function to run. *args: positional arguments to pass i...
[ "Call", "the", "supplied", "function", "with", "the", "supplied", "arguments", "and", "return", "the", "total", "execution", "time", "as", "a", "float", "in", "seconds", "." ]
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/tools.py#L25-L43
benjamin-hodgson/Contexts
src/contexts/tools.py
set_trace
def set_trace(): """Start a Pdb instance at the calling frame, with stdout routed to sys.__stdout__.""" # https://github.com/nose-devs/nose/blob/master/nose/tools/nontrivial.py pdb.Pdb(stdout=sys.__stdout__).set_trace(sys._getframe().f_back)
python
def set_trace(): """Start a Pdb instance at the calling frame, with stdout routed to sys.__stdout__.""" # https://github.com/nose-devs/nose/blob/master/nose/tools/nontrivial.py pdb.Pdb(stdout=sys.__stdout__).set_trace(sys._getframe().f_back)
[ "def", "set_trace", "(", ")", ":", "# https://github.com/nose-devs/nose/blob/master/nose/tools/nontrivial.py", "pdb", ".", "Pdb", "(", "stdout", "=", "sys", ".", "__stdout__", ")", ".", "set_trace", "(", "sys", ".", "_getframe", "(", ")", ".", "f_back", ")" ]
Start a Pdb instance at the calling frame, with stdout routed to sys.__stdout__.
[ "Start", "a", "Pdb", "instance", "at", "the", "calling", "frame", "with", "stdout", "routed", "to", "sys", ".", "__stdout__", "." ]
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/tools.py#L46-L49
OpenHydrology/lmoments3
lmoments3/distr.py
LmomDistrMixin.lmom_fit
def lmom_fit(self, data=[], lmom_ratios=[]): """ Fit the distribution function to the given data or given L-moments. :param data: Data to use in calculating the distribution parameters :type data: array_like :param lmom_ratios: L-moments (ratios) l1, l2, t3, t4, .. to use in cal...
python
def lmom_fit(self, data=[], lmom_ratios=[]): """ Fit the distribution function to the given data or given L-moments. :param data: Data to use in calculating the distribution parameters :type data: array_like :param lmom_ratios: L-moments (ratios) l1, l2, t3, t4, .. to use in cal...
[ "def", "lmom_fit", "(", "self", ",", "data", "=", "[", "]", ",", "lmom_ratios", "=", "[", "]", ")", ":", "n_min", "=", "self", ".", "numargs", "+", "2", "if", "len", "(", "data", ")", ">", "0", ":", "if", "len", "(", "data", ")", "<=", "n_min...
Fit the distribution function to the given data or given L-moments. :param data: Data to use in calculating the distribution parameters :type data: array_like :param lmom_ratios: L-moments (ratios) l1, l2, t3, t4, .. to use in calculating the distribution parameters :type lmom_ratios: a...
[ "Fit", "the", "distribution", "function", "to", "the", "given", "data", "or", "given", "L", "-", "moments", "." ]
train
https://github.com/OpenHydrology/lmoments3/blob/65934df58cd754f1a38e35dc5ee6c30717e5b94c/lmoments3/distr.py#L44-L65
OpenHydrology/lmoments3
lmoments3/distr.py
LmomDistrMixin.lmom
def lmom(self, *args, nmom=5, **kwds): """ Compute the distribution's L-moments, e.g. l1, l2, l3, l4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int :param kwd...
python
def lmom(self, *args, nmom=5, **kwds): """ Compute the distribution's L-moments, e.g. l1, l2, l3, l4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int :param kwd...
[ "def", "lmom", "(", "self", ",", "*", "args", ",", "nmom", "=", "5", ",", "*", "*", "kwds", ")", ":", "ratios", "=", "self", ".", "lmom_ratios", "(", "*", "args", ",", "nmom", "=", "nmom", ",", "*", "*", "kwds", ")", "moments", "=", "ratios", ...
Compute the distribution's L-moments, e.g. l1, l2, l3, l4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int :param kwds: Distribution parameters as named arguments. See :attr:`r...
[ "Compute", "the", "distribution", "s", "L", "-", "moments", "e", ".", "g", ".", "l1", "l2", "l3", "l4", ".." ]
train
https://github.com/OpenHydrology/lmoments3/blob/65934df58cd754f1a38e35dc5ee6c30717e5b94c/lmoments3/distr.py#L67-L84
OpenHydrology/lmoments3
lmoments3/distr.py
LmomDistrMixin.lmom_ratios
def lmom_ratios(self, *args, nmom=5, **kwds): """ Compute the distribution's L-moment ratios, e.g. l1, l2, t3, t4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int ...
python
def lmom_ratios(self, *args, nmom=5, **kwds): """ Compute the distribution's L-moment ratios, e.g. l1, l2, t3, t4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int ...
[ "def", "lmom_ratios", "(", "self", ",", "*", "args", ",", "nmom", "=", "5", ",", "*", "*", "kwds", ")", ":", "if", "nmom", ">", "20", ":", "return", "ValueError", "(", "\"Parameter nmom too large. Max of 20.\"", ")", "shapes", ",", "loc", ",", "scale", ...
Compute the distribution's L-moment ratios, e.g. l1, l2, t3, t4, .. :param args: Distribution parameters in order of shape(s), loc, scale :type args: float :param nmom: Number of moments to calculate :type nmom: int :param kwds: Distribution parameters as named arguments. See :a...
[ "Compute", "the", "distribution", "s", "L", "-", "moment", "ratios", "e", ".", "g", ".", "l1", "l2", "t3", "t4", ".." ]
train
https://github.com/OpenHydrology/lmoments3/blob/65934df58cd754f1a38e35dc5ee6c30717e5b94c/lmoments3/distr.py#L86-L108
benjamin-hodgson/Contexts
src/contexts/__init__.py
run
def run(): """ Run all the test classes in the main module. Returns: exit code as an integer. The default behaviour (which may be overridden by plugins) is to return a 0 exit code if the test run succeeded, and 1 if it failed. """ plugin_list = load_plugins() module = sys.modul...
python
def run(): """ Run all the test classes in the main module. Returns: exit code as an integer. The default behaviour (which may be overridden by plugins) is to return a 0 exit code if the test run succeeded, and 1 if it failed. """ plugin_list = load_plugins() module = sys.modul...
[ "def", "run", "(", ")", ":", "plugin_list", "=", "load_plugins", "(", ")", "module", "=", "sys", ".", "modules", "[", "'__main__'", "]", "plugin_list", ".", "insert", "(", "0", ",", "ObjectSupplier", "(", "module", ")", ")", "return", "run_with_plugins", ...
Run all the test classes in the main module. Returns: exit code as an integer. The default behaviour (which may be overridden by plugins) is to return a 0 exit code if the test run succeeded, and 1 if it failed.
[ "Run", "all", "the", "test", "classes", "in", "the", "main", "module", "." ]
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/__init__.py#L26-L39
benjamin-hodgson/Contexts
src/contexts/__init__.py
run_with_plugins
def run_with_plugins(plugin_list): """ Carry out a test run with the supplied list of plugin instances. The plugins are expected to identify the object to run. Parameters: plugin_list: a list of plugin instances (objects which implement some subset of PluginInterface) Returns: exit code as ...
python
def run_with_plugins(plugin_list): """ Carry out a test run with the supplied list of plugin instances. The plugins are expected to identify the object to run. Parameters: plugin_list: a list of plugin instances (objects which implement some subset of PluginInterface) Returns: exit code as ...
[ "def", "run_with_plugins", "(", "plugin_list", ")", ":", "composite", "=", "core", ".", "PluginComposite", "(", "plugin_list", ")", "to_run", "=", "composite", ".", "get_object_to_run", "(", ")", "test_run", "=", "core", ".", "TestRun", "(", "to_run", ",", "...
Carry out a test run with the supplied list of plugin instances. The plugins are expected to identify the object to run. Parameters: plugin_list: a list of plugin instances (objects which implement some subset of PluginInterface) Returns: exit code as an integer. The default behaviour (whic...
[ "Carry", "out", "a", "test", "run", "with", "the", "supplied", "list", "of", "plugin", "instances", ".", "The", "plugins", "are", "expected", "to", "identify", "the", "object", "to", "run", "." ]
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/__init__.py#L42-L60
benjamin-hodgson/Contexts
src/contexts/plugins/identification/filespec.py
FileSpecIdentifier.initialise
def initialise(self, args=None, env=None, file=None, cwd=None): """ Filthy hack: we provide file and cwd here rather than as constructor args because Mr Hodgson decided to pass stdout as the only parameter to __init__. File should only be passed during tests. """ ...
python
def initialise(self, args=None, env=None, file=None, cwd=None): """ Filthy hack: we provide file and cwd here rather than as constructor args because Mr Hodgson decided to pass stdout as the only parameter to __init__. File should only be passed during tests. """ ...
[ "def", "initialise", "(", "self", ",", "args", "=", "None", ",", "env", "=", "None", ",", "file", "=", "None", ",", "cwd", "=", "None", ")", ":", "self", ".", "spec_file", "=", "args", "and", "args", ".", "specs", "or", "None", "self", ".", "cwd"...
Filthy hack: we provide file and cwd here rather than as constructor args because Mr Hodgson decided to pass stdout as the only parameter to __init__. File should only be passed during tests.
[ "Filthy", "hack", ":", "we", "provide", "file", "and", "cwd", "here", "rather", "than", "as", "constructor", "args", "because", "Mr", "Hodgson", "decided", "to", "pass", "stdout", "as", "the", "only", "parameter", "to", "__init__", ".", "File", "should", "...
train
https://github.com/benjamin-hodgson/Contexts/blob/f5ee6a08aed19ab157158c1fc7752cff18cceb91/src/contexts/plugins/identification/filespec.py#L19-L29
OpenHydrology/lmoments3
lmoments3/__init__.py
lmom_ratios
def lmom_ratios(data, nmom=5): """ Estimate `nmom` number of L-moments from a sample `data`. :param data: Sequence of (sample) data :type data: list or array-like sequence :param nmom: number of L-moments to estimate :type nmom: int :return: L-moment ratios like this: l1, l2, t3, t4, t5, .....
python
def lmom_ratios(data, nmom=5): """ Estimate `nmom` number of L-moments from a sample `data`. :param data: Sequence of (sample) data :type data: list or array-like sequence :param nmom: number of L-moments to estimate :type nmom: int :return: L-moment ratios like this: l1, l2, t3, t4, t5, .....
[ "def", "lmom_ratios", "(", "data", ",", "nmom", "=", "5", ")", ":", "if", "nmom", "<=", "5", ":", "return", "_samlmusmall", "(", "data", ",", "nmom", ")", "else", ":", "return", "_samlmularge", "(", "data", ",", "nmom", ")" ]
Estimate `nmom` number of L-moments from a sample `data`. :param data: Sequence of (sample) data :type data: list or array-like sequence :param nmom: number of L-moments to estimate :type nmom: int :return: L-moment ratios like this: l1, l2, t3, t4, t5, .. . As in: items 3 and higher are L-moment r...
[ "Estimate", "nmom", "number", "of", "L", "-", "moments", "from", "a", "sample", "data", "." ]
train
https://github.com/OpenHydrology/lmoments3/blob/65934df58cd754f1a38e35dc5ee6c30717e5b94c/lmoments3/__init__.py#L69-L84
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI._run
def _run(self, url_path, headers=None, **kwargs): """ Requests API """ url = self._construct_url(url_path) payload = kwargs payload.update({'api_token': self.api_token}) return self._make_request(url, payload, headers)
python
def _run(self, url_path, headers=None, **kwargs): """ Requests API """ url = self._construct_url(url_path) payload = kwargs payload.update({'api_token': self.api_token}) return self._make_request(url, payload, headers)
[ "def", "_run", "(", "self", ",", "url_path", ",", "headers", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url", "=", "self", ".", "_construct_url", "(", "url_path", ")", "payload", "=", "kwargs", "payload", ".", "update", "(", "{", "'api_token'", ...
Requests API
[ "Requests", "API" ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L129-L138
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI._apiv1_run
def _apiv1_run(self, action, headers=None, **kwargs): """ Kept for backwards compatibility of this client See "self.clear_reference_language" """ warnings.warn( "POEditor API v1 is deprecated. Use POEditorAPI._run method to call API v2", DeprecationWarning...
python
def _apiv1_run(self, action, headers=None, **kwargs): """ Kept for backwards compatibility of this client See "self.clear_reference_language" """ warnings.warn( "POEditor API v1 is deprecated. Use POEditorAPI._run method to call API v2", DeprecationWarning...
[ "def", "_apiv1_run", "(", "self", ",", "action", ",", "headers", "=", "None", ",", "*", "*", "kwargs", ")", ":", "warnings", ".", "warn", "(", "\"POEditor API v1 is deprecated. Use POEditorAPI._run method to call API v2\"", ",", "DeprecationWarning", ",", "stacklevel"...
Kept for backwards compatibility of this client See "self.clear_reference_language"
[ "Kept", "for", "backwards", "compatibility", "of", "this", "client", "See", "self", ".", "clear_reference_language" ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L140-L154
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI._project_formatter
def _project_formatter(self, data): """ Project object """ open_ = False if not data['open'] or data['open'] == '0' else True public = False if not data['public'] or data['public'] == '0' else True output = { 'created': parse_datetime(data['created']), ...
python
def _project_formatter(self, data): """ Project object """ open_ = False if not data['open'] or data['open'] == '0' else True public = False if not data['public'] or data['public'] == '0' else True output = { 'created': parse_datetime(data['created']), ...
[ "def", "_project_formatter", "(", "self", ",", "data", ")", ":", "open_", "=", "False", "if", "not", "data", "[", "'open'", "]", "or", "data", "[", "'open'", "]", "==", "'0'", "else", "True", "public", "=", "False", "if", "not", "data", "[", "'public...
Project object
[ "Project", "object" ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L156-L176
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.list_projects
def list_projects(self): """ Returns the list of projects owned by user. """ data = self._run( url_path="projects/list" ) projects = data['result'].get('projects', []) return [self._project_formatter(item) for item in projects]
python
def list_projects(self): """ Returns the list of projects owned by user. """ data = self._run( url_path="projects/list" ) projects = data['result'].get('projects', []) return [self._project_formatter(item) for item in projects]
[ "def", "list_projects", "(", "self", ")", ":", "data", "=", "self", ".", "_run", "(", "url_path", "=", "\"projects/list\"", ")", "projects", "=", "data", "[", "'result'", "]", ".", "get", "(", "'projects'", ",", "[", "]", ")", "return", "[", "self", ...
Returns the list of projects owned by user.
[ "Returns", "the", "list", "of", "projects", "owned", "by", "user", "." ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L178-L186
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.create_project
def create_project(self, name, description=None): """ creates a new project. Returns the id of the project (if successful) """ description = description or '' data = self._run( url_path="projects/add", name=name, description=description ...
python
def create_project(self, name, description=None): """ creates a new project. Returns the id of the project (if successful) """ description = description or '' data = self._run( url_path="projects/add", name=name, description=description ...
[ "def", "create_project", "(", "self", ",", "name", ",", "description", "=", "None", ")", ":", "description", "=", "description", "or", "''", "data", "=", "self", ".", "_run", "(", "url_path", "=", "\"projects/add\"", ",", "name", "=", "name", ",", "descr...
creates a new project. Returns the id of the project (if successful)
[ "creates", "a", "new", "project", ".", "Returns", "the", "id", "of", "the", "project", "(", "if", "successful", ")" ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L188-L198
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.update_project
def update_project(self, project_id, name=None, description=None, reference_language=None): """ Updates project settings (name, description, reference language) If optional parameters are not sent, their respective fields are not updated. """ kwargs = {} ...
python
def update_project(self, project_id, name=None, description=None, reference_language=None): """ Updates project settings (name, description, reference language) If optional parameters are not sent, their respective fields are not updated. """ kwargs = {} ...
[ "def", "update_project", "(", "self", ",", "project_id", ",", "name", "=", "None", ",", "description", "=", "None", ",", "reference_language", "=", "None", ")", ":", "kwargs", "=", "{", "}", "if", "name", "is", "not", "None", ":", "kwargs", "[", "'name...
Updates project settings (name, description, reference language) If optional parameters are not sent, their respective fields are not updated.
[ "Updates", "project", "settings", "(", "name", "description", "reference", "language", ")", "If", "optional", "parameters", "are", "not", "sent", "their", "respective", "fields", "are", "not", "updated", "." ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L200-L219
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.view_project_details
def view_project_details(self, project_id): """ Returns project's details. """ data = self._run( url_path="projects/view", id=project_id ) return self._project_formatter(data['result']['project'])
python
def view_project_details(self, project_id): """ Returns project's details. """ data = self._run( url_path="projects/view", id=project_id ) return self._project_formatter(data['result']['project'])
[ "def", "view_project_details", "(", "self", ",", "project_id", ")", ":", "data", "=", "self", ".", "_run", "(", "url_path", "=", "\"projects/view\"", ",", "id", "=", "project_id", ")", "return", "self", ".", "_project_formatter", "(", "data", "[", "'result'"...
Returns project's details.
[ "Returns", "project", "s", "details", "." ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L232-L240
sporteasy/python-poeditor
poeditor/client.py
POEditorAPI.list_project_languages
def list_project_languages(self, project_id): """ Returns project languages, percentage of translation done for each and the datetime (UTC - ISO 8601) when the last change was made. """ data = self._run( url_path="languages/list", id=project_id ) ...
python
def list_project_languages(self, project_id): """ Returns project languages, percentage of translation done for each and the datetime (UTC - ISO 8601) when the last change was made. """ data = self._run( url_path="languages/list", id=project_id ) ...
[ "def", "list_project_languages", "(", "self", ",", "project_id", ")", ":", "data", "=", "self", ".", "_run", "(", "url_path", "=", "\"languages/list\"", ",", "id", "=", "project_id", ")", "return", "data", "[", "'result'", "]", ".", "get", "(", "'languages...
Returns project languages, percentage of translation done for each and the datetime (UTC - ISO 8601) when the last change was made.
[ "Returns", "project", "languages", "percentage", "of", "translation", "done", "for", "each", "and", "the", "datetime", "(", "UTC", "-", "ISO", "8601", ")", "when", "the", "last", "change", "was", "made", "." ]
train
https://github.com/sporteasy/python-poeditor/blob/e9c0a8ab08816903122f730b73ffaab46601076c/poeditor/client.py#L242-L251