nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
karmab/kcli | fff2a2632841f54d9346b437821585df0ec659d7 | kvirt/krpc/kcli_pb2_grpc.py | python | KconfigServicer.list_plans | (self, request, context) | Missing associated documentation comment in .proto file | Missing associated documentation comment in .proto file | [
"Missing",
"associated",
"documentation",
"comment",
"in",
".",
"proto",
"file"
] | def list_plans(self, request, context):
"""Missing associated documentation comment in .proto file"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | [
"def",
"list_plans",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"context",
".",
"set_code",
"(",
"grpc",
".",
"StatusCode",
".",
"UNIMPLEMENTED",
")",
"context",
".",
"set_details",
"(",
"'Method not implemented!'",
")",
"raise",
"NotImplementedError... | https://github.com/karmab/kcli/blob/fff2a2632841f54d9346b437821585df0ec659d7/kvirt/krpc/kcli_pb2_grpc.py#L1032-L1036 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/codecs.py | python | StreamReader.read | (self, size=-1, chars=-1, firstline=False) | return result | Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of characters to read from the
stream. read() will never return more than chars
characters, but it might return less, if there are not enough
characters avai... | Decodes data from the stream self.stream and returns the
resulting object. | [
"Decodes",
"data",
"from",
"the",
"stream",
"self",
".",
"stream",
"and",
"returns",
"the",
"resulting",
"object",
"."
] | def read(self, size=-1, chars=-1, firstline=False):
""" Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of characters to read from the
stream. read() will never return more than chars
characters, but it might... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
",",
"chars",
"=",
"-",
"1",
",",
"firstline",
"=",
"False",
")",
":",
"# If we have lines cached, first merge them back into characters",
"if",
"self",
".",
"linebuffer",
":",
"self",
".",
"charbuffer",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/codecs.py#L424-L501 | |
treeio/treeio | bae3115f4015aad2cbc5ab45572232ceec990495 | treeio/reports/views.py | python | charts_index | (request, response_format='html') | return render_to_response('reports/chart_index', context,
context_instance=RequestContext(request),
response_format=response_format) | Charts index page | Charts index page | [
"Charts",
"index",
"page"
] | def charts_index(request, response_format='html'):
"Charts index page"
charts = Object.filter_by_request(request, Chart.objects)
context = _get_default_context(request)
context.update({'charts': charts})
return render_to_response('reports/chart_index', context,
conte... | [
"def",
"charts_index",
"(",
"request",
",",
"response_format",
"=",
"'html'",
")",
":",
"charts",
"=",
"Object",
".",
"filter_by_request",
"(",
"request",
",",
"Chart",
".",
"objects",
")",
"context",
"=",
"_get_default_context",
"(",
"request",
")",
"context"... | https://github.com/treeio/treeio/blob/bae3115f4015aad2cbc5ab45572232ceec990495/treeio/reports/views.py#L272-L282 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/machinelearning/layer1.py | python | MachineLearningConnection.create_ml_model | (self, ml_model_id, ml_model_type,
training_data_source_id, ml_model_name=None,
parameters=None, recipe=None, recipe_uri=None) | return self.make_request(action='CreateMLModel',
body=json.dumps(params)) | Creates a new `MLModel` using the data files and the recipe as
information sources.
An `MLModel` is nearly immutable. Users can only update the
`MLModelName` and the `ScoreThreshold` in an `MLModel` without
creating a new `MLModel`.
`CreateMLModel` is an asynchronous operation.... | Creates a new `MLModel` using the data files and the recipe as
information sources. | [
"Creates",
"a",
"new",
"MLModel",
"using",
"the",
"data",
"files",
"and",
"the",
"recipe",
"as",
"information",
"sources",
"."
] | def create_ml_model(self, ml_model_id, ml_model_type,
training_data_source_id, ml_model_name=None,
parameters=None, recipe=None, recipe_uri=None):
"""
Creates a new `MLModel` using the data files and the recipe as
information sources.
An `... | [
"def",
"create_ml_model",
"(",
"self",
",",
"ml_model_id",
",",
"ml_model_type",
",",
"training_data_source_id",
",",
"ml_model_name",
"=",
"None",
",",
"parameters",
"=",
"None",
",",
"recipe",
"=",
"None",
",",
"recipe_uri",
"=",
"None",
")",
":",
"params",
... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/machinelearning/layer1.py#L472-L581 | |
zhanghan1990/zipline-chinese | 86904cac4b6e928271f640910aa83675ce945b8b | zipline/pipeline/factors/factor.py | python | Factor.quartiles | (self, mask=NotSpecified) | return self.quantiles(bins=4, mask=mask) | Construct a Classifier computing quartiles over the output of ``self``.
Every non-NaN data point the output is labelled with a value of either
0, 1, 2, or 3, corresponding to the first, second, third, or fourth
quartile over each row. NaN data points are labelled with -1.
If ``mask`` ... | Construct a Classifier computing quartiles over the output of ``self``. | [
"Construct",
"a",
"Classifier",
"computing",
"quartiles",
"over",
"the",
"output",
"of",
"self",
"."
] | def quartiles(self, mask=NotSpecified):
"""
Construct a Classifier computing quartiles over the output of ``self``.
Every non-NaN data point the output is labelled with a value of either
0, 1, 2, or 3, corresponding to the first, second, third, or fourth
quartile over each row. ... | [
"def",
"quartiles",
"(",
"self",
",",
"mask",
"=",
"NotSpecified",
")",
":",
"return",
"self",
".",
"quantiles",
"(",
"bins",
"=",
"4",
",",
"mask",
"=",
"mask",
")"
] | https://github.com/zhanghan1990/zipline-chinese/blob/86904cac4b6e928271f640910aa83675ce945b8b/zipline/pipeline/factors/factor.py#L726-L747 | |
SirFroweey/PyDark | 617c2bfda360afa7750c4707ecacd4ec82fa29af | PyDark/engine.py | python | DarkSprite.create_circle | (self, color=(255, 255, 255, 255), radius=50, invisible=False) | return self.CreateCircle(color, radius, invisible) | Create(draw) a circle surface. | Create(draw) a circle surface. | [
"Create",
"(",
"draw",
")",
"a",
"circle",
"surface",
"."
] | def create_circle(self, color=(255, 255, 255, 255), radius=50, invisible=False):
"""Create(draw) a circle surface."""
return self.CreateCircle(color, radius, invisible) | [
"def",
"create_circle",
"(",
"self",
",",
"color",
"=",
"(",
"255",
",",
"255",
",",
"255",
",",
"255",
")",
",",
"radius",
"=",
"50",
",",
"invisible",
"=",
"False",
")",
":",
"return",
"self",
".",
"CreateCircle",
"(",
"color",
",",
"radius",
","... | https://github.com/SirFroweey/PyDark/blob/617c2bfda360afa7750c4707ecacd4ec82fa29af/PyDark/engine.py#L564-L566 | |
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/androidapp.py | python | AndroidApp.send_key | (self, key) | 发送单个按键
:param key: 发送的按键字符串
:type key: string | 发送单个按键
:param key: 发送的按键字符串
:type key: string | [
"发送单个按键",
":",
"param",
"key",
":",
"发送的按键字符串",
":",
"type",
"key",
":",
"string"
] | def send_key(self, key):
'''发送单个按键
:param key: 发送的按键字符串
:type key: string
'''
self.get_driver().send_key(key) | [
"def",
"send_key",
"(",
"self",
",",
"key",
")",
":",
"self",
".",
"get_driver",
"(",
")",
".",
"send_key",
"(",
"key",
")"
] | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/androidapp.py#L186-L192 | ||
lazzyfu/YaSQL | 2e73941aaca2a9b69d49e360d3a2376029a8ec1d | yasql/apps/redisms/redisApi.py | python | RedisApi.read_mget | (self, args_list) | 返回所有(一个或多个)给定 key 的值 | 返回所有(一个或多个)给定 key 的值 | [
"返回所有",
"(",
"一个或多个",
")",
"给定",
"key",
"的值"
] | def read_mget(self, args_list):
"""返回所有(一个或多个)给定 key 的值"""
if len(args_list) >= 1:
try:
r = self.conn.mget(args_list)
except Exception as err:
r = str(err)
return r
else:
return "ERR wrong number of arguments for 'mg... | [
"def",
"read_mget",
"(",
"self",
",",
"args_list",
")",
":",
"if",
"len",
"(",
"args_list",
")",
">=",
"1",
":",
"try",
":",
"r",
"=",
"self",
".",
"conn",
".",
"mget",
"(",
"args_list",
")",
"except",
"Exception",
"as",
"err",
":",
"r",
"=",
"st... | https://github.com/lazzyfu/YaSQL/blob/2e73941aaca2a9b69d49e360d3a2376029a8ec1d/yasql/apps/redisms/redisApi.py#L283-L292 | ||
xtiankisutsa/MARA_Framework | ac4ac88bfd38f33ae8780a606ed09ab97177c562 | tools/qark/qark/lib/blessed/terminal.py | python | Terminal.strip | (self, text) | return Sequence(text, self).strip() | T.strip(text) -> unicode
Return string ``text`` stripped of its whitespace *and* sequences.
Text containing backspace or term.left will "overstrike", so that
the string ``u"_\\b"`` or ``u"__\\b\\b="`` becomes ``u"x"``,
not ``u"="`` (as would actually be printed on a terminal). | T.strip(text) -> unicode | [
"T",
".",
"strip",
"(",
"text",
")",
"-",
">",
"unicode"
] | def strip(self, text):
"""T.strip(text) -> unicode
Return string ``text`` stripped of its whitespace *and* sequences.
Text containing backspace or term.left will "overstrike", so that
the string ``u"_\\b"`` or ``u"__\\b\\b="`` becomes ``u"x"``,
not ``u"="`` (as would actually b... | [
"def",
"strip",
"(",
"self",
",",
"text",
")",
":",
"return",
"Sequence",
"(",
"text",
",",
"self",
")",
".",
"strip",
"(",
")"
] | https://github.com/xtiankisutsa/MARA_Framework/blob/ac4ac88bfd38f33ae8780a606ed09ab97177c562/tools/qark/qark/lib/blessed/terminal.py#L448-L457 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/ZSI-2.0-py2.7.egg/ZSI/TC.py | python | TypeCode.__init__ | (self, pname=None, aname=None, minOccurs=1,
maxOccurs=1, nillable=False, typed=True, unique=True,
pyclass=None, attrs_aname='_attrs', **kw) | Baseclass initialization.
Instance data (and usually keyword arg)
pname -- the parameter name (localname).
nspname -- the namespace for the parameter;
None to ignore the namespace
typed -- output xsi:type attribute
unique -- data item is not aliase... | Baseclass initialization.
Instance data (and usually keyword arg)
pname -- the parameter name (localname).
nspname -- the namespace for the parameter;
None to ignore the namespace
typed -- output xsi:type attribute
unique -- data item is not aliase... | [
"Baseclass",
"initialization",
".",
"Instance",
"data",
"(",
"and",
"usually",
"keyword",
"arg",
")",
"pname",
"--",
"the",
"parameter",
"name",
"(",
"localname",
")",
".",
"nspname",
"--",
"the",
"namespace",
"for",
"the",
"parameter",
";",
"None",
"to",
... | def __init__(self, pname=None, aname=None, minOccurs=1,
maxOccurs=1, nillable=False, typed=True, unique=True,
pyclass=None, attrs_aname='_attrs', **kw):
'''Baseclass initialization.
Instance data (and usually keyword arg)
pname -- the parameter name (localname).
... | [
"def",
"__init__",
"(",
"self",
",",
"pname",
"=",
"None",
",",
"aname",
"=",
"None",
",",
"minOccurs",
"=",
"1",
",",
"maxOccurs",
"=",
"1",
",",
"nillable",
"=",
"False",
",",
"typed",
"=",
"True",
",",
"unique",
"=",
"True",
",",
"pyclass",
"=",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/ZSI-2.0-py2.7.egg/ZSI/TC.py#L72-L108 | ||
Tencent/FaceDetection-DSFD | 09deec4376f397a1124f71bc81210fadfaac296e | data/widerface.py | python | WIDERFaceDetection.pull_anno | (self, index) | return img_id.split('/')[-1], gt | Returns the original annotation of image at index
Note: not using self.__getitem__(), as any transformations passed in
could mess up this functionality.
Argument:
index (int): index of img to get annotation of
Return:
list: [img_id, [(label, bbox coords),...]]
... | Returns the original annotation of image at index | [
"Returns",
"the",
"original",
"annotation",
"of",
"image",
"at",
"index"
] | def pull_anno(self, index):
'''Returns the original annotation of image at index
Note: not using self.__getitem__(), as any transformations passed in
could mess up this functionality.
Argument:
index (int): index of img to get annotation of
Return:
list:... | [
"def",
"pull_anno",
"(",
"self",
",",
"index",
")",
":",
"img_id",
"=",
"self",
".",
"img_ids",
"[",
"index",
"]",
"anno",
"=",
"self",
".",
"label_ids",
"[",
"index",
"]",
"gt",
"=",
"self",
".",
"target_transform",
"(",
"anno",
",",
"1",
",",
"1"... | https://github.com/Tencent/FaceDetection-DSFD/blob/09deec4376f397a1124f71bc81210fadfaac296e/data/widerface.py#L276-L291 | |
jonathf/chaospy | f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e | chaospy/quadrature/frontend.py | python | generate_quadrature | (
order,
dist,
rule=None,
sparse=False,
growth=None,
segments=1,
recurrence_algorithm="stieltjes",
tolerance=1e-10,
scaling=3,
n_max=5000,
) | return abscissas, weights | Numerical quadrature node and weight generator.
Args:
order (int):
The order of the quadrature.
dist (chaospy.distributions.baseclass.Distribution):
The distribution which density will be used as weight function.
rule (str, Sequence[str], None):
Rule for ... | Numerical quadrature node and weight generator. | [
"Numerical",
"quadrature",
"node",
"and",
"weight",
"generator",
"."
] | def generate_quadrature(
order,
dist,
rule=None,
sparse=False,
growth=None,
segments=1,
recurrence_algorithm="stieltjes",
tolerance=1e-10,
scaling=3,
n_max=5000,
):
"""
Numerical quadrature node and weight generator.
Args:
... | [
"def",
"generate_quadrature",
"(",
"order",
",",
"dist",
",",
"rule",
"=",
"None",
",",
"sparse",
"=",
"False",
",",
"growth",
"=",
"None",
",",
"segments",
"=",
"1",
",",
"recurrence_algorithm",
"=",
"\"stieltjes\"",
",",
"tolerance",
"=",
"1e-10",
",",
... | https://github.com/jonathf/chaospy/blob/f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e/chaospy/quadrature/frontend.py#L41-L195 | |
praw-dev/praw | d1280b132f509ad115f3941fb55f13f979068377 | praw/models/reddit/live.py | python | LiveThread.discussions | (
self, **generator_kwargs: Union[str, int, Dict[str, str]]
) | return ListingGenerator(self._reddit, url, **generator_kwargs) | Get submissions linking to the thread.
:param generator_kwargs: keyword arguments passed to :class:`.ListingGenerator`
constructor.
:returns: A :class:`.ListingGenerator` object which yields :class:`.Submission`
object.
Additional keyword arguments are passed in the in... | Get submissions linking to the thread. | [
"Get",
"submissions",
"linking",
"to",
"the",
"thread",
"."
] | def discussions(
self, **generator_kwargs: Union[str, int, Dict[str, str]]
) -> Iterator["praw.models.Submission"]:
"""Get submissions linking to the thread.
:param generator_kwargs: keyword arguments passed to :class:`.ListingGenerator`
constructor.
:returns: A :class:... | [
"def",
"discussions",
"(",
"self",
",",
"*",
"*",
"generator_kwargs",
":",
"Union",
"[",
"str",
",",
"int",
",",
"Dict",
"[",
"str",
",",
"str",
"]",
"]",
")",
"->",
"Iterator",
"[",
"\"praw.models.Submission\"",
"]",
":",
"url",
"=",
"API_PATH",
"[",
... | https://github.com/praw-dev/praw/blob/d1280b132f509ad115f3941fb55f13f979068377/praw/models/reddit/live.py#L409-L433 | |
lektor/lektor | d5a7f22343572a991f2316c086f24005d0cbf0f8 | lektor/db.py | python | Query.order_by | (self, *fields) | return rv | Sets the ordering of the query. | Sets the ordering of the query. | [
"Sets",
"the",
"ordering",
"of",
"the",
"query",
"."
] | def order_by(self, *fields):
"""Sets the ordering of the query."""
rv = self._clone()
rv._order_by = fields or None
return rv | [
"def",
"order_by",
"(",
"self",
",",
"*",
"fields",
")",
":",
"rv",
"=",
"self",
".",
"_clone",
"(",
")",
"rv",
".",
"_order_by",
"=",
"fields",
"or",
"None",
"return",
"rv"
] | https://github.com/lektor/lektor/blob/d5a7f22343572a991f2316c086f24005d0cbf0f8/lektor/db.py#L1124-L1128 | |
brain-research/nngp | aaaebfc3f74a9e6e499751b6355f65360dd64107 | gpr.py | python | GaussianProcessRegression.predict | (self, test_x, sess, get_var=False) | Compute mean and varaince prediction for test inputs.
Raises:
ArithmeticError: Cholesky fails even after increasing to large values of
stability epsilon. | Compute mean and varaince prediction for test inputs. | [
"Compute",
"mean",
"and",
"varaince",
"prediction",
"for",
"test",
"inputs",
"."
] | def predict(self, test_x, sess, get_var=False):
"""Compute mean and varaince prediction for test inputs.
Raises:
ArithmeticError: Cholesky fails even after increasing to large values of
stability epsilon.
"""
if self.l_np is None:
self._build_cholesky()
start_time = time.time(... | [
"def",
"predict",
"(",
"self",
",",
"test_x",
",",
"sess",
",",
"get_var",
"=",
"False",
")",
":",
"if",
"self",
".",
"l_np",
"is",
"None",
":",
"self",
".",
"_build_cholesky",
"(",
")",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"self",
"."... | https://github.com/brain-research/nngp/blob/aaaebfc3f74a9e6e499751b6355f65360dd64107/gpr.py#L100-L153 | ||
quora/asynq | 67c611c5afb00794a95a3126ef9fdbf8604174aa | asynq/scheduler.py | python | TaskScheduler._select_batch_to_flush | (self) | return best_batch | Returns the batch having highest priority,
or ``None``, if there are no batches.
This method uses ``BatchBase.get_priority()`` to
determine the priority.
Side effect: this method removed flushed batches.
:return: selected batch or None. | Returns the batch having highest priority,
or ``None``, if there are no batches. | [
"Returns",
"the",
"batch",
"having",
"highest",
"priority",
"or",
"None",
"if",
"there",
"are",
"no",
"batches",
"."
] | def _select_batch_to_flush(self):
"""Returns the batch having highest priority,
or ``None``, if there are no batches.
This method uses ``BatchBase.get_priority()`` to
determine the priority.
Side effect: this method removed flushed batches.
:return: selected batch or N... | [
"def",
"_select_batch_to_flush",
"(",
"self",
")",
":",
"best_batch",
"=",
"None",
"best_priority",
"=",
"None",
"batches_to_remove",
"=",
"None",
"for",
"batch",
"in",
"self",
".",
"_batches",
":",
"if",
"not",
"batch",
".",
"items",
"or",
"batch",
".",
"... | https://github.com/quora/asynq/blob/67c611c5afb00794a95a3126ef9fdbf8604174aa/asynq/scheduler.py#L223-L252 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/datetime.py | python | timedelta.__mod__ | (self, other) | return NotImplemented | [] | def __mod__(self, other):
if isinstance(other, timedelta):
r = self._to_microseconds() % other._to_microseconds()
return timedelta(0, 0, r)
return NotImplemented | [
"def",
"__mod__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"timedelta",
")",
":",
"r",
"=",
"self",
".",
"_to_microseconds",
"(",
")",
"%",
"other",
".",
"_to_microseconds",
"(",
")",
"return",
"timedelta",
"(",
"0",
... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/datetime.py#L690-L694 | |||
rotki/rotki | aafa446815cdd5e9477436d1b02bee7d01b398c8 | rotkehlchen/utils/misc.py | python | timestamp_to_date | (
ts: Timestamp,
formatstr: str = '%d/%m/%Y %H:%M:%S',
treat_as_local: bool = False,
) | return date.rstrip() | Transforms a timestamp to a datesring depending on given formatstr and UTC/local choice | Transforms a timestamp to a datesring depending on given formatstr and UTC/local choice | [
"Transforms",
"a",
"timestamp",
"to",
"a",
"datesring",
"depending",
"on",
"given",
"formatstr",
"and",
"UTC",
"/",
"local",
"choice"
] | def timestamp_to_date(
ts: Timestamp,
formatstr: str = '%d/%m/%Y %H:%M:%S',
treat_as_local: bool = False,
) -> str:
"""Transforms a timestamp to a datesring depending on given formatstr and UTC/local choice"""
if treat_as_local is False:
date = datetime.datetime.utcfromtimestamp(... | [
"def",
"timestamp_to_date",
"(",
"ts",
":",
"Timestamp",
",",
"formatstr",
":",
"str",
"=",
"'%d/%m/%Y %H:%M:%S'",
",",
"treat_as_local",
":",
"bool",
"=",
"False",
",",
")",
"->",
"str",
":",
"if",
"treat_as_local",
"is",
"False",
":",
"date",
"=",
"datet... | https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/utils/misc.py#L97-L109 | |
pulp/pulp | a0a28d804f997b6f81c391378aff2e4c90183df9 | server/pulp/server/webservices/views/tasks.py | python | TaskResourceView.delete | (self, request, task_id) | return generate_json_response(None) | Dispatch tasks.cancel to delete a single task.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param task_id: The ID of the task you wish to cancel
:type task_id: basestring
:return: Response containing None
:rtype: django.ht... | Dispatch tasks.cancel to delete a single task. | [
"Dispatch",
"tasks",
".",
"cancel",
"to",
"delete",
"a",
"single",
"task",
"."
] | def delete(self, request, task_id):
"""
Dispatch tasks.cancel to delete a single task.
:param request: WSGI request object
:type request: django.core.handlers.wsgi.WSGIRequest
:param task_id: The ID of the task you wish to cancel
:type task_id: basestring
:ret... | [
"def",
"delete",
"(",
"self",
",",
"request",
",",
"task_id",
")",
":",
"tasks",
".",
"cancel",
"(",
"task_id",
")",
"return",
"generate_json_response",
"(",
"None",
")"
] | https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/server/pulp/server/webservices/views/tasks.py#L135-L148 | |
automl/RoBO | 91366b12a1a3deb8e80dd08599e0eaf4df28adc1 | robo/acquisition_functions/lcb.py | python | LCB.__init__ | (self, model, par=1.0) | r"""
The lower confidence bound that computes for a
test point the acquisition value by:
.. math::
LCB(X) := - (\mu(x) - \kappa\sigma(x))
Note: We want to find the minimum of and thus minimize the lower confidence bound.
But RoBO always maximizes the acquisition functi... | r"""
The lower confidence bound that computes for a
test point the acquisition value by: | [
"r",
"The",
"lower",
"confidence",
"bound",
"that",
"computes",
"for",
"a",
"test",
"point",
"the",
"acquisition",
"value",
"by",
":"
] | def __init__(self, model, par=1.0):
r"""
The lower confidence bound that computes for a
test point the acquisition value by:
.. math::
LCB(X) := - (\mu(x) - \kappa\sigma(x))
Note: We want to find the minimum of and thus minimize the lower confidence bound.
But ... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"par",
"=",
"1.0",
")",
":",
"self",
".",
"par",
"=",
"par",
"super",
"(",
"LCB",
",",
"self",
")",
".",
"__init__",
"(",
"model",
")"
] | https://github.com/automl/RoBO/blob/91366b12a1a3deb8e80dd08599e0eaf4df28adc1/robo/acquisition_functions/lcb.py#L12-L38 | ||
hacktoolspack/hack-tools | c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2 | xsssniper/core/packages/clint/textui/progress.py | python | dots | (it, label='', hide=False) | Progress iterator. Prints a dot for each item being iterated | Progress iterator. Prints a dot for each item being iterated | [
"Progress",
"iterator",
".",
"Prints",
"a",
"dot",
"for",
"each",
"item",
"being",
"iterated"
] | def dots(it, label='', hide=False):
"""Progress iterator. Prints a dot for each item being iterated"""
count = 0
if not hide:
STREAM.write(label)
for item in it:
if not hide:
STREAM.write(DOTS_CHAR)
sys.stderr.flush()
count += 1
yield item
... | [
"def",
"dots",
"(",
"it",
",",
"label",
"=",
"''",
",",
"hide",
"=",
"False",
")",
":",
"count",
"=",
"0",
"if",
"not",
"hide",
":",
"STREAM",
".",
"write",
"(",
"label",
")",
"for",
"item",
"in",
"it",
":",
"if",
"not",
"hide",
":",
"STREAM",
... | https://github.com/hacktoolspack/hack-tools/blob/c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2/xsssniper/core/packages/clint/textui/progress.py#L67-L85 | ||
aaronportnoy/toolbag | 2d39457a7617b2f334d203d8c8cf88a5a25ef1fa | toolbag/agent/dbg/vtrace/__init__.py | python | Trace.searchMemory | (self, needle, regex=False) | return ret | Search all of process memory for a sequence of bytes. | Search all of process memory for a sequence of bytes. | [
"Search",
"all",
"of",
"process",
"memory",
"for",
"a",
"sequence",
"of",
"bytes",
"."
] | def searchMemory(self, needle, regex=False):
"""
Search all of process memory for a sequence of bytes.
"""
ret = e_mem.IMemory.searchMemory(self, needle, regex=regex)
self.setMeta('search', ret)
self.setVariable('search', ret)
return ret | [
"def",
"searchMemory",
"(",
"self",
",",
"needle",
",",
"regex",
"=",
"False",
")",
":",
"ret",
"=",
"e_mem",
".",
"IMemory",
".",
"searchMemory",
"(",
"self",
",",
"needle",
",",
"regex",
"=",
"regex",
")",
"self",
".",
"setMeta",
"(",
"'search'",
"... | https://github.com/aaronportnoy/toolbag/blob/2d39457a7617b2f334d203d8c8cf88a5a25ef1fa/toolbag/agent/dbg/vtrace/__init__.py#L480-L487 | |
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/beets/mediafile.py | python | MP3DescStorageStyle.__init__ | (self, desc=u'', key='TXXX', **kwargs) | [] | def __init__(self, desc=u'', key='TXXX', **kwargs):
assert isinstance(desc, six.text_type)
self.description = desc
super(MP3DescStorageStyle, self).__init__(key=key, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"desc",
"=",
"u''",
",",
"key",
"=",
"'TXXX'",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"isinstance",
"(",
"desc",
",",
"six",
".",
"text_type",
")",
"self",
".",
"description",
"=",
"desc",
"super",
"(",
"M... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/beets/mediafile.py#L836-L839 | ||||
thunlp/JointNRE | 29e2070910d0940bf4d32a8b8c97800bceff98fb | jointE/KATT/train.py | python | MakeSummary | (name, value) | return summary | Creates a tf.Summary proto with the given name and value. | Creates a tf.Summary proto with the given name and value. | [
"Creates",
"a",
"tf",
".",
"Summary",
"proto",
"with",
"the",
"given",
"name",
"and",
"value",
"."
] | def MakeSummary(name, value):
"""Creates a tf.Summary proto with the given name and value."""
summary = tf.Summary()
val = summary.value.add()
val.tag = str(name)
val.simple_value = float(value)
return summary | [
"def",
"MakeSummary",
"(",
"name",
",",
"value",
")",
":",
"summary",
"=",
"tf",
".",
"Summary",
"(",
")",
"val",
"=",
"summary",
".",
"value",
".",
"add",
"(",
")",
"val",
".",
"tag",
"=",
"str",
"(",
"name",
")",
"val",
".",
"simple_value",
"="... | https://github.com/thunlp/JointNRE/blob/29e2070910d0940bf4d32a8b8c97800bceff98fb/jointE/KATT/train.py#L53-L59 | |
dmlc/gluon-cv | 709bc139919c02f7454cb411311048be188cde64 | gluoncv/auto/data/dataset.py | python | try_import_pycocotools | () | Tricks to optionally install and import pycocotools | Tricks to optionally install and import pycocotools | [
"Tricks",
"to",
"optionally",
"install",
"and",
"import",
"pycocotools"
] | def try_import_pycocotools():
"""Tricks to optionally install and import pycocotools"""
# first we can try import pycocotools
try:
import pycocotools as _
except ImportError:
# we need to install pycootools, which is a bit tricky
# pycocotools sdist requires Cython, numpy(already... | [
"def",
"try_import_pycocotools",
"(",
")",
":",
"# first we can try import pycocotools",
"try",
":",
"import",
"pycocotools",
"as",
"_",
"except",
"ImportError",
":",
"# we need to install pycootools, which is a bit tricky",
"# pycocotools sdist requires Cython, numpy(already met)",
... | https://github.com/dmlc/gluon-cv/blob/709bc139919c02f7454cb411311048be188cde64/gluoncv/auto/data/dataset.py#L36-L54 | ||
adamgreig/agg-kicad | d3777a5df6f4ccee77dac4dea7c37727404a32c2 | scripts/build_mod_chip.py | python | external_silk | (conf) | return out | Draw external silkscreen. | Draw external silkscreen. | [
"Draw",
"external",
"silkscreen",
"."
] | def external_silk(conf):
"""Draw external silkscreen."""
out = []
return out | [
"def",
"external_silk",
"(",
"conf",
")",
":",
"out",
"=",
"[",
"]",
"return",
"out"
] | https://github.com/adamgreig/agg-kicad/blob/d3777a5df6f4ccee77dac4dea7c37727404a32c2/scripts/build_mod_chip.py#L107-L110 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/ppcls/arch/backbone/model_zoo/swin_transformer.py | python | SwinTransformer_large_patch4_window7_224 | (pretrained=False,
use_ssld=False,
**kwargs) | return model | [] | def SwinTransformer_large_patch4_window7_224(pretrained=False,
use_ssld=False,
**kwargs):
model = SwinTransformer(
embed_dim=192,
depths=[2, 2, 18, 2],
num_heads=[6, 12, 24, 48],
window_size=7,
... | [
"def",
"SwinTransformer_large_patch4_window7_224",
"(",
"pretrained",
"=",
"False",
",",
"use_ssld",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"SwinTransformer",
"(",
"embed_dim",
"=",
"192",
",",
"depths",
"=",
"[",
"2",
",",
"2",
","... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppcls/arch/backbone/model_zoo/swin_transformer.py#L825-L839 | |||
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/simplifier.py | python | Simplifier.walk_bv_concat | (self, formula, args, **kwargs) | return self.manager.BVConcat(args[0], args[1]) | [] | def walk_bv_concat(self, formula, args, **kwargs):
if args[0].is_bv_constant() and args[1].is_bv_constant():
w0 = args[0].bv_width()
w1 = args[1].bv_width()
res = (2**w1) * args[0].bv_unsigned_value() + \
args[1].bv_unsigned_value()
return self.m... | [
"def",
"walk_bv_concat",
"(",
"self",
",",
"formula",
",",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"[",
"0",
"]",
".",
"is_bv_constant",
"(",
")",
"and",
"args",
"[",
"1",
"]",
".",
"is_bv_constant",
"(",
")",
":",
"w0",
"=",
"ar... | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/simplifier.py#L734-L741 | |||
google/rekall | 55d1925f2df9759a989b35271b4fa48fc54a1c86 | rekall-core/rekall/plugins/tools/live_windows.py | python | Live.parse_exception | (self, e) | Yes! seriously there is no way to get at the real error code. | Yes! seriously there is no way to get at the real error code. | [
"Yes!",
"seriously",
"there",
"is",
"no",
"way",
"to",
"get",
"at",
"the",
"real",
"error",
"code",
"."
] | def parse_exception(self, e):
"""Yes! seriously there is no way to get at the real error code."""
# We often see code like if "Access Denied" in str(e):... but
# this is unreliable since the message will be different when
# different language packs are used. The best way is to
# ... | [
"def",
"parse_exception",
"(",
"self",
",",
"e",
")",
":",
"# We often see code like if \"Access Denied\" in str(e):... but",
"# this is unreliable since the message will be different when",
"# different language packs are used. The best way is to",
"# compare the numeric error code, but this ... | https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/plugins/tools/live_windows.py#L88-L97 | ||
maxpumperla/deep_learning_and_the_game_of_go | 35f983cabb7294d84f2554dc4c23063f23f985b8 | code/dlgo/ttt/tttboard.py | python | Board.get | (self, point) | return self._grid.get(point) | Return the content of a point on the board.
Returns None if the point is empty, or a Player if there is a
stone on that point. | Return the content of a point on the board. | [
"Return",
"the",
"content",
"of",
"a",
"point",
"on",
"the",
"board",
"."
] | def get(self, point):
"""Return the content of a point on the board.
Returns None if the point is empty, or a Player if there is a
stone on that point.
"""
return self._grid.get(point) | [
"def",
"get",
"(",
"self",
",",
"point",
")",
":",
"return",
"self",
".",
"_grid",
".",
"get",
"(",
"point",
")"
] | https://github.com/maxpumperla/deep_learning_and_the_game_of_go/blob/35f983cabb7294d84f2554dc4c23063f23f985b8/code/dlgo/ttt/tttboard.py#L39-L45 | |
sphinx-doc/sphinx | e79681c76843c1339863b365747079b2d662d0c1 | sphinx/environment/adapters/asset.py | python | ImageAdapter.get_original_image_uri | (self, name: str) | return name | Get the original image URI. | Get the original image URI. | [
"Get",
"the",
"original",
"image",
"URI",
"."
] | def get_original_image_uri(self, name: str) -> str:
"""Get the original image URI."""
while name in self.env.original_image_uri:
name = self.env.original_image_uri[name]
return name | [
"def",
"get_original_image_uri",
"(",
"self",
",",
"name",
":",
"str",
")",
"->",
"str",
":",
"while",
"name",
"in",
"self",
".",
"env",
".",
"original_image_uri",
":",
"name",
"=",
"self",
".",
"env",
".",
"original_image_uri",
"[",
"name",
"]",
"return... | https://github.com/sphinx-doc/sphinx/blob/e79681c76843c1339863b365747079b2d662d0c1/sphinx/environment/adapters/asset.py#L18-L23 | |
jtpereyda/boofuzz | 64badab7257117bcadab35e903d723223dde9203 | boofuzz/utils/debugger_thread_pydbg.py | python | DebuggerThreadPydbg.post_send | (self) | return not av | This routine is called after the fuzzer transmits a test case and returns the status of the target.
Returns:
bool: True if the target is still active, False otherwise. | This routine is called after the fuzzer transmits a test case and returns the status of the target. | [
"This",
"routine",
"is",
"called",
"after",
"the",
"fuzzer",
"transmits",
"a",
"test",
"case",
"and",
"returns",
"the",
"status",
"of",
"the",
"target",
"."
] | def post_send(self):
"""
This routine is called after the fuzzer transmits a test case and returns the status of the target.
Returns:
bool: True if the target is still active, False otherwise.
"""
av = self.access_violation
# if there was an access violation... | [
"def",
"post_send",
"(",
"self",
")",
":",
"av",
"=",
"self",
".",
"access_violation",
"# if there was an access violation, wait for the debugger thread to finish then kill thread handle.",
"# it is important to wait for the debugger thread to finish because it could be taking its sweet ass ... | https://github.com/jtpereyda/boofuzz/blob/64badab7257117bcadab35e903d723223dde9203/boofuzz/utils/debugger_thread_pydbg.py#L182-L200 | |
grnet/synnefo | d06ec8c7871092131cdaabf6b03ed0b504c93e43 | snf-cyclades-app/synnefo/logic/backend.py | python | get_physical_resources | (backend) | return res | Get the physical resources of a backend.
Get the resources of a backend as reported by the backend (not the db). | Get the physical resources of a backend. | [
"Get",
"the",
"physical",
"resources",
"of",
"a",
"backend",
"."
] | def get_physical_resources(backend):
""" Get the physical resources of a backend.
Get the resources of a backend as reported by the backend (not the db).
"""
nodes = get_nodes(backend, bulk=True)
attr = ['mfree', 'mtotal', 'dfree', 'dtotal', 'pinst_cnt', 'ctotal']
res = {}
for a in attr:
... | [
"def",
"get_physical_resources",
"(",
"backend",
")",
":",
"nodes",
"=",
"get_nodes",
"(",
"backend",
",",
"bulk",
"=",
"True",
")",
"attr",
"=",
"[",
"'mfree'",
",",
"'mtotal'",
",",
"'dfree'",
",",
"'dtotal'",
",",
"'pinst_cnt'",
",",
"'ctotal'",
"]",
... | https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-cyclades-app/synnefo/logic/backend.py#L1542-L1560 | |
HeinleinSupport/check_mk_extensions | aa7d7389b812ed00f91dad61d66fb676284897d8 | dovereplstat/lib/check_mk/base/plugins/agent_based/dovereplstat.py | python | discovery_dovereplstat | (section) | [] | def discovery_dovereplstat(section) -> DiscoveryResult:
if 'total_users' in section:
yield Service() | [
"def",
"discovery_dovereplstat",
"(",
"section",
")",
"->",
"DiscoveryResult",
":",
"if",
"'total_users'",
"in",
"section",
":",
"yield",
"Service",
"(",
")"
] | https://github.com/HeinleinSupport/check_mk_extensions/blob/aa7d7389b812ed00f91dad61d66fb676284897d8/dovereplstat/lib/check_mk/base/plugins/agent_based/dovereplstat.py#L73-L75 | ||||
hughw19/NOCS_CVPR2019 | 14dbce775c3c7c45bb7b19269bd53d68efb8f73f | utils.py | python | compute_degree_cm_mAP | (final_results, synset_names, log_dir, degree_thresholds=[360], shift_thresholds=[100], iou_3d_thresholds=[0.1], iou_pose_thres=0.1, use_matches_for_pose=False) | return iou_3d_aps, pose_aps | Compute Average Precision at a set IoU threshold (default 0.5).
Returns:
mAP: Mean Average Precision
precisions: List of precisions at different class score thresholds.
recalls: List of recall values at different class score thresholds.
overlaps: [pred_boxes, gt_boxes] IoU overlaps. | Compute Average Precision at a set IoU threshold (default 0.5).
Returns:
mAP: Mean Average Precision
precisions: List of precisions at different class score thresholds.
recalls: List of recall values at different class score thresholds.
overlaps: [pred_boxes, gt_boxes] IoU overlaps. | [
"Compute",
"Average",
"Precision",
"at",
"a",
"set",
"IoU",
"threshold",
"(",
"default",
"0",
".",
"5",
")",
".",
"Returns",
":",
"mAP",
":",
"Mean",
"Average",
"Precision",
"precisions",
":",
"List",
"of",
"precisions",
"at",
"different",
"class",
"score"... | def compute_degree_cm_mAP(final_results, synset_names, log_dir, degree_thresholds=[360], shift_thresholds=[100], iou_3d_thresholds=[0.1], iou_pose_thres=0.1, use_matches_for_pose=False):
"""Compute Average Precision at a set IoU threshold (default 0.5).
Returns:
mAP: Mean Average Precision
precisions: L... | [
"def",
"compute_degree_cm_mAP",
"(",
"final_results",
",",
"synset_names",
",",
"log_dir",
",",
"degree_thresholds",
"=",
"[",
"360",
"]",
",",
"shift_thresholds",
"=",
"[",
"100",
"]",
",",
"iou_3d_thresholds",
"=",
"[",
"0.1",
"]",
",",
"iou_pose_thres",
"="... | https://github.com/hughw19/NOCS_CVPR2019/blob/14dbce775c3c7c45bb7b19269bd53d68efb8f73f/utils.py#L1711-L2010 | |
justquick/django-activity-stream | 12bceac1d8d37124d29c7717fc928496319fe03a | actstream/views.py | python | detail | (request, action_id) | return render(
request,
'actstream/detail.html',
{
'action': get_object_or_404(models.Action, pk=action_id)
}
) | ``Action`` detail view (pretty boring, mainly used for get_absolute_url) | ``Action`` detail view (pretty boring, mainly used for get_absolute_url) | [
"Action",
"detail",
"view",
"(",
"pretty",
"boring",
"mainly",
"used",
"for",
"get_absolute_url",
")"
] | def detail(request, action_id):
"""
``Action`` detail view (pretty boring, mainly used for get_absolute_url)
"""
return render(
request,
'actstream/detail.html',
{
'action': get_object_or_404(models.Action, pk=action_id)
}
) | [
"def",
"detail",
"(",
"request",
",",
"action_id",
")",
":",
"return",
"render",
"(",
"request",
",",
"'actstream/detail.html'",
",",
"{",
"'action'",
":",
"get_object_or_404",
"(",
"models",
".",
"Action",
",",
"pk",
"=",
"action_id",
")",
"}",
")"
] | https://github.com/justquick/django-activity-stream/blob/12bceac1d8d37124d29c7717fc928496319fe03a/actstream/views.py#L119-L129 | |
pygments/pygments | cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7 | pygments/formatters/html.py | python | HtmlFormatter._get_css_classes | (self, ttype) | return cls or '' | Return the CSS classes of this token type prefixed with the classprefix option. | Return the CSS classes of this token type prefixed with the classprefix option. | [
"Return",
"the",
"CSS",
"classes",
"of",
"this",
"token",
"type",
"prefixed",
"with",
"the",
"classprefix",
"option",
"."
] | def _get_css_classes(self, ttype):
"""Return the CSS classes of this token type prefixed with the classprefix option."""
cls = self._get_css_class(ttype)
while ttype not in STANDARD_TYPES:
ttype = ttype.parent
cls = self._get_css_class(ttype) + ' ' + cls
return cl... | [
"def",
"_get_css_classes",
"(",
"self",
",",
"ttype",
")",
":",
"cls",
"=",
"self",
".",
"_get_css_class",
"(",
"ttype",
")",
"while",
"ttype",
"not",
"in",
"STANDARD_TYPES",
":",
"ttype",
"=",
"ttype",
".",
"parent",
"cls",
"=",
"self",
".",
"_get_css_c... | https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/formatters/html.py#L469-L475 | |
pyqtgraph/pyqtgraph | ac3887abfca4e529aac44f022f8e40556a2587b0 | pyqtgraph/multiprocess/remoteproxy.py | python | ObjectProxy._getValue | (self) | return self._handler.getObjValue(self) | Return the value of the proxied object
(the remote object must be picklable) | Return the value of the proxied object
(the remote object must be picklable) | [
"Return",
"the",
"value",
"of",
"the",
"proxied",
"object",
"(",
"the",
"remote",
"object",
"must",
"be",
"picklable",
")"
] | def _getValue(self):
"""
Return the value of the proxied object
(the remote object must be picklable)
"""
return self._handler.getObjValue(self) | [
"def",
"_getValue",
"(",
"self",
")",
":",
"return",
"self",
".",
"_handler",
".",
"getObjValue",
"(",
"self",
")"
] | https://github.com/pyqtgraph/pyqtgraph/blob/ac3887abfca4e529aac44f022f8e40556a2587b0/pyqtgraph/multiprocess/remoteproxy.py#L876-L881 | |
rizar/attention-lvcsr | 1ae52cafdd8419874846f9544a299eef9c758f3b | libs/Theano/theano/gof/opt.py | python | Optimizer.__call__ | (self, fgraph) | return self.optimize(fgraph) | WRITEME
Same as self.optimize(fgraph). | WRITEME | [
"WRITEME"
] | def __call__(self, fgraph):
"""
WRITEME
Same as self.optimize(fgraph).
"""
return self.optimize(fgraph) | [
"def",
"__call__",
"(",
"self",
",",
"fgraph",
")",
":",
"return",
"self",
".",
"optimize",
"(",
"fgraph",
")"
] | https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/gof/opt.py#L94-L101 | |
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/annotation/reformat.py | python | publocus | (args) | %prog publocus idsfile > idsfiles.publocus
Given a list of model identifiers, convert each into a GenBank approved
pub_locus.
Example output:
Medtr1g007020.1 MTR_1g007020
Medtr1g007030.1 MTR_1g007030
Medtr1g007060.1 MTR_1g007060A
Medtr1g007060.2 MTR_1g007060B | %prog publocus idsfile > idsfiles.publocus | [
"%prog",
"publocus",
"idsfile",
">",
"idsfiles",
".",
"publocus"
] | def publocus(args):
"""
%prog publocus idsfile > idsfiles.publocus
Given a list of model identifiers, convert each into a GenBank approved
pub_locus.
Example output:
Medtr1g007020.1 MTR_1g007020
Medtr1g007030.1 MTR_1g007030
Medtr1g007060.1 MTR_1g007060A
Medtr1g007060.2 MTR_1g00... | [
"def",
"publocus",
"(",
"args",
")",
":",
"p",
"=",
"OptionParser",
"(",
"publocus",
".",
"__doc__",
")",
"p",
".",
"add_option",
"(",
"\"--locus_tag\"",
",",
"default",
"=",
"\"MTR_\"",
",",
"help",
"=",
"\"GenBank locus tag\"",
")",
"opts",
",",
"args",
... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/annotation/reformat.py#L1229-L1290 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/operators.py | python | desc_op | (a) | return a.desc() | [] | def desc_op(a):
return a.desc() | [
"def",
"desc_op",
"(",
"a",
")",
":",
"return",
"a",
".",
"desc",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/operators.py#L1236-L1237 | |||
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | lvars_t.find_input_lvar | (self, *args) | return _idaapi.lvars_t_find_input_lvar(self, *args) | find_input_lvar(self, argloc, _size) -> int | find_input_lvar(self, argloc, _size) -> int | [
"find_input_lvar",
"(",
"self",
"argloc",
"_size",
")",
"-",
">",
"int"
] | def find_input_lvar(self, *args):
"""
find_input_lvar(self, argloc, _size) -> int
"""
return _idaapi.lvars_t_find_input_lvar(self, *args) | [
"def",
"find_input_lvar",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"lvars_t_find_input_lvar",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L36162-L36166 | |
joke2k/faker | 0ebe46fc9b9793fe315cf0fce430258ce74df6f8 | faker/providers/lorem/en_PH/__init__.py | python | Provider.english_words | (self, nb: int = 3, unique: bool = False) | return self.words(nb, self.english_word_list, unique) | Generate a list of English words.
:sample: nb=5
:sample: nb=5, unique=True | Generate a list of English words. | [
"Generate",
"a",
"list",
"of",
"English",
"words",
"."
] | def english_words(self, nb: int = 3, unique: bool = False) -> List[str]:
"""Generate a list of English words.
:sample: nb=5
:sample: nb=5, unique=True
"""
return self.words(nb, self.english_word_list, unique) | [
"def",
"english_words",
"(",
"self",
",",
"nb",
":",
"int",
"=",
"3",
",",
"unique",
":",
"bool",
"=",
"False",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"words",
"(",
"nb",
",",
"self",
".",
"english_word_list",
",",
"unique"... | https://github.com/joke2k/faker/blob/0ebe46fc9b9793fe315cf0fce430258ce74df6f8/faker/providers/lorem/en_PH/__init__.py#L29-L35 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | spark/datadog_checks/spark/config_models/defaults.py | python | shared_service | (field, value) | return get_default_field_value(field, value) | [] | def shared_service(field, value):
return get_default_field_value(field, value) | [
"def",
"shared_service",
"(",
"field",
",",
"value",
")",
":",
"return",
"get_default_field_value",
"(",
"field",
",",
"value",
")"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/spark/datadog_checks/spark/config_models/defaults.py#L17-L18 | |||
amimo/dcc | 114326ab5a082a42c7728a375726489e4709ca29 | androguard/core/analysis/analysis.py | python | Analysis.create_xref | (self) | Create Class, Method, String and Field crossreferences
for all classes in the Analysis.
If you are using multiple DEX files, this function must
be called when all DEX files are added.
If you call the function after every DEX file, the
crossreferences might be wrong! | Create Class, Method, String and Field crossreferences
for all classes in the Analysis. | [
"Create",
"Class",
"Method",
"String",
"and",
"Field",
"crossreferences",
"for",
"all",
"classes",
"in",
"the",
"Analysis",
"."
] | def create_xref(self):
"""
Create Class, Method, String and Field crossreferences
for all classes in the Analysis.
If you are using multiple DEX files, this function must
be called when all DEX files are added.
If you call the function after every DEX file, the
c... | [
"def",
"create_xref",
"(",
"self",
")",
":",
"log",
".",
"debug",
"(",
"\"Creating Crossreferences (XREF)\"",
")",
"tic",
"=",
"time",
".",
"time",
"(",
")",
"# TODO on concurrent runs, we probably need to clean up first,",
"# or check that we do not write garbage.",
"# TOD... | https://github.com/amimo/dcc/blob/114326ab5a082a42c7728a375726489e4709ca29/androguard/core/analysis/analysis.py#L1118-L1139 | ||
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/hardware/modules/amdgpu_exp.py | python | AMDGpuExp.post_install | (self, dest_dir) | Post install commands | Post install commands | [
"Post",
"install",
"commands"
] | def post_install(self, dest_dir):
""" Post install commands """
pass | [
"def",
"post_install",
"(",
"self",
",",
"dest_dir",
")",
":",
"pass"
] | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/hardware/modules/amdgpu_exp.py#L69-L71 | ||
web2py/web2py | 095905c4e010a1426c729483d912e270a51b7ba8 | gluon/rewrite.py | python | _params_default | (app=None) | return p | Returns a new copy of default parameters | Returns a new copy of default parameters | [
"Returns",
"a",
"new",
"copy",
"of",
"default",
"parameters"
] | def _params_default(app=None):
"""Returns a new copy of default parameters"""
p = Storage()
p.name = app or "BASE"
p.default_application = app or "init"
p.default_controller = "default"
p.default_function = "index"
p.routes_app = []
p.routes_in = []
p.routes_out = []
p.routes_one... | [
"def",
"_params_default",
"(",
"app",
"=",
"None",
")",
":",
"p",
"=",
"Storage",
"(",
")",
"p",
".",
"name",
"=",
"app",
"or",
"\"BASE\"",
"p",
".",
"default_application",
"=",
"app",
"or",
"\"init\"",
"p",
".",
"default_controller",
"=",
"\"default\"",... | https://github.com/web2py/web2py/blob/095905c4e010a1426c729483d912e270a51b7ba8/gluon/rewrite.py#L92-L113 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/python-monitorclient-1.1/build/lib.linux-x86_64-2.7/monitorclient/v1/monitor_backups.py | python | ServiceManageBackupManager.create | (self, monitor_id, container=None,
name=None, description=None) | return self._create('/backups', body, 'backup') | Create a monitor backup.
:param monitor_id: The ID of the monitor to backup.
:param container: The name of the backup service container.
:param name: The name of the backup.
:param description: The description of the backup.
:rtype: :class:`ServiceManageBackup` | Create a monitor backup. | [
"Create",
"a",
"monitor",
"backup",
"."
] | def create(self, monitor_id, container=None,
name=None, description=None):
"""Create a monitor backup.
:param monitor_id: The ID of the monitor to backup.
:param container: The name of the backup service container.
:param name: The name of the backup.
:param descr... | [
"def",
"create",
"(",
"self",
",",
"monitor_id",
",",
"container",
"=",
"None",
",",
"name",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"body",
"=",
"{",
"'backup'",
":",
"{",
"'monitor_id'",
":",
"monitor_id",
",",
"'container'",
":",
"co... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/python-monitorclient-1.1/build/lib.linux-x86_64-2.7/monitorclient/v1/monitor_backups.py#L37-L51 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/formats/base.py | python | TranslationFormat.all_store_units | (self) | return self.store.units | Wrapper for all store units for possible filtering. | Wrapper for all store units for possible filtering. | [
"Wrapper",
"for",
"all",
"store",
"units",
"for",
"possible",
"filtering",
"."
] | def all_store_units(self):
"""Wrapper for all store units for possible filtering."""
return self.store.units | [
"def",
"all_store_units",
"(",
"self",
")",
":",
"return",
"self",
".",
"store",
".",
"units"
] | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/formats/base.py#L336-L338 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/graphs/generic_graph.py | python | GenericGraph.longest_path | (self, s=None, t=None, use_edge_labels=False, algorithm="MILP",
solver=None, verbose=0, *, integrality_tolerance=1e-3) | r"""
Return a longest path of ``self``.
INPUT:
- ``s`` -- a vertex (default: ``None``); forces the source of the path
(the method then returns the longest path starting at ``s``). The
argument is set to ``None`` by default, which means that no constraint
is set up... | r"""
Return a longest path of ``self``. | [
"r",
"Return",
"a",
"longest",
"path",
"of",
"self",
"."
] | def longest_path(self, s=None, t=None, use_edge_labels=False, algorithm="MILP",
solver=None, verbose=0, *, integrality_tolerance=1e-3):
r"""
Return a longest path of ``self``.
INPUT:
- ``s`` -- a vertex (default: ``None``); forces the source of the path
(... | [
"def",
"longest_path",
"(",
"self",
",",
"s",
"=",
"None",
",",
"t",
"=",
"None",
",",
"use_edge_labels",
"=",
"False",
",",
"algorithm",
"=",
"\"MILP\"",
",",
"solver",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"*",
",",
"integrality_tolerance",
"="... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/graphs/generic_graph.py#L7155-L7535 | ||
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_lnxshell.py | python | st_lnxshell.do_location | (self,line) | [] | def do_location(self,line): self.stlib.location() | [
"def",
"do_location",
"(",
"self",
",",
"line",
")",
":",
"self",
".",
"stlib",
".",
"location",
"(",
")"
] | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_lnxshell.py#L105-L105 | ||||
ring04h/wyportmap | c4201e2313504e780a7f25238eba2a2d3223e739 | sqlalchemy/orm/session.py | python | Session.expunge_all | (self) | Remove all object instances from this ``Session``.
This is equivalent to calling ``expunge(obj)`` on all objects in this
``Session``. | Remove all object instances from this ``Session``. | [
"Remove",
"all",
"object",
"instances",
"from",
"this",
"Session",
"."
] | def expunge_all(self):
"""Remove all object instances from this ``Session``.
This is equivalent to calling ``expunge(obj)`` on all objects in this
``Session``.
"""
for state in self.identity_map.all_states() + list(self._new):
state._detach()
self.identity_... | [
"def",
"expunge_all",
"(",
"self",
")",
":",
"for",
"state",
"in",
"self",
".",
"identity_map",
".",
"all_states",
"(",
")",
"+",
"list",
"(",
"self",
".",
"_new",
")",
":",
"state",
".",
"_detach",
"(",
")",
"self",
".",
"identity_map",
"=",
"self",... | https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/orm/session.py#L1014-L1026 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Utils/old_content_branch.py | python | edit_playbooks_directory | (new_to_version: str, dir_path: str) | Edit Playbooks directory to fit the branch | Edit Playbooks directory to fit the branch | [
"Edit",
"Playbooks",
"directory",
"to",
"fit",
"the",
"branch"
] | def edit_playbooks_directory(new_to_version: str, dir_path: str):
"""Edit Playbooks directory to fit the branch"""
for file_name in os.listdir(dir_path):
file_path = os.path.join(dir_path, file_name)
if file_path.endswith('md'):
continue
if os.path.isfile(file_path):
... | [
"def",
"edit_playbooks_directory",
"(",
"new_to_version",
":",
"str",
",",
"dir_path",
":",
"str",
")",
":",
"for",
"file_name",
"in",
"os",
".",
"listdir",
"(",
"dir_path",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dir_path",
","... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Utils/old_content_branch.py#L171-L203 | ||
befelix/safe_learning | f1aad5a3d2f433993e842aa2e6ca7a9c45ad95d4 | safe_learning/functions.py | python | Triangulation.nindex | (self) | return self.tri.nindex | Return the number of parameters. | Return the number of parameters. | [
"Return",
"the",
"number",
"of",
"parameters",
"."
] | def nindex(self):
"""Return the number of parameters."""
return self.tri.nindex | [
"def",
"nindex",
"(",
"self",
")",
":",
"return",
"self",
".",
"tri",
".",
"nindex"
] | https://github.com/befelix/safe_learning/blob/f1aad5a3d2f433993e842aa2e6ca7a9c45ad95d4/safe_learning/functions.py#L1438-L1440 | |
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/corresponding/prediction.py | python | corresponding_chromaticities_prediction_VonKries | (experiment=1,
transform='CAT02') | Returns the corresponding chromaticities prediction for *Von Kries*
chromatic adaptation model using given transform.
Parameters
----------
experiment : integer or CorrespondingColourDataset, optional
{1, 2, 3, 4, 6, 8, 9, 11, 12}
*Breneman (1987)* experiment number or
:class:`c... | Returns the corresponding chromaticities prediction for *Von Kries*
chromatic adaptation model using given transform. | [
"Returns",
"the",
"corresponding",
"chromaticities",
"prediction",
"for",
"*",
"Von",
"Kries",
"*",
"chromatic",
"adaptation",
"model",
"using",
"given",
"transform",
"."
] | def corresponding_chromaticities_prediction_VonKries(experiment=1,
transform='CAT02'):
"""
Returns the corresponding chromaticities prediction for *Von Kries*
chromatic adaptation model using given transform.
Parameters
----------
experiment ... | [
"def",
"corresponding_chromaticities_prediction_VonKries",
"(",
"experiment",
"=",
"1",
",",
"transform",
"=",
"'CAT02'",
")",
":",
"experiment_results",
"=",
"(",
"convert_experiment_results_Breneman1987",
"(",
"experiment",
")",
"if",
"is_numeric",
"(",
"experiment",
... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/corresponding/prediction.py#L448-L513 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/bertabs/modeling_bertabs.py | python | BertSumOptimizer.step | (self) | [] | def step(self):
self._step += 1
for stack, optimizer in self.optimizers.items():
new_rate = self._update_rate(stack)
for param_group in optimizer.param_groups:
param_group["lr"] = new_rate
optimizer.step()
self.current_learning_rates[stack]... | [
"def",
"step",
"(",
"self",
")",
":",
"self",
".",
"_step",
"+=",
"1",
"for",
"stack",
",",
"optimizer",
"in",
"self",
".",
"optimizers",
".",
"items",
"(",
")",
":",
"new_rate",
"=",
"self",
".",
"_update_rate",
"(",
"stack",
")",
"for",
"param_grou... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/bertabs/modeling_bertabs.py#L1051-L1058 | ||||
NervanaSystems/ngraph-python | ac032c83c7152b615a9ad129d54d350f9d6a2986 | ngraph/transformers/passes/flexfusion.py | python | FlexFusion.construct_sigmoid_pattern | (self) | return sigmoid_op | Generate graph op that represents a pattern for Sigmoid operation
ng.sigmoid(x)
Returns:
Single pattern that matches Sigmoid | Generate graph op that represents a pattern for Sigmoid operation
ng.sigmoid(x) | [
"Generate",
"graph",
"op",
"that",
"represents",
"a",
"pattern",
"for",
"Sigmoid",
"operation",
"ng",
".",
"sigmoid",
"(",
"x",
")"
] | def construct_sigmoid_pattern(self):
"""
Generate graph op that represents a pattern for Sigmoid operation
ng.sigmoid(x)
Returns:
Single pattern that matches Sigmoid
"""
self.sigmoid_x_label = "X"
x = PatternLabelOp(self.sigmoid_x_label, axes={ng.mak... | [
"def",
"construct_sigmoid_pattern",
"(",
"self",
")",
":",
"self",
".",
"sigmoid_x_label",
"=",
"\"X\"",
"x",
"=",
"PatternLabelOp",
"(",
"self",
".",
"sigmoid_x_label",
",",
"axes",
"=",
"{",
"ng",
".",
"make_axis",
"(",
"name",
"=",
"'N'",
")",
"}",
")... | https://github.com/NervanaSystems/ngraph-python/blob/ac032c83c7152b615a9ad129d54d350f9d6a2986/ngraph/transformers/passes/flexfusion.py#L8-L20 | |
mxdg/passbytcp | 0230198598b6df0098ac1630c10c1d377cdbf3f9 | server/common_func.py | python | CtrlPkg.pbuild_hs_m2s | (cls, force_rebuilt=False) | pkg build: Handshake Master to Slaver | pkg build: Handshake Master to Slaver | [
"pkg",
"build",
":",
"Handshake",
"Master",
"to",
"Slaver"
] | def pbuild_hs_m2s(cls, force_rebuilt=False):
"""pkg build: Handshake Master to Slaver"""
# because py27 do not have functools.lru_cache, so we must write our own
if force_rebuilt:
return CtrlPkg(
pkg_type=cls.PTYPE_HS_M2S,
data=(cls.SECRET_KEY_CRC32,),... | [
"def",
"pbuild_hs_m2s",
"(",
"cls",
",",
"force_rebuilt",
"=",
"False",
")",
":",
"# because py27 do not have functools.lru_cache, so we must write our own",
"if",
"force_rebuilt",
":",
"return",
"CtrlPkg",
"(",
"pkg_type",
"=",
"cls",
".",
"PTYPE_HS_M2S",
",",
"data",
... | https://github.com/mxdg/passbytcp/blob/0230198598b6df0098ac1630c10c1d377cdbf3f9/server/common_func.py#L463-L473 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/modern_forms/fan.py | python | ModernFormsFanEntity.__init__ | (
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) | Initialize Modern Forms light. | Initialize Modern Forms light. | [
"Initialize",
"Modern",
"Forms",
"light",
"."
] | def __init__(
self, entry_id: str, coordinator: ModernFormsDataUpdateCoordinator
) -> None:
"""Initialize Modern Forms light."""
super().__init__(
entry_id=entry_id,
coordinator=coordinator,
name=f"{coordinator.data.info.device_name} Fan",
)
... | [
"def",
"__init__",
"(",
"self",
",",
"entry_id",
":",
"str",
",",
"coordinator",
":",
"ModernFormsDataUpdateCoordinator",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"entry_id",
"=",
"entry_id",
",",
"coordinator",
"=",
"coordinator",
",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/modern_forms/fan.py#L75-L84 | ||
blue-season/pywarm | 92b9d85bee2d88fe23499714665d97ba7b5813ea | examples/efficientnet.py | python | drop_connect | (x, rate) | return x/rate*drop_mask.floor() | Randomly set entire batch to 0. | Randomly set entire batch to 0. | [
"Randomly",
"set",
"entire",
"batch",
"to",
"0",
"."
] | def drop_connect(x, rate):
""" Randomly set entire batch to 0. """
if rate == 0:
return x
rate = 1.0-rate
drop_mask = torch.rand([x.shape[0], 1, 1, 1], device=x.device, requires_grad=False)+rate
return x/rate*drop_mask.floor() | [
"def",
"drop_connect",
"(",
"x",
",",
"rate",
")",
":",
"if",
"rate",
"==",
"0",
":",
"return",
"x",
"rate",
"=",
"1.0",
"-",
"rate",
"drop_mask",
"=",
"torch",
".",
"rand",
"(",
"[",
"x",
".",
"shape",
"[",
"0",
"]",
",",
"1",
",",
"1",
",",... | https://github.com/blue-season/pywarm/blob/92b9d85bee2d88fe23499714665d97ba7b5813ea/examples/efficientnet.py#L70-L76 | |
python-babel/babel | cc36c84a83dd447bf48a6af3eb03c97bf299e8cb | babel/core.py | python | Locale.parse | (cls, identifier, sep='_', resolve_likely_subtags=True) | Create a `Locale` instance for the given locale identifier.
>>> l = Locale.parse('de-DE', sep='-')
>>> l.display_name
u'Deutsch (Deutschland)'
If the `identifier` parameter is not a string, but actually a `Locale`
object, that object is returned:
>>> Locale.parse(l)
... | Create a `Locale` instance for the given locale identifier. | [
"Create",
"a",
"Locale",
"instance",
"for",
"the",
"given",
"locale",
"identifier",
"."
] | def parse(cls, identifier, sep='_', resolve_likely_subtags=True):
"""Create a `Locale` instance for the given locale identifier.
>>> l = Locale.parse('de-DE', sep='-')
>>> l.display_name
u'Deutsch (Deutschland)'
If the `identifier` parameter is not a string, but actually a `Loc... | [
"def",
"parse",
"(",
"cls",
",",
"identifier",
",",
"sep",
"=",
"'_'",
",",
"resolve_likely_subtags",
"=",
"True",
")",
":",
"if",
"identifier",
"is",
"None",
":",
"return",
"None",
"elif",
"isinstance",
"(",
"identifier",
",",
"Locale",
")",
":",
"retur... | https://github.com/python-babel/babel/blob/cc36c84a83dd447bf48a6af3eb03c97bf299e8cb/babel/core.py#L222-L331 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/topology/simplicial_complex.py | python | SimplicialComplex.cone_vertices | (self) | return sorted(C) | r"""
Return the list of cone vertices of ``self``.
A vertex is a cone vertex if and only if it appears in every facet.
EXAMPLES::
sage: SimplicialComplex([[1,2,3]]).cone_vertices()
[1, 2, 3]
sage: SimplicialComplex([[1,2,3], [1,3,4], [1,5,6]]).cone_vertices... | r"""
Return the list of cone vertices of ``self``. | [
"r",
"Return",
"the",
"list",
"of",
"cone",
"vertices",
"of",
"self",
"."
] | def cone_vertices(self):
r"""
Return the list of cone vertices of ``self``.
A vertex is a cone vertex if and only if it appears in every facet.
EXAMPLES::
sage: SimplicialComplex([[1,2,3]]).cone_vertices()
[1, 2, 3]
sage: SimplicialComplex([[1,2,3],... | [
"def",
"cone_vertices",
"(",
"self",
")",
":",
"F",
"=",
"self",
".",
"facets",
"(",
")",
"C",
"=",
"set",
"(",
"self",
".",
"vertices",
"(",
")",
")",
"for",
"f",
"in",
"F",
":",
"C",
"=",
"C",
".",
"intersection",
"(",
"list",
"(",
"f",
")"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/topology/simplicial_complex.py#L4511-L4532 | |
Arelle/Arelle | 20f3d8a8afd41668e1520799acd333349ce0ba17 | arelle/webserver/bottle.py | python | Bottle.remove_hook | (self, name, func) | Remove a callback from a hook. | Remove a callback from a hook. | [
"Remove",
"a",
"callback",
"from",
"a",
"hook",
"."
] | def remove_hook(self, name, func):
""" Remove a callback from a hook. """
if name in self._hooks and func in self._hooks[name]:
self._hooks[name].remove(func)
return True | [
"def",
"remove_hook",
"(",
"self",
",",
"name",
",",
"func",
")",
":",
"if",
"name",
"in",
"self",
".",
"_hooks",
"and",
"func",
"in",
"self",
".",
"_hooks",
"[",
"name",
"]",
":",
"self",
".",
"_hooks",
"[",
"name",
"]",
".",
"remove",
"(",
"fun... | https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/webserver/bottle.py#L693-L697 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/sprint/error_signals.py | python | SprintInstancePool.get_free_instance | (self) | return self._maybe_create_new_instance() | :rtype: SprintSubprocessInstance|None | :rtype: SprintSubprocessInstance|None | [
":",
"rtype",
":",
"SprintSubprocessInstance|None"
] | def get_free_instance(self):
"""
:rtype: SprintSubprocessInstance|None
"""
for inst in self.instances:
if not inst.is_calculating:
return inst
return self._maybe_create_new_instance() | [
"def",
"get_free_instance",
"(",
"self",
")",
":",
"for",
"inst",
"in",
"self",
".",
"instances",
":",
"if",
"not",
"inst",
".",
"is_calculating",
":",
"return",
"inst",
"return",
"self",
".",
"_maybe_create_new_instance",
"(",
")"
] | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/sprint/error_signals.py#L537-L544 | |
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/reportlab/build/lib.linux-i686-2.7/reportlab/lib/sequencer.py | python | Sequencer.setFormat | (self, counter, format) | Specifies that the given counter should use
the given format henceforth. | Specifies that the given counter should use
the given format henceforth. | [
"Specifies",
"that",
"the",
"given",
"counter",
"should",
"use",
"the",
"given",
"format",
"henceforth",
"."
] | def setFormat(self, counter, format):
"""Specifies that the given counter should use
the given format henceforth."""
func = self._formatters[format]
self._getCounter(counter).setFormatter(func) | [
"def",
"setFormat",
"(",
"self",
",",
"counter",
",",
"format",
")",
":",
"func",
"=",
"self",
".",
"_formatters",
"[",
"format",
"]",
"self",
".",
"_getCounter",
"(",
"counter",
")",
".",
"setFormatter",
"(",
"func",
")"
] | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/reportlab/build/lib.linux-i686-2.7/reportlab/lib/sequencer.py#L214-L218 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django_redis/client/dummy.py | python | RedisDummyCache.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
DummyCache.__init__(self, *args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"DummyCache",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django_redis/client/dummy.py#L5-L6 | ||||
skylines-project/skylines | ce68ee280af05498b3859fc2c199b08043ad58a9 | fabfile.py | python | restart_service | (service) | [] | def restart_service(service):
run("systemctl --user restart %s" % service) | [
"def",
"restart_service",
"(",
"service",
")",
":",
"run",
"(",
"\"systemctl --user restart %s\"",
"%",
"service",
")"
] | https://github.com/skylines-project/skylines/blob/ce68ee280af05498b3859fc2c199b08043ad58a9/fabfile.py#L53-L54 | ||||
CalebBell/thermo | 572a47d1b03d49fe609b8d5f826fa6a7cde00828 | thermo/eos_alpha_functions.py | python | Mathias_Copeman_poly_a_alpha.a_alphas_vectorized | (self, T) | return a_alphas | [] | def a_alphas_vectorized(self, T):
ais, alpha_coeffs, Tcs = self.ais, self.alpha_coeffs, self.Tcs
a_alphas = []
for i in range(self.N):
tau = 1.0 - (T/Tcs[i])**0.5
if T < Tcs[i]:
x0 = horner(alpha_coeffs[i], tau)
a_alpha = x0*x0*ais[i]
... | [
"def",
"a_alphas_vectorized",
"(",
"self",
",",
"T",
")",
":",
"ais",
",",
"alpha_coeffs",
",",
"Tcs",
"=",
"self",
".",
"ais",
",",
"self",
".",
"alpha_coeffs",
",",
"self",
".",
"Tcs",
"a_alphas",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"s... | https://github.com/CalebBell/thermo/blob/572a47d1b03d49fe609b8d5f826fa6a7cde00828/thermo/eos_alpha_functions.py#L1606-L1618 | |||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/preview/understand/assistant/__init__.py | python | AssistantPage.__repr__ | (self) | return '<Twilio.Preview.Understand.AssistantPage>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.Preview.Understand.AssistantPage>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.Preview.Understand.AssistantPage>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/__init__.py#L220-L227 | |
cedricbonhomme/Stegano | 1b8d8042b73179fd76782f04793bd44a01fa1570 | stegano/steganalysis/parity.py | python | steganalyse | (img: Image.Image) | return encoded | Steganlysis of the LSB technique. | Steganlysis of the LSB technique. | [
"Steganlysis",
"of",
"the",
"LSB",
"technique",
"."
] | def steganalyse(img: Image.Image) -> Image.Image:
"""
Steganlysis of the LSB technique.
"""
encoded = Image.new(img.mode, (img.size))
width, height = img.size
for row in range(height):
for col in range(width):
r, g, b = img.getpixel((col, row))[0:3]
if r % 2 == 0:... | [
"def",
"steganalyse",
"(",
"img",
":",
"Image",
".",
"Image",
")",
"->",
"Image",
".",
"Image",
":",
"encoded",
"=",
"Image",
".",
"new",
"(",
"img",
".",
"mode",
",",
"(",
"img",
".",
"size",
")",
")",
"width",
",",
"height",
"=",
"img",
".",
... | https://github.com/cedricbonhomme/Stegano/blob/1b8d8042b73179fd76782f04793bd44a01fa1570/stegano/steganalysis/parity.py#L31-L53 | |
virtualabs/btlejack | 4e3014f90a55d0e7068f2580dfd6cac3e149114b | btlejack/jobs.py | python | MultiSnifferInterface.recover_prng | (self, access_address, crcinit, chm, hop_interval) | Recover BLE5 internal PRNG counter. | Recover BLE5 internal PRNG counter. | [
"Recover",
"BLE5",
"internal",
"PRNG",
"counter",
"."
] | def recover_prng(self, access_address, crcinit, chm, hop_interval):
"""
Recover BLE5 internal PRNG counter.
"""
self.reset()
link = self.get_free_interface()
link.set_timeout(0.1)
if link is not None:
link.recover_prng(access_address, crcinit, chm, hop... | [
"def",
"recover_prng",
"(",
"self",
",",
"access_address",
",",
"crcinit",
",",
"chm",
",",
"hop_interval",
")",
":",
"self",
".",
"reset",
"(",
")",
"link",
"=",
"self",
".",
"get_free_interface",
"(",
")",
"link",
".",
"set_timeout",
"(",
"0.1",
")",
... | https://github.com/virtualabs/btlejack/blob/4e3014f90a55d0e7068f2580dfd6cac3e149114b/btlejack/jobs.py#L298-L306 | ||
midgetspy/Sick-Beard | 171a607e41b7347a74cc815f6ecce7968d9acccf | lib/pythontwitter/__init__.py | python | Status.SetText | (self, text) | Set the text of this status message.
Args:
text:
The text of this status message | Set the text of this status message. | [
"Set",
"the",
"text",
"of",
"this",
"status",
"message",
"."
] | def SetText(self, text):
'''Set the text of this status message.
Args:
text:
The text of this status message
'''
self._text = text | [
"def",
"SetText",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"_text",
"=",
"text"
] | https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/lib/pythontwitter/__init__.py#L377-L384 | ||
open-mmlab/mmpose | 0376d51efdd93b3c8f3338211130753fed808bb9 | mmpose/core/post_processing/one_euro_filter.py | python | OneEuroFilter.__init__ | (self,
x0,
dx0=0.0,
min_cutoff=1.7,
beta=0.3,
d_cutoff=30.0,
fps=None) | One Euro Filter for keypoints smoothing.
Args:
x0 (np.ndarray[K, 2]): Initialize keypoints value
dx0 (float): 0.0
min_cutoff (float): parameter for one euro filter
beta (float): parameter for one euro filter
d_cutoff (float): Input data FPS
... | One Euro Filter for keypoints smoothing. | [
"One",
"Euro",
"Filter",
"for",
"keypoints",
"smoothing",
"."
] | def __init__(self,
x0,
dx0=0.0,
min_cutoff=1.7,
beta=0.3,
d_cutoff=30.0,
fps=None):
"""One Euro Filter for keypoints smoothing.
Args:
x0 (np.ndarray[K, 2]): Initialize keypoints value
... | [
"def",
"__init__",
"(",
"self",
",",
"x0",
",",
"dx0",
"=",
"0.0",
",",
"min_cutoff",
"=",
"1.7",
",",
"beta",
"=",
"0.3",
",",
"d_cutoff",
"=",
"30.0",
",",
"fps",
"=",
"None",
")",
":",
"# The parameters.",
"self",
".",
"data_shape",
"=",
"x0",
"... | https://github.com/open-mmlab/mmpose/blob/0376d51efdd93b3c8f3338211130753fed808bb9/mmpose/core/post_processing/one_euro_filter.py#L21-L57 | ||
pygments/pygments | cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7 | pygments/util.py | python | guess_decode | (text) | Decode *text* with guessed encoding.
First try UTF-8; this should fail for non-UTF-8 encodings.
Then try the preferred locale encoding.
Fall back to latin-1, which always works. | Decode *text* with guessed encoding. | [
"Decode",
"*",
"text",
"*",
"with",
"guessed",
"encoding",
"."
] | def guess_decode(text):
"""Decode *text* with guessed encoding.
First try UTF-8; this should fail for non-UTF-8 encodings.
Then try the preferred locale encoding.
Fall back to latin-1, which always works.
"""
try:
text = text.decode('utf-8')
return text, 'utf-8'
except Unico... | [
"def",
"guess_decode",
"(",
"text",
")",
":",
"try",
":",
"text",
"=",
"text",
".",
"decode",
"(",
"'utf-8'",
")",
"return",
"text",
",",
"'utf-8'",
"except",
"UnicodeDecodeError",
":",
"try",
":",
"import",
"locale",
"prefencoding",
"=",
"locale",
".",
... | https://github.com/pygments/pygments/blob/cd3ad20dfc8a6cb43e2c0b22b14446dcc0a554d7/pygments/util.py#L259-L277 | ||
SCons/scons | 309f0234d1d9cc76955818be47c5c722f577dac6 | SCons/Tool/swig.py | python | _find_modules | (src) | return mnames, directors | Find all modules referenced by %module lines in `src`, a SWIG .i file.
Returns a list of all modules, and a flag set if SWIG directors have
been requested (SWIG will generate an additional header file in this
case.) | Find all modules referenced by %module lines in `src`, a SWIG .i file.
Returns a list of all modules, and a flag set if SWIG directors have
been requested (SWIG will generate an additional header file in this
case.) | [
"Find",
"all",
"modules",
"referenced",
"by",
"%module",
"lines",
"in",
"src",
"a",
"SWIG",
".",
"i",
"file",
".",
"Returns",
"a",
"list",
"of",
"all",
"modules",
"and",
"a",
"flag",
"set",
"if",
"SWIG",
"directors",
"have",
"been",
"requested",
"(",
"... | def _find_modules(src):
"""Find all modules referenced by %module lines in `src`, a SWIG .i file.
Returns a list of all modules, and a flag set if SWIG directors have
been requested (SWIG will generate an additional header file in this
case.)"""
directors = 0
mnames = []
try:
... | [
"def",
"_find_modules",
"(",
"src",
")",
":",
"directors",
"=",
"0",
"mnames",
"=",
"[",
"]",
"try",
":",
"with",
"open",
"(",
"src",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"matches",
"=",
"_reModule",
".",
"findall",
"(",
... | https://github.com/SCons/scons/blob/309f0234d1d9cc76955818be47c5c722f577dac6/SCons/Tool/swig.py#L60-L79 | |
mkeeter/kokopelli | c99b7909e138c42c7d5c99927f5031f021bffd77 | koko/c/vec3f.py | python | Vec3f.__init__ | (self, x=0., y=0., z=0.) | [] | def __init__(self, x=0., y=0., z=0.):
try: x = list(x)
except TypeError: ctypes.Structure.__init__(self, x, y, z)
else: ctypes.Structure.__init__(self, x[0], x[1], x[2]) | [
"def",
"__init__",
"(",
"self",
",",
"x",
"=",
"0.",
",",
"y",
"=",
"0.",
",",
"z",
"=",
"0.",
")",
":",
"try",
":",
"x",
"=",
"list",
"(",
"x",
")",
"except",
"TypeError",
":",
"ctypes",
".",
"Structure",
".",
"__init__",
"(",
"self",
",",
"... | https://github.com/mkeeter/kokopelli/blob/c99b7909e138c42c7d5c99927f5031f021bffd77/koko/c/vec3f.py#L11-L14 | ||||
mahmoud/lithoxyl | b4bfa92c54df85b4bd5935fe270e2aa3fb25c412 | lithoxyl/action.py | python | Action.failure | (self, message=None, *a, **kw) | return self._end('failure', message, a, kw) | Mark this Action failed. Also set the Action's
*message* template. Positional and keyword arguments will be
used to generate the formatted message. Keyword arguments will
also be added to the Action's ``data_map`` attribute. | Mark this Action failed. Also set the Action's
*message* template. Positional and keyword arguments will be
used to generate the formatted message. Keyword arguments will
also be added to the Action's ``data_map`` attribute. | [
"Mark",
"this",
"Action",
"failed",
".",
"Also",
"set",
"the",
"Action",
"s",
"*",
"message",
"*",
"template",
".",
"Positional",
"and",
"keyword",
"arguments",
"will",
"be",
"used",
"to",
"generate",
"the",
"formatted",
"message",
".",
"Keyword",
"arguments... | def failure(self, message=None, *a, **kw):
"""Mark this Action failed. Also set the Action's
*message* template. Positional and keyword arguments will be
used to generate the formatted message. Keyword arguments will
also be added to the Action's ``data_map`` attribute.
"""
... | [
"def",
"failure",
"(",
"self",
",",
"message",
"=",
"None",
",",
"*",
"a",
",",
"*",
"*",
"kw",
")",
":",
"if",
"not",
"message",
":",
"if",
"self",
".",
"data_map",
":",
"message",
"=",
"self",
".",
"name",
"+",
"' failed - ({data_map_repr})'",
"els... | https://github.com/mahmoud/lithoxyl/blob/b4bfa92c54df85b4bd5935fe270e2aa3fb25c412/lithoxyl/action.py#L178-L190 | |
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library_base.py | python | Interface._get_attr | (self, name) | [] | def _get_attr(self, name):
attr = self._search_attr(name, prefix="get")
if inspect.isfunction(attr) or inspect.ismethod(attr):
return self._call_method(attr)
else:
return attr | [
"def",
"_get_attr",
"(",
"self",
",",
"name",
")",
":",
"attr",
"=",
"self",
".",
"_search_attr",
"(",
"name",
",",
"prefix",
"=",
"\"get\"",
")",
"if",
"inspect",
".",
"isfunction",
"(",
"attr",
")",
"or",
"inspect",
".",
"ismethod",
"(",
"attr",
")... | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library_base.py#L178-L183 | ||||
pythonarcade/arcade | 1ee3eb1900683213e8e8df93943327c2ea784564 | arcade/examples/sprite_health.py | python | MyGame.on_update | (self, delta_time) | Movement and game logic | Movement and game logic | [
"Movement",
"and",
"game",
"logic"
] | def on_update(self, delta_time):
""" Movement and game logic """
# Call update on bullet sprites
self.bullet_list.update()
# Loop through each bullet
for bullet in self.bullet_list:
# Check this bullet to see if it hit a coin
hit_list = arcade.check_for... | [
"def",
"on_update",
"(",
"self",
",",
"delta_time",
")",
":",
"# Call update on bullet sprites",
"self",
".",
"bullet_list",
".",
"update",
"(",
")",
"# Loop through each bullet",
"for",
"bullet",
"in",
"self",
".",
"bullet_list",
":",
"# Check this bullet to see if i... | https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/sprite_health.py#L186-L223 | ||
ucbdrive/skipnet | 4825e53aaf72a505c3328cd89ad27533946d8a96 | cifar/models.py | python | cifar100_feedforward_110 | (pretrained=False, **kwargs) | return model | SkipNet-110 with FFGate-II | SkipNet-110 with FFGate-II | [
"SkipNet",
"-",
"110",
"with",
"FFGate",
"-",
"II"
] | def cifar100_feedforward_110(pretrained=False, **kwargs):
"""SkipNet-110 with FFGate-II"""
model = ResNetFeedForwardSP(BasicBlock, [18, 18, 18], num_classes=100,
gate_type='ffgate2')
return model | [
"def",
"cifar100_feedforward_110",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"ResNetFeedForwardSP",
"(",
"BasicBlock",
",",
"[",
"18",
",",
"18",
",",
"18",
"]",
",",
"num_classes",
"=",
"100",
",",
"gate_type",
"=... | https://github.com/ucbdrive/skipnet/blob/4825e53aaf72a505c3328cd89ad27533946d8a96/cifar/models.py#L512-L516 | |
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/hacs/utils/store.py | python | async_remove_store | (hass, key) | Remove a store element that should no longer be used. | Remove a store element that should no longer be used. | [
"Remove",
"a",
"store",
"element",
"that",
"should",
"no",
"longer",
"be",
"used",
"."
] | async def async_remove_store(hass, key):
"""Remove a store element that should no longer be used."""
if "/" not in key:
return
await get_store_for_key(hass, key).async_remove() | [
"async",
"def",
"async_remove_store",
"(",
"hass",
",",
"key",
")",
":",
"if",
"\"/\"",
"not",
"in",
"key",
":",
"return",
"await",
"get_store_for_key",
"(",
"hass",
",",
"key",
")",
".",
"async_remove",
"(",
")"
] | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/hacs/utils/store.py#L82-L86 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/contrib/auth/hashers.py | python | MD5PasswordHasher.encode | (self, password, salt) | return "%s$%s$%s" % (self.algorithm, salt, hash) | [] | def encode(self, password, salt):
assert password is not None
assert salt and '$' not in salt
hash = hashlib.md5(force_bytes(salt + password)).hexdigest()
return "%s$%s$%s" % (self.algorithm, salt, hash) | [
"def",
"encode",
"(",
"self",
",",
"password",
",",
"salt",
")",
":",
"assert",
"password",
"is",
"not",
"None",
"assert",
"salt",
"and",
"'$'",
"not",
"in",
"salt",
"hash",
"=",
"hashlib",
".",
"md5",
"(",
"force_bytes",
"(",
"salt",
"+",
"password",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/auth/hashers.py#L521-L525 | |||
scrapinghub/spidermon | f2b21e45e70796f583bbb97f39b823c31d242b17 | spidermon/contrib/scrapy/stats.py | python | ValidationStatsManager._get_stats_name | (self, *names) | return "/".join([self.prefix] + list([self._get_name(n) for n in names])) | [] | def _get_stats_name(self, *names):
return "/".join([self.prefix] + list([self._get_name(n) for n in names])) | [
"def",
"_get_stats_name",
"(",
"self",
",",
"*",
"names",
")",
":",
"return",
"\"/\"",
".",
"join",
"(",
"[",
"self",
".",
"prefix",
"]",
"+",
"list",
"(",
"[",
"self",
".",
"_get_name",
"(",
"n",
")",
"for",
"n",
"in",
"names",
"]",
")",
")"
] | https://github.com/scrapinghub/spidermon/blob/f2b21e45e70796f583bbb97f39b823c31d242b17/spidermon/contrib/scrapy/stats.py#L46-L47 | |||
SpockBotMC/SpockBot | f89911551f18357720034fbaa52837a0d09f66ea | spockbot/mcp/nbt.py | python | _TagEnd._parse_buffer | (self, buffer) | [] | def _parse_buffer(self, buffer):
# Note: buffer.read() may raise an IOError, for example if buffer is a
# corrupt gzip.GzipFile
value = self.fmt.unpack(buffer.read(1))[0]
if value != 0:
raise ValueError(
"A Tag End must be rendered as '0', not as '%d'." % (val... | [
"def",
"_parse_buffer",
"(",
"self",
",",
"buffer",
")",
":",
"# Note: buffer.read() may raise an IOError, for example if buffer is a",
"# corrupt gzip.GzipFile",
"value",
"=",
"self",
".",
"fmt",
".",
"unpack",
"(",
"buffer",
".",
"read",
"(",
"1",
")",
")",
"[",
... | https://github.com/SpockBotMC/SpockBot/blob/f89911551f18357720034fbaa52837a0d09f66ea/spockbot/mcp/nbt.py#L114-L120 | ||||
lixinsu/RCZoo | 37fcb7962fbd4c751c561d4a0c84173881ea8339 | reader/bert/modeling.py | python | BertConfig.to_json_string | (self) | return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | Serializes this instance to a JSON string. | Serializes this instance to a JSON string. | [
"Serializes",
"this",
"instance",
"to",
"a",
"JSON",
"string",
"."
] | def to_json_string(self):
"""Serializes this instance to a JSON string."""
return json.dumps(self.to_dict(), indent=2, sort_keys=True) + "\n" | [
"def",
"to_json_string",
"(",
"self",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"self",
".",
"to_dict",
"(",
")",
",",
"indent",
"=",
"2",
",",
"sort_keys",
"=",
"True",
")",
"+",
"\"\\n\""
] | https://github.com/lixinsu/RCZoo/blob/37fcb7962fbd4c751c561d4a0c84173881ea8339/reader/bert/modeling.py#L222-L224 | |
pyjs/pyjs | 6c4a3d3a67300cd5df7f95a67ca9dcdc06950523 | pyjs/pyv8/linker.py | python | PyV8Linker.merge_resources | (self, dir_name) | find the absolute paths of js includes | find the absolute paths of js includes | [
"find",
"the",
"absolute",
"paths",
"of",
"js",
"includes"
] | def merge_resources(self, dir_name):
"""find the absolute paths of js includes"""
if not self.js_libs or dir_name in self.merged_public:
return
public_folder = os.path.join(dir_name, 'public')
if not os.path.isdir(public_folder):
return
for i, js_lib in en... | [
"def",
"merge_resources",
"(",
"self",
",",
"dir_name",
")",
":",
"if",
"not",
"self",
".",
"js_libs",
"or",
"dir_name",
"in",
"self",
".",
"merged_public",
":",
"return",
"public_folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dir_name",
",",
"'publ... | https://github.com/pyjs/pyjs/blob/6c4a3d3a67300cd5df7f95a67ca9dcdc06950523/pyjs/pyv8/linker.py#L115-L125 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/crystals/infinity_crystals.py | python | InfinityCrystalOfTableaux.__init__ | (self, cartan_type) | Initialize ``self``.
EXAMPLES::
sage: B = crystals.infinity.Tableaux(['A',2])
sage: TestSuite(B).run() # long time | Initialize ``self``. | [
"Initialize",
"self",
"."
] | def __init__(self, cartan_type):
"""
Initialize ``self``.
EXAMPLES::
sage: B = crystals.infinity.Tableaux(['A',2])
sage: TestSuite(B).run() # long time
"""
Parent.__init__(self, category=(HighestWeightCrystals(),
I... | [
"def",
"__init__",
"(",
"self",
",",
"cartan_type",
")",
":",
"Parent",
".",
"__init__",
"(",
"self",
",",
"category",
"=",
"(",
"HighestWeightCrystals",
"(",
")",
",",
"InfiniteEnumeratedSets",
"(",
")",
")",
")",
"self",
".",
"_cartan_type",
"=",
"cartan... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/crystals/infinity_crystals.py#L211-L224 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex/cv/nets/__init__.py | python | shufflenetv2 | (input, num_classes=1000) | return model(input) | [] | def shufflenetv2(input, num_classes=1000):
model = ShuffleNetV2(num_classes=num_classes)
return model(input) | [
"def",
"shufflenetv2",
"(",
"input",
",",
"num_classes",
"=",
"1000",
")",
":",
"model",
"=",
"ShuffleNetV2",
"(",
"num_classes",
"=",
"num_classes",
")",
"return",
"model",
"(",
"input",
")"
] | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex/cv/nets/__init__.py#L150-L152 | |||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/graphics/display_styles/DnaCylinderChunks.py | python | DnaCylinderChunks._get_nice_rainbow_color | (self, hue, saturation, value) | return colorsys.hsv_to_rgb(hue, saturation, value) | Gets a color of a hue limited to red-magenta range.
@param hue: color hue (0..1)
@type hue: float
@param saturation: color saturation (0..1)
@type saturation: float
@param value: color value (0..1)
@type value: float
@return: color for given (h,s,v) | Gets a color of a hue limited to red-magenta range. | [
"Gets",
"a",
"color",
"of",
"a",
"hue",
"limited",
"to",
"red",
"-",
"magenta",
"range",
"."
] | def _get_nice_rainbow_color(self, hue, saturation, value):
"""
Gets a color of a hue limited to red-magenta range.
@param hue: color hue (0..1)
@type hue: float
@param saturation: color saturation (0..1)
@type saturation: float
@param value: color value (0..1)
... | [
"def",
"_get_nice_rainbow_color",
"(",
"self",
",",
"hue",
",",
"saturation",
",",
"value",
")",
":",
"hue",
"*=",
"0.8",
"if",
"hue",
"<",
"0.0",
":",
"hue",
"=",
"0.0",
"if",
"hue",
">",
"1.0",
":",
"hue",
"=",
"1.0",
"return",
"colorsys",
".",
"... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/graphics/display_styles/DnaCylinderChunks.py#L431-L451 | |
eth-sri/debin | 9abb5215b54077da1e9479bfcbc56cd860aac370 | py/elftools/elf/gnuversions.py | python | VersionAuxiliary.__getitem__ | (self, name) | return self.entry[name] | Implement dict-like access to entries | Implement dict-like access to entries | [
"Implement",
"dict",
"-",
"like",
"access",
"to",
"entries"
] | def __getitem__(self, name):
""" Implement dict-like access to entries
"""
return self.entry[name] | [
"def",
"__getitem__",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"entry",
"[",
"name",
"]"
] | https://github.com/eth-sri/debin/blob/9abb5215b54077da1e9479bfcbc56cd860aac370/py/elftools/elf/gnuversions.py#L48-L51 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/distlib/locators.py | python | SimpleScrapingLocator._wait_threads | (self) | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so. | [
"Tell",
"all",
"the",
"threads",
"to",
"terminate",
"(",
"by",
"sending",
"a",
"sentinel",
"value",
")",
"and",
"wait",
"for",
"them",
"to",
"do",
"so",
"."
] | def _wait_threads(self):
"""
Tell all the threads to terminate (by sending a sentinel value) and
wait for them to do so.
"""
# Note that you need two loops, since you can't say which
# thread will get each sentinel
for t in self._threads:
self._to_fetc... | [
"def",
"_wait_threads",
"(",
"self",
")",
":",
"# Note that you need two loops, since you can't say which",
"# thread will get each sentinel",
"for",
"t",
"in",
"self",
".",
"_threads",
":",
"self",
".",
"_to_fetch",
".",
"put",
"(",
"None",
")",
"# sentinel",
"for",
... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/distlib/locators.py#L640-L651 | ||
hhursev/recipe-scrapers | 478b9ddb0dda02b17b14f299eea729bef8131aa9 | recipe_scrapers/onehundredonecookbooks.py | python | OneHundredOneCookBooks.title | (self) | return self.soup.find("h1").get_text() | [] | def title(self):
return self.soup.find("h1").get_text() | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"self",
".",
"soup",
".",
"find",
"(",
"\"h1\"",
")",
".",
"get_text",
"(",
")"
] | https://github.com/hhursev/recipe-scrapers/blob/478b9ddb0dda02b17b14f299eea729bef8131aa9/recipe_scrapers/onehundredonecookbooks.py#L18-L19 | |||
aertslab/pySCENIC | c66455cdc0d736d67963b218a8ebce61dc4eef82 | src/pyscenic/regions.py | python | df2regulons | (
df: pd.DataFrame,
gene_regulons: Sequence[Regulon],
db: RegionRankingDatabase,
delineations: Iterator[Delineation] = Delineation,
) | Create gene-based regulons from a dataframe of enriched motifs. | Create gene-based regulons from a dataframe of enriched motifs. | [
"Create",
"gene",
"-",
"based",
"regulons",
"from",
"a",
"dataframe",
"of",
"enriched",
"motifs",
"."
] | def df2regulons(
df: pd.DataFrame,
gene_regulons: Sequence[Regulon],
db: RegionRankingDatabase,
delineations: Iterator[Delineation] = Delineation,
) -> Sequence[Regulon]:
"""
Create gene-based regulons from a dataframe of enriched motifs.
"""
# TODO: This method needs to be implemented ... | [
"def",
"df2regulons",
"(",
"df",
":",
"pd",
".",
"DataFrame",
",",
"gene_regulons",
":",
"Sequence",
"[",
"Regulon",
"]",
",",
"db",
":",
"RegionRankingDatabase",
",",
"delineations",
":",
"Iterator",
"[",
"Delineation",
"]",
"=",
"Delineation",
",",
")",
... | https://github.com/aertslab/pySCENIC/blob/c66455cdc0d736d67963b218a8ebce61dc4eef82/src/pyscenic/regions.py#L100-L133 | ||
openai/baselines | ea25b9e8b234e6ee1bca43083f8f3cf974143998 | baselines/common/misc_util.py | python | pickle_load | (path, compression=False) | Unpickle a possible compressed pickle.
Parameters
----------
path: str
path to the output file
compression: bool
if true assumes that pickle was compressed when created and attempts decompression.
Returns
-------
obj: object
the unpickled object | Unpickle a possible compressed pickle. | [
"Unpickle",
"a",
"possible",
"compressed",
"pickle",
"."
] | def pickle_load(path, compression=False):
"""Unpickle a possible compressed pickle.
Parameters
----------
path: str
path to the output file
compression: bool
if true assumes that pickle was compressed when created and attempts decompression.
Returns
-------
obj: object
... | [
"def",
"pickle_load",
"(",
"path",
",",
"compression",
"=",
"False",
")",
":",
"if",
"compression",
":",
"with",
"zipfile",
".",
"ZipFile",
"(",
"path",
",",
"\"r\"",
",",
"compression",
"=",
"zipfile",
".",
"ZIP_DEFLATED",
")",
"as",
"myzip",
":",
"with... | https://github.com/openai/baselines/blob/ea25b9e8b234e6ee1bca43083f8f3cf974143998/baselines/common/misc_util.py#L221-L243 | ||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/webpage/webpage/gui/guicontroller.py | python | GuiController._addOtherTools | (self) | Добавить остальные инструменты | Добавить остальные инструменты | [
"Добавить",
"остальные",
"инструменты"
] | def _addOtherTools(self):
"""
Добавить остальные инструменты
"""
toolbar = self._application.mainWindow.toolbars[TOOLBAR_WEBPAGE]
menu = self._menu
# Вставить картинку
self._application.actionController.getAction(IMAGE_STR_ID).setFunc(
lambda param: s... | [
"def",
"_addOtherTools",
"(",
"self",
")",
":",
"toolbar",
"=",
"self",
".",
"_application",
".",
"mainWindow",
".",
"toolbars",
"[",
"TOOLBAR_WEBPAGE",
"]",
"menu",
"=",
"self",
".",
"_menu",
"# Вставить картинку",
"self",
".",
"_application",
".",
"actionCon... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/webpage/webpage/gui/guicontroller.py#L639-L723 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/interfaces.py | python | IInterface.__contains__ | (name) | Test whether the name is defined by the interface | Test whether the name is defined by the interface | [
"Test",
"whether",
"the",
"name",
"is",
"defined",
"by",
"the",
"interface"
] | def __contains__(name):
"""Test whether the name is defined by the interface""" | [
"def",
"__contains__",
"(",
"name",
")",
":"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/zope.interface-4.5.0/src/zope/interface/interfaces.py#L291-L292 | ||
facebookresearch/SpanBERT | 0670d8b6a38f6714b85ea7a033f16bd8cc162676 | pretraining/fairseq/models/fairseq_decoder.py | python | FairseqDecoder.get_normalized_probs | (self, net_output, log_probs, sample) | Get normalized probabilities (or log probs) from a net's output. | Get normalized probabilities (or log probs) from a net's output. | [
"Get",
"normalized",
"probabilities",
"(",
"or",
"log",
"probs",
")",
"from",
"a",
"net",
"s",
"output",
"."
] | def get_normalized_probs(self, net_output, log_probs, sample):
"""Get normalized probabilities (or log probs) from a net's output."""
if hasattr(self, 'adaptive_softmax') and self.adaptive_softmax is not None:
assert sample is not None and 'target' in sample
out = self.adaptive_... | [
"def",
"get_normalized_probs",
"(",
"self",
",",
"net_output",
",",
"log_probs",
",",
"sample",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'adaptive_softmax'",
")",
"and",
"self",
".",
"adaptive_softmax",
"is",
"not",
"None",
":",
"assert",
"sample",
"is"... | https://github.com/facebookresearch/SpanBERT/blob/0670d8b6a38f6714b85ea7a033f16bd8cc162676/pretraining/fairseq/models/fairseq_decoder.py#L36-L48 | ||
pyudev/pyudev | d5630bf15692b652db55d626f66274169f3448d5 | src/pyudev/discover.py | python | DeviceNameHypothesis.match | (cls, value) | return value | Match ``value`` under the assumption that it is a device name.
:returns: the device path or None
:rtype: str or NoneType | Match ``value`` under the assumption that it is a device name. | [
"Match",
"value",
"under",
"the",
"assumption",
"that",
"it",
"is",
"a",
"device",
"name",
"."
] | def match(cls, value):
"""
Match ``value`` under the assumption that it is a device name.
:returns: the device path or None
:rtype: str or NoneType
"""
return value | [
"def",
"match",
"(",
"cls",
",",
"value",
")",
":",
"return",
"value"
] | https://github.com/pyudev/pyudev/blob/d5630bf15692b652db55d626f66274169f3448d5/src/pyudev/discover.py#L249-L256 | |
clips/pattern | d25511f9ca7ed9356b801d8663b8b5168464e68f | pattern/vector/__init__.py | python | sigmoid_derivative | (y) | return 1.0 - y * y | Backward propagation activation function derivative. | Backward propagation activation function derivative. | [
"Backward",
"propagation",
"activation",
"function",
"derivative",
"."
] | def sigmoid_derivative(y):
""" Backward propagation activation function derivative.
"""
#return y * (1.0 - y)
return 1.0 - y * y | [
"def",
"sigmoid_derivative",
"(",
"y",
")",
":",
"#return y * (1.0 - y)",
"return",
"1.0",
"-",
"y",
"*",
"y"
] | https://github.com/clips/pattern/blob/d25511f9ca7ed9356b801d8663b8b5168464e68f/pattern/vector/__init__.py#L3162-L3166 | |
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.py | python | positive_int_list | (argument) | return [positive_int(entry) for entry in entries] | Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.)
Raises ValueError for non-positive-integer values. | Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.) | [
"Converts",
"a",
"space",
"-",
"or",
"comma",
"-",
"separated",
"list",
"of",
"values",
"into",
"a",
"Python",
"list",
"of",
"integers",
".",
"(",
"Directive",
"option",
"conversion",
"function",
".",
")"
] | def positive_int_list(argument):
"""
Converts a space- or comma-separated list of values into a Python list
of integers.
(Directive option conversion function.)
Raises ValueError for non-positive-integer values.
"""
if ',' in argument:
entries = argument.split(',')
else:
... | [
"def",
"positive_int_list",
"(",
"argument",
")",
":",
"if",
"','",
"in",
"argument",
":",
"entries",
"=",
"argument",
".",
"split",
"(",
"','",
")",
"else",
":",
"entries",
"=",
"argument",
".",
"split",
"(",
")",
"return",
"[",
"positive_int",
"(",
"... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/docutils/parsers/rst/directives/__init__.py#L346-L358 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.