id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
53,600 | wummel/dosage | dosagelib/director.py | ComicGetter.saveComicStrip | def saveComicStrip(self, strip):
"""Save a comic strip which can consist of multiple images."""
allskipped = True
for image in strip.getImages():
try:
if self.options.dry_run:
filename, saved = "", False
else:
fi... | python | def saveComicStrip(self, strip):
"""Save a comic strip which can consist of multiple images."""
allskipped = True
for image in strip.getImages():
try:
if self.options.dry_run:
filename, saved = "", False
else:
fi... | [
"def",
"saveComicStrip",
"(",
"self",
",",
"strip",
")",
":",
"allskipped",
"=",
"True",
"for",
"image",
"in",
"strip",
".",
"getImages",
"(",
")",
":",
"try",
":",
"if",
"self",
".",
"options",
".",
"dry_run",
":",
"filename",
",",
"saved",
"=",
"\"... | Save a comic strip which can consist of multiple images. | [
"Save",
"a",
"comic",
"strip",
"which",
"can",
"consist",
"of",
"multiple",
"images",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/director.py#L126-L142 |
53,601 | haikuginger/beekeeper | beekeeper/variables.py | merge | def merge(var1, var2):
"""
Take two copies of a variable and reconcile them. var1 is assumed
to be the higher-level variable, and so will be overridden by var2
where such becomes necessary.
"""
out = {}
out['value'] = var2.get('value', var1.get('value', None))
out['mimetype'] = var2.get(... | python | def merge(var1, var2):
"""
Take two copies of a variable and reconcile them. var1 is assumed
to be the higher-level variable, and so will be overridden by var2
where such becomes necessary.
"""
out = {}
out['value'] = var2.get('value', var1.get('value', None))
out['mimetype'] = var2.get(... | [
"def",
"merge",
"(",
"var1",
",",
"var2",
")",
":",
"out",
"=",
"{",
"}",
"out",
"[",
"'value'",
"]",
"=",
"var2",
".",
"get",
"(",
"'value'",
",",
"var1",
".",
"get",
"(",
"'value'",
",",
"None",
")",
")",
"out",
"[",
"'mimetype'",
"]",
"=",
... | Take two copies of a variable and reconcile them. var1 is assumed
to be the higher-level variable, and so will be overridden by var2
where such becomes necessary. | [
"Take",
"two",
"copies",
"of",
"a",
"variable",
"and",
"reconcile",
"them",
".",
"var1",
"is",
"assumed",
"to",
"be",
"the",
"higher",
"-",
"level",
"variable",
"and",
"so",
"will",
"be",
"overridden",
"by",
"var2",
"where",
"such",
"becomes",
"necessary",... | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L17-L29 |
53,602 | haikuginger/beekeeper | beekeeper/variables.py | Variable.has_value_of_type | def has_value_of_type(self, var_type):
"""
Does the variable both have the given type and
have a variable value we can use?
"""
if self.has_value() and self.has_type(var_type):
return True
return False | python | def has_value_of_type(self, var_type):
"""
Does the variable both have the given type and
have a variable value we can use?
"""
if self.has_value() and self.has_type(var_type):
return True
return False | [
"def",
"has_value_of_type",
"(",
"self",
",",
"var_type",
")",
":",
"if",
"self",
".",
"has_value",
"(",
")",
"and",
"self",
".",
"has_type",
"(",
"var_type",
")",
":",
"return",
"True",
"return",
"False"
] | Does the variable both have the given type and
have a variable value we can use? | [
"Does",
"the",
"variable",
"both",
"have",
"the",
"given",
"type",
"and",
"have",
"a",
"variable",
"value",
"we",
"can",
"use?"
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L101-L108 |
53,603 | haikuginger/beekeeper | beekeeper/variables.py | Variables.optional_names | def optional_names(self):
"""
Get a list of the variables that are defined, but not required
"""
for name, var in self.items():
if var.get('optional', False):
yield name | python | def optional_names(self):
"""
Get a list of the variables that are defined, but not required
"""
for name, var in self.items():
if var.get('optional', False):
yield name | [
"def",
"optional_names",
"(",
"self",
")",
":",
"for",
"name",
",",
"var",
"in",
"self",
".",
"items",
"(",
")",
":",
"if",
"var",
".",
"get",
"(",
"'optional'",
",",
"False",
")",
":",
"yield",
"name"
] | Get a list of the variables that are defined, but not required | [
"Get",
"a",
"list",
"of",
"the",
"variables",
"that",
"are",
"defined",
"but",
"not",
"required"
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L154-L160 |
53,604 | haikuginger/beekeeper | beekeeper/variables.py | Variables.types | def types(self):
"""
Return a list of all the variable types that exist in the
Variables object.
"""
output = set()
for var in self.values():
if var.has_value():
output.update(var.types())
return list(output) | python | def types(self):
"""
Return a list of all the variable types that exist in the
Variables object.
"""
output = set()
for var in self.values():
if var.has_value():
output.update(var.types())
return list(output) | [
"def",
"types",
"(",
"self",
")",
":",
"output",
"=",
"set",
"(",
")",
"for",
"var",
"in",
"self",
".",
"values",
"(",
")",
":",
"if",
"var",
".",
"has_value",
"(",
")",
":",
"output",
".",
"update",
"(",
"var",
".",
"types",
"(",
")",
")",
"... | Return a list of all the variable types that exist in the
Variables object. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"variable",
"types",
"that",
"exist",
"in",
"the",
"Variables",
"object",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L180-L189 |
53,605 | haikuginger/beekeeper | beekeeper/variables.py | Variables.add | def add(self, **kwargs):
"""
Add additional single Variable objects to the Variables
object.
"""
for name, var in kwargs.items():
if iskeyword(name):
var['name'] = name
name = '_' + name
if name in self:
self... | python | def add(self, **kwargs):
"""
Add additional single Variable objects to the Variables
object.
"""
for name, var in kwargs.items():
if iskeyword(name):
var['name'] = name
name = '_' + name
if name in self:
self... | [
"def",
"add",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"var",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"iskeyword",
"(",
"name",
")",
":",
"var",
"[",
"'name'",
"]",
"=",
"name",
"name",
"=",
"'_'",
"+",
"... | Add additional single Variable objects to the Variables
object. | [
"Add",
"additional",
"single",
"Variable",
"objects",
"to",
"the",
"Variables",
"object",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L198-L211 |
53,606 | haikuginger/beekeeper | beekeeper/variables.py | Variables.fill_arg | def fill_arg(self, *args):
"""
If we get a single positional argument, and only a single
variable needs to be filled, fill that variable with
the value from that positional argument.
"""
missing = self.missing_vars()
if len(args) == len(missing) == 1:
... | python | def fill_arg(self, *args):
"""
If we get a single positional argument, and only a single
variable needs to be filled, fill that variable with
the value from that positional argument.
"""
missing = self.missing_vars()
if len(args) == len(missing) == 1:
... | [
"def",
"fill_arg",
"(",
"self",
",",
"*",
"args",
")",
":",
"missing",
"=",
"self",
".",
"missing_vars",
"(",
")",
"if",
"len",
"(",
"args",
")",
"==",
"len",
"(",
"missing",
")",
"==",
"1",
":",
"self",
".",
"setval",
"(",
"missing",
"[",
"0",
... | If we get a single positional argument, and only a single
variable needs to be filled, fill that variable with
the value from that positional argument. | [
"If",
"we",
"get",
"a",
"single",
"positional",
"argument",
"and",
"only",
"a",
"single",
"variable",
"needs",
"to",
"be",
"filled",
"fill",
"that",
"variable",
"with",
"the",
"value",
"from",
"that",
"positional",
"argument",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L213-L221 |
53,607 | haikuginger/beekeeper | beekeeper/variables.py | Variables.fill_kwargs | def fill_kwargs(self, **kwargs):
"""
Fill empty variable objects by name with the values from
any present keyword arguments.
"""
for var, val in kwargs.items():
self.setval(var, val) | python | def fill_kwargs(self, **kwargs):
"""
Fill empty variable objects by name with the values from
any present keyword arguments.
"""
for var, val in kwargs.items():
self.setval(var, val) | [
"def",
"fill_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"var",
",",
"val",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"self",
".",
"setval",
"(",
"var",
",",
"val",
")"
] | Fill empty variable objects by name with the values from
any present keyword arguments. | [
"Fill",
"empty",
"variable",
"objects",
"by",
"name",
"with",
"the",
"values",
"from",
"any",
"present",
"keyword",
"arguments",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L223-L229 |
53,608 | haikuginger/beekeeper | beekeeper/variables.py | Variables.fill | def fill(self, *args, **kwargs):
"""
Take args and kwargs and fill up any variables that
don't have a value yet.
"""
self.fill_kwargs(**kwargs)
self.fill_arg(*args)
self.assert_full()
return self | python | def fill(self, *args, **kwargs):
"""
Take args and kwargs and fill up any variables that
don't have a value yet.
"""
self.fill_kwargs(**kwargs)
self.fill_arg(*args)
self.assert_full()
return self | [
"def",
"fill",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"fill_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"fill_arg",
"(",
"*",
"args",
")",
"self",
".",
"assert_full",
"(",
")",
"return",
"self"
] | Take args and kwargs and fill up any variables that
don't have a value yet. | [
"Take",
"args",
"and",
"kwargs",
"and",
"fill",
"up",
"any",
"variables",
"that",
"don",
"t",
"have",
"a",
"value",
"yet",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L239-L247 |
53,609 | haikuginger/beekeeper | beekeeper/variables.py | Variables.setval | def setval(self, varname, value):
"""
Set the value of the variable with the given name.
"""
if varname in self:
self[varname]['value'] = value
else:
self[varname] = Variable(self.default_type, value=value) | python | def setval(self, varname, value):
"""
Set the value of the variable with the given name.
"""
if varname in self:
self[varname]['value'] = value
else:
self[varname] = Variable(self.default_type, value=value) | [
"def",
"setval",
"(",
"self",
",",
"varname",
",",
"value",
")",
":",
"if",
"varname",
"in",
"self",
":",
"self",
"[",
"varname",
"]",
"[",
"'value'",
"]",
"=",
"value",
"else",
":",
"self",
"[",
"varname",
"]",
"=",
"Variable",
"(",
"self",
".",
... | Set the value of the variable with the given name. | [
"Set",
"the",
"value",
"of",
"the",
"variable",
"with",
"the",
"given",
"name",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/variables.py#L249-L256 |
53,610 | synw/dataswim | dataswim/charts/__init__.py | Plot.chart | def chart(self, x=None, y=None, chart_type=None, opts=None,
style=None, label=None, options={}, **kwargs):
"""
Get a chart
"""
try:
self.chart_obj = self._chart(x, y, chart_type, opts, style, label,
options=options, **kwargs)
except Exception as e:
self.err(e, self.chart, "Can not create... | python | def chart(self, x=None, y=None, chart_type=None, opts=None,
style=None, label=None, options={}, **kwargs):
"""
Get a chart
"""
try:
self.chart_obj = self._chart(x, y, chart_type, opts, style, label,
options=options, **kwargs)
except Exception as e:
self.err(e, self.chart, "Can not create... | [
"def",
"chart",
"(",
"self",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"chart_type",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"style",
"=",
"None",
",",
"label",
"=",
"None",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
... | Get a chart | [
"Get",
"a",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L29-L38 |
53,611 | synw/dataswim | dataswim/charts/__init__.py | Plot._chart | def _chart(self, x, y, chart_type, opts, style, label, options, **kwargs):
"""
Initialize chart options
"""
if opts is not None:
self.chart_opts = opts
if style is not None:
self.chart_style = style
if label is not None:
self.label = label
self.x = x
self.y = y
if chart_type is None:
retur... | python | def _chart(self, x, y, chart_type, opts, style, label, options, **kwargs):
"""
Initialize chart options
"""
if opts is not None:
self.chart_opts = opts
if style is not None:
self.chart_style = style
if label is not None:
self.label = label
self.x = x
self.y = y
if chart_type is None:
retur... | [
"def",
"_chart",
"(",
"self",
",",
"x",
",",
"y",
",",
"chart_type",
",",
"opts",
",",
"style",
",",
"label",
",",
"options",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"opts",
"is",
"not",
"None",
":",
"self",
".",
"chart_opts",
"=",
"opts",
"if",... | Initialize chart options | [
"Initialize",
"chart",
"options"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L51-L71 |
53,612 | synw/dataswim | dataswim/charts/__init__.py | Plot.bar_ | def bar_(self, label=None, style=None, opts=None, options={}):
"""
Get a bar chart
"""
try:
return self._get_chart("bar", style=style, opts=opts, label=label,
options=options)
except Exception as e:
self.err(e, self.bar_, "Can not draw bar chart") | python | def bar_(self, label=None, style=None, opts=None, options={}):
"""
Get a bar chart
"""
try:
return self._get_chart("bar", style=style, opts=opts, label=label,
options=options)
except Exception as e:
self.err(e, self.bar_, "Can not draw bar chart") | [
"def",
"bar_",
"(",
"self",
",",
"label",
"=",
"None",
",",
"style",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"options",
"=",
"{",
"}",
")",
":",
"try",
":",
"return",
"self",
".",
"_get_chart",
"(",
"\"bar\"",
",",
"style",
"=",
"style",
",",... | Get a bar chart | [
"Get",
"a",
"bar",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L73-L81 |
53,613 | synw/dataswim | dataswim/charts/__init__.py | Plot.sbar_ | def sbar_(self, stack_index=None, label=None, style=None, opts=None,
options={}):
"""
Get a stacked bar chart
"""
self.opts(dict(stack_index=stack_index, color_index=stack_index))
try:
if stack_index is None:
self.err(self.sbar_, "Please provide a stack index parameter")
options["stack_index"] ... | python | def sbar_(self, stack_index=None, label=None, style=None, opts=None,
options={}):
"""
Get a stacked bar chart
"""
self.opts(dict(stack_index=stack_index, color_index=stack_index))
try:
if stack_index is None:
self.err(self.sbar_, "Please provide a stack index parameter")
options["stack_index"] ... | [
"def",
"sbar_",
"(",
"self",
",",
"stack_index",
"=",
"None",
",",
"label",
"=",
"None",
",",
"style",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"options",
"=",
"{",
"}",
")",
":",
"self",
".",
"opts",
"(",
"dict",
"(",
"stack_index",
"=",
"sta... | Get a stacked bar chart | [
"Get",
"a",
"stacked",
"bar",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L83-L96 |
53,614 | synw/dataswim | dataswim/charts/__init__.py | Plot.sline_ | def sline_(self, window_size=5,
y_label="Moving average", chart_label=None):
"""
Get a moving average curve chart to smooth between points
"""
options = dict(window_size=window_size, y_label=y_label)
try:
return self._get_chart("sline", style=self.chart_style,
opts=self.chart_opts, label=c... | python | def sline_(self, window_size=5,
y_label="Moving average", chart_label=None):
"""
Get a moving average curve chart to smooth between points
"""
options = dict(window_size=window_size, y_label=y_label)
try:
return self._get_chart("sline", style=self.chart_style,
opts=self.chart_opts, label=c... | [
"def",
"sline_",
"(",
"self",
",",
"window_size",
"=",
"5",
",",
"y_label",
"=",
"\"Moving average\"",
",",
"chart_label",
"=",
"None",
")",
":",
"options",
"=",
"dict",
"(",
"window_size",
"=",
"window_size",
",",
"y_label",
"=",
"y_label",
")",
"try",
... | Get a moving average curve chart to smooth between points | [
"Get",
"a",
"moving",
"average",
"curve",
"chart",
"to",
"smooth",
"between",
"points"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L128-L139 |
53,615 | synw/dataswim | dataswim/charts/__init__.py | Plot.sarea_ | def sarea_(self, col, x=None, y=None, rsum=None, rmean=None):
"""
Get an stacked area chart
"""
try:
charts = self._multiseries(col, x, y, "area", rsum, rmean)
return hv.Area.stack(charts)
except Exception as e:
self.err(e, self.sarea_, "Can not draw stacked area chart") | python | def sarea_(self, col, x=None, y=None, rsum=None, rmean=None):
"""
Get an stacked area chart
"""
try:
charts = self._multiseries(col, x, y, "area", rsum, rmean)
return hv.Area.stack(charts)
except Exception as e:
self.err(e, self.sarea_, "Can not draw stacked area chart") | [
"def",
"sarea_",
"(",
"self",
",",
"col",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"rsum",
"=",
"None",
",",
"rmean",
"=",
"None",
")",
":",
"try",
":",
"charts",
"=",
"self",
".",
"_multiseries",
"(",
"col",
",",
"x",
",",
"y",
","... | Get an stacked area chart | [
"Get",
"an",
"stacked",
"area",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L151-L159 |
53,616 | synw/dataswim | dataswim/charts/__init__.py | Plot.line_point_ | def line_point_(self, label=None, style=None, opts=None, options={},
colors={"line": "orange", "point": "#30A2DA"}):
"""
Get a line and point chart
"""
try:
if style is None:
style = self.chart_style
if "size" not in style:
style["size"] = 10
style["color"] = colors["line"]
c = self._... | python | def line_point_(self, label=None, style=None, opts=None, options={},
colors={"line": "orange", "point": "#30A2DA"}):
"""
Get a line and point chart
"""
try:
if style is None:
style = self.chart_style
if "size" not in style:
style["size"] = 10
style["color"] = colors["line"]
c = self._... | [
"def",
"line_point_",
"(",
"self",
",",
"label",
"=",
"None",
",",
"style",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"options",
"=",
"{",
"}",
",",
"colors",
"=",
"{",
"\"line\"",
":",
"\"orange\"",
",",
"\"point\"",
":",
"\"#30A2DA\"",
"}",
")",
... | Get a line and point chart | [
"Get",
"a",
"line",
"and",
"point",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L251-L269 |
53,617 | synw/dataswim | dataswim/charts/__init__.py | Plot._multiseries | def _multiseries(self, col, x, y, ctype, rsum, rmean):
"""
Chart multiple series from a column distinct values
"""
self.autoprint = False
x, y = self._check_fields(x, y)
chart = None
series = self.split_(col)
for key in series:
instance = series[key]
if rsum is not None:
instance.rsum(rsum, in... | python | def _multiseries(self, col, x, y, ctype, rsum, rmean):
"""
Chart multiple series from a column distinct values
"""
self.autoprint = False
x, y = self._check_fields(x, y)
chart = None
series = self.split_(col)
for key in series:
instance = series[key]
if rsum is not None:
instance.rsum(rsum, in... | [
"def",
"_multiseries",
"(",
"self",
",",
"col",
",",
"x",
",",
"y",
",",
"ctype",
",",
"rsum",
",",
"rmean",
")",
":",
"self",
".",
"autoprint",
"=",
"False",
"x",
",",
"y",
"=",
"self",
".",
"_check_fields",
"(",
"x",
",",
"y",
")",
"chart",
"... | Chart multiple series from a column distinct values | [
"Chart",
"multiple",
"series",
"from",
"a",
"column",
"distinct",
"values"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L332-L367 |
53,618 | synw/dataswim | dataswim/charts/__init__.py | Plot.distrib_ | def distrib_(self, label=None, style=None, opts=None):
"""
Get a Seaborn distribution chart
"""
try:
return self._get_chart("distribution", style=style, opts=opts, label=label)
except Exception as e:
self.err(e, "Can not draw distrinution chart") | python | def distrib_(self, label=None, style=None, opts=None):
"""
Get a Seaborn distribution chart
"""
try:
return self._get_chart("distribution", style=style, opts=opts, label=label)
except Exception as e:
self.err(e, "Can not draw distrinution chart") | [
"def",
"distrib_",
"(",
"self",
",",
"label",
"=",
"None",
",",
"style",
"=",
"None",
",",
"opts",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_get_chart",
"(",
"\"distribution\"",
",",
"style",
"=",
"style",
",",
"opts",
"=",
"opts",
... | Get a Seaborn distribution chart | [
"Get",
"a",
"Seaborn",
"distribution",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L387-L394 |
53,619 | synw/dataswim | dataswim/charts/__init__.py | Plot.opts | def opts(self, dictobj):
"""
Add or update options
"""
for k in dictobj:
self.chart_opts[k] = dictobj[k] | python | def opts(self, dictobj):
"""
Add or update options
"""
for k in dictobj:
self.chart_opts[k] = dictobj[k] | [
"def",
"opts",
"(",
"self",
",",
"dictobj",
")",
":",
"for",
"k",
"in",
"dictobj",
":",
"self",
".",
"chart_opts",
"[",
"k",
"]",
"=",
"dictobj",
"[",
"k",
"]"
] | Add or update options | [
"Add",
"or",
"update",
"options"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L444-L449 |
53,620 | synw/dataswim | dataswim/charts/__init__.py | Plot.styles | def styles(self, dictobj):
"""
Add or update styles
"""
for k in dictobj:
self.chart_style[k] = dictobj[k] | python | def styles(self, dictobj):
"""
Add or update styles
"""
for k in dictobj:
self.chart_style[k] = dictobj[k] | [
"def",
"styles",
"(",
"self",
",",
"dictobj",
")",
":",
"for",
"k",
"in",
"dictobj",
":",
"self",
".",
"chart_style",
"[",
"k",
"]",
"=",
"dictobj",
"[",
"k",
"]"
] | Add or update styles | [
"Add",
"or",
"update",
"styles"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L451-L456 |
53,621 | synw/dataswim | dataswim/charts/__init__.py | Plot.ropt | def ropt(self, name):
"""
Remove one option
"""
try:
del self.chart_opts[name]
except KeyError:
self.warning("Option " + name + " is not set")
except:
self.err("Can not remove option " + name) | python | def ropt(self, name):
"""
Remove one option
"""
try:
del self.chart_opts[name]
except KeyError:
self.warning("Option " + name + " is not set")
except:
self.err("Can not remove option " + name) | [
"def",
"ropt",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"del",
"self",
".",
"chart_opts",
"[",
"name",
"]",
"except",
"KeyError",
":",
"self",
".",
"warning",
"(",
"\"Option \"",
"+",
"name",
"+",
"\" is not set\"",
")",
"except",
":",
"self",
... | Remove one option | [
"Remove",
"one",
"option"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L458-L467 |
53,622 | synw/dataswim | dataswim/charts/__init__.py | Plot.rstyle | def rstyle(self, name):
"""
Remove one style
"""
try:
del self.chart_style[name]
except KeyError:
self.warning("Style " + name + " is not set")
except:
self.err("Can not remove style " + name) | python | def rstyle(self, name):
"""
Remove one style
"""
try:
del self.chart_style[name]
except KeyError:
self.warning("Style " + name + " is not set")
except:
self.err("Can not remove style " + name) | [
"def",
"rstyle",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"del",
"self",
".",
"chart_style",
"[",
"name",
"]",
"except",
"KeyError",
":",
"self",
".",
"warning",
"(",
"\"Style \"",
"+",
"name",
"+",
"\" is not set\"",
")",
"except",
":",
"self",... | Remove one style | [
"Remove",
"one",
"style"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L469-L478 |
53,623 | synw/dataswim | dataswim/charts/__init__.py | Plot.defaults | def defaults(self):
"""
Reset the chart options and style to defaults
"""
self.chart_style = {}
self.chart_opts = {}
self.style("color", "#30A2DA")
self.width(900)
self.height(250) | python | def defaults(self):
"""
Reset the chart options and style to defaults
"""
self.chart_style = {}
self.chart_opts = {}
self.style("color", "#30A2DA")
self.width(900)
self.height(250) | [
"def",
"defaults",
"(",
"self",
")",
":",
"self",
".",
"chart_style",
"=",
"{",
"}",
"self",
".",
"chart_opts",
"=",
"{",
"}",
"self",
".",
"style",
"(",
"\"color\"",
",",
"\"#30A2DA\"",
")",
"self",
".",
"width",
"(",
"900",
")",
"self",
".",
"hei... | Reset the chart options and style to defaults | [
"Reset",
"the",
"chart",
"options",
"and",
"style",
"to",
"defaults"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L492-L500 |
53,624 | synw/dataswim | dataswim/charts/__init__.py | Plot._check_fields | def _check_fields(self, x, y):
"""
Check x and y fields parameters and initialize
"""
if x is None:
if self.x is None:
self.err(
self._check_fields,
"X field is not set: please specify a parameter")
return
x = self.x
if y is None:
if self.y is None:
self.err(
self._check_fi... | python | def _check_fields(self, x, y):
"""
Check x and y fields parameters and initialize
"""
if x is None:
if self.x is None:
self.err(
self._check_fields,
"X field is not set: please specify a parameter")
return
x = self.x
if y is None:
if self.y is None:
self.err(
self._check_fi... | [
"def",
"_check_fields",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"if",
"x",
"is",
"None",
":",
"if",
"self",
".",
"x",
"is",
"None",
":",
"self",
".",
"err",
"(",
"self",
".",
"_check_fields",
",",
"\"X field is not set: please specify a parameter\"",
... | Check x and y fields parameters and initialize | [
"Check",
"x",
"and",
"y",
"fields",
"parameters",
"and",
"initialize"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L532-L550 |
53,625 | synw/dataswim | dataswim/charts/__init__.py | Plot._get_chart | def _get_chart(self, chart_type, x=None, y=None, style=None, opts=None,
label=None, options={}, **kwargs):
"""
Get a full chart object
"""
sbcharts = ["density", "distribution", "dlinear"]
acharts = ["tick", "circle", "text", "line_num", "bar_num"]
if chart_type in sbcharts:
self._set_seaborn_engi... | python | def _get_chart(self, chart_type, x=None, y=None, style=None, opts=None,
label=None, options={}, **kwargs):
"""
Get a full chart object
"""
sbcharts = ["density", "distribution", "dlinear"]
acharts = ["tick", "circle", "text", "line_num", "bar_num"]
if chart_type in sbcharts:
self._set_seaborn_engi... | [
"def",
"_get_chart",
"(",
"self",
",",
"chart_type",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"style",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"label",
"=",
"None",
",",
"options",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",... | Get a full chart object | [
"Get",
"a",
"full",
"chart",
"object"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L552-L586 |
53,626 | synw/dataswim | dataswim/charts/__init__.py | Plot._check_defaults | def _check_defaults(self, x_only=True):
"""
Checks if charts defaults are set
"""
if self.x is None:
self.err(self._check_defaults,
"X field is not set: please specify a parameter")
return
if x_only is True:
return
if self.y is None:
self.err(self._check_defaults,
"Y field is not set... | python | def _check_defaults(self, x_only=True):
"""
Checks if charts defaults are set
"""
if self.x is None:
self.err(self._check_defaults,
"X field is not set: please specify a parameter")
return
if x_only is True:
return
if self.y is None:
self.err(self._check_defaults,
"Y field is not set... | [
"def",
"_check_defaults",
"(",
"self",
",",
"x_only",
"=",
"True",
")",
":",
"if",
"self",
".",
"x",
"is",
"None",
":",
"self",
".",
"err",
"(",
"self",
".",
"_check_defaults",
",",
"\"X field is not set: please specify a parameter\"",
")",
"return",
"if",
"... | Checks if charts defaults are set | [
"Checks",
"if",
"charts",
"defaults",
"are",
"set"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/__init__.py#L588-L601 |
53,627 | wummel/dosage | dosagelib/plugins/u.py | Unsounded.getIndexStripUrl | def getIndexStripUrl(self, index):
"""Get comic strip URL from index."""
chapter, num = index.split('-')
return self.stripUrl % (chapter, chapter, num) | python | def getIndexStripUrl(self, index):
"""Get comic strip URL from index."""
chapter, num = index.split('-')
return self.stripUrl % (chapter, chapter, num) | [
"def",
"getIndexStripUrl",
"(",
"self",
",",
"index",
")",
":",
"chapter",
",",
"num",
"=",
"index",
".",
"split",
"(",
"'-'",
")",
"return",
"self",
".",
"stripUrl",
"%",
"(",
"chapter",
",",
"chapter",
",",
"num",
")"
] | Get comic strip URL from index. | [
"Get",
"comic",
"strip",
"URL",
"from",
"index",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/u.py#L53-L56 |
53,628 | flaper87/python-gerrit | gerrit/filters.py | Items.add_flags | def add_flags(self, *flags):
"""Adds one or more flags to the query.
For example:
current-patch-set -> --current-patch-set
"""
if not isinstance(flags, (list, tuple)):
flags = [str(flags)]
self.extend(["--%s" % f for f in flags])
return self | python | def add_flags(self, *flags):
"""Adds one or more flags to the query.
For example:
current-patch-set -> --current-patch-set
"""
if not isinstance(flags, (list, tuple)):
flags = [str(flags)]
self.extend(["--%s" % f for f in flags])
return self | [
"def",
"add_flags",
"(",
"self",
",",
"*",
"flags",
")",
":",
"if",
"not",
"isinstance",
"(",
"flags",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"flags",
"=",
"[",
"str",
"(",
"flags",
")",
"]",
"self",
".",
"extend",
"(",
"[",
"\"--%s\"",
... | Adds one or more flags to the query.
For example:
current-patch-set -> --current-patch-set | [
"Adds",
"one",
"or",
"more",
"flags",
"to",
"the",
"query",
"."
] | 34fcd6d98f31b35280f29c353ad8098905ba4b39 | https://github.com/flaper87/python-gerrit/blob/34fcd6d98f31b35280f29c353ad8098905ba4b39/gerrit/filters.py#L20-L30 |
53,629 | misli/django-cms-articles | cms_articles/models/managers.py | ArticleManager.search | def search(self, q, language=None, current_site_only=True):
"""Simple search function
Plugins can define a 'search_fields' tuple similar to ModelAdmin classes
"""
from cms.plugin_pool import plugin_pool
qs = self.get_queryset()
qs = qs.public()
if current_site_... | python | def search(self, q, language=None, current_site_only=True):
"""Simple search function
Plugins can define a 'search_fields' tuple similar to ModelAdmin classes
"""
from cms.plugin_pool import plugin_pool
qs = self.get_queryset()
qs = qs.public()
if current_site_... | [
"def",
"search",
"(",
"self",
",",
"q",
",",
"language",
"=",
"None",
",",
"current_site_only",
"=",
"True",
")",
":",
"from",
"cms",
".",
"plugin_pool",
"import",
"plugin_pool",
"qs",
"=",
"self",
".",
"get_queryset",
"(",
")",
"qs",
"=",
"qs",
".",
... | Simple search function
Plugins can define a 'search_fields' tuple similar to ModelAdmin classes | [
"Simple",
"search",
"function"
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/models/managers.py#L19-L60 |
53,630 | misli/django-cms-articles | cms_articles/models/managers.py | TitleManager.get_title | def get_title(self, article, language, language_fallback=False):
"""
Gets the latest content for a particular article and language. Falls back
to another language if wanted.
"""
try:
title = self.get(language=language, article=article)
return title
... | python | def get_title(self, article, language, language_fallback=False):
"""
Gets the latest content for a particular article and language. Falls back
to another language if wanted.
"""
try:
title = self.get(language=language, article=article)
return title
... | [
"def",
"get_title",
"(",
"self",
",",
"article",
",",
"language",
",",
"language_fallback",
"=",
"False",
")",
":",
"try",
":",
"title",
"=",
"self",
".",
"get",
"(",
"language",
"=",
"language",
",",
"article",
"=",
"article",
")",
"return",
"title",
... | Gets the latest content for a particular article and language. Falls back
to another language if wanted. | [
"Gets",
"the",
"latest",
"content",
"for",
"a",
"particular",
"article",
"and",
"language",
".",
"Falls",
"back",
"to",
"another",
"language",
"if",
"wanted",
"."
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/models/managers.py#L64-L86 |
53,631 | misli/django-cms-articles | cms_articles/models/managers.py | TitleManager.set_or_create | def set_or_create(self, request, article, form, language):
"""
set or create a title for a particular article and language
"""
base_fields = [
'slug',
'title',
'description',
'meta_description',
'page_title',
'menu_t... | python | def set_or_create(self, request, article, form, language):
"""
set or create a title for a particular article and language
"""
base_fields = [
'slug',
'title',
'description',
'meta_description',
'page_title',
'menu_t... | [
"def",
"set_or_create",
"(",
"self",
",",
"request",
",",
"article",
",",
"form",
",",
"language",
")",
":",
"base_fields",
"=",
"[",
"'slug'",
",",
"'title'",
",",
"'description'",
",",
"'meta_description'",
",",
"'page_title'",
",",
"'menu_title'",
",",
"'... | set or create a title for a particular article and language | [
"set",
"or",
"create",
"a",
"title",
"for",
"a",
"particular",
"article",
"and",
"language"
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/models/managers.py#L95-L124 |
53,632 | wummel/dosage | dosagelib/util.py | get_nt_system_uid | def get_nt_system_uid():
"""Get the MachineGuid from
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\MachineGuid
"""
try:
import _winreg as winreg
except ImportError:
import winreg
lm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
key = winreg.OpenK... | python | def get_nt_system_uid():
"""Get the MachineGuid from
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\MachineGuid
"""
try:
import _winreg as winreg
except ImportError:
import winreg
lm = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
try:
key = winreg.OpenK... | [
"def",
"get_nt_system_uid",
"(",
")",
":",
"try",
":",
"import",
"_winreg",
"as",
"winreg",
"except",
"ImportError",
":",
"import",
"winreg",
"lm",
"=",
"winreg",
".",
"ConnectRegistry",
"(",
"None",
",",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
")",
"try",
":",... | Get the MachineGuid from
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\MachineGuid | [
"Get",
"the",
"MachineGuid",
"from",
"HKEY_LOCAL_MACHINE",
"\\",
"Software",
"\\",
"Microsoft",
"\\",
"Cryptography",
"\\",
"MachineGuid"
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L78-L94 |
53,633 | wummel/dosage | dosagelib/util.py | unicode_safe | def unicode_safe(text, encoding=UrlEncoding, errors='ignore'):
"""Decode text to Unicode if not already done."""
try:
text_type = unicode
except NameError:
text_type = str
if isinstance(text, text_type):
return text
return text.decode(encoding, errors) | python | def unicode_safe(text, encoding=UrlEncoding, errors='ignore'):
"""Decode text to Unicode if not already done."""
try:
text_type = unicode
except NameError:
text_type = str
if isinstance(text, text_type):
return text
return text.decode(encoding, errors) | [
"def",
"unicode_safe",
"(",
"text",
",",
"encoding",
"=",
"UrlEncoding",
",",
"errors",
"=",
"'ignore'",
")",
":",
"try",
":",
"text_type",
"=",
"unicode",
"except",
"NameError",
":",
"text_type",
"=",
"str",
"if",
"isinstance",
"(",
"text",
",",
"text_typ... | Decode text to Unicode if not already done. | [
"Decode",
"text",
"to",
"Unicode",
"if",
"not",
"already",
"done",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L121-L129 |
53,634 | wummel/dosage | dosagelib/util.py | getPageContent | def getPageContent(url, session, max_content_bytes=MaxContentBytes):
"""Get text content of given URL."""
check_robotstxt(url, session)
# read page data
try:
page = urlopen(url, session, max_content_bytes=max_content_bytes)
except IOError:
page = urlopen(url, session, max_content_byt... | python | def getPageContent(url, session, max_content_bytes=MaxContentBytes):
"""Get text content of given URL."""
check_robotstxt(url, session)
# read page data
try:
page = urlopen(url, session, max_content_bytes=max_content_bytes)
except IOError:
page = urlopen(url, session, max_content_byt... | [
"def",
"getPageContent",
"(",
"url",
",",
"session",
",",
"max_content_bytes",
"=",
"MaxContentBytes",
")",
":",
"check_robotstxt",
"(",
"url",
",",
"session",
")",
"# read page data",
"try",
":",
"page",
"=",
"urlopen",
"(",
"url",
",",
"session",
",",
"max... | Get text content of given URL. | [
"Get",
"text",
"content",
"of",
"given",
"URL",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L185-L203 |
53,635 | wummel/dosage | dosagelib/util.py | getImageObject | def getImageObject(url, referrer, session, max_content_bytes=MaxImageBytes):
"""Get response object for given image URL."""
return urlopen(url, session, referrer=referrer, max_content_bytes=max_content_bytes, stream=True) | python | def getImageObject(url, referrer, session, max_content_bytes=MaxImageBytes):
"""Get response object for given image URL."""
return urlopen(url, session, referrer=referrer, max_content_bytes=max_content_bytes, stream=True) | [
"def",
"getImageObject",
"(",
"url",
",",
"referrer",
",",
"session",
",",
"max_content_bytes",
"=",
"MaxImageBytes",
")",
":",
"return",
"urlopen",
"(",
"url",
",",
"session",
",",
"referrer",
"=",
"referrer",
",",
"max_content_bytes",
"=",
"max_content_bytes",... | Get response object for given image URL. | [
"Get",
"response",
"object",
"for",
"given",
"image",
"URL",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L206-L208 |
53,636 | wummel/dosage | dosagelib/util.py | prettyMatcherList | def prettyMatcherList(things):
"""Try to construct a nicely-formatted string for a list of matcher
objects. Those may be compiled regular expressions or strings..."""
norm = []
for x in makeSequence(things):
if hasattr(x, 'pattern'):
norm.append(x.pattern)
else:
n... | python | def prettyMatcherList(things):
"""Try to construct a nicely-formatted string for a list of matcher
objects. Those may be compiled regular expressions or strings..."""
norm = []
for x in makeSequence(things):
if hasattr(x, 'pattern'):
norm.append(x.pattern)
else:
n... | [
"def",
"prettyMatcherList",
"(",
"things",
")",
":",
"norm",
"=",
"[",
"]",
"for",
"x",
"in",
"makeSequence",
"(",
"things",
")",
":",
"if",
"hasattr",
"(",
"x",
",",
"'pattern'",
")",
":",
"norm",
".",
"append",
"(",
"x",
".",
"pattern",
")",
"els... | Try to construct a nicely-formatted string for a list of matcher
objects. Those may be compiled regular expressions or strings... | [
"Try",
"to",
"construct",
"a",
"nicely",
"-",
"formatted",
"string",
"for",
"a",
"list",
"of",
"matcher",
"objects",
".",
"Those",
"may",
"be",
"compiled",
"regular",
"expressions",
"or",
"strings",
"..."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L219-L228 |
53,637 | wummel/dosage | dosagelib/util.py | normaliseURL | def normaliseURL(url):
"""Normalising
- strips and leading or trailing whitespace,
- replaces HTML entities and character references,
- removes any leading empty segments to avoid breaking urllib2.
"""
url = unicode_safe(url).strip()
# XXX: brutal hack
url = unescape(url)
pu = list(... | python | def normaliseURL(url):
"""Normalising
- strips and leading or trailing whitespace,
- replaces HTML entities and character references,
- removes any leading empty segments to avoid breaking urllib2.
"""
url = unicode_safe(url).strip()
# XXX: brutal hack
url = unescape(url)
pu = list(... | [
"def",
"normaliseURL",
"(",
"url",
")",
":",
"url",
"=",
"unicode_safe",
"(",
"url",
")",
".",
"strip",
"(",
")",
"# XXX: brutal hack",
"url",
"=",
"unescape",
"(",
"url",
")",
"pu",
"=",
"list",
"(",
"urlparse",
"(",
"url",
")",
")",
"segments",
"="... | Normalising
- strips and leading or trailing whitespace,
- replaces HTML entities and character references,
- removes any leading empty segments to avoid breaking urllib2. | [
"Normalising",
"-",
"strips",
"and",
"leading",
"or",
"trailing",
"whitespace",
"-",
"replaces",
"HTML",
"entities",
"and",
"character",
"references",
"-",
"removes",
"any",
"leading",
"empty",
"segments",
"to",
"avoid",
"breaking",
"urllib2",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L239-L259 |
53,638 | wummel/dosage | dosagelib/util.py | check_robotstxt | def check_robotstxt(url, session):
"""Check if robots.txt allows our user agent for the given URL.
@raises: IOError if URL is not allowed
"""
roboturl = get_roboturl(url)
rp = get_robotstxt_parser(roboturl, session=session)
if not rp.can_fetch(UserAgent, str(url)):
raise IOError("%s is d... | python | def check_robotstxt(url, session):
"""Check if robots.txt allows our user agent for the given URL.
@raises: IOError if URL is not allowed
"""
roboturl = get_roboturl(url)
rp = get_robotstxt_parser(roboturl, session=session)
if not rp.can_fetch(UserAgent, str(url)):
raise IOError("%s is d... | [
"def",
"check_robotstxt",
"(",
"url",
",",
"session",
")",
":",
"roboturl",
"=",
"get_roboturl",
"(",
"url",
")",
"rp",
"=",
"get_robotstxt_parser",
"(",
"roboturl",
",",
"session",
"=",
"session",
")",
"if",
"not",
"rp",
".",
"can_fetch",
"(",
"UserAgent"... | Check if robots.txt allows our user agent for the given URL.
@raises: IOError if URL is not allowed | [
"Check",
"if",
"robots",
".",
"txt",
"allows",
"our",
"user",
"agent",
"for",
"the",
"given",
"URL",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L268-L275 |
53,639 | wummel/dosage | dosagelib/util.py | get_robotstxt_parser | def get_robotstxt_parser(url, session=None):
"""Get a RobotFileParser for the given robots.txt URL."""
rp = robotparser.RobotFileParser()
try:
req = urlopen(url, session, max_content_bytes=MaxContentBytes, raise_for_status=False)
except Exception:
# connect or timeout errors are treated ... | python | def get_robotstxt_parser(url, session=None):
"""Get a RobotFileParser for the given robots.txt URL."""
rp = robotparser.RobotFileParser()
try:
req = urlopen(url, session, max_content_bytes=MaxContentBytes, raise_for_status=False)
except Exception:
# connect or timeout errors are treated ... | [
"def",
"get_robotstxt_parser",
"(",
"url",
",",
"session",
"=",
"None",
")",
":",
"rp",
"=",
"robotparser",
".",
"RobotFileParser",
"(",
")",
"try",
":",
"req",
"=",
"urlopen",
"(",
"url",
",",
"session",
",",
"max_content_bytes",
"=",
"MaxContentBytes",
"... | Get a RobotFileParser for the given robots.txt URL. | [
"Get",
"a",
"RobotFileParser",
"for",
"the",
"given",
"robots",
".",
"txt",
"URL",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L279-L292 |
53,640 | wummel/dosage | dosagelib/util.py | urlopen | def urlopen(url, session, referrer=None, max_content_bytes=None,
timeout=ConnectionTimeoutSecs, raise_for_status=True,
stream=False, data=None, useragent=UserAgent):
"""Open an URL and return the response object."""
out.debug(u'Open URL %s' % url)
headers = {'User-Agent': useragent}
... | python | def urlopen(url, session, referrer=None, max_content_bytes=None,
timeout=ConnectionTimeoutSecs, raise_for_status=True,
stream=False, data=None, useragent=UserAgent):
"""Open an URL and return the response object."""
out.debug(u'Open URL %s' % url)
headers = {'User-Agent': useragent}
... | [
"def",
"urlopen",
"(",
"url",
",",
"session",
",",
"referrer",
"=",
"None",
",",
"max_content_bytes",
"=",
"None",
",",
"timeout",
"=",
"ConnectionTimeoutSecs",
",",
"raise_for_status",
"=",
"True",
",",
"stream",
"=",
"False",
",",
"data",
"=",
"None",
",... | Open an URL and return the response object. | [
"Open",
"an",
"URL",
"and",
"return",
"the",
"response",
"object",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L295-L331 |
53,641 | wummel/dosage | dosagelib/util.py | check_content_size | def check_content_size(url, headers, max_content_bytes):
"""Check that content length in URL response headers do not exceed the
given maximum bytes.
"""
if not max_content_bytes:
return
if 'content-length' in headers:
size = int(headers['content-length'])
if size > max_conten... | python | def check_content_size(url, headers, max_content_bytes):
"""Check that content length in URL response headers do not exceed the
given maximum bytes.
"""
if not max_content_bytes:
return
if 'content-length' in headers:
size = int(headers['content-length'])
if size > max_conten... | [
"def",
"check_content_size",
"(",
"url",
",",
"headers",
",",
"max_content_bytes",
")",
":",
"if",
"not",
"max_content_bytes",
":",
"return",
"if",
"'content-length'",
"in",
"headers",
":",
"size",
"=",
"int",
"(",
"headers",
"[",
"'content-length'",
"]",
")",... | Check that content length in URL response headers do not exceed the
given maximum bytes. | [
"Check",
"that",
"content",
"length",
"in",
"URL",
"response",
"headers",
"do",
"not",
"exceed",
"the",
"given",
"maximum",
"bytes",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L334-L344 |
53,642 | wummel/dosage | dosagelib/util.py | splitpath | def splitpath(path):
"""Split a path in its components."""
c = []
head, tail = os.path.split(path)
while tail:
c.insert(0, tail)
head, tail = os.path.split(head)
return c | python | def splitpath(path):
"""Split a path in its components."""
c = []
head, tail = os.path.split(path)
while tail:
c.insert(0, tail)
head, tail = os.path.split(head)
return c | [
"def",
"splitpath",
"(",
"path",
")",
":",
"c",
"=",
"[",
"]",
"head",
",",
"tail",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"while",
"tail",
":",
"c",
".",
"insert",
"(",
"0",
",",
"tail",
")",
"head",
",",
"tail",
"=",
"os",
... | Split a path in its components. | [
"Split",
"a",
"path",
"in",
"its",
"components",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L347-L354 |
53,643 | wummel/dosage | dosagelib/util.py | getRelativePath | def getRelativePath(basepath, path):
"""Get a path that is relative to the given base path."""
basepath = splitpath(os.path.abspath(basepath))
path = splitpath(os.path.abspath(path))
afterCommon = False
for c in basepath:
if afterCommon or path[0] != c:
path.insert(0, os.path.par... | python | def getRelativePath(basepath, path):
"""Get a path that is relative to the given base path."""
basepath = splitpath(os.path.abspath(basepath))
path = splitpath(os.path.abspath(path))
afterCommon = False
for c in basepath:
if afterCommon or path[0] != c:
path.insert(0, os.path.par... | [
"def",
"getRelativePath",
"(",
"basepath",
",",
"path",
")",
":",
"basepath",
"=",
"splitpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"basepath",
")",
")",
"path",
"=",
"splitpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
")"... | Get a path that is relative to the given base path. | [
"Get",
"a",
"path",
"that",
"is",
"relative",
"to",
"the",
"given",
"base",
"path",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L357-L368 |
53,644 | wummel/dosage | dosagelib/util.py | getQueryParams | def getQueryParams(url):
"""Get URL query parameters."""
query = urlsplit(url)[3]
out.debug(u'Extracting query parameters from %r (%r)...' % (url, query))
return cgi.parse_qs(query) | python | def getQueryParams(url):
"""Get URL query parameters."""
query = urlsplit(url)[3]
out.debug(u'Extracting query parameters from %r (%r)...' % (url, query))
return cgi.parse_qs(query) | [
"def",
"getQueryParams",
"(",
"url",
")",
":",
"query",
"=",
"urlsplit",
"(",
"url",
")",
"[",
"3",
"]",
"out",
".",
"debug",
"(",
"u'Extracting query parameters from %r (%r)...'",
"%",
"(",
"url",
",",
"query",
")",
")",
"return",
"cgi",
".",
"parse_qs",
... | Get URL query parameters. | [
"Get",
"URL",
"query",
"parameters",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L371-L375 |
53,645 | wummel/dosage | dosagelib/util.py | unquote | def unquote(text):
"""Replace all percent-encoded entities in text."""
while '%' in text:
newtext = url_unquote(text)
if newtext == text:
break
text = newtext
return text | python | def unquote(text):
"""Replace all percent-encoded entities in text."""
while '%' in text:
newtext = url_unquote(text)
if newtext == text:
break
text = newtext
return text | [
"def",
"unquote",
"(",
"text",
")",
":",
"while",
"'%'",
"in",
"text",
":",
"newtext",
"=",
"url_unquote",
"(",
"text",
")",
"if",
"newtext",
"==",
"text",
":",
"break",
"text",
"=",
"newtext",
"return",
"text"
] | Replace all percent-encoded entities in text. | [
"Replace",
"all",
"percent",
"-",
"encoded",
"entities",
"in",
"text",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L460-L467 |
53,646 | wummel/dosage | dosagelib/util.py | getFilename | def getFilename(name):
"""Get a filename from given name without dangerous or incompatible characters."""
# first replace all illegal chars
name = re.sub(r"[^0-9a-zA-Z_\-\.]", "_", name)
# then remove double dots and underscores
while ".." in name:
name = name.replace('..', '.')
while "_... | python | def getFilename(name):
"""Get a filename from given name without dangerous or incompatible characters."""
# first replace all illegal chars
name = re.sub(r"[^0-9a-zA-Z_\-\.]", "_", name)
# then remove double dots and underscores
while ".." in name:
name = name.replace('..', '.')
while "_... | [
"def",
"getFilename",
"(",
"name",
")",
":",
"# first replace all illegal chars",
"name",
"=",
"re",
".",
"sub",
"(",
"r\"[^0-9a-zA-Z_\\-\\.]\"",
",",
"\"_\"",
",",
"name",
")",
"# then remove double dots and underscores",
"while",
"\"..\"",
"in",
"name",
":",
"name... | Get a filename from given name without dangerous or incompatible characters. | [
"Get",
"a",
"filename",
"from",
"given",
"name",
"without",
"dangerous",
"or",
"incompatible",
"characters",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L500-L512 |
53,647 | wummel/dosage | dosagelib/util.py | getExistingFile | def getExistingFile(name, max_suffix=1000):
"""Add filename suffix until file exists
@return: filename if file is found
@raise: ValueError if maximum suffix number is reached while searching
"""
num = 1
stem, ext = os.path.splitext(name)
filename = name
while not os.path.exists(filename)... | python | def getExistingFile(name, max_suffix=1000):
"""Add filename suffix until file exists
@return: filename if file is found
@raise: ValueError if maximum suffix number is reached while searching
"""
num = 1
stem, ext = os.path.splitext(name)
filename = name
while not os.path.exists(filename)... | [
"def",
"getExistingFile",
"(",
"name",
",",
"max_suffix",
"=",
"1000",
")",
":",
"num",
"=",
"1",
"stem",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"name",
")",
"filename",
"=",
"name",
"while",
"not",
"os",
".",
"path",
".",
"exist... | Add filename suffix until file exists
@return: filename if file is found
@raise: ValueError if maximum suffix number is reached while searching | [
"Add",
"filename",
"suffix",
"until",
"file",
"exists"
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L515-L529 |
53,648 | wummel/dosage | dosagelib/util.py | getNonexistingFile | def getNonexistingFile(name):
"""Add filename suffix until file not exists
@return: filename
"""
num = 1
stem, ext = os.path.splitext(name)
filename = name
while os.path.exists(filename):
suffix = "-%d" % num
filename = stem + suffix + ext
num += 1
return filename | python | def getNonexistingFile(name):
"""Add filename suffix until file not exists
@return: filename
"""
num = 1
stem, ext = os.path.splitext(name)
filename = name
while os.path.exists(filename):
suffix = "-%d" % num
filename = stem + suffix + ext
num += 1
return filename | [
"def",
"getNonexistingFile",
"(",
"name",
")",
":",
"num",
"=",
"1",
"stem",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"name",
")",
"filename",
"=",
"name",
"while",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"suff... | Add filename suffix until file not exists
@return: filename | [
"Add",
"filename",
"suffix",
"until",
"file",
"not",
"exists"
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/util.py#L532-L543 |
53,649 | wummel/dosage | scripts/creators.py | has_gocomics_comic | def has_gocomics_comic(name):
"""Test if comic name already exists."""
cname = "Gocomics/%s" % name
for scraperclass in get_scraperclasses():
lname = scraperclass.getName().lower()
if lname == cname.lower():
return True
return False | python | def has_gocomics_comic(name):
"""Test if comic name already exists."""
cname = "Gocomics/%s" % name
for scraperclass in get_scraperclasses():
lname = scraperclass.getName().lower()
if lname == cname.lower():
return True
return False | [
"def",
"has_gocomics_comic",
"(",
"name",
")",
":",
"cname",
"=",
"\"Gocomics/%s\"",
"%",
"name",
"for",
"scraperclass",
"in",
"get_scraperclasses",
"(",
")",
":",
"lname",
"=",
"scraperclass",
".",
"getName",
"(",
")",
".",
"lower",
"(",
")",
"if",
"lname... | Test if comic name already exists. | [
"Test",
"if",
"comic",
"name",
"already",
"exists",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/creators.py#L56-L63 |
53,650 | wummel/dosage | scripts/creators.py | print_results | def print_results(args):
"""Print comics."""
min_comics, filename = args
with codecs.open(filename, 'a', 'utf-8') as fp:
for name, url in sorted(load_result(json_file).items()):
if name in exclude_comics:
continue
if has_gocomics_comic(name):
p... | python | def print_results(args):
"""Print comics."""
min_comics, filename = args
with codecs.open(filename, 'a', 'utf-8') as fp:
for name, url in sorted(load_result(json_file).items()):
if name in exclude_comics:
continue
if has_gocomics_comic(name):
p... | [
"def",
"print_results",
"(",
"args",
")",
":",
"min_comics",
",",
"filename",
"=",
"args",
"with",
"codecs",
".",
"open",
"(",
"filename",
",",
"'a'",
",",
"'utf-8'",
")",
"as",
"fp",
":",
"for",
"name",
",",
"url",
"in",
"sorted",
"(",
"load_result",
... | Print comics. | [
"Print",
"comics",
"."
] | a0109c3a46219f280e6e5e77183674e40da0f304 | https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/creators.py#L66-L79 |
53,651 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.search_product | def search_product(self, limit=100, offset=0, with_price=0, with_supported_software=0,
with_description=0):
"""Search the list of available products."""
response = self.request(E.searchProductSslCertRequest(
E.limit(limit),
E.offset(offset),
E.... | python | def search_product(self, limit=100, offset=0, with_price=0, with_supported_software=0,
with_description=0):
"""Search the list of available products."""
response = self.request(E.searchProductSslCertRequest(
E.limit(limit),
E.offset(offset),
E.... | [
"def",
"search_product",
"(",
"self",
",",
"limit",
"=",
"100",
",",
"offset",
"=",
"0",
",",
"with_price",
"=",
"0",
",",
"with_supported_software",
"=",
"0",
",",
"with_description",
"=",
"0",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"... | Search the list of available products. | [
"Search",
"the",
"list",
"of",
"available",
"products",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L23-L34 |
53,652 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.retrieve_product | def retrieve_product(self, product_id):
"""Retrieve details on a single product."""
response = self.request(E.retrieveProductSslCertRequest(
E.id(product_id)
))
return response.as_model(SSLProduct) | python | def retrieve_product(self, product_id):
"""Retrieve details on a single product."""
response = self.request(E.retrieveProductSslCertRequest(
E.id(product_id)
))
return response.as_model(SSLProduct) | [
"def",
"retrieve_product",
"(",
"self",
",",
"product_id",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"retrieveProductSslCertRequest",
"(",
"E",
".",
"id",
"(",
"product_id",
")",
")",
")",
"return",
"response",
".",
"as_model",
"(",... | Retrieve details on a single product. | [
"Retrieve",
"details",
"on",
"a",
"single",
"product",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L36-L43 |
53,653 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.search_order | def search_order(self, limit=100, offset=0, common_name_pattern=None, status=None,
contact_handle=None):
"""Search all SSL certificate orders."""
response = self.request(E.searchOrderSslCertRequest(
E.limit(limit),
E.offset(offset),
OE('commonNam... | python | def search_order(self, limit=100, offset=0, common_name_pattern=None, status=None,
contact_handle=None):
"""Search all SSL certificate orders."""
response = self.request(E.searchOrderSslCertRequest(
E.limit(limit),
E.offset(offset),
OE('commonNam... | [
"def",
"search_order",
"(",
"self",
",",
"limit",
"=",
"100",
",",
"offset",
"=",
"0",
",",
"common_name_pattern",
"=",
"None",
",",
"status",
"=",
"None",
",",
"contact_handle",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",... | Search all SSL certificate orders. | [
"Search",
"all",
"SSL",
"certificate",
"orders",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L45-L57 |
53,654 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.retrieve_order | def retrieve_order(self, order_id):
"""Retrieve details on a single order."""
response = self.request(E.retrieveOrderSslCertRequest(
E.id(order_id)
))
return response.as_model(SSLOrder) | python | def retrieve_order(self, order_id):
"""Retrieve details on a single order."""
response = self.request(E.retrieveOrderSslCertRequest(
E.id(order_id)
))
return response.as_model(SSLOrder) | [
"def",
"retrieve_order",
"(",
"self",
",",
"order_id",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"retrieveOrderSslCertRequest",
"(",
"E",
".",
"id",
"(",
"order_id",
")",
")",
")",
"return",
"response",
".",
"as_model",
"(",
"SSLO... | Retrieve details on a single order. | [
"Retrieve",
"details",
"on",
"a",
"single",
"order",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L59-L66 |
53,655 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.create | def create(self, product_id, period, csr, software_id, organization_handle,
approver_email=None, signature_hash_algorithm=None, domain_validation_methods=None,
hostnames=None, technical_handle=None):
"""Order a new SSL certificate."""
response = self.request(E.createSslCer... | python | def create(self, product_id, period, csr, software_id, organization_handle,
approver_email=None, signature_hash_algorithm=None, domain_validation_methods=None,
hostnames=None, technical_handle=None):
"""Order a new SSL certificate."""
response = self.request(E.createSslCer... | [
"def",
"create",
"(",
"self",
",",
"product_id",
",",
"period",
",",
"csr",
",",
"software_id",
",",
"organization_handle",
",",
"approver_email",
"=",
"None",
",",
"signature_hash_algorithm",
"=",
"None",
",",
"domain_validation_methods",
"=",
"None",
",",
"hos... | Order a new SSL certificate. | [
"Order",
"a",
"new",
"SSL",
"certificate",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L68-L86 |
53,656 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.reissue | def reissue(self, order_id, csr, software_id, organization_handle, approver_email=None,
signature_hash_algorithm=None, domain_validation_methods=None, hostnames=None,
technical_handle=None):
"""Reissue an SSL certificate order"""
response = self.request(E.reissueSslCertR... | python | def reissue(self, order_id, csr, software_id, organization_handle, approver_email=None,
signature_hash_algorithm=None, domain_validation_methods=None, hostnames=None,
technical_handle=None):
"""Reissue an SSL certificate order"""
response = self.request(E.reissueSslCertR... | [
"def",
"reissue",
"(",
"self",
",",
"order_id",
",",
"csr",
",",
"software_id",
",",
"organization_handle",
",",
"approver_email",
"=",
"None",
",",
"signature_hash_algorithm",
"=",
"None",
",",
"domain_validation_methods",
"=",
"None",
",",
"hostnames",
"=",
"N... | Reissue an SSL certificate order | [
"Reissue",
"an",
"SSL",
"certificate",
"order"
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L88-L105 |
53,657 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.modify | def modify(self, order_id, approver_email=None, domain_validation_methods=None):
"""Modify an ordered SSL certificate."""
response = self.request(E.modifySslCertRequest(
E.id(order_id),
OE('approverEmail', approver_email),
OE('domainValidationMethods', domain_validat... | python | def modify(self, order_id, approver_email=None, domain_validation_methods=None):
"""Modify an ordered SSL certificate."""
response = self.request(E.modifySslCertRequest(
E.id(order_id),
OE('approverEmail', approver_email),
OE('domainValidationMethods', domain_validat... | [
"def",
"modify",
"(",
"self",
",",
"order_id",
",",
"approver_email",
"=",
"None",
",",
"domain_validation_methods",
"=",
"None",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"modifySslCertRequest",
"(",
"E",
".",
"id",
"(",
"order_id"... | Modify an ordered SSL certificate. | [
"Modify",
"an",
"ordered",
"SSL",
"certificate",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L107-L116 |
53,658 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.cancel | def cancel(self, order_id):
"""Cancel an ordered SSL certificate."""
response = self.request(E.cancelSslCertRequest(
E.id(order_id)
))
return int(response.data.id) | python | def cancel(self, order_id):
"""Cancel an ordered SSL certificate."""
response = self.request(E.cancelSslCertRequest(
E.id(order_id)
))
return int(response.data.id) | [
"def",
"cancel",
"(",
"self",
",",
"order_id",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"cancelSslCertRequest",
"(",
"E",
".",
"id",
"(",
"order_id",
")",
")",
")",
"return",
"int",
"(",
"response",
".",
"data",
".",
"id",
... | Cancel an ordered SSL certificate. | [
"Cancel",
"an",
"ordered",
"SSL",
"certificate",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L118-L125 |
53,659 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.retrieve_approver_email_list | def retrieve_approver_email_list(self, domain, product_id):
"""Retrieve the list of allowed approver email addresses."""
response = self.request(E.retrieveApproverEmailListSslCertRequest(
E.domain(domain),
E.productId(product_id)
))
return [str(i) for i in respo... | python | def retrieve_approver_email_list(self, domain, product_id):
"""Retrieve the list of allowed approver email addresses."""
response = self.request(E.retrieveApproverEmailListSslCertRequest(
E.domain(domain),
E.productId(product_id)
))
return [str(i) for i in respo... | [
"def",
"retrieve_approver_email_list",
"(",
"self",
",",
"domain",
",",
"product_id",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"retrieveApproverEmailListSslCertRequest",
"(",
"E",
".",
"domain",
"(",
"domain",
")",
",",
"E",
".",
"pr... | Retrieve the list of allowed approver email addresses. | [
"Retrieve",
"the",
"list",
"of",
"allowed",
"approver",
"email",
"addresses",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L127-L135 |
53,660 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.resend_approver_email | def resend_approver_email(self, order_id):
"""Resend the activation email to the approver."""
response = self.request(E.resendApproverEmailSslCertRequest(
E.id(order_id)
))
return int(response.data.id) | python | def resend_approver_email(self, order_id):
"""Resend the activation email to the approver."""
response = self.request(E.resendApproverEmailSslCertRequest(
E.id(order_id)
))
return int(response.data.id) | [
"def",
"resend_approver_email",
"(",
"self",
",",
"order_id",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"resendApproverEmailSslCertRequest",
"(",
"E",
".",
"id",
"(",
"order_id",
")",
")",
")",
"return",
"int",
"(",
"response",
".",... | Resend the activation email to the approver. | [
"Resend",
"the",
"activation",
"email",
"to",
"the",
"approver",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L137-L144 |
53,661 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.change_approver_email_address | def change_approver_email_address(self, order_id, approver_email):
"""Change the approver email address for an ordered SSL certificate."""
response = self.request(
E.changeApproverEmailAddressSslCertRequest(
E.id(order_id),
E.approverEmail(approver_email)
... | python | def change_approver_email_address(self, order_id, approver_email):
"""Change the approver email address for an ordered SSL certificate."""
response = self.request(
E.changeApproverEmailAddressSslCertRequest(
E.id(order_id),
E.approverEmail(approver_email)
... | [
"def",
"change_approver_email_address",
"(",
"self",
",",
"order_id",
",",
"approver_email",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"changeApproverEmailAddressSslCertRequest",
"(",
"E",
".",
"id",
"(",
"order_id",
")",
",",
"E",
".",... | Change the approver email address for an ordered SSL certificate. | [
"Change",
"the",
"approver",
"email",
"address",
"for",
"an",
"ordered",
"SSL",
"certificate",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L146-L156 |
53,662 | AntagonistHQ/openprovider.py | openprovider/modules/ssl.py | SSLModule.decode_csr | def decode_csr(self, csr):
"""Decode a CSR and return its data."""
response = self.request(E.decodeCsrSslCertRequest(
E.csr(csr)
))
return response.data | python | def decode_csr(self, csr):
"""Decode a CSR and return its data."""
response = self.request(E.decodeCsrSslCertRequest(
E.csr(csr)
))
return response.data | [
"def",
"decode_csr",
"(",
"self",
",",
"csr",
")",
":",
"response",
"=",
"self",
".",
"request",
"(",
"E",
".",
"decodeCsrSslCertRequest",
"(",
"E",
".",
"csr",
"(",
"csr",
")",
")",
")",
"return",
"response",
".",
"data"
] | Decode a CSR and return its data. | [
"Decode",
"a",
"CSR",
"and",
"return",
"its",
"data",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/modules/ssl.py#L158-L165 |
53,663 | gmr/tinman | tinman/application.py | Application._import_class | def _import_class(self, class_path):
"""Try and import the specified namespaced class.
:param str class_path: The full path to the class (foo.bar.Baz)
:rtype: class
"""
LOGGER.debug('Importing %s', class_path)
try:
return utils.import_namespaced_class(class_... | python | def _import_class(self, class_path):
"""Try and import the specified namespaced class.
:param str class_path: The full path to the class (foo.bar.Baz)
:rtype: class
"""
LOGGER.debug('Importing %s', class_path)
try:
return utils.import_namespaced_class(class_... | [
"def",
"_import_class",
"(",
"self",
",",
"class_path",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'Importing %s'",
",",
"class_path",
")",
"try",
":",
"return",
"utils",
".",
"import_namespaced_class",
"(",
"class_path",
")",
"except",
"ImportError",
"as",
"erro... | Try and import the specified namespaced class.
:param str class_path: The full path to the class (foo.bar.Baz)
:rtype: class | [
"Try",
"and",
"import",
"the",
"specified",
"namespaced",
"class",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L88-L100 |
53,664 | gmr/tinman | tinman/application.py | Application._import_module | def _import_module(self, module_path):
"""Dynamically import a module returning a handle to it.
:param str module_path: The module path
:rtype: module
"""
LOGGER.debug('Importing %s', module_path)
try:
return __import__(module_path)
except ImportErro... | python | def _import_module(self, module_path):
"""Dynamically import a module returning a handle to it.
:param str module_path: The module path
:rtype: module
"""
LOGGER.debug('Importing %s', module_path)
try:
return __import__(module_path)
except ImportErro... | [
"def",
"_import_module",
"(",
"self",
",",
"module_path",
")",
":",
"LOGGER",
".",
"debug",
"(",
"'Importing %s'",
",",
"module_path",
")",
"try",
":",
"return",
"__import__",
"(",
"module_path",
")",
"except",
"ImportError",
"as",
"error",
":",
"LOGGER",
".... | Dynamically import a module returning a handle to it.
:param str module_path: The module path
:rtype: module | [
"Dynamically",
"import",
"a",
"module",
"returning",
"a",
"handle",
"to",
"it",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L102-L114 |
53,665 | gmr/tinman | tinman/application.py | Application._insert_base_path | def _insert_base_path(self):
"""If the "base" path is set in the paths section of the config, insert
it into the python path.
"""
if config.BASE in self.paths:
sys.path.insert(0, self.paths[config.BASE]) | python | def _insert_base_path(self):
"""If the "base" path is set in the paths section of the config, insert
it into the python path.
"""
if config.BASE in self.paths:
sys.path.insert(0, self.paths[config.BASE]) | [
"def",
"_insert_base_path",
"(",
"self",
")",
":",
"if",
"config",
".",
"BASE",
"in",
"self",
".",
"paths",
":",
"sys",
".",
"path",
".",
"insert",
"(",
"0",
",",
"self",
".",
"paths",
"[",
"config",
".",
"BASE",
"]",
")"
] | If the "base" path is set in the paths section of the config, insert
it into the python path. | [
"If",
"the",
"base",
"path",
"is",
"set",
"in",
"the",
"paths",
"section",
"of",
"the",
"config",
"insert",
"it",
"into",
"the",
"python",
"path",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L116-L122 |
53,666 | gmr/tinman | tinman/application.py | Application._prepare_route | def _prepare_route(self, attrs):
"""Take a given inbound list for a route and parse it creating the
route and importing the class it belongs to.
:param list attrs: Route attributes
:rtype: list
"""
if type(attrs) not in (list, tuple):
LOGGER.error('Invalid r... | python | def _prepare_route(self, attrs):
"""Take a given inbound list for a route and parse it creating the
route and importing the class it belongs to.
:param list attrs: Route attributes
:rtype: list
"""
if type(attrs) not in (list, tuple):
LOGGER.error('Invalid r... | [
"def",
"_prepare_route",
"(",
"self",
",",
"attrs",
")",
":",
"if",
"type",
"(",
"attrs",
")",
"not",
"in",
"(",
"list",
",",
"tuple",
")",
":",
"LOGGER",
".",
"error",
"(",
"'Invalid route, must be a list or tuple: %r'",
",",
"attrs",
")",
"return",
"# By... | Take a given inbound list for a route and parse it creating the
route and importing the class it belongs to.
:param list attrs: Route attributes
:rtype: list | [
"Take",
"a",
"given",
"inbound",
"list",
"for",
"a",
"route",
"and",
"parse",
"it",
"creating",
"the",
"route",
"and",
"importing",
"the",
"class",
"it",
"belongs",
"to",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L139-L179 |
53,667 | gmr/tinman | tinman/application.py | Application._prepare_routes | def _prepare_routes(self, routes):
"""Prepare the routes by iterating through the list of tuples & calling
prepare route on them.
:param routes: Routes to prepare
:type routes: list
:rtype: list
:raises: ValueError
"""
if not isinstance(routes, list):
... | python | def _prepare_routes(self, routes):
"""Prepare the routes by iterating through the list of tuples & calling
prepare route on them.
:param routes: Routes to prepare
:type routes: list
:rtype: list
:raises: ValueError
"""
if not isinstance(routes, list):
... | [
"def",
"_prepare_routes",
"(",
"self",
",",
"routes",
")",
":",
"if",
"not",
"isinstance",
"(",
"routes",
",",
"list",
")",
":",
"raise",
"ValueError",
"(",
"'Routes parameter must be a list of tuples'",
")",
"prepared_routes",
"=",
"list",
"(",
")",
"for",
"p... | Prepare the routes by iterating through the list of tuples & calling
prepare route on them.
:param routes: Routes to prepare
:type routes: list
:rtype: list
:raises: ValueError | [
"Prepare",
"the",
"routes",
"by",
"iterating",
"through",
"the",
"list",
"of",
"tuples",
"&",
"calling",
"prepare",
"route",
"on",
"them",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L181-L199 |
53,668 | gmr/tinman | tinman/application.py | Application._prepare_transforms | def _prepare_transforms(self):
"""Prepare the list of transforming objects"""
for offset, value in enumerate(self._config.get(config.TRANSFORMS, [])):
self._config[config.TRANSFORMS][offset] = self._import_class(value) | python | def _prepare_transforms(self):
"""Prepare the list of transforming objects"""
for offset, value in enumerate(self._config.get(config.TRANSFORMS, [])):
self._config[config.TRANSFORMS][offset] = self._import_class(value) | [
"def",
"_prepare_transforms",
"(",
"self",
")",
":",
"for",
"offset",
",",
"value",
"in",
"enumerate",
"(",
"self",
".",
"_config",
".",
"get",
"(",
"config",
".",
"TRANSFORMS",
",",
"[",
"]",
")",
")",
":",
"self",
".",
"_config",
"[",
"config",
"."... | Prepare the list of transforming objects | [
"Prepare",
"the",
"list",
"of",
"transforming",
"objects"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L216-L219 |
53,669 | gmr/tinman | tinman/application.py | Application._prepare_translations | def _prepare_translations(self):
"""Load in translations if they are set, and add the default locale as
well.
"""
if config.TRANSLATIONS in self.paths:
LOGGER.info('Loading translations from %s',
self.paths[config.TRANSLATIONS])
from torna... | python | def _prepare_translations(self):
"""Load in translations if they are set, and add the default locale as
well.
"""
if config.TRANSLATIONS in self.paths:
LOGGER.info('Loading translations from %s',
self.paths[config.TRANSLATIONS])
from torna... | [
"def",
"_prepare_translations",
"(",
"self",
")",
":",
"if",
"config",
".",
"TRANSLATIONS",
"in",
"self",
".",
"paths",
":",
"LOGGER",
".",
"info",
"(",
"'Loading translations from %s'",
",",
"self",
".",
"paths",
"[",
"config",
".",
"TRANSLATIONS",
"]",
")"... | Load in translations if they are set, and add the default locale as
well. | [
"Load",
"in",
"translations",
"if",
"they",
"are",
"set",
"and",
"add",
"the",
"default",
"locale",
"as",
"well",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L221-L234 |
53,670 | gmr/tinman | tinman/application.py | Application._prepare_uimodules | def _prepare_uimodules(self):
"""Prepare the UI Modules from a list of namespaced paths."""
for key, value in self._config.get(config.UI_MODULES, {}).iteritems():
self._config[config.UI_MODULES][key] = self._import_class(value)
self._config[config.UI_MODULES] = dict(self._config[conf... | python | def _prepare_uimodules(self):
"""Prepare the UI Modules from a list of namespaced paths."""
for key, value in self._config.get(config.UI_MODULES, {}).iteritems():
self._config[config.UI_MODULES][key] = self._import_class(value)
self._config[config.UI_MODULES] = dict(self._config[conf... | [
"def",
"_prepare_uimodules",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"_config",
".",
"get",
"(",
"config",
".",
"UI_MODULES",
",",
"{",
"}",
")",
".",
"iteritems",
"(",
")",
":",
"self",
".",
"_config",
"[",
"config",
... | Prepare the UI Modules from a list of namespaced paths. | [
"Prepare",
"the",
"UI",
"Modules",
"from",
"a",
"list",
"of",
"namespaced",
"paths",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L236-L240 |
53,671 | gmr/tinman | tinman/application.py | Application._prepare_version | def _prepare_version(self):
"""Setup the application version"""
if config.VERSION not in self._config:
self._config[config.VERSION] = __version__ | python | def _prepare_version(self):
"""Setup the application version"""
if config.VERSION not in self._config:
self._config[config.VERSION] = __version__ | [
"def",
"_prepare_version",
"(",
"self",
")",
":",
"if",
"config",
".",
"VERSION",
"not",
"in",
"self",
".",
"_config",
":",
"self",
".",
"_config",
"[",
"config",
".",
"VERSION",
"]",
"=",
"__version__"
] | Setup the application version | [
"Setup",
"the",
"application",
"version"
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L242-L245 |
53,672 | gmr/tinman | tinman/application.py | Attributes.add | def add(self, item, value):
"""Add an attribute value to our object instance.
:param str item: Application attribute name
:param any value: Value to associate with the attribute
:raises: AttributeError
"""
if item in self.__dict__[self.ATTRIBUTES].keys():
ra... | python | def add(self, item, value):
"""Add an attribute value to our object instance.
:param str item: Application attribute name
:param any value: Value to associate with the attribute
:raises: AttributeError
"""
if item in self.__dict__[self.ATTRIBUTES].keys():
ra... | [
"def",
"add",
"(",
"self",
",",
"item",
",",
"value",
")",
":",
"if",
"item",
"in",
"self",
".",
"__dict__",
"[",
"self",
".",
"ATTRIBUTES",
"]",
".",
"keys",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"'%s already exists'",
"%",
"item",
")",
"se... | Add an attribute value to our object instance.
:param str item: Application attribute name
:param any value: Value to associate with the attribute
:raises: AttributeError | [
"Add",
"an",
"attribute",
"value",
"to",
"our",
"object",
"instance",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L329-L339 |
53,673 | gmr/tinman | tinman/application.py | Attributes.remove | def remove(self, item):
"""Remove an attribute value to our object instance.
:param str item: Application attribute name
:raises: AttributeError
"""
if item not in self.__dict__[self.ATTRIBUTES].keys():
raise AttributeError('%s does not exist' % item)
delatt... | python | def remove(self, item):
"""Remove an attribute value to our object instance.
:param str item: Application attribute name
:raises: AttributeError
"""
if item not in self.__dict__[self.ATTRIBUTES].keys():
raise AttributeError('%s does not exist' % item)
delatt... | [
"def",
"remove",
"(",
"self",
",",
"item",
")",
":",
"if",
"item",
"not",
"in",
"self",
".",
"__dict__",
"[",
"self",
".",
"ATTRIBUTES",
"]",
".",
"keys",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"'%s does not exist'",
"%",
"item",
")",
"delattr"... | Remove an attribute value to our object instance.
:param str item: Application attribute name
:raises: AttributeError | [
"Remove",
"an",
"attribute",
"value",
"to",
"our",
"object",
"instance",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/application.py#L341-L350 |
53,674 | danpoland/pyramid-restful-framework | pyramid_restful/pagination/pagenumber.py | Paginator.count | def count(self):
"""
Returns the total number of objects, across all pages.
"""
try:
return self.object_list.count()
except (AttributeError, TypeError):
# AttributeError if object_list has no count() method.
# TypeError if object_list.count() ... | python | def count(self):
"""
Returns the total number of objects, across all pages.
"""
try:
return self.object_list.count()
except (AttributeError, TypeError):
# AttributeError if object_list has no count() method.
# TypeError if object_list.count() ... | [
"def",
"count",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"object_list",
".",
"count",
"(",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
")",
":",
"# AttributeError if object_list has no count() method.",
"# TypeError if object_list.count() ... | Returns the total number of objects, across all pages. | [
"Returns",
"the",
"total",
"number",
"of",
"objects",
"across",
"all",
"pages",
"."
] | 4d8c9db44b1869c3d1fdd59ca304c3166473fcbb | https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/pagination/pagenumber.py#L98-L109 |
53,675 | danpoland/pyramid-restful-framework | pyramid_restful/pagination/pagenumber.py | Paginator.num_pages | def num_pages(self):
"""
Returns the total number of pages.
"""
if self.count == 0 and not self.allow_empty_first_page:
return 0
hits = max(1, self.count - self.orphans)
return int(ceil(hits / float(self.per_page))) | python | def num_pages(self):
"""
Returns the total number of pages.
"""
if self.count == 0 and not self.allow_empty_first_page:
return 0
hits = max(1, self.count - self.orphans)
return int(ceil(hits / float(self.per_page))) | [
"def",
"num_pages",
"(",
"self",
")",
":",
"if",
"self",
".",
"count",
"==",
"0",
"and",
"not",
"self",
".",
"allow_empty_first_page",
":",
"return",
"0",
"hits",
"=",
"max",
"(",
"1",
",",
"self",
".",
"count",
"-",
"self",
".",
"orphans",
")",
"r... | Returns the total number of pages. | [
"Returns",
"the",
"total",
"number",
"of",
"pages",
"."
] | 4d8c9db44b1869c3d1fdd59ca304c3166473fcbb | https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/pagination/pagenumber.py#L112-L122 |
53,676 | AntagonistHQ/openprovider.py | openprovider/response.py | Response.as_models | def as_models(self, klass):
"""Turns an array-style response into a list of models."""
try:
return [klass(mod) for mod in self.tree.reply.data.results.array[0].item]
except AttributeError:
return [] | python | def as_models(self, klass):
"""Turns an array-style response into a list of models."""
try:
return [klass(mod) for mod in self.tree.reply.data.results.array[0].item]
except AttributeError:
return [] | [
"def",
"as_models",
"(",
"self",
",",
"klass",
")",
":",
"try",
":",
"return",
"[",
"klass",
"(",
"mod",
")",
"for",
"mod",
"in",
"self",
".",
"tree",
".",
"reply",
".",
"data",
".",
"results",
".",
"array",
"[",
"0",
"]",
".",
"item",
"]",
"ex... | Turns an array-style response into a list of models. | [
"Turns",
"an",
"array",
"-",
"style",
"response",
"into",
"a",
"list",
"of",
"models",
"."
] | 5871c3d5b3661e23667f147f49f20389c817a0a4 | https://github.com/AntagonistHQ/openprovider.py/blob/5871c3d5b3661e23667f147f49f20389c817a0a4/openprovider/response.py#L34-L39 |
53,677 | gmr/tinman | tinman/utilities/initialize.py | Project._create_argument_parser | def _create_argument_parser(self):
"""Create and return the argument parser with all of the arguments
and configuration ready to go.
:rtype: argparse.ArgumentParser
"""
parser = self._new_argument_parser()
self._add_base_arguments(parser)
self._add_required_argu... | python | def _create_argument_parser(self):
"""Create and return the argument parser with all of the arguments
and configuration ready to go.
:rtype: argparse.ArgumentParser
"""
parser = self._new_argument_parser()
self._add_base_arguments(parser)
self._add_required_argu... | [
"def",
"_create_argument_parser",
"(",
"self",
")",
":",
"parser",
"=",
"self",
".",
"_new_argument_parser",
"(",
")",
"self",
".",
"_add_base_arguments",
"(",
"parser",
")",
"self",
".",
"_add_required_arguments",
"(",
"parser",
")",
"return",
"parser"
] | Create and return the argument parser with all of the arguments
and configuration ready to go.
:rtype: argparse.ArgumentParser | [
"Create",
"and",
"return",
"the",
"argument",
"parser",
"with",
"all",
"of",
"the",
"arguments",
"and",
"configuration",
"ready",
"to",
"go",
"."
] | 98f0acd15a228d752caa1864cdf02aaa3d492a9f | https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/utilities/initialize.py#L49-L59 |
53,678 | ekiro/haps | haps/container.py | Container.autodiscover | def autodiscover(cls,
module_paths: List[str],
subclass: 'Container' = None) -> None:
"""
Load all modules automatically and find bases and eggs.
:param module_paths: List of paths that should be discovered
:param subclass: Optional Container su... | python | def autodiscover(cls,
module_paths: List[str],
subclass: 'Container' = None) -> None:
"""
Load all modules automatically and find bases and eggs.
:param module_paths: List of paths that should be discovered
:param subclass: Optional Container su... | [
"def",
"autodiscover",
"(",
"cls",
",",
"module_paths",
":",
"List",
"[",
"str",
"]",
",",
"subclass",
":",
"'Container'",
"=",
"None",
")",
"->",
"None",
":",
"def",
"find_base",
"(",
"bases",
":",
"set",
",",
"implementation",
":",
"Type",
")",
":",
... | Load all modules automatically and find bases and eggs.
:param module_paths: List of paths that should be discovered
:param subclass: Optional Container subclass that should be used | [
"Load",
"all",
"modules",
"automatically",
"and",
"find",
"bases",
"and",
"eggs",
"."
] | 64b6746187e44dadb23b842607d294e03c30a0be | https://github.com/ekiro/haps/blob/64b6746187e44dadb23b842607d294e03c30a0be/haps/container.py#L148-L196 |
53,679 | ekiro/haps | haps/container.py | Container.get_object | def get_object(self, base_: Type, qualifier: str = None) -> Any:
"""
Get instance directly from the container.
If the qualifier is not None, proper method to create/retrieve instance
is used.
:param base_: `base` of this object
:param qualifier: optional qualifier
... | python | def get_object(self, base_: Type, qualifier: str = None) -> Any:
"""
Get instance directly from the container.
If the qualifier is not None, proper method to create/retrieve instance
is used.
:param base_: `base` of this object
:param qualifier: optional qualifier
... | [
"def",
"get_object",
"(",
"self",
",",
"base_",
":",
"Type",
",",
"qualifier",
":",
"str",
"=",
"None",
")",
"->",
"Any",
":",
"egg_",
"=",
"self",
".",
"_find_egg",
"(",
"base_",
",",
"qualifier",
")",
"if",
"egg_",
"is",
"None",
":",
"raise",
"Un... | Get instance directly from the container.
If the qualifier is not None, proper method to create/retrieve instance
is used.
:param base_: `base` of this object
:param qualifier: optional qualifier
:return: object instance | [
"Get",
"instance",
"directly",
"from",
"the",
"container",
"."
] | 64b6746187e44dadb23b842607d294e03c30a0be | https://github.com/ekiro/haps/blob/64b6746187e44dadb23b842607d294e03c30a0be/haps/container.py#L202-L225 |
53,680 | ekiro/haps | haps/container.py | Container.register_scope | def register_scope(self, name: str, scope_class: Type[Scope]) -> None:
"""
Register new scopes which should be subclass of `Scope`
:param name: Name of new scopes
:param scope_class: Class of new scopes
"""
with self._lock:
if name in self.scopes:
... | python | def register_scope(self, name: str, scope_class: Type[Scope]) -> None:
"""
Register new scopes which should be subclass of `Scope`
:param name: Name of new scopes
:param scope_class: Class of new scopes
"""
with self._lock:
if name in self.scopes:
... | [
"def",
"register_scope",
"(",
"self",
",",
"name",
":",
"str",
",",
"scope_class",
":",
"Type",
"[",
"Scope",
"]",
")",
"->",
"None",
":",
"with",
"self",
".",
"_lock",
":",
"if",
"name",
"in",
"self",
".",
"scopes",
":",
"raise",
"AlreadyConfigured",
... | Register new scopes which should be subclass of `Scope`
:param name: Name of new scopes
:param scope_class: Class of new scopes | [
"Register",
"new",
"scopes",
"which",
"should",
"be",
"subclass",
"of",
"Scope"
] | 64b6746187e44dadb23b842607d294e03c30a0be | https://github.com/ekiro/haps/blob/64b6746187e44dadb23b842607d294e03c30a0be/haps/container.py#L227-L237 |
53,681 | misli/django-cms-articles | cms_articles/article_rendering.py | render_article | def render_article(request, article, current_language, slug):
"""
Renders an article
"""
context = {}
context['article'] = article
context['lang'] = current_language
context['current_article'] = article
context['has_change_permissions'] = article.has_change_permission(request)
respo... | python | def render_article(request, article, current_language, slug):
"""
Renders an article
"""
context = {}
context['article'] = article
context['lang'] = current_language
context['current_article'] = article
context['has_change_permissions'] = article.has_change_permission(request)
respo... | [
"def",
"render_article",
"(",
"request",
",",
"article",
",",
"current_language",
",",
"slug",
")",
":",
"context",
"=",
"{",
"}",
"context",
"[",
"'article'",
"]",
"=",
"article",
"context",
"[",
"'lang'",
"]",
"=",
"current_language",
"context",
"[",
"'c... | Renders an article | [
"Renders",
"an",
"article"
] | d96ac77e049022deb4c70d268e4eab74d175145c | https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/article_rendering.py#L7-L38 |
53,682 | haikuginger/beekeeper | beekeeper/api.py | Endpoint.new_action | def new_action(self, method='GET', **kwargs):
"""
Create a new Action linked to this endpoint with the given args.
"""
if method not in self.methods:
raise TypeError('{} not in valid method(s): {}.'.format(method, self.methods))
return Action(self, method, **kwargs) | python | def new_action(self, method='GET', **kwargs):
"""
Create a new Action linked to this endpoint with the given args.
"""
if method not in self.methods:
raise TypeError('{} not in valid method(s): {}.'.format(method, self.methods))
return Action(self, method, **kwargs) | [
"def",
"new_action",
"(",
"self",
",",
"method",
"=",
"'GET'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"method",
"not",
"in",
"self",
".",
"methods",
":",
"raise",
"TypeError",
"(",
"'{} not in valid method(s): {}.'",
".",
"format",
"(",
"method",
",",
... | Create a new Action linked to this endpoint with the given args. | [
"Create",
"a",
"new",
"Action",
"linked",
"to",
"this",
"endpoint",
"with",
"the",
"given",
"args",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L42-L48 |
53,683 | haikuginger/beekeeper | beekeeper/api.py | APIObject.add_action | def add_action(self, name, parent, action):
"""
Add a single Action to the APIObject.
"""
if iskeyword(name):
name = '_' + name
self._actions[name] = parent.new_action(**action)
setattr(self, name, self._actions[name].execute) | python | def add_action(self, name, parent, action):
"""
Add a single Action to the APIObject.
"""
if iskeyword(name):
name = '_' + name
self._actions[name] = parent.new_action(**action)
setattr(self, name, self._actions[name].execute) | [
"def",
"add_action",
"(",
"self",
",",
"name",
",",
"parent",
",",
"action",
")",
":",
"if",
"iskeyword",
"(",
"name",
")",
":",
"name",
"=",
"'_'",
"+",
"name",
"self",
".",
"_actions",
"[",
"name",
"]",
"=",
"parent",
".",
"new_action",
"(",
"*",... | Add a single Action to the APIObject. | [
"Add",
"a",
"single",
"Action",
"to",
"the",
"APIObject",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L91-L98 |
53,684 | haikuginger/beekeeper | beekeeper/api.py | APIObject.printed_out | def printed_out(self, name):
"""
Create a string describing the APIObject and its children
"""
out = ''
out += '|\n'
if self._id_variable:
subs = '[{}]'.format(self._id_variable)
else:
subs = ''
out += '|---{}{}\n'.format(name, subs... | python | def printed_out(self, name):
"""
Create a string describing the APIObject and its children
"""
out = ''
out += '|\n'
if self._id_variable:
subs = '[{}]'.format(self._id_variable)
else:
subs = ''
out += '|---{}{}\n'.format(name, subs... | [
"def",
"printed_out",
"(",
"self",
",",
"name",
")",
":",
"out",
"=",
"''",
"out",
"+=",
"'|\\n'",
"if",
"self",
".",
"_id_variable",
":",
"subs",
"=",
"'[{}]'",
".",
"format",
"(",
"self",
".",
"_id_variable",
")",
"else",
":",
"subs",
"=",
"''",
... | Create a string describing the APIObject and its children | [
"Create",
"a",
"string",
"describing",
"the",
"APIObject",
"and",
"its",
"children"
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L100-L115 |
53,685 | haikuginger/beekeeper | beekeeper/api.py | Action.printed_out | def printed_out(self, name):
"""
Create a string representation of the action
"""
opt = self.variables().optional_namestring()
req = self.variables().required_namestring()
out = ''
out += '| |\n'
out += '| |---{}({}{})\n'.format(name, req, opt)
... | python | def printed_out(self, name):
"""
Create a string representation of the action
"""
opt = self.variables().optional_namestring()
req = self.variables().required_namestring()
out = ''
out += '| |\n'
out += '| |---{}({}{})\n'.format(name, req, opt)
... | [
"def",
"printed_out",
"(",
"self",
",",
"name",
")",
":",
"opt",
"=",
"self",
".",
"variables",
"(",
")",
".",
"optional_namestring",
"(",
")",
"req",
"=",
"self",
".",
"variables",
"(",
")",
".",
"required_namestring",
"(",
")",
"out",
"=",
"''",
"o... | Create a string representation of the action | [
"Create",
"a",
"string",
"representation",
"of",
"the",
"action"
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L208-L219 |
53,686 | haikuginger/beekeeper | beekeeper/api.py | API.from_hive_file | def from_hive_file(cls, fname, *args, **kwargs):
"""
Open a local JSON hive file and initialize from the hive contained
in that file, paying attention to the version keyword argument.
"""
version = kwargs.pop('version', None)
require = kwargs.pop('require_https', True)
... | python | def from_hive_file(cls, fname, *args, **kwargs):
"""
Open a local JSON hive file and initialize from the hive contained
in that file, paying attention to the version keyword argument.
"""
version = kwargs.pop('version', None)
require = kwargs.pop('require_https', True)
... | [
"def",
"from_hive_file",
"(",
"cls",
",",
"fname",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"kwargs",
".",
"pop",
"(",
"'version'",
",",
"None",
")",
"require",
"=",
"kwargs",
".",
"pop",
"(",
"'require_https'",
",",
"True... | Open a local JSON hive file and initialize from the hive contained
in that file, paying attention to the version keyword argument. | [
"Open",
"a",
"local",
"JSON",
"hive",
"file",
"and",
"initialize",
"from",
"the",
"hive",
"contained",
"in",
"that",
"file",
"paying",
"attention",
"to",
"the",
"version",
"keyword",
"argument",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L244-L251 |
53,687 | haikuginger/beekeeper | beekeeper/api.py | API.from_remote_hive | def from_remote_hive(cls, url, *args, **kwargs):
"""
Download a JSON hive file from a URL, and initialize from it,
paying attention to the version keyword argument.
"""
version = kwargs.pop('version', None)
require = kwargs.pop('require_https', False)
return cls(H... | python | def from_remote_hive(cls, url, *args, **kwargs):
"""
Download a JSON hive file from a URL, and initialize from it,
paying attention to the version keyword argument.
"""
version = kwargs.pop('version', None)
require = kwargs.pop('require_https', False)
return cls(H... | [
"def",
"from_remote_hive",
"(",
"cls",
",",
"url",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"kwargs",
".",
"pop",
"(",
"'version'",
",",
"None",
")",
"require",
"=",
"kwargs",
".",
"pop",
"(",
"'require_https'",
",",
"Fals... | Download a JSON hive file from a URL, and initialize from it,
paying attention to the version keyword argument. | [
"Download",
"a",
"JSON",
"hive",
"file",
"from",
"a",
"URL",
"and",
"initialize",
"from",
"it",
"paying",
"attention",
"to",
"the",
"version",
"keyword",
"argument",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L254-L261 |
53,688 | haikuginger/beekeeper | beekeeper/api.py | API.add_endpoint | def add_endpoint(self, name, **kwargs):
"""
Add an endpoint with the given name to the API.
"""
self._endpoints[name] = Endpoint(self, **kwargs) | python | def add_endpoint(self, name, **kwargs):
"""
Add an endpoint with the given name to the API.
"""
self._endpoints[name] = Endpoint(self, **kwargs) | [
"def",
"add_endpoint",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_endpoints",
"[",
"name",
"]",
"=",
"Endpoint",
"(",
"self",
",",
"*",
"*",
"kwargs",
")"
] | Add an endpoint with the given name to the API. | [
"Add",
"an",
"endpoint",
"with",
"the",
"given",
"name",
"to",
"the",
"API",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L290-L294 |
53,689 | haikuginger/beekeeper | beekeeper/api.py | API.add_object | def add_object(self, name, obj):
"""
Initialize an APIObject with the given name and make it available
using dot notation from the top-level namespace.
"""
if iskeyword(name):
name = '_' + name
setattr(self, name, APIObject(self, **obj))
self._objects[... | python | def add_object(self, name, obj):
"""
Initialize an APIObject with the given name and make it available
using dot notation from the top-level namespace.
"""
if iskeyword(name):
name = '_' + name
setattr(self, name, APIObject(self, **obj))
self._objects[... | [
"def",
"add_object",
"(",
"self",
",",
"name",
",",
"obj",
")",
":",
"if",
"iskeyword",
"(",
"name",
")",
":",
"name",
"=",
"'_'",
"+",
"name",
"setattr",
"(",
"self",
",",
"name",
",",
"APIObject",
"(",
"self",
",",
"*",
"*",
"obj",
")",
")",
... | Initialize an APIObject with the given name and make it available
using dot notation from the top-level namespace. | [
"Initialize",
"an",
"APIObject",
"with",
"the",
"given",
"name",
"and",
"make",
"it",
"available",
"using",
"dot",
"notation",
"from",
"the",
"top",
"-",
"level",
"namespace",
"."
] | b647d3add0b407ec5dc3a2a39c4f6dac31243b18 | https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/api.py#L296-L304 |
53,690 | synw/dataswim | dataswim/charts/altair.py | Altair.raenc | def raenc(self, key):
"""
Remove an entry from the altair encoding dict
"""
if key in self.altair_encode:
del self.altair_encode[key]
else:
self.warning("Key " + key + " not found in Altair encoding dict") | python | def raenc(self, key):
"""
Remove an entry from the altair encoding dict
"""
if key in self.altair_encode:
del self.altair_encode[key]
else:
self.warning("Key " + key + " not found in Altair encoding dict") | [
"def",
"raenc",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"altair_encode",
":",
"del",
"self",
".",
"altair_encode",
"[",
"key",
"]",
"else",
":",
"self",
".",
"warning",
"(",
"\"Key \"",
"+",
"key",
"+",
"\" not found in Altai... | Remove an entry from the altair encoding dict | [
"Remove",
"an",
"entry",
"from",
"the",
"altair",
"encoding",
"dict"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L23-L30 |
53,691 | synw/dataswim | dataswim/charts/altair.py | Altair._altair_line_num_ | def _altair_line_num_(self, xfield, yfield, opts, style, encode):
"""
Get a line + text number chart
"""
try:
c = self._altair_chart_num_("line", xfield,
yfield, opts, style, encode)
except Exception as e:
self.er... | python | def _altair_line_num_(self, xfield, yfield, opts, style, encode):
"""
Get a line + text number chart
"""
try:
c = self._altair_chart_num_("line", xfield,
yfield, opts, style, encode)
except Exception as e:
self.er... | [
"def",
"_altair_line_num_",
"(",
"self",
",",
"xfield",
",",
"yfield",
",",
"opts",
",",
"style",
",",
"encode",
")",
":",
"try",
":",
"c",
"=",
"self",
".",
"_altair_chart_num_",
"(",
"\"line\"",
",",
"xfield",
",",
"yfield",
",",
"opts",
",",
"style"... | Get a line + text number chart | [
"Get",
"a",
"line",
"+",
"text",
"number",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L38-L48 |
53,692 | synw/dataswim | dataswim/charts/altair.py | Altair._altair_chart_num_ | def _altair_chart_num_(self, chart_type, xfield, yfield, opts, style2, encode):
"""
Get a chart + text number chart
"""
style = {**style2}
text_color = "grey"
if "text_color" in style:
text_color = style["text_color"]
del style["text_color"]
... | python | def _altair_chart_num_(self, chart_type, xfield, yfield, opts, style2, encode):
"""
Get a chart + text number chart
"""
style = {**style2}
text_color = "grey"
if "text_color" in style:
text_color = style["text_color"]
del style["text_color"]
... | [
"def",
"_altair_chart_num_",
"(",
"self",
",",
"chart_type",
",",
"xfield",
",",
"yfield",
",",
"opts",
",",
"style2",
",",
"encode",
")",
":",
"style",
"=",
"{",
"*",
"*",
"style2",
"}",
"text_color",
"=",
"\"grey\"",
"if",
"\"text_color\"",
"in",
"styl... | Get a chart + text number chart | [
"Get",
"a",
"chart",
"+",
"text",
"number",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L74-L109 |
53,693 | synw/dataswim | dataswim/charts/altair.py | Altair._altair_hline_ | def _altair_hline_(self, xfield, yfield, opts, style, encode):
"""
Get a mean line chart
"""
try:
rawy = yfield
if ":" in yfield:
rawy = yfield.split(":")[0]
mean = self.df[rawy].mean()
l = []
i = 0
w... | python | def _altair_hline_(self, xfield, yfield, opts, style, encode):
"""
Get a mean line chart
"""
try:
rawy = yfield
if ":" in yfield:
rawy = yfield.split(":")[0]
mean = self.df[rawy].mean()
l = []
i = 0
w... | [
"def",
"_altair_hline_",
"(",
"self",
",",
"xfield",
",",
"yfield",
",",
"opts",
",",
"style",
",",
"encode",
")",
":",
"try",
":",
"rawy",
"=",
"yfield",
"if",
"\":\"",
"in",
"yfield",
":",
"rawy",
"=",
"yfield",
".",
"split",
"(",
"\":\"",
")",
"... | Get a mean line chart | [
"Get",
"a",
"mean",
"line",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L111-L131 |
53,694 | synw/dataswim | dataswim/charts/altair.py | Altair._get_altair_chart | def _get_altair_chart(self, xfield, yfield, chart_type,
label, opts={}, style={}, **kwargs):
"""
Get an Altair chart object
"""
encode = self.altair_encode
chart = None
if chart_type == "bar":
chart = Chart(self.df).mark_bar(**style).... | python | def _get_altair_chart(self, xfield, yfield, chart_type,
label, opts={}, style={}, **kwargs):
"""
Get an Altair chart object
"""
encode = self.altair_encode
chart = None
if chart_type == "bar":
chart = Chart(self.df).mark_bar(**style).... | [
"def",
"_get_altair_chart",
"(",
"self",
",",
"xfield",
",",
"yfield",
",",
"chart_type",
",",
"label",
",",
"opts",
"=",
"{",
"}",
",",
"style",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"encode",
"=",
"self",
".",
"altair_encode",
"chart",
... | Get an Altair chart object | [
"Get",
"an",
"Altair",
"chart",
"object"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L133-L178 |
53,695 | synw/dataswim | dataswim/charts/altair.py | Altair._get_altair_html_ | def _get_altair_html_(self, chart_obj, slug):
"""
Get html for an Altair chart
"""
try:
json_data = chart_obj.to_json(indent=0)
except Exception as e:
self.err(e)
html = '<div id="' + slug + '"></div>\n'
html += '<script type="text/javascri... | python | def _get_altair_html_(self, chart_obj, slug):
"""
Get html for an Altair chart
"""
try:
json_data = chart_obj.to_json(indent=0)
except Exception as e:
self.err(e)
html = '<div id="' + slug + '"></div>\n'
html += '<script type="text/javascri... | [
"def",
"_get_altair_html_",
"(",
"self",
",",
"chart_obj",
",",
"slug",
")",
":",
"try",
":",
"json_data",
"=",
"chart_obj",
".",
"to_json",
"(",
"indent",
"=",
"0",
")",
"except",
"Exception",
"as",
"e",
":",
"self",
".",
"err",
"(",
"e",
")",
"html... | Get html for an Altair chart | [
"Get",
"html",
"for",
"an",
"Altair",
"chart"
] | 4a4a53f80daa7cd8e8409d76a19ce07296269da2 | https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/charts/altair.py#L192-L217 |
53,696 | cslarsen/crianza | crianza/tokenizer.py | Tokenizer.parse_number | def parse_number(self, s):
"""Parses integers in bases 10 and 16 and floats."""
start = 1 if s[0] in ["-","+"] else 0
all_digits = lambda x: all(map(lambda c: c.isdigit(), x))
ishex = lambda c: c.isdigit() or ord(c.lower()) in range(ord("a"), ord("f"))
all_hex = lambda x: all(ma... | python | def parse_number(self, s):
"""Parses integers in bases 10 and 16 and floats."""
start = 1 if s[0] in ["-","+"] else 0
all_digits = lambda x: all(map(lambda c: c.isdigit(), x))
ishex = lambda c: c.isdigit() or ord(c.lower()) in range(ord("a"), ord("f"))
all_hex = lambda x: all(ma... | [
"def",
"parse_number",
"(",
"self",
",",
"s",
")",
":",
"start",
"=",
"1",
"if",
"s",
"[",
"0",
"]",
"in",
"[",
"\"-\"",
",",
"\"+\"",
"]",
"else",
"0",
"all_digits",
"=",
"lambda",
"x",
":",
"all",
"(",
"map",
"(",
"lambda",
"c",
":",
"c",
"... | Parses integers in bases 10 and 16 and floats. | [
"Parses",
"integers",
"in",
"bases",
"10",
"and",
"16",
"and",
"floats",
"."
] | fa044f9d491f37cc06892bad14b2c80b8ac5a7cd | https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/tokenizer.py#L56-L86 |
53,697 | cslarsen/crianza | crianza/tokenizer.py | Tokenizer.tokenize | def tokenize(self):
"""Breaks a stream up into tokens.
Yields tuples of the form (line_number, column, Tokenizer.TOKEN).
"""
def readlines(s):
while True:
line = s.readline()
if line != "":
yield line.rstrip()
... | python | def tokenize(self):
"""Breaks a stream up into tokens.
Yields tuples of the form (line_number, column, Tokenizer.TOKEN).
"""
def readlines(s):
while True:
line = s.readline()
if line != "":
yield line.rstrip()
... | [
"def",
"tokenize",
"(",
"self",
")",
":",
"def",
"readlines",
"(",
"s",
")",
":",
"while",
"True",
":",
"line",
"=",
"s",
".",
"readline",
"(",
")",
"if",
"line",
"!=",
"\"\"",
":",
"yield",
"line",
".",
"rstrip",
"(",
")",
"else",
":",
"break",
... | Breaks a stream up into tokens.
Yields tuples of the form (line_number, column, Tokenizer.TOKEN). | [
"Breaks",
"a",
"stream",
"up",
"into",
"tokens",
"."
] | fa044f9d491f37cc06892bad14b2c80b8ac5a7cd | https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/tokenizer.py#L157-L174 |
53,698 | ekiro/haps | haps/application.py | ApplicationRunner.run | def run(app_class: Type[Application],
extra_module_paths: List[str] = None, **kwargs: Any) -> None:
"""
Runner for haps application.
:param app_class: :class:`~haps.application.Application` type
:param extra_module_paths: Extra modules list to autodiscover
:param kwa... | python | def run(app_class: Type[Application],
extra_module_paths: List[str] = None, **kwargs: Any) -> None:
"""
Runner for haps application.
:param app_class: :class:`~haps.application.Application` type
:param extra_module_paths: Extra modules list to autodiscover
:param kwa... | [
"def",
"run",
"(",
"app_class",
":",
"Type",
"[",
"Application",
"]",
",",
"extra_module_paths",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"None",
":",
"module",
"=",
"app_class",
".",
"__module__",
"i... | Runner for haps application.
:param app_class: :class:`~haps.application.Application` type
:param extra_module_paths: Extra modules list to autodiscover
:param kwargs: Extra arguments are passed to\
:func:`~haps.Container.autodiscover` | [
"Runner",
"for",
"haps",
"application",
"."
] | 64b6746187e44dadb23b842607d294e03c30a0be | https://github.com/ekiro/haps/blob/64b6746187e44dadb23b842607d294e03c30a0be/haps/application.py#L35-L70 |
53,699 | oasiswork/zimsoap | zimsoap/zobjects.py | ZObject.from_dict | def from_dict(cls, d):
""" Given a dict in python-zimbra format or XML, generate
a Python object.
"""
if type(d) != dict:
raise TypeError('Expecting a <dict>, got a {0}'.format(type(d)))
obj = cls()
obj._full_data = d
# import attributes
obj.... | python | def from_dict(cls, d):
""" Given a dict in python-zimbra format or XML, generate
a Python object.
"""
if type(d) != dict:
raise TypeError('Expecting a <dict>, got a {0}'.format(type(d)))
obj = cls()
obj._full_data = d
# import attributes
obj.... | [
"def",
"from_dict",
"(",
"cls",
",",
"d",
")",
":",
"if",
"type",
"(",
"d",
")",
"!=",
"dict",
":",
"raise",
"TypeError",
"(",
"'Expecting a <dict>, got a {0}'",
".",
"format",
"(",
"type",
"(",
"d",
")",
")",
")",
"obj",
"=",
"cls",
"(",
")",
"obj... | Given a dict in python-zimbra format or XML, generate
a Python object. | [
"Given",
"a",
"dict",
"in",
"python",
"-",
"zimbra",
"format",
"or",
"XML",
"generate",
"a",
"Python",
"object",
"."
] | d1ea2eb4d50f263c9a16e5549af03f1eff3e295e | https://github.com/oasiswork/zimsoap/blob/d1ea2eb4d50f263c9a16e5549af03f1eff3e295e/zimsoap/zobjects.py#L33-L49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.