id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
10,100 | diging/tethne | tethne/serialize/paper.py | Serialize.serializeInstitution | def serializeInstitution(self):
"""
This method creates a fixture for the "django-tethne_citation_institution" model.
Returns
-------
institution details which can be written to a file
"""
institution_data = []
institution_instance_data = []
affi... | python | def serializeInstitution(self):
"""
This method creates a fixture for the "django-tethne_citation_institution" model.
Returns
-------
institution details which can be written to a file
"""
institution_data = []
institution_instance_data = []
affi... | [
"def",
"serializeInstitution",
"(",
"self",
")",
":",
"institution_data",
"=",
"[",
"]",
"institution_instance_data",
"=",
"[",
"]",
"affiliation_data",
"=",
"[",
"]",
"affiliation_id",
"=",
"tethnedao",
".",
"getMaxAffiliationID",
"(",
")",
"institution_id",
"=",... | This method creates a fixture for the "django-tethne_citation_institution" model.
Returns
-------
institution details which can be written to a file | [
"This",
"method",
"creates",
"a",
"fixture",
"for",
"the",
"django",
"-",
"tethne_citation_institution",
"model",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/serialize/paper.py#L289-L344 |
10,101 | diging/tethne | tethne/serialize/paper.py | Serialize.get_details_from_inst_literal | def get_details_from_inst_literal(self, institute_literal, institution_id, institution_instance_id, paper_key):
"""
This method parses the institute literal to get the following
1. Department naame
2. Country
3. University name
4. ZIP, STATE AND CITY (Only if the country ... | python | def get_details_from_inst_literal(self, institute_literal, institution_id, institution_instance_id, paper_key):
"""
This method parses the institute literal to get the following
1. Department naame
2. Country
3. University name
4. ZIP, STATE AND CITY (Only if the country ... | [
"def",
"get_details_from_inst_literal",
"(",
"self",
",",
"institute_literal",
",",
"institution_id",
",",
"institution_instance_id",
",",
"paper_key",
")",
":",
"institute_details",
"=",
"institute_literal",
".",
"split",
"(",
"','",
")",
"institute_name",
"=",
"inst... | This method parses the institute literal to get the following
1. Department naame
2. Country
3. University name
4. ZIP, STATE AND CITY (Only if the country is USA. For other countries the standard may vary. So parsing these
values becomes very difficult. However, the complete add... | [
"This",
"method",
"parses",
"the",
"institute",
"literal",
"to",
"get",
"the",
"following",
"1",
".",
"Department",
"naame",
"2",
".",
"Country",
"3",
".",
"University",
"name",
"4",
".",
"ZIP",
"STATE",
"AND",
"CITY",
"(",
"Only",
"if",
"the",
"country"... | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/serialize/paper.py#L346-L424 |
10,102 | diging/tethne | tethne/serialize/paper.py | Serialize.get_affiliation_details | def get_affiliation_details(self, value, affiliation_id, institute_literal):
"""
This method is used to map the Affiliation between an author and Institution.
Parameters
----------
value - The author name
affiliation_id - Primary key of the affiliation table
inst... | python | def get_affiliation_details(self, value, affiliation_id, institute_literal):
"""
This method is used to map the Affiliation between an author and Institution.
Parameters
----------
value - The author name
affiliation_id - Primary key of the affiliation table
inst... | [
"def",
"get_affiliation_details",
"(",
"self",
",",
"value",
",",
"affiliation_id",
",",
"institute_literal",
")",
":",
"tokens",
"=",
"tuple",
"(",
"[",
"t",
".",
"upper",
"(",
")",
".",
"strip",
"(",
")",
"for",
"t",
"in",
"value",
".",
"split",
"(",... | This method is used to map the Affiliation between an author and Institution.
Parameters
----------
value - The author name
affiliation_id - Primary key of the affiliation table
institute_literal
Returns
-------
Affiliation details(JSON fixture) which ca... | [
"This",
"method",
"is",
"used",
"to",
"map",
"the",
"Affiliation",
"between",
"an",
"author",
"and",
"Institution",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/serialize/paper.py#L426-L464 |
10,103 | diging/tethne | tethne/readers/base.py | IterParser.start | def start(self):
"""
Find the first data entry and prepare to parse.
"""
while not self.is_start(self.current_tag):
self.next()
self.new_entry() | python | def start(self):
"""
Find the first data entry and prepare to parse.
"""
while not self.is_start(self.current_tag):
self.next()
self.new_entry() | [
"def",
"start",
"(",
"self",
")",
":",
"while",
"not",
"self",
".",
"is_start",
"(",
"self",
".",
"current_tag",
")",
":",
"self",
".",
"next",
"(",
")",
"self",
".",
"new_entry",
"(",
")"
] | Find the first data entry and prepare to parse. | [
"Find",
"the",
"first",
"data",
"entry",
"and",
"prepare",
"to",
"parse",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/base.py#L129-L136 |
10,104 | diging/tethne | tethne/readers/base.py | IterParser.handle | def handle(self, tag, data):
"""
Process a single line of data, and store the result.
Parameters
----------
tag : str
data :
"""
if self.is_end(tag):
self.postprocess_entry()
if self.is_start(tag):
self.new_entry()
... | python | def handle(self, tag, data):
"""
Process a single line of data, and store the result.
Parameters
----------
tag : str
data :
"""
if self.is_end(tag):
self.postprocess_entry()
if self.is_start(tag):
self.new_entry()
... | [
"def",
"handle",
"(",
"self",
",",
"tag",
",",
"data",
")",
":",
"if",
"self",
".",
"is_end",
"(",
"tag",
")",
":",
"self",
".",
"postprocess_entry",
"(",
")",
"if",
"self",
".",
"is_start",
"(",
"tag",
")",
":",
"self",
".",
"new_entry",
"(",
")... | Process a single line of data, and store the result.
Parameters
----------
tag : str
data : | [
"Process",
"a",
"single",
"line",
"of",
"data",
"and",
"store",
"the",
"result",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/base.py#L138-L183 |
10,105 | diging/tethne | tethne/readers/base.py | FTParser.open | def open(self):
"""
Open the data file.
"""
if not os.path.exists(self.path):
raise IOError("No such path: {0}".format(self.path))
with open(self.path, "rb") as f:
msg = f.read()
result = chardet.detect(msg)
self.buffer = codecs.open(se... | python | def open(self):
"""
Open the data file.
"""
if not os.path.exists(self.path):
raise IOError("No such path: {0}".format(self.path))
with open(self.path, "rb") as f:
msg = f.read()
result = chardet.detect(msg)
self.buffer = codecs.open(se... | [
"def",
"open",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"raise",
"IOError",
"(",
"\"No such path: {0}\"",
".",
"format",
"(",
"self",
".",
"path",
")",
")",
"with",
"open",
"(",
"self... | Open the data file. | [
"Open",
"the",
"data",
"file",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/base.py#L206-L221 |
10,106 | diging/tethne | tethne/readers/base.py | FTParser.next | def next(self):
"""
Get the next line of data.
Returns
-------
tag : str
data :
"""
line = self.buffer.readline()
while line == '\n': # Skip forward to the next line with content.
line = self.buffer.readline()
if line =... | python | def next(self):
"""
Get the next line of data.
Returns
-------
tag : str
data :
"""
line = self.buffer.readline()
while line == '\n': # Skip forward to the next line with content.
line = self.buffer.readline()
if line =... | [
"def",
"next",
"(",
"self",
")",
":",
"line",
"=",
"self",
".",
"buffer",
".",
"readline",
"(",
")",
"while",
"line",
"==",
"'\\n'",
":",
"# Skip forward to the next line with content.",
"line",
"=",
"self",
".",
"buffer",
".",
"readline",
"(",
")",
"if",
... | Get the next line of data.
Returns
-------
tag : str
data : | [
"Get",
"the",
"next",
"line",
"of",
"data",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/base.py#L223-L247 |
10,107 | diging/tethne | tethne/networks/authors.py | coauthors | def coauthors(corpus, min_weight=1, edge_attrs=['ayjid', 'date'], **kwargs):
"""
A graph describing joint authorship in ``corpus``.
"""
return cooccurrence(corpus, 'authors', min_weight=min_weight,
edge_attrs=edge_attrs, **kwargs) | python | def coauthors(corpus, min_weight=1, edge_attrs=['ayjid', 'date'], **kwargs):
"""
A graph describing joint authorship in ``corpus``.
"""
return cooccurrence(corpus, 'authors', min_weight=min_weight,
edge_attrs=edge_attrs, **kwargs) | [
"def",
"coauthors",
"(",
"corpus",
",",
"min_weight",
"=",
"1",
",",
"edge_attrs",
"=",
"[",
"'ayjid'",
",",
"'date'",
"]",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"cooccurrence",
"(",
"corpus",
",",
"'authors'",
",",
"min_weight",
"=",
"min_weight"... | A graph describing joint authorship in ``corpus``. | [
"A",
"graph",
"describing",
"joint",
"authorship",
"in",
"corpus",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/networks/authors.py#L22-L27 |
10,108 | diging/tethne | tethne/readers/zotero.py | extract_text | def extract_text(fpath):
"""
Extracts structured text content from a plain-text file at ``fpath``.
Parameters
----------
fpath : str
Path to the text file..
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains sentence context.
"""... | python | def extract_text(fpath):
"""
Extracts structured text content from a plain-text file at ``fpath``.
Parameters
----------
fpath : str
Path to the text file..
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains sentence context.
"""... | [
"def",
"extract_text",
"(",
"fpath",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"fpath",
",",
"'r'",
")",
"as",
"f",
":",
"# Determine the encoding of the file.",
"document",
"=",
"f",
".",
"read",
"(",
")",
"encoding",
"=",
"chardet",
".",
"detect",
... | Extracts structured text content from a plain-text file at ``fpath``.
Parameters
----------
fpath : str
Path to the text file..
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains sentence context. | [
"Extracts",
"structured",
"text",
"content",
"from",
"a",
"plain",
"-",
"text",
"file",
"at",
"fpath",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/zotero.py#L86-L117 |
10,109 | diging/tethne | tethne/readers/zotero.py | extract_pdf | def extract_pdf(fpath):
"""
Extracts structured text content from a PDF at ``fpath``.
Parameters
----------
fpath : str
Path to the PDF.
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains page and sentence contexts.
"""
with... | python | def extract_pdf(fpath):
"""
Extracts structured text content from a PDF at ``fpath``.
Parameters
----------
fpath : str
Path to the PDF.
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains page and sentence contexts.
"""
with... | [
"def",
"extract_pdf",
"(",
"fpath",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"fpath",
",",
"'r'",
")",
"as",
"f",
":",
"# Determine the encoding of the file.",
"document",
"=",
"slate",
".",
"PDF",
"(",
"f",
")",
"encoding",
"=",
"chardet",
".",
"de... | Extracts structured text content from a PDF at ``fpath``.
Parameters
----------
fpath : str
Path to the PDF.
Returns
-------
:class:`.StructuredFeature`
A :class:`.StructuredFeature` that contains page and sentence contexts. | [
"Extracts",
"structured",
"text",
"content",
"from",
"a",
"PDF",
"at",
"fpath",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/zotero.py#L120-L167 |
10,110 | diging/tethne | tethne/readers/zotero.py | read | def read(path, corpus=True, index_by='uri', follow_links=False, **kwargs):
"""
Read bibliographic data from Zotero RDF.
Examples
--------
Assuming that the Zotero collection was exported to the directory
``/my/working/dir`` with the name ``myCollection``, a subdirectory should
have been cre... | python | def read(path, corpus=True, index_by='uri', follow_links=False, **kwargs):
"""
Read bibliographic data from Zotero RDF.
Examples
--------
Assuming that the Zotero collection was exported to the directory
``/my/working/dir`` with the name ``myCollection``, a subdirectory should
have been cre... | [
"def",
"read",
"(",
"path",
",",
"corpus",
"=",
"True",
",",
"index_by",
"=",
"'uri'",
",",
"follow_links",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: is there a case where `from_dir` would make sense?",
"parser",
"=",
"ZoteroParser",
"(",
"path",... | Read bibliographic data from Zotero RDF.
Examples
--------
Assuming that the Zotero collection was exported to the directory
``/my/working/dir`` with the name ``myCollection``, a subdirectory should
have been created at ``/my/working/dir/myCollection``, and an RDF file
should exist at ``/my/wor... | [
"Read",
"bibliographic",
"data",
"from",
"Zotero",
"RDF",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/zotero.py#L391-L446 |
10,111 | diging/tethne | tethne/readers/zotero.py | ZoteroParser.handle_date | def handle_date(self, value):
"""
Attempt to coerced date to ISO8601.
"""
try:
return iso8601.parse_date(unicode(value)).year
except iso8601.ParseError:
for datefmt in ("%B %d, %Y", "%Y-%m", "%Y-%m-%d", "%m/%d/%Y"):
try:
... | python | def handle_date(self, value):
"""
Attempt to coerced date to ISO8601.
"""
try:
return iso8601.parse_date(unicode(value)).year
except iso8601.ParseError:
for datefmt in ("%B %d, %Y", "%Y-%m", "%Y-%m-%d", "%m/%d/%Y"):
try:
... | [
"def",
"handle_date",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"return",
"iso8601",
".",
"parse_date",
"(",
"unicode",
"(",
"value",
")",
")",
".",
"year",
"except",
"iso8601",
".",
"ParseError",
":",
"for",
"datefmt",
"in",
"(",
"\"%B %d, %Y\"",... | Attempt to coerced date to ISO8601. | [
"Attempt",
"to",
"coerced",
"date",
"to",
"ISO8601",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/zotero.py#L242-L254 |
10,112 | diging/tethne | tethne/readers/zotero.py | ZoteroParser.postprocess_link | def postprocess_link(self, entry):
"""
Attempt to load full-text content from resource.
"""
if not self.follow_links:
return
if type(entry.link) is not list:
entry.link = [entry.link]
for link in list(entry.link):
if not os.path.exis... | python | def postprocess_link(self, entry):
"""
Attempt to load full-text content from resource.
"""
if not self.follow_links:
return
if type(entry.link) is not list:
entry.link = [entry.link]
for link in list(entry.link):
if not os.path.exis... | [
"def",
"postprocess_link",
"(",
"self",
",",
"entry",
")",
":",
"if",
"not",
"self",
".",
"follow_links",
":",
"return",
"if",
"type",
"(",
"entry",
".",
"link",
")",
"is",
"not",
"list",
":",
"entry",
".",
"link",
"=",
"[",
"entry",
".",
"link",
"... | Attempt to load full-text content from resource. | [
"Attempt",
"to",
"load",
"full",
"-",
"text",
"content",
"from",
"resource",
"."
] | ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f | https://github.com/diging/tethne/blob/ba10eeb264b7a3f2dbcce71cfd5cb2d6bbf7055f/tethne/readers/zotero.py#L351-L388 |
10,113 | web-push-libs/pywebpush | pywebpush/__init__.py | webpush | def webpush(subscription_info,
data=None,
vapid_private_key=None,
vapid_claims=None,
content_encoding="aes128gcm",
curl=False,
timeout=None,
ttl=0):
"""
One call solution to endcode and send `data` to the endpoint
co... | python | def webpush(subscription_info,
data=None,
vapid_private_key=None,
vapid_claims=None,
content_encoding="aes128gcm",
curl=False,
timeout=None,
ttl=0):
"""
One call solution to endcode and send `data` to the endpoint
co... | [
"def",
"webpush",
"(",
"subscription_info",
",",
"data",
"=",
"None",
",",
"vapid_private_key",
"=",
"None",
",",
"vapid_claims",
"=",
"None",
",",
"content_encoding",
"=",
"\"aes128gcm\"",
",",
"curl",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"ttl",
... | One call solution to endcode and send `data` to the endpoint
contained in `subscription_info` using optional VAPID auth headers.
in example:
.. code-block:: python
from pywebpush import python
webpush(
subscription_info={
"endpoint": "https://push.... | [
"One",
"call",
"solution",
"to",
"endcode",
"and",
"send",
"data",
"to",
"the",
"endpoint",
"contained",
"in",
"subscription_info",
"using",
"optional",
"VAPID",
"auth",
"headers",
"."
] | 2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4 | https://github.com/web-push-libs/pywebpush/blob/2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4/pywebpush/__init__.py#L350-L435 |
10,114 | web-push-libs/pywebpush | pywebpush/__init__.py | WebPusher.encode | def encode(self, data, content_encoding="aes128gcm"):
"""Encrypt the data.
:param data: A serialized block of byte data (String, JSON, bit array,
etc.) Make sure that whatever you send, your client knows how
to understand it.
:type data: str
:param content_encodi... | python | def encode(self, data, content_encoding="aes128gcm"):
"""Encrypt the data.
:param data: A serialized block of byte data (String, JSON, bit array,
etc.) Make sure that whatever you send, your client knows how
to understand it.
:type data: str
:param content_encodi... | [
"def",
"encode",
"(",
"self",
",",
"data",
",",
"content_encoding",
"=",
"\"aes128gcm\"",
")",
":",
"# Salt is a random 16 byte array.",
"if",
"not",
"data",
":",
"return",
"if",
"not",
"self",
".",
"auth_key",
"or",
"not",
"self",
".",
"receiver_key",
":",
... | Encrypt the data.
:param data: A serialized block of byte data (String, JSON, bit array,
etc.) Make sure that whatever you send, your client knows how
to understand it.
:type data: str
:param content_encoding: The content_encoding type to use to encrypt
the d... | [
"Encrypt",
"the",
"data",
"."
] | 2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4 | https://github.com/web-push-libs/pywebpush/blob/2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4/pywebpush/__init__.py#L162-L224 |
10,115 | web-push-libs/pywebpush | pywebpush/__init__.py | WebPusher.send | def send(self, data=None, headers=None, ttl=0, gcm_key=None, reg_id=None,
content_encoding="aes128gcm", curl=False, timeout=None):
"""Encode and send the data to the Push Service.
:param data: A serialized block of data (see encode() ).
:type data: str
:param headers: A dic... | python | def send(self, data=None, headers=None, ttl=0, gcm_key=None, reg_id=None,
content_encoding="aes128gcm", curl=False, timeout=None):
"""Encode and send the data to the Push Service.
:param data: A serialized block of data (see encode() ).
:type data: str
:param headers: A dic... | [
"def",
"send",
"(",
"self",
",",
"data",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"ttl",
"=",
"0",
",",
"gcm_key",
"=",
"None",
",",
"reg_id",
"=",
"None",
",",
"content_encoding",
"=",
"\"aes128gcm\"",
",",
"curl",
"=",
"False",
",",
"timeout"... | Encode and send the data to the Push Service.
:param data: A serialized block of data (see encode() ).
:type data: str
:param headers: A dictionary containing any additional HTTP headers.
:type headers: dict
:param ttl: The Time To Live in seconds for this message if the
... | [
"Encode",
"and",
"send",
"the",
"data",
"to",
"the",
"Push",
"Service",
"."
] | 2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4 | https://github.com/web-push-libs/pywebpush/blob/2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4/pywebpush/__init__.py#L256-L347 |
10,116 | martijnvermaat/calmap | calmap/__init__.py | calendarplot | def calendarplot(data, how='sum', yearlabels=True, yearascending=True, yearlabel_kws=None,
subplot_kws=None, gridspec_kws=None, fig_kws=None, **kwargs):
"""
Plot a timeseries as a calendar heatmap.
Parameters
----------
data : Series
Data for the plot. Must be indexed by a ... | python | def calendarplot(data, how='sum', yearlabels=True, yearascending=True, yearlabel_kws=None,
subplot_kws=None, gridspec_kws=None, fig_kws=None, **kwargs):
"""
Plot a timeseries as a calendar heatmap.
Parameters
----------
data : Series
Data for the plot. Must be indexed by a ... | [
"def",
"calendarplot",
"(",
"data",
",",
"how",
"=",
"'sum'",
",",
"yearlabels",
"=",
"True",
",",
"yearascending",
"=",
"True",
",",
"yearlabel_kws",
"=",
"None",
",",
"subplot_kws",
"=",
"None",
",",
"gridspec_kws",
"=",
"None",
",",
"fig_kws",
"=",
"N... | Plot a timeseries as a calendar heatmap.
Parameters
----------
data : Series
Data for the plot. Must be indexed by a DatetimeIndex.
how : string
Method for resampling data by day. If `None`, assume data is already
sampled by day and don't resample. Otherwise, this is passed to P... | [
"Plot",
"a",
"timeseries",
"as",
"a",
"calendar",
"heatmap",
"."
] | 83e2a9a0bdc773c9e48e05772fb412ac8deb8bae | https://github.com/martijnvermaat/calmap/blob/83e2a9a0bdc773c9e48e05772fb412ac8deb8bae/calmap/__init__.py#L233-L329 |
10,117 | Frojd/wagtail-geo-widget | wagtailgeowidget/helpers.py | geosgeometry_str_to_struct | def geosgeometry_str_to_struct(value):
'''
Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0]
'''
result = geos_ptrn.match(value)
if not result:
return None
return {
'srid': result.group(1),
... | python | def geosgeometry_str_to_struct(value):
'''
Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0]
'''
result = geos_ptrn.match(value)
if not result:
return None
return {
'srid': result.group(1),
... | [
"def",
"geosgeometry_str_to_struct",
"(",
"value",
")",
":",
"result",
"=",
"geos_ptrn",
".",
"match",
"(",
"value",
")",
"if",
"not",
"result",
":",
"return",
"None",
"return",
"{",
"'srid'",
":",
"result",
".",
"group",
"(",
"1",
")",
",",
"'x'",
":"... | Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0] | [
"Parses",
"a",
"geosgeometry",
"string",
"into",
"struct",
"."
] | 3482891be8903293812738d9128b9bda03b9a2ba | https://github.com/Frojd/wagtail-geo-widget/blob/3482891be8903293812738d9128b9bda03b9a2ba/wagtailgeowidget/helpers.py#L8-L27 |
10,118 | Frojd/wagtail-geo-widget | example/examplesite/settings/__init__.py | get_env | def get_env(name, default=None):
"""Get the environment variable or return exception"""
if name in os.environ:
return os.environ[name]
if default is not None:
return default
error_msg = "Set the {} env variable".format(name)
raise ImproperlyConfigured(error_msg) | python | def get_env(name, default=None):
"""Get the environment variable or return exception"""
if name in os.environ:
return os.environ[name]
if default is not None:
return default
error_msg = "Set the {} env variable".format(name)
raise ImproperlyConfigured(error_msg) | [
"def",
"get_env",
"(",
"name",
",",
"default",
"=",
"None",
")",
":",
"if",
"name",
"in",
"os",
".",
"environ",
":",
"return",
"os",
".",
"environ",
"[",
"name",
"]",
"if",
"default",
"is",
"not",
"None",
":",
"return",
"default",
"error_msg",
"=",
... | Get the environment variable or return exception | [
"Get",
"the",
"environment",
"variable",
"or",
"return",
"exception"
] | 3482891be8903293812738d9128b9bda03b9a2ba | https://github.com/Frojd/wagtail-geo-widget/blob/3482891be8903293812738d9128b9bda03b9a2ba/example/examplesite/settings/__init__.py#L6-L15 |
10,119 | newville/asteval | asteval/asteval.py | Interpreter.user_defined_symbols | def user_defined_symbols(self):
"""Return a set of symbols that have been added to symtable after
construction.
I.e., the symbols from self.symtable that are not in
self.no_deepcopy.
Returns
-------
unique_symbols : set
symbols in symtable that are n... | python | def user_defined_symbols(self):
"""Return a set of symbols that have been added to symtable after
construction.
I.e., the symbols from self.symtable that are not in
self.no_deepcopy.
Returns
-------
unique_symbols : set
symbols in symtable that are n... | [
"def",
"user_defined_symbols",
"(",
"self",
")",
":",
"sym_in_current",
"=",
"set",
"(",
"self",
".",
"symtable",
".",
"keys",
"(",
")",
")",
"sym_from_construction",
"=",
"set",
"(",
"self",
".",
"no_deepcopy",
")",
"unique_symbols",
"=",
"sym_in_current",
... | Return a set of symbols that have been added to symtable after
construction.
I.e., the symbols from self.symtable that are not in
self.no_deepcopy.
Returns
-------
unique_symbols : set
symbols in symtable that are not in self.no_deepcopy | [
"Return",
"a",
"set",
"of",
"symbols",
"that",
"have",
"been",
"added",
"to",
"symtable",
"after",
"construction",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L216-L232 |
10,120 | newville/asteval | asteval/asteval.py | Interpreter.unimplemented | def unimplemented(self, node):
"""Unimplemented nodes."""
self.raise_exception(node, exc=NotImplementedError,
msg="'%s' not supported" %
(node.__class__.__name__)) | python | def unimplemented(self, node):
"""Unimplemented nodes."""
self.raise_exception(node, exc=NotImplementedError,
msg="'%s' not supported" %
(node.__class__.__name__)) | [
"def",
"unimplemented",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"raise_exception",
"(",
"node",
",",
"exc",
"=",
"NotImplementedError",
",",
"msg",
"=",
"\"'%s' not supported\"",
"%",
"(",
"node",
".",
"__class__",
".",
"__name__",
")",
")"
] | Unimplemented nodes. | [
"Unimplemented",
"nodes",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L234-L238 |
10,121 | newville/asteval | asteval/asteval.py | Interpreter.raise_exception | def raise_exception(self, node, exc=None, msg='', expr=None,
lineno=None):
"""Add an exception."""
if self.error is None:
self.error = []
if expr is None:
expr = self.expr
if len(self.error) > 0 and not isinstance(node, ast.Module):
... | python | def raise_exception(self, node, exc=None, msg='', expr=None,
lineno=None):
"""Add an exception."""
if self.error is None:
self.error = []
if expr is None:
expr = self.expr
if len(self.error) > 0 and not isinstance(node, ast.Module):
... | [
"def",
"raise_exception",
"(",
"self",
",",
"node",
",",
"exc",
"=",
"None",
",",
"msg",
"=",
"''",
",",
"expr",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"if",
"self",
".",
"error",
"is",
"None",
":",
"self",
".",
"error",
"=",
"[",
"... | Add an exception. | [
"Add",
"an",
"exception",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L240-L261 |
10,122 | newville/asteval | asteval/asteval.py | Interpreter.run | def run(self, node, expr=None, lineno=None, with_raise=True):
"""Execute parsed Ast representation for an expression."""
# Note: keep the 'node is None' test: internal code here may run
# run(None) and expect a None in return.
if time.time() - self.start_time > self.max_time:
... | python | def run(self, node, expr=None, lineno=None, with_raise=True):
"""Execute parsed Ast representation for an expression."""
# Note: keep the 'node is None' test: internal code here may run
# run(None) and expect a None in return.
if time.time() - self.start_time > self.max_time:
... | [
"def",
"run",
"(",
"self",
",",
"node",
",",
"expr",
"=",
"None",
",",
"lineno",
"=",
"None",
",",
"with_raise",
"=",
"True",
")",
":",
"# Note: keep the 'node is None' test: internal code here may run",
"# run(None) and expect a None in return.",
"if",
"time",
"."... | Execute parsed Ast representation for an expression. | [
"Execute",
"parsed",
"Ast",
"representation",
"for",
"an",
"expression",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L279-L313 |
10,123 | newville/asteval | asteval/asteval.py | Interpreter.eval | def eval(self, expr, lineno=0, show_errors=True):
"""Evaluate a single statement."""
self.lineno = lineno
self.error = []
self.start_time = time.time()
try:
node = self.parse(expr)
except:
errmsg = exc_info()[1]
if len(self.error) > 0:
... | python | def eval(self, expr, lineno=0, show_errors=True):
"""Evaluate a single statement."""
self.lineno = lineno
self.error = []
self.start_time = time.time()
try:
node = self.parse(expr)
except:
errmsg = exc_info()[1]
if len(self.error) > 0:
... | [
"def",
"eval",
"(",
"self",
",",
"expr",
",",
"lineno",
"=",
"0",
",",
"show_errors",
"=",
"True",
")",
":",
"self",
".",
"lineno",
"=",
"lineno",
"self",
".",
"error",
"=",
"[",
"]",
"self",
".",
"start_time",
"=",
"time",
".",
"time",
"(",
")",... | Evaluate a single statement. | [
"Evaluate",
"a",
"single",
"statement",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L319-L351 |
10,124 | newville/asteval | asteval/asteval.py | Interpreter.on_module | def on_module(self, node): # ():('body',)
"""Module def."""
out = None
for tnode in node.body:
out = self.run(tnode)
return out | python | def on_module(self, node): # ():('body',)
"""Module def."""
out = None
for tnode in node.body:
out = self.run(tnode)
return out | [
"def",
"on_module",
"(",
"self",
",",
"node",
")",
":",
"# ():('body',)",
"out",
"=",
"None",
"for",
"tnode",
"in",
"node",
".",
"body",
":",
"out",
"=",
"self",
".",
"run",
"(",
"tnode",
")",
"return",
"out"
] | Module def. | [
"Module",
"def",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L378-L383 |
10,125 | newville/asteval | asteval/asteval.py | Interpreter.on_assert | def on_assert(self, node): # ('test', 'msg')
"""Assert statement."""
if not self.run(node.test):
self.raise_exception(node, exc=AssertionError, msg=node.msg)
return True | python | def on_assert(self, node): # ('test', 'msg')
"""Assert statement."""
if not self.run(node.test):
self.raise_exception(node, exc=AssertionError, msg=node.msg)
return True | [
"def",
"on_assert",
"(",
"self",
",",
"node",
")",
":",
"# ('test', 'msg')",
"if",
"not",
"self",
".",
"run",
"(",
"node",
".",
"test",
")",
":",
"self",
".",
"raise_exception",
"(",
"node",
",",
"exc",
"=",
"AssertionError",
",",
"msg",
"=",
"node",
... | Assert statement. | [
"Assert",
"statement",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L411-L415 |
10,126 | newville/asteval | asteval/asteval.py | Interpreter.on_name | def on_name(self, node): # ('id', 'ctx')
"""Name node."""
ctx = node.ctx.__class__
if ctx in (ast.Param, ast.Del):
return str(node.id)
else:
if node.id in self.symtable:
return self.symtable[node.id]
else:
msg = "name... | python | def on_name(self, node): # ('id', 'ctx')
"""Name node."""
ctx = node.ctx.__class__
if ctx in (ast.Param, ast.Del):
return str(node.id)
else:
if node.id in self.symtable:
return self.symtable[node.id]
else:
msg = "name... | [
"def",
"on_name",
"(",
"self",
",",
"node",
")",
":",
"# ('id', 'ctx')",
"ctx",
"=",
"node",
".",
"ctx",
".",
"__class__",
"if",
"ctx",
"in",
"(",
"ast",
".",
"Param",
",",
"ast",
".",
"Del",
")",
":",
"return",
"str",
"(",
"node",
".",
"id",
")"... | Name node. | [
"Name",
"node",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L442-L452 |
10,127 | newville/asteval | asteval/asteval.py | Interpreter.on_attribute | def on_attribute(self, node): # ('value', 'attr', 'ctx')
"""Extract attribute."""
ctx = node.ctx.__class__
if ctx == ast.Store:
msg = "attribute for storage: shouldn't be here!"
self.raise_exception(node, exc=RuntimeError, msg=msg)
sym = self.run(node.value)
... | python | def on_attribute(self, node): # ('value', 'attr', 'ctx')
"""Extract attribute."""
ctx = node.ctx.__class__
if ctx == ast.Store:
msg = "attribute for storage: shouldn't be here!"
self.raise_exception(node, exc=RuntimeError, msg=msg)
sym = self.run(node.value)
... | [
"def",
"on_attribute",
"(",
"self",
",",
"node",
")",
":",
"# ('value', 'attr', 'ctx')",
"ctx",
"=",
"node",
".",
"ctx",
".",
"__class__",
"if",
"ctx",
"==",
"ast",
".",
"Store",
":",
"msg",
"=",
"\"attribute for storage: shouldn't be here!\"",
"self",
".",
"r... | Extract attribute. | [
"Extract",
"attribute",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L496-L519 |
10,128 | newville/asteval | asteval/asteval.py | Interpreter.on_assign | def on_assign(self, node): # ('targets', 'value')
"""Simple assignment."""
val = self.run(node.value)
for tnode in node.targets:
self.node_assign(tnode, val)
return | python | def on_assign(self, node): # ('targets', 'value')
"""Simple assignment."""
val = self.run(node.value)
for tnode in node.targets:
self.node_assign(tnode, val)
return | [
"def",
"on_assign",
"(",
"self",
",",
"node",
")",
":",
"# ('targets', 'value')",
"val",
"=",
"self",
".",
"run",
"(",
"node",
".",
"value",
")",
"for",
"tnode",
"in",
"node",
".",
"targets",
":",
"self",
".",
"node_assign",
"(",
"tnode",
",",
"val",
... | Simple assignment. | [
"Simple",
"assignment",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L521-L526 |
10,129 | newville/asteval | asteval/asteval.py | Interpreter.on_augassign | def on_augassign(self, node): # ('target', 'op', 'value')
"""Augmented assign."""
return self.on_assign(ast.Assign(targets=[node.target],
value=ast.BinOp(left=node.target,
op=node.op,
... | python | def on_augassign(self, node): # ('target', 'op', 'value')
"""Augmented assign."""
return self.on_assign(ast.Assign(targets=[node.target],
value=ast.BinOp(left=node.target,
op=node.op,
... | [
"def",
"on_augassign",
"(",
"self",
",",
"node",
")",
":",
"# ('target', 'op', 'value')",
"return",
"self",
".",
"on_assign",
"(",
"ast",
".",
"Assign",
"(",
"targets",
"=",
"[",
"node",
".",
"target",
"]",
",",
"value",
"=",
"ast",
".",
"BinOp",
"(",
... | Augmented assign. | [
"Augmented",
"assign",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L528-L533 |
10,130 | newville/asteval | asteval/asteval.py | Interpreter.on_slice | def on_slice(self, node): # ():('lower', 'upper', 'step')
"""Simple slice."""
return slice(self.run(node.lower),
self.run(node.upper),
self.run(node.step)) | python | def on_slice(self, node): # ():('lower', 'upper', 'step')
"""Simple slice."""
return slice(self.run(node.lower),
self.run(node.upper),
self.run(node.step)) | [
"def",
"on_slice",
"(",
"self",
",",
"node",
")",
":",
"# ():('lower', 'upper', 'step')",
"return",
"slice",
"(",
"self",
".",
"run",
"(",
"node",
".",
"lower",
")",
",",
"self",
".",
"run",
"(",
"node",
".",
"upper",
")",
",",
"self",
".",
"run",
"(... | Simple slice. | [
"Simple",
"slice",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L535-L539 |
10,131 | newville/asteval | asteval/asteval.py | Interpreter.on_extslice | def on_extslice(self, node): # ():('dims',)
"""Extended slice."""
return tuple([self.run(tnode) for tnode in node.dims]) | python | def on_extslice(self, node): # ():('dims',)
"""Extended slice."""
return tuple([self.run(tnode) for tnode in node.dims]) | [
"def",
"on_extslice",
"(",
"self",
",",
"node",
")",
":",
"# ():('dims',)",
"return",
"tuple",
"(",
"[",
"self",
".",
"run",
"(",
"tnode",
")",
"for",
"tnode",
"in",
"node",
".",
"dims",
"]",
")"
] | Extended slice. | [
"Extended",
"slice",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L541-L543 |
10,132 | newville/asteval | asteval/asteval.py | Interpreter.on_delete | def on_delete(self, node): # ('targets',)
"""Delete statement."""
for tnode in node.targets:
if tnode.ctx.__class__ != ast.Del:
break
children = []
while tnode.__class__ == ast.Attribute:
children.append(tnode.attr)
t... | python | def on_delete(self, node): # ('targets',)
"""Delete statement."""
for tnode in node.targets:
if tnode.ctx.__class__ != ast.Del:
break
children = []
while tnode.__class__ == ast.Attribute:
children.append(tnode.attr)
t... | [
"def",
"on_delete",
"(",
"self",
",",
"node",
")",
":",
"# ('targets',)",
"for",
"tnode",
"in",
"node",
".",
"targets",
":",
"if",
"tnode",
".",
"ctx",
".",
"__class__",
"!=",
"ast",
".",
"Del",
":",
"break",
"children",
"=",
"[",
"]",
"while",
"tnod... | Delete statement. | [
"Delete",
"statement",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L559-L575 |
10,133 | newville/asteval | asteval/asteval.py | Interpreter.on_unaryop | def on_unaryop(self, node): # ('op', 'operand')
"""Unary operator."""
return op2func(node.op)(self.run(node.operand)) | python | def on_unaryop(self, node): # ('op', 'operand')
"""Unary operator."""
return op2func(node.op)(self.run(node.operand)) | [
"def",
"on_unaryop",
"(",
"self",
",",
"node",
")",
":",
"# ('op', 'operand')",
"return",
"op2func",
"(",
"node",
".",
"op",
")",
"(",
"self",
".",
"run",
"(",
"node",
".",
"operand",
")",
")"
] | Unary operator. | [
"Unary",
"operator",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L577-L579 |
10,134 | newville/asteval | asteval/asteval.py | Interpreter.on_binop | def on_binop(self, node): # ('left', 'op', 'right')
"""Binary operator."""
return op2func(node.op)(self.run(node.left),
self.run(node.right)) | python | def on_binop(self, node): # ('left', 'op', 'right')
"""Binary operator."""
return op2func(node.op)(self.run(node.left),
self.run(node.right)) | [
"def",
"on_binop",
"(",
"self",
",",
"node",
")",
":",
"# ('left', 'op', 'right')",
"return",
"op2func",
"(",
"node",
".",
"op",
")",
"(",
"self",
".",
"run",
"(",
"node",
".",
"left",
")",
",",
"self",
".",
"run",
"(",
"node",
".",
"right",
")",
"... | Binary operator. | [
"Binary",
"operator",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L581-L584 |
10,135 | newville/asteval | asteval/asteval.py | Interpreter.on_boolop | def on_boolop(self, node): # ('op', 'values')
"""Boolean operator."""
val = self.run(node.values[0])
is_and = ast.And == node.op.__class__
if (is_and and val) or (not is_and and not val):
for n in node.values[1:]:
val = op2func(node.op)(val, self.run(n))
... | python | def on_boolop(self, node): # ('op', 'values')
"""Boolean operator."""
val = self.run(node.values[0])
is_and = ast.And == node.op.__class__
if (is_and and val) or (not is_and and not val):
for n in node.values[1:]:
val = op2func(node.op)(val, self.run(n))
... | [
"def",
"on_boolop",
"(",
"self",
",",
"node",
")",
":",
"# ('op', 'values')",
"val",
"=",
"self",
".",
"run",
"(",
"node",
".",
"values",
"[",
"0",
"]",
")",
"is_and",
"=",
"ast",
".",
"And",
"==",
"node",
".",
"op",
".",
"__class__",
"if",
"(",
... | Boolean operator. | [
"Boolean",
"operator",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L586-L595 |
10,136 | newville/asteval | asteval/asteval.py | Interpreter._printer | def _printer(self, *out, **kws):
"""Generic print function."""
flush = kws.pop('flush', True)
fileh = kws.pop('file', self.writer)
sep = kws.pop('sep', ' ')
end = kws.pop('sep', '\n')
print(*out, file=fileh, sep=sep, end=end)
if flush:
fileh.flush() | python | def _printer(self, *out, **kws):
"""Generic print function."""
flush = kws.pop('flush', True)
fileh = kws.pop('file', self.writer)
sep = kws.pop('sep', ' ')
end = kws.pop('sep', '\n')
print(*out, file=fileh, sep=sep, end=end)
if flush:
fileh.flush() | [
"def",
"_printer",
"(",
"self",
",",
"*",
"out",
",",
"*",
"*",
"kws",
")",
":",
"flush",
"=",
"kws",
".",
"pop",
"(",
"'flush'",
",",
"True",
")",
"fileh",
"=",
"kws",
".",
"pop",
"(",
"'file'",
",",
"self",
".",
"writer",
")",
"sep",
"=",
"... | Generic print function. | [
"Generic",
"print",
"function",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L626-L635 |
10,137 | newville/asteval | asteval/asteval.py | Interpreter.on_if | def on_if(self, node): # ('test', 'body', 'orelse')
"""Regular if-then-else statement."""
block = node.body
if not self.run(node.test):
block = node.orelse
for tnode in block:
self.run(tnode) | python | def on_if(self, node): # ('test', 'body', 'orelse')
"""Regular if-then-else statement."""
block = node.body
if not self.run(node.test):
block = node.orelse
for tnode in block:
self.run(tnode) | [
"def",
"on_if",
"(",
"self",
",",
"node",
")",
":",
"# ('test', 'body', 'orelse')",
"block",
"=",
"node",
".",
"body",
"if",
"not",
"self",
".",
"run",
"(",
"node",
".",
"test",
")",
":",
"block",
"=",
"node",
".",
"orelse",
"for",
"tnode",
"in",
"bl... | Regular if-then-else statement. | [
"Regular",
"if",
"-",
"then",
"-",
"else",
"statement",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L637-L643 |
10,138 | newville/asteval | asteval/asteval.py | Interpreter.on_ifexp | def on_ifexp(self, node): # ('test', 'body', 'orelse')
"""If expressions."""
expr = node.orelse
if self.run(node.test):
expr = node.body
return self.run(expr) | python | def on_ifexp(self, node): # ('test', 'body', 'orelse')
"""If expressions."""
expr = node.orelse
if self.run(node.test):
expr = node.body
return self.run(expr) | [
"def",
"on_ifexp",
"(",
"self",
",",
"node",
")",
":",
"# ('test', 'body', 'orelse')",
"expr",
"=",
"node",
".",
"orelse",
"if",
"self",
".",
"run",
"(",
"node",
".",
"test",
")",
":",
"expr",
"=",
"node",
".",
"body",
"return",
"self",
".",
"run",
"... | If expressions. | [
"If",
"expressions",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L645-L650 |
10,139 | newville/asteval | asteval/asteval.py | Interpreter.on_while | def on_while(self, node): # ('test', 'body', 'orelse')
"""While blocks."""
while self.run(node.test):
self._interrupt = None
for tnode in node.body:
self.run(tnode)
if self._interrupt is not None:
break
if isinsta... | python | def on_while(self, node): # ('test', 'body', 'orelse')
"""While blocks."""
while self.run(node.test):
self._interrupt = None
for tnode in node.body:
self.run(tnode)
if self._interrupt is not None:
break
if isinsta... | [
"def",
"on_while",
"(",
"self",
",",
"node",
")",
":",
"# ('test', 'body', 'orelse')",
"while",
"self",
".",
"run",
"(",
"node",
".",
"test",
")",
":",
"self",
".",
"_interrupt",
"=",
"None",
"for",
"tnode",
"in",
"node",
".",
"body",
":",
"self",
".",... | While blocks. | [
"While",
"blocks",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L652-L665 |
10,140 | newville/asteval | asteval/asteval.py | Interpreter.on_for | def on_for(self, node): # ('target', 'iter', 'body', 'orelse')
"""For blocks."""
for val in self.run(node.iter):
self.node_assign(node.target, val)
self._interrupt = None
for tnode in node.body:
self.run(tnode)
if self._interrupt is ... | python | def on_for(self, node): # ('target', 'iter', 'body', 'orelse')
"""For blocks."""
for val in self.run(node.iter):
self.node_assign(node.target, val)
self._interrupt = None
for tnode in node.body:
self.run(tnode)
if self._interrupt is ... | [
"def",
"on_for",
"(",
"self",
",",
"node",
")",
":",
"# ('target', 'iter', 'body', 'orelse')",
"for",
"val",
"in",
"self",
".",
"run",
"(",
"node",
".",
"iter",
")",
":",
"self",
".",
"node_assign",
"(",
"node",
".",
"target",
",",
"val",
")",
"self",
... | For blocks. | [
"For",
"blocks",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L667-L681 |
10,141 | newville/asteval | asteval/asteval.py | Interpreter.on_listcomp | def on_listcomp(self, node): # ('elt', 'generators')
"""List comprehension."""
out = []
for tnode in node.generators:
if tnode.__class__ == ast.comprehension:
for val in self.run(tnode.iter):
self.node_assign(tnode.target, val)
... | python | def on_listcomp(self, node): # ('elt', 'generators')
"""List comprehension."""
out = []
for tnode in node.generators:
if tnode.__class__ == ast.comprehension:
for val in self.run(tnode.iter):
self.node_assign(tnode.target, val)
... | [
"def",
"on_listcomp",
"(",
"self",
",",
"node",
")",
":",
"# ('elt', 'generators')",
"out",
"=",
"[",
"]",
"for",
"tnode",
"in",
"node",
".",
"generators",
":",
"if",
"tnode",
".",
"__class__",
"==",
"ast",
".",
"comprehension",
":",
"for",
"val",
"in",
... | List comprehension. | [
"List",
"comprehension",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L683-L695 |
10,142 | newville/asteval | asteval/asteval.py | Interpreter.on_excepthandler | def on_excepthandler(self, node): # ('type', 'name', 'body')
"""Exception handler..."""
return (self.run(node.type), node.name, node.body) | python | def on_excepthandler(self, node): # ('type', 'name', 'body')
"""Exception handler..."""
return (self.run(node.type), node.name, node.body) | [
"def",
"on_excepthandler",
"(",
"self",
",",
"node",
")",
":",
"# ('type', 'name', 'body')",
"return",
"(",
"self",
".",
"run",
"(",
"node",
".",
"type",
")",
",",
"node",
".",
"name",
",",
"node",
".",
"body",
")"
] | Exception handler... | [
"Exception",
"handler",
"..."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L697-L699 |
10,143 | newville/asteval | asteval/asteval.py | Interpreter.on_call | def on_call(self, node):
"""Function execution."""
# ('func', 'args', 'keywords'. Py<3.5 has 'starargs' and 'kwargs' too)
func = self.run(node.func)
if not hasattr(func, '__call__') and not isinstance(func, type):
msg = "'%s' is not callable!!" % (func)
self.rais... | python | def on_call(self, node):
"""Function execution."""
# ('func', 'args', 'keywords'. Py<3.5 has 'starargs' and 'kwargs' too)
func = self.run(node.func)
if not hasattr(func, '__call__') and not isinstance(func, type):
msg = "'%s' is not callable!!" % (func)
self.rais... | [
"def",
"on_call",
"(",
"self",
",",
"node",
")",
":",
"# ('func', 'args', 'keywords'. Py<3.5 has 'starargs' and 'kwargs' too)",
"func",
"=",
"self",
".",
"run",
"(",
"node",
".",
"func",
")",
"if",
"not",
"hasattr",
"(",
"func",
",",
"'__call__'",
")",
"and",
... | Function execution. | [
"Function",
"execution",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L744-L776 |
10,144 | newville/asteval | asteval/asteval.py | Interpreter.on_functiondef | def on_functiondef(self, node):
"""Define procedures."""
# ('name', 'args', 'body', 'decorator_list')
if node.decorator_list:
raise Warning("decorated procedures not supported!")
kwargs = []
if not valid_symbol_name(node.name) or node.name in self.readonly_symbols:
... | python | def on_functiondef(self, node):
"""Define procedures."""
# ('name', 'args', 'body', 'decorator_list')
if node.decorator_list:
raise Warning("decorated procedures not supported!")
kwargs = []
if not valid_symbol_name(node.name) or node.name in self.readonly_symbols:
... | [
"def",
"on_functiondef",
"(",
"self",
",",
"node",
")",
":",
"# ('name', 'args', 'body', 'decorator_list')",
"if",
"node",
".",
"decorator_list",
":",
"raise",
"Warning",
"(",
"\"decorated procedures not supported!\"",
")",
"kwargs",
"=",
"[",
"]",
"if",
"not",
"val... | Define procedures. | [
"Define",
"procedures",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/asteval.py#L782-L823 |
10,145 | newville/asteval | asteval/astutils.py | safe_pow | def safe_pow(base, exp):
"""safe version of pow"""
if exp > MAX_EXPONENT:
raise RuntimeError("Invalid exponent, max exponent is {}".format(MAX_EXPONENT))
return base ** exp | python | def safe_pow(base, exp):
"""safe version of pow"""
if exp > MAX_EXPONENT:
raise RuntimeError("Invalid exponent, max exponent is {}".format(MAX_EXPONENT))
return base ** exp | [
"def",
"safe_pow",
"(",
"base",
",",
"exp",
")",
":",
"if",
"exp",
">",
"MAX_EXPONENT",
":",
"raise",
"RuntimeError",
"(",
"\"Invalid exponent, max exponent is {}\"",
".",
"format",
"(",
"MAX_EXPONENT",
")",
")",
"return",
"base",
"**",
"exp"
] | safe version of pow | [
"safe",
"version",
"of",
"pow"
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L183-L187 |
10,146 | newville/asteval | asteval/astutils.py | safe_mult | def safe_mult(a, b):
"""safe version of multiply"""
if isinstance(a, str) and isinstance(b, int) and len(a) * b > MAX_STR_LEN:
raise RuntimeError("String length exceeded, max string length is {}".format(MAX_STR_LEN))
return a * b | python | def safe_mult(a, b):
"""safe version of multiply"""
if isinstance(a, str) and isinstance(b, int) and len(a) * b > MAX_STR_LEN:
raise RuntimeError("String length exceeded, max string length is {}".format(MAX_STR_LEN))
return a * b | [
"def",
"safe_mult",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"str",
")",
"and",
"isinstance",
"(",
"b",
",",
"int",
")",
"and",
"len",
"(",
"a",
")",
"*",
"b",
">",
"MAX_STR_LEN",
":",
"raise",
"RuntimeError",
"(",
"\"Stri... | safe version of multiply | [
"safe",
"version",
"of",
"multiply"
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L190-L194 |
10,147 | newville/asteval | asteval/astutils.py | safe_add | def safe_add(a, b):
"""safe version of add"""
if isinstance(a, str) and isinstance(b, str) and len(a) + len(b) > MAX_STR_LEN:
raise RuntimeError("String length exceeded, max string length is {}".format(MAX_STR_LEN))
return a + b | python | def safe_add(a, b):
"""safe version of add"""
if isinstance(a, str) and isinstance(b, str) and len(a) + len(b) > MAX_STR_LEN:
raise RuntimeError("String length exceeded, max string length is {}".format(MAX_STR_LEN))
return a + b | [
"def",
"safe_add",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"str",
")",
"and",
"isinstance",
"(",
"b",
",",
"str",
")",
"and",
"len",
"(",
"a",
")",
"+",
"len",
"(",
"b",
")",
">",
"MAX_STR_LEN",
":",
"raise",
"RuntimeEr... | safe version of add | [
"safe",
"version",
"of",
"add"
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L197-L201 |
10,148 | newville/asteval | asteval/astutils.py | safe_lshift | def safe_lshift(a, b):
"""safe version of lshift"""
if b > MAX_SHIFT:
raise RuntimeError("Invalid left shift, max left shift is {}".format(MAX_SHIFT))
return a << b | python | def safe_lshift(a, b):
"""safe version of lshift"""
if b > MAX_SHIFT:
raise RuntimeError("Invalid left shift, max left shift is {}".format(MAX_SHIFT))
return a << b | [
"def",
"safe_lshift",
"(",
"a",
",",
"b",
")",
":",
"if",
"b",
">",
"MAX_SHIFT",
":",
"raise",
"RuntimeError",
"(",
"\"Invalid left shift, max left shift is {}\"",
".",
"format",
"(",
"MAX_SHIFT",
")",
")",
"return",
"a",
"<<",
"b"
] | safe version of lshift | [
"safe",
"version",
"of",
"lshift"
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L204-L208 |
10,149 | newville/asteval | asteval/astutils.py | valid_symbol_name | def valid_symbol_name(name):
"""Determine whether the input symbol name is a valid name.
Arguments
---------
name : str
name to check for validity.
Returns
--------
valid : bool
whether name is a a valid symbol name
This checks for Python reserved words and that... | python | def valid_symbol_name(name):
"""Determine whether the input symbol name is a valid name.
Arguments
---------
name : str
name to check for validity.
Returns
--------
valid : bool
whether name is a a valid symbol name
This checks for Python reserved words and that... | [
"def",
"valid_symbol_name",
"(",
"name",
")",
":",
"if",
"name",
"in",
"RESERVED_WORDS",
":",
"return",
"False",
"gen",
"=",
"generate_tokens",
"(",
"io",
".",
"BytesIO",
"(",
"name",
".",
"encode",
"(",
"'utf-8'",
")",
")",
".",
"readline",
")",
"typ",
... | Determine whether the input symbol name is a valid name.
Arguments
---------
name : str
name to check for validity.
Returns
--------
valid : bool
whether name is a a valid symbol name
This checks for Python reserved words and that the name matches
the regular ex... | [
"Determine",
"whether",
"the",
"input",
"symbol",
"name",
"is",
"a",
"valid",
"name",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L241-L264 |
10,150 | newville/asteval | asteval/astutils.py | make_symbol_table | def make_symbol_table(use_numpy=True, **kws):
"""Create a default symboltable, taking dict of user-defined symbols.
Arguments
---------
numpy : bool, optional
whether to include symbols from numpy
kws : optional
additional symbol name, value pairs to include in symbol table
Retu... | python | def make_symbol_table(use_numpy=True, **kws):
"""Create a default symboltable, taking dict of user-defined symbols.
Arguments
---------
numpy : bool, optional
whether to include symbols from numpy
kws : optional
additional symbol name, value pairs to include in symbol table
Retu... | [
"def",
"make_symbol_table",
"(",
"use_numpy",
"=",
"True",
",",
"*",
"*",
"kws",
")",
":",
"symtable",
"=",
"{",
"}",
"for",
"sym",
"in",
"FROM_PY",
":",
"if",
"sym",
"in",
"builtins",
":",
"symtable",
"[",
"sym",
"]",
"=",
"builtins",
"[",
"sym",
... | Create a default symboltable, taking dict of user-defined symbols.
Arguments
---------
numpy : bool, optional
whether to include symbols from numpy
kws : optional
additional symbol name, value pairs to include in symbol table
Returns
--------
symbol_table : dict
a sym... | [
"Create",
"a",
"default",
"symboltable",
"taking",
"dict",
"of",
"user",
"-",
"defined",
"symbols",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L351-L389 |
10,151 | newville/asteval | asteval/astutils.py | ExceptionHolder.get_error | def get_error(self):
"""Retrieve error data."""
col_offset = -1
if self.node is not None:
try:
col_offset = self.node.col_offset
except AttributeError:
pass
try:
exc_name = self.exc.__name__
except AttributeError... | python | def get_error(self):
"""Retrieve error data."""
col_offset = -1
if self.node is not None:
try:
col_offset = self.node.col_offset
except AttributeError:
pass
try:
exc_name = self.exc.__name__
except AttributeError... | [
"def",
"get_error",
"(",
"self",
")",
":",
"col_offset",
"=",
"-",
"1",
"if",
"self",
".",
"node",
"is",
"not",
"None",
":",
"try",
":",
"col_offset",
"=",
"self",
".",
"node",
".",
"col_offset",
"except",
"AttributeError",
":",
"pass",
"try",
":",
"... | Retrieve error data. | [
"Retrieve",
"error",
"data",
"."
] | bb7d3a95079f96ead75ea55662014bbcc82f9b28 | https://github.com/newville/asteval/blob/bb7d3a95079f96ead75ea55662014bbcc82f9b28/asteval/astutils.py#L303-L322 |
10,152 | admiralobvious/vyper | vyper/vyper.py | Vyper.add_config_path | def add_config_path(self, path):
"""Add a path for Vyper to search for the config file in.
Can be called multiple times to define multiple search paths.
"""
abspath = util.abs_pathify(path)
if abspath not in self._config_paths:
log.info("Adding {0} to paths to search"... | python | def add_config_path(self, path):
"""Add a path for Vyper to search for the config file in.
Can be called multiple times to define multiple search paths.
"""
abspath = util.abs_pathify(path)
if abspath not in self._config_paths:
log.info("Adding {0} to paths to search"... | [
"def",
"add_config_path",
"(",
"self",
",",
"path",
")",
":",
"abspath",
"=",
"util",
".",
"abs_pathify",
"(",
"path",
")",
"if",
"abspath",
"not",
"in",
"self",
".",
"_config_paths",
":",
"log",
".",
"info",
"(",
"\"Adding {0} to paths to search\"",
".",
... | Add a path for Vyper to search for the config file in.
Can be called multiple times to define multiple search paths. | [
"Add",
"a",
"path",
"for",
"Vyper",
"to",
"search",
"for",
"the",
"config",
"file",
"in",
".",
"Can",
"be",
"called",
"multiple",
"times",
"to",
"define",
"multiple",
"search",
"paths",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L122-L129 |
10,153 | admiralobvious/vyper | vyper/vyper.py | Vyper.sub | def sub(self, key):
"""Returns new Vyper instance representing a sub tree of this instance.
"""
subv = Vyper()
data = self.get(key)
if isinstance(data, dict):
subv._config = data
return subv
else:
return None | python | def sub(self, key):
"""Returns new Vyper instance representing a sub tree of this instance.
"""
subv = Vyper()
data = self.get(key)
if isinstance(data, dict):
subv._config = data
return subv
else:
return None | [
"def",
"sub",
"(",
"self",
",",
"key",
")",
":",
"subv",
"=",
"Vyper",
"(",
")",
"data",
"=",
"self",
".",
"get",
"(",
"key",
")",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"subv",
".",
"_config",
"=",
"data",
"return",
"subv",
"e... | Returns new Vyper instance representing a sub tree of this instance. | [
"Returns",
"new",
"Vyper",
"instance",
"representing",
"a",
"sub",
"tree",
"of",
"this",
"instance",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L224-L233 |
10,154 | admiralobvious/vyper | vyper/vyper.py | Vyper.unmarshall_key | def unmarshall_key(self, key, cls):
"""Takes a single key and unmarshalls it into a class."""
return setattr(cls, key, self.get(key)) | python | def unmarshall_key(self, key, cls):
"""Takes a single key and unmarshalls it into a class."""
return setattr(cls, key, self.get(key)) | [
"def",
"unmarshall_key",
"(",
"self",
",",
"key",
",",
"cls",
")",
":",
"return",
"setattr",
"(",
"cls",
",",
"key",
",",
"self",
".",
"get",
"(",
"key",
")",
")"
] | Takes a single key and unmarshalls it into a class. | [
"Takes",
"a",
"single",
"key",
"and",
"unmarshalls",
"it",
"into",
"a",
"class",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L235-L237 |
10,155 | admiralobvious/vyper | vyper/vyper.py | Vyper.unmarshall | def unmarshall(self, cls):
"""Unmarshalls the config into a class. Make sure that the tags on
the attributes of the class are properly set.
"""
for k, v in self.all_settings().items():
setattr(cls, k, v)
return cls | python | def unmarshall(self, cls):
"""Unmarshalls the config into a class. Make sure that the tags on
the attributes of the class are properly set.
"""
for k, v in self.all_settings().items():
setattr(cls, k, v)
return cls | [
"def",
"unmarshall",
"(",
"self",
",",
"cls",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"all_settings",
"(",
")",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"cls",
",",
"k",
",",
"v",
")",
"return",
"cls"
] | Unmarshalls the config into a class. Make sure that the tags on
the attributes of the class are properly set. | [
"Unmarshalls",
"the",
"config",
"into",
"a",
"class",
".",
"Make",
"sure",
"that",
"the",
"tags",
"on",
"the",
"attributes",
"of",
"the",
"class",
"are",
"properly",
"set",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L239-L246 |
10,156 | admiralobvious/vyper | vyper/vyper.py | Vyper.bind_env | def bind_env(self, *input_):
"""Binds a Vyper key to a ENV variable.
ENV variables are case sensitive.
If only a key is provided, it will use the env key matching the key,
uppercased.
`env_prefix` will be used when set when env name is not provided.
"""
if len(inp... | python | def bind_env(self, *input_):
"""Binds a Vyper key to a ENV variable.
ENV variables are case sensitive.
If only a key is provided, it will use the env key matching the key,
uppercased.
`env_prefix` will be used when set when env name is not provided.
"""
if len(inp... | [
"def",
"bind_env",
"(",
"self",
",",
"*",
"input_",
")",
":",
"if",
"len",
"(",
"input_",
")",
"==",
"0",
":",
"return",
"\"bind_env missing key to bind to\"",
"key",
"=",
"input_",
"[",
"0",
"]",
".",
"lower",
"(",
")",
"if",
"len",
"(",
"input_",
"... | Binds a Vyper key to a ENV variable.
ENV variables are case sensitive.
If only a key is provided, it will use the env key matching the key,
uppercased.
`env_prefix` will be used when set when env name is not provided. | [
"Binds",
"a",
"Vyper",
"key",
"to",
"a",
"ENV",
"variable",
".",
"ENV",
"variables",
"are",
"case",
"sensitive",
".",
"If",
"only",
"a",
"key",
"is",
"provided",
"it",
"will",
"use",
"the",
"env",
"key",
"matching",
"the",
"key",
"uppercased",
".",
"en... | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L289-L321 |
10,157 | admiralobvious/vyper | vyper/vyper.py | Vyper.is_set | def is_set(self, key):
"""Check to see if the key has been set in any of the data locations.
"""
path = key.split(self._key_delimiter)
lower_case_key = key.lower()
val = self._find(lower_case_key)
if val is None:
source = self._find(path[0].lower())
... | python | def is_set(self, key):
"""Check to see if the key has been set in any of the data locations.
"""
path = key.split(self._key_delimiter)
lower_case_key = key.lower()
val = self._find(lower_case_key)
if val is None:
source = self._find(path[0].lower())
... | [
"def",
"is_set",
"(",
"self",
",",
"key",
")",
":",
"path",
"=",
"key",
".",
"split",
"(",
"self",
".",
"_key_delimiter",
")",
"lower_case_key",
"=",
"key",
".",
"lower",
"(",
")",
"val",
"=",
"self",
".",
"_find",
"(",
"lower_case_key",
")",
"if",
... | Check to see if the key has been set in any of the data locations. | [
"Check",
"to",
"see",
"if",
"the",
"key",
"has",
"been",
"set",
"in",
"any",
"of",
"the",
"data",
"locations",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L438-L451 |
10,158 | admiralobvious/vyper | vyper/vyper.py | Vyper.register_alias | def register_alias(self, alias, key):
"""Aliases provide another accessor for the same key.
This enables one to change a name without breaking the application.
"""
alias = alias.lower()
key = key.lower()
if alias != key and alias != self._real_key(key):
exists... | python | def register_alias(self, alias, key):
"""Aliases provide another accessor for the same key.
This enables one to change a name without breaking the application.
"""
alias = alias.lower()
key = key.lower()
if alias != key and alias != self._real_key(key):
exists... | [
"def",
"register_alias",
"(",
"self",
",",
"alias",
",",
"key",
")",
":",
"alias",
"=",
"alias",
".",
"lower",
"(",
")",
"key",
"=",
"key",
".",
"lower",
"(",
")",
"if",
"alias",
"!=",
"key",
"and",
"alias",
"!=",
"self",
".",
"_real_key",
"(",
"... | Aliases provide another accessor for the same key.
This enables one to change a name without breaking the application. | [
"Aliases",
"provide",
"another",
"accessor",
"for",
"the",
"same",
"key",
".",
"This",
"enables",
"one",
"to",
"change",
"a",
"name",
"without",
"breaking",
"the",
"application",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L466-L499 |
10,159 | admiralobvious/vyper | vyper/vyper.py | Vyper.set_default | def set_default(self, key, value):
"""Set the default value for this key.
Default only used when no value is provided by the user via
arg, config or env.
"""
k = self._real_key(key.lower())
self._defaults[k] = value | python | def set_default(self, key, value):
"""Set the default value for this key.
Default only used when no value is provided by the user via
arg, config or env.
"""
k = self._real_key(key.lower())
self._defaults[k] = value | [
"def",
"set_default",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"k",
"=",
"self",
".",
"_real_key",
"(",
"key",
".",
"lower",
"(",
")",
")",
"self",
".",
"_defaults",
"[",
"k",
"]",
"=",
"value"
] | Set the default value for this key.
Default only used when no value is provided by the user via
arg, config or env. | [
"Set",
"the",
"default",
"value",
"for",
"this",
"key",
".",
"Default",
"only",
"used",
"when",
"no",
"value",
"is",
"provided",
"by",
"the",
"user",
"via",
"arg",
"config",
"or",
"env",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L517-L523 |
10,160 | admiralobvious/vyper | vyper/vyper.py | Vyper._unmarshall_reader | def _unmarshall_reader(self, file_, d):
"""Unmarshall a file into a `dict`."""
return util.unmarshall_config_reader(file_, d, self._get_config_type()) | python | def _unmarshall_reader(self, file_, d):
"""Unmarshall a file into a `dict`."""
return util.unmarshall_config_reader(file_, d, self._get_config_type()) | [
"def",
"_unmarshall_reader",
"(",
"self",
",",
"file_",
",",
"d",
")",
":",
"return",
"util",
".",
"unmarshall_config_reader",
"(",
"file_",
",",
"d",
",",
"self",
".",
"_get_config_type",
"(",
")",
")"
] | Unmarshall a file into a `dict`. | [
"Unmarshall",
"a",
"file",
"into",
"a",
"dict",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L586-L588 |
10,161 | admiralobvious/vyper | vyper/vyper.py | Vyper._get_key_value_config | def _get_key_value_config(self):
"""Retrieves the first found remote configuration."""
for rp in self._remote_providers:
val = self._get_remote_config(rp)
self._kvstore = val
return None
raise errors.RemoteConfigError("No Files Found") | python | def _get_key_value_config(self):
"""Retrieves the first found remote configuration."""
for rp in self._remote_providers:
val = self._get_remote_config(rp)
self._kvstore = val
return None
raise errors.RemoteConfigError("No Files Found") | [
"def",
"_get_key_value_config",
"(",
"self",
")",
":",
"for",
"rp",
"in",
"self",
".",
"_remote_providers",
":",
"val",
"=",
"self",
".",
"_get_remote_config",
"(",
"rp",
")",
"self",
".",
"_kvstore",
"=",
"val",
"return",
"None",
"raise",
"errors",
".",
... | Retrieves the first found remote configuration. | [
"Retrieves",
"the",
"first",
"found",
"remote",
"configuration",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L590-L597 |
10,162 | admiralobvious/vyper | vyper/vyper.py | Vyper.all_keys | def all_keys(self, uppercase_keys=False):
"""Return all keys regardless where they are set."""
d = {}
for k in self._override.keys():
d[k.upper() if uppercase_keys else k.lower()] = {}
for k in self._args.keys():
d[k.upper() if uppercase_keys else k.lower()] = {... | python | def all_keys(self, uppercase_keys=False):
"""Return all keys regardless where they are set."""
d = {}
for k in self._override.keys():
d[k.upper() if uppercase_keys else k.lower()] = {}
for k in self._args.keys():
d[k.upper() if uppercase_keys else k.lower()] = {... | [
"def",
"all_keys",
"(",
"self",
",",
"uppercase_keys",
"=",
"False",
")",
":",
"d",
"=",
"{",
"}",
"for",
"k",
"in",
"self",
".",
"_override",
".",
"keys",
"(",
")",
":",
"d",
"[",
"k",
".",
"upper",
"(",
")",
"if",
"uppercase_keys",
"else",
"k",... | Return all keys regardless where they are set. | [
"Return",
"all",
"keys",
"regardless",
"where",
"they",
"are",
"set",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L617-L642 |
10,163 | admiralobvious/vyper | vyper/vyper.py | Vyper.all_settings | def all_settings(self, uppercase_keys=False):
"""Return all settings as a `dict`."""
d = {}
for k in self.all_keys(uppercase_keys):
d[k] = self.get(k)
return d | python | def all_settings(self, uppercase_keys=False):
"""Return all settings as a `dict`."""
d = {}
for k in self.all_keys(uppercase_keys):
d[k] = self.get(k)
return d | [
"def",
"all_settings",
"(",
"self",
",",
"uppercase_keys",
"=",
"False",
")",
":",
"d",
"=",
"{",
"}",
"for",
"k",
"in",
"self",
".",
"all_keys",
"(",
"uppercase_keys",
")",
":",
"d",
"[",
"k",
"]",
"=",
"self",
".",
"get",
"(",
"k",
")",
"return... | Return all settings as a `dict`. | [
"Return",
"all",
"settings",
"as",
"a",
"dict",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L644-L651 |
10,164 | admiralobvious/vyper | vyper/vyper.py | Vyper.debug | def debug(self): # pragma: no cover
"""Prints all configuration registries for debugging purposes."""
print("Aliases:")
pprint.pprint(self._aliases)
print("Override:")
pprint.pprint(self._override)
print("Args:")
pprint.pprint(self._args)
print("Env:")
... | python | def debug(self): # pragma: no cover
"""Prints all configuration registries for debugging purposes."""
print("Aliases:")
pprint.pprint(self._aliases)
print("Override:")
pprint.pprint(self._override)
print("Args:")
pprint.pprint(self._args)
print("Env:")
... | [
"def",
"debug",
"(",
"self",
")",
":",
"# pragma: no cover",
"print",
"(",
"\"Aliases:\"",
")",
"pprint",
".",
"pprint",
"(",
"self",
".",
"_aliases",
")",
"print",
"(",
"\"Override:\"",
")",
"pprint",
".",
"pprint",
"(",
"self",
".",
"_override",
")",
"... | Prints all configuration registries for debugging purposes. | [
"Prints",
"all",
"configuration",
"registries",
"for",
"debugging",
"purposes",
"."
] | 58ec7b90661502b7b2fea7a30849b90b907fcdec | https://github.com/admiralobvious/vyper/blob/58ec7b90661502b7b2fea7a30849b90b907fcdec/vyper/vyper.py#L713-L729 |
10,165 | rsalmei/clearly | clearly/command_line.py | server | def server(**kwargs):
"""
Starts the Clearly Server.
BROKER: The broker being used by celery, like "amqp://localhost".
"""
start_server(**{k: v for k, v in kwargs.items() if v},
blocking=True) | python | def server(**kwargs):
"""
Starts the Clearly Server.
BROKER: The broker being used by celery, like "amqp://localhost".
"""
start_server(**{k: v for k, v in kwargs.items() if v},
blocking=True) | [
"def",
"server",
"(",
"*",
"*",
"kwargs",
")",
":",
"start_server",
"(",
"*",
"*",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
"if",
"v",
"}",
",",
"blocking",
"=",
"True",
")"
] | Starts the Clearly Server.
BROKER: The broker being used by celery, like "amqp://localhost". | [
"Starts",
"the",
"Clearly",
"Server",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/command_line.py#L25-L32 |
10,166 | rsalmei/clearly | clearly/server.py | start_server | def start_server(broker, backend=None, port=12223,
max_tasks=10000, max_workers=100,
blocking=False, debug=False): # pragma: no cover
"""Starts a Clearly Server programmatically."""
_setup_logging(debug)
queue_listener_dispatcher = Queue()
listener = EventListener(bro... | python | def start_server(broker, backend=None, port=12223,
max_tasks=10000, max_workers=100,
blocking=False, debug=False): # pragma: no cover
"""Starts a Clearly Server programmatically."""
_setup_logging(debug)
queue_listener_dispatcher = Queue()
listener = EventListener(bro... | [
"def",
"start_server",
"(",
"broker",
",",
"backend",
"=",
"None",
",",
"port",
"=",
"12223",
",",
"max_tasks",
"=",
"10000",
",",
"max_workers",
"=",
"100",
",",
"blocking",
"=",
"False",
",",
"debug",
"=",
"False",
")",
":",
"# pragma: no cover",
"_set... | Starts a Clearly Server programmatically. | [
"Starts",
"a",
"Clearly",
"Server",
"programmatically",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L193-L205 |
10,167 | rsalmei/clearly | clearly/server.py | ClearlyServer._event_to_pb | def _event_to_pb(event):
"""Supports converting internal TaskData and WorkerData, as well as
celery Task and Worker to proto buffers messages.
Args:
event (Union[TaskData|Task|WorkerData|Worker]):
Returns:
ProtoBuf object
"""
if isinstance(event... | python | def _event_to_pb(event):
"""Supports converting internal TaskData and WorkerData, as well as
celery Task and Worker to proto buffers messages.
Args:
event (Union[TaskData|Task|WorkerData|Worker]):
Returns:
ProtoBuf object
"""
if isinstance(event... | [
"def",
"_event_to_pb",
"(",
"event",
")",
":",
"if",
"isinstance",
"(",
"event",
",",
"(",
"TaskData",
",",
"Task",
")",
")",
":",
"key",
",",
"klass",
"=",
"'task'",
",",
"clearly_pb2",
".",
"TaskMessage",
"elif",
"isinstance",
"(",
"event",
",",
"(",... | Supports converting internal TaskData and WorkerData, as well as
celery Task and Worker to proto buffers messages.
Args:
event (Union[TaskData|Task|WorkerData|Worker]):
Returns:
ProtoBuf object | [
"Supports",
"converting",
"internal",
"TaskData",
"and",
"WorkerData",
"as",
"well",
"as",
"celery",
"Task",
"and",
"Worker",
"to",
"proto",
"buffers",
"messages",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L73-L96 |
10,168 | rsalmei/clearly | clearly/server.py | ClearlyServer.filter_tasks | def filter_tasks(self, request, context):
"""Filter tasks by matching patterns to name, routing key and state."""
_log_request(request, context)
tasks_pattern, tasks_negate = PATTERN_PARAMS_OP(request.tasks_filter)
state_pattern = request.state_pattern
limit, reverse = request.li... | python | def filter_tasks(self, request, context):
"""Filter tasks by matching patterns to name, routing key and state."""
_log_request(request, context)
tasks_pattern, tasks_negate = PATTERN_PARAMS_OP(request.tasks_filter)
state_pattern = request.state_pattern
limit, reverse = request.li... | [
"def",
"filter_tasks",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"_log_request",
"(",
"request",
",",
"context",
")",
"tasks_pattern",
",",
"tasks_negate",
"=",
"PATTERN_PARAMS_OP",
"(",
"request",
".",
"tasks_filter",
")",
"state_pattern",
"=",
"... | Filter tasks by matching patterns to name, routing key and state. | [
"Filter",
"tasks",
"by",
"matching",
"patterns",
"to",
"name",
"routing",
"key",
"and",
"state",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L98-L124 |
10,169 | rsalmei/clearly | clearly/server.py | ClearlyServer.filter_workers | def filter_workers(self, request, context):
"""Filter workers by matching a pattern to hostname."""
_log_request(request, context)
workers_pattern, workers_negate = PATTERN_PARAMS_OP(request.workers_filter)
hregex = re.compile(workers_pattern) # hostname filter condition
def h... | python | def filter_workers(self, request, context):
"""Filter workers by matching a pattern to hostname."""
_log_request(request, context)
workers_pattern, workers_negate = PATTERN_PARAMS_OP(request.workers_filter)
hregex = re.compile(workers_pattern) # hostname filter condition
def h... | [
"def",
"filter_workers",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"_log_request",
"(",
"request",
",",
"context",
")",
"workers_pattern",
",",
"workers_negate",
"=",
"PATTERN_PARAMS_OP",
"(",
"request",
".",
"workers_filter",
")",
"hregex",
"=",
... | Filter workers by matching a pattern to hostname. | [
"Filter",
"workers",
"by",
"matching",
"a",
"pattern",
"to",
"hostname",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L126-L146 |
10,170 | rsalmei/clearly | clearly/server.py | ClearlyServer.seen_tasks | def seen_tasks(self, request, context):
"""Returns all seen task types."""
_log_request(request, context)
result = clearly_pb2.SeenTasksMessage()
result.task_types.extend(self.listener.memory.task_types())
return result | python | def seen_tasks(self, request, context):
"""Returns all seen task types."""
_log_request(request, context)
result = clearly_pb2.SeenTasksMessage()
result.task_types.extend(self.listener.memory.task_types())
return result | [
"def",
"seen_tasks",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"_log_request",
"(",
"request",
",",
"context",
")",
"result",
"=",
"clearly_pb2",
".",
"SeenTasksMessage",
"(",
")",
"result",
".",
"task_types",
".",
"extend",
"(",
"self",
".",
... | Returns all seen task types. | [
"Returns",
"all",
"seen",
"task",
"types",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L156-L161 |
10,171 | rsalmei/clearly | clearly/server.py | ClearlyServer.reset_tasks | def reset_tasks(self, request, context):
"""Resets all captured tasks."""
_log_request(request, context)
self.listener.memory.clear_tasks()
return clearly_pb2.Empty() | python | def reset_tasks(self, request, context):
"""Resets all captured tasks."""
_log_request(request, context)
self.listener.memory.clear_tasks()
return clearly_pb2.Empty() | [
"def",
"reset_tasks",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"_log_request",
"(",
"request",
",",
"context",
")",
"self",
".",
"listener",
".",
"memory",
".",
"clear_tasks",
"(",
")",
"return",
"clearly_pb2",
".",
"Empty",
"(",
")"
] | Resets all captured tasks. | [
"Resets",
"all",
"captured",
"tasks",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L163-L167 |
10,172 | rsalmei/clearly | clearly/server.py | ClearlyServer.get_stats | def get_stats(self, request, context):
"""Returns the server statistics."""
_log_request(request, context)
m = self.listener.memory
return clearly_pb2.StatsMessage(
task_count=m.task_count,
event_count=m.event_count,
len_tasks=len(m.tasks),
... | python | def get_stats(self, request, context):
"""Returns the server statistics."""
_log_request(request, context)
m = self.listener.memory
return clearly_pb2.StatsMessage(
task_count=m.task_count,
event_count=m.event_count,
len_tasks=len(m.tasks),
... | [
"def",
"get_stats",
"(",
"self",
",",
"request",
",",
"context",
")",
":",
"_log_request",
"(",
"request",
",",
"context",
")",
"m",
"=",
"self",
".",
"listener",
".",
"memory",
"return",
"clearly_pb2",
".",
"StatsMessage",
"(",
"task_count",
"=",
"m",
"... | Returns the server statistics. | [
"Returns",
"the",
"server",
"statistics",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/server.py#L169-L178 |
10,173 | rsalmei/clearly | clearly/utils/data.py | accepts | def accepts(regex, negate, *values):
"""Given a compiled regex and a negate, find if any of the values match.
Args:
regex (Pattern):
negate (bool):
*values (str):
Returns:
"""
return any(v and regex.search(v) for v in values) != negate | python | def accepts(regex, negate, *values):
"""Given a compiled regex and a negate, find if any of the values match.
Args:
regex (Pattern):
negate (bool):
*values (str):
Returns:
"""
return any(v and regex.search(v) for v in values) != negate | [
"def",
"accepts",
"(",
"regex",
",",
"negate",
",",
"*",
"values",
")",
":",
"return",
"any",
"(",
"v",
"and",
"regex",
".",
"search",
"(",
"v",
")",
"for",
"v",
"in",
"values",
")",
"!=",
"negate"
] | Given a compiled regex and a negate, find if any of the values match.
Args:
regex (Pattern):
negate (bool):
*values (str):
Returns: | [
"Given",
"a",
"compiled",
"regex",
"and",
"a",
"negate",
"find",
"if",
"any",
"of",
"the",
"values",
"match",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/utils/data.py#L1-L12 |
10,174 | rsalmei/clearly | clearly/utils/data.py | copy_update | def copy_update(pb_message, **kwds):
"""Returns a copy of the PB object, with some fields updated.
Args:
pb_message:
**kwds:
Returns:
"""
result = pb_message.__class__()
result.CopyFrom(pb_message)
for k, v in kwds.items():
setattr(result, k, v)
return result | python | def copy_update(pb_message, **kwds):
"""Returns a copy of the PB object, with some fields updated.
Args:
pb_message:
**kwds:
Returns:
"""
result = pb_message.__class__()
result.CopyFrom(pb_message)
for k, v in kwds.items():
setattr(result, k, v)
return result | [
"def",
"copy_update",
"(",
"pb_message",
",",
"*",
"*",
"kwds",
")",
":",
"result",
"=",
"pb_message",
".",
"__class__",
"(",
")",
"result",
".",
"CopyFrom",
"(",
"pb_message",
")",
"for",
"k",
",",
"v",
"in",
"kwds",
".",
"items",
"(",
")",
":",
"... | Returns a copy of the PB object, with some fields updated.
Args:
pb_message:
**kwds:
Returns: | [
"Returns",
"a",
"copy",
"of",
"the",
"PB",
"object",
"with",
"some",
"fields",
"updated",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/utils/data.py#L15-L29 |
10,175 | rsalmei/clearly | clearly/event_core/streaming_dispatcher.py | StreamingDispatcher.__start | def __start(self): # pragma: no cover
"""Starts the real-time engine that captures tasks."""
assert not self.dispatcher_thread
self.dispatcher_thread = threading.Thread(target=self.__run_dispatcher,
name='clearly-dispatcher')
self.disp... | python | def __start(self): # pragma: no cover
"""Starts the real-time engine that captures tasks."""
assert not self.dispatcher_thread
self.dispatcher_thread = threading.Thread(target=self.__run_dispatcher,
name='clearly-dispatcher')
self.disp... | [
"def",
"__start",
"(",
"self",
")",
":",
"# pragma: no cover",
"assert",
"not",
"self",
".",
"dispatcher_thread",
"self",
".",
"dispatcher_thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"__run_dispatcher",
",",
"name",
"=",
"'clearl... | Starts the real-time engine that captures tasks. | [
"Starts",
"the",
"real",
"-",
"time",
"engine",
"that",
"captures",
"tasks",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/event_core/streaming_dispatcher.py#L56-L65 |
10,176 | rsalmei/clearly | clearly/event_core/streaming_dispatcher.py | StreamingDispatcher.streaming_client | def streaming_client(self, tasks_regex, tasks_negate, workers_regex, workers_negate):
"""Connects a client to the streaming capture, filtering the events that are sent
to it.
Args:
tasks_regex (str): a pattern to filter tasks to capture.
ex.: '^dispatch|^email' to fi... | python | def streaming_client(self, tasks_regex, tasks_negate, workers_regex, workers_negate):
"""Connects a client to the streaming capture, filtering the events that are sent
to it.
Args:
tasks_regex (str): a pattern to filter tasks to capture.
ex.: '^dispatch|^email' to fi... | [
"def",
"streaming_client",
"(",
"self",
",",
"tasks_regex",
",",
"tasks_negate",
",",
"workers_regex",
",",
"workers_negate",
")",
":",
"cc",
"=",
"CapturingClient",
"(",
"Queue",
"(",
")",
",",
"re",
".",
"compile",
"(",
"tasks_regex",
")",
",",
"tasks_nega... | Connects a client to the streaming capture, filtering the events that are sent
to it.
Args:
tasks_regex (str): a pattern to filter tasks to capture.
ex.: '^dispatch|^email' to filter names starting with that
or 'dispatch.*123456' to filter that exact na... | [
"Connects",
"a",
"client",
"to",
"the",
"streaming",
"capture",
"filtering",
"the",
"events",
"that",
"are",
"sent",
"to",
"it",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/event_core/streaming_dispatcher.py#L79-L100 |
10,177 | rsalmei/clearly | clearly/event_core/event_listener.py | EventListener.__start | def __start(self): # pragma: no cover
"""Starts the real-time engine that captures events."""
assert not self._listener_thread
self._listener_thread = threading.Thread(target=self.__run_listener,
name='clearly-listener')
self._listener_... | python | def __start(self): # pragma: no cover
"""Starts the real-time engine that captures events."""
assert not self._listener_thread
self._listener_thread = threading.Thread(target=self.__run_listener,
name='clearly-listener')
self._listener_... | [
"def",
"__start",
"(",
"self",
")",
":",
"# pragma: no cover",
"assert",
"not",
"self",
".",
"_listener_thread",
"self",
".",
"_listener_thread",
"=",
"threading",
".",
"Thread",
"(",
"target",
"=",
"self",
".",
"__run_listener",
",",
"name",
"=",
"'clearly-li... | Starts the real-time engine that captures events. | [
"Starts",
"the",
"real",
"-",
"time",
"engine",
"that",
"captures",
"events",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/event_core/event_listener.py#L71-L81 |
10,178 | rsalmei/clearly | clearly/client.py | ClearlyClient.capture | def capture(self, pattern=None, negate=False, workers=None, negate_workers=False,
params=None, success=False, error=True, stats=False):
"""Starts capturing selected events in real-time. You can filter exactly what
you want to see, as the Clearly Server handles all tasks and workers updat... | python | def capture(self, pattern=None, negate=False, workers=None, negate_workers=False,
params=None, success=False, error=True, stats=False):
"""Starts capturing selected events in real-time. You can filter exactly what
you want to see, as the Clearly Server handles all tasks and workers updat... | [
"def",
"capture",
"(",
"self",
",",
"pattern",
"=",
"None",
",",
"negate",
"=",
"False",
",",
"workers",
"=",
"None",
",",
"negate_workers",
"=",
"False",
",",
"params",
"=",
"None",
",",
"success",
"=",
"False",
",",
"error",
"=",
"True",
",",
"stat... | Starts capturing selected events in real-time. You can filter exactly what
you want to see, as the Clearly Server handles all tasks and workers updates
being sent to celery. Several clients can see different sets of events at the
same time.
This runs in the foreground, so you can see in... | [
"Starts",
"capturing",
"selected",
"events",
"in",
"real",
"-",
"time",
".",
"You",
"can",
"filter",
"exactly",
"what",
"you",
"want",
"to",
"see",
"as",
"the",
"Clearly",
"Server",
"handles",
"all",
"tasks",
"and",
"workers",
"updates",
"being",
"sent",
"... | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/client.py#L40-L92 |
10,179 | rsalmei/clearly | clearly/client.py | ClearlyClient.tasks | def tasks(self, pattern=None, negate=False, state=None, limit=None, reverse=True,
params=None, success=False, error=True):
"""Filters stored tasks and displays their current statuses.
Note that, to be able to list the tasks sorted chronologically, celery retrieves
tasks from the L... | python | def tasks(self, pattern=None, negate=False, state=None, limit=None, reverse=True,
params=None, success=False, error=True):
"""Filters stored tasks and displays their current statuses.
Note that, to be able to list the tasks sorted chronologically, celery retrieves
tasks from the L... | [
"def",
"tasks",
"(",
"self",
",",
"pattern",
"=",
"None",
",",
"negate",
"=",
"False",
",",
"state",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"reverse",
"=",
"True",
",",
"params",
"=",
"None",
",",
"success",
"=",
"False",
",",
"error",
"=",
... | Filters stored tasks and displays their current statuses.
Note that, to be able to list the tasks sorted chronologically, celery retrieves
tasks from the LRU event heap instead of the dict storage, so the total number
of tasks fetched may be different than the server `max_tasks` setting. For
... | [
"Filters",
"stored",
"tasks",
"and",
"displays",
"their",
"current",
"statuses",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/client.py#L118-L158 |
10,180 | rsalmei/clearly | clearly/client.py | ClearlyClient.seen_tasks | def seen_tasks(self):
"""Shows a list of seen task types."""
print('\n'.join(self._stub.seen_tasks(clearly_pb2.Empty()).task_types)) | python | def seen_tasks(self):
"""Shows a list of seen task types."""
print('\n'.join(self._stub.seen_tasks(clearly_pb2.Empty()).task_types)) | [
"def",
"seen_tasks",
"(",
"self",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"self",
".",
"_stub",
".",
"seen_tasks",
"(",
"clearly_pb2",
".",
"Empty",
"(",
")",
")",
".",
"task_types",
")",
")"
] | Shows a list of seen task types. | [
"Shows",
"a",
"list",
"of",
"seen",
"task",
"types",
"."
] | fd784843d13f0fed28fc192565bec3668f1363f4 | https://github.com/rsalmei/clearly/blob/fd784843d13f0fed28fc192565bec3668f1363f4/clearly/client.py#L197-L199 |
10,181 | linuxlewis/channels-api | channels_api/decorators.py | detail_action | def detail_action(**kwargs):
"""
Used to mark a method on a ResourceBinding that should be routed for detail actions.
"""
def decorator(func):
func.action = True
func.detail = True
func.kwargs = kwargs
return func
return decorator | python | def detail_action(**kwargs):
"""
Used to mark a method on a ResourceBinding that should be routed for detail actions.
"""
def decorator(func):
func.action = True
func.detail = True
func.kwargs = kwargs
return func
return decorator | [
"def",
"detail_action",
"(",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"func",
".",
"action",
"=",
"True",
"func",
".",
"detail",
"=",
"True",
"func",
".",
"kwargs",
"=",
"kwargs",
"return",
"func",
"return",
"decorator"
... | Used to mark a method on a ResourceBinding that should be routed for detail actions. | [
"Used",
"to",
"mark",
"a",
"method",
"on",
"a",
"ResourceBinding",
"that",
"should",
"be",
"routed",
"for",
"detail",
"actions",
"."
] | ec2a81a1ae83606980ad5bb709bca517fdde077d | https://github.com/linuxlewis/channels-api/blob/ec2a81a1ae83606980ad5bb709bca517fdde077d/channels_api/decorators.py#L1-L10 |
10,182 | linuxlewis/channels-api | channels_api/decorators.py | list_action | def list_action(**kwargs):
"""
Used to mark a method on a ResourceBinding that should be routed for list actions.
"""
def decorator(func):
func.action = True
func.detail = False
func.kwargs = kwargs
return func
return decorator | python | def list_action(**kwargs):
"""
Used to mark a method on a ResourceBinding that should be routed for list actions.
"""
def decorator(func):
func.action = True
func.detail = False
func.kwargs = kwargs
return func
return decorator | [
"def",
"list_action",
"(",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"func",
".",
"action",
"=",
"True",
"func",
".",
"detail",
"=",
"False",
"func",
".",
"kwargs",
"=",
"kwargs",
"return",
"func",
"return",
"decorator"
] | Used to mark a method on a ResourceBinding that should be routed for list actions. | [
"Used",
"to",
"mark",
"a",
"method",
"on",
"a",
"ResourceBinding",
"that",
"should",
"be",
"routed",
"for",
"list",
"actions",
"."
] | ec2a81a1ae83606980ad5bb709bca517fdde077d | https://github.com/linuxlewis/channels-api/blob/ec2a81a1ae83606980ad5bb709bca517fdde077d/channels_api/decorators.py#L13-L22 |
10,183 | mattja/sdeint | sdeint/_broadcast.py | broadcast_to | def broadcast_to(array, shape, subok=False):
"""Broadcast an array to a new shape.
Parameters
----------
array : array_like
The array to broadcast.
shape : tuple
The shape of the desired array.
subok : bool, optional
If True, then sub-classes will be passed-through, othe... | python | def broadcast_to(array, shape, subok=False):
"""Broadcast an array to a new shape.
Parameters
----------
array : array_like
The array to broadcast.
shape : tuple
The shape of the desired array.
subok : bool, optional
If True, then sub-classes will be passed-through, othe... | [
"def",
"broadcast_to",
"(",
"array",
",",
"shape",
",",
"subok",
"=",
"False",
")",
":",
"return",
"_broadcast_to",
"(",
"array",
",",
"shape",
",",
"subok",
"=",
"subok",
",",
"readonly",
"=",
"True",
")"
] | Broadcast an array to a new shape.
Parameters
----------
array : array_like
The array to broadcast.
shape : tuple
The shape of the desired array.
subok : bool, optional
If True, then sub-classes will be passed-through, otherwise
the returned array will be forced to b... | [
"Broadcast",
"an",
"array",
"to",
"a",
"new",
"shape",
"."
] | 7cf807cdf97b3bb39d29e1c2dc834b519499b601 | https://github.com/mattja/sdeint/blob/7cf807cdf97b3bb39d29e1c2dc834b519499b601/sdeint/_broadcast.py#L70-L108 |
10,184 | mattja/sdeint | sdeint/wiener.py | _K | def _K(m):
""" matrix K_m from Wiktorsson2001 """
M = m*(m - 1)//2
K = np.zeros((M, m**2), dtype=np.int64)
row = 0
for j in range(1, m):
col = (j - 1)*m + j
s = m - j
K[row:(row+s), col:(col+s)] = np.eye(s)
row += s
return K | python | def _K(m):
""" matrix K_m from Wiktorsson2001 """
M = m*(m - 1)//2
K = np.zeros((M, m**2), dtype=np.int64)
row = 0
for j in range(1, m):
col = (j - 1)*m + j
s = m - j
K[row:(row+s), col:(col+s)] = np.eye(s)
row += s
return K | [
"def",
"_K",
"(",
"m",
")",
":",
"M",
"=",
"m",
"*",
"(",
"m",
"-",
"1",
")",
"//",
"2",
"K",
"=",
"np",
".",
"zeros",
"(",
"(",
"M",
",",
"m",
"**",
"2",
")",
",",
"dtype",
"=",
"np",
".",
"int64",
")",
"row",
"=",
"0",
"for",
"j",
... | matrix K_m from Wiktorsson2001 | [
"matrix",
"K_m",
"from",
"Wiktorsson2001"
] | 7cf807cdf97b3bb39d29e1c2dc834b519499b601 | https://github.com/mattja/sdeint/blob/7cf807cdf97b3bb39d29e1c2dc834b519499b601/sdeint/wiener.py#L187-L197 |
10,185 | riptano/ccm | ccmlib/cluster.py | Cluster.wait_for_compactions | def wait_for_compactions(self, timeout=600):
"""
Wait for all compactions to finish on all nodes.
"""
for node in list(self.nodes.values()):
if node.is_running():
node.wait_for_compactions(timeout)
return self | python | def wait_for_compactions(self, timeout=600):
"""
Wait for all compactions to finish on all nodes.
"""
for node in list(self.nodes.values()):
if node.is_running():
node.wait_for_compactions(timeout)
return self | [
"def",
"wait_for_compactions",
"(",
"self",
",",
"timeout",
"=",
"600",
")",
":",
"for",
"node",
"in",
"list",
"(",
"self",
".",
"nodes",
".",
"values",
"(",
")",
")",
":",
"if",
"node",
".",
"is_running",
"(",
")",
":",
"node",
".",
"wait_for_compac... | Wait for all compactions to finish on all nodes. | [
"Wait",
"for",
"all",
"compactions",
"to",
"finish",
"on",
"all",
"nodes",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/cluster.py#L472-L479 |
10,186 | riptano/ccm | ccmlib/dse_node.py | DseNode.watch_log_for_alive | def watch_log_for_alive(self, nodes, from_mark=None, timeout=720, filename='system.log'):
"""
Watch the log of this node until it detects that the provided other
nodes are marked UP. This method works similarly to watch_log_for_death.
We want to provide a higher default timeout when thi... | python | def watch_log_for_alive(self, nodes, from_mark=None, timeout=720, filename='system.log'):
"""
Watch the log of this node until it detects that the provided other
nodes are marked UP. This method works similarly to watch_log_for_death.
We want to provide a higher default timeout when thi... | [
"def",
"watch_log_for_alive",
"(",
"self",
",",
"nodes",
",",
"from_mark",
"=",
"None",
",",
"timeout",
"=",
"720",
",",
"filename",
"=",
"'system.log'",
")",
":",
"super",
"(",
"DseNode",
",",
"self",
")",
".",
"watch_log_for_alive",
"(",
"nodes",
",",
... | Watch the log of this node until it detects that the provided other
nodes are marked UP. This method works similarly to watch_log_for_death.
We want to provide a higher default timeout when this is called on DSE. | [
"Watch",
"the",
"log",
"of",
"this",
"node",
"until",
"it",
"detects",
"that",
"the",
"provided",
"other",
"nodes",
"are",
"marked",
"UP",
".",
"This",
"method",
"works",
"similarly",
"to",
"watch_log_for_death",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/dse_node.py#L102-L109 |
10,187 | riptano/ccm | ccmlib/node.py | Node.load | def load(path, name, cluster):
"""
Load a node from from the path on disk to the config files, the node name and the
cluster the node is part of.
"""
node_path = os.path.join(path, name)
filename = os.path.join(node_path, 'node.conf')
with open(filename, 'r') as f... | python | def load(path, name, cluster):
"""
Load a node from from the path on disk to the config files, the node name and the
cluster the node is part of.
"""
node_path = os.path.join(path, name)
filename = os.path.join(node_path, 'node.conf')
with open(filename, 'r') as f... | [
"def",
"load",
"(",
"path",
",",
"name",
",",
"cluster",
")",
":",
"node_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"name",
")",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"node_path",
",",
"'node.conf'",
")",
"with",
... | Load a node from from the path on disk to the config files, the node name and the
cluster the node is part of. | [
"Load",
"a",
"node",
"from",
"from",
"the",
"path",
"on",
"disk",
"to",
"the",
"config",
"files",
"the",
"node",
"name",
"and",
"the",
"cluster",
"the",
"node",
"is",
"part",
"of",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L150-L194 |
10,188 | riptano/ccm | ccmlib/node.py | Node.get_install_dir | def get_install_dir(self):
"""
Returns the path to the cassandra source directory used by this node.
"""
if self.__install_dir is None:
return self.cluster.get_install_dir()
else:
common.validate_install_dir(self.__install_dir)
return self.__in... | python | def get_install_dir(self):
"""
Returns the path to the cassandra source directory used by this node.
"""
if self.__install_dir is None:
return self.cluster.get_install_dir()
else:
common.validate_install_dir(self.__install_dir)
return self.__in... | [
"def",
"get_install_dir",
"(",
"self",
")",
":",
"if",
"self",
".",
"__install_dir",
"is",
"None",
":",
"return",
"self",
".",
"cluster",
".",
"get_install_dir",
"(",
")",
"else",
":",
"common",
".",
"validate_install_dir",
"(",
"self",
".",
"__install_dir",... | Returns the path to the cassandra source directory used by this node. | [
"Returns",
"the",
"path",
"to",
"the",
"cassandra",
"source",
"directory",
"used",
"by",
"this",
"node",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L241-L249 |
10,189 | riptano/ccm | ccmlib/node.py | Node.set_install_dir | def set_install_dir(self, install_dir=None, version=None, verbose=False):
"""
Sets the path to the cassandra source directory for use by this node.
"""
if version is None:
self.__install_dir = install_dir
if install_dir is not None:
common.validate... | python | def set_install_dir(self, install_dir=None, version=None, verbose=False):
"""
Sets the path to the cassandra source directory for use by this node.
"""
if version is None:
self.__install_dir = install_dir
if install_dir is not None:
common.validate... | [
"def",
"set_install_dir",
"(",
"self",
",",
"install_dir",
"=",
"None",
",",
"version",
"=",
"None",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"version",
"is",
"None",
":",
"self",
".",
"__install_dir",
"=",
"install_dir",
"if",
"install_dir",
"is",
... | Sets the path to the cassandra source directory for use by this node. | [
"Sets",
"the",
"path",
"to",
"the",
"cassandra",
"source",
"directory",
"for",
"use",
"by",
"this",
"node",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L255-L274 |
10,190 | riptano/ccm | ccmlib/node.py | Node.show | def show(self, only_status=False, show_cluster=True):
"""
Print infos on this node configuration.
"""
self.__update_status()
indent = ''.join([" " for i in xrange(0, len(self.name) + 2)])
print_("{}: {}".format(self.name, self.__get_status_string()))
if not only_s... | python | def show(self, only_status=False, show_cluster=True):
"""
Print infos on this node configuration.
"""
self.__update_status()
indent = ''.join([" " for i in xrange(0, len(self.name) + 2)])
print_("{}: {}".format(self.name, self.__get_status_string()))
if not only_s... | [
"def",
"show",
"(",
"self",
",",
"only_status",
"=",
"False",
",",
"show_cluster",
"=",
"True",
")",
":",
"self",
".",
"__update_status",
"(",
")",
"indent",
"=",
"''",
".",
"join",
"(",
"[",
"\" \"",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"len... | Print infos on this node configuration. | [
"Print",
"infos",
"on",
"this",
"node",
"configuration",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L329-L350 |
10,191 | riptano/ccm | ccmlib/node.py | Node.is_running | def is_running(self):
"""
Return true if the node is running
"""
self.__update_status()
return self.status == Status.UP or self.status == Status.DECOMMISSIONED | python | def is_running(self):
"""
Return true if the node is running
"""
self.__update_status()
return self.status == Status.UP or self.status == Status.DECOMMISSIONED | [
"def",
"is_running",
"(",
"self",
")",
":",
"self",
".",
"__update_status",
"(",
")",
"return",
"self",
".",
"status",
"==",
"Status",
".",
"UP",
"or",
"self",
".",
"status",
"==",
"Status",
".",
"DECOMMISSIONED"
] | Return true if the node is running | [
"Return",
"true",
"if",
"the",
"node",
"is",
"running"
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L352-L357 |
10,192 | riptano/ccm | ccmlib/node.py | Node.grep_log | def grep_log(self, expr, filename='system.log', from_mark=None):
"""
Returns a list of lines matching the regular expression in parameter
in the Cassandra log of this node
"""
matchings = []
pattern = re.compile(expr)
with open(os.path.join(self.get_path(), 'logs'... | python | def grep_log(self, expr, filename='system.log', from_mark=None):
"""
Returns a list of lines matching the regular expression in parameter
in the Cassandra log of this node
"""
matchings = []
pattern = re.compile(expr)
with open(os.path.join(self.get_path(), 'logs'... | [
"def",
"grep_log",
"(",
"self",
",",
"expr",
",",
"filename",
"=",
"'system.log'",
",",
"from_mark",
"=",
"None",
")",
":",
"matchings",
"=",
"[",
"]",
"pattern",
"=",
"re",
".",
"compile",
"(",
"expr",
")",
"with",
"open",
"(",
"os",
".",
"path",
... | Returns a list of lines matching the regular expression in parameter
in the Cassandra log of this node | [
"Returns",
"a",
"list",
"of",
"lines",
"matching",
"the",
"regular",
"expression",
"in",
"parameter",
"in",
"the",
"Cassandra",
"log",
"of",
"this",
"node"
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L387-L401 |
10,193 | riptano/ccm | ccmlib/node.py | Node.wait_for_binary_interface | def wait_for_binary_interface(self, **kwargs):
"""
Waits for the Binary CQL interface to be listening. If > 1.2 will check
log for 'Starting listening for CQL clients' before checking for the
interface to be listening.
Emits a warning if not listening after 30 seconds.
... | python | def wait_for_binary_interface(self, **kwargs):
"""
Waits for the Binary CQL interface to be listening. If > 1.2 will check
log for 'Starting listening for CQL clients' before checking for the
interface to be listening.
Emits a warning if not listening after 30 seconds.
... | [
"def",
"wait_for_binary_interface",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"cluster",
".",
"version",
"(",
")",
">=",
"'1.2'",
":",
"self",
".",
"watch_log_for",
"(",
"\"Starting listening for CQL clients\"",
",",
"*",
"*",
"kwarg... | Waits for the Binary CQL interface to be listening. If > 1.2 will check
log for 'Starting listening for CQL clients' before checking for the
interface to be listening.
Emits a warning if not listening after 30 seconds. | [
"Waits",
"for",
"the",
"Binary",
"CQL",
"interface",
"to",
"be",
"listening",
".",
"If",
">",
"1",
".",
"2",
"will",
"check",
"log",
"for",
"Starting",
"listening",
"for",
"CQL",
"clients",
"before",
"checking",
"for",
"the",
"interface",
"to",
"be",
"li... | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L544-L558 |
10,194 | riptano/ccm | ccmlib/node.py | Node.wait_for_thrift_interface | def wait_for_thrift_interface(self, **kwargs):
"""
Waits for the Thrift interface to be listening.
Emits a warning if not listening after 30 seconds.
"""
if self.cluster.version() >= '4':
return;
self.watch_log_for("Listening for thrift clients...", **kwargs... | python | def wait_for_thrift_interface(self, **kwargs):
"""
Waits for the Thrift interface to be listening.
Emits a warning if not listening after 30 seconds.
"""
if self.cluster.version() >= '4':
return;
self.watch_log_for("Listening for thrift clients...", **kwargs... | [
"def",
"wait_for_thrift_interface",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"cluster",
".",
"version",
"(",
")",
">=",
"'4'",
":",
"return",
"self",
".",
"watch_log_for",
"(",
"\"Listening for thrift clients...\"",
",",
"*",
"*",
... | Waits for the Thrift interface to be listening.
Emits a warning if not listening after 30 seconds. | [
"Waits",
"for",
"the",
"Thrift",
"interface",
"to",
"be",
"listening",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L560-L573 |
10,195 | riptano/ccm | ccmlib/node.py | Node.wait_for_compactions | def wait_for_compactions(self, timeout=120):
"""
Wait for all compactions to finish on this node.
"""
pattern = re.compile("pending tasks: 0")
start = time.time()
while time.time() - start < timeout:
output, err, rc = self.nodetool("compactionstats")
... | python | def wait_for_compactions(self, timeout=120):
"""
Wait for all compactions to finish on this node.
"""
pattern = re.compile("pending tasks: 0")
start = time.time()
while time.time() - start < timeout:
output, err, rc = self.nodetool("compactionstats")
... | [
"def",
"wait_for_compactions",
"(",
"self",
",",
"timeout",
"=",
"120",
")",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"\"pending tasks: 0\"",
")",
"start",
"=",
"time",
".",
"time",
"(",
")",
"while",
"time",
".",
"time",
"(",
")",
"-",
"start",... | Wait for all compactions to finish on this node. | [
"Wait",
"for",
"all",
"compactions",
"to",
"finish",
"on",
"this",
"node",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L804-L815 |
10,196 | riptano/ccm | ccmlib/node.py | Node.update_startup_byteman_script | def update_startup_byteman_script(self, byteman_startup_script):
"""
Update the byteman startup script, i.e., rule injected before the node starts.
:param byteman_startup_script: the relative path to the script
:raise common.LoadError: if the node does not have byteman installed
... | python | def update_startup_byteman_script(self, byteman_startup_script):
"""
Update the byteman startup script, i.e., rule injected before the node starts.
:param byteman_startup_script: the relative path to the script
:raise common.LoadError: if the node does not have byteman installed
... | [
"def",
"update_startup_byteman_script",
"(",
"self",
",",
"byteman_startup_script",
")",
":",
"if",
"self",
".",
"byteman_port",
"==",
"'0'",
":",
"raise",
"common",
".",
"LoadError",
"(",
"'Byteman is not installed'",
")",
"self",
".",
"byteman_startup_script",
"="... | Update the byteman startup script, i.e., rule injected before the node starts.
:param byteman_startup_script: the relative path to the script
:raise common.LoadError: if the node does not have byteman installed | [
"Update",
"the",
"byteman",
"startup",
"script",
"i",
".",
"e",
".",
"rule",
"injected",
"before",
"the",
"node",
"starts",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L953-L963 |
10,197 | riptano/ccm | ccmlib/node.py | Node._find_cmd | def _find_cmd(self, cmd):
"""
Locates command under cassandra root and fixes permissions if needed
"""
cdir = self.get_install_cassandra_root()
if self.get_base_cassandra_version() >= 2.1:
fcmd = common.join_bin(cdir, os.path.join('tools', 'bin'), cmd)
else:
... | python | def _find_cmd(self, cmd):
"""
Locates command under cassandra root and fixes permissions if needed
"""
cdir = self.get_install_cassandra_root()
if self.get_base_cassandra_version() >= 2.1:
fcmd = common.join_bin(cdir, os.path.join('tools', 'bin'), cmd)
else:
... | [
"def",
"_find_cmd",
"(",
"self",
",",
"cmd",
")",
":",
"cdir",
"=",
"self",
".",
"get_install_cassandra_root",
"(",
")",
"if",
"self",
".",
"get_base_cassandra_version",
"(",
")",
">=",
"2.1",
":",
"fcmd",
"=",
"common",
".",
"join_bin",
"(",
"cdir",
","... | Locates command under cassandra root and fixes permissions if needed | [
"Locates",
"command",
"under",
"cassandra",
"root",
"and",
"fixes",
"permissions",
"if",
"needed"
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L1209-L1224 |
10,198 | riptano/ccm | ccmlib/node.py | Node.data_size | def data_size(self, live_data=None):
"""Uses `nodetool info` to get the size of a node's data in KB."""
if live_data is not None:
warnings.warn("The 'live_data' keyword argument is deprecated.",
DeprecationWarning)
output = self.nodetool('info')[0]
r... | python | def data_size(self, live_data=None):
"""Uses `nodetool info` to get the size of a node's data in KB."""
if live_data is not None:
warnings.warn("The 'live_data' keyword argument is deprecated.",
DeprecationWarning)
output = self.nodetool('info')[0]
r... | [
"def",
"data_size",
"(",
"self",
",",
"live_data",
"=",
"None",
")",
":",
"if",
"live_data",
"is",
"not",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"The 'live_data' keyword argument is deprecated.\"",
",",
"DeprecationWarning",
")",
"output",
"=",
"self",
"."... | Uses `nodetool info` to get the size of a node's data in KB. | [
"Uses",
"nodetool",
"info",
"to",
"get",
"the",
"size",
"of",
"a",
"node",
"s",
"data",
"in",
"KB",
"."
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L1338-L1344 |
10,199 | riptano/ccm | ccmlib/node.py | Node.get_sstable_data_files | def get_sstable_data_files(self, ks, table):
"""
Read sstable data files by using sstableutil, so we ignore temporary files
"""
p = self.get_sstable_data_files_process(ks=ks, table=table)
out, _, _ = handle_external_tool_process(p, ["sstableutil", '--type', 'final', ks, table])
... | python | def get_sstable_data_files(self, ks, table):
"""
Read sstable data files by using sstableutil, so we ignore temporary files
"""
p = self.get_sstable_data_files_process(ks=ks, table=table)
out, _, _ = handle_external_tool_process(p, ["sstableutil", '--type', 'final', ks, table])
... | [
"def",
"get_sstable_data_files",
"(",
"self",
",",
"ks",
",",
"table",
")",
":",
"p",
"=",
"self",
".",
"get_sstable_data_files_process",
"(",
"ks",
"=",
"ks",
",",
"table",
"=",
"table",
")",
"out",
",",
"_",
",",
"_",
"=",
"handle_external_tool_process",... | Read sstable data files by using sstableutil, so we ignore temporary files | [
"Read",
"sstable",
"data",
"files",
"by",
"using",
"sstableutil",
"so",
"we",
"ignore",
"temporary",
"files"
] | 275699f79d102b5039b79cc17fa6305dccf18412 | https://github.com/riptano/ccm/blob/275699f79d102b5039b79cc17fa6305dccf18412/ccmlib/node.py#L2005-L2013 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.