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
StyXman/ayrton
ayrton/parser/error.py
OperationError.print_app_tb_only
def print_app_tb_only(self, file): "NOT_RPYTHON" tb = self._application_traceback if tb: import linecache print >> file, "Traceback (application-level):" while tb is not None: co = tb.frame.pycode lineno = tb.get_lineno() ...
python
def print_app_tb_only(self, file): "NOT_RPYTHON" tb = self._application_traceback if tb: import linecache print >> file, "Traceback (application-level):" while tb is not None: co = tb.frame.pycode lineno = tb.get_lineno() ...
[ "def", "print_app_tb_only", "(", "self", ",", "file", ")", ":", "tb", "=", "self", ".", "_application_traceback", "if", "tb", ":", "import", "linecache", "print", ">>", "file", ",", "\"Traceback (application-level):\"", "while", "tb", "is", "not", "None", ":",...
NOT_RPYTHON
[ "NOT_RPYTHON" ]
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/parser/error.py#L119-L145
StyXman/ayrton
ayrton/parser/error.py
OperationError.print_detailed_traceback
def print_detailed_traceback(self, space=None, file=None): """NOT_RPYTHON: Dump a nice detailed interpreter- and application-level traceback, useful to debug the interpreter.""" if file is None: file = sys.stderr f = io.StringIO() for i in range(len(self.debug_excs)-1...
python
def print_detailed_traceback(self, space=None, file=None): """NOT_RPYTHON: Dump a nice detailed interpreter- and application-level traceback, useful to debug the interpreter.""" if file is None: file = sys.stderr f = io.StringIO() for i in range(len(self.debug_excs)-1...
[ "def", "print_detailed_traceback", "(", "self", ",", "space", "=", "None", ",", "file", "=", "None", ")", ":", "if", "file", "is", "None", ":", "file", "=", "sys", ".", "stderr", "f", "=", "io", ".", "StringIO", "(", ")", "for", "i", "in", "range",...
NOT_RPYTHON: Dump a nice detailed interpreter- and application-level traceback, useful to debug the interpreter.
[ "NOT_RPYTHON", ":", "Dump", "a", "nice", "detailed", "interpreter", "-", "and", "application", "-", "level", "traceback", "useful", "to", "debug", "the", "interpreter", "." ]
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/parser/error.py#L147-L164
StyXman/ayrton
ayrton/parser/error.py
OperationError.normalize_exception
def normalize_exception(self, space): """Normalize the OperationError. In other words, fix w_type and/or w_value to make sure that the __class__ of w_value is exactly w_type. """ # # This method covers all ways in which the Python statement # "raise X, Y" can produce a v...
python
def normalize_exception(self, space): """Normalize the OperationError. In other words, fix w_type and/or w_value to make sure that the __class__ of w_value is exactly w_type. """ # # This method covers all ways in which the Python statement # "raise X, Y" can produce a v...
[ "def", "normalize_exception", "(", "self", ",", "space", ")", ":", "#", "# This method covers all ways in which the Python statement", "# \"raise X, Y\" can produce a valid exception type and instance.", "#", "# In the following table, 'Class' means a subclass of BaseException", "# and 'in...
Normalize the OperationError. In other words, fix w_type and/or w_value to make sure that the __class__ of w_value is exactly w_type.
[ "Normalize", "the", "OperationError", ".", "In", "other", "words", "fix", "w_type", "and", "/", "or", "w_value", "to", "make", "sure", "that", "the", "__class__", "of", "w_value", "is", "exactly", "w_type", "." ]
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/parser/error.py#L166-L241
StyXman/ayrton
ayrton/parser/error.py
OperationError.get_traceback
def get_traceback(self): """Calling this marks the PyTraceback as escaped, i.e. it becomes accessible and inspectable by app-level Python code. For the JIT. Note that this has no effect if there are already several traceback frames recorded, because in this case they are already marked ...
python
def get_traceback(self): """Calling this marks the PyTraceback as escaped, i.e. it becomes accessible and inspectable by app-level Python code. For the JIT. Note that this has no effect if there are already several traceback frames recorded, because in this case they are already marked ...
[ "def", "get_traceback", "(", "self", ")", ":", "from", "pypy", ".", "interpreter", ".", "pytraceback", "import", "PyTraceback", "tb", "=", "self", ".", "_application_traceback", "if", "tb", "is", "not", "None", "and", "isinstance", "(", "tb", ",", "PyTraceba...
Calling this marks the PyTraceback as escaped, i.e. it becomes accessible and inspectable by app-level Python code. For the JIT. Note that this has no effect if there are already several traceback frames recorded, because in this case they are already marked as escaping by executioncont...
[ "Calling", "this", "marks", "the", "PyTraceback", "as", "escaped", "i", ".", "e", ".", "it", "becomes", "accessible", "and", "inspectable", "by", "app", "-", "level", "Python", "code", ".", "For", "the", "JIT", ".", "Note", "that", "this", "has", "no", ...
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/parser/error.py#L300-L312
StyXman/ayrton
ayrton/parser/error.py
OperationError.record_context
def record_context(self, space, frame): """Record a __context__ for this exception from the current frame if one exists. __context__ is otherwise lazily determined from the traceback. However the current frame.last_exception must be checked for a __context__ before this Operatio...
python
def record_context(self, space, frame): """Record a __context__ for this exception from the current frame if one exists. __context__ is otherwise lazily determined from the traceback. However the current frame.last_exception must be checked for a __context__ before this Operatio...
[ "def", "record_context", "(", "self", ",", "space", ",", "frame", ")", ":", "last_exception", "=", "frame", ".", "last_exception", "if", "(", "last_exception", "is", "not", "None", "and", "not", "frame", ".", "hide", "(", ")", "or", "last_exception", "is",...
Record a __context__ for this exception from the current frame if one exists. __context__ is otherwise lazily determined from the traceback. However the current frame.last_exception must be checked for a __context__ before this OperationError overwrites it (making the previous l...
[ "Record", "a", "__context__", "for", "this", "exception", "from", "the", "current", "frame", "if", "one", "exists", "." ]
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/parser/error.py#L333-L350
davidsoncasey/quiver
plotter/plotter.py
regex_check
def regex_check(equation_str): """A quick regular expression check to see that the input is sane Args: equation_str (str): String of equation to be parsed by sympify function. Expected to be valid Python. Raises: BadInputError: If input does not look safe to parse as an equatio...
python
def regex_check(equation_str): """A quick regular expression check to see that the input is sane Args: equation_str (str): String of equation to be parsed by sympify function. Expected to be valid Python. Raises: BadInputError: If input does not look safe to parse as an equatio...
[ "def", "regex_check", "(", "equation_str", ")", ":", "match1", "=", "re", ".", "match", "(", "r'^(([xy+\\-*/()0-9. ]+|sin\\(|cos\\(|exp\\(|log\\()?)+$'", ",", "equation_str", ")", "match2", "=", "re", ".", "match", "(", "r'^.*([xy]) *([xy]).*$'", ",", "equation_str", ...
A quick regular expression check to see that the input is sane Args: equation_str (str): String of equation to be parsed by sympify function. Expected to be valid Python. Raises: BadInputError: If input does not look safe to parse as an equation.
[ "A", "quick", "regular", "expression", "check", "to", "see", "that", "the", "input", "is", "sane", "Args", ":", "equation_str", "(", "str", ")", ":", "String", "of", "equation", "to", "be", "parsed", "by", "sympify", "function", ".", "Expected", "to", "b...
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L30-L47
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter.set_equation_from_string
def set_equation_from_string(self, equation_str, fail_silently=False, check_equation=True): """Set equation attribute from a string. Checks to see that the string is well-formed, and then uses sympy.sympify to evaluate. Args: e...
python
def set_equation_from_string(self, equation_str, fail_silently=False, check_equation=True): """Set equation attribute from a string. Checks to see that the string is well-formed, and then uses sympy.sympify to evaluate. Args: e...
[ "def", "set_equation_from_string", "(", "self", ",", "equation_str", ",", "fail_silently", "=", "False", ",", "check_equation", "=", "True", ")", ":", "if", "check_equation", ":", "regex_check", "(", "equation_str", ")", "# Create Queue to allow for timeout", "q", "...
Set equation attribute from a string. Checks to see that the string is well-formed, and then uses sympy.sympify to evaluate. Args: equation_str (str): A string representation (in valid Python) of the equation to be added. fail_silently (bool): Wh...
[ "Set", "equation", "attribute", "from", "a", "string", ".", "Checks", "to", "see", "that", "the", "string", "is", "well", "-", "formed", "and", "then", "uses", "sympy", ".", "sympify", "to", "evaluate", ".", "Args", ":", "equation_str", "(", "str", ")", ...
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L81-L130
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter._calc_partials
def _calc_partials(self): """Calculate the partial derivatives Uses sympy.utilities.lambdify to convert equation into a function that can be easily computed. Raises: MissingEquationError: if method is called before equation is attached. """...
python
def _calc_partials(self): """Calculate the partial derivatives Uses sympy.utilities.lambdify to convert equation into a function that can be easily computed. Raises: MissingEquationError: if method is called before equation is attached. """...
[ "def", "_calc_partials", "(", "self", ")", ":", "if", "not", "self", ".", "equation", ":", "raise", "self", ".", "MissingEquationError", "(", "'No equation attached'", ")", "x", ",", "y", "=", "sympy", ".", "symbols", "(", "'x,y'", ")", "compute_func", "="...
Calculate the partial derivatives Uses sympy.utilities.lambdify to convert equation into a function that can be easily computed. Raises: MissingEquationError: if method is called before equation is attached.
[ "Calculate", "the", "partial", "derivatives", "Uses", "sympy", ".", "utilities", ".", "lambdify", "to", "convert", "equation", "into", "a", "function", "that", "can", "be", "easily", "computed", ".", "Raises", ":", "MissingEquationError", ":", "if", "method", ...
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L136-L170
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter.make_plot
def make_plot(self): """Draw the plot on the figure attribute Uses matplotlib to draw and format the chart """ X, Y, DX, DY = self._calc_partials() # Plot the values self.figure = plt.Figure() axes = self.figure.add_subplot(1, 1, 1) axes....
python
def make_plot(self): """Draw the plot on the figure attribute Uses matplotlib to draw and format the chart """ X, Y, DX, DY = self._calc_partials() # Plot the values self.figure = plt.Figure() axes = self.figure.add_subplot(1, 1, 1) axes....
[ "def", "make_plot", "(", "self", ")", ":", "X", ",", "Y", ",", "DX", ",", "DY", "=", "self", ".", "_calc_partials", "(", ")", "# Plot the values", "self", ".", "figure", "=", "plt", ".", "Figure", "(", ")", "axes", "=", "self", ".", "figure", ".", ...
Draw the plot on the figure attribute Uses matplotlib to draw and format the chart
[ "Draw", "the", "plot", "on", "the", "figure", "attribute", "Uses", "matplotlib", "to", "draw", "and", "format", "the", "chart" ]
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L172-L186
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter.write_data
def write_data(self, output): """Write the data out as base64 binary Args: output (file-like object): Output to write figure to. """ if self.figure: canvas = FigureCanvas(self.figure) self.figure.savefig(output, format='png', bbox_inches='tight'...
python
def write_data(self, output): """Write the data out as base64 binary Args: output (file-like object): Output to write figure to. """ if self.figure: canvas = FigureCanvas(self.figure) self.figure.savefig(output, format='png', bbox_inches='tight'...
[ "def", "write_data", "(", "self", ",", "output", ")", ":", "if", "self", ".", "figure", ":", "canvas", "=", "FigureCanvas", "(", "self", ".", "figure", ")", "self", ".", "figure", ".", "savefig", "(", "output", ",", "format", "=", "'png'", ",", "bbox...
Write the data out as base64 binary Args: output (file-like object): Output to write figure to.
[ "Write", "the", "data", "out", "as", "base64", "binary", "Args", ":", "output", "(", "file", "-", "like", "object", ")", ":", "Output", "to", "write", "figure", "to", "." ]
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L188-L199
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter.make_data
def make_data(self): """Return data of the field in a format that can be converted to JSON Returns: data (dict): A dictionary of dictionaries, such that for a given x, y pair, data[x][y] = {"dx": dx, "dy": dy}. Note that this is transposed from the matrix repre...
python
def make_data(self): """Return data of the field in a format that can be converted to JSON Returns: data (dict): A dictionary of dictionaries, such that for a given x, y pair, data[x][y] = {"dx": dx, "dy": dy}. Note that this is transposed from the matrix repre...
[ "def", "make_data", "(", "self", ")", ":", "X", ",", "Y", ",", "DX", ",", "DY", "=", "self", ".", "_calc_partials", "(", ")", "data", "=", "{", "}", "import", "pdb", "for", "x", "in", "self", ".", "xrange", ":", "data", "[", "x", "]", "=", "{...
Return data of the field in a format that can be converted to JSON Returns: data (dict): A dictionary of dictionaries, such that for a given x, y pair, data[x][y] = {"dx": dx, "dy": dy}. Note that this is transposed from the matrix representation in DX and DY
[ "Return", "data", "of", "the", "field", "in", "a", "format", "that", "can", "be", "converted", "to", "JSON", "Returns", ":", "data", "(", "dict", ")", ":", "A", "dictionary", "of", "dictionaries", "such", "that", "for", "a", "given", "x", "y", "pair", ...
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L201-L216
davidsoncasey/quiver
plotter/plotter.py
FieldPlotter.json_data
def json_data(self): """Returns data as JSON Returns: json_data (str): JSON representation of data, as created in make_data """ def stringify_keys(d): if not isinstance(d, dict): return d return dict((str(k), stringify_keys(v)) f...
python
def json_data(self): """Returns data as JSON Returns: json_data (str): JSON representation of data, as created in make_data """ def stringify_keys(d): if not isinstance(d, dict): return d return dict((str(k), stringify_keys(v)) f...
[ "def", "json_data", "(", "self", ")", ":", "def", "stringify_keys", "(", "d", ")", ":", "if", "not", "isinstance", "(", "d", ",", "dict", ")", ":", "return", "d", "return", "dict", "(", "(", "str", "(", "k", ")", ",", "stringify_keys", "(", "v", ...
Returns data as JSON Returns: json_data (str): JSON representation of data, as created in make_data
[ "Returns", "data", "as", "JSON", "Returns", ":", "json_data", "(", "str", ")", ":", "JSON", "representation", "of", "data", "as", "created", "in", "make_data" ]
train
https://github.com/davidsoncasey/quiver/blob/030153ba56d03ef9a500b4cee52a52e0f7cdc6a9/plotter/plotter.py#L218-L230
KelSolaar/Foundations
foundations/tcp_server.py
EchoRequestsHandler.handle
def handle(self): """ Reimplements the :meth:`SocketServer.BaseRequestHandler.handle` method. :return: Method success. :rtype: bool """ while True: data = self.request.recv(1024) if not data: break self.request.send(d...
python
def handle(self): """ Reimplements the :meth:`SocketServer.BaseRequestHandler.handle` method. :return: Method success. :rtype: bool """ while True: data = self.request.recv(1024) if not data: break self.request.send(d...
[ "def", "handle", "(", "self", ")", ":", "while", "True", ":", "data", "=", "self", ".", "request", ".", "recv", "(", "1024", ")", "if", "not", "data", ":", "break", "self", ".", "request", ".", "send", "(", "data", ")", "return", "True" ]
Reimplements the :meth:`SocketServer.BaseRequestHandler.handle` method. :return: Method success. :rtype: bool
[ "Reimplements", "the", ":", "meth", ":", "SocketServer", ".", "BaseRequestHandler", ".", "handle", "method", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L44-L58
KelSolaar/Foundations
foundations/tcp_server.py
TCPServer.address
def address(self, value): """ Setter for **self.__address** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format( "addre...
python
def address(self, value): """ Setter for **self.__address** attribute. :param value: Attribute value. :type value: unicode """ if value is not None: assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format( "addre...
[ "def", "address", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "type", "(", "value", ")", "is", "unicode", ",", "\"'{0}' attribute: '{1}' type is not 'unicode'!\"", ".", "format", "(", "\"address\"", ",", "value", "...
Setter for **self.__address** attribute. :param value: Attribute value. :type value: unicode
[ "Setter", "for", "**", "self", ".", "__address", "**", "attribute", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L111-L122
KelSolaar/Foundations
foundations/tcp_server.py
TCPServer.port
def port(self, value): """ Setter for **self.__port** attribute. :param value: Attribute value. :type value: int """ if value is not None: assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format( "port", value) ...
python
def port(self, value): """ Setter for **self.__port** attribute. :param value: Attribute value. :type value: int """ if value is not None: assert type(value) is int, "'{0}' attribute: '{1}' type is not 'int'!".format( "port", value) ...
[ "def", "port", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "type", "(", "value", ")", "is", "int", ",", "\"'{0}' attribute: '{1}' type is not 'int'!\"", ".", "format", "(", "\"port\"", ",", "value", ")", "assert"...
Setter for **self.__port** attribute. :param value: Attribute value. :type value: int
[ "Setter", "for", "**", "self", ".", "__port", "**", "attribute", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L147-L160
KelSolaar/Foundations
foundations/tcp_server.py
TCPServer.handler
def handler(self, value): """ Setter for **self.__handler** attribute. :param value: Attribute value. ( SocketServer.BaseRequestHandler ) """ if value is not None: assert issubclass(value, SocketServer.BaseRequestHandler), \ "'{0}' attribute: '{1}' i...
python
def handler(self, value): """ Setter for **self.__handler** attribute. :param value: Attribute value. ( SocketServer.BaseRequestHandler ) """ if value is not None: assert issubclass(value, SocketServer.BaseRequestHandler), \ "'{0}' attribute: '{1}' i...
[ "def", "handler", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", ":", "assert", "issubclass", "(", "value", ",", "SocketServer", ".", "BaseRequestHandler", ")", ",", "\"'{0}' attribute: '{1}' is not 'SocketServer.BaseRequestHandler' subclass!...
Setter for **self.__handler** attribute. :param value: Attribute value. ( SocketServer.BaseRequestHandler )
[ "Setter", "for", "**", "self", ".", "__handler", "**", "attribute", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L185-L196
KelSolaar/Foundations
foundations/tcp_server.py
TCPServer.start
def start(self): """ Starts the TCP server. :return: Method success. :rtype: bool """ if self.__online: raise foundations.exceptions.ServerOperationError( "{0} | '{1}' TCP Server is already online!".format(self.__class__.__name__, self)) ...
python
def start(self): """ Starts the TCP server. :return: Method success. :rtype: bool """ if self.__online: raise foundations.exceptions.ServerOperationError( "{0} | '{1}' TCP Server is already online!".format(self.__class__.__name__, self)) ...
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "__online", ":", "raise", "foundations", ".", "exceptions", ".", "ServerOperationError", "(", "\"{0} | '{1}' TCP Server is already online!\"", ".", "format", "(", "self", ".", "__class__", ".", "__name__", ...
Starts the TCP server. :return: Method success. :rtype: bool
[ "Starts", "the", "TCP", "server", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L243-L271
KelSolaar/Foundations
foundations/tcp_server.py
TCPServer.stop
def stop(self, terminate=False): """ Stops the TCP server. :return: Method success. :rtype: bool """ if not self.__online: raise foundations.exceptions.ServerOperationError( "{0} | '{1}' TCP Server is not online!".format(self.__class__.__name...
python
def stop(self, terminate=False): """ Stops the TCP server. :return: Method success. :rtype: bool """ if not self.__online: raise foundations.exceptions.ServerOperationError( "{0} | '{1}' TCP Server is not online!".format(self.__class__.__name...
[ "def", "stop", "(", "self", ",", "terminate", "=", "False", ")", ":", "if", "not", "self", ".", "__online", ":", "raise", "foundations", ".", "exceptions", ".", "ServerOperationError", "(", "\"{0} | '{1}' TCP Server is not online!\"", ".", "format", "(", "self",...
Stops the TCP server. :return: Method success. :rtype: bool
[ "Stops", "the", "TCP", "server", "." ]
train
https://github.com/KelSolaar/Foundations/blob/5c141330faf09dad70a12bc321f4c564917d0a91/foundations/tcp_server.py#L274-L296
theonion/djes
djes/mapping.py
get_first_mapping
def get_first_mapping(cls): """This allows for Django-like inheritance of mapping configurations""" from .models import Indexable if issubclass(cls, Indexable) and hasattr(cls, "Mapping"): return cls.Mapping for base in cls.__bases__: mapping = get_first_mapping(base) if mapping...
python
def get_first_mapping(cls): """This allows for Django-like inheritance of mapping configurations""" from .models import Indexable if issubclass(cls, Indexable) and hasattr(cls, "Mapping"): return cls.Mapping for base in cls.__bases__: mapping = get_first_mapping(base) if mapping...
[ "def", "get_first_mapping", "(", "cls", ")", ":", "from", ".", "models", "import", "Indexable", "if", "issubclass", "(", "cls", ",", "Indexable", ")", "and", "hasattr", "(", "cls", ",", "\"Mapping\"", ")", ":", "return", "cls", ".", "Mapping", "for", "ba...
This allows for Django-like inheritance of mapping configurations
[ "This", "allows", "for", "Django", "-", "like", "inheritance", "of", "mapping", "configurations" ]
train
https://github.com/theonion/djes/blob/8f7347382c74172e82e959e3dfbc12b18fbb523f/djes/mapping.py#L43-L53
theonion/djes
djes/mapping.py
DjangoMapping.configure_field
def configure_field(self, field): """This configures an Elasticsearch Mapping field, based on a Django model field""" from .models import Indexable # This is for reverse relations, which do not have a db column if field.auto_created and field.is_relation: if isinstance(field...
python
def configure_field(self, field): """This configures an Elasticsearch Mapping field, based on a Django model field""" from .models import Indexable # This is for reverse relations, which do not have a db column if field.auto_created and field.is_relation: if isinstance(field...
[ "def", "configure_field", "(", "self", ",", "field", ")", ":", "from", ".", "models", "import", "Indexable", "# This is for reverse relations, which do not have a db column", "if", "field", ".", "auto_created", "and", "field", ".", "is_relation", ":", "if", "isinstanc...
This configures an Elasticsearch Mapping field, based on a Django model field
[ "This", "configures", "an", "Elasticsearch", "Mapping", "field", "based", "on", "a", "Django", "model", "field" ]
train
https://github.com/theonion/djes/blob/8f7347382c74172e82e959e3dfbc12b18fbb523f/djes/mapping.py#L114-L147
flypenguin/python-cattleprod
cattleprod/__init__.py
poke
def poke(url, accesskey=None, secretkey=None, __method__='GET', **req_args): """ Poke the Rancher API. Returns a Rod object instance. Central starting point for the cattleprod package. :param url: The full Rancher URL to the API endpoint. :param accesskey: The rancher access key, optional. :para...
python
def poke(url, accesskey=None, secretkey=None, __method__='GET', **req_args): """ Poke the Rancher API. Returns a Rod object instance. Central starting point for the cattleprod package. :param url: The full Rancher URL to the API endpoint. :param accesskey: The rancher access key, optional. :para...
[ "def", "poke", "(", "url", ",", "accesskey", "=", "None", ",", "secretkey", "=", "None", ",", "__method__", "=", "'GET'", ",", "*", "*", "req_args", ")", ":", "if", "accesskey", "and", "secretkey", ":", "req_args", "[", "'auth'", "]", "=", "(", "acce...
Poke the Rancher API. Returns a Rod object instance. Central starting point for the cattleprod package. :param url: The full Rancher URL to the API endpoint. :param accesskey: The rancher access key, optional. :param secretkey: The rancher secret key, optional. :param __method__: Internal method, do...
[ "Poke", "the", "Rancher", "API", ".", "Returns", "a", "Rod", "object", "instance", ".", "Central", "starting", "point", "for", "the", "cattleprod", "package", ".", ":", "param", "url", ":", "The", "full", "Rancher", "URL", "to", "the", "API", "endpoint", ...
train
https://github.com/flypenguin/python-cattleprod/blob/05043c91de78d211968db65413d3db4fd44c89e4/cattleprod/__init__.py#L55-L76
limodou/par
par/gwiki.py
WikiHtmlVisitor.tag
def tag(self, tag, child='', enclose=0, newline=True, **kwargs): """ enclose: 0 => <tag> 1 => <tag/> 2 => <tag></tag> """ kw = kwargs.copy() _class = '' if '_class' in kw: _class = kw.pop('_class') if 'class' in kw: ...
python
def tag(self, tag, child='', enclose=0, newline=True, **kwargs): """ enclose: 0 => <tag> 1 => <tag/> 2 => <tag></tag> """ kw = kwargs.copy() _class = '' if '_class' in kw: _class = kw.pop('_class') if 'class' in kw: ...
[ "def", "tag", "(", "self", ",", "tag", ",", "child", "=", "''", ",", "enclose", "=", "0", ",", "newline", "=", "True", ",", "*", "*", "kwargs", ")", ":", "kw", "=", "kwargs", ".", "copy", "(", ")", "_class", "=", "''", "if", "'_class'", "in", ...
enclose: 0 => <tag> 1 => <tag/> 2 => <tag></tag>
[ "enclose", ":", "0", "=", ">", "<tag", ">", "1", "=", ">", "<tag", "/", ">", "2", "=", ">", "<tag", ">", "<", "/", "tag", ">" ]
train
https://github.com/limodou/par/blob/0863c339c8d0d46f8516eb4577b459b9cf2dec8d/par/gwiki.py#L163-L211
StyXman/ayrton
ayrton/remote.py
remote.param
def param (self, param, kwargs, default_value=False): """gets a param from kwargs, or uses a default_value. if found, it's removed from kwargs""" if param in kwargs: value= kwargs[param] del kwargs[param] else: value= default_value setattr (sel...
python
def param (self, param, kwargs, default_value=False): """gets a param from kwargs, or uses a default_value. if found, it's removed from kwargs""" if param in kwargs: value= kwargs[param] del kwargs[param] else: value= default_value setattr (sel...
[ "def", "param", "(", "self", ",", "param", ",", "kwargs", ",", "default_value", "=", "False", ")", ":", "if", "param", "in", "kwargs", ":", "value", "=", "kwargs", "[", "param", "]", "del", "kwargs", "[", "param", "]", "else", ":", "value", "=", "d...
gets a param from kwargs, or uses a default_value. if found, it's removed from kwargs
[ "gets", "a", "param", "from", "kwargs", "or", "uses", "a", "default_value", ".", "if", "found", "it", "s", "removed", "from", "kwargs" ]
train
https://github.com/StyXman/ayrton/blob/e1eed5c7ef230e3c2340a1f0bf44c72bbdc0debb/ayrton/remote.py#L172-L180
goshuirc/irc
girc/imapping.py
IMap._set_transmaps
def _set_transmaps(self): """Set translation maps for our standard.""" if self._std == 'ascii': self._lower_chars = string.ascii_lowercase self._upper_chars = string.ascii_uppercase elif self._std == 'rfc1459': self._lower_chars = (string.ascii_lowercase + ...
python
def _set_transmaps(self): """Set translation maps for our standard.""" if self._std == 'ascii': self._lower_chars = string.ascii_lowercase self._upper_chars = string.ascii_uppercase elif self._std == 'rfc1459': self._lower_chars = (string.ascii_lowercase + ...
[ "def", "_set_transmaps", "(", "self", ")", ":", "if", "self", ".", "_std", "==", "'ascii'", ":", "self", ".", "_lower_chars", "=", "string", ".", "ascii_lowercase", "self", ".", "_upper_chars", "=", "string", ".", "ascii_uppercase", "elif", "self", ".", "_...
Set translation maps for our standard.
[ "Set", "translation", "maps", "for", "our", "standard", "." ]
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L22-L38
goshuirc/irc
girc/imapping.py
IMap.set_std
def set_std(self, std): """Set the standard we'll be using (isupport CASEMAPPING).""" if not hasattr(self, '_std'): IMap.__init__(self) # translation based on std self._std = std.lower() # set casemapping maps self._set_transmaps() # create translat...
python
def set_std(self, std): """Set the standard we'll be using (isupport CASEMAPPING).""" if not hasattr(self, '_std'): IMap.__init__(self) # translation based on std self._std = std.lower() # set casemapping maps self._set_transmaps() # create translat...
[ "def", "set_std", "(", "self", ",", "std", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_std'", ")", ":", "IMap", ".", "__init__", "(", "self", ")", "# translation based on std", "self", ".", "_std", "=", "std", ".", "lower", "(", ")", "# se...
Set the standard we'll be using (isupport CASEMAPPING).
[ "Set", "the", "standard", "we", "ll", "be", "using", "(", "isupport", "CASEMAPPING", ")", "." ]
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L42-L57
goshuirc/irc
girc/imapping.py
IDict.copy
def copy(self): """Return a copy of ourself.""" new_dict = IDict(std=self._std) new_dict.update(self.store) return new_dict
python
def copy(self): """Return a copy of ourself.""" new_dict = IDict(std=self._std) new_dict.update(self.store) return new_dict
[ "def", "copy", "(", "self", ")", ":", "new_dict", "=", "IDict", "(", "std", "=", "self", ".", "_std", ")", "new_dict", ".", "update", "(", "self", ".", "store", ")", "return", "new_dict" ]
Return a copy of ourself.
[ "Return", "a", "copy", "of", "ourself", "." ]
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L103-L107
goshuirc/irc
girc/imapping.py
IString._irc_lower
def _irc_lower(self, in_string): """Convert us to our lower-case equivalent, given our std.""" conv_string = self._translate(in_string) if self._lower_trans is not None: conv_string = conv_string.translate(self._lower_trans) return str.lower(conv_string)
python
def _irc_lower(self, in_string): """Convert us to our lower-case equivalent, given our std.""" conv_string = self._translate(in_string) if self._lower_trans is not None: conv_string = conv_string.translate(self._lower_trans) return str.lower(conv_string)
[ "def", "_irc_lower", "(", "self", ",", "in_string", ")", ":", "conv_string", "=", "self", ".", "_translate", "(", "in_string", ")", "if", "self", ".", "_lower_trans", "is", "not", "None", ":", "conv_string", "=", "conv_string", ".", "translate", "(", "self...
Convert us to our lower-case equivalent, given our std.
[ "Convert", "us", "to", "our", "lower", "-", "case", "equivalent", "given", "our", "std", "." ]
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L204-L209
goshuirc/irc
girc/imapping.py
IString._irc_upper
def _irc_upper(self, in_string): """Convert us to our upper-case equivalent, given our std.""" conv_string = self._translate(in_string) if self._upper_trans is not None: conv_string = in_string.translate(self._upper_trans) return str.upper(conv_string)
python
def _irc_upper(self, in_string): """Convert us to our upper-case equivalent, given our std.""" conv_string = self._translate(in_string) if self._upper_trans is not None: conv_string = in_string.translate(self._upper_trans) return str.upper(conv_string)
[ "def", "_irc_upper", "(", "self", ",", "in_string", ")", ":", "conv_string", "=", "self", ".", "_translate", "(", "in_string", ")", "if", "self", ".", "_upper_trans", "is", "not", "None", ":", "conv_string", "=", "in_string", ".", "translate", "(", "self",...
Convert us to our upper-case equivalent, given our std.
[ "Convert", "us", "to", "our", "upper", "-", "case", "equivalent", "given", "our", "std", "." ]
train
https://github.com/goshuirc/irc/blob/d6a5e3e04d337566c009b087f108cd76f9e122cc/girc/imapping.py#L211-L216
praekelt/django-richcomments
richcomments/views.py
list
def list(request, content_type, id): """ Wrapper exposing comment's render_comment_list tag as a view. """ # get object app_label, model = content_type.split('-') ctype = ContentType.objects.get(app_label=app_label, model=model) obj = ctype.get_object_for_this_type(id=id) # setup templa...
python
def list(request, content_type, id): """ Wrapper exposing comment's render_comment_list tag as a view. """ # get object app_label, model = content_type.split('-') ctype = ContentType.objects.get(app_label=app_label, model=model) obj = ctype.get_object_for_this_type(id=id) # setup templa...
[ "def", "list", "(", "request", ",", "content_type", ",", "id", ")", ":", "# get object", "app_label", ",", "model", "=", "content_type", ".", "split", "(", "'-'", ")", "ctype", "=", "ContentType", ".", "objects", ".", "get", "(", "app_label", "=", "app_l...
Wrapper exposing comment's render_comment_list tag as a view.
[ "Wrapper", "exposing", "comment", "s", "render_comment_list", "tag", "as", "a", "view", "." ]
train
https://github.com/praekelt/django-richcomments/blob/e1b2e123bf46135fd2bdf8fa810e4995e641db72/richcomments/views.py#L6-L20
PMBio/limix-backup
limix/stats/fdr.py
qvalues1
def qvalues1(PV,m=None,pi=1.0): """estimate q vlaues from a list of Pvalues this algorihm is taken from Storey, significance testing for genomic ... m: number of tests, (if not len(PV)), pi: fraction of expected true null (1.0 is a conservative estimate) @param PV: pvalues @param m: total number of...
python
def qvalues1(PV,m=None,pi=1.0): """estimate q vlaues from a list of Pvalues this algorihm is taken from Storey, significance testing for genomic ... m: number of tests, (if not len(PV)), pi: fraction of expected true null (1.0 is a conservative estimate) @param PV: pvalues @param m: total number of...
[ "def", "qvalues1", "(", "PV", ",", "m", "=", "None", ",", "pi", "=", "1.0", ")", ":", "S", "=", "PV", ".", "shape", "PV", "=", "PV", ".", "flatten", "(", ")", "if", "m", "is", "None", ":", "m", "=", "len", "(", "PV", ")", "*", "1.0", "els...
estimate q vlaues from a list of Pvalues this algorihm is taken from Storey, significance testing for genomic ... m: number of tests, (if not len(PV)), pi: fraction of expected true null (1.0 is a conservative estimate) @param PV: pvalues @param m: total number of tests if PV is not the entire array. ...
[ "estimate", "q", "vlaues", "from", "a", "list", "of", "Pvalues", "this", "algorihm", "is", "taken", "from", "Storey", "significance", "testing", "for", "genomic", "...", "m", ":", "number", "of", "tests", "(", "if", "not", "len", "(", "PV", "))", "pi", ...
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/stats/fdr.py#L13-L57
PMBio/limix-backup
limix/stats/fdr.py
estimate_lambda
def estimate_lambda(pv): """estimate lambda form a set of PV""" LOD2 = sp.median(st.chi2.isf(pv,1)) L = (LOD2/0.456) return (L)
python
def estimate_lambda(pv): """estimate lambda form a set of PV""" LOD2 = sp.median(st.chi2.isf(pv,1)) L = (LOD2/0.456) return (L)
[ "def", "estimate_lambda", "(", "pv", ")", ":", "LOD2", "=", "sp", ".", "median", "(", "st", ".", "chi2", ".", "isf", "(", "pv", ",", "1", ")", ")", "L", "=", "(", "LOD2", "/", "0.456", ")", "return", "(", "L", ")" ]
estimate lambda form a set of PV
[ "estimate", "lambda", "form", "a", "set", "of", "PV" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/stats/fdr.py#L153-L157
jhermann/rudiments
src/rudiments/reamed/click.py
pretty_path
def pretty_path(path, _home_re=re.compile('^' + re.escape(os.path.expanduser('~') + os.sep))): """Prettify path for humans, and make it Unicode.""" path = format_filename(path) path = _home_re.sub('~' + os.sep, path) return path
python
def pretty_path(path, _home_re=re.compile('^' + re.escape(os.path.expanduser('~') + os.sep))): """Prettify path for humans, and make it Unicode.""" path = format_filename(path) path = _home_re.sub('~' + os.sep, path) return path
[ "def", "pretty_path", "(", "path", ",", "_home_re", "=", "re", ".", "compile", "(", "'^'", "+", "re", ".", "escape", "(", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", "+", "os", ".", "sep", ")", ")", ")", ":", "path", "=", "format_filen...
Prettify path for humans, and make it Unicode.
[ "Prettify", "path", "for", "humans", "and", "make", "it", "Unicode", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L39-L43
jhermann/rudiments
src/rudiments/reamed/click.py
serror
def serror(message, *args, **kwargs): """Print a styled error message, while using any arguments to format the message.""" if args or kwargs: message = message.format(*args, **kwargs) return secho(message, fg='white', bg='red', bold=True)
python
def serror(message, *args, **kwargs): """Print a styled error message, while using any arguments to format the message.""" if args or kwargs: message = message.format(*args, **kwargs) return secho(message, fg='white', bg='red', bold=True)
[ "def", "serror", "(", "message", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "args", "or", "kwargs", ":", "message", "=", "message", ".", "format", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "secho", "(", "message", ...
Print a styled error message, while using any arguments to format the message.
[ "Print", "a", "styled", "error", "message", "while", "using", "any", "arguments", "to", "format", "the", "message", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L46-L50
jhermann/rudiments
src/rudiments/reamed/click.py
AliasedGroup.get_command
def get_command(self, ctx, cmd_name): """Map some aliases to their 'real' names.""" cmd_name = self.MAP.get(cmd_name, cmd_name) return super(AliasedGroup, self).get_command(ctx, cmd_name)
python
def get_command(self, ctx, cmd_name): """Map some aliases to their 'real' names.""" cmd_name = self.MAP.get(cmd_name, cmd_name) return super(AliasedGroup, self).get_command(ctx, cmd_name)
[ "def", "get_command", "(", "self", ",", "ctx", ",", "cmd_name", ")", ":", "cmd_name", "=", "self", ".", "MAP", ".", "get", "(", "cmd_name", ",", "cmd_name", ")", "return", "super", "(", "AliasedGroup", ",", "self", ")", ".", "get_command", "(", "ctx", ...
Map some aliases to their 'real' names.
[ "Map", "some", "aliases", "to", "their", "real", "names", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L72-L75
jhermann/rudiments
src/rudiments/reamed/click.py
Configuration.from_context
def from_context(cls, ctx, config_paths=None, project=None): """Create a configuration object, and initialize the Click context with it.""" if ctx.obj is None: ctx.obj = Bunch() ctx.obj.cfg = cls(ctx.info_name, config_paths, project=project) return ctx.obj.cfg
python
def from_context(cls, ctx, config_paths=None, project=None): """Create a configuration object, and initialize the Click context with it.""" if ctx.obj is None: ctx.obj = Bunch() ctx.obj.cfg = cls(ctx.info_name, config_paths, project=project) return ctx.obj.cfg
[ "def", "from_context", "(", "cls", ",", "ctx", ",", "config_paths", "=", "None", ",", "project", "=", "None", ")", ":", "if", "ctx", ".", "obj", "is", "None", ":", "ctx", ".", "obj", "=", "Bunch", "(", ")", "ctx", ".", "obj", ".", "cfg", "=", "...
Create a configuration object, and initialize the Click context with it.
[ "Create", "a", "configuration", "object", "and", "initialize", "the", "Click", "context", "with", "it", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L97-L102
jhermann/rudiments
src/rudiments/reamed/click.py
Configuration.locations
def locations(self, exists=True): """ Return the location of the config file(s). A given directory will be scanned for ``*.conf`` files, in alphabetical order. Any duplicates will be eliminated. If ``exists`` is True, only existing configuration locations are returned. ...
python
def locations(self, exists=True): """ Return the location of the config file(s). A given directory will be scanned for ``*.conf`` files, in alphabetical order. Any duplicates will be eliminated. If ``exists`` is True, only existing configuration locations are returned. ...
[ "def", "locations", "(", "self", ",", "exists", "=", "True", ")", ":", "result", "=", "[", "]", "for", "config_files", "in", "self", ".", "config_paths", ":", "if", "not", "config_files", ":", "continue", "if", "os", ".", "path", ".", "isdir", "(", "...
Return the location of the config file(s). A given directory will be scanned for ``*.conf`` files, in alphabetical order. Any duplicates will be eliminated. If ``exists`` is True, only existing configuration locations are returned.
[ "Return", "the", "location", "of", "the", "config", "file", "(", "s", ")", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L137-L161
jhermann/rudiments
src/rudiments/reamed/click.py
Configuration.load
def load(self): """Load configuration from the defined locations.""" if not self.loaded: self.values = configobj.ConfigObj({}, **self.DEFAULT_CONFIG_OPTS) for path in self.locations(): try: part = configobj.ConfigObj(infile=path, **self.DEFAULT...
python
def load(self): """Load configuration from the defined locations.""" if not self.loaded: self.values = configobj.ConfigObj({}, **self.DEFAULT_CONFIG_OPTS) for path in self.locations(): try: part = configobj.ConfigObj(infile=path, **self.DEFAULT...
[ "def", "load", "(", "self", ")", ":", "if", "not", "self", ".", "loaded", ":", "self", ".", "values", "=", "configobj", ".", "ConfigObj", "(", "{", "}", ",", "*", "*", "self", ".", "DEFAULT_CONFIG_OPTS", ")", "for", "path", "in", "self", ".", "loca...
Load configuration from the defined locations.
[ "Load", "configuration", "from", "the", "defined", "locations", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L163-L174
jhermann/rudiments
src/rudiments/reamed/click.py
Configuration.section
def section(self, ctx, optional=False): """ Return section of the config for a specific context (sub-command). Parameters: ctx (Context): The Click context object. optional (bool): If ``True``, return an empty config object when section is missing. ...
python
def section(self, ctx, optional=False): """ Return section of the config for a specific context (sub-command). Parameters: ctx (Context): The Click context object. optional (bool): If ``True``, return an empty config object when section is missing. ...
[ "def", "section", "(", "self", ",", "ctx", ",", "optional", "=", "False", ")", ":", "values", "=", "self", ".", "load", "(", ")", "try", ":", "return", "values", "[", "ctx", ".", "info_name", "]", "except", "KeyError", ":", "if", "optional", ":", "...
Return section of the config for a specific context (sub-command). Parameters: ctx (Context): The Click context object. optional (bool): If ``True``, return an empty config object when section is missing. Returns: Section: The configuration secti...
[ "Return", "section", "of", "the", "config", "for", "a", "specific", "context", "(", "sub", "-", "command", ")", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L180-L199
jhermann/rudiments
src/rudiments/reamed/click.py
Configuration.get
def get(self, name, default=NO_DEFAULT): """ Return the specified name from the root section. Parameters: name (str): The name of the requested value. default (optional): If set, the default value to use instead of raising :class:`Logg...
python
def get(self, name, default=NO_DEFAULT): """ Return the specified name from the root section. Parameters: name (str): The name of the requested value. default (optional): If set, the default value to use instead of raising :class:`Logg...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "NO_DEFAULT", ")", ":", "values", "=", "self", ".", "load", "(", ")", "try", ":", "return", "values", "[", "name", "]", "except", "KeyError", ":", "if", "default", "is", "self", ".", "NO_...
Return the specified name from the root section. Parameters: name (str): The name of the requested value. default (optional): If set, the default value to use instead of raising :class:`LoggedFailure` for unknown names. Re...
[ "Return", "the", "specified", "name", "from", "the", "root", "section", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/reamed/click.py#L201-L223
jhshi/wltrace
wltrace/common.py
WlTrace.next
def next(self): """Iteration function. Note that it is possible to yield dangling ack packets as well, so user can detect if the sniffer missed the previous packet. """ try: self._fetch() pkt = self.pkt_queue.popleft() try: se...
python
def next(self): """Iteration function. Note that it is possible to yield dangling ack packets as well, so user can detect if the sniffer missed the previous packet. """ try: self._fetch() pkt = self.pkt_queue.popleft() try: se...
[ "def", "next", "(", "self", ")", ":", "try", ":", "self", ".", "_fetch", "(", ")", "pkt", "=", "self", ".", "pkt_queue", ".", "popleft", "(", ")", "try", ":", "self", ".", "_infer_acked", "(", "pkt", ")", "except", ":", "pass", "try", ":", "self"...
Iteration function. Note that it is possible to yield dangling ack packets as well, so user can detect if the sniffer missed the previous packet.
[ "Iteration", "function", "." ]
train
https://github.com/jhshi/wltrace/blob/4c8441162f7cddd47375da2effc52c95b97dc81d/wltrace/common.py#L202-L223
jhshi/wltrace
wltrace/common.py
WlTrace.peek
def peek(self): """Get the current packet without consuming it. """ try: self._fetch() pkt = self.pkt_queue[0] return pkt except IndexError: raise StopIteration()
python
def peek(self): """Get the current packet without consuming it. """ try: self._fetch() pkt = self.pkt_queue[0] return pkt except IndexError: raise StopIteration()
[ "def", "peek", "(", "self", ")", ":", "try", ":", "self", ".", "_fetch", "(", ")", "pkt", "=", "self", ".", "pkt_queue", "[", "0", "]", "return", "pkt", "except", "IndexError", ":", "raise", "StopIteration", "(", ")" ]
Get the current packet without consuming it.
[ "Get", "the", "current", "packet", "without", "consuming", "it", "." ]
train
https://github.com/jhshi/wltrace/blob/4c8441162f7cddd47375da2effc52c95b97dc81d/wltrace/common.py#L225-L233
theonion/djes
djes/search.py
LazySearch.execute
def execute(self): """ Execute the search and return an instance of ``Response`` wrapping all the data. """ if hasattr(self, "_executed"): return self._executed es = connections.get_connection(self._using) if getattr(self, "_full", False) is False: ...
python
def execute(self): """ Execute the search and return an instance of ``Response`` wrapping all the data. """ if hasattr(self, "_executed"): return self._executed es = connections.get_connection(self._using) if getattr(self, "_full", False) is False: ...
[ "def", "execute", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "\"_executed\"", ")", ":", "return", "self", ".", "_executed", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "if", "getattr", "(", "self", "...
Execute the search and return an instance of ``Response`` wrapping all the data.
[ "Execute", "the", "search", "and", "return", "an", "instance", "of", "Response", "wrapping", "all", "the", "data", "." ]
train
https://github.com/theonion/djes/blob/8f7347382c74172e82e959e3dfbc12b18fbb523f/djes/search.py#L106-L128
grycap/cpyutils
config.py
set_paths
def set_paths(etc_paths = [ "/etc/" ]): """ Sets the paths where the configuration files will be searched * You can have multiple configuration files (e.g. in the /etc/default folder and in /etc/appfolder/) """ global _ETC_PATHS _ETC_PATHS = [] for p in etc_paths: ...
python
def set_paths(etc_paths = [ "/etc/" ]): """ Sets the paths where the configuration files will be searched * You can have multiple configuration files (e.g. in the /etc/default folder and in /etc/appfolder/) """ global _ETC_PATHS _ETC_PATHS = [] for p in etc_paths: ...
[ "def", "set_paths", "(", "etc_paths", "=", "[", "\"/etc/\"", "]", ")", ":", "global", "_ETC_PATHS", "_ETC_PATHS", "=", "[", "]", "for", "p", "in", "etc_paths", ":", "_ETC_PATHS", ".", "append", "(", "os", ".", "path", ".", "expanduser", "(", "p", ")", ...
Sets the paths where the configuration files will be searched * You can have multiple configuration files (e.g. in the /etc/default folder and in /etc/appfolder/)
[ "Sets", "the", "paths", "where", "the", "configuration", "files", "will", "be", "searched", "*", "You", "can", "have", "multiple", "configuration", "files", "(", "e", ".", "g", ".", "in", "the", "/", "etc", "/", "default", "folder", "and", "in", "/", "...
train
https://github.com/grycap/cpyutils/blob/fa966fc6d2ae1e1e799e19941561aa79b617f1b1/config.py#L29-L39
grycap/cpyutils
config.py
config_filename
def config_filename(filename): """ Obtains the first filename found that is included in one of the configuration folders. This function returs the full path for the file. * It is useful for files that are not config-formatted (e.g. hosts files, json, etc.) that will be rea...
python
def config_filename(filename): """ Obtains the first filename found that is included in one of the configuration folders. This function returs the full path for the file. * It is useful for files that are not config-formatted (e.g. hosts files, json, etc.) that will be rea...
[ "def", "config_filename", "(", "filename", ")", ":", "global", "_ETC_PATHS", "if", "filename", ".", "startswith", "(", "'/'", ")", ":", "_LOGGER", ".", "info", "(", "\"using absolute path for filename \\\"%s\\\"\"", "%", "filename", ")", "return", "filename", "imp...
Obtains the first filename found that is included in one of the configuration folders. This function returs the full path for the file. * It is useful for files that are not config-formatted (e.g. hosts files, json, etc.) that will be read using other mechanisms
[ "Obtains", "the", "first", "filename", "found", "that", "is", "included", "in", "one", "of", "the", "configuration", "folders", ".", "This", "function", "returs", "the", "full", "path", "for", "the", "file", ".", "*", "It", "is", "useful", "for", "files", ...
train
https://github.com/grycap/cpyutils/blob/fa966fc6d2ae1e1e799e19941561aa79b617f1b1/config.py#L61-L83
grycap/cpyutils
config.py
read_config
def read_config(section, variables, sink, filename = None, logvars = False): """ This functions creates a dictionary whose keys are the variables indicated in 'variables' with the values obtained from the config filenames set for this module. 'variables' is a dictionary of variable ...
python
def read_config(section, variables, sink, filename = None, logvars = False): """ This functions creates a dictionary whose keys are the variables indicated in 'variables' with the values obtained from the config filenames set for this module. 'variables' is a dictionary of variable ...
[ "def", "read_config", "(", "section", ",", "variables", ",", "sink", ",", "filename", "=", "None", ",", "logvars", "=", "False", ")", ":", "global", "_ETC_PATHS", "import", "ConfigParser", "config", "=", "ConfigParser", ".", "ConfigParser", "(", ")", "if", ...
This functions creates a dictionary whose keys are the variables indicated in 'variables' with the values obtained from the config filenames set for this module. 'variables' is a dictionary of variable names and default values { 'VAR1': defaultval1, ...} The value for the varia...
[ "This", "functions", "creates", "a", "dictionary", "whose", "keys", "are", "the", "variables", "indicated", "in", "variables", "with", "the", "values", "obtained", "from", "the", "config", "filenames", "set", "for", "this", "module", ".", "variables", "is", "a...
train
https://github.com/grycap/cpyutils/blob/fa966fc6d2ae1e1e799e19941561aa79b617f1b1/config.py#L85-L137
grycap/cpyutils
config.py
existing_config_files
def existing_config_files(): """ Method that calculates all the configuration files that are valid, according to the 'set_paths' and other methods for this module. """ global _ETC_PATHS global _MAIN_CONFIG_FILE global _CONFIG_VAR_INCLUDE global _CONFIG_FILTER config_files = ...
python
def existing_config_files(): """ Method that calculates all the configuration files that are valid, according to the 'set_paths' and other methods for this module. """ global _ETC_PATHS global _MAIN_CONFIG_FILE global _CONFIG_VAR_INCLUDE global _CONFIG_FILTER config_files = ...
[ "def", "existing_config_files", "(", ")", ":", "global", "_ETC_PATHS", "global", "_MAIN_CONFIG_FILE", "global", "_CONFIG_VAR_INCLUDE", "global", "_CONFIG_FILTER", "config_files", "=", "[", "]", "for", "possible", "in", "_ETC_PATHS", ":", "config_files", "=", "config_f...
Method that calculates all the configuration files that are valid, according to the 'set_paths' and other methods for this module.
[ "Method", "that", "calculates", "all", "the", "configuration", "files", "that", "are", "valid", "according", "to", "the", "set_paths", "and", "other", "methods", "for", "this", "module", "." ]
train
https://github.com/grycap/cpyutils/blob/fa966fc6d2ae1e1e799e19941561aa79b617f1b1/config.py#L234-L257
millar/provstore-api
provstore/bundle.py
Bundle.prov
def prov(self): """ :return: This bundle's provenance :rtype: :py:class:`prov.model.ProvDocument` """ if not self._prov: self._prov = self._api.get_bundle(self._document.id, self._id) return self._prov
python
def prov(self): """ :return: This bundle's provenance :rtype: :py:class:`prov.model.ProvDocument` """ if not self._prov: self._prov = self._api.get_bundle(self._document.id, self._id) return self._prov
[ "def", "prov", "(", "self", ")", ":", "if", "not", "self", ".", "_prov", ":", "self", ".", "_prov", "=", "self", ".", "_api", ".", "get_bundle", "(", "self", ".", "_document", ".", "id", ",", "self", ".", "_id", ")", "return", "self", ".", "_prov...
:return: This bundle's provenance :rtype: :py:class:`prov.model.ProvDocument`
[ ":", "return", ":", "This", "bundle", "s", "provenance", ":", "rtype", ":", ":", "py", ":", "class", ":", "prov", ".", "model", ".", "ProvDocument" ]
train
https://github.com/millar/provstore-api/blob/0dd506b4f0e00623b95a52caa70debe758817179/provstore/bundle.py#L32-L40
bretth/woven
woven/project.py
deploy_project
def deploy_project(): """ Deploy to the project directory in the virtualenv """ project_root = '/'.join([deployment_root(),'env',env.project_fullname,'project']) local_dir = os.getcwd() if env.verbosity: print env.host,"DEPLOYING project", env.project_fullname #Exclude a fe...
python
def deploy_project(): """ Deploy to the project directory in the virtualenv """ project_root = '/'.join([deployment_root(),'env',env.project_fullname,'project']) local_dir = os.getcwd() if env.verbosity: print env.host,"DEPLOYING project", env.project_fullname #Exclude a fe...
[ "def", "deploy_project", "(", ")", ":", "project_root", "=", "'/'", ".", "join", "(", "[", "deployment_root", "(", ")", ",", "'env'", ",", "env", ".", "project_fullname", ",", "'project'", "]", ")", "local_dir", "=", "os", ".", "getcwd", "(", ")", "if"...
Deploy to the project directory in the virtualenv
[ "Deploy", "to", "the", "project", "directory", "in", "the", "virtualenv" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L61-L90
bretth/woven
woven/project.py
deploy_sitesettings
def deploy_sitesettings(): """ Deploy to the project directory in the virtualenv """ sitesettings = '/'.join([deployment_root(),'env',env.project_fullname,'project',env.project_package_name,'sitesettings']) local_dir = os.path.join(os.getcwd(),env.project_package_name,'sitesettings') crea...
python
def deploy_sitesettings(): """ Deploy to the project directory in the virtualenv """ sitesettings = '/'.join([deployment_root(),'env',env.project_fullname,'project',env.project_package_name,'sitesettings']) local_dir = os.path.join(os.getcwd(),env.project_package_name,'sitesettings') crea...
[ "def", "deploy_sitesettings", "(", ")", ":", "sitesettings", "=", "'/'", ".", "join", "(", "[", "deployment_root", "(", ")", ",", "'env'", ",", "env", ".", "project_fullname", ",", "'project'", ",", "env", ".", "project_package_name", ",", "'sitesettings'", ...
Deploy to the project directory in the virtualenv
[ "Deploy", "to", "the", "project", "directory", "in", "the", "virtualenv" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L92-L105
bretth/woven
woven/project.py
deploy_templates
def deploy_templates(): """ Deploy any templates from your shortest TEMPLATE_DIRS setting """ deployed = None if not hasattr(env, 'project_template_dir'): #the normal pattern would mean the shortest path is the main one. #its probably the last listed length = 1000 ...
python
def deploy_templates(): """ Deploy any templates from your shortest TEMPLATE_DIRS setting """ deployed = None if not hasattr(env, 'project_template_dir'): #the normal pattern would mean the shortest path is the main one. #its probably the last listed length = 1000 ...
[ "def", "deploy_templates", "(", ")", ":", "deployed", "=", "None", "if", "not", "hasattr", "(", "env", ",", "'project_template_dir'", ")", ":", "#the normal pattern would mean the shortest path is the main one.", "#its probably the last listed", "length", "=", "1000", "fo...
Deploy any templates from your shortest TEMPLATE_DIRS setting
[ "Deploy", "any", "templates", "from", "your", "shortest", "TEMPLATE_DIRS", "setting" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L108-L130
bretth/woven
woven/project.py
deploy_static
def deploy_static(): """ Deploy static (application) versioned media """ if not env.STATIC_URL or 'http://' in env.STATIC_URL: return from django.core.servers.basehttp import AdminMediaHandler remote_dir = '/'.join([deployment_root(),'env',env.project_fullname,'static']) m_prefix = len(...
python
def deploy_static(): """ Deploy static (application) versioned media """ if not env.STATIC_URL or 'http://' in env.STATIC_URL: return from django.core.servers.basehttp import AdminMediaHandler remote_dir = '/'.join([deployment_root(),'env',env.project_fullname,'static']) m_prefix = len(...
[ "def", "deploy_static", "(", ")", ":", "if", "not", "env", ".", "STATIC_URL", "or", "'http://'", "in", "env", ".", "STATIC_URL", ":", "return", "from", "django", ".", "core", ".", "servers", ".", "basehttp", "import", "AdminMediaHandler", "remote_dir", "=", ...
Deploy static (application) versioned media
[ "Deploy", "static", "(", "application", ")", "versioned", "media" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L133-L163
bretth/woven
woven/project.py
deploy_media
def deploy_media(): """ Deploy MEDIA_ROOT unversioned on host """ if not env.MEDIA_URL or not env.MEDIA_ROOT or 'http://' in env.MEDIA_URL: return local_dir = env.MEDIA_ROOT remote_dir = '/'.join([deployment_root(),'public']) media_url = env.MEDIA_URL[1:] if media_url: remo...
python
def deploy_media(): """ Deploy MEDIA_ROOT unversioned on host """ if not env.MEDIA_URL or not env.MEDIA_ROOT or 'http://' in env.MEDIA_URL: return local_dir = env.MEDIA_ROOT remote_dir = '/'.join([deployment_root(),'public']) media_url = env.MEDIA_URL[1:] if media_url: remo...
[ "def", "deploy_media", "(", ")", ":", "if", "not", "env", ".", "MEDIA_URL", "or", "not", "env", ".", "MEDIA_ROOT", "or", "'http://'", "in", "env", ".", "MEDIA_URL", ":", "return", "local_dir", "=", "env", ".", "MEDIA_ROOT", "remote_dir", "=", "'/'", ".",...
Deploy MEDIA_ROOT unversioned on host
[ "Deploy", "MEDIA_ROOT", "unversioned", "on", "host" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L166-L184
bretth/woven
woven/project.py
deploy_db
def deploy_db(rollback=False): """ Deploy a sqlite database from development """ if not rollback: if env.DEFAULT_DATABASE_ENGINE=='django.db.backends.sqlite3': db_dir = '/'.join([deployment_root(),'database']) db_name = ''.join([env.project_name,'_','site_1','.db']) ...
python
def deploy_db(rollback=False): """ Deploy a sqlite database from development """ if not rollback: if env.DEFAULT_DATABASE_ENGINE=='django.db.backends.sqlite3': db_dir = '/'.join([deployment_root(),'database']) db_name = ''.join([env.project_name,'_','site_1','.db']) ...
[ "def", "deploy_db", "(", "rollback", "=", "False", ")", ":", "if", "not", "rollback", ":", "if", "env", ".", "DEFAULT_DATABASE_ENGINE", "==", "'django.db.backends.sqlite3'", ":", "db_dir", "=", "'/'", ".", "join", "(", "[", "deployment_root", "(", ")", ",", ...
Deploy a sqlite database from development
[ "Deploy", "a", "sqlite", "database", "from", "development" ]
train
https://github.com/bretth/woven/blob/ec1da7b401a335f43129e7115fe7a4d145649f1e/woven/project.py#L187-L233
peterldowns/djoauth2
djoauth2/access_token.py
AccessTokenAuthenticator.validate
def validate(self, request): """ Checks a request for proper authentication details. Returns a tuple of ``(access_token, error_response_arguments)``, which are designed to be passed to the :py:meth:`make_error_response` method. For example, to restrict access to a given endpoint: .. code-block:: ...
python
def validate(self, request): """ Checks a request for proper authentication details. Returns a tuple of ``(access_token, error_response_arguments)``, which are designed to be passed to the :py:meth:`make_error_response` method. For example, to restrict access to a given endpoint: .. code-block:: ...
[ "def", "validate", "(", "self", ",", "request", ")", ":", "# Ensure that all of the scopes that are being checked against exist.", "# Otherwise, raise a ValueError.", "for", "name", "in", "self", ".", "required_scope_names", ":", "if", "not", "Scope", ".", "objects", ".",...
Checks a request for proper authentication details. Returns a tuple of ``(access_token, error_response_arguments)``, which are designed to be passed to the :py:meth:`make_error_response` method. For example, to restrict access to a given endpoint: .. code-block:: python def foo_bar_resource(...
[ "Checks", "a", "request", "for", "proper", "authentication", "details", "." ]
train
https://github.com/peterldowns/djoauth2/blob/151c7619d1d7a91d720397cfecf3a29fcc9747a9/djoauth2/access_token.py#L26-L123
peterldowns/djoauth2
djoauth2/access_token.py
AccessTokenAuthenticator.make_error_response
def make_error_response(self, validation_error, expose_errors): """ Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with er...
python
def make_error_response(self, validation_error, expose_errors): """ Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with er...
[ "def", "make_error_response", "(", "self", ",", "validation_error", ",", "expose_errors", ")", ":", "authenticate_header", "=", "[", "'Bearer realm=\"{}\"'", ".", "format", "(", "settings", ".", "DJOAUTH2_REALM", ")", "]", "if", "not", "expose_errors", ":", "respo...
Return an appropriate ``HttpResponse`` on authentication failure. In case of an error, the specification only details the inclusion of the ``WWW-Authenticate`` header. Additionally, when allowed by the specification, we respond with error details formatted in JSON in the body of the response. For more ...
[ "Return", "an", "appropriate", "HttpResponse", "on", "authentication", "failure", "." ]
train
https://github.com/peterldowns/djoauth2/blob/151c7619d1d7a91d720397cfecf3a29fcc9747a9/djoauth2/access_token.py#L126-L174
limodou/par
par/_compat.py
import_
def import_(module, objects=None, via=None): """ :param module: py3 compatiable module path :param objects: objects want to imported, it should be a list :param via: for some py2 module, you should give the import path according the objects which you want to imported :return: object or modul...
python
def import_(module, objects=None, via=None): """ :param module: py3 compatiable module path :param objects: objects want to imported, it should be a list :param via: for some py2 module, you should give the import path according the objects which you want to imported :return: object or modul...
[ "def", "import_", "(", "module", ",", "objects", "=", "None", ",", "via", "=", "None", ")", ":", "if", "PY3", ":", "mod", "=", "__import__", "(", "module", ",", "fromlist", "=", "[", "'*'", "]", ")", "else", ":", "path", "=", "modules_mapping", "."...
:param module: py3 compatiable module path :param objects: objects want to imported, it should be a list :param via: for some py2 module, you should give the import path according the objects which you want to imported :return: object or module
[ ":", "param", "module", ":", "py3", "compatiable", "module", "path", ":", "param", "objects", ":", "objects", "want", "to", "imported", "it", "should", "be", "a", "list", ":", "param", "via", ":", "for", "some", "py2", "module", "you", "should", "give", ...
train
https://github.com/limodou/par/blob/0863c339c8d0d46f8516eb4577b459b9cf2dec8d/par/_compat.py#L246-L277
rjw57/starman
starman/rts.py
rts_smooth
def rts_smooth(kalman_filter, state_count=None): """ Compute the Rauch-Tung-Striebel smoothed state estimates and estimate covariances for a Kalman filter. Args: kalman_filter (KalmanFilter): Filter whose smoothed states should be returned state_count (int or None): Number o...
python
def rts_smooth(kalman_filter, state_count=None): """ Compute the Rauch-Tung-Striebel smoothed state estimates and estimate covariances for a Kalman filter. Args: kalman_filter (KalmanFilter): Filter whose smoothed states should be returned state_count (int or None): Number o...
[ "def", "rts_smooth", "(", "kalman_filter", ",", "state_count", "=", "None", ")", ":", "if", "state_count", "is", "None", ":", "state_count", "=", "kalman_filter", ".", "state_count", "state_count", "=", "int", "(", "state_count", ")", "if", "state_count", "<",...
Compute the Rauch-Tung-Striebel smoothed state estimates and estimate covariances for a Kalman filter. Args: kalman_filter (KalmanFilter): Filter whose smoothed states should be returned state_count (int or None): Number of smoothed states to return. If None, use ``kalma...
[ "Compute", "the", "Rauch", "-", "Tung", "-", "Striebel", "smoothed", "state", "estimates", "and", "estimate", "covariances", "for", "a", "Kalman", "filter", "." ]
train
https://github.com/rjw57/starman/blob/1f9475e2354c9630a61f4898ad871de1d2fdbc71/starman/rts.py#L12-L61
idlesign/envbox
envbox/base.py
get_environment
def get_environment(default=DEVELOPMENT, detectors=None, detectors_opts=None, use_envfiles=True): """Returns current environment type object. :param str|Environment|None default: Default environment type or alias. :param list[Detector] detectors: List of environment detectors to be used in chain. ...
python
def get_environment(default=DEVELOPMENT, detectors=None, detectors_opts=None, use_envfiles=True): """Returns current environment type object. :param str|Environment|None default: Default environment type or alias. :param list[Detector] detectors: List of environment detectors to be used in chain. ...
[ "def", "get_environment", "(", "default", "=", "DEVELOPMENT", ",", "detectors", "=", "None", ",", "detectors_opts", "=", "None", ",", "use_envfiles", "=", "True", ")", ":", "detectors_opts", "=", "detectors_opts", "or", "{", "}", "if", "detectors", "is", "No...
Returns current environment type object. :param str|Environment|None default: Default environment type or alias. :param list[Detector] detectors: List of environment detectors to be used in chain. If not set, default builtin chain is used. :param dict detectors_opts: Detectors options dictionary....
[ "Returns", "current", "environment", "type", "object", "." ]
train
https://github.com/idlesign/envbox/blob/4d10cc007e1bc6acf924413c4c16c3b5960d460a/envbox/base.py#L9-L50
idlesign/envbox
envbox/base.py
import_by_environment
def import_by_environment(environment=None, module_name_pattern='settings_%s', silent=False): """Automatically imports symbols of a submodule of a package for given (or detected) environment into globals of an entry-point submodule. Example:: - project --- __init__.py --- settings....
python
def import_by_environment(environment=None, module_name_pattern='settings_%s', silent=False): """Automatically imports symbols of a submodule of a package for given (or detected) environment into globals of an entry-point submodule. Example:: - project --- __init__.py --- settings....
[ "def", "import_by_environment", "(", "environment", "=", "None", ",", "module_name_pattern", "=", "'settings_%s'", ",", "silent", "=", "False", ")", ":", "environment", "=", "environment", "or", "get_environment", "(", ")", "module_name_pattern", "=", "'.'", "+", ...
Automatically imports symbols of a submodule of a package for given (or detected) environment into globals of an entry-point submodule. Example:: - project --- __init__.py --- settings.py --- settings_development.py * Here ``project`` is a package available for import (not...
[ "Automatically", "imports", "symbols", "of", "a", "submodule", "of", "a", "package", "for", "given", "(", "or", "detected", ")", "environment", "into", "globals", "of", "an", "entry", "-", "point", "submodule", "." ]
train
https://github.com/idlesign/envbox/blob/4d10cc007e1bc6acf924413c4c16c3b5960d460a/envbox/base.py#L53-L104
jhermann/rudiments
src/rudiments/pysupport.py
import_name
def import_name(modulename, name=None): """ Import identifier ``name`` from module ``modulename``. If ``name`` is omitted, ``modulename`` must contain the name after the module path, delimited by a colon. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``...
python
def import_name(modulename, name=None): """ Import identifier ``name`` from module ``modulename``. If ``name`` is omitted, ``modulename`` must contain the name after the module path, delimited by a colon. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``...
[ "def", "import_name", "(", "modulename", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "modulename", ",", "name", "=", "modulename", ".", "rsplit", "(", "':'", ",", "1", ")", "module", "=", "__import__", "(", "modulename", ",", ...
Import identifier ``name`` from module ``modulename``. If ``name`` is omitted, ``modulename`` must contain the name after the module path, delimited by a colon. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``. name (str): Name to import from ``...
[ "Import", "identifier", "name", "from", "module", "modulename", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/pysupport.py#L25-L41
jhermann/rudiments
src/rudiments/pysupport.py
load_module
def load_module(modulename, modulepath): """ Load a Python module from a path under a specified name. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``. modulepath (str): Filename of the module. Returns: Loaded module. """ if '.' ...
python
def load_module(modulename, modulepath): """ Load a Python module from a path under a specified name. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``. modulepath (str): Filename of the module. Returns: Loaded module. """ if '.' ...
[ "def", "load_module", "(", "modulename", ",", "modulepath", ")", ":", "if", "'.'", "in", "modulename", ":", "modulepackage", ",", "modulebase", "=", "modulename", ".", "rsplit", "(", "'.'", ",", "1", ")", "else", ":", "modulepackage", "=", "''", "imp", "...
Load a Python module from a path under a specified name. Parameters: modulename (str): Fully qualified module name, e.g. ``x.y.z``. modulepath (str): Filename of the module. Returns: Loaded module.
[ "Load", "a", "Python", "module", "from", "a", "path", "under", "a", "specified", "name", "." ]
train
https://github.com/jhermann/rudiments/blob/028ec7237946115c7b18e50557cbc5f6b824653e/src/rudiments/pysupport.py#L44-L79
Carbonara-Project/Guanciale
guanciale/matching.py
ProcedureHandler.handleFlow
def handleFlow(self): #TODO replace sorting loops with sorted function self.targets = {} self.api = [] #flow = [] addrs = [] internals = [] for instr in self.bb_insns: if isinstance(instr, CallInsn): ...
python
def handleFlow(self): #TODO replace sorting loops with sorted function self.targets = {} self.api = [] #flow = [] addrs = [] internals = [] for instr in self.bb_insns: if isinstance(instr, CallInsn): ...
[ "def", "handleFlow", "(", "self", ")", ":", "#TODO replace sorting loops with sorted function\r", "self", ".", "targets", "=", "{", "}", "self", ".", "api", "=", "[", "]", "#flow = []\r", "addrs", "=", "[", "]", "internals", "=", "[", "]", "for", "instr", ...
for f in flow: print f for pp in self.bb_insns: print pp
[ "for", "f", "in", "flow", ":", "print", "f", "for", "pp", "in", "self", ".", "bb_insns", ":", "print", "pp" ]
train
https://github.com/Carbonara-Project/Guanciale/blob/c239ffac6fb481d09c4071d1de1a09f60dc584ab/guanciale/matching.py#L258-L328
oasiswork/django-humanize
django_humanize/templatetags/humanizelib.py
init
def init(): """ Initialize the lib Function-design use is to be able to test language settings changes """ if settings.USE_L10N: locale = settings.LANGUAGE_CODE.replace('-', '_') try: humanize.i18n.activate(locale) except FileNotFoundError: pass # Just ...
python
def init(): """ Initialize the lib Function-design use is to be able to test language settings changes """ if settings.USE_L10N: locale = settings.LANGUAGE_CODE.replace('-', '_') try: humanize.i18n.activate(locale) except FileNotFoundError: pass # Just ...
[ "def", "init", "(", ")", ":", "if", "settings", ".", "USE_L10N", ":", "locale", "=", "settings", ".", "LANGUAGE_CODE", ".", "replace", "(", "'-'", ",", "'_'", ")", "try", ":", "humanize", ".", "i18n", ".", "activate", "(", "locale", ")", "except", "F...
Initialize the lib Function-design use is to be able to test language settings changes
[ "Initialize", "the", "lib" ]
train
https://github.com/oasiswork/django-humanize/blob/4065485113a076ba1c29e813009fd4ca9767fec4/django_humanize/templatetags/humanizelib.py#L15-L44
jf-parent/brome
brome/runner/base_runner.py
BaseRunner.kill_pid
def kill_pid(self, pid): """Kill process by pid Args: pid (int) """ try: p = psutil.Process(pid) p.terminate() self.info_log('Killed [pid:%s][name:%s]' % (p.pid, p.name())) except psutil.NoSuchProcess: self.error_log...
python
def kill_pid(self, pid): """Kill process by pid Args: pid (int) """ try: p = psutil.Process(pid) p.terminate() self.info_log('Killed [pid:%s][name:%s]' % (p.pid, p.name())) except psutil.NoSuchProcess: self.error_log...
[ "def", "kill_pid", "(", "self", ",", "pid", ")", ":", "try", ":", "p", "=", "psutil", ".", "Process", "(", "pid", ")", "p", ".", "terminate", "(", ")", "self", ".", "info_log", "(", "'Killed [pid:%s][name:%s]'", "%", "(", "p", ".", "pid", ",", "p",...
Kill process by pid Args: pid (int)
[ "Kill", "process", "by", "pid" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/runner/base_runner.py#L117-L131
jf-parent/brome
brome/runner/base_runner.py
BaseRunner.kill
def kill(self, procname): """Kill by process name Args: procname (str) """ for proc in psutil.process_iter(): if proc.name() == procname: self.info_log( '[pid:%s][name:%s] killed' % (proc.pid, proc.name()) ...
python
def kill(self, procname): """Kill by process name Args: procname (str) """ for proc in psutil.process_iter(): if proc.name() == procname: self.info_log( '[pid:%s][name:%s] killed' % (proc.pid, proc.name()) ...
[ "def", "kill", "(", "self", ",", "procname", ")", ":", "for", "proc", "in", "psutil", ".", "process_iter", "(", ")", ":", "if", "proc", ".", "name", "(", ")", "==", "procname", ":", "self", ".", "info_log", "(", "'[pid:%s][name:%s] killed'", "%", "(", ...
Kill by process name Args: procname (str)
[ "Kill", "by", "process", "name" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/runner/base_runner.py#L133-L145
jf-parent/brome
brome/runner/base_runner.py
BaseRunner.configure_logger
def configure_logger(self): """Configure the test batch runner logger """ logger_name = 'brome_runner' self.logger = logging.getLogger(logger_name) format_ = BROME_CONFIG['logger_runner']['format'] # Stream logger if BROME_CONFIG['logger_runner']['streamlogger...
python
def configure_logger(self): """Configure the test batch runner logger """ logger_name = 'brome_runner' self.logger = logging.getLogger(logger_name) format_ = BROME_CONFIG['logger_runner']['format'] # Stream logger if BROME_CONFIG['logger_runner']['streamlogger...
[ "def", "configure_logger", "(", "self", ")", ":", "logger_name", "=", "'brome_runner'", "self", ".", "logger", "=", "logging", ".", "getLogger", "(", "logger_name", ")", "format_", "=", "BROME_CONFIG", "[", "'logger_runner'", "]", "[", "'format'", "]", "# Stre...
Configure the test batch runner logger
[ "Configure", "the", "test", "batch", "runner", "logger" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/runner/base_runner.py#L240-L282
PMBio/limix-backup
limix/utils/util_functions.py
smartAppend
def smartAppend(table,name,value): """ helper function for apppending in a dictionary """ if name not in list(table.keys()): table[name] = [] table[name].append(value)
python
def smartAppend(table,name,value): """ helper function for apppending in a dictionary """ if name not in list(table.keys()): table[name] = [] table[name].append(value)
[ "def", "smartAppend", "(", "table", ",", "name", ",", "value", ")", ":", "if", "name", "not", "in", "list", "(", "table", ".", "keys", "(", ")", ")", ":", "table", "[", "name", "]", "=", "[", "]", "table", "[", "name", "]", ".", "append", "(", ...
helper function for apppending in a dictionary
[ "helper", "function", "for", "apppending", "in", "a", "dictionary" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/utils/util_functions.py#L15-L21
PMBio/limix-backup
limix/utils/util_functions.py
smartSum
def smartSum(x,key,value): """ create a new page in x if key is not a page of x otherwise add value to x[key] """ if key not in list(x.keys()): x[key] = value else: x[key]+=value
python
def smartSum(x,key,value): """ create a new page in x if key is not a page of x otherwise add value to x[key] """ if key not in list(x.keys()): x[key] = value else: x[key]+=value
[ "def", "smartSum", "(", "x", ",", "key", ",", "value", ")", ":", "if", "key", "not", "in", "list", "(", "x", ".", "keys", "(", ")", ")", ":", "x", "[", "key", "]", "=", "value", "else", ":", "x", "[", "key", "]", "+=", "value" ]
create a new page in x if key is not a page of x otherwise add value to x[key]
[ "create", "a", "new", "page", "in", "x", "if", "key", "is", "not", "a", "page", "of", "x", "otherwise", "add", "value", "to", "x", "[", "key", "]" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/utils/util_functions.py#L23-L28
PMBio/limix-backup
limix/utils/util_functions.py
dumpDictHdf5
def dumpDictHdf5(RV,o): """ Dump a dictionary where each page is a list or an array """ for key in list(RV.keys()): o.create_dataset(name=key,data=SP.array(RV[key]),chunks=True,compression='gzip')
python
def dumpDictHdf5(RV,o): """ Dump a dictionary where each page is a list or an array """ for key in list(RV.keys()): o.create_dataset(name=key,data=SP.array(RV[key]),chunks=True,compression='gzip')
[ "def", "dumpDictHdf5", "(", "RV", ",", "o", ")", ":", "for", "key", "in", "list", "(", "RV", ".", "keys", "(", ")", ")", ":", "o", ".", "create_dataset", "(", "name", "=", "key", ",", "data", "=", "SP", ".", "array", "(", "RV", "[", "key", "]...
Dump a dictionary where each page is a list or an array
[ "Dump", "a", "dictionary", "where", "each", "page", "is", "a", "list", "or", "an", "array" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/utils/util_functions.py#L30-L33
PMBio/limix-backup
limix/utils/util_functions.py
smartDumpDictHdf5
def smartDumpDictHdf5(RV,o): """ Dump a dictionary where each page is a list or an array or still a dictionary (in this case, it iterates)""" for key in list(RV.keys()): if type(RV[key])==dict: g = o.create_group(key) smartDumpDictHdf5(RV[key],g) else: o.creat...
python
def smartDumpDictHdf5(RV,o): """ Dump a dictionary where each page is a list or an array or still a dictionary (in this case, it iterates)""" for key in list(RV.keys()): if type(RV[key])==dict: g = o.create_group(key) smartDumpDictHdf5(RV[key],g) else: o.creat...
[ "def", "smartDumpDictHdf5", "(", "RV", ",", "o", ")", ":", "for", "key", "in", "list", "(", "RV", ".", "keys", "(", ")", ")", ":", "if", "type", "(", "RV", "[", "key", "]", ")", "==", "dict", ":", "g", "=", "o", ".", "create_group", "(", "key...
Dump a dictionary where each page is a list or an array or still a dictionary (in this case, it iterates)
[ "Dump", "a", "dictionary", "where", "each", "page", "is", "a", "list", "or", "an", "array", "or", "still", "a", "dictionary", "(", "in", "this", "case", "it", "iterates", ")" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/utils/util_functions.py#L35-L42
thomasleese/mo
mo/mofile.py
load
def load(filename: str, format: str = None): """Load a task file and get a ``Project`` back.""" path = Path(filename).resolve() with path.open() as file: data = file.read() if format is None: loader, error_class = _load_autodetect, InvalidMofileFormat else: try: ...
python
def load(filename: str, format: str = None): """Load a task file and get a ``Project`` back.""" path = Path(filename).resolve() with path.open() as file: data = file.read() if format is None: loader, error_class = _load_autodetect, InvalidMofileFormat else: try: ...
[ "def", "load", "(", "filename", ":", "str", ",", "format", ":", "str", "=", "None", ")", ":", "path", "=", "Path", "(", "filename", ")", ".", "resolve", "(", ")", "with", "path", ".", "open", "(", ")", "as", "file", ":", "data", "=", "file", "....
Load a task file and get a ``Project`` back.
[ "Load", "a", "task", "file", "and", "get", "a", "Project", "back", "." ]
train
https://github.com/thomasleese/mo/blob/b757f52b42e51ad19c14724ceb7c5db5d52abaea/mo/mofile.py#L33-L54
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
year_origin_filter
def year_origin_filter(year_predicate=None, origin_predicate=None): """\ Returns a predicate for cable identifiers where `year_predicate` and `origin_predicate` must hold true. If `year_predicate` and `origin_predicate` is ``None`` the returned predicate holds always true. `year_predicate` ...
python
def year_origin_filter(year_predicate=None, origin_predicate=None): """\ Returns a predicate for cable identifiers where `year_predicate` and `origin_predicate` must hold true. If `year_predicate` and `origin_predicate` is ``None`` the returned predicate holds always true. `year_predicate` ...
[ "def", "year_origin_filter", "(", "year_predicate", "=", "None", ",", "origin_predicate", "=", "None", ")", ":", "def", "accept", "(", "cable_id", ",", "predicate", ")", ":", "year", ",", "origin", "=", "_YEAR_ORIGIN_PATTERN", ".", "match", "(", "canonicalize_...
\ Returns a predicate for cable identifiers where `year_predicate` and `origin_predicate` must hold true. If `year_predicate` and `origin_predicate` is ``None`` the returned predicate holds always true. `year_predicate` A predicate which returns ``True`` or ``False`` for a cable y...
[ "\\", "Returns", "a", "predicate", "for", "cable", "identifiers", "where", "year_predicate", "and", "origin_predicate", "must", "hold", "true", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L23-L52
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_europe
def origin_europe(origin): """\ Returns if the origin is located in Europe. This holds true for the following countries: * Albania * Armenia * Austria * Azerbaijan * Belarus * Belgium * Bulgaria * Bosnia and Herzegovina * Bulgaria ...
python
def origin_europe(origin): """\ Returns if the origin is located in Europe. This holds true for the following countries: * Albania * Armenia * Austria * Azerbaijan * Belarus * Belgium * Bulgaria * Bosnia and Herzegovina * Bulgaria ...
[ "def", "origin_europe", "(", "origin", ")", ":", "return", "origin_albania", "(", "origin", ")", "or", "origin_armenia", "(", "origin", ")", "or", "origin_austria", "(", "origin", ")", "or", "origin_azerbaijan", "(", "origin", ")", "or", "origin_belarus", "(",...
\ Returns if the origin is located in Europe. This holds true for the following countries: * Albania * Armenia * Austria * Azerbaijan * Belarus * Belgium * Bulgaria * Bosnia and Herzegovina * Bulgaria * Croatia * Cyprus ...
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "Europe", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L77-L158
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_north_africa
def origin_north_africa(origin): """\ Returns if the origin is located in North Africa. Holds true for the following countries: * Algeria * Egypt * Libya * Morocco * Sudan * Tunisia `origin` The origin to check. """ return origin_egypt(or...
python
def origin_north_africa(origin): """\ Returns if the origin is located in North Africa. Holds true for the following countries: * Algeria * Egypt * Libya * Morocco * Sudan * Tunisia `origin` The origin to check. """ return origin_egypt(or...
[ "def", "origin_north_africa", "(", "origin", ")", ":", "return", "origin_egypt", "(", "origin", ")", "or", "origin_algeria", "(", "origin", ")", "or", "origin_libya", "(", "origin", ")", "or", "origin_morocco", "(", "origin", ")", "or", "origin_sudan", "(", ...
\ Returns if the origin is located in North Africa. Holds true for the following countries: * Algeria * Egypt * Libya * Morocco * Sudan * Tunisia `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "North", "Africa", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L161-L178
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_west_africa
def origin_west_africa(origin): """\ Returns if the origin is located in West Africa. Holds true for the following countries: * Benin * Burkin Faso * Cape Verde * Côte d'Ivoire * Gambia * Ghana * Guinea * Liberia * Mali * Mauri...
python
def origin_west_africa(origin): """\ Returns if the origin is located in West Africa. Holds true for the following countries: * Benin * Burkin Faso * Cape Verde * Côte d'Ivoire * Gambia * Ghana * Guinea * Liberia * Mali * Mauri...
[ "def", "origin_west_africa", "(", "origin", ")", ":", "return", "origin_benin", "(", "origin", ")", "or", "origin_burkina_faso", "(", "origin", ")", "or", "origin_cape_verde", "(", "origin", ")", "or", "origin_cote_divoire", "(", "origin", ")", "or", "origin_gam...
\ Returns if the origin is located in West Africa. Holds true for the following countries: * Benin * Burkin Faso * Cape Verde * Côte d'Ivoire * Gambia * Ghana * Guinea * Liberia * Mali * Mauritania * Niger * Nigeria...
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "West", "Africa", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L181-L212
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_central_asia
def origin_central_asia(origin): """\ Returns if the origin is located in Central Asia. Holds true for the following countries: * Afghanistan * Kazakhstan * Kyrgyzstan * Tajikistan * Turkmenistan * Uzbekistan `origin` The origin to check. """...
python
def origin_central_asia(origin): """\ Returns if the origin is located in Central Asia. Holds true for the following countries: * Afghanistan * Kazakhstan * Kyrgyzstan * Tajikistan * Turkmenistan * Uzbekistan `origin` The origin to check. """...
[ "def", "origin_central_asia", "(", "origin", ")", ":", "return", "origin_afghanistan", "(", "origin", ")", "or", "origin_kazakhstan", "(", "origin", ")", "or", "origin_kyrgyzstan", "(", "origin", ")", "or", "origin_tajikistan", "(", "origin", ")", "or", "origin_...
\ Returns if the origin is located in Central Asia. Holds true for the following countries: * Afghanistan * Kazakhstan * Kyrgyzstan * Tajikistan * Turkmenistan * Uzbekistan `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "Central", "Asia", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L215-L232
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_east_asia
def origin_east_asia(origin): """\ Returns if the origin is located in East Asia Holds true for the following countries: * China * Japan * Mongolia * South Korea * Taiwan `origin` The origin to check. """ return origin_china(origin) or origin_jap...
python
def origin_east_asia(origin): """\ Returns if the origin is located in East Asia Holds true for the following countries: * China * Japan * Mongolia * South Korea * Taiwan `origin` The origin to check. """ return origin_china(origin) or origin_jap...
[ "def", "origin_east_asia", "(", "origin", ")", ":", "return", "origin_china", "(", "origin", ")", "or", "origin_japan", "(", "origin", ")", "or", "origin_mongolia", "(", "origin", ")", "or", "origin_south_korea", "(", "origin", ")", "or", "origin_taiwan", "(",...
\ Returns if the origin is located in East Asia Holds true for the following countries: * China * Japan * Mongolia * South Korea * Taiwan `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "East", "Asia" ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L235-L251
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_west_asia
def origin_west_asia(origin): """\ Returns if the origin is located in Western Asia. Holds true for the following countries: * Armenia * Azerbaijan * Bahrain * Cyprus * Georgia * Iraq * Israel * Jordan * Kuwait * Lebanon ...
python
def origin_west_asia(origin): """\ Returns if the origin is located in Western Asia. Holds true for the following countries: * Armenia * Azerbaijan * Bahrain * Cyprus * Georgia * Iraq * Israel * Jordan * Kuwait * Lebanon ...
[ "def", "origin_west_asia", "(", "origin", ")", ":", "return", "origin_armenia", "(", "origin", ")", "or", "origin_azerbaijan", "(", "origin", ")", "or", "origin_bahrain", "(", "origin", ")", "or", "origin_cyprus", "(", "origin", ")", "or", "origin_georgia", "(...
\ Returns if the origin is located in Western Asia. Holds true for the following countries: * Armenia * Azerbaijan * Bahrain * Cyprus * Georgia * Iraq * Israel * Jordan * Kuwait * Lebanon * Oman * Qatar * Sa...
[ "\\", "Returns", "if", "the", "origin", "is", "located", "in", "Western", "Asia", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L254-L288
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_canada
def origin_canada(origin): """\ Returns if the origin is Canada. `origin` The origin to check. """ return origin in ( u'CALGARY', u'HALIFAX', u'MONTREAL', u'QUEBEC', u'OTTAWA', u'TORONTO', u'VANCOUVER')
python
def origin_canada(origin): """\ Returns if the origin is Canada. `origin` The origin to check. """ return origin in ( u'CALGARY', u'HALIFAX', u'MONTREAL', u'QUEBEC', u'OTTAWA', u'TORONTO', u'VANCOUVER')
[ "def", "origin_canada", "(", "origin", ")", ":", "return", "origin", "in", "(", "u'CALGARY'", ",", "u'HALIFAX'", ",", "u'MONTREAL'", ",", "u'QUEBEC'", ",", "u'OTTAWA'", ",", "u'TORONTO'", ",", "u'VANCOUVER'", ")" ]
\ Returns if the origin is Canada. `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "Canada", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L583-L592
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_germany
def origin_germany(origin): """\ Returns if the origin is Germany. `origin` The origin to check. """ return origin in (u'BONN', u'BERLIN', u'DUSSELDORF', u'FRANKFURT', u'HAMBURG', u'LEIPZIG', u'MUNICH')
python
def origin_germany(origin): """\ Returns if the origin is Germany. `origin` The origin to check. """ return origin in (u'BONN', u'BERLIN', u'DUSSELDORF', u'FRANKFURT', u'HAMBURG', u'LEIPZIG', u'MUNICH')
[ "def", "origin_germany", "(", "origin", ")", ":", "return", "origin", "in", "(", "u'BONN'", ",", "u'BERLIN'", ",", "u'DUSSELDORF'", ",", "u'FRANKFURT'", ",", "u'HAMBURG'", ",", "u'LEIPZIG'", ",", "u'MUNICH'", ")" ]
\ Returns if the origin is Germany. `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "Germany", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L916-L924
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_iraq
def origin_iraq(origin): """\ Returns if the origin is Iraq. `origin` The origin to check. """ return origin == u'BAGHDAD' \ or u'BASRAH' in origin \ or u'HILLAH' in origin \ or u'KIRKUK' in origin \ or u'MOSUL' in origin
python
def origin_iraq(origin): """\ Returns if the origin is Iraq. `origin` The origin to check. """ return origin == u'BAGHDAD' \ or u'BASRAH' in origin \ or u'HILLAH' in origin \ or u'KIRKUK' in origin \ or u'MOSUL' in origin
[ "def", "origin_iraq", "(", "origin", ")", ":", "return", "origin", "==", "u'BAGHDAD'", "or", "u'BASRAH'", "in", "origin", "or", "u'HILLAH'", "in", "origin", "or", "u'KIRKUK'", "in", "origin", "or", "u'MOSUL'", "in", "origin" ]
\ Returns if the origin is Iraq. `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "Iraq", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L1057-L1068
heuer/cablemap
cablemap.core/cablemap/core/predicates.py
origin_mexico
def origin_mexico(origin): """\ Returns if the origin is Mexico. `origin` The origin to check. """ return origin in (u'CIUDADJUAREZ', u'GUADALAJARA', u'HERMOSILLO', u'MATAMOROS', u'MERIDA', u'MEXICO', u'MONTERREY', u'NOGALES', ...
python
def origin_mexico(origin): """\ Returns if the origin is Mexico. `origin` The origin to check. """ return origin in (u'CIUDADJUAREZ', u'GUADALAJARA', u'HERMOSILLO', u'MATAMOROS', u'MERIDA', u'MEXICO', u'MONTERREY', u'NOGALES', ...
[ "def", "origin_mexico", "(", "origin", ")", ":", "return", "origin", "in", "(", "u'CIUDADJUAREZ'", ",", "u'GUADALAJARA'", ",", "u'HERMOSILLO'", ",", "u'MATAMOROS'", ",", "u'MERIDA'", ",", "u'MEXICO'", ",", "u'MONTERREY'", ",", "u'NOGALES'", ",", "u'NUEVOLAREDO'", ...
\ Returns if the origin is Mexico. `origin` The origin to check.
[ "\\", "Returns", "if", "the", "origin", "is", "Mexico", "." ]
train
https://github.com/heuer/cablemap/blob/42066c8fc2972d237a2c35578e14525aaf705f38/cablemap.core/cablemap/core/predicates.py#L1352-L1362
thomasleese/mo
mo/runner.py
Runner.resolve_variables
def resolve_variables(self, task): """ Resolve task variables based on input variables and the default values. Raises ------ LookupError If a variable is missing. """ variables = {**task.variables, **self.project.variables} values = ...
python
def resolve_variables(self, task): """ Resolve task variables based on input variables and the default values. Raises ------ LookupError If a variable is missing. """ variables = {**task.variables, **self.project.variables} values = ...
[ "def", "resolve_variables", "(", "self", ",", "task", ")", ":", "variables", "=", "{", "*", "*", "task", ".", "variables", ",", "*", "*", "self", ".", "project", ".", "variables", "}", "values", "=", "{", "}", "for", "variable", "in", "variables", "....
Resolve task variables based on input variables and the default values. Raises ------ LookupError If a variable is missing.
[ "Resolve", "task", "variables", "based", "on", "input", "variables", "and", "the", "default", "values", "." ]
train
https://github.com/thomasleese/mo/blob/b757f52b42e51ad19c14724ceb7c5db5d52abaea/mo/runner.py#L44-L65
thomasleese/mo
mo/runner.py
Runner.run_task
def run_task(self, name): """Run a task.""" if name in self.tasks_run: yield events.skipping_task(name) else: yield events.finding_task(name) try: task = self.find_task(name) except NoSuchTaskError as e: yield even...
python
def run_task(self, name): """Run a task.""" if name in self.tasks_run: yield events.skipping_task(name) else: yield events.finding_task(name) try: task = self.find_task(name) except NoSuchTaskError as e: yield even...
[ "def", "run_task", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "tasks_run", ":", "yield", "events", ".", "skipping_task", "(", "name", ")", "else", ":", "yield", "events", ".", "finding_task", "(", "name", ")", "try", ":", "t...
Run a task.
[ "Run", "a", "task", "." ]
train
https://github.com/thomasleese/mo/blob/b757f52b42e51ad19c14724ceb7c5db5d52abaea/mo/runner.py#L85-L108
fitnr/twitter_bot_utils
twitter_bot_utils/tools.py
_autofollow
def _autofollow(api, action, dry_run): ''' Follow back or unfollow the friends/followers of user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually (un)follow, just report ''' try: # get the last 5000 followers followers = api.followers_ids() ...
python
def _autofollow(api, action, dry_run): ''' Follow back or unfollow the friends/followers of user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually (un)follow, just report ''' try: # get the last 5000 followers followers = api.followers_ids() ...
[ "def", "_autofollow", "(", "api", ",", "action", ",", "dry_run", ")", ":", "try", ":", "# get the last 5000 followers", "followers", "=", "api", ".", "followers_ids", "(", ")", "# Get the last 5000 people user has followed", "friends", "=", "api", ".", "friends_ids"...
Follow back or unfollow the friends/followers of user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually (un)follow, just report
[ "Follow", "back", "or", "unfollow", "the", "friends", "/", "followers", "of", "user", "authenicated", "in", "api", ".", ":", "api", "twitter_bot_utils", ".", "api", ".", "API", ":", "dry_run", "bool", "don", "t", "actually", "(", "un", ")", "follow", "ju...
train
https://github.com/fitnr/twitter_bot_utils/blob/21f35afa5048cd3efa54db8cb87d405f69a78a62/twitter_bot_utils/tools.py#L30-L83
fitnr/twitter_bot_utils
twitter_bot_utils/tools.py
fave_mentions
def fave_mentions(api, dry_run=None): ''' Fave (aka like) recent mentions from user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually favorite, just report ''' f = api.favorites(include_entities=False, count=150) favs = [m.id_str for m in f] try: ...
python
def fave_mentions(api, dry_run=None): ''' Fave (aka like) recent mentions from user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually favorite, just report ''' f = api.favorites(include_entities=False, count=150) favs = [m.id_str for m in f] try: ...
[ "def", "fave_mentions", "(", "api", ",", "dry_run", "=", "None", ")", ":", "f", "=", "api", ".", "favorites", "(", "include_entities", "=", "False", ",", "count", "=", "150", ")", "favs", "=", "[", "m", ".", "id_str", "for", "m", "in", "f", "]", ...
Fave (aka like) recent mentions from user authenicated in 'api'. :api twitter_bot_utils.api.API :dry_run bool don't actually favorite, just report
[ "Fave", "(", "aka", "like", ")", "recent", "mentions", "from", "user", "authenicated", "in", "api", ".", ":", "api", "twitter_bot_utils", ".", "api", ".", "API", ":", "dry_run", "bool", "don", "t", "actually", "favorite", "just", "report" ]
train
https://github.com/fitnr/twitter_bot_utils/blob/21f35afa5048cd3efa54db8cb87d405f69a78a62/twitter_bot_utils/tools.py#L86-L116
PMBio/limix-backup
limix/deprecated/utils/plot.py
plot_manhattan
def plot_manhattan(posCum,pv,chromBounds=None, thr=None,qv=None,lim=None,xticklabels=True, alphaNS=0.1,alphaS=0.5,colorNS='DarkBlue',colorS='Orange',plt=None,thr_plotting=None,labelS=None,labelNS=None): """ This script makes a manhattan plot ------------------------------------------- posCum cumulative ...
python
def plot_manhattan(posCum,pv,chromBounds=None, thr=None,qv=None,lim=None,xticklabels=True, alphaNS=0.1,alphaS=0.5,colorNS='DarkBlue',colorS='Orange',plt=None,thr_plotting=None,labelS=None,labelNS=None): """ This script makes a manhattan plot ------------------------------------------- posCum cumulative ...
[ "def", "plot_manhattan", "(", "posCum", ",", "pv", ",", "chromBounds", "=", "None", ",", "thr", "=", "None", ",", "qv", "=", "None", ",", "lim", "=", "None", ",", "xticklabels", "=", "True", ",", "alphaNS", "=", "0.1", ",", "alphaS", "=", "0.5", ",...
This script makes a manhattan plot ------------------------------------------- posCum cumulative position pv pvalues chromBounds chrom boundaries (optionally). If not supplied, everything will be plotted into a single chromosome qv qvalues if provided, threshold for significance is set on qvalues but...
[ "This", "script", "makes", "a", "manhattan", "plot", "-------------------------------------------", "posCum", "cumulative", "position", "pv", "pvalues", "chromBounds", "chrom", "boundaries", "(", "optionally", ")", ".", "If", "not", "supplied", "everything", "will", "...
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/utils/plot.py#L27-L111
PMBio/limix-backup
limix/deprecated/utils/plot.py
_qqplot_bar
def _qqplot_bar(M=1000000, alphaLevel = 0.05, distr = 'log10'): """calculate theoretical expectations for qqplot""" mRange=10**(sp.arange(sp.log10(0.5),sp.log10(M-0.5)+0.1,0.1));#should be exp or 10**? numPts=len(mRange); betaalphaLevel=sp.zeros(numPts);#down in the plot betaOneMinusalphaLevel=sp.zeros(numPts);#up...
python
def _qqplot_bar(M=1000000, alphaLevel = 0.05, distr = 'log10'): """calculate theoretical expectations for qqplot""" mRange=10**(sp.arange(sp.log10(0.5),sp.log10(M-0.5)+0.1,0.1));#should be exp or 10**? numPts=len(mRange); betaalphaLevel=sp.zeros(numPts);#down in the plot betaOneMinusalphaLevel=sp.zeros(numPts);#up...
[ "def", "_qqplot_bar", "(", "M", "=", "1000000", ",", "alphaLevel", "=", "0.05", ",", "distr", "=", "'log10'", ")", ":", "mRange", "=", "10", "**", "(", "sp", ".", "arange", "(", "sp", ".", "log10", "(", "0.5", ")", ",", "sp", ".", "log10", "(", ...
calculate theoretical expectations for qqplot
[ "calculate", "theoretical", "expectations", "for", "qqplot" ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/utils/plot.py#L114-L130
PMBio/limix-backup
limix/deprecated/utils/plot.py
qqplot
def qqplot(pv, distr = 'log10', alphaLevel = 0.05): """ This script makes a Quantile-Quantile plot of the observed negative log P-value distribution against the theoretical one under the null. Input: pv pvalues (numpy array) distr scale of the distribution (log10 or chi2) alphaLevel signifi...
python
def qqplot(pv, distr = 'log10', alphaLevel = 0.05): """ This script makes a Quantile-Quantile plot of the observed negative log P-value distribution against the theoretical one under the null. Input: pv pvalues (numpy array) distr scale of the distribution (log10 or chi2) alphaLevel signifi...
[ "def", "qqplot", "(", "pv", ",", "distr", "=", "'log10'", ",", "alphaLevel", "=", "0.05", ")", ":", "shape_ok", "=", "(", "len", "(", "pv", ".", "shape", ")", "==", "1", ")", "or", "(", "(", "len", "(", "pv", ".", "shape", ")", "==", "2", ")"...
This script makes a Quantile-Quantile plot of the observed negative log P-value distribution against the theoretical one under the null. Input: pv pvalues (numpy array) distr scale of the distribution (log10 or chi2) alphaLevel significance bounds
[ "This", "script", "makes", "a", "Quantile", "-", "Quantile", "plot", "of", "the", "observed", "negative", "log", "P", "-", "value", "distribution", "against", "the", "theoretical", "one", "under", "the", "null", "." ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/utils/plot.py#L133-L177
PMBio/limix-backup
limix/deprecated/utils/plot.py
plot_normal
def plot_normal(x=None, mean_x=None,std_x=None,color='red',linewidth=2,alpha=1,bins=20,xlim=False,plot_mean=True,plot_std=False,plot_2std=True,figure=None,annotate=True,histogram=True): """ plot a fit of a normal distribution to the data in x. """ import pylab if figure is None: figure=pylab...
python
def plot_normal(x=None, mean_x=None,std_x=None,color='red',linewidth=2,alpha=1,bins=20,xlim=False,plot_mean=True,plot_std=False,plot_2std=True,figure=None,annotate=True,histogram=True): """ plot a fit of a normal distribution to the data in x. """ import pylab if figure is None: figure=pylab...
[ "def", "plot_normal", "(", "x", "=", "None", ",", "mean_x", "=", "None", ",", "std_x", "=", "None", ",", "color", "=", "'red'", ",", "linewidth", "=", "2", ",", "alpha", "=", "1", ",", "bins", "=", "20", ",", "xlim", "=", "False", ",", "plot_mean...
plot a fit of a normal distribution to the data in x.
[ "plot", "a", "fit", "of", "a", "normal", "distribution", "to", "the", "data", "in", "x", "." ]
train
https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/deprecated/utils/plot.py#L180-L225
xolox/python-naturalsort
natsort/__init__.py
natsort
def natsort(l, key=None, reverse=False): """ Sort the given list in the way that humans expect (using natural order sorting). :param l: An iterable of strings to sort. :param key: An optional sort key similar to the one accepted by Python's built in :func:`sorted()` function. Expected t...
python
def natsort(l, key=None, reverse=False): """ Sort the given list in the way that humans expect (using natural order sorting). :param l: An iterable of strings to sort. :param key: An optional sort key similar to the one accepted by Python's built in :func:`sorted()` function. Expected t...
[ "def", "natsort", "(", "l", ",", "key", "=", "None", ",", "reverse", "=", "False", ")", ":", "return", "sorted", "(", "l", ",", "key", "=", "lambda", "v", ":", "NaturalOrderKey", "(", "key", "and", "key", "(", "v", ")", "or", "v", ")", ",", "re...
Sort the given list in the way that humans expect (using natural order sorting). :param l: An iterable of strings to sort. :param key: An optional sort key similar to the one accepted by Python's built in :func:`sorted()` function. Expected to produce strings. :param reverse...
[ "Sort", "the", "given", "list", "in", "the", "way", "that", "humans", "expect", "(", "using", "natural", "order", "sorting", ")", "." ]
train
https://github.com/xolox/python-naturalsort/blob/721c9c892029b2d04d482adfc66088bcc7526ce8/natsort/__init__.py#L22-L33
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.is_present
def is_present(self, selector): """Check if an element is present in the dom or not This method won't check if the element is displayed or not This method won't wait until the element is visible or present This method won't raise any exception if the element is not present Retu...
python
def is_present(self, selector): """Check if an element is present in the dom or not This method won't check if the element is displayed or not This method won't wait until the element is visible or present This method won't raise any exception if the element is not present Retu...
[ "def", "is_present", "(", "self", ",", "selector", ")", ":", "self", ".", "debug_log", "(", "\"Is present (%s)\"", "%", "selector", ")", "element", "=", "self", ".", "find", "(", "selector", ",", "raise_exception", "=", "False", ",", "wait_until_present", "=...
Check if an element is present in the dom or not This method won't check if the element is displayed or not This method won't wait until the element is visible or present This method won't raise any exception if the element is not present Returns: bool: True if the element ...
[ "Check", "if", "an", "element", "is", "present", "in", "the", "dom", "or", "not" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L78-L101
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.is_visible
def is_visible(self, selector): """Check if an element is visible in the dom or not This method will check if the element is displayed or not This method might (according to the config highlight:element_is_visible) highlight the element if it is visible This method won...
python
def is_visible(self, selector): """Check if an element is visible in the dom or not This method will check if the element is displayed or not This method might (according to the config highlight:element_is_visible) highlight the element if it is visible This method won...
[ "def", "is_visible", "(", "self", ",", "selector", ")", ":", "self", ".", "debug_log", "(", "\"Is visible (%s)\"", "%", "selector", ")", "element", "=", "self", ".", "find", "(", "selector", ",", "raise_exception", "=", "False", ",", "wait_until_present", "=...
Check if an element is visible in the dom or not This method will check if the element is displayed or not This method might (according to the config highlight:element_is_visible) highlight the element if it is visible This method won't wait until the element is visible or pre...
[ "Check", "if", "an", "element", "is", "visible", "in", "the", "dom", "or", "not" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L103-L141
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.find
def find(self, selector, **kwargs): """Find an element with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Returns: No...
python
def find(self, selector, **kwargs): """Find an element with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Returns: No...
[ "def", "find", "(", "self", ",", "selector", ",", "*", "*", "kwargs", ")", ":", "self", ".", "debug_log", "(", "\"Finding element with selector: %s\"", "%", "selector", ")", "elements", "=", "self", ".", "find_all", "(", "selector", ",", "*", "*", "kwargs"...
Find an element with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Returns: None if no element was found proxy_el...
[ "Find", "an", "element", "with", "a", "selector" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L144-L174
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.find_last
def find_last(self, selector, **kwargs): """Return the last element found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Retu...
python
def find_last(self, selector, **kwargs): """Return the last element found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Retu...
[ "def", "find_last", "(", "self", ",", "selector", ",", "*", "*", "kwargs", ")", ":", "self", ".", "debug_log", "(", "\"Finding last element with selector: %s\"", "%", "selector", ")", "elements", "=", "self", ".", "find_all", "(", "selector", ",", "*", "*", ...
Return the last element found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) wait_until_visible (bool) raise_exception (bool) Returns: None if no element was found ...
[ "Return", "the", "last", "element", "found", "with", "a", "selector" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L176-L206
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.find_all
def find_all(self, selector, **kwargs): """Return all the elements found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) default configurable via proxy_driver:wait_until_present_before_find ...
python
def find_all(self, selector, **kwargs): """Return all the elements found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) default configurable via proxy_driver:wait_until_present_before_find ...
[ "def", "find_all", "(", "self", ",", "selector", ",", "*", "*", "kwargs", ")", ":", "self", ".", "debug_log", "(", "\"Finding elements with selector: %s\"", "%", "selector", ")", "raise_exception", "=", "kwargs", ".", "get", "(", "'raise_exception'", ",", "BRO...
Return all the elements found with a selector Args: selector (str): the selector used to find the element Kwargs: wait_until_present (bool) default configurable via proxy_driver:wait_until_present_before_find wait_until_visible (bool) default configu...
[ "Return", "all", "the", "elements", "found", "with", "a", "selector" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L208-L303
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.wait_until_clickable
def wait_until_clickable(self, selector, **kwargs): """Wait until an element is clickable Args: selector (str): the selector used to find the element Kwargs: timeout (int) second before a timeout exception is raise raise_exception (bool) raise an exception o...
python
def wait_until_clickable(self, selector, **kwargs): """Wait until an element is clickable Args: selector (str): the selector used to find the element Kwargs: timeout (int) second before a timeout exception is raise raise_exception (bool) raise an exception o...
[ "def", "wait_until_clickable", "(", "self", ",", "selector", ",", "*", "*", "kwargs", ")", ":", "self", ".", "info_log", "(", "\"Waiting until clickable (%s)\"", "%", "selector", ")", "timeout", "=", "kwargs", ".", "get", "(", "'timeout'", ",", "BROME_CONFIG",...
Wait until an element is clickable Args: selector (str): the selector used to find the element Kwargs: timeout (int) second before a timeout exception is raise raise_exception (bool) raise an exception or return a bool Returns: bool True if elem...
[ "Wait", "until", "an", "element", "is", "clickable" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L306-L365
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.get
def get(self, url): """Navigate to a specific url This specific implementation inject a javascript script to intercept the javascript error Configurable with the "proxy_driver:intercept_javascript_error" config Args: url (str): the url to navigate to R...
python
def get(self, url): """Navigate to a specific url This specific implementation inject a javascript script to intercept the javascript error Configurable with the "proxy_driver:intercept_javascript_error" config Args: url (str): the url to navigate to R...
[ "def", "get", "(", "self", ",", "url", ")", ":", "self", ".", "_driver", ".", "get", "(", "url", ")", "if", "self", ".", "bot_diary", ":", "self", ".", "bot_diary", ".", "add_auto_entry", "(", "\"I went on\"", ",", "target", "=", "url", ",", "take_sc...
Navigate to a specific url This specific implementation inject a javascript script to intercept the javascript error Configurable with the "proxy_driver:intercept_javascript_error" config Args: url (str): the url to navigate to Returns: bool
[ "Navigate", "to", "a", "specific", "url" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L688-L715
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.print_javascript_error
def print_javascript_error(self): """Print to the info log the gathered javascript error If no error is found then nothing is printed """ errors = self.get_javascript_error(return_type='list') if errors: self.info_log("Javascript error:") for error in er...
python
def print_javascript_error(self): """Print to the info log the gathered javascript error If no error is found then nothing is printed """ errors = self.get_javascript_error(return_type='list') if errors: self.info_log("Javascript error:") for error in er...
[ "def", "print_javascript_error", "(", "self", ")", ":", "errors", "=", "self", ".", "get_javascript_error", "(", "return_type", "=", "'list'", ")", "if", "errors", ":", "self", ".", "info_log", "(", "\"Javascript error:\"", ")", "for", "error", "in", "errors",...
Print to the info log the gathered javascript error If no error is found then nothing is printed
[ "Print", "to", "the", "info", "log", "the", "gathered", "javascript", "error" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L748-L758
jf-parent/brome
brome/core/proxy_driver.py
ProxyDriver.get_javascript_error
def get_javascript_error(self, return_type='string'): """Return the gathered javascript error Args: return_type: 'string' | 'list'; default: 'string' """ if BROME_CONFIG['proxy_driver']['intercept_javascript_error']: js_errors = self._driver.execute_script( ...
python
def get_javascript_error(self, return_type='string'): """Return the gathered javascript error Args: return_type: 'string' | 'list'; default: 'string' """ if BROME_CONFIG['proxy_driver']['intercept_javascript_error']: js_errors = self._driver.execute_script( ...
[ "def", "get_javascript_error", "(", "self", ",", "return_type", "=", "'string'", ")", ":", "if", "BROME_CONFIG", "[", "'proxy_driver'", "]", "[", "'intercept_javascript_error'", "]", ":", "js_errors", "=", "self", ".", "_driver", ".", "execute_script", "(", "'re...
Return the gathered javascript error Args: return_type: 'string' | 'list'; default: 'string'
[ "Return", "the", "gathered", "javascript", "error" ]
train
https://github.com/jf-parent/brome/blob/784f45d96b83b703dd2181cb59ca8ea777c2510e/brome/core/proxy_driver.py#L760-L789