partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | Menu.launch | Launches a new menu. Wraps curses nicely so exceptions won't screw with
the terminal too much. | tmc/ui/menu.py | def launch(title, items, selected=None):
"""
Launches a new menu. Wraps curses nicely so exceptions won't screw with
the terminal too much.
"""
resp = {"code": -1, "done": False}
curses.wrapper(Menu, title, items, selected, resp)
return resp | def launch(title, items, selected=None):
"""
Launches a new menu. Wraps curses nicely so exceptions won't screw with
the terminal too much.
"""
resp = {"code": -1, "done": False}
curses.wrapper(Menu, title, items, selected, resp)
return resp | [
"Launches",
"a",
"new",
"menu",
".",
"Wraps",
"curses",
"nicely",
"so",
"exceptions",
"won",
"t",
"screw",
"with",
"the",
"terminal",
"too",
"much",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/ui/menu.py#L122-L129 | [
"def",
"launch",
"(",
"title",
",",
"items",
",",
"selected",
"=",
"None",
")",
":",
"resp",
"=",
"{",
"\"code\"",
":",
"-",
"1",
",",
"\"done\"",
":",
"False",
"}",
"curses",
".",
"wrapper",
"(",
"Menu",
",",
"title",
",",
"items",
",",
"selected"... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | Ions.q | Numerically solved trajectory function for initial conditons :math:`q(0) = q_0` and :math:`q'(0) = 0`. | scisalt/PWFA/ions.py | def q(self, x, q0):
"""
Numerically solved trajectory function for initial conditons :math:`q(0) = q_0` and :math:`q'(0) = 0`.
"""
y1_0 = q0
y0_0 = 0
y0 = [y0_0, y1_0]
y = _sp.integrate.odeint(self._func, y0, x, Dfun=self._gradient, rtol=self.rtol, atol=self.at... | def q(self, x, q0):
"""
Numerically solved trajectory function for initial conditons :math:`q(0) = q_0` and :math:`q'(0) = 0`.
"""
y1_0 = q0
y0_0 = 0
y0 = [y0_0, y1_0]
y = _sp.integrate.odeint(self._func, y0, x, Dfun=self._gradient, rtol=self.rtol, atol=self.at... | [
"Numerically",
"solved",
"trajectory",
"function",
"for",
"initial",
"conditons",
":",
"math",
":",
"q",
"(",
"0",
")",
"=",
"q_0",
"and",
":",
"math",
":",
"q",
"(",
"0",
")",
"=",
"0",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions.py#L93-L103 | [
"def",
"q",
"(",
"self",
",",
"x",
",",
"q0",
")",
":",
"y1_0",
"=",
"q0",
"y0_0",
"=",
"0",
"y0",
"=",
"[",
"y0_0",
",",
"y1_0",
"]",
"y",
"=",
"_sp",
".",
"integrate",
".",
"odeint",
"(",
"self",
".",
"_func",
",",
"y0",
",",
"x",
",",
... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | RankedModel.save | Overridden method that handles that re-ranking of objects and the
integrity of the ``rank`` field.
:param rerank:
Added parameter, if True will rerank other objects based on the
change in this save. Defaults to True. | awl/rankedmodel/models.py | def save(self, *args, **kwargs):
"""Overridden method that handles that re-ranking of objects and the
integrity of the ``rank`` field.
:param rerank:
Added parameter, if True will rerank other objects based on the
change in this save. Defaults to True.
"""
... | def save(self, *args, **kwargs):
"""Overridden method that handles that re-ranking of objects and the
integrity of the ``rank`` field.
:param rerank:
Added parameter, if True will rerank other objects based on the
change in this save. Defaults to True.
"""
... | [
"Overridden",
"method",
"that",
"handles",
"that",
"re",
"-",
"ranking",
"of",
"objects",
"and",
"the",
"integrity",
"of",
"the",
"rank",
"field",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/rankedmodel/models.py#L113-L131 | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"rerank",
"=",
"kwargs",
".",
"pop",
"(",
"'rerank'",
",",
"True",
")",
"if",
"rerank",
":",
"if",
"not",
"self",
".",
"id",
":",
"self",
".",
"_process_new_rank_obj",... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | RankedModel.repack | Removes any blank ranks in the order. | awl/rankedmodel/models.py | def repack(self):
"""Removes any blank ranks in the order."""
items = self.grouped_filter().order_by('rank').select_for_update()
for count, item in enumerate(items):
item.rank = count + 1
item.save(rerank=False) | def repack(self):
"""Removes any blank ranks in the order."""
items = self.grouped_filter().order_by('rank').select_for_update()
for count, item in enumerate(items):
item.rank = count + 1
item.save(rerank=False) | [
"Removes",
"any",
"blank",
"ranks",
"in",
"the",
"order",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/rankedmodel/models.py#L153-L158 | [
"def",
"repack",
"(",
"self",
")",
":",
"items",
"=",
"self",
".",
"grouped_filter",
"(",
")",
".",
"order_by",
"(",
"'rank'",
")",
".",
"select_for_update",
"(",
")",
"for",
"count",
",",
"item",
"in",
"enumerate",
"(",
"items",
")",
":",
"item",
".... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | refetch_for_update | Queries the database for the same object that is passed in, refetching
its contents and runs ``select_for_update()`` to lock the corresponding
row until the next commit.
:param obj:
Object to refetch
:returns:
Refreshed version of the object | awl/utils.py | def refetch_for_update(obj):
"""Queries the database for the same object that is passed in, refetching
its contents and runs ``select_for_update()`` to lock the corresponding
row until the next commit.
:param obj:
Object to refetch
:returns:
Refreshed version of the object
"""
... | def refetch_for_update(obj):
"""Queries the database for the same object that is passed in, refetching
its contents and runs ``select_for_update()`` to lock the corresponding
row until the next commit.
:param obj:
Object to refetch
:returns:
Refreshed version of the object
"""
... | [
"Queries",
"the",
"database",
"for",
"the",
"same",
"object",
"that",
"is",
"passed",
"in",
"refetching",
"its",
"contents",
"and",
"runs",
"select_for_update",
"()",
"to",
"lock",
"the",
"corresponding",
"row",
"until",
"the",
"next",
"commit",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/utils.py#L46-L56 | [
"def",
"refetch_for_update",
"(",
"obj",
")",
":",
"return",
"obj",
".",
"__class__",
".",
"objects",
".",
"select_for_update",
"(",
")",
".",
"get",
"(",
"id",
"=",
"obj",
".",
"id",
")"
] | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | get_field_names | Returns the field names of a Django model object.
:param obj: the Django model class or object instance to get the fields
from
:param ignore_auto: ignore any fields of type AutoField. Defaults to True
:param ignore_relations: ignore any fields that involve relations such as
the ForeignKey o... | awl/utils.py | def get_field_names(obj, ignore_auto=True, ignore_relations=True,
exclude=[]):
"""Returns the field names of a Django model object.
:param obj: the Django model class or object instance to get the fields
from
:param ignore_auto: ignore any fields of type AutoField. Defaults to True
:pa... | def get_field_names(obj, ignore_auto=True, ignore_relations=True,
exclude=[]):
"""Returns the field names of a Django model object.
:param obj: the Django model class or object instance to get the fields
from
:param ignore_auto: ignore any fields of type AutoField. Defaults to True
:pa... | [
"Returns",
"the",
"field",
"names",
"of",
"a",
"Django",
"model",
"object",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/utils.py#L59-L93 | [
"def",
"get_field_names",
"(",
"obj",
",",
"ignore_auto",
"=",
"True",
",",
"ignore_relations",
"=",
"True",
",",
"exclude",
"=",
"[",
"]",
")",
":",
"from",
"django",
".",
"db",
".",
"models",
"import",
"(",
"AutoField",
",",
"ForeignKey",
",",
"ManyToM... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | get_obj_attr | Works like getattr() but supports django's double underscore object
dereference notation.
Example usage:
.. code-block:: python
>>> get_obj_attr(book, 'writer__age')
42
>>> get_obj_attr(book, 'publisher__address')
<Address object at 105a79ac8>
:param obj:
Obj... | awl/utils.py | def get_obj_attr(obj, attr):
"""Works like getattr() but supports django's double underscore object
dereference notation.
Example usage:
.. code-block:: python
>>> get_obj_attr(book, 'writer__age')
42
>>> get_obj_attr(book, 'publisher__address')
<Address object at 105a... | def get_obj_attr(obj, attr):
"""Works like getattr() but supports django's double underscore object
dereference notation.
Example usage:
.. code-block:: python
>>> get_obj_attr(book, 'writer__age')
42
>>> get_obj_attr(book, 'publisher__address')
<Address object at 105a... | [
"Works",
"like",
"getattr",
"()",
"but",
"supports",
"django",
"s",
"double",
"underscore",
"object",
"dereference",
"notation",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/utils.py#L96-L129 | [
"def",
"get_obj_attr",
"(",
"obj",
",",
"attr",
")",
":",
"# handle '__' referencing like in QuerySets",
"fields",
"=",
"attr",
".",
"split",
"(",
"'__'",
")",
"field_obj",
"=",
"getattr",
"(",
"obj",
",",
"fields",
"[",
"0",
"]",
")",
"for",
"field",
"in"... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | URLTree.as_list | Returns a list of strings describing the full paths and patterns
along with the name of the urls. Example:
.. code-block::python
>>> u = URLTree()
>>> u.as_list()
[
'admin/',
'admin/$, name=index',
'admin/login/$, name... | awl/utils.py | def as_list(self):
"""Returns a list of strings describing the full paths and patterns
along with the name of the urls. Example:
.. code-block::python
>>> u = URLTree()
>>> u.as_list()
[
'admin/',
'admin/$, name=index',
... | def as_list(self):
"""Returns a list of strings describing the full paths and patterns
along with the name of the urls. Example:
.. code-block::python
>>> u = URLTree()
>>> u.as_list()
[
'admin/',
'admin/$, name=index',
... | [
"Returns",
"a",
"list",
"of",
"strings",
"describing",
"the",
"full",
"paths",
"and",
"patterns",
"along",
"with",
"the",
"name",
"of",
"the",
"urls",
".",
"Example",
":"
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/utils.py#L178-L195 | [
"def",
"as_list",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"child",
"in",
"self",
".",
"children",
":",
"self",
".",
"_depth_traversal",
"(",
"child",
",",
"result",
")",
"return",
"result"
] | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | register | Register all HTTP error code error handlers
Currently, errors are handled by the JSON error handler. | starling/flask/error_handler/error_code.py | def register(
app):
"""
Register all HTTP error code error handlers
Currently, errors are handled by the JSON error handler.
"""
# Pick a handler based on the requested format. Currently we assume the
# caller wants JSON.
error_handler = json.http_exception_error_handler
@app... | def register(
app):
"""
Register all HTTP error code error handlers
Currently, errors are handled by the JSON error handler.
"""
# Pick a handler based on the requested format. Currently we assume the
# caller wants JSON.
error_handler = json.http_exception_error_handler
@app... | [
"Register",
"all",
"HTTP",
"error",
"code",
"error",
"handlers"
] | geoneric/starling | python | https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/flask/error_handler/error_code.py#L7-L47 | [
"def",
"register",
"(",
"app",
")",
":",
"# Pick a handler based on the requested format. Currently we assume the",
"# caller wants JSON.",
"error_handler",
"=",
"json",
".",
"http_exception_error_handler",
"@",
"app",
".",
"errorhandler",
"(",
"400",
")",
"def",
"handle_ba... | a8e1324c4d6e8b063a0d353bcd03bb8e57edd888 |
valid | plot | Plots but automatically resizes x axis.
.. versionadded:: 1.4
Parameters
----------
args
Passed on to :meth:`matplotlib.axis.Axis.plot`.
ax : :class:`matplotlib.axis.Axis`, optional
The axis to plot to.
kwargs
Passed on to :meth:`matplotlib.axis.Axis.plot`. | scisalt/matplotlib/plot.py | def plot(*args, ax=None, **kwargs):
"""
Plots but automatically resizes x axis.
.. versionadded:: 1.4
Parameters
----------
args
Passed on to :meth:`matplotlib.axis.Axis.plot`.
ax : :class:`matplotlib.axis.Axis`, optional
The axis to plot to.
kwargs
Passed on to... | def plot(*args, ax=None, **kwargs):
"""
Plots but automatically resizes x axis.
.. versionadded:: 1.4
Parameters
----------
args
Passed on to :meth:`matplotlib.axis.Axis.plot`.
ax : :class:`matplotlib.axis.Axis`, optional
The axis to plot to.
kwargs
Passed on to... | [
"Plots",
"but",
"automatically",
"resizes",
"x",
"axis",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/plot.py#L10-L37 | [
"def",
"plot",
"(",
"*",
"args",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ax",
"is",
"None",
":",
"fig",
",",
"ax",
"=",
"_setup_axes",
"(",
")",
"pl",
"=",
"ax",
".",
"plot",
"(",
"*",
"args",
",",
"*",
"*",
"kwarg... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | linspacestep | Create a vector of values over an interval with a specified step size.
Parameters
----------
start : float
The beginning of the interval.
stop : float
The end of the interval.
step : float
The step size.
Returns
-------
vector : :class:`numpy.ndarray`
T... | scisalt/numpy/linspacestep.py | def linspacestep(start, stop, step=1):
"""
Create a vector of values over an interval with a specified step size.
Parameters
----------
start : float
The beginning of the interval.
stop : float
The end of the interval.
step : float
The step size.
Returns
--... | def linspacestep(start, stop, step=1):
"""
Create a vector of values over an interval with a specified step size.
Parameters
----------
start : float
The beginning of the interval.
stop : float
The end of the interval.
step : float
The step size.
Returns
--... | [
"Create",
"a",
"vector",
"of",
"values",
"over",
"an",
"interval",
"with",
"a",
"specified",
"step",
"size",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/numpy/linspacestep.py#L7-L31 | [
"def",
"linspacestep",
"(",
"start",
",",
"stop",
",",
"step",
"=",
"1",
")",
":",
"# Find an integer number of steps",
"numsteps",
"=",
"_np",
".",
"int",
"(",
"(",
"stop",
"-",
"start",
")",
"/",
"step",
")",
"# Do a linspace over the new range",
"# that has... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | mylogger | Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Parent logging level.
* *stream_level*: Logging level for console stream.
* *file_level*: Logging level for general file log. | scisalt/logging/mylogger.py | def mylogger(name=None, filename=None, indent_offset=7, level=_logging.DEBUG, stream_level=_logging.WARN, file_level=_logging.INFO):
"""
Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Par... | def mylogger(name=None, filename=None, indent_offset=7, level=_logging.DEBUG, stream_level=_logging.WARN, file_level=_logging.INFO):
"""
Sets up logging to *filename*.debug.log, *filename*.log, and the terminal. *indent_offset* attempts to line up the lowest indent level to 0. Custom levels:
* *level*: Par... | [
"Sets",
"up",
"logging",
"to",
"*",
"filename",
"*",
".",
"debug",
".",
"log",
"*",
"filename",
"*",
".",
"log",
"and",
"the",
"terminal",
".",
"*",
"indent_offset",
"*",
"attempts",
"to",
"line",
"up",
"the",
"lowest",
"indent",
"level",
"to",
"0",
... | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/logging/mylogger.py#L6-L40 | [
"def",
"mylogger",
"(",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"indent_offset",
"=",
"7",
",",
"level",
"=",
"_logging",
".",
"DEBUG",
",",
"stream_level",
"=",
"_logging",
".",
"WARN",
",",
"file_level",
"=",
"_logging",
".",
"INFO",
... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | selected_course | Passes the selected course as the first argument to func. | tmc/__main__.py | def selected_course(func):
"""
Passes the selected course as the first argument to func.
"""
@wraps(func)
def inner(*args, **kwargs):
course = Course.get_selected()
return func(course, *args, **kwargs)
return inner | def selected_course(func):
"""
Passes the selected course as the first argument to func.
"""
@wraps(func)
def inner(*args, **kwargs):
course = Course.get_selected()
return func(course, *args, **kwargs)
return inner | [
"Passes",
"the",
"selected",
"course",
"as",
"the",
"first",
"argument",
"to",
"func",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L38-L46 | [
"def",
"selected_course",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"course",
"=",
"Course",
".",
"get_selected",
"(",
")",
"return",
"func",
"(",
"course",
",",
"*",... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | selected_exercise | Passes the selected exercise as the first argument to func. | tmc/__main__.py | def selected_exercise(func):
"""
Passes the selected exercise as the first argument to func.
"""
@wraps(func)
def inner(*args, **kwargs):
exercise = Exercise.get_selected()
return func(exercise, *args, **kwargs)
return inner | def selected_exercise(func):
"""
Passes the selected exercise as the first argument to func.
"""
@wraps(func)
def inner(*args, **kwargs):
exercise = Exercise.get_selected()
return func(exercise, *args, **kwargs)
return inner | [
"Passes",
"the",
"selected",
"exercise",
"as",
"the",
"first",
"argument",
"to",
"func",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L49-L57 | [
"def",
"selected_exercise",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"exercise",
"=",
"Exercise",
".",
"get_selected",
"(",
")",
"return",
"func",
"(",
"exercise",
","... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | false_exit | If func returns False the program exits immediately. | tmc/__main__.py | def false_exit(func):
"""
If func returns False the program exits immediately.
"""
@wraps(func)
def inner(*args, **kwargs):
ret = func(*args, **kwargs)
if ret is False:
if "TMC_TESTING" in os.environ:
raise TMCExit()
else:
sys.e... | def false_exit(func):
"""
If func returns False the program exits immediately.
"""
@wraps(func)
def inner(*args, **kwargs):
ret = func(*args, **kwargs)
if ret is False:
if "TMC_TESTING" in os.environ:
raise TMCExit()
else:
sys.e... | [
"If",
"func",
"returns",
"False",
"the",
"program",
"exits",
"immediately",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L60-L73 | [
"def",
"false_exit",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"inner",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"ret",
"is",
"False",
"... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | configure | Configure tmc.py to use your account. | tmc/__main__.py | def configure(server=None, username=None, password=None, tid=None, auto=False):
"""
Configure tmc.py to use your account.
"""
if not server and not username and not password and not tid:
if Config.has():
if not yn_prompt("Override old configuration", False):
return Fa... | def configure(server=None, username=None, password=None, tid=None, auto=False):
"""
Configure tmc.py to use your account.
"""
if not server and not username and not password and not tid:
if Config.has():
if not yn_prompt("Override old configuration", False):
return Fa... | [
"Configure",
"tmc",
".",
"py",
"to",
"use",
"your",
"account",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L104-L160 | [
"def",
"configure",
"(",
"server",
"=",
"None",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"tid",
"=",
"None",
",",
"auto",
"=",
"False",
")",
":",
"if",
"not",
"server",
"and",
"not",
"username",
"and",
"not",
"password",
"and"... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | download | Download the exercises from the server. | tmc/__main__.py | def download(course, tid=None, dl_all=False, force=False, upgradejava=False,
update=False):
"""
Download the exercises from the server.
"""
def dl(id):
download_exercise(Exercise.get(Exercise.tid == id),
force=force,
update_java=u... | def download(course, tid=None, dl_all=False, force=False, upgradejava=False,
update=False):
"""
Download the exercises from the server.
"""
def dl(id):
download_exercise(Exercise.get(Exercise.tid == id),
force=force,
update_java=u... | [
"Download",
"the",
"exercises",
"from",
"the",
"server",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L183-L205 | [
"def",
"download",
"(",
"course",
",",
"tid",
"=",
"None",
",",
"dl_all",
"=",
"False",
",",
"force",
"=",
"False",
",",
"upgradejava",
"=",
"False",
",",
"update",
"=",
"False",
")",
":",
"def",
"dl",
"(",
"id",
")",
":",
"download_exercise",
"(",
... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | skip | Go to the next exercise. | tmc/__main__.py | def skip(course, num=1):
"""
Go to the next exercise.
"""
sel = None
try:
sel = Exercise.get_selected()
if sel.course.tid != course.tid:
sel = None
except NoExerciseSelected:
pass
if sel is None:
sel = course.exercises.first()
else:
tr... | def skip(course, num=1):
"""
Go to the next exercise.
"""
sel = None
try:
sel = Exercise.get_selected()
if sel.course.tid != course.tid:
sel = None
except NoExerciseSelected:
pass
if sel is None:
sel = course.exercises.first()
else:
tr... | [
"Go",
"to",
"the",
"next",
"exercise",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L211-L233 | [
"def",
"skip",
"(",
"course",
",",
"num",
"=",
"1",
")",
":",
"sel",
"=",
"None",
"try",
":",
"sel",
"=",
"Exercise",
".",
"get_selected",
"(",
")",
"if",
"sel",
".",
"course",
".",
"tid",
"!=",
"course",
".",
"tid",
":",
"sel",
"=",
"None",
"e... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | run | Spawns a process with `command path-of-exercise` | tmc/__main__.py | def run(exercise, command):
"""
Spawns a process with `command path-of-exercise`
"""
Popen(['nohup', command, exercise.path()], stdout=DEVNULL, stderr=DEVNULL) | def run(exercise, command):
"""
Spawns a process with `command path-of-exercise`
"""
Popen(['nohup', command, exercise.path()], stdout=DEVNULL, stderr=DEVNULL) | [
"Spawns",
"a",
"process",
"with",
"command",
"path",
"-",
"of",
"-",
"exercise"
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L255-L259 | [
"def",
"run",
"(",
"exercise",
",",
"command",
")",
":",
"Popen",
"(",
"[",
"'nohup'",
",",
"command",
",",
"exercise",
".",
"path",
"(",
")",
"]",
",",
"stdout",
"=",
"DEVNULL",
",",
"stderr",
"=",
"DEVNULL",
")"
] | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | select | Select a course or an exercise. | tmc/__main__.py | def select(course=False, tid=None, auto=False):
"""
Select a course or an exercise.
"""
if course:
update(course=True)
course = None
try:
course = Course.get_selected()
except NoCourseSelected:
pass
ret = {}
if not tid:
... | def select(course=False, tid=None, auto=False):
"""
Select a course or an exercise.
"""
if course:
update(course=True)
course = None
try:
course = Course.get_selected()
except NoCourseSelected:
pass
ret = {}
if not tid:
... | [
"Select",
"a",
"course",
"or",
"an",
"exercise",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L266-L312 | [
"def",
"select",
"(",
"course",
"=",
"False",
",",
"tid",
"=",
"None",
",",
"auto",
"=",
"False",
")",
":",
"if",
"course",
":",
"update",
"(",
"course",
"=",
"True",
")",
"course",
"=",
"None",
"try",
":",
"course",
"=",
"Course",
".",
"get_select... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | submit | Submit the selected exercise to the server. | tmc/__main__.py | def submit(course, tid=None, pastebin=False, review=False):
"""
Submit the selected exercise to the server.
"""
if tid is not None:
return submit_exercise(Exercise.byid(tid),
pastebin=pastebin,
request_review=review)
else:
... | def submit(course, tid=None, pastebin=False, review=False):
"""
Submit the selected exercise to the server.
"""
if tid is not None:
return submit_exercise(Exercise.byid(tid),
pastebin=pastebin,
request_review=review)
else:
... | [
"Submit",
"the",
"selected",
"exercise",
"to",
"the",
"server",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L323-L335 | [
"def",
"submit",
"(",
"course",
",",
"tid",
"=",
"None",
",",
"pastebin",
"=",
"False",
",",
"review",
"=",
"False",
")",
":",
"if",
"tid",
"is",
"not",
"None",
":",
"return",
"submit_exercise",
"(",
"Exercise",
".",
"byid",
"(",
"tid",
")",
",",
"... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | paste | Sends the selected exercise to the TMC pastebin. | tmc/__main__.py | def paste(tid=None, review=False):
"""
Sends the selected exercise to the TMC pastebin.
"""
submit(pastebin=True, tid=tid, review=False) | def paste(tid=None, review=False):
"""
Sends the selected exercise to the TMC pastebin.
"""
submit(pastebin=True, tid=tid, review=False) | [
"Sends",
"the",
"selected",
"exercise",
"to",
"the",
"TMC",
"pastebin",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L342-L346 | [
"def",
"paste",
"(",
"tid",
"=",
"None",
",",
"review",
"=",
"False",
")",
":",
"submit",
"(",
"pastebin",
"=",
"True",
",",
"tid",
"=",
"tid",
",",
"review",
"=",
"False",
")"
] | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | list_all | Lists all of the exercises in the current course. | tmc/__main__.py | def list_all(course, single=None):
"""
Lists all of the exercises in the current course.
"""
def bs(val):
return "●" if val else " "
def bc(val):
return as_success("✔") if val else as_error("✘")
def format_line(exercise):
return "{0} │ {1} │ {2} │ {3} │ {4}".format(exe... | def list_all(course, single=None):
"""
Lists all of the exercises in the current course.
"""
def bs(val):
return "●" if val else " "
def bc(val):
return as_success("✔") if val else as_error("✘")
def format_line(exercise):
return "{0} │ {1} │ {2} │ {3} │ {4}".format(exe... | [
"Lists",
"all",
"of",
"the",
"exercises",
"in",
"the",
"current",
"course",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L372-L398 | [
"def",
"list_all",
"(",
"course",
",",
"single",
"=",
"None",
")",
":",
"def",
"bs",
"(",
"val",
")",
":",
"return",
"\"●\" i",
" v",
"l e",
"se \"",
"\"",
"def",
"bc",
"(",
"val",
")",
":",
"return",
"as_success",
"(",
"\"✔\") ",
"i",
" v",
"l e",... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | update | Update the data of courses and or exercises from server. | tmc/__main__.py | def update(course=False):
"""
Update the data of courses and or exercises from server.
"""
if course:
with Spinner.context(msg="Updated course metadata.",
waitmsg="Updating course metadata."):
for course in api.get_courses():
old = None
... | def update(course=False):
"""
Update the data of courses and or exercises from server.
"""
if course:
with Spinner.context(msg="Updated course metadata.",
waitmsg="Updating course metadata."):
for course in api.get_courses():
old = None
... | [
"Update",
"the",
"data",
"of",
"courses",
"and",
"or",
"exercises",
"from",
"server",
"."
] | minttu/tmc.py | python | https://github.com/minttu/tmc.py/blob/212cfe1791a4aab4783f99b665cc32da6437f419/tmc/__main__.py#L403-L459 | [
"def",
"update",
"(",
"course",
"=",
"False",
")",
":",
"if",
"course",
":",
"with",
"Spinner",
".",
"context",
"(",
"msg",
"=",
"\"Updated course metadata.\"",
",",
"waitmsg",
"=",
"\"Updating course metadata.\"",
")",
":",
"for",
"course",
"in",
"api",
"."... | 212cfe1791a4aab4783f99b665cc32da6437f419 |
valid | determine_type | Determine the type of x | incisive/core.py | def determine_type(x):
"""Determine the type of x"""
types = (int, float, str)
_type = filter(lambda a: is_type(a, x), types)[0]
return _type(x) | def determine_type(x):
"""Determine the type of x"""
types = (int, float, str)
_type = filter(lambda a: is_type(a, x), types)[0]
return _type(x) | [
"Determine",
"the",
"type",
"of",
"x"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L21-L25 | [
"def",
"determine_type",
"(",
"x",
")",
":",
"types",
"=",
"(",
"int",
",",
"float",
",",
"str",
")",
"_type",
"=",
"filter",
"(",
"lambda",
"a",
":",
"is_type",
"(",
"a",
",",
"x",
")",
",",
"types",
")",
"[",
"0",
"]",
"return",
"_type",
"(",... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | dmap | map for a directory | incisive/core.py | def dmap(fn, record):
"""map for a directory"""
values = (fn(v) for k, v in record.items())
return dict(itertools.izip(record, values)) | def dmap(fn, record):
"""map for a directory"""
values = (fn(v) for k, v in record.items())
return dict(itertools.izip(record, values)) | [
"map",
"for",
"a",
"directory"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L28-L31 | [
"def",
"dmap",
"(",
"fn",
",",
"record",
")",
":",
"values",
"=",
"(",
"fn",
"(",
"v",
")",
"for",
"k",
",",
"v",
"in",
"record",
".",
"items",
"(",
")",
")",
"return",
"dict",
"(",
"itertools",
".",
"izip",
"(",
"record",
",",
"values",
")",
... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | apply_types | Apply the types on the elements of the line | incisive/core.py | def apply_types(use_types, guess_type, line):
"""Apply the types on the elements of the line"""
new_line = {}
for k, v in line.items():
if use_types.has_key(k):
new_line[k] = force_type(use_types[k], v)
elif guess_type:
new_line[k] = determine_type(v)
else:
... | def apply_types(use_types, guess_type, line):
"""Apply the types on the elements of the line"""
new_line = {}
for k, v in line.items():
if use_types.has_key(k):
new_line[k] = force_type(use_types[k], v)
elif guess_type:
new_line[k] = determine_type(v)
else:
... | [
"Apply",
"the",
"types",
"on",
"the",
"elements",
"of",
"the",
"line"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L41-L51 | [
"def",
"apply_types",
"(",
"use_types",
",",
"guess_type",
",",
"line",
")",
":",
"new_line",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"line",
".",
"items",
"(",
")",
":",
"if",
"use_types",
".",
"has_key",
"(",
"k",
")",
":",
"new_line",
"[",
... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | read_csv | Read a CSV file
Usage
-----
>>> data = read_csv(filename, delimiter=delimiter, skip=skip,
guess_type=guess_type, has_header=True, use_types={})
# Use specific types
>>> types = {"sepal.length": int, "petal.width": float}
>>> data = read_csv(filename, guess_type=guess_type, use... | incisive/core.py | def read_csv(filename, delimiter=",", skip=0, guess_type=True, has_header=True, use_types={}):
"""Read a CSV file
Usage
-----
>>> data = read_csv(filename, delimiter=delimiter, skip=skip,
guess_type=guess_type, has_header=True, use_types={})
# Use specific types
>>> types = {"... | def read_csv(filename, delimiter=",", skip=0, guess_type=True, has_header=True, use_types={}):
"""Read a CSV file
Usage
-----
>>> data = read_csv(filename, delimiter=delimiter, skip=skip,
guess_type=guess_type, has_header=True, use_types={})
# Use specific types
>>> types = {"... | [
"Read",
"a",
"CSV",
"file",
"Usage",
"-----",
">>>",
"data",
"=",
"read_csv",
"(",
"filename",
"delimiter",
"=",
"delimiter",
"skip",
"=",
"skip",
"guess_type",
"=",
"guess_type",
"has_header",
"=",
"True",
"use_types",
"=",
"{}",
")"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L55-L88 | [
"def",
"read_csv",
"(",
"filename",
",",
"delimiter",
"=",
"\",\"",
",",
"skip",
"=",
"0",
",",
"guess_type",
"=",
"True",
",",
"has_header",
"=",
"True",
",",
"use_types",
"=",
"{",
"}",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | write_csv | Write the data to the specified filename
Usage
-----
>>> write_csv(filename, header, data, mode=mode)
Parameters
----------
filename : str
The name of the file
header : list of strings
The names of the columns (or fields):
(fieldname1, fieldname2, ...)
dat... | incisive/core.py | def write_csv(filename, header, data=None, rows=None, mode="w"):
"""Write the data to the specified filename
Usage
-----
>>> write_csv(filename, header, data, mode=mode)
Parameters
----------
filename : str
The name of the file
header : list of strings
The names of... | def write_csv(filename, header, data=None, rows=None, mode="w"):
"""Write the data to the specified filename
Usage
-----
>>> write_csv(filename, header, data, mode=mode)
Parameters
----------
filename : str
The name of the file
header : list of strings
The names of... | [
"Write",
"the",
"data",
"to",
"the",
"specified",
"filename",
"Usage",
"-----",
">>>",
"write_csv",
"(",
"filename",
"header",
"data",
"mode",
"=",
"mode",
")"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L91-L152 | [
"def",
"write_csv",
"(",
"filename",
",",
"header",
",",
"data",
"=",
"None",
",",
"rows",
"=",
"None",
",",
"mode",
"=",
"\"w\"",
")",
":",
"if",
"data",
"==",
"rows",
"==",
"None",
":",
"msg",
"=",
"\"You must specify either data or rows\"",
"raise",
"... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | format_to_csv | Convert a file to a .csv file | incisive/core.py | def format_to_csv(filename, skiprows=0, delimiter=""):
"""Convert a file to a .csv file"""
if not delimiter:
delimiter = "\t"
input_file = open(filename, "r")
if skiprows:
[input_file.readline() for _ in range(skiprows)]
new_filename = os.path.splitext(filename)[0] + ".csv"
o... | def format_to_csv(filename, skiprows=0, delimiter=""):
"""Convert a file to a .csv file"""
if not delimiter:
delimiter = "\t"
input_file = open(filename, "r")
if skiprows:
[input_file.readline() for _ in range(skiprows)]
new_filename = os.path.splitext(filename)[0] + ".csv"
o... | [
"Convert",
"a",
"file",
"to",
"a",
".",
"csv",
"file"
] | TaurusOlson/incisive | python | https://github.com/TaurusOlson/incisive/blob/25bb9f53495985c1416c82e26f54158df4050cb0/incisive/core.py#L155-L182 | [
"def",
"format_to_csv",
"(",
"filename",
",",
"skiprows",
"=",
"0",
",",
"delimiter",
"=",
"\"\"",
")",
":",
"if",
"not",
"delimiter",
":",
"delimiter",
"=",
"\"\\t\"",
"input_file",
"=",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"if",
"skiprows",
":",... | 25bb9f53495985c1416c82e26f54158df4050cb0 |
valid | savefig | Save the figure *fig* (optional, if not specified, latest figure in focus) to *filename* in the path *path* with extension *ext*.
*\*\*kwargs* is passed to :meth:`matplotlib.figure.Figure.savefig`. | scisalt/matplotlib/savefig.py | def savefig(filename, path="figs", fig=None, ext='eps', verbose=False, **kwargs):
"""
Save the figure *fig* (optional, if not specified, latest figure in focus) to *filename* in the path *path* with extension *ext*.
*\*\*kwargs* is passed to :meth:`matplotlib.figure.Figure.savefig`.
"""
filename ... | def savefig(filename, path="figs", fig=None, ext='eps', verbose=False, **kwargs):
"""
Save the figure *fig* (optional, if not specified, latest figure in focus) to *filename* in the path *path* with extension *ext*.
*\*\*kwargs* is passed to :meth:`matplotlib.figure.Figure.savefig`.
"""
filename ... | [
"Save",
"the",
"figure",
"*",
"fig",
"*",
"(",
"optional",
"if",
"not",
"specified",
"latest",
"figure",
"in",
"focus",
")",
"to",
"*",
"filename",
"*",
"in",
"the",
"path",
"*",
"path",
"*",
"with",
"extension",
"*",
"ext",
"*",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/savefig.py#L12-L32 | [
"def",
"savefig",
"(",
"filename",
",",
"path",
"=",
"\"figs\"",
",",
"fig",
"=",
"None",
",",
"ext",
"=",
"'eps'",
",",
"verbose",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
","... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | admin_obj_link | Returns a link to the django admin change list with a filter set to
only the object given.
:param obj:
Object to create the admin change list display link for
:param display:
Text to display in the link. Defaults to string call of the object
:returns:
Text containing HTML for a... | awl/admintools.py | def admin_obj_link(obj, display=''):
"""Returns a link to the django admin change list with a filter set to
only the object given.
:param obj:
Object to create the admin change list display link for
:param display:
Text to display in the link. Defaults to string call of the object
... | def admin_obj_link(obj, display=''):
"""Returns a link to the django admin change list with a filter set to
only the object given.
:param obj:
Object to create the admin change list display link for
:param display:
Text to display in the link. Defaults to string call of the object
... | [
"Returns",
"a",
"link",
"to",
"the",
"django",
"admin",
"change",
"list",
"with",
"a",
"filter",
"set",
"to",
"only",
"the",
"object",
"given",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L12-L32 | [
"def",
"admin_obj_link",
"(",
"obj",
",",
"display",
"=",
"''",
")",
":",
"# get the url for the change list for this object",
"url",
"=",
"reverse",
"(",
"'admin:%s_%s_changelist'",
"%",
"(",
"obj",
".",
"_meta",
".",
"app_label",
",",
"obj",
".",
"_meta",
".",... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | admin_obj_attr | A safe version of :func:``utils.get_obj_attr`` that returns and empty
string in the case of an exception or an empty object | awl/admintools.py | def admin_obj_attr(obj, attr):
"""A safe version of :func:``utils.get_obj_attr`` that returns and empty
string in the case of an exception or an empty object
"""
try:
field_obj = get_obj_attr(obj, attr)
if not field_obj:
return ''
except AttributeError:
return ''
... | def admin_obj_attr(obj, attr):
"""A safe version of :func:``utils.get_obj_attr`` that returns and empty
string in the case of an exception or an empty object
"""
try:
field_obj = get_obj_attr(obj, attr)
if not field_obj:
return ''
except AttributeError:
return ''
... | [
"A",
"safe",
"version",
"of",
":",
"func",
":",
"utils",
".",
"get_obj_attr",
"that",
"returns",
"and",
"empty",
"string",
"in",
"the",
"case",
"of",
"an",
"exception",
"or",
"an",
"empty",
"object"
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L35-L46 | [
"def",
"admin_obj_attr",
"(",
"obj",
",",
"attr",
")",
":",
"try",
":",
"field_obj",
"=",
"get_obj_attr",
"(",
"obj",
",",
"attr",
")",
"if",
"not",
"field_obj",
":",
"return",
"''",
"except",
"AttributeError",
":",
"return",
"''",
"return",
"field_obj"
] | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | _obj_display | Returns string representation of an object, either the default or based
on the display template passed in. | awl/admintools.py | def _obj_display(obj, display=''):
"""Returns string representation of an object, either the default or based
on the display template passed in.
"""
result = ''
if not display:
result = str(obj)
else:
template = Template(display)
context = Context({'obj':obj})
res... | def _obj_display(obj, display=''):
"""Returns string representation of an object, either the default or based
on the display template passed in.
"""
result = ''
if not display:
result = str(obj)
else:
template = Template(display)
context = Context({'obj':obj})
res... | [
"Returns",
"string",
"representation",
"of",
"an",
"object",
"either",
"the",
"default",
"or",
"based",
"on",
"the",
"display",
"template",
"passed",
"in",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L49-L61 | [
"def",
"_obj_display",
"(",
"obj",
",",
"display",
"=",
"''",
")",
":",
"result",
"=",
"''",
"if",
"not",
"display",
":",
"result",
"=",
"str",
"(",
"obj",
")",
"else",
":",
"template",
"=",
"Template",
"(",
"display",
")",
"context",
"=",
"Context",... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | make_admin_obj_mixin | This method dynamically creates a mixin to be used with your
:class:`ModelAdmin` classes. The mixin provides utility methods that can
be referenced in side of the admin object's ``list_display`` and other
similar attributes.
:param name:
Each usage of the mixin must be given a unique name... | awl/admintools.py | def make_admin_obj_mixin(name):
"""This method dynamically creates a mixin to be used with your
:class:`ModelAdmin` classes. The mixin provides utility methods that can
be referenced in side of the admin object's ``list_display`` and other
similar attributes.
:param name:
Each usage o... | def make_admin_obj_mixin(name):
"""This method dynamically creates a mixin to be used with your
:class:`ModelAdmin` classes. The mixin provides utility methods that can
be referenced in side of the admin object's ``list_display`` and other
similar attributes.
:param name:
Each usage o... | [
"This",
"method",
"dynamically",
"creates",
"a",
"mixin",
"to",
"be",
"used",
"with",
"your",
":",
"class",
":",
"ModelAdmin",
"classes",
".",
"The",
"mixin",
"provides",
"utility",
"methods",
"that",
"can",
"be",
"referenced",
"in",
"side",
"of",
"the",
"... | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L64-L232 | [
"def",
"make_admin_obj_mixin",
"(",
"name",
")",
":",
"@",
"classmethod",
"def",
"add_obj_link",
"(",
"cls",
",",
"funcname",
",",
"attr",
",",
"title",
"=",
"''",
",",
"display",
"=",
"''",
")",
":",
"if",
"not",
"title",
":",
"title",
"=",
"attr",
... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | fancy_modeladmin | Returns a new copy of a :class:`FancyModelAdmin` class (a class, not
an instance!). This can then be inherited from when declaring a model
admin class. The :class:`FancyModelAdmin` class has additional methods
for managing the ``list_display`` attribute.
:param ``*args``: [optional] any arguments given... | awl/admintools.py | def fancy_modeladmin(*args):
"""Returns a new copy of a :class:`FancyModelAdmin` class (a class, not
an instance!). This can then be inherited from when declaring a model
admin class. The :class:`FancyModelAdmin` class has additional methods
for managing the ``list_display`` attribute.
:param ``*ar... | def fancy_modeladmin(*args):
"""Returns a new copy of a :class:`FancyModelAdmin` class (a class, not
an instance!). This can then be inherited from when declaring a model
admin class. The :class:`FancyModelAdmin` class has additional methods
for managing the ``list_display`` attribute.
:param ``*ar... | [
"Returns",
"a",
"new",
"copy",
"of",
"a",
":",
"class",
":",
"FancyModelAdmin",
"class",
"(",
"a",
"class",
"not",
"an",
"instance!",
")",
".",
"This",
"can",
"then",
"be",
"inherited",
"from",
"when",
"declaring",
"a",
"model",
"admin",
"class",
".",
... | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L439-L512 | [
"def",
"fancy_modeladmin",
"(",
"*",
"args",
")",
":",
"global",
"klass_count",
"klass_count",
"+=",
"1",
"name",
"=",
"'DynamicAdminClass%d'",
"%",
"klass_count",
"# clone the admin class",
"klass",
"=",
"type",
"(",
"name",
",",
"(",
"FancyModelAdmin",
",",
")... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | FancyModelAdmin.add_display | Adds a ``list_display`` property without any extra wrappers,
similar to :func:`add_displays`, but can also change the title.
:param attr:
Name of the attribute to add to the display
:param title:
Title for the column of the django admin table. If not given it
... | awl/admintools.py | def add_display(cls, attr, title=''):
"""Adds a ``list_display`` property without any extra wrappers,
similar to :func:`add_displays`, but can also change the title.
:param attr:
Name of the attribute to add to the display
:param title:
Title for the column of t... | def add_display(cls, attr, title=''):
"""Adds a ``list_display`` property without any extra wrappers,
similar to :func:`add_displays`, but can also change the title.
:param attr:
Name of the attribute to add to the display
:param title:
Title for the column of t... | [
"Adds",
"a",
"list_display",
"property",
"without",
"any",
"extra",
"wrappers",
"similar",
"to",
":",
"func",
":",
"add_displays",
"but",
"can",
"also",
"change",
"the",
"title",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L256-L283 | [
"def",
"add_display",
"(",
"cls",
",",
"attr",
",",
"title",
"=",
"''",
")",
":",
"global",
"klass_count",
"klass_count",
"+=",
"1",
"fn_name",
"=",
"'dyn_fn_%d'",
"%",
"klass_count",
"cls",
".",
"list_display",
".",
"append",
"(",
"fn_name",
")",
"if",
... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | FancyModelAdmin.add_link | Adds a ``list_display`` attribute that appears as a link to the
django admin change page for the type of object being shown. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to dereference from the corresponding
object, i.e. wha... | awl/admintools.py | def add_link(cls, attr, title='', display=''):
"""Adds a ``list_display`` attribute that appears as a link to the
django admin change page for the type of object being shown. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to deref... | def add_link(cls, attr, title='', display=''):
"""Adds a ``list_display`` attribute that appears as a link to the
django admin change page for the type of object being shown. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to deref... | [
"Adds",
"a",
"list_display",
"attribute",
"that",
"appears",
"as",
"a",
"link",
"to",
"the",
"django",
"admin",
"change",
"page",
"for",
"the",
"type",
"of",
"object",
"being",
"shown",
".",
"Supports",
"double",
"underscore",
"attribute",
"name",
"dereferenci... | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L286-L352 | [
"def",
"add_link",
"(",
"cls",
",",
"attr",
",",
"title",
"=",
"''",
",",
"display",
"=",
"''",
")",
":",
"global",
"klass_count",
"klass_count",
"+=",
"1",
"fn_name",
"=",
"'dyn_fn_%d'",
"%",
"klass_count",
"cls",
".",
"list_display",
".",
"append",
"("... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | FancyModelAdmin.add_object | Adds a ``list_display`` attribute showing an object. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to dereference from the corresponding
object, i.e. what will be lined to. This name supports double
underscore object li... | awl/admintools.py | def add_object(cls, attr, title='', display=''):
"""Adds a ``list_display`` attribute showing an object. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to dereference from the corresponding
object, i.e. what will be lined to.... | def add_object(cls, attr, title='', display=''):
"""Adds a ``list_display`` attribute showing an object. Supports
double underscore attribute name dereferencing.
:param attr:
Name of the attribute to dereference from the corresponding
object, i.e. what will be lined to.... | [
"Adds",
"a",
"list_display",
"attribute",
"showing",
"an",
"object",
".",
"Supports",
"double",
"underscore",
"attribute",
"name",
"dereferencing",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L355-L398 | [
"def",
"add_object",
"(",
"cls",
",",
"attr",
",",
"title",
"=",
"''",
",",
"display",
"=",
"''",
")",
":",
"global",
"klass_count",
"klass_count",
"+=",
"1",
"fn_name",
"=",
"'dyn_fn_%d'",
"%",
"klass_count",
"cls",
".",
"list_display",
".",
"append",
"... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | FancyModelAdmin.add_formatted_field | Adds a ``list_display`` attribute showing a field in the object
using a python %formatted string.
:param field:
Name of the field in the object.
:param format_string:
A old-style (to remain python 2.x compatible) % string formatter
with a single variable ref... | awl/admintools.py | def add_formatted_field(cls, field, format_string, title=''):
"""Adds a ``list_display`` attribute showing a field in the object
using a python %formatted string.
:param field:
Name of the field in the object.
:param format_string:
A old-style (to remain python ... | def add_formatted_field(cls, field, format_string, title=''):
"""Adds a ``list_display`` attribute showing a field in the object
using a python %formatted string.
:param field:
Name of the field in the object.
:param format_string:
A old-style (to remain python ... | [
"Adds",
"a",
"list_display",
"attribute",
"showing",
"a",
"field",
"in",
"the",
"object",
"using",
"a",
"python",
"%formatted",
"string",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/admintools.py#L401-L435 | [
"def",
"add_formatted_field",
"(",
"cls",
",",
"field",
",",
"format_string",
",",
"title",
"=",
"''",
")",
":",
"global",
"klass_count",
"klass_count",
"+=",
"1",
"fn_name",
"=",
"'dyn_fn_%d'",
"%",
"klass_count",
"cls",
".",
"list_display",
".",
"append",
... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | post_required | View decorator that enforces that the method was called using POST.
This decorator can be called with or without parameters. As it is
expected to wrap a view, the first argument of the method being wrapped is
expected to be a ``request`` object.
.. code-block:: python
@post_required
d... | awl/decorators.py | def post_required(method_or_options=[]):
"""View decorator that enforces that the method was called using POST.
This decorator can be called with or without parameters. As it is
expected to wrap a view, the first argument of the method being wrapped is
expected to be a ``request`` object.
.. code-... | def post_required(method_or_options=[]):
"""View decorator that enforces that the method was called using POST.
This decorator can be called with or without parameters. As it is
expected to wrap a view, the first argument of the method being wrapped is
expected to be a ``request`` object.
.. code-... | [
"View",
"decorator",
"that",
"enforces",
"that",
"the",
"method",
"was",
"called",
"using",
"POST",
".",
"This",
"decorator",
"can",
"be",
"called",
"with",
"or",
"without",
"parameters",
".",
"As",
"it",
"is",
"expected",
"to",
"wrap",
"a",
"view",
"the",... | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/decorators.py#L13-L70 | [
"def",
"post_required",
"(",
"method_or_options",
"=",
"[",
"]",
")",
":",
"def",
"decorator",
"(",
"method",
")",
":",
"# handle wrapping or wrapping with arguments; if no arguments (and no",
"# calling parenthesis) then method_or_options will be a list,",
"# otherwise it will be ... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | json_post_required | View decorator that enforces that the method was called using POST and
contains a field containing a JSON dictionary. This method should
only be used to wrap views and assumes the first argument of the method
being wrapped is a ``request`` object.
.. code-block:: python
@json_post_required('da... | awl/decorators.py | def json_post_required(*decorator_args):
"""View decorator that enforces that the method was called using POST and
contains a field containing a JSON dictionary. This method should
only be used to wrap views and assumes the first argument of the method
being wrapped is a ``request`` object.
.. code... | def json_post_required(*decorator_args):
"""View decorator that enforces that the method was called using POST and
contains a field containing a JSON dictionary. This method should
only be used to wrap views and assumes the first argument of the method
being wrapped is a ``request`` object.
.. code... | [
"View",
"decorator",
"that",
"enforces",
"that",
"the",
"method",
"was",
"called",
"using",
"POST",
"and",
"contains",
"a",
"field",
"containing",
"a",
"JSON",
"dictionary",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"to",
"wrap",
"views",
"and",... | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/decorators.py#L73-L117 | [
"def",
"json_post_required",
"(",
"*",
"decorator_args",
")",
":",
"def",
"decorator",
"(",
"method",
")",
":",
"@",
"wraps",
"(",
"method",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"field",
"=",
"decorator_args",
"["... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | hist | Creates a histogram of data *x* with a *bins*, *labels* = :code:`[title, xlabel, ylabel]`. | scisalt/matplotlib/hist.py | def hist(x, bins=10, labels=None, aspect="auto", plot=True, ax=None, range=None):
"""
Creates a histogram of data *x* with a *bins*, *labels* = :code:`[title, xlabel, ylabel]`.
"""
h, edge = _np.histogram(x, bins=bins, range=range)
mids = edge + (edge[1]-edge[0])/2
mids = mids[:-1]
if... | def hist(x, bins=10, labels=None, aspect="auto", plot=True, ax=None, range=None):
"""
Creates a histogram of data *x* with a *bins*, *labels* = :code:`[title, xlabel, ylabel]`.
"""
h, edge = _np.histogram(x, bins=bins, range=range)
mids = edge + (edge[1]-edge[0])/2
mids = mids[:-1]
if... | [
"Creates",
"a",
"histogram",
"of",
"data",
"*",
"x",
"*",
"with",
"a",
"*",
"bins",
"*",
"*",
"labels",
"*",
"=",
":",
"code",
":",
"[",
"title",
"xlabel",
"ylabel",
"]",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/hist.py#L10-L29 | [
"def",
"hist",
"(",
"x",
",",
"bins",
"=",
"10",
",",
"labels",
"=",
"None",
",",
"aspect",
"=",
"\"auto\"",
",",
"plot",
"=",
"True",
",",
"ax",
"=",
"None",
",",
"range",
"=",
"None",
")",
":",
"h",
",",
"edge",
"=",
"_np",
".",
"histogram",
... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Match.sigma | Spot size of matched beam :math:`\\left( \\frac{2 E \\varepsilon_0 }{ n_p e^2 } \\right)^{1/4} \\sqrt{\\epsilon}` | scisalt/PWFA/match.py | def sigma(self):
"""
Spot size of matched beam :math:`\\left( \\frac{2 E \\varepsilon_0 }{ n_p e^2 } \\right)^{1/4} \\sqrt{\\epsilon}`
"""
return _np.power(2*_sltr.GeV2joule(self.E)*_spc.epsilon_0 / (self.plasma.n_p * _np.power(_spc.elementary_charge, 2)) , 0.25) * _np.sqrt(self.emit) | def sigma(self):
"""
Spot size of matched beam :math:`\\left( \\frac{2 E \\varepsilon_0 }{ n_p e^2 } \\right)^{1/4} \\sqrt{\\epsilon}`
"""
return _np.power(2*_sltr.GeV2joule(self.E)*_spc.epsilon_0 / (self.plasma.n_p * _np.power(_spc.elementary_charge, 2)) , 0.25) * _np.sqrt(self.emit) | [
"Spot",
"size",
"of",
"matched",
"beam",
":",
"math",
":",
"\\\\",
"left",
"(",
"\\\\",
"frac",
"{",
"2",
"E",
"\\\\",
"varepsilon_0",
"}",
"{",
"n_p",
"e^2",
"}",
"\\\\",
"right",
")",
"^",
"{",
"1",
"/",
"4",
"}",
"\\\\",
"sqrt",
"{",
"\\\\",
... | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/match.py#L53-L57 | [
"def",
"sigma",
"(",
"self",
")",
":",
"return",
"_np",
".",
"power",
"(",
"2",
"*",
"_sltr",
".",
"GeV2joule",
"(",
"self",
".",
"E",
")",
"*",
"_spc",
".",
"epsilon_0",
"/",
"(",
"self",
".",
"plasma",
".",
"n_p",
"*",
"_np",
".",
"power",
"(... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Match.sigma_prime | Divergence of matched beam | scisalt/PWFA/match.py | def sigma_prime(self):
"""
Divergence of matched beam
"""
return _np.sqrt(self.emit/self.beta(self.E)) | def sigma_prime(self):
"""
Divergence of matched beam
"""
return _np.sqrt(self.emit/self.beta(self.E)) | [
"Divergence",
"of",
"matched",
"beam"
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/match.py#L67-L71 | [
"def",
"sigma_prime",
"(",
"self",
")",
":",
"return",
"_np",
".",
"sqrt",
"(",
"self",
".",
"emit",
"/",
"self",
".",
"beta",
"(",
"self",
".",
"E",
")",
")"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | MatchPlasma.n_p | The plasma density in SI units. | scisalt/PWFA/match.py | def n_p(self):
"""
The plasma density in SI units.
"""
return 2*_sltr.GeV2joule(self.E)*_spc.epsilon_0 / (self.beta*_spc.elementary_charge)**2 | def n_p(self):
"""
The plasma density in SI units.
"""
return 2*_sltr.GeV2joule(self.E)*_spc.epsilon_0 / (self.beta*_spc.elementary_charge)**2 | [
"The",
"plasma",
"density",
"in",
"SI",
"units",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/match.py#L127-L131 | [
"def",
"n_p",
"(",
"self",
")",
":",
"return",
"2",
"*",
"_sltr",
".",
"GeV2joule",
"(",
"self",
".",
"E",
")",
"*",
"_spc",
".",
"epsilon_0",
"/",
"(",
"self",
".",
"beta",
"*",
"_spc",
".",
"elementary_charge",
")",
"**",
"2"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | MatchPlasma.plasma | The matched :class:`Plasma`. | scisalt/PWFA/match.py | def plasma(self, species=_pt.hydrogen):
"""
The matched :class:`Plasma`.
"""
return _Plasma(self.n_p, species=species) | def plasma(self, species=_pt.hydrogen):
"""
The matched :class:`Plasma`.
"""
return _Plasma(self.n_p, species=species) | [
"The",
"matched",
":",
"class",
":",
"Plasma",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/match.py#L141-L145 | [
"def",
"plasma",
"(",
"self",
",",
"species",
"=",
"_pt",
".",
"hydrogen",
")",
":",
"return",
"_Plasma",
"(",
"self",
".",
"n_p",
",",
"species",
"=",
"species",
")"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | main | Semver tag triggered deployment helper | yld/__main__.py | def main(target, label):
"""
Semver tag triggered deployment helper
"""
check_environment(target, label)
click.secho('Fetching tags from the upstream ...')
handler = TagHandler(git.list_tags())
print_information(handler, label)
tag = handler.yield_tag(target, label)
confirm(tag) | def main(target, label):
"""
Semver tag triggered deployment helper
"""
check_environment(target, label)
click.secho('Fetching tags from the upstream ...')
handler = TagHandler(git.list_tags())
print_information(handler, label)
tag = handler.yield_tag(target, label)
confirm(tag) | [
"Semver",
"tag",
"triggered",
"deployment",
"helper"
] | ewilazarus/yld | python | https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/__main__.py#L26-L38 | [
"def",
"main",
"(",
"target",
",",
"label",
")",
":",
"check_environment",
"(",
"target",
",",
"label",
")",
"click",
".",
"secho",
"(",
"'Fetching tags from the upstream ...'",
")",
"handler",
"=",
"TagHandler",
"(",
"git",
".",
"list_tags",
"(",
")",
")",
... | 157e474d1055f14ffdfd7e99da6c77d5f17d4307 |
valid | check_environment | Performs some environment checks prior to the program's execution | yld/__main__.py | def check_environment(target, label):
"""
Performs some environment checks prior to the program's execution
"""
if not git.exists():
click.secho('You must have git installed to use yld.', fg='red')
sys.exit(1)
if not os.path.isdir('.git'):
click.secho('You must cd into a git... | def check_environment(target, label):
"""
Performs some environment checks prior to the program's execution
"""
if not git.exists():
click.secho('You must have git installed to use yld.', fg='red')
sys.exit(1)
if not os.path.isdir('.git'):
click.secho('You must cd into a git... | [
"Performs",
"some",
"environment",
"checks",
"prior",
"to",
"the",
"program",
"s",
"execution"
] | ewilazarus/yld | python | https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/__main__.py#L41-L60 | [
"def",
"check_environment",
"(",
"target",
",",
"label",
")",
":",
"if",
"not",
"git",
".",
"exists",
"(",
")",
":",
"click",
".",
"secho",
"(",
"'You must have git installed to use yld.'",
",",
"fg",
"=",
"'red'",
")",
"sys",
".",
"exit",
"(",
"1",
")",... | 157e474d1055f14ffdfd7e99da6c77d5f17d4307 |
valid | print_information | Prints latest tag's information | yld/__main__.py | def print_information(handler, label):
"""
Prints latest tag's information
"""
click.echo('=> Latest stable: {tag}'.format(
tag=click.style(str(handler.latest_stable or 'N/A'), fg='yellow' if
handler.latest_stable else 'magenta')
))
if label is not None:
... | def print_information(handler, label):
"""
Prints latest tag's information
"""
click.echo('=> Latest stable: {tag}'.format(
tag=click.style(str(handler.latest_stable or 'N/A'), fg='yellow' if
handler.latest_stable else 'magenta')
))
if label is not None:
... | [
"Prints",
"latest",
"tag",
"s",
"information"
] | ewilazarus/yld | python | https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/__main__.py#L63-L78 | [
"def",
"print_information",
"(",
"handler",
",",
"label",
")",
":",
"click",
".",
"echo",
"(",
"'=> Latest stable: {tag}'",
".",
"format",
"(",
"tag",
"=",
"click",
".",
"style",
"(",
"str",
"(",
"handler",
".",
"latest_stable",
"or",
"'N/A'",
")",
",",
... | 157e474d1055f14ffdfd7e99da6c77d5f17d4307 |
valid | confirm | Prompts user before proceeding | yld/__main__.py | def confirm(tag):
"""
Prompts user before proceeding
"""
click.echo()
if click.confirm('Do you want to create the tag {tag}?'.format(
tag=click.style(str(tag), fg='yellow')),
default=True, abort=True):
git.create_tag(tag)
if click.confirm(
'Do you want to pus... | def confirm(tag):
"""
Prompts user before proceeding
"""
click.echo()
if click.confirm('Do you want to create the tag {tag}?'.format(
tag=click.style(str(tag), fg='yellow')),
default=True, abort=True):
git.create_tag(tag)
if click.confirm(
'Do you want to pus... | [
"Prompts",
"user",
"before",
"proceeding"
] | ewilazarus/yld | python | https://github.com/ewilazarus/yld/blob/157e474d1055f14ffdfd7e99da6c77d5f17d4307/yld/__main__.py#L81-L99 | [
"def",
"confirm",
"(",
"tag",
")",
":",
"click",
".",
"echo",
"(",
")",
"if",
"click",
".",
"confirm",
"(",
"'Do you want to create the tag {tag}?'",
".",
"format",
"(",
"tag",
"=",
"click",
".",
"style",
"(",
"str",
"(",
"tag",
")",
",",
"fg",
"=",
... | 157e474d1055f14ffdfd7e99da6c77d5f17d4307 |
valid | imshow | Plots an array *X* such that the first coordinate is the *x* coordinate and the second coordinate is the *y* coordinate, with the origin at the bottom left corner.
Optional argument *ax* allows an existing axes to be used.
*\*\*kwargs* are passed on to :meth:`matplotlib.axes.Axes.imshow`.
.. versionadded... | scisalt/matplotlib/imshow.py | def imshow(X, ax=None, add_cbar=True, rescale_fig=True, **kwargs):
"""
Plots an array *X* such that the first coordinate is the *x* coordinate and the second coordinate is the *y* coordinate, with the origin at the bottom left corner.
Optional argument *ax* allows an existing axes to be used.
*\*\*kwa... | def imshow(X, ax=None, add_cbar=True, rescale_fig=True, **kwargs):
"""
Plots an array *X* such that the first coordinate is the *x* coordinate and the second coordinate is the *y* coordinate, with the origin at the bottom left corner.
Optional argument *ax* allows an existing axes to be used.
*\*\*kwa... | [
"Plots",
"an",
"array",
"*",
"X",
"*",
"such",
"that",
"the",
"first",
"coordinate",
"is",
"the",
"*",
"x",
"*",
"coordinate",
"and",
"the",
"second",
"coordinate",
"is",
"the",
"*",
"y",
"*",
"coordinate",
"with",
"the",
"origin",
"at",
"the",
"bottom... | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/imshow.py#L28-L45 | [
"def",
"imshow",
"(",
"X",
",",
"ax",
"=",
"None",
",",
"add_cbar",
"=",
"True",
",",
"rescale_fig",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_plot_array",
"(",
"X",
",",
"plottype",
"=",
"_IMSHOW",
",",
"ax",
"=",
"ax",
",",
"a... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | scaled_figsize | Given an array *X*, determine a good size for the figure to be by shrinking it to fit within *figsize*. If not specified, shrinks to fit the figsize specified by the current :attr:`matplotlib.rcParams`.
.. versionadded:: 1.3 | scisalt/matplotlib/imshow.py | def scaled_figsize(X, figsize=None, h_pad=None, v_pad=None):
"""
Given an array *X*, determine a good size for the figure to be by shrinking it to fit within *figsize*. If not specified, shrinks to fit the figsize specified by the current :attr:`matplotlib.rcParams`.
.. versionadded:: 1.3
"""
if fi... | def scaled_figsize(X, figsize=None, h_pad=None, v_pad=None):
"""
Given an array *X*, determine a good size for the figure to be by shrinking it to fit within *figsize*. If not specified, shrinks to fit the figsize specified by the current :attr:`matplotlib.rcParams`.
.. versionadded:: 1.3
"""
if fi... | [
"Given",
"an",
"array",
"*",
"X",
"*",
"determine",
"a",
"good",
"size",
"for",
"the",
"figure",
"to",
"be",
"by",
"shrinking",
"it",
"to",
"fit",
"within",
"*",
"figsize",
"*",
".",
"If",
"not",
"specified",
"shrinks",
"to",
"fit",
"the",
"figsize",
... | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/imshow.py#L132-L156 | [
"def",
"scaled_figsize",
"(",
"X",
",",
"figsize",
"=",
"None",
",",
"h_pad",
"=",
"None",
",",
"v_pad",
"=",
"None",
")",
":",
"if",
"figsize",
"is",
"None",
":",
"figsize",
"=",
"_mpl",
".",
"rcParams",
"[",
"'figure.figsize'",
"]",
"# ================... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | get | Gets an array from datasets.
.. versionadded:: 1.4 | scisalt/h5/h5.py | def get(f, key, default=None):
"""
Gets an array from datasets.
.. versionadded:: 1.4
"""
if key in f.keys():
val = f[key].value
if default is None:
return val
else:
if _np.shape(val) == _np.shape(default):
return val
return def... | def get(f, key, default=None):
"""
Gets an array from datasets.
.. versionadded:: 1.4
"""
if key in f.keys():
val = f[key].value
if default is None:
return val
else:
if _np.shape(val) == _np.shape(default):
return val
return def... | [
"Gets",
"an",
"array",
"from",
"datasets",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/h5/h5.py#L28-L44 | [
"def",
"get",
"(",
"f",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"f",
".",
"keys",
"(",
")",
":",
"val",
"=",
"f",
"[",
"key",
"]",
".",
"value",
"if",
"default",
"is",
"None",
":",
"return",
"val",
"else",
":",
... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | FolderDiff.get_state | Get the current directory state | packtex/commands/install.py | def get_state(self):
"""Get the current directory state"""
return [os.path.join(dp, f)
for dp, _, fn in os.walk(self.dir)
for f in fn] | def get_state(self):
"""Get the current directory state"""
return [os.path.join(dp, f)
for dp, _, fn in os.walk(self.dir)
for f in fn] | [
"Get",
"the",
"current",
"directory",
"state"
] | TheKevJames/packtex | python | https://github.com/TheKevJames/packtex/blob/9bb4a2ade47e223ece66156221128138a117f293/packtex/commands/install.py#L65-L69 | [
"def",
"get_state",
"(",
"self",
")",
":",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"dp",
",",
"f",
")",
"for",
"dp",
",",
"_",
",",
"fn",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"dir",
")",
"for",
"f",
"in",
"fn",
"]"
] | 9bb4a2ade47e223ece66156221128138a117f293 |
valid | ProgressBar.tick | Add one tick to progress bar | packtex/commands/install.py | def tick(self):
"""Add one tick to progress bar"""
self.current += 1
if self.current == self.factor:
sys.stdout.write('+')
sys.stdout.flush()
self.current = 0 | def tick(self):
"""Add one tick to progress bar"""
self.current += 1
if self.current == self.factor:
sys.stdout.write('+')
sys.stdout.flush()
self.current = 0 | [
"Add",
"one",
"tick",
"to",
"progress",
"bar"
] | TheKevJames/packtex | python | https://github.com/TheKevJames/packtex/blob/9bb4a2ade47e223ece66156221128138a117f293/packtex/commands/install.py#L99-L105 | [
"def",
"tick",
"(",
"self",
")",
":",
"self",
".",
"current",
"+=",
"1",
"if",
"self",
".",
"current",
"==",
"self",
".",
"factor",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"'+'",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"self",
... | 9bb4a2ade47e223ece66156221128138a117f293 |
valid | DLL.push | Push k to the top of the list
>>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.push(2)
>>> l
[2, 1]
>>> l.push(3)
>>> l
[3, 2, 1] | dllist.py | def push(self, k):
"""Push k to the top of the list
>>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.push(2)
>>> l
[2, 1]
>>> l.push(3)
>>> l
[3, 2, 1]
"""
if not self._first:
# first item
self._f... | def push(self, k):
"""Push k to the top of the list
>>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.push(2)
>>> l
[2, 1]
>>> l.push(3)
>>> l
[3, 2, 1]
"""
if not self._first:
# first item
self._f... | [
"Push",
"k",
"to",
"the",
"top",
"of",
"the",
"list"
] | langloisjp/pysvccache | python | https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/dllist.py#L25-L52 | [
"def",
"push",
"(",
"self",
",",
"k",
")",
":",
"if",
"not",
"self",
".",
"_first",
":",
"# first item",
"self",
".",
"_first",
"=",
"self",
".",
"_last",
"=",
"node",
"=",
"DLL",
".",
"Node",
"(",
"k",
")",
"elif",
"self",
".",
"_first",
".",
... | c4b95f1982f3a99e1f63341d15173099361e549b |
valid | DLL.deletenode | >>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.size()
1
>>> l.deletenode(l._first)
>>> l
[]
>>> l.size()
0
>>> l._index
{}
>>> l._first | dllist.py | def deletenode(self, node):
"""
>>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.size()
1
>>> l.deletenode(l._first)
>>> l
[]
>>> l.size()
0
>>> l._index
{}
>>> l._first
"""
if self._last =... | def deletenode(self, node):
"""
>>> l = DLL()
>>> l.push(1)
>>> l
[1]
>>> l.size()
1
>>> l.deletenode(l._first)
>>> l
[]
>>> l.size()
0
>>> l._index
{}
>>> l._first
"""
if self._last =... | [
">>>",
"l",
"=",
"DLL",
"()",
">>>",
"l",
".",
"push",
"(",
"1",
")",
">>>",
"l",
"[",
"1",
"]",
">>>",
"l",
".",
"size",
"()",
"1",
">>>",
"l",
".",
"deletenode",
"(",
"l",
".",
"_first",
")",
">>>",
"l",
"[]",
">>>",
"l",
".",
"size",
"... | langloisjp/pysvccache | python | https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/dllist.py#L72-L95 | [
"def",
"deletenode",
"(",
"self",
",",
"node",
")",
":",
"if",
"self",
".",
"_last",
"==",
"node",
":",
"self",
".",
"_last",
"=",
"node",
".",
"previous",
"if",
"self",
".",
"_first",
"==",
"node",
":",
"self",
".",
"_first",
"=",
"node",
".",
"... | c4b95f1982f3a99e1f63341d15173099361e549b |
valid | DLL.pop | >>> l = DLL()
>>> l.push(1)
>>> l.pop()
1 | dllist.py | def pop(self):
"""
>>> l = DLL()
>>> l.push(1)
>>> l.pop()
1
"""
k = self._last.value
self.deletenode(self._last)
return k | def pop(self):
"""
>>> l = DLL()
>>> l.push(1)
>>> l.pop()
1
"""
k = self._last.value
self.deletenode(self._last)
return k | [
">>>",
"l",
"=",
"DLL",
"()",
">>>",
"l",
".",
"push",
"(",
"1",
")",
">>>",
"l",
".",
"pop",
"()",
"1"
] | langloisjp/pysvccache | python | https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/dllist.py#L97-L106 | [
"def",
"pop",
"(",
"self",
")",
":",
"k",
"=",
"self",
".",
"_last",
".",
"value",
"self",
".",
"deletenode",
"(",
"self",
".",
"_last",
")",
"return",
"k"
] | c4b95f1982f3a99e1f63341d15173099361e549b |
valid | Counter.increment | Call this method to increment the named counter. This is atomic on
the database.
:param name:
Name for a previously created ``Counter`` object | awl/models.py | def increment(cls, name):
"""Call this method to increment the named counter. This is atomic on
the database.
:param name:
Name for a previously created ``Counter`` object
"""
with transaction.atomic():
counter = Counter.objects.select_for_update().get(... | def increment(cls, name):
"""Call this method to increment the named counter. This is atomic on
the database.
:param name:
Name for a previously created ``Counter`` object
"""
with transaction.atomic():
counter = Counter.objects.select_for_update().get(... | [
"Call",
"this",
"method",
"to",
"increment",
"the",
"named",
"counter",
".",
"This",
"is",
"atomic",
"on",
"the",
"database",
"."
] | cltrudeau/django-awl | python | https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/models.py#L17-L29 | [
"def",
"increment",
"(",
"cls",
",",
"name",
")",
":",
"with",
"transaction",
".",
"atomic",
"(",
")",
":",
"counter",
"=",
"Counter",
".",
"objects",
".",
"select_for_update",
"(",
")",
".",
"get",
"(",
"name",
"=",
"name",
")",
"counter",
".",
"val... | 70d469ef9a161c1170b53aa017cf02d7c15eb90c |
valid | pcolor_axes | Return axes :code:`x, y` for *array* to be used with :func:`matplotlib.pyplot.color`.
*px_to_units* is a function to convert pixels to units. By default, returns pixels. | scisalt/matplotlib/pcolor_axes.py | def pcolor_axes(array, px_to_units=px_to_units):
"""
Return axes :code:`x, y` for *array* to be used with :func:`matplotlib.pyplot.color`.
*px_to_units* is a function to convert pixels to units. By default, returns pixels.
"""
# ======================================
# Coords need to be +1 larg... | def pcolor_axes(array, px_to_units=px_to_units):
"""
Return axes :code:`x, y` for *array* to be used with :func:`matplotlib.pyplot.color`.
*px_to_units* is a function to convert pixels to units. By default, returns pixels.
"""
# ======================================
# Coords need to be +1 larg... | [
"Return",
"axes",
":",
"code",
":",
"x",
"y",
"for",
"*",
"array",
"*",
"to",
"be",
"used",
"with",
":",
"func",
":",
"matplotlib",
".",
"pyplot",
".",
"color",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/pcolor_axes.py#L11-L30 | [
"def",
"pcolor_axes",
"(",
"array",
",",
"px_to_units",
"=",
"px_to_units",
")",
":",
"# ======================================",
"# Coords need to be +1 larger than array",
"# ======================================",
"x_size",
"=",
"array",
".",
"shape",
"[",
"0",
"]",
"+"... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Ions2D.nb0 | On-axis beam density :math:`n_{b,0}`. | scisalt/PWFA/ions2d.py | def nb0(self):
"""
On-axis beam density :math:`n_{b,0}`.
"""
return self.N_e / ( (2*_np.pi)**(3/2) * self.sig_r**2 * self.sig_xi) | def nb0(self):
"""
On-axis beam density :math:`n_{b,0}`.
"""
return self.N_e / ( (2*_np.pi)**(3/2) * self.sig_r**2 * self.sig_xi) | [
"On",
"-",
"axis",
"beam",
"density",
":",
"math",
":",
"n_",
"{",
"b",
"0",
"}",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions2d.py#L73-L77 | [
"def",
"nb0",
"(",
"self",
")",
":",
"return",
"self",
".",
"N_e",
"/",
"(",
"(",
"2",
"*",
"_np",
".",
"pi",
")",
"**",
"(",
"3",
"/",
"2",
")",
"*",
"self",
".",
"sig_r",
"**",
"2",
"*",
"self",
".",
"sig_xi",
")"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Ions2D.lambda_large | The wavelength for large (:math:`r_0 < \\sigma_r`) oscillations. | scisalt/PWFA/ions2d.py | def lambda_large(self, r0):
"""
The wavelength for large (:math:`r_0 < \\sigma_r`) oscillations.
"""
return 2*_np.sqrt(2*_np.pi/self.k)*r0 | def lambda_large(self, r0):
"""
The wavelength for large (:math:`r_0 < \\sigma_r`) oscillations.
"""
return 2*_np.sqrt(2*_np.pi/self.k)*r0 | [
"The",
"wavelength",
"for",
"large",
"(",
":",
"math",
":",
"r_0",
"<",
"\\\\",
"sigma_r",
")",
"oscillations",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions2d.py#L79-L83 | [
"def",
"lambda_large",
"(",
"self",
",",
"r0",
")",
":",
"return",
"2",
"*",
"_np",
".",
"sqrt",
"(",
"2",
"*",
"_np",
".",
"pi",
"/",
"self",
".",
"k",
")",
"*",
"r0"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Ions2D.r_small | Approximate trajectory function for small (:math:`r_0 < \\sigma_r`) oscillations. | scisalt/PWFA/ions2d.py | def r_small(self, x, r0):
"""
Approximate trajectory function for small (:math:`r_0 < \\sigma_r`) oscillations.
"""
return r0*_np.cos(_np.sqrt(self.k_small) * x) | def r_small(self, x, r0):
"""
Approximate trajectory function for small (:math:`r_0 < \\sigma_r`) oscillations.
"""
return r0*_np.cos(_np.sqrt(self.k_small) * x) | [
"Approximate",
"trajectory",
"function",
"for",
"small",
"(",
":",
"math",
":",
"r_0",
"<",
"\\\\",
"sigma_r",
")",
"oscillations",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions2d.py#L85-L89 | [
"def",
"r_small",
"(",
"self",
",",
"x",
",",
"r0",
")",
":",
"return",
"r0",
"*",
"_np",
".",
"cos",
"(",
"_np",
".",
"sqrt",
"(",
"self",
".",
"k_small",
")",
"*",
"x",
")"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Ions2D.r_large | Approximate trajectory function for large (:math:`r_0 > \\sigma_r`) oscillations. | scisalt/PWFA/ions2d.py | def r_large(self, x, r0):
"""
Approximate trajectory function for large (:math:`r_0 > \\sigma_r`) oscillations.
"""
return r0*_np.cos(x*self.omega_big(r0)) | def r_large(self, x, r0):
"""
Approximate trajectory function for large (:math:`r_0 > \\sigma_r`) oscillations.
"""
return r0*_np.cos(x*self.omega_big(r0)) | [
"Approximate",
"trajectory",
"function",
"for",
"large",
"(",
":",
"math",
":",
"r_0",
">",
"\\\\",
"sigma_r",
")",
"oscillations",
"."
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions2d.py#L91-L95 | [
"def",
"r_large",
"(",
"self",
",",
"x",
",",
"r0",
")",
":",
"return",
"r0",
"*",
"_np",
".",
"cos",
"(",
"x",
"*",
"self",
".",
"omega_big",
"(",
"r0",
")",
")"
] | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Ions2D.k | Driving force term: :math:`r'' = -k \\left( \\frac{1-e^{-r^2/2{\\sigma_r}^2}}{r} \\right)` | scisalt/PWFA/ions2d.py | def k(self):
"""
Driving force term: :math:`r'' = -k \\left( \\frac{1-e^{-r^2/2{\\sigma_r}^2}}{r} \\right)`
"""
try:
return self._k
except AttributeError:
self._k = e**2 * self.N_e / ( (2*_np.pi)**(5/2) * e0 * self.m * c**2 * self.sig_xi)
retur... | def k(self):
"""
Driving force term: :math:`r'' = -k \\left( \\frac{1-e^{-r^2/2{\\sigma_r}^2}}{r} \\right)`
"""
try:
return self._k
except AttributeError:
self._k = e**2 * self.N_e / ( (2*_np.pi)**(5/2) * e0 * self.m * c**2 * self.sig_xi)
retur... | [
"Driving",
"force",
"term",
":",
":",
"math",
":",
"r",
"=",
"-",
"k",
"\\\\",
"left",
"(",
"\\\\",
"frac",
"{",
"1",
"-",
"e^",
"{",
"-",
"r^2",
"/",
"2",
"{",
"\\\\",
"sigma_r",
"}",
"^2",
"}}",
"{",
"r",
"}",
"\\\\",
"right",
")"
] | joelfrederico/SciSalt | python | https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/ions2d.py#L98-L106 | [
"def",
"k",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_k",
"except",
"AttributeError",
":",
"self",
".",
"_k",
"=",
"e",
"**",
"2",
"*",
"self",
".",
"N_e",
"/",
"(",
"(",
"2",
"*",
"_np",
".",
"pi",
")",
"**",
"(",
"5",
"/... | 7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f |
valid | Component.print_loading | print loading message on screen
.. note::
loading message only write to `sys.stdout`
:param int wait: seconds to wait
:param str message: message to print
:return: None | cliez/component.py | def print_loading(self, wait, message):
"""
print loading message on screen
.. note::
loading message only write to `sys.stdout`
:param int wait: seconds to wait
:param str message: message to print
:return: None
"""
tags = ['\\', '|', '/',... | def print_loading(self, wait, message):
"""
print loading message on screen
.. note::
loading message only write to `sys.stdout`
:param int wait: seconds to wait
:param str message: message to print
:return: None
"""
tags = ['\\', '|', '/',... | [
"print",
"loading",
"message",
"on",
"screen"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L53-L80 | [
"def",
"print_loading",
"(",
"self",
",",
"wait",
",",
"message",
")",
":",
"tags",
"=",
"[",
"'\\\\'",
",",
"'|'",
",",
"'/'",
",",
"'-'",
"]",
"for",
"i",
"in",
"range",
"(",
"wait",
")",
":",
"time",
".",
"sleep",
"(",
"0.25",
")",
"sys",
".... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Component.warn_message | print warn type message,
if file handle is `sys.stdout`, print color message
:param str message: message to print
:param file fh: file handle,default is `sys.stdout`
:param str prefix: message prefix,default is `[warn]`
:param str suffix: message suffix ,default is `...`
... | cliez/component.py | def warn_message(self, message, fh=None, prefix="[warn]:", suffix="..."):
"""
print warn type message,
if file handle is `sys.stdout`, print color message
:param str message: message to print
:param file fh: file handle,default is `sys.stdout`
:param str prefix: message... | def warn_message(self, message, fh=None, prefix="[warn]:", suffix="..."):
"""
print warn type message,
if file handle is `sys.stdout`, print color message
:param str message: message to print
:param file fh: file handle,default is `sys.stdout`
:param str prefix: message... | [
"print",
"warn",
"type",
"message",
"if",
"file",
"handle",
"is",
"sys",
".",
"stdout",
"print",
"color",
"message"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L82-L103 | [
"def",
"warn_message",
"(",
"self",
",",
"message",
",",
"fh",
"=",
"None",
",",
"prefix",
"=",
"\"[warn]:\"",
",",
"suffix",
"=",
"\"...\"",
")",
":",
"msg",
"=",
"prefix",
"+",
"message",
"+",
"suffix",
"fh",
"=",
"fh",
"or",
"sys",
".",
"stdout",
... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Component.error_message | print error type message
if file handle is `sys.stderr`, print color message
:param str message: message to print
:param file fh: file handle, default is `sys.stdout`
:param str prefix: message prefix,default is `[error]`
:param str suffix: message suffix ,default is '...'
... | cliez/component.py | def error_message(self, message, fh=None, prefix="[error]:",
suffix="..."):
"""
print error type message
if file handle is `sys.stderr`, print color message
:param str message: message to print
:param file fh: file handle, default is `sys.stdout`
:p... | def error_message(self, message, fh=None, prefix="[error]:",
suffix="..."):
"""
print error type message
if file handle is `sys.stderr`, print color message
:param str message: message to print
:param file fh: file handle, default is `sys.stdout`
:p... | [
"print",
"error",
"type",
"message",
"if",
"file",
"handle",
"is",
"sys",
".",
"stderr",
"print",
"color",
"message"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L112-L132 | [
"def",
"error_message",
"(",
"self",
",",
"message",
",",
"fh",
"=",
"None",
",",
"prefix",
"=",
"\"[error]:\"",
",",
"suffix",
"=",
"\"...\"",
")",
":",
"msg",
"=",
"prefix",
"+",
"message",
"+",
"suffix",
"fh",
"=",
"fh",
"or",
"sys",
".",
"stderr"... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Component.system | a built-in wrapper make dry-run easier.
you should use this instead use `os.system`
.. note::
to use it,you need add '--dry-run' option in
your argparser options
:param str cmd: command to execute
:param bool fake_code: only display command
when is... | cliez/component.py | def system(self, cmd, fake_code=False):
"""
a built-in wrapper make dry-run easier.
you should use this instead use `os.system`
.. note::
to use it,you need add '--dry-run' option in
your argparser options
:param str cmd: command to execute
:pa... | def system(self, cmd, fake_code=False):
"""
a built-in wrapper make dry-run easier.
you should use this instead use `os.system`
.. note::
to use it,you need add '--dry-run' option in
your argparser options
:param str cmd: command to execute
:pa... | [
"a",
"built",
"-",
"in",
"wrapper",
"make",
"dry",
"-",
"run",
"easier",
".",
"you",
"should",
"use",
"this",
"instead",
"use",
"os",
".",
"system"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L147-L176 | [
"def",
"system",
"(",
"self",
",",
"cmd",
",",
"fake_code",
"=",
"False",
")",
":",
"try",
":",
"if",
"self",
".",
"options",
".",
"dry_run",
":",
"def",
"fake_system",
"(",
"cmd",
")",
":",
"self",
".",
"print_message",
"(",
"cmd",
")",
"return",
... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Component.load_resource | .. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
load resource file which in package.
this method is used to load file easier in different environment.
e.g:
consume we have a file named `resource.io` in package `cliez.conf`,
a... | cliez/component.py | def load_resource(path, root=''):
"""
.. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
load resource file which in package.
this method is used to load file easier in different environment.
e.g:
consume we have a file ... | def load_resource(path, root=''):
"""
.. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
load resource file which in package.
this method is used to load file easier in different environment.
e.g:
consume we have a file ... | [
"..",
"warning",
"::"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L179-L254 | [
"def",
"load_resource",
"(",
"path",
",",
"root",
"=",
"''",
")",
":",
"if",
"root",
":",
"full_path",
"=",
"root",
"+",
"'/'",
"+",
"path",
".",
"strip",
"(",
"'/'",
")",
"else",
":",
"full_path",
"=",
"path",
"buf",
"=",
"''",
"try",
":",
"buf"... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Component.load_description | .. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
Load resource file as description,
if resource file not exist,will return empty string.
:param str path: name resource path
:param str root: same as `load_resource` root
:return:... | cliez/component.py | def load_description(name, root=''):
"""
.. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
Load resource file as description,
if resource file not exist,will return empty string.
:param str path: name resource path
:para... | def load_description(name, root=''):
"""
.. warning::
Experiment feature.
BE CAREFUL! WE MAY REMOVE THIS FEATURE!
Load resource file as description,
if resource file not exist,will return empty string.
:param str path: name resource path
:para... | [
"..",
"warning",
"::"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/component.py#L257-L280 | [
"def",
"load_description",
"(",
"name",
",",
"root",
"=",
"''",
")",
":",
"desc",
"=",
"''",
"try",
":",
"desc",
"=",
"Component",
".",
"load_resource",
"(",
"name",
",",
"root",
"=",
"root",
")",
"except",
"(",
"IOError",
",",
"ImportError",
")",
":... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | Firebase_sync.name | Returns the name of the Firebase. If a Firebase instance points to
'https://my_firebase.firebaseio.com/users' its name would be 'users' | firecall/sync.py | def name(self):
'''
Returns the name of the Firebase. If a Firebase instance points to
'https://my_firebase.firebaseio.com/users' its name would be 'users'
'''
i = self.__url.rfind('/')
if self.__url[:i] == 'https:/':
return "/"
return self.__url[i+1:] | def name(self):
'''
Returns the name of the Firebase. If a Firebase instance points to
'https://my_firebase.firebaseio.com/users' its name would be 'users'
'''
i = self.__url.rfind('/')
if self.__url[:i] == 'https:/':
return "/"
return self.__url[i+1:] | [
"Returns",
"the",
"name",
"of",
"the",
"Firebase",
".",
"If",
"a",
"Firebase",
"instance",
"points",
"to",
"https",
":",
"//",
"my_firebase",
".",
"firebaseio",
".",
"com",
"/",
"users",
"its",
"name",
"would",
"be",
"users"
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L45-L53 | [
"def",
"name",
"(",
"self",
")",
":",
"i",
"=",
"self",
".",
"__url",
".",
"rfind",
"(",
"'/'",
")",
"if",
"self",
".",
"__url",
"[",
":",
"i",
"]",
"==",
"'https:/'",
":",
"return",
"\"/\"",
"return",
"self",
".",
"__url",
"[",
"i",
"+",
"1",
... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.url_correct | Returns a Corrected URL to be used for a Request
as per the REST API. | firecall/sync.py | def url_correct(self, point, auth=None, export=None):
'''
Returns a Corrected URL to be used for a Request
as per the REST API.
'''
newUrl = self.__url + point + '.json'
if auth or export:
newUrl += "?"
if auth:
newUrl += ("auth=" + auth)
... | def url_correct(self, point, auth=None, export=None):
'''
Returns a Corrected URL to be used for a Request
as per the REST API.
'''
newUrl = self.__url + point + '.json'
if auth or export:
newUrl += "?"
if auth:
newUrl += ("auth=" + auth)
... | [
"Returns",
"a",
"Corrected",
"URL",
"to",
"be",
"used",
"for",
"a",
"Request",
"as",
"per",
"the",
"REST",
"API",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L59-L73 | [
"def",
"url_correct",
"(",
"self",
",",
"point",
",",
"auth",
"=",
"None",
",",
"export",
"=",
"None",
")",
":",
"newUrl",
"=",
"self",
".",
"__url",
"+",
"point",
"+",
"'.json'",
"if",
"auth",
"or",
"export",
":",
"newUrl",
"+=",
"\"?\"",
"if",
"a... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.__read | Reads a File with contents in correct JSON format.
Returns the data as Python objects.
path - (string) path to the file | firecall/sync.py | def __read(path):
'''
Reads a File with contents in correct JSON format.
Returns the data as Python objects.
path - (string) path to the file
'''
try:
with open(path, 'r') as data_file:
data = data_file.read()
data = json.loads(... | def __read(path):
'''
Reads a File with contents in correct JSON format.
Returns the data as Python objects.
path - (string) path to the file
'''
try:
with open(path, 'r') as data_file:
data = data_file.read()
data = json.loads(... | [
"Reads",
"a",
"File",
"with",
"contents",
"in",
"correct",
"JSON",
"format",
".",
"Returns",
"the",
"data",
"as",
"Python",
"objects",
".",
"path",
"-",
"(",
"string",
")",
"path",
"to",
"the",
"file"
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L76-L91 | [
"def",
"__read",
"(",
"path",
")",
":",
"try",
":",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"data_file",
":",
"data",
"=",
"data_file",
".",
"read",
"(",
")",
"data",
"=",
"json",
".",
"loads",
"(",
"data",
")",
"return",
"data",
"exc... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.__write | Writes to a File. Returns the data written.
path - (string) path to the file to write to.
data - (json) data from a request.
mode - (string) mode to open the file in. Default to 'w'. Overwrites. | firecall/sync.py | def __write(path, data, mode="w"):
'''
Writes to a File. Returns the data written.
path - (string) path to the file to write to.
data - (json) data from a request.
mode - (string) mode to open the file in. Default to 'w'. Overwrites.
'''
with open(path, mode) as d... | def __write(path, data, mode="w"):
'''
Writes to a File. Returns the data written.
path - (string) path to the file to write to.
data - (json) data from a request.
mode - (string) mode to open the file in. Default to 'w'. Overwrites.
'''
with open(path, mode) as d... | [
"Writes",
"to",
"a",
"File",
".",
"Returns",
"the",
"data",
"written",
".",
"path",
"-",
"(",
"string",
")",
"path",
"to",
"the",
"file",
"to",
"write",
"to",
".",
"data",
"-",
"(",
"json",
")",
"data",
"from",
"a",
"request",
".",
"mode",
"-",
"... | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L94-L104 | [
"def",
"__write",
"(",
"path",
",",
"data",
",",
"mode",
"=",
"\"w\"",
")",
":",
"with",
"open",
"(",
"path",
",",
"mode",
")",
"as",
"data_file",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
",",
"indent",
"=",
"4",
")",
"data_file",
"."... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.amust | Requires the User to provide a certain parameter
for the method to function properly.
Else, an Exception is raised.
args - (tuple) arguments you are looking for.
argv - (dict) arguments you have received and want to inspect. | firecall/sync.py | def amust(self, args, argv):
'''
Requires the User to provide a certain parameter
for the method to function properly.
Else, an Exception is raised.
args - (tuple) arguments you are looking for.
argv - (dict) arguments you have received and want to inspect.
'''
... | def amust(self, args, argv):
'''
Requires the User to provide a certain parameter
for the method to function properly.
Else, an Exception is raised.
args - (tuple) arguments you are looking for.
argv - (dict) arguments you have received and want to inspect.
'''
... | [
"Requires",
"the",
"User",
"to",
"provide",
"a",
"certain",
"parameter",
"for",
"the",
"method",
"to",
"function",
"properly",
".",
"Else",
"an",
"Exception",
"is",
"raised",
".",
"args",
"-",
"(",
"tuple",
")",
"arguments",
"you",
"are",
"looking",
"for",... | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L106-L116 | [
"def",
"amust",
"(",
"self",
",",
"args",
",",
"argv",
")",
":",
"for",
"arg",
"in",
"args",
":",
"if",
"str",
"(",
"arg",
")",
"not",
"in",
"argv",
":",
"raise",
"KeyError",
"(",
"\"ArgMissing: \"",
"+",
"str",
"(",
"arg",
")",
"+",
"\" not passed... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.catch_error | Checks for Errors in a Response.
401 or 403 - Security Rules Violation.
404 or 417 - Firebase NOT Found.
response - (Request.Response) - response from a request. | firecall/sync.py | def catch_error(response):
'''
Checks for Errors in a Response.
401 or 403 - Security Rules Violation.
404 or 417 - Firebase NOT Found.
response - (Request.Response) - response from a request.
'''
status = response.status_code
if status == 401 or status ==... | def catch_error(response):
'''
Checks for Errors in a Response.
401 or 403 - Security Rules Violation.
404 or 417 - Firebase NOT Found.
response - (Request.Response) - response from a request.
'''
status = response.status_code
if status == 401 or status ==... | [
"Checks",
"for",
"Errors",
"in",
"a",
"Response",
".",
"401",
"or",
"403",
"-",
"Security",
"Rules",
"Violation",
".",
"404",
"or",
"417",
"-",
"Firebase",
"NOT",
"Found",
".",
"response",
"-",
"(",
"Request",
".",
"Response",
")",
"-",
"response",
"fr... | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L119-L130 | [
"def",
"catch_error",
"(",
"response",
")",
":",
"status",
"=",
"response",
".",
"status_code",
"if",
"status",
"==",
"401",
"or",
"status",
"==",
"403",
":",
"raise",
"EnvironmentError",
"(",
"\"Forbidden\"",
")",
"elif",
"status",
"==",
"417",
"or",
"sta... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.get_sync | GET: gets data from the Firebase.
Requires the 'point' parameter as a keyworded argument. | firecall/sync.py | def get_sync(self, **kwargs):
'''
GET: gets data from the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.get(self.url_correct(kwargs["point"],
kwargs.get("auth", sel... | def get_sync(self, **kwargs):
'''
GET: gets data from the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.get(self.url_correct(kwargs["point"],
kwargs.get("auth", sel... | [
"GET",
":",
"gets",
"data",
"from",
"the",
"Firebase",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L132-L141 | [
"def",
"get_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
")",
",",
"kwargs",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"url_correct",
"(",
"kwargs",
"[",
"\"point\"",
... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.put_sync | PUT: puts data into the Firebase.
Requires the 'point' parameter as a keyworded argument. | firecall/sync.py | def put_sync(self, **kwargs):
'''
PUT: puts data into the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point", "data"), kwargs)
response = requests.put(self.url_correct(kwargs["point"],
kwargs.get("aut... | def put_sync(self, **kwargs):
'''
PUT: puts data into the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point", "data"), kwargs)
response = requests.put(self.url_correct(kwargs["point"],
kwargs.get("aut... | [
"PUT",
":",
"puts",
"data",
"into",
"the",
"Firebase",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L144-L154 | [
"def",
"put_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
"\"data\"",
")",
",",
"kwargs",
")",
"response",
"=",
"requests",
".",
"put",
"(",
"self",
".",
"url_correct",
"(",
"kwargs",
"[",
... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.post_sync | POST: post data to a Firebase.
Requires the 'point' parameter as a keyworded argument.
Note: Firebase will give it a randomized "key"
and the data will be the "value". Thus a key-value pair | firecall/sync.py | def post_sync(self, **kwargs):
'''
POST: post data to a Firebase.
Requires the 'point' parameter as a keyworded argument.
Note: Firebase will give it a randomized "key"
and the data will be the "value". Thus a key-value pair
'''
self.amust(("point", "data"), kwar... | def post_sync(self, **kwargs):
'''
POST: post data to a Firebase.
Requires the 'point' parameter as a keyworded argument.
Note: Firebase will give it a randomized "key"
and the data will be the "value". Thus a key-value pair
'''
self.amust(("point", "data"), kwar... | [
"POST",
":",
"post",
"data",
"to",
"a",
"Firebase",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
".",
"Note",
":",
"Firebase",
"will",
"give",
"it",
"a",
"randomized",
"key",
"and",
"the",
"data",
"will",
"be",
"the",... | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L156-L169 | [
"def",
"post_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
"\"data\"",
")",
",",
"kwargs",
")",
"response",
"=",
"requests",
".",
"post",
"(",
"self",
".",
"url_correct",
"(",
"kwargs",
"[",
... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.update_sync | UPDATE: updates data in the Firebase.
Requires the 'point' parameter as a keyworded argument. | firecall/sync.py | def update_sync(self, **kwargs):
'''
UPDATE: updates data in the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point", "data"), kwargs)
# Sending the 'PATCH' request
response = requests.patch(self.url_correct(
kwarg... | def update_sync(self, **kwargs):
'''
UPDATE: updates data in the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point", "data"), kwargs)
# Sending the 'PATCH' request
response = requests.patch(self.url_correct(
kwarg... | [
"UPDATE",
":",
"updates",
"data",
"in",
"the",
"Firebase",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L172-L184 | [
"def",
"update_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
"\"data\"",
")",
",",
"kwargs",
")",
"# Sending the 'PATCH' request",
"response",
"=",
"requests",
".",
"patch",
"(",
"self",
".",
"ur... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.delete_sync | DELETE: delete data in the Firebase.
Requires the 'point' parameter as a keyworded argument. | firecall/sync.py | def delete_sync(self, **kwargs):
'''
DELETE: delete data in the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.delete(self.url_correct(
kwargs["point"],
kwargs.get("auth", se... | def delete_sync(self, **kwargs):
'''
DELETE: delete data in the Firebase.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.delete(self.url_correct(
kwargs["point"],
kwargs.get("auth", se... | [
"DELETE",
":",
"delete",
"data",
"in",
"the",
"Firebase",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L186-L196 | [
"def",
"delete_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
")",
",",
"kwargs",
")",
"response",
"=",
"requests",
".",
"delete",
"(",
"self",
".",
"url_correct",
"(",
"kwargs",
"[",
"\"point... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | Firebase_sync.export_sync | EXPORT: exports data from the Firebase into a File, if given.
Requires the 'point' parameter as a keyworded argument. | firecall/sync.py | def export_sync(self, **kwargs):
'''
EXPORT: exports data from the Firebase into a File, if given.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.get(self.url_correct(kwargs["point"],
... | def export_sync(self, **kwargs):
'''
EXPORT: exports data from the Firebase into a File, if given.
Requires the 'point' parameter as a keyworded argument.
'''
self.amust(("point",), kwargs)
response = requests.get(self.url_correct(kwargs["point"],
... | [
"EXPORT",
":",
"exports",
"data",
"from",
"the",
"Firebase",
"into",
"a",
"File",
"if",
"given",
".",
"Requires",
"the",
"point",
"parameter",
"as",
"a",
"keyworded",
"argument",
"."
] | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/sync.py#L198-L210 | [
"def",
"export_sync",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"amust",
"(",
"(",
"\"point\"",
",",
")",
",",
"kwargs",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"url_correct",
"(",
"kwargs",
"[",
"\"point\""... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | superable | Provide .__super in python 2.x classes without having to specify the current
class name each time super is used (DRY principle). | supertools/__init__.py | def superable(cls) :
'''Provide .__super in python 2.x classes without having to specify the current
class name each time super is used (DRY principle).'''
name = cls.__name__
super_name = '_%s__super' % (name,)
setattr(cls,super_name,super(cls))
return cls | def superable(cls) :
'''Provide .__super in python 2.x classes without having to specify the current
class name each time super is used (DRY principle).'''
name = cls.__name__
super_name = '_%s__super' % (name,)
setattr(cls,super_name,super(cls))
return cls | [
"Provide",
".",
"__super",
"in",
"python",
"2",
".",
"x",
"classes",
"without",
"having",
"to",
"specify",
"the",
"current",
"class",
"name",
"each",
"time",
"super",
"is",
"used",
"(",
"DRY",
"principle",
")",
"."
] | gissehel/supertools | python | https://github.com/gissehel/supertools/blob/566bb6f8869082b247d96cb1fd7ccf948e3ba30f/supertools/__init__.py#L1-L7 | [
"def",
"superable",
"(",
"cls",
")",
":",
"name",
"=",
"cls",
".",
"__name__",
"super_name",
"=",
"'_%s__super'",
"%",
"(",
"name",
",",
")",
"setattr",
"(",
"cls",
",",
"super_name",
",",
"super",
"(",
"cls",
")",
")",
"return",
"cls"
] | 566bb6f8869082b247d96cb1fd7ccf948e3ba30f |
valid | main | Main method.
This method holds what you want to execute when
the script is run on command line. | _CI/bin/bump.py | def main():
"""
Main method.
This method holds what you want to execute when
the script is run on command line.
"""
args = get_arguments()
setup_logging(args)
version_path = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'..',
'..',
'.VERSION'
... | def main():
"""
Main method.
This method holds what you want to execute when
the script is run on command line.
"""
args = get_arguments()
setup_logging(args)
version_path = os.path.abspath(os.path.join(
os.path.dirname(__file__),
'..',
'..',
'.VERSION'
... | [
"Main",
"method",
"."
] | costastf/gitwrapperlib | python | https://github.com/costastf/gitwrapperlib/blob/3d7ab65fee906e30e4fa4608c4b2fdc266e5af6d/_CI/bin/bump.py#L80-L131 | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"get_arguments",
"(",
")",
"setup_logging",
"(",
"args",
")",
"version_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__fi... | 3d7ab65fee906e30e4fa4608c4b2fdc266e5af6d |
valid | valid_url | Validates a Firebase URL. A valid URL must exhibit:
- Protocol must be HTTPS
- Domain Must be firebaseio.com
- firebasename can only contain:
- hyphen, small and capital letters
- firebasename can not have leading and trailing hyphens
- childnames can not contain:
- period, dollar ... | firecall/general.py | def valid_url(name):
'''
Validates a Firebase URL. A valid URL must exhibit:
- Protocol must be HTTPS
- Domain Must be firebaseio.com
- firebasename can only contain:
- hyphen, small and capital letters
- firebasename can not have leading and trailing hyphens
- childnames can not c... | def valid_url(name):
'''
Validates a Firebase URL. A valid URL must exhibit:
- Protocol must be HTTPS
- Domain Must be firebaseio.com
- firebasename can only contain:
- hyphen, small and capital letters
- firebasename can not have leading and trailing hyphens
- childnames can not c... | [
"Validates",
"a",
"Firebase",
"URL",
".",
"A",
"valid",
"URL",
"must",
"exhibit",
":",
"-",
"Protocol",
"must",
"be",
"HTTPS",
"-",
"Domain",
"Must",
"be",
"firebaseio",
".",
"com",
"-",
"firebasename",
"can",
"only",
"contain",
":",
"-",
"hyphen",
"smal... | GochoMugo/firecall | python | https://github.com/GochoMugo/firecall/blob/6b99ff72b3c056f51a5901f2be32030c7e68961a/firecall/general.py#L9-L31 | [
"def",
"valid_url",
"(",
"name",
")",
":",
"try",
":",
"pattern",
"=",
"r'^https://([a-zA-Z0-9][a-zA-Z0-9\\-]+[a-zA-Z0-9]).firebaseio.com(/[^\\#\\$\\[\\]\\.\\x00-\\x1F\\x7F]*)'",
"result",
"=",
"re",
".",
"search",
"(",
"pattern",
",",
"name",
"+",
"'/'",
")",
".",
"g... | 6b99ff72b3c056f51a5901f2be32030c7e68961a |
valid | pickle | Pickle and compress. | pickle_blosc/_core.py | def pickle(obj, filepath):
"""Pickle and compress."""
arr = pkl.dumps(obj, -1)
with open(filepath, 'wb') as f:
s = 0
while s < len(arr):
e = min(s + blosc.MAX_BUFFERSIZE, len(arr))
carr = blosc.compress(arr[s:e], typesize=8)
f.write(carr)
s = e | def pickle(obj, filepath):
"""Pickle and compress."""
arr = pkl.dumps(obj, -1)
with open(filepath, 'wb') as f:
s = 0
while s < len(arr):
e = min(s + blosc.MAX_BUFFERSIZE, len(arr))
carr = blosc.compress(arr[s:e], typesize=8)
f.write(carr)
s = e | [
"Pickle",
"and",
"compress",
"."
] | limix/pickle-blosc | python | https://github.com/limix/pickle-blosc/blob/69d3b1c41813e02854d71a3f2911124aa9233fd0/pickle_blosc/_core.py#L11-L20 | [
"def",
"pickle",
"(",
"obj",
",",
"filepath",
")",
":",
"arr",
"=",
"pkl",
".",
"dumps",
"(",
"obj",
",",
"-",
"1",
")",
"with",
"open",
"(",
"filepath",
",",
"'wb'",
")",
"as",
"f",
":",
"s",
"=",
"0",
"while",
"s",
"<",
"len",
"(",
"arr",
... | 69d3b1c41813e02854d71a3f2911124aa9233fd0 |
valid | unpickle | Decompress and unpickle. | pickle_blosc/_core.py | def unpickle(filepath):
"""Decompress and unpickle."""
arr = []
with open(filepath, 'rb') as f:
carr = f.read(blosc.MAX_BUFFERSIZE)
while len(carr) > 0:
arr.append(blosc.decompress(carr))
carr = f.read(blosc.MAX_BUFFERSIZE)
return pkl.loads(b"".join(arr)) | def unpickle(filepath):
"""Decompress and unpickle."""
arr = []
with open(filepath, 'rb') as f:
carr = f.read(blosc.MAX_BUFFERSIZE)
while len(carr) > 0:
arr.append(blosc.decompress(carr))
carr = f.read(blosc.MAX_BUFFERSIZE)
return pkl.loads(b"".join(arr)) | [
"Decompress",
"and",
"unpickle",
"."
] | limix/pickle-blosc | python | https://github.com/limix/pickle-blosc/blob/69d3b1c41813e02854d71a3f2911124aa9233fd0/pickle_blosc/_core.py#L23-L31 | [
"def",
"unpickle",
"(",
"filepath",
")",
":",
"arr",
"=",
"[",
"]",
"with",
"open",
"(",
"filepath",
",",
"'rb'",
")",
"as",
"f",
":",
"carr",
"=",
"f",
".",
"read",
"(",
"blosc",
".",
"MAX_BUFFERSIZE",
")",
"while",
"len",
"(",
"carr",
")",
">",... | 69d3b1c41813e02854d71a3f2911124aa9233fd0 |
valid | contact | Displays the contact form and sends the email | src/geelweb/django/contactform/views.py | def contact(request):
"""Displays the contact form and sends the email"""
form = ContactForm(request.POST or None)
if form.is_valid():
subject = form.cleaned_data['subject']
message = form.cleaned_data['message']
sender = form.cleaned_data['sender']
cc_myself = form.cleaned_d... | def contact(request):
"""Displays the contact form and sends the email"""
form = ContactForm(request.POST or None)
if form.is_valid():
subject = form.cleaned_data['subject']
message = form.cleaned_data['message']
sender = form.cleaned_data['sender']
cc_myself = form.cleaned_d... | [
"Displays",
"the",
"contact",
"form",
"and",
"sends",
"the",
"email"
] | geelweb/geelweb-django-contactform | python | https://github.com/geelweb/geelweb-django-contactform/blob/9c5934e0877f61c3ddeca48569836703e1d6344a/src/geelweb/django/contactform/views.py#L12-L29 | [
"def",
"contact",
"(",
"request",
")",
":",
"form",
"=",
"ContactForm",
"(",
"request",
".",
"POST",
"or",
"None",
")",
"if",
"form",
".",
"is_valid",
"(",
")",
":",
"subject",
"=",
"form",
".",
"cleaned_data",
"[",
"'subject'",
"]",
"message",
"=",
... | 9c5934e0877f61c3ddeca48569836703e1d6344a |
valid | InitComponent.load_gitconfig | try use gitconfig info.
author,email etc. | cliez/components/init.py | def load_gitconfig(self):
"""
try use gitconfig info.
author,email etc.
"""
gitconfig_path = os.path.expanduser('~/.gitconfig')
if os.path.exists(gitconfig_path):
parser = Parser()
parser.read(gitconfig_path)
parser.sections()
... | def load_gitconfig(self):
"""
try use gitconfig info.
author,email etc.
"""
gitconfig_path = os.path.expanduser('~/.gitconfig')
if os.path.exists(gitconfig_path):
parser = Parser()
parser.read(gitconfig_path)
parser.sections()
... | [
"try",
"use",
"gitconfig",
"info",
".",
"author",
"email",
"etc",
"."
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/components/init.py#L29-L42 | [
"def",
"load_gitconfig",
"(",
"self",
")",
":",
"gitconfig_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~/.gitconfig'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"gitconfig_path",
")",
":",
"parser",
"=",
"Parser",
"(",
")",
"parser",... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | InitComponent.render | render template string to user string
:param str match_string: template string,syntax: '___VAR___'
:param str new_string: user string
:return: | cliez/components/init.py | def render(self, match_string, new_string):
"""
render template string to user string
:param str match_string: template string,syntax: '___VAR___'
:param str new_string: user string
:return:
"""
current_dir = self.options.dir
# safe check,we don't allow ... | def render(self, match_string, new_string):
"""
render template string to user string
:param str match_string: template string,syntax: '___VAR___'
:param str new_string: user string
:return:
"""
current_dir = self.options.dir
# safe check,we don't allow ... | [
"render",
"template",
"string",
"to",
"user",
"string",
":",
"param",
"str",
"match_string",
":",
"template",
"string",
"syntax",
":",
"___VAR___",
":",
"param",
"str",
"new_string",
":",
"user",
"string",
":",
"return",
":"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/components/init.py#L44-L144 | [
"def",
"render",
"(",
"self",
",",
"match_string",
",",
"new_string",
")",
":",
"current_dir",
"=",
"self",
".",
"options",
".",
"dir",
"# safe check,we don't allow handle system root and user root.",
"if",
"os",
".",
"path",
".",
"expanduser",
"(",
"current_dir",
... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | InitComponent.add_arguments | Init project. | cliez/components/init.py | def add_arguments(cls):
"""
Init project.
"""
return [
(('--yes',), dict(action='store_true', help='clean .git repo')),
(('--variable', '-s'),
dict(nargs='+', help='set extra variable,format is name:value')),
(('--skip-builtin',),
... | def add_arguments(cls):
"""
Init project.
"""
return [
(('--yes',), dict(action='store_true', help='clean .git repo')),
(('--variable', '-s'),
dict(nargs='+', help='set extra variable,format is name:value')),
(('--skip-builtin',),
... | [
"Init",
"project",
"."
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/components/init.py#L264-L274 | [
"def",
"add_arguments",
"(",
"cls",
")",
":",
"return",
"[",
"(",
"(",
"'--yes'",
",",
")",
",",
"dict",
"(",
"action",
"=",
"'store_true'",
",",
"help",
"=",
"'clean .git repo'",
")",
")",
",",
"(",
"(",
"'--variable'",
",",
"'-s'",
")",
",",
"dict"... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | SlotComponent.set_signal | 设置信号处理
默认直接中断,考虑到一些场景用户需要等待线程结束.
可在此自定义操作
:return: | cliez/slot.py | def set_signal(self):
"""
设置信号处理
默认直接中断,考虑到一些场景用户需要等待线程结束.
可在此自定义操作
:return:
"""
def signal_handle(signum, frame):
self.error("User interrupt.kill threads.")
sys.exit(-1)
pass
signal.signal(signal.SIGINT, signal_hand... | def set_signal(self):
"""
设置信号处理
默认直接中断,考虑到一些场景用户需要等待线程结束.
可在此自定义操作
:return:
"""
def signal_handle(signum, frame):
self.error("User interrupt.kill threads.")
sys.exit(-1)
pass
signal.signal(signal.SIGINT, signal_hand... | [
"设置信号处理"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/slot.py#L100-L116 | [
"def",
"set_signal",
"(",
"self",
")",
":",
"def",
"signal_handle",
"(",
"signum",
",",
"frame",
")",
":",
"self",
".",
"error",
"(",
"\"User interrupt.kill threads.\"",
")",
"sys",
".",
"exit",
"(",
"-",
"1",
")",
"pass",
"signal",
".",
"signal",
"(",
... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | SlotComponent.check_exclusive_mode | 检查是否是独占模式
参数顺序必须一致,也就是说如果参数顺序不一致,则判定为是两个不同的进程
这么设计是考虑到:
- 一般而言,排他模式的服务启动都是crontab等脚本来完成的,不存在顺序变更的可能
- 这在调试的时候可以帮助我们不需要结束原有进程就可以继续调试
:return: | cliez/slot.py | def check_exclusive_mode(self):
"""
检查是否是独占模式
参数顺序必须一致,也就是说如果参数顺序不一致,则判定为是两个不同的进程
这么设计是考虑到:
- 一般而言,排他模式的服务启动都是crontab等脚本来完成的,不存在顺序变更的可能
- 这在调试的时候可以帮助我们不需要结束原有进程就可以继续调试
:return:
"""
if self.options.exclusive_mode:
import psutil
... | def check_exclusive_mode(self):
"""
检查是否是独占模式
参数顺序必须一致,也就是说如果参数顺序不一致,则判定为是两个不同的进程
这么设计是考虑到:
- 一般而言,排他模式的服务启动都是crontab等脚本来完成的,不存在顺序变更的可能
- 这在调试的时候可以帮助我们不需要结束原有进程就可以继续调试
:return:
"""
if self.options.exclusive_mode:
import psutil
... | [
"检查是否是独占模式"
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/slot.py#L118-L154 | [
"def",
"check_exclusive_mode",
"(",
"self",
")",
":",
"if",
"self",
".",
"options",
".",
"exclusive_mode",
":",
"import",
"psutil",
"current_pid",
"=",
"os",
".",
"getpid",
"(",
")",
"current",
"=",
"psutil",
".",
"Process",
"(",
"current_pid",
")",
".",
... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | SlotComponent.run | In general, you don't need to overwrite this method.
:param options:
:return: | cliez/slot.py | def run(self, options):
"""
In general, you don't need to overwrite this method.
:param options:
:return:
"""
self.set_signal()
self.check_exclusive_mode()
slot = self.Handle(self)
# start thread
i = 0
while i < options.threads:... | def run(self, options):
"""
In general, you don't need to overwrite this method.
:param options:
:return:
"""
self.set_signal()
self.check_exclusive_mode()
slot = self.Handle(self)
# start thread
i = 0
while i < options.threads:... | [
"In",
"general",
"you",
"don",
"t",
"need",
"to",
"overwrite",
"this",
"method",
"."
] | wangwenpei/cliez | python | https://github.com/wangwenpei/cliez/blob/d6fe775544cd380735c56c8a4a79bc2ad22cb6c4/cliez/slot.py#L156-L191 | [
"def",
"run",
"(",
"self",
",",
"options",
")",
":",
"self",
".",
"set_signal",
"(",
")",
"self",
".",
"check_exclusive_mode",
"(",
")",
"slot",
"=",
"self",
".",
"Handle",
"(",
"self",
")",
"# start thread",
"i",
"=",
"0",
"while",
"i",
"<",
"option... | d6fe775544cd380735c56c8a4a79bc2ad22cb6c4 |
valid | serial_ports | Returns
-------
pandas.DataFrame
Table of serial ports that match the USB vendor ID and product ID for
the `Teensy 3.2`_ board.
.. Teensy 3.2: https://www.pjrc.com/store/teensy32.html | dropbot_dx/proxy.py | def serial_ports():
'''
Returns
-------
pandas.DataFrame
Table of serial ports that match the USB vendor ID and product ID for
the `Teensy 3.2`_ board.
.. Teensy 3.2: https://www.pjrc.com/store/teensy32.html
'''
df_comports = sd.comports()
# Match COM ports with USB vend... | def serial_ports():
'''
Returns
-------
pandas.DataFrame
Table of serial ports that match the USB vendor ID and product ID for
the `Teensy 3.2`_ board.
.. Teensy 3.2: https://www.pjrc.com/store/teensy32.html
'''
df_comports = sd.comports()
# Match COM ports with USB vend... | [
"Returns",
"-------",
"pandas",
".",
"DataFrame",
"Table",
"of",
"serial",
"ports",
"that",
"match",
"the",
"USB",
"vendor",
"ID",
"and",
"product",
"ID",
"for",
"the",
"Teensy",
"3",
".",
"2",
"_",
"board",
"."
] | wheeler-microfluidics/dropbot-dx | python | https://github.com/wheeler-microfluidics/dropbot-dx/blob/de7e6cd79378ab2e7e0d4b37d7687932526ab417/dropbot_dx/proxy.py#L9-L27 | [
"def",
"serial_ports",
"(",
")",
":",
"df_comports",
"=",
"sd",
".",
"comports",
"(",
")",
"# Match COM ports with USB vendor ID and product IDs for [Teensy 3.2",
"# device][1].",
"#",
"# [1]: https://www.pjrc.com/store/teensy32.html",
"df_teensy_comports",
"=",
"df_comports",
... | de7e6cd79378ab2e7e0d4b37d7687932526ab417 |
valid | combine_filenames | Return a new filename to use as the combined file name for a
bunch of files, based on the SHA of their contents.
A precondition is that they all have the same file extension
Given that the list of files can have different paths, we aim to use the
most common path.
Example:
/somewhere/else/fo... | inkblock/main.py | def combine_filenames(filenames, max_length=40):
"""Return a new filename to use as the combined file name for a
bunch of files, based on the SHA of their contents.
A precondition is that they all have the same file extension
Given that the list of files can have different paths, we aim to use the
... | def combine_filenames(filenames, max_length=40):
"""Return a new filename to use as the combined file name for a
bunch of files, based on the SHA of their contents.
A precondition is that they all have the same file extension
Given that the list of files can have different paths, we aim to use the
... | [
"Return",
"a",
"new",
"filename",
"to",
"use",
"as",
"the",
"combined",
"file",
"name",
"for",
"a",
"bunch",
"of",
"files",
"based",
"on",
"the",
"SHA",
"of",
"their",
"contents",
".",
"A",
"precondition",
"is",
"that",
"they",
"all",
"have",
"the",
"s... | skoczen/inkblock | python | https://github.com/skoczen/inkblock/blob/099f834c1e9fc0938abaa8824725eeac57603f6c/inkblock/main.py#L88-L149 | [
"def",
"combine_filenames",
"(",
"filenames",
",",
"max_length",
"=",
"40",
")",
":",
"# Get the SHA for each file, then sha all the shas.",
"path",
"=",
"None",
"names",
"=",
"[",
"]",
"extension",
"=",
"None",
"timestamps",
"=",
"[",
"]",
"shas",
"=",
"[",
"... | 099f834c1e9fc0938abaa8824725eeac57603f6c |
valid | apply_orientation | Extract the oritentation EXIF tag from the image, which should be a PIL Image instance,
and if there is an orientation tag that would rotate the image, apply that rotation to
the Image instance given to do an in-place rotation.
:param Image im: Image instance to inspect
:return: A possibly transposed i... | inkblock/main.py | def apply_orientation(im):
"""
Extract the oritentation EXIF tag from the image, which should be a PIL Image instance,
and if there is an orientation tag that would rotate the image, apply that rotation to
the Image instance given to do an in-place rotation.
:param Image im: Image instance to inspe... | def apply_orientation(im):
"""
Extract the oritentation EXIF tag from the image, which should be a PIL Image instance,
and if there is an orientation tag that would rotate the image, apply that rotation to
the Image instance given to do an in-place rotation.
:param Image im: Image instance to inspe... | [
"Extract",
"the",
"oritentation",
"EXIF",
"tag",
"from",
"the",
"image",
"which",
"should",
"be",
"a",
"PIL",
"Image",
"instance",
"and",
"if",
"there",
"is",
"an",
"orientation",
"tag",
"that",
"would",
"rotate",
"the",
"image",
"apply",
"that",
"rotation",... | skoczen/inkblock | python | https://github.com/skoczen/inkblock/blob/099f834c1e9fc0938abaa8824725eeac57603f6c/inkblock/main.py#L204-L226 | [
"def",
"apply_orientation",
"(",
"im",
")",
":",
"try",
":",
"kOrientationEXIFTag",
"=",
"0x0112",
"if",
"hasattr",
"(",
"im",
",",
"'_getexif'",
")",
":",
"# only present in JPEGs",
"e",
"=",
"im",
".",
"_getexif",
"(",
")",
"# returns None if no EXIF data",
... | 099f834c1e9fc0938abaa8824725eeac57603f6c |
valid | write | Start a new piece | inkblock/main.py | def write():
"""Start a new piece"""
click.echo("Fantastic. Let's get started. ")
title = click.prompt("What's the title?")
# Make sure that title doesn't exist.
url = slugify(title)
url = click.prompt("What's the URL?", default=url)
# Make sure that title doesn't exist.
click.echo("Go... | def write():
"""Start a new piece"""
click.echo("Fantastic. Let's get started. ")
title = click.prompt("What's the title?")
# Make sure that title doesn't exist.
url = slugify(title)
url = click.prompt("What's the URL?", default=url)
# Make sure that title doesn't exist.
click.echo("Go... | [
"Start",
"a",
"new",
"piece"
] | skoczen/inkblock | python | https://github.com/skoczen/inkblock/blob/099f834c1e9fc0938abaa8824725eeac57603f6c/inkblock/main.py#L1354-L1365 | [
"def",
"write",
"(",
")",
":",
"click",
".",
"echo",
"(",
"\"Fantastic. Let's get started. \"",
")",
"title",
"=",
"click",
".",
"prompt",
"(",
"\"What's the title?\"",
")",
"# Make sure that title doesn't exist.",
"url",
"=",
"slugify",
"(",
"title",
")",
"url",
... | 099f834c1e9fc0938abaa8824725eeac57603f6c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.