repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
zhemao/funktown | funktown/dictionary.py | ImmutableDict.remove | def remove(self, key):
'''Returns a new ImmutableDict with the given key removed.'''
copydict = ImmutableDict()
copydict.tree = self.tree.remove(hash(key))
copydict._length = self._length - 1
return copydict | python | def remove(self, key):
'''Returns a new ImmutableDict with the given key removed.'''
copydict = ImmutableDict()
copydict.tree = self.tree.remove(hash(key))
copydict._length = self._length - 1
return copydict | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"copydict",
"=",
"ImmutableDict",
"(",
")",
"copydict",
".",
"tree",
"=",
"self",
".",
"tree",
".",
"remove",
"(",
"hash",
"(",
"key",
")",
")",
"copydict",
".",
"_length",
"=",
"self",
".",
"_len... | Returns a new ImmutableDict with the given key removed. | [
"Returns",
"a",
"new",
"ImmutableDict",
"with",
"the",
"given",
"key",
"removed",
"."
] | 8d5c5a8bdad2b85b33b4cea3febd820c2657c375 | https://github.com/zhemao/funktown/blob/8d5c5a8bdad2b85b33b4cea3febd820c2657c375/funktown/dictionary.py#L44-L49 | train | Returns a new ImmutableDict with the given key removed. |
thiagokokada/livedumper | src/livedumper/dumper.py | LivestreamerDumper.open | def open(self, url, quality):
"""Attempt to open stream from *url*.
Exits with '-1' (using self.exit()) in case of error, including
an error msg.
"""
self.original_url = url
try:
self.livestreamer = Livestreamer()
self._load_config()
... | python | def open(self, url, quality):
"""Attempt to open stream from *url*.
Exits with '-1' (using self.exit()) in case of error, including
an error msg.
"""
self.original_url = url
try:
self.livestreamer = Livestreamer()
self._load_config()
... | [
"def",
"open",
"(",
"self",
",",
"url",
",",
"quality",
")",
":",
"self",
".",
"original_url",
"=",
"url",
"try",
":",
"self",
".",
"livestreamer",
"=",
"Livestreamer",
"(",
")",
"self",
".",
"_load_config",
"(",
")",
"streams",
"=",
"self",
".",
"li... | Attempt to open stream from *url*.
Exits with '-1' (using self.exit()) in case of error, including
an error msg. | [
"Attempt",
"to",
"open",
"stream",
"from",
"*",
"url",
"*",
"."
] | f6441283269b4a602cafea3be5cda9446fc64005 | https://github.com/thiagokokada/livedumper/blob/f6441283269b4a602cafea3be5cda9446fc64005/src/livedumper/dumper.py#L86-L114 | train | Attempt to open stream from url. |
thiagokokada/livedumper | src/livedumper/dumper.py | LivestreamerDumper._load_config | def _load_config(self):
"Load and parse config file, pass options to livestreamer"
config = SafeConfigParser()
config_file = os.path.join(self.config_path, 'settings.ini')
config.read(config_file)
for option, type in list(AVAILABLE_OPTIONS.items()):
if confi... | python | def _load_config(self):
"Load and parse config file, pass options to livestreamer"
config = SafeConfigParser()
config_file = os.path.join(self.config_path, 'settings.ini')
config.read(config_file)
for option, type in list(AVAILABLE_OPTIONS.items()):
if confi... | [
"def",
"_load_config",
"(",
"self",
")",
":",
"config",
"=",
"SafeConfigParser",
"(",
")",
"config_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config_path",
",",
"'settings.ini'",
")",
"config",
".",
"read",
"(",
"config_file",
")",
"f... | Load and parse config file, pass options to livestreamer | [
"Load",
"and",
"parse",
"config",
"file",
"pass",
"options",
"to",
"livestreamer"
] | f6441283269b4a602cafea3be5cda9446fc64005 | https://github.com/thiagokokada/livedumper/blob/f6441283269b4a602cafea3be5cda9446fc64005/src/livedumper/dumper.py#L116-L134 | train | Load and parse config file pass options to livestreamer |
thiagokokada/livedumper | src/livedumper/dumper.py | LivestreamerDumper.get_title | def get_title(self):
"""Returns the filename from URL (including extension), that
may be:
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'[Hatsune Miku] After Rain Sweet*Drops [English Sub] -
YouTube.mp4'
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'watch_v=Z... | python | def get_title(self):
"""Returns the filename from URL (including extension), that
may be:
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'[Hatsune Miku] After Rain Sweet*Drops [English Sub] -
YouTube.mp4'
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'watch_v=Z... | [
"def",
"get_title",
"(",
"self",
")",
":",
"stream_type",
"=",
"self",
".",
"stream",
".",
"__class__",
".",
"__name__",
"try",
":",
"extension",
"=",
"VIDEO_EXTENSIONS",
"[",
"stream_type",
"]",
"except",
"KeyError",
":",
"print",
"(",
"'No extension found...... | Returns the filename from URL (including extension), that
may be:
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'[Hatsune Miku] After Rain Sweet*Drops [English Sub] -
YouTube.mp4'
https://www.youtube.com/watch?v=ZEtEH-GIAJE ->
'watch_v=ZEtEH-GIAJE.mp4'
The for... | [
"Returns",
"the",
"filename",
"from",
"URL",
"(",
"including",
"extension",
")",
"that",
"may",
"be",
":"
] | f6441283269b4a602cafea3be5cda9446fc64005 | https://github.com/thiagokokada/livedumper/blob/f6441283269b4a602cafea3be5cda9446fc64005/src/livedumper/dumper.py#L137-L190 | train | Returns the title of the current page. |
thiagokokada/livedumper | src/livedumper/dumper.py | LivestreamerDumper.dump | def dump(self, filepath):
"Attempt to dump an opened stream to path *filepath*."
common.ask_overwrite(filepath)
filename = os.path.basename(filepath)
file_size = 0
with open(filepath, 'ab') as f:
try:
while True:
buf = self.fd.rea... | python | def dump(self, filepath):
"Attempt to dump an opened stream to path *filepath*."
common.ask_overwrite(filepath)
filename = os.path.basename(filepath)
file_size = 0
with open(filepath, 'ab') as f:
try:
while True:
buf = self.fd.rea... | [
"def",
"dump",
"(",
"self",
",",
"filepath",
")",
":",
"common",
".",
"ask_overwrite",
"(",
"filepath",
")",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filepath",
")",
"file_size",
"=",
"0",
"with",
"open",
"(",
"filepath",
",",
"'ab'",... | Attempt to dump an opened stream to path *filepath*. | [
"Attempt",
"to",
"dump",
"an",
"opened",
"stream",
"to",
"path",
"*",
"filepath",
"*",
"."
] | f6441283269b4a602cafea3be5cda9446fc64005 | https://github.com/thiagokokada/livedumper/blob/f6441283269b4a602cafea3be5cda9446fc64005/src/livedumper/dumper.py#L206-L226 | train | Attempt to dump an opened stream to path filepath *. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/text.py | PrototypeCtsNode.urn | def urn(self, value: Union[URN, str]):
""" Set the urn
:param value: URN to be saved
:raises: *TypeError* when the value is not URN compatible
"""
if isinstance(value, str):
value = URN(value)
elif not isinstance(value, URN):
raise TypeError("New... | python | def urn(self, value: Union[URN, str]):
""" Set the urn
:param value: URN to be saved
:raises: *TypeError* when the value is not URN compatible
"""
if isinstance(value, str):
value = URN(value)
elif not isinstance(value, URN):
raise TypeError("New... | [
"def",
"urn",
"(",
"self",
",",
"value",
":",
"Union",
"[",
"URN",
",",
"str",
"]",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"URN",
"(",
"value",
")",
"elif",
"not",
"isinstance",
"(",
"value",
",",
"URN",
... | Set the urn
:param value: URN to be saved
:raises: *TypeError* when the value is not URN compatible | [
"Set",
"the",
"urn"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L55-L66 | train | Set the urn of the current object |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/text.py | PrototypeCtsNode.get_cts_metadata | def get_cts_metadata(self, key: str, lang: str = None) -> Literal:
""" Get easily a metadata from the CTS namespace
:param key: CTS property to retrieve
:param lang: Language in which it should be
:return: Literal value of the CTS graph property
"""
return self.metadata.... | python | def get_cts_metadata(self, key: str, lang: str = None) -> Literal:
""" Get easily a metadata from the CTS namespace
:param key: CTS property to retrieve
:param lang: Language in which it should be
:return: Literal value of the CTS graph property
"""
return self.metadata.... | [
"def",
"get_cts_metadata",
"(",
"self",
",",
"key",
":",
"str",
",",
"lang",
":",
"str",
"=",
"None",
")",
"->",
"Literal",
":",
"return",
"self",
".",
"metadata",
".",
"get_single",
"(",
"RDF_NAMESPACES",
".",
"CTS",
".",
"term",
"(",
"key",
")",
",... | Get easily a metadata from the CTS namespace
:param key: CTS property to retrieve
:param lang: Language in which it should be
:return: Literal value of the CTS graph property | [
"Get",
"easily",
"a",
"metadata",
"from",
"the",
"CTS",
"namespace"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L68-L75 | train | Get easily a metadata from the CTS namespace |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/text.py | PrototypeCtsNode.set_metadata_from_collection | def set_metadata_from_collection(self, text_metadata: CtsTextMetadata):
""" Set the object metadata using its collections recursively
:param text_metadata: Object representing the current text as a collection
:type text_metadata: CtsEditionMetadata or CtsTranslationMetadata
"""
... | python | def set_metadata_from_collection(self, text_metadata: CtsTextMetadata):
""" Set the object metadata using its collections recursively
:param text_metadata: Object representing the current text as a collection
:type text_metadata: CtsEditionMetadata or CtsTranslationMetadata
"""
... | [
"def",
"set_metadata_from_collection",
"(",
"self",
",",
"text_metadata",
":",
"CtsTextMetadata",
")",
":",
"edition",
",",
"work",
",",
"textgroup",
"=",
"tuple",
"(",
"(",
"[",
"text_metadata",
"]",
"+",
"text_metadata",
".",
"parents",
")",
"[",
":",
"3",... | Set the object metadata using its collections recursively
:param text_metadata: Object representing the current text as a collection
:type text_metadata: CtsEditionMetadata or CtsTranslationMetadata | [
"Set",
"the",
"object",
"metadata",
"using",
"its",
"collections",
"recursively"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L94-L123 | train | Set the object metadata using its collections recursively |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/text.py | PrototypeCtsText.reffs | def reffs(self) -> BaseReferenceSet:
""" Get all valid reffs for every part of the CtsText
:rtype: [str]
"""
if not self._cts:
self._cts = BaseReferenceSet(
[reff for reffs in [self.getReffs(level=i) for i in range(1, len(self.citation) + 1)] for reff in reff... | python | def reffs(self) -> BaseReferenceSet:
""" Get all valid reffs for every part of the CtsText
:rtype: [str]
"""
if not self._cts:
self._cts = BaseReferenceSet(
[reff for reffs in [self.getReffs(level=i) for i in range(1, len(self.citation) + 1)] for reff in reff... | [
"def",
"reffs",
"(",
"self",
")",
"->",
"BaseReferenceSet",
":",
"if",
"not",
"self",
".",
"_cts",
":",
"self",
".",
"_cts",
"=",
"BaseReferenceSet",
"(",
"[",
"reff",
"for",
"reffs",
"in",
"[",
"self",
".",
"getReffs",
"(",
"level",
"=",
"i",
")",
... | Get all valid reffs for every part of the CtsText
:rtype: [str] | [
"Get",
"all",
"valid",
"reffs",
"for",
"every",
"part",
"of",
"the",
"CtsText"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/text.py#L165-L174 | train | Get all valid reffs for every part of the CtsText |
hawkular/hawkular-client-python | hawkular/metrics.py | create_datapoint | def create_datapoint(value, timestamp=None, **tags):
"""
Creates a single datapoint dict with a value, timestamp and tags.
:param value: Value of the datapoint. Type depends on the id's MetricType
:param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond ac... | python | def create_datapoint(value, timestamp=None, **tags):
"""
Creates a single datapoint dict with a value, timestamp and tags.
:param value: Value of the datapoint. Type depends on the id's MetricType
:param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond ac... | [
"def",
"create_datapoint",
"(",
"value",
",",
"timestamp",
"=",
"None",
",",
"*",
"*",
"tags",
")",
":",
"if",
"timestamp",
"is",
"None",
":",
"timestamp",
"=",
"time_millis",
"(",
")",
"if",
"type",
"(",
"timestamp",
")",
"is",
"datetime",
":",
"times... | Creates a single datapoint dict with a value, timestamp and tags.
:param value: Value of the datapoint. Type depends on the id's MetricType
:param timestamp: Optional timestamp of the datapoint. Uses client current time if not set. Millisecond accuracy. Can be datetime instance also.
:param tags: Optional ... | [
"Creates",
"a",
"single",
"datapoint",
"dict",
"with",
"a",
"value",
"timestamp",
"and",
"tags",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L362-L382 | train | Creates a single datapoint dict with a value timestamp and tags. |
hawkular/hawkular-client-python | hawkular/metrics.py | create_metric | def create_metric(metric_type, metric_id, data):
"""
Create Hawkular-Metrics' submittable structure.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param data: A datapoint or a list of datapoints created with create_datapoint(value, timest... | python | def create_metric(metric_type, metric_id, data):
"""
Create Hawkular-Metrics' submittable structure.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param data: A datapoint or a list of datapoints created with create_datapoint(value, timest... | [
"def",
"create_metric",
"(",
"metric_type",
",",
"metric_id",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"data",
"=",
"[",
"data",
"]",
"return",
"{",
"'type'",
":",
"metric_type",
",",
"'id'",
":",
"metric_id... | Create Hawkular-Metrics' submittable structure.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param data: A datapoint or a list of datapoints created with create_datapoint(value, timestamp, tags) | [
"Create",
"Hawkular",
"-",
"Metrics",
"submittable",
"structure",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L384-L395 | train | Create Hawkular - Metrics submittable structure. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.put | def put(self, data):
"""
Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture
of types.
:param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints)
"""
if not isinstance(data, list):
... | python | def put(self, data):
"""
Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture
of types.
:param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints)
"""
if not isinstance(data, list):
... | [
"def",
"put",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"data",
"=",
"[",
"data",
"]",
"r",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"d",
"in",
"data",
":",
"metric_... | Send multiple different metric_ids to the server in a single batch. Metrics can be a mixture
of types.
:param data: A dict or a list of dicts created with create_metric(metric_type, metric_id, datapoints) | [
"Send",
"multiple",
"different",
"metric_ids",
"to",
"the",
"server",
"in",
"a",
"single",
"batch",
".",
"Metrics",
"can",
"be",
"a",
"mixture",
"of",
"types",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L109-L129 | train | Send multiple different metric_ids to the server in a single batch. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.push | def push(self, metric_type, metric_id, value, timestamp=None):
"""
Pushes a single metric_id, datapoint combination to the server.
This method is an assistant method for the put method by removing the need to
create data structures first.
:param metric_type: MetricType to be ma... | python | def push(self, metric_type, metric_id, value, timestamp=None):
"""
Pushes a single metric_id, datapoint combination to the server.
This method is an assistant method for the put method by removing the need to
create data structures first.
:param metric_type: MetricType to be ma... | [
"def",
"push",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
",",
"value",
",",
"timestamp",
"=",
"None",
")",
":",
"if",
"type",
"(",
"timestamp",
")",
"is",
"datetime",
":",
"timestamp",
"=",
"datetime_to_time_millis",
"(",
"timestamp",
")",
"item",... | Pushes a single metric_id, datapoint combination to the server.
This method is an assistant method for the put method by removing the need to
create data structures first.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
... | [
"Pushes",
"a",
"single",
"metric_id",
"datapoint",
"combination",
"to",
"the",
"server",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L131-L147 | train | Pushes a single metric_id datapoint combination to the server. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_metric | def query_metric(self, metric_type, metric_id, start=None, end=None, **query_options):
"""
Query for metrics datapoints from the server.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param start: Milliseconds since epo... | python | def query_metric(self, metric_type, metric_id, start=None, end=None, **query_options):
"""
Query for metrics datapoints from the server.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param start: Milliseconds since epo... | [
"def",
"query_metric",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"*",
"*",
"query_options",
")",
":",
"if",
"start",
"is",
"not",
"None",
":",
"if",
"type",
"(",
"start",
")",
"is",
... | Query for metrics datapoints from the server.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param start: Milliseconds since epoch or datetime instance
:param end: Milliseconds since epoch or datetime instance
:param qu... | [
"Query",
"for",
"metrics",
"datapoints",
"from",
"the",
"server",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L149-L174 | train | Query the Hawkular - Metrics API for a single metric. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_metric_stats | def query_metric_stats(self, metric_type, metric_id=None, start=None, end=None, bucketDuration=None, **query_options):
"""
Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation.
:param metric_type: MetricType to be matched (required)
:... | python | def query_metric_stats(self, metric_type, metric_id=None, start=None, end=None, bucketDuration=None, **query_options):
"""
Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation.
:param metric_type: MetricType to be matched (required)
:... | [
"def",
"query_metric_stats",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"bucketDuration",
"=",
"None",
",",
"*",
"*",
"query_options",
")",
":",
"if",
"start",
"is",
"not",
"... | Query for metric aggregates from the server. This is called buckets in the Hawkular-Metrics documentation.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id or None for tags matching only
:param start: Milliseconds since epoch or datetime ... | [
"Query",
"for",
"metric",
"aggregates",
"from",
"the",
"server",
".",
"This",
"is",
"called",
"buckets",
"in",
"the",
"Hawkular",
"-",
"Metrics",
"documentation",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L176-L212 | train | Query for metric aggregates from the server. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_metric_definition | def query_metric_definition(self, metric_type, metric_id):
"""
Query definition of a single metric id.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
"""
return self._get(self._get_metrics_single_url(metric_type,... | python | def query_metric_definition(self, metric_type, metric_id):
"""
Query definition of a single metric id.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
"""
return self._get(self._get_metrics_single_url(metric_type,... | [
"def",
"query_metric_definition",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
")",
":",
"return",
"self",
".",
"_get",
"(",
"self",
".",
"_get_metrics_single_url",
"(",
"metric_type",
",",
"metric_id",
")",
")"
] | Query definition of a single metric id.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id | [
"Query",
"definition",
"of",
"a",
"single",
"metric",
"id",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L214-L221 | train | Query the definition of a single metric id. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_metric_definitions | def query_metric_definitions(self, metric_type=None, id_filter=None, **tags):
"""
Query available metric definitions.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param id_filter: Filter the id with regexp is tag filtering is used, otherw... | python | def query_metric_definitions(self, metric_type=None, id_filter=None, **tags):
"""
Query available metric definitions.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param id_filter: Filter the id with regexp is tag filtering is used, otherw... | [
"def",
"query_metric_definitions",
"(",
"self",
",",
"metric_type",
"=",
"None",
",",
"id_filter",
"=",
"None",
",",
"*",
"*",
"tags",
")",
":",
"params",
"=",
"{",
"}",
"if",
"id_filter",
"is",
"not",
"None",
":",
"params",
"[",
"'id'",
"]",
"=",
"i... | Query available metric definitions.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param id_filter: Filter the id with regexp is tag filtering is used, otherwise a list of exact metric ids
:param tags: A dict of tag key/value pairs. Uses Hawkular-M... | [
"Query",
"available",
"metric",
"definitions",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L223-L242 | train | Query available metric definitions. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_tag_values | def query_tag_values(self, metric_type=None, **tags):
"""
Query for possible tag values.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax
"... | python | def query_tag_values(self, metric_type=None, **tags):
"""
Query for possible tag values.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax
"... | [
"def",
"query_tag_values",
"(",
"self",
",",
"metric_type",
"=",
"None",
",",
"*",
"*",
"tags",
")",
":",
"tagql",
"=",
"self",
".",
"_transform_tags",
"(",
"*",
"*",
"tags",
")",
"return",
"self",
".",
"_get",
"(",
"self",
".",
"_get_metrics_tags_url",
... | Query for possible tag values.
:param metric_type: A MetricType to be queried. If left to None, matches all the MetricTypes
:param tags: A dict of tag key/value pairs. Uses Hawkular-Metrics tag query language for syntax | [
"Query",
"for",
"possible",
"tag",
"values",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L244-L253 | train | Query for possible tag values. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.create_metric_definition | def create_metric_definition(self, metric_type, metric_id, **tags):
"""
Create metric definition with custom definition. **tags should be a set of tags, such as
units, env ..
:param metric_type: MetricType of the new definition
:param metric_id: metric_id is the string index of ... | python | def create_metric_definition(self, metric_type, metric_id, **tags):
"""
Create metric definition with custom definition. **tags should be a set of tags, such as
units, env ..
:param metric_type: MetricType of the new definition
:param metric_id: metric_id is the string index of ... | [
"def",
"create_metric_definition",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
",",
"*",
"*",
"tags",
")",
":",
"item",
"=",
"{",
"'id'",
":",
"metric_id",
"}",
"if",
"len",
"(",
"tags",
")",
">",
"0",
":",
"# We have some arguments to pass..",
"dat... | Create metric definition with custom definition. **tags should be a set of tags, such as
units, env ..
:param metric_type: MetricType of the new definition
:param metric_id: metric_id is the string index of the created metric
:param tags: Key/Value tag values of the new metric | [
"Create",
"metric",
"definition",
"with",
"custom",
"definition",
".",
"**",
"tags",
"should",
"be",
"a",
"set",
"of",
"tags",
"such",
"as",
"units",
"env",
".."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L255-L282 | train | Create a metric definition with custom definition. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.query_metric_tags | def query_metric_tags(self, metric_type, metric_id):
"""
Returns a list of tags in the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
"""
definition = self._get(self._get_metrics_tags_url(self.... | python | def query_metric_tags(self, metric_type, metric_id):
"""
Returns a list of tags in the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
"""
definition = self._get(self._get_metrics_tags_url(self.... | [
"def",
"query_metric_tags",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
")",
":",
"definition",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_get_metrics_tags_url",
"(",
"self",
".",
"_get_metrics_single_url",
"(",
"metric_type",
",",
"metric_id",
")",
... | Returns a list of tags in the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id | [
"Returns",
"a",
"list",
"of",
"tags",
"in",
"the",
"metric",
"definition",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L284-L292 | train | Query the metric definition for tags. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.update_metric_tags | def update_metric_tags(self, metric_type, metric_id, **tags):
"""
Replace the metric_id's tags with given **tags
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param tags: Updated key/value tag values of the metric
... | python | def update_metric_tags(self, metric_type, metric_id, **tags):
"""
Replace the metric_id's tags with given **tags
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param tags: Updated key/value tag values of the metric
... | [
"def",
"update_metric_tags",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
",",
"*",
"*",
"tags",
")",
":",
"self",
".",
"_put",
"(",
"self",
".",
"_get_metrics_tags_url",
"(",
"self",
".",
"_get_metrics_single_url",
"(",
"metric_type",
",",
"metric_id",
... | Replace the metric_id's tags with given **tags
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param tags: Updated key/value tag values of the metric | [
"Replace",
"the",
"metric_id",
"s",
"tags",
"with",
"given",
"**",
"tags"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L294-L302 | train | Update the tags of the metric_id with the given tags. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.delete_metric_tags | def delete_metric_tags(self, metric_type, metric_id, **deleted_tags):
"""
Delete one or more tags from the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param deleted_tags: List of deleted tag names.... | python | def delete_metric_tags(self, metric_type, metric_id, **deleted_tags):
"""
Delete one or more tags from the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param deleted_tags: List of deleted tag names.... | [
"def",
"delete_metric_tags",
"(",
"self",
",",
"metric_type",
",",
"metric_id",
",",
"*",
"*",
"deleted_tags",
")",
":",
"tags",
"=",
"self",
".",
"_transform_tags",
"(",
"*",
"*",
"deleted_tags",
")",
"tags_url",
"=",
"self",
".",
"_get_metrics_tags_url",
"... | Delete one or more tags from the metric definition.
:param metric_type: MetricType to be matched (required)
:param metric_id: Exact string matching metric id
:param deleted_tags: List of deleted tag names. Values can be set to anything | [
"Delete",
"one",
"or",
"more",
"tags",
"from",
"the",
"metric",
"definition",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L304-L315 | train | Delete one or more tags from the metric definition. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.create_tenant | def create_tenant(self, tenant_id, retentions=None):
"""
Create a tenant. Currently nothing can be set (to be fixed after the master
version of Hawkular-Metrics has fixed implementation.
:param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info
... | python | def create_tenant(self, tenant_id, retentions=None):
"""
Create a tenant. Currently nothing can be set (to be fixed after the master
version of Hawkular-Metrics has fixed implementation.
:param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info
... | [
"def",
"create_tenant",
"(",
"self",
",",
"tenant_id",
",",
"retentions",
"=",
"None",
")",
":",
"item",
"=",
"{",
"'id'",
":",
"tenant_id",
"}",
"if",
"retentions",
"is",
"not",
"None",
":",
"item",
"[",
"'retentions'",
"]",
"=",
"retentions",
"self",
... | Create a tenant. Currently nothing can be set (to be fixed after the master
version of Hawkular-Metrics has fixed implementation.
:param retentions: A set of retention settings, see Hawkular-Metrics documentation for more info | [
"Create",
"a",
"tenant",
".",
"Currently",
"nothing",
"can",
"be",
"set",
"(",
"to",
"be",
"fixed",
"after",
"the",
"master",
"version",
"of",
"Hawkular",
"-",
"Metrics",
"has",
"fixed",
"implementation",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L327-L338 | train | Create a tenant. |
hawkular/hawkular-client-python | hawkular/metrics.py | HawkularMetricsClient.delete_tenant | def delete_tenant(self, tenant_id):
"""
Asynchronously deletes a tenant and all the data associated with the tenant.
:param tenant_id: Tenant id to be sent for deletion process
"""
self._delete(self._get_single_id_url(self._get_tenants_url(), tenant_id)) | python | def delete_tenant(self, tenant_id):
"""
Asynchronously deletes a tenant and all the data associated with the tenant.
:param tenant_id: Tenant id to be sent for deletion process
"""
self._delete(self._get_single_id_url(self._get_tenants_url(), tenant_id)) | [
"def",
"delete_tenant",
"(",
"self",
",",
"tenant_id",
")",
":",
"self",
".",
"_delete",
"(",
"self",
".",
"_get_single_id_url",
"(",
"self",
".",
"_get_tenants_url",
"(",
")",
",",
"tenant_id",
")",
")"
] | Asynchronously deletes a tenant and all the data associated with the tenant.
:param tenant_id: Tenant id to be sent for deletion process | [
"Asynchronously",
"deletes",
"a",
"tenant",
"and",
"all",
"the",
"data",
"associated",
"with",
"the",
"tenant",
".",
":",
"param",
"tenant_id",
":",
"Tenant",
"id",
"to",
"be",
"sent",
"for",
"deletion",
"process"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/metrics.py#L340-L345 | train | Asynchronously deletes a single tenant and all the data associated with the tenant. |
aiidateam/aiida-codtools | aiida_codtools/common/resources.py | get_default_options | def get_default_options(num_machines=1, max_wallclock_seconds=1800, withmpi=False):
"""
Return an instance of the options dictionary with the minimally required parameters
for a JobCalculation and set to default values unless overriden
:param num_machines: set the number of nodes, default=1
:param ... | python | def get_default_options(num_machines=1, max_wallclock_seconds=1800, withmpi=False):
"""
Return an instance of the options dictionary with the minimally required parameters
for a JobCalculation and set to default values unless overriden
:param num_machines: set the number of nodes, default=1
:param ... | [
"def",
"get_default_options",
"(",
"num_machines",
"=",
"1",
",",
"max_wallclock_seconds",
"=",
"1800",
",",
"withmpi",
"=",
"False",
")",
":",
"return",
"{",
"'resources'",
":",
"{",
"'num_machines'",
":",
"int",
"(",
"num_machines",
")",
"}",
",",
"'max_wa... | Return an instance of the options dictionary with the minimally required parameters
for a JobCalculation and set to default values unless overriden
:param num_machines: set the number of nodes, default=1
:param max_wallclock_seconds: set the maximum number of wallclock seconds, default=1800
:param with... | [
"Return",
"an",
"instance",
"of",
"the",
"options",
"dictionary",
"with",
"the",
"minimally",
"required",
"parameters",
"for",
"a",
"JobCalculation",
"and",
"set",
"to",
"default",
"values",
"unless",
"overriden"
] | da5e4259b7a2e86cf0cc3f997e11dd36d445fa94 | https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/common/resources.py#L5-L20 | train | Returns a dictionary with the minimally required parameters
for a JobCalculation and set to default values unless overriden
is True |
aloetesting/aloe_webdriver | aloe_webdriver/screenshot_failed.py | take_screenshot | def take_screenshot(self):
"""Take a screenshot after a failed step."""
if not self.failed:
return
browser = getattr(world, 'browser', None)
if not browser:
return
try:
scenario_name = self.scenario.name
scenario_index = \
self.scenario.feature.scenario... | python | def take_screenshot(self):
"""Take a screenshot after a failed step."""
if not self.failed:
return
browser = getattr(world, 'browser', None)
if not browser:
return
try:
scenario_name = self.scenario.name
scenario_index = \
self.scenario.feature.scenario... | [
"def",
"take_screenshot",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"failed",
":",
"return",
"browser",
"=",
"getattr",
"(",
"world",
",",
"'browser'",
",",
"None",
")",
"if",
"not",
"browser",
":",
"return",
"try",
":",
"scenario_name",
"=",
"s... | Take a screenshot after a failed step. | [
"Take",
"a",
"screenshot",
"after",
"a",
"failed",
"step",
"."
] | 65d847da4bdc63f9c015cb19d4efdee87df8ffad | https://github.com/aloetesting/aloe_webdriver/blob/65d847da4bdc63f9c015cb19d4efdee87df8ffad/aloe_webdriver/screenshot_failed.py#L64-L100 | train | Take a screenshot after a failed step. |
SHDShim/pytheos | pytheos/eqn_kunc.py | kunc_p | def kunc_p(v, v0, k0, k0p, order=5):
"""
calculate Kunc EOS
see Dorogokupets 2015 for detail
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at reference conditions
... | python | def kunc_p(v, v0, k0, k0p, order=5):
"""
calculate Kunc EOS
see Dorogokupets 2015 for detail
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at reference conditions
... | [
"def",
"kunc_p",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"5",
")",
":",
"return",
"cal_p_kunc",
"(",
"v",
",",
"[",
"v0",
",",
"k0",
",",
"k0p",
"]",
",",
"order",
"=",
"order",
",",
"uncertainties",
"=",
"isuncertainties",... | calculate Kunc EOS
see Dorogokupets 2015 for detail
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at reference conditions
:param order: order for the Kunc equation
... | [
"calculate",
"Kunc",
"EOS",
"see",
"Dorogokupets",
"2015",
"for",
"detail"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L13-L26 | train | calculate Kunc EOS
|
SHDShim/pytheos | pytheos/eqn_kunc.py | cal_p_kunc | def cal_p_kunc(v, k, order=5, uncertainties=True):
"""
calculate Kunc EOS,
see Dorogokupets2015 for functional form
:param v: unit-cell volume in A^3
:param k: [v0, k0, k0p]
:param order: order for the Kunc equation
:param uncertainties: use of uncertainties package
:return: pressure in... | python | def cal_p_kunc(v, k, order=5, uncertainties=True):
"""
calculate Kunc EOS,
see Dorogokupets2015 for functional form
:param v: unit-cell volume in A^3
:param k: [v0, k0, k0p]
:param order: order for the Kunc equation
:param uncertainties: use of uncertainties package
:return: pressure in... | [
"def",
"cal_p_kunc",
"(",
"v",
",",
"k",
",",
"order",
"=",
"5",
",",
"uncertainties",
"=",
"True",
")",
":",
"v0",
"=",
"k",
"[",
"0",
"]",
"k0",
"=",
"k",
"[",
"1",
"]",
"k0p",
"=",
"k",
"[",
"2",
"]",
"x",
"=",
"np",
".",
"power",
"(",... | calculate Kunc EOS,
see Dorogokupets2015 for functional form
:param v: unit-cell volume in A^3
:param k: [v0, k0, k0p]
:param order: order for the Kunc equation
:param uncertainties: use of uncertainties package
:return: pressure in GPa
:note: internal function | [
"calculate",
"Kunc",
"EOS",
"see",
"Dorogokupets2015",
"for",
"functional",
"form"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L29-L51 | train | calculate pressure in Kunc EOS |
SHDShim/pytheos | pytheos/eqn_kunc.py | kunc_v_single | def kunc_v_single(p, v0, k0, k0p, order=5, min_strain=0.01):
"""
find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at ... | python | def kunc_v_single(p, v0, k0, k0p, order=5, min_strain=0.01):
"""
find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at ... | [
"def",
"kunc_v_single",
"(",
"p",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"5",
",",
"min_strain",
"=",
"0.01",
")",
":",
"if",
"p",
"<=",
"1.e-5",
":",
"return",
"v0",
"def",
"f_diff",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
... | find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at reference conditions
:param order: order of Kunc function
:param ... | [
"find",
"volume",
"at",
"given",
"pressure",
"using",
"brenth",
"in",
"scipy",
".",
"optimize"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L54-L72 | train | find volume at given pressure using brenth in scipy. optimize
|
SHDShim/pytheos | pytheos/eqn_kunc.py | kunc_v | def kunc_v(p, v0, k0, k0p, order=5, min_strain=0.01):
"""
find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at referen... | python | def kunc_v(p, v0, k0, k0p, order=5, min_strain=0.01):
"""
find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at referen... | [
"def",
"kunc_v",
"(",
"p",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"5",
",",
"min_strain",
"=",
"0.01",
")",
":",
"if",
"isuncertainties",
"(",
"[",
"p",
",",
"v0",
",",
"k0",
",",
"k0p",
"]",
")",
":",
"f_u",
"=",
"np",
".",
"... | find volume at given pressure using brenth in scipy.optimize
:param p: pressure in GPa
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at reference conditions
:param order: order of Kunc function
:param ... | [
"find",
"volume",
"at",
"given",
"pressure",
"using",
"brenth",
"in",
"scipy",
".",
"optimize"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L75-L93 | train | find volume at given pressure using a Kunc function |
SHDShim/pytheos | pytheos/eqn_kunc.py | kunc_dPdV | def kunc_dPdV(v, v0, k0, k0p, order=5, precision=1.e-5):
"""
calculate dP/dV for numerical calculation of bulk modulus
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at referenc... | python | def kunc_dPdV(v, v0, k0, k0p, order=5, precision=1.e-5):
"""
calculate dP/dV for numerical calculation of bulk modulus
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at referenc... | [
"def",
"kunc_dPdV",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"5",
",",
"precision",
"=",
"1.e-5",
")",
":",
"def",
"f_scalar",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"order",
",",
"precision",
"=",
... | calculate dP/dV for numerical calculation of bulk modulus
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus at r... | [
"calculate",
"dP",
"/",
"dV",
"for",
"numerical",
"calculation",
"of",
"bulk",
"modulus",
"according",
"to",
"test",
"this",
"differs",
"from",
"analytical",
"result",
"by",
"1",
".",
"e",
"-",
"5"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L114-L130 | train | calculate dP / dV for bulk modulus at reference conditions |
SHDShim/pytheos | pytheos/eqn_kunc.py | kunc_k_num | def kunc_k_num(v, v0, k0, k0p, order=5, precision=1.e-5):
"""
calculate bulk modulus numerically from volume, not pressure
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at refe... | python | def kunc_k_num(v, v0, k0, k0p, order=5, precision=1.e-5):
"""
calculate bulk modulus numerically from volume, not pressure
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at refe... | [
"def",
"kunc_k_num",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",
"5",
",",
"precision",
"=",
"1.e-5",
")",
":",
"return",
"-",
"1.",
"*",
"v",
"*",
"kunc_dPdV",
"(",
"v",
",",
"v0",
",",
"k0",
",",
"k0p",
",",
"order",
"=",... | calculate bulk modulus numerically from volume, not pressure
according to test this differs from analytical result by 1.e-5
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param k0: bulk modulus at reference conditions
:param k0p: pressure derivative of bulk modulus a... | [
"calculate",
"bulk",
"modulus",
"numerically",
"from",
"volume",
"not",
"pressure",
"according",
"to",
"test",
"this",
"differs",
"from",
"analytical",
"result",
"by",
"1",
".",
"e",
"-",
"5"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_kunc.py#L133-L146 | train | calculate bulk modulus numerically from volume not pressure
|
totalgood/twip | twip/futil.py | path_status | def path_status(path, filename='', status=None, verbosity=0):
""" Retrieve the access, modify, and create timetags for a path along with its size
Arguments:
path (str): full path to the file or directory to be statused
status (dict): optional existing status to be updated/overwritten with new s... | python | def path_status(path, filename='', status=None, verbosity=0):
""" Retrieve the access, modify, and create timetags for a path along with its size
Arguments:
path (str): full path to the file or directory to be statused
status (dict): optional existing status to be updated/overwritten with new s... | [
"def",
"path_status",
"(",
"path",
",",
"filename",
"=",
"''",
",",
"status",
"=",
"None",
",",
"verbosity",
"=",
"0",
")",
":",
"status",
"=",
"status",
"or",
"{",
"}",
"if",
"not",
"filename",
":",
"dir_path",
",",
"filename",
"=",
"os",
".",
"pa... | Retrieve the access, modify, and create timetags for a path along with its size
Arguments:
path (str): full path to the file or directory to be statused
status (dict): optional existing status to be updated/overwritten with new status values
Returns:
dict: {'size': bytes (int), 'access... | [
"Retrieve",
"the",
"access",
"modify",
"and",
"create",
"timetags",
"for",
"a",
"path",
"along",
"with",
"its",
"size"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/futil.py#L53-L108 | train | Retrieve the access modify and create timetags for a path. |
totalgood/twip | twip/futil.py | find_files | def find_files(path='', ext='', level=None, typ=list, dirs=False, files=True, verbosity=0):
""" Recursively find all files in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Only file paths... | python | def find_files(path='', ext='', level=None, typ=list, dirs=False, files=True, verbosity=0):
""" Recursively find all files in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Only file paths... | [
"def",
"find_files",
"(",
"path",
"=",
"''",
",",
"ext",
"=",
"''",
",",
"level",
"=",
"None",
",",
"typ",
"=",
"list",
",",
"dirs",
"=",
"False",
",",
"files",
"=",
"True",
",",
"verbosity",
"=",
"0",
")",
":",
"gen",
"=",
"generate_files",
"(",... | Recursively find all files in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Only file paths that ".endswith()" this string will be returned
level (int, optional): Depth of file tree to ... | [
"Recursively",
"find",
"all",
"files",
"in",
"the",
"indicated",
"directory"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/futil.py#L111-L163 | train | Find all files in the specified directory tree. |
totalgood/twip | twip/futil.py | generate_files | def generate_files(path='', ext='', level=None, dirs=False, files=True, verbosity=0):
""" Recursively generate files (and thier stats) in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Onl... | python | def generate_files(path='', ext='', level=None, dirs=False, files=True, verbosity=0):
""" Recursively generate files (and thier stats) in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Onl... | [
"def",
"generate_files",
"(",
"path",
"=",
"''",
",",
"ext",
"=",
"''",
",",
"level",
"=",
"None",
",",
"dirs",
"=",
"False",
",",
"files",
"=",
"True",
",",
"verbosity",
"=",
"0",
")",
":",
"path",
"=",
"path",
"or",
"'./'",
"ext",
"=",
"str",
... | Recursively generate files (and thier stats) in the indicated directory
Filter by the indicated file name extension (ext)
Args:
path (str): Root/base path to search.
ext (str): File name extension. Only file paths that ".endswith()" this string will be returned
level (int, optional): Dept... | [
"Recursively",
"generate",
"files",
"(",
"and",
"thier",
"stats",
")",
"in",
"the",
"indicated",
"directory"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/futil.py#L166-L230 | train | Generate files in a directory tree. |
erijo/tellive-py | tellive/livemessage.py | LiveMessageToken.serialize | def serialize(self):
"""Serialize the token and return it as bytes."""
if type(self.value) == int:
return "i{:X}s".format(self.value).encode('ascii')
if type(self.value) == str:
value = self.value.encode('utf-8')
return "{:X}:".format(len(value)).encode('asci... | python | def serialize(self):
"""Serialize the token and return it as bytes."""
if type(self.value) == int:
return "i{:X}s".format(self.value).encode('ascii')
if type(self.value) == str:
value = self.value.encode('utf-8')
return "{:X}:".format(len(value)).encode('asci... | [
"def",
"serialize",
"(",
"self",
")",
":",
"if",
"type",
"(",
"self",
".",
"value",
")",
"==",
"int",
":",
"return",
"\"i{:X}s\"",
".",
"format",
"(",
"self",
".",
"value",
")",
".",
"encode",
"(",
"'ascii'",
")",
"if",
"type",
"(",
"self",
".",
... | Serialize the token and return it as bytes. | [
"Serialize",
"the",
"token",
"and",
"return",
"it",
"as",
"bytes",
"."
] | a84ebb1eb29ee4c69a085e55e523ac5fff0087fc | https://github.com/erijo/tellive-py/blob/a84ebb1eb29ee4c69a085e55e523ac5fff0087fc/tellive/livemessage.py#L31-L55 | train | Serialize the token and return it as bytes. |
ChrisBeaumont/smother | smother/control.py | Smother.write | def write(self, file_or_path, append=False, timeout=10):
"""
Write Smother results to a file.
Parameters
----------
fiile_or_path : str
Path to write report to
append : bool
If True, read an existing smother report from `outpath`
and c... | python | def write(self, file_or_path, append=False, timeout=10):
"""
Write Smother results to a file.
Parameters
----------
fiile_or_path : str
Path to write report to
append : bool
If True, read an existing smother report from `outpath`
and c... | [
"def",
"write",
"(",
"self",
",",
"file_or_path",
",",
"append",
"=",
"False",
",",
"timeout",
"=",
"10",
")",
":",
"if",
"isinstance",
"(",
"file_or_path",
",",
"six",
".",
"string_types",
")",
":",
"if",
"self",
".",
"coverage",
":",
"file_or_path",
... | Write Smother results to a file.
Parameters
----------
fiile_or_path : str
Path to write report to
append : bool
If True, read an existing smother report from `outpath`
and combine it with this file before writing.
timeout : int
Ti... | [
"Write",
"Smother",
"results",
"to",
"a",
"file",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/control.py#L87-L137 | train | Writes smother results to a file. |
ChrisBeaumont/smother | smother/control.py | Smother.query_context | def query_context(self, regions, file_factory=PythonFile):
"""
Return which set of test contexts intersect a set of code regions.
Parameters
----------
regions: A sequence of Intervals
file_factory: Callable (optional, default PythonFile)
A callable that ta... | python | def query_context(self, regions, file_factory=PythonFile):
"""
Return which set of test contexts intersect a set of code regions.
Parameters
----------
regions: A sequence of Intervals
file_factory: Callable (optional, default PythonFile)
A callable that ta... | [
"def",
"query_context",
"(",
"self",
",",
"regions",
",",
"file_factory",
"=",
"PythonFile",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"region",
"in",
"regions",
":",
"try",
":",
"pf",
"=",
"file_factory",
"(",
"region",
".",
"filename",
")",
"e... | Return which set of test contexts intersect a set of code regions.
Parameters
----------
regions: A sequence of Intervals
file_factory: Callable (optional, default PythonFile)
A callable that takes a filename and
returns a PythonFile object.
Returns
... | [
"Return",
"which",
"set",
"of",
"test",
"contexts",
"intersect",
"a",
"set",
"of",
"code",
"regions",
"."
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/control.py#L174-L214 | train | Query which set of test contexts intersect a set of code regions. |
ChrisBeaumont/smother | smother/control.py | Smother._invert | def _invert(self):
"""
Invert coverage data from {test_context: {file: line}}
to {file: {test_context: line}}
"""
result = defaultdict(dict)
for test_context, src_context in six.iteritems(self.data):
for src, lines in six.iteritems(src_context):
... | python | def _invert(self):
"""
Invert coverage data from {test_context: {file: line}}
to {file: {test_context: line}}
"""
result = defaultdict(dict)
for test_context, src_context in six.iteritems(self.data):
for src, lines in six.iteritems(src_context):
... | [
"def",
"_invert",
"(",
"self",
")",
":",
"result",
"=",
"defaultdict",
"(",
"dict",
")",
"for",
"test_context",
",",
"src_context",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"data",
")",
":",
"for",
"src",
",",
"lines",
"in",
"six",
".",
"iter... | Invert coverage data from {test_context: {file: line}}
to {file: {test_context: line}} | [
"Invert",
"coverage",
"data",
"from",
"{",
"test_context",
":",
"{",
"file",
":",
"line",
"}}",
"to",
"{",
"file",
":",
"{",
"test_context",
":",
"line",
"}}"
] | 65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb | https://github.com/ChrisBeaumont/smother/blob/65d1ea6ae0060d213b0dcbb983c5aa8e7fee07bb/smother/control.py#L216-L225 | train | Invert coverage data from source context to coverage data. |
Capitains/MyCapytain | MyCapytain/common/reference/_base.py | BaseCitationSet.children | def children(self, val: list):
""" Sets children
:param val: List of citation children
"""
final_value = []
if val is not None:
for citation in val:
if citation is None:
continue
elif not isinstance(citation, (BaseC... | python | def children(self, val: list):
""" Sets children
:param val: List of citation children
"""
final_value = []
if val is not None:
for citation in val:
if citation is None:
continue
elif not isinstance(citation, (BaseC... | [
"def",
"children",
"(",
"self",
",",
"val",
":",
"list",
")",
":",
"final_value",
"=",
"[",
"]",
"if",
"val",
"is",
"not",
"None",
":",
"for",
"citation",
"in",
"val",
":",
"if",
"citation",
"is",
"None",
":",
"continue",
"elif",
"not",
"isinstance",... | Sets children
:param val: List of citation children | [
"Sets",
"children"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/reference/_base.py#L36-L55 | train | Sets the children of the current object to the given list of citation children. |
Capitains/MyCapytain | MyCapytain/common/reference/_base.py | BaseCitationSet.add_child | def add_child(self, child):
""" Adds a child to the CitationSet
:param child: Child citation to add
:return:
"""
if isinstance(child, BaseCitation):
self._children.append(child) | python | def add_child(self, child):
""" Adds a child to the CitationSet
:param child: Child citation to add
:return:
"""
if isinstance(child, BaseCitation):
self._children.append(child) | [
"def",
"add_child",
"(",
"self",
",",
"child",
")",
":",
"if",
"isinstance",
"(",
"child",
",",
"BaseCitation",
")",
":",
"self",
".",
"_children",
".",
"append",
"(",
"child",
")"
] | Adds a child to the CitationSet
:param child: Child citation to add
:return: | [
"Adds",
"a",
"child",
"to",
"the",
"CitationSet"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/reference/_base.py#L57-L64 | train | Adds a child to the citation set. |
Capitains/MyCapytain | MyCapytain/common/reference/_base.py | BaseCitation.depth | def depth(self) -> int:
""" Depth of the citation scheme
.. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1
:rtype: int
:return: Depth of the citation scheme
"""
if len(self.children):
return 1 + max([c... | python | def depth(self) -> int:
""" Depth of the citation scheme
.. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1
:rtype: int
:return: Depth of the citation scheme
"""
if len(self.children):
return 1 + max([c... | [
"def",
"depth",
"(",
"self",
")",
"->",
"int",
":",
"if",
"len",
"(",
"self",
".",
"children",
")",
":",
"return",
"1",
"+",
"max",
"(",
"[",
"child",
".",
"depth",
"for",
"child",
"in",
"self",
".",
"children",
"]",
")",
"else",
":",
"return",
... | Depth of the citation scheme
.. example:: If we have a Book, Poem, Line system, and the citation we are looking at is Poem, depth is 1
:rtype: int
:return: Depth of the citation scheme | [
"Depth",
"of",
"the",
"citation",
"scheme"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/common/reference/_base.py#L298-L310 | train | Depth of the citation scheme. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | PrototypeCtsCollection.get_cts_property | def get_cts_property(self, prop, lang=None):
""" Set given property in CTS Namespace
.. example::
collection.get_cts_property("groupname", "eng")
:param prop: Property to get (Without namespace)
:param lang: Language to get for given value
:return: Value or default ... | python | def get_cts_property(self, prop, lang=None):
""" Set given property in CTS Namespace
.. example::
collection.get_cts_property("groupname", "eng")
:param prop: Property to get (Without namespace)
:param lang: Language to get for given value
:return: Value or default ... | [
"def",
"get_cts_property",
"(",
"self",
",",
"prop",
",",
"lang",
"=",
"None",
")",
":",
"x",
"=",
"{",
"obj",
".",
"language",
":",
"obj",
"for",
"obj",
"in",
"self",
".",
"metadata",
".",
"get",
"(",
"RDF_NAMESPACES",
".",
"CTS",
".",
"term",
"("... | Set given property in CTS Namespace
.. example::
collection.get_cts_property("groupname", "eng")
:param prop: Property to get (Without namespace)
:param lang: Language to get for given value
:return: Value or default if lang is set, else whole set of values
:rtype: ... | [
"Set",
"given",
"property",
"in",
"CTS",
"Namespace"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L66-L84 | train | Get given property in CTS Namespace
collection. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | PrototypeCtsCollection.set_cts_property | def set_cts_property(self, prop, value, lang=None):
""" Set given property in CTS Namespace
.. example::
collection.set_cts_property("groupname", "MyCapytain", "eng")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property
:par... | python | def set_cts_property(self, prop, value, lang=None):
""" Set given property in CTS Namespace
.. example::
collection.set_cts_property("groupname", "MyCapytain", "eng")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property
:par... | [
"def",
"set_cts_property",
"(",
"self",
",",
"prop",
",",
"value",
",",
"lang",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"Literal",
")",
":",
"value",
"=",
"Literal",
"(",
"value",
",",
"lang",
"=",
"lang",
")",
"prop",
... | Set given property in CTS Namespace
.. example::
collection.set_cts_property("groupname", "MyCapytain", "eng")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property
:param lang: Language to set for given value | [
"Set",
"given",
"property",
"in",
"CTS",
"Namespace"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L86-L103 | train | Set given property in CTS Namespace |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | PrototypeCtsCollection.set_link | def set_link(self, prop, value):
""" Set given link in CTS Namespace
.. example::
collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property
"""
... | python | def set_link(self, prop, value):
""" Set given link in CTS Namespace
.. example::
collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property
"""
... | [
"def",
"set_link",
"(",
"self",
",",
"prop",
",",
"value",
")",
":",
"# https://rdflib.readthedocs.io/en/stable/",
"# URIRef == identifiers (urn, http, URI in general)",
"# Literal == String or Number (can have a language)",
"# BNode == Anonymous nodes (So no specific identifier)",
"#\t\... | Set given link in CTS Namespace
.. example::
collection.set_link(NAMESPACES.CTS.about, "urn:cts:latinLit:phi1294.phi002")
:param prop: Property to set (Without namespace)
:param value: Value to set for given property | [
"Set",
"given",
"link",
"in",
"CTS",
"Namespace"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L118-L135 | train | Set given link in CTS Namespace
collection. set_link ( namespaces. CTS. about |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsTextMetadata.editions | def editions(self):
""" Get all editions of the texts
:return: List of editions
:rtype: [CtsTextMetadata]
"""
return [
item
for urn, item in self.parent.children.items()
if isinstance(item, CtsEditionMetadata)
] | python | def editions(self):
""" Get all editions of the texts
:return: List of editions
:rtype: [CtsTextMetadata]
"""
return [
item
for urn, item in self.parent.children.items()
if isinstance(item, CtsEditionMetadata)
] | [
"def",
"editions",
"(",
"self",
")",
":",
"return",
"[",
"item",
"for",
"urn",
",",
"item",
"in",
"self",
".",
"parent",
".",
"children",
".",
"items",
"(",
")",
"if",
"isinstance",
"(",
"item",
",",
"CtsEditionMetadata",
")",
"]"
] | Get all editions of the texts
:return: List of editions
:rtype: [CtsTextMetadata] | [
"Get",
"all",
"editions",
"of",
"the",
"texts"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L263-L273 | train | Get all the editions of the texts |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsTextMetadata.get_creator | def get_creator(self, lang=None):
""" Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal
"""
return self.parent.parent.metadata.get_label(lang=lang) | python | def get_creator(self, lang=None):
""" Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal
"""
return self.parent.parent.metadata.get_label(lang=lang) | [
"def",
"get_creator",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"return",
"self",
".",
"parent",
".",
"parent",
".",
"metadata",
".",
"get_label",
"(",
"lang",
"=",
"lang",
")"
] | Get the DC Creator literal value
:param lang: Language to retrieve
:return: Creator string representation
:rtype: Literal | [
"Get",
"the",
"DC",
"Creator",
"literal",
"value"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L342-L349 | train | Get the DC Creator literal value for the given language |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsTextMetadata.get_description | def get_description(self, lang=None):
""" Get the DC description of the object
:param lang: Lang to retrieve
:return: Description string representation
:rtype: Literal
"""
return self.metadata.get_single(key=RDF_NAMESPACES.CTS.description, lang=lang) | python | def get_description(self, lang=None):
""" Get the DC description of the object
:param lang: Lang to retrieve
:return: Description string representation
:rtype: Literal
"""
return self.metadata.get_single(key=RDF_NAMESPACES.CTS.description, lang=lang) | [
"def",
"get_description",
"(",
"self",
",",
"lang",
"=",
"None",
")",
":",
"return",
"self",
".",
"metadata",
".",
"get_single",
"(",
"key",
"=",
"RDF_NAMESPACES",
".",
"CTS",
".",
"description",
",",
"lang",
"=",
"lang",
")"
] | Get the DC description of the object
:param lang: Lang to retrieve
:return: Description string representation
:rtype: Literal | [
"Get",
"the",
"DC",
"description",
"of",
"the",
"object"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L360-L367 | train | Get the DC description of the object
|
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsWorkMetadata.lang | def lang(self):
""" Languages this text is in
:return: List of available languages
"""
return str(self.graph.value(self.asNode(), DC.language)) | python | def lang(self):
""" Languages this text is in
:return: List of available languages
"""
return str(self.graph.value(self.asNode(), DC.language)) | [
"def",
"lang",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"graph",
".",
"value",
"(",
"self",
".",
"asNode",
"(",
")",
",",
"DC",
".",
"language",
")",
")"
] | Languages this text is in
:return: List of available languages | [
"Languages",
"this",
"text",
"is",
"in"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L461-L466 | train | Returns the language of the current text in the language graph. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsWorkMetadata.lang | def lang(self, lang):
""" Language this text is available in
:param lang: Language to add
:type lang: str
"""
self.graph.set((self.asNode(), DC.language, Literal(lang))) | python | def lang(self, lang):
""" Language this text is available in
:param lang: Language to add
:type lang: str
"""
self.graph.set((self.asNode(), DC.language, Literal(lang))) | [
"def",
"lang",
"(",
"self",
",",
"lang",
")",
":",
"self",
".",
"graph",
".",
"set",
"(",
"(",
"self",
".",
"asNode",
"(",
")",
",",
"DC",
".",
"language",
",",
"Literal",
"(",
"lang",
")",
")",
")"
] | Language this text is available in
:param lang: Language to add
:type lang: str | [
"Language",
"this",
"text",
"is",
"available",
"in"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L469-L475 | train | Set the language of this text in the node graph. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsWorkMetadata.update | def update(self, other):
""" Merge two XmlCtsWorkMetadata Objects.
- Original (left Object) keeps his parent.
- Added document overwrite text if it already exists
:param other: XmlCtsWorkMetadata object
:type other: CtsWorkMetadata
:return: XmlCtsWorkMetadata Object
... | python | def update(self, other):
""" Merge two XmlCtsWorkMetadata Objects.
- Original (left Object) keeps his parent.
- Added document overwrite text if it already exists
:param other: XmlCtsWorkMetadata object
:type other: CtsWorkMetadata
:return: XmlCtsWorkMetadata Object
... | [
"def",
"update",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"CtsWorkMetadata",
")",
":",
"raise",
"TypeError",
"(",
"\"Cannot add %s to CtsWorkMetadata\"",
"%",
"type",
"(",
"other",
")",
")",
"elif",
"self",
".",
"u... | Merge two XmlCtsWorkMetadata Objects.
- Original (left Object) keeps his parent.
- Added document overwrite text if it already exists
:param other: XmlCtsWorkMetadata object
:type other: CtsWorkMetadata
:return: XmlCtsWorkMetadata Object
:rtype XmlCtsWorkMetadata: | [
"Merge",
"two",
"XmlCtsWorkMetadata",
"Objects",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L477-L498 | train | Merge two XmlCtsWorkMetadata Objects. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsWorkMetadata.get_translation_in | def get_translation_in(self, key=None):
""" Find a translation with given language
:param key: Language to find
:type key: text_type
:rtype: [CtsTextMetadata]
:returns: List of availables translations
"""
if key is not None:
return [
i... | python | def get_translation_in(self, key=None):
""" Find a translation with given language
:param key: Language to find
:type key: text_type
:rtype: [CtsTextMetadata]
:returns: List of availables translations
"""
if key is not None:
return [
i... | [
"def",
"get_translation_in",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
"is",
"not",
"None",
":",
"return",
"[",
"item",
"for",
"item",
"in",
"self",
".",
"texts",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"item",
",",
"Ct... | Find a translation with given language
:param key: Language to find
:type key: text_type
:rtype: [CtsTextMetadata]
:returns: List of availables translations | [
"Find",
"a",
"translation",
"with",
"given",
"language"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L500-L519 | train | Returns a list of availableables translations in the language specified by key. |
Capitains/MyCapytain | MyCapytain/resources/prototypes/cts/inventory.py | CtsTextgroupMetadata.update | def update(self, other):
""" Merge two Textgroup Objects.
- Original (left Object) keeps his parent.
- Added document merges with work if it already exists
:param other: Textgroup object
:type other: CtsTextgroupMetadata
:return: Textgroup Object
:rtype: CtsText... | python | def update(self, other):
""" Merge two Textgroup Objects.
- Original (left Object) keeps his parent.
- Added document merges with work if it already exists
:param other: Textgroup object
:type other: CtsTextgroupMetadata
:return: Textgroup Object
:rtype: CtsText... | [
"def",
"update",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"CtsTextgroupMetadata",
")",
":",
"raise",
"TypeError",
"(",
"\"Cannot add %s to CtsTextgroupMetadata\"",
"%",
"type",
"(",
"other",
")",
")",
"elif",
"str",
... | Merge two Textgroup Objects.
- Original (left Object) keeps his parent.
- Added document merges with work if it already exists
:param other: Textgroup object
:type other: CtsTextgroupMetadata
:return: Textgroup Object
:rtype: CtsTextgroupMetadata | [
"Merge",
"two",
"Textgroup",
"Objects",
"."
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resources/prototypes/cts/inventory.py#L581-L605 | train | Merge two Textgroup Objects. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.get | def get(self, tags=[], trigger_ids=[]):
"""
Get triggers with optional filtering. Querying without parameters returns all the trigger definitions.
:param tags: Fetch triggers with matching tags only. Use * to match all values.
:param trigger_ids: List of triggerIds to fetch
"""
... | python | def get(self, tags=[], trigger_ids=[]):
"""
Get triggers with optional filtering. Querying without parameters returns all the trigger definitions.
:param tags: Fetch triggers with matching tags only. Use * to match all values.
:param trigger_ids: List of triggerIds to fetch
"""
... | [
"def",
"get",
"(",
"self",
",",
"tags",
"=",
"[",
"]",
",",
"trigger_ids",
"=",
"[",
"]",
")",
":",
"params",
"=",
"{",
"}",
"if",
"len",
"(",
"tags",
")",
">",
"0",
":",
"params",
"[",
"'tags'",
"]",
"=",
"','",
".",
"join",
"(",
"tags",
"... | Get triggers with optional filtering. Querying without parameters returns all the trigger definitions.
:param tags: Fetch triggers with matching tags only. Use * to match all values.
:param trigger_ids: List of triggerIds to fetch | [
"Get",
"triggers",
"with",
"optional",
"filtering",
".",
"Querying",
"without",
"parameters",
"returns",
"all",
"the",
"trigger",
"definitions",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L132-L148 | train | Get all the triggers with optional filtering. Querying without parameters returns all the trigger definitions. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.create | def create(self, trigger):
"""
Create a new trigger.
:param trigger: FullTrigger or Trigger class to be created
:return: The created trigger
"""
data = self._serialize_object(trigger)
if isinstance(trigger, FullTrigger):
returned_dict = self._post(sel... | python | def create(self, trigger):
"""
Create a new trigger.
:param trigger: FullTrigger or Trigger class to be created
:return: The created trigger
"""
data = self._serialize_object(trigger)
if isinstance(trigger, FullTrigger):
returned_dict = self._post(sel... | [
"def",
"create",
"(",
"self",
",",
"trigger",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"trigger",
")",
"if",
"isinstance",
"(",
"trigger",
",",
"FullTrigger",
")",
":",
"returned_dict",
"=",
"self",
".",
"_post",
"(",
"self",
".",
... | Create a new trigger.
:param trigger: FullTrigger or Trigger class to be created
:return: The created trigger | [
"Create",
"a",
"new",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L150-L163 | train | Create a new trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.update | def update(self, trigger_id, full_trigger):
"""
Update an existing full trigger.
:param full_trigger: FullTrigger with conditions, dampenings and triggers
:type full_trigger: FullTrigger
:return: Updated FullTrigger definition
"""
data = self._serialize_object(fu... | python | def update(self, trigger_id, full_trigger):
"""
Update an existing full trigger.
:param full_trigger: FullTrigger with conditions, dampenings and triggers
:type full_trigger: FullTrigger
:return: Updated FullTrigger definition
"""
data = self._serialize_object(fu... | [
"def",
"update",
"(",
"self",
",",
"trigger_id",
",",
"full_trigger",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"full_trigger",
")",
"rdict",
"=",
"self",
".",
"_put",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'t... | Update an existing full trigger.
:param full_trigger: FullTrigger with conditions, dampenings and triggers
:type full_trigger: FullTrigger
:return: Updated FullTrigger definition | [
"Update",
"an",
"existing",
"full",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L165-L175 | train | Update an existing full trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.single | def single(self, trigger_id, full=False):
"""
Get an existing (full) trigger definition.
:param trigger_id: Trigger definition id to be retrieved.
:param full: Fetch the full definition, default is False.
:return: Trigger of FullTrigger depending on the full parameter value.
... | python | def single(self, trigger_id, full=False):
"""
Get an existing (full) trigger definition.
:param trigger_id: Trigger definition id to be retrieved.
:param full: Fetch the full definition, default is False.
:return: Trigger of FullTrigger depending on the full parameter value.
... | [
"def",
"single",
"(",
"self",
",",
"trigger_id",
",",
"full",
"=",
"False",
")",
":",
"if",
"full",
":",
"returned_dict",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'trigger'",
",",
"trigger_id",
"]",
")",... | Get an existing (full) trigger definition.
:param trigger_id: Trigger definition id to be retrieved.
:param full: Fetch the full definition, default is False.
:return: Trigger of FullTrigger depending on the full parameter value. | [
"Get",
"an",
"existing",
"(",
"full",
")",
"trigger",
"definition",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L187-L200 | train | Get a single trigger definition. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.create_group | def create_group(self, trigger):
"""
Create a new group trigger.
:param trigger: Group member trigger to be created
:return: The created group Trigger
"""
data = self._serialize_object(trigger)
return Trigger(self._post(self._service_url(['triggers', 'groups']), ... | python | def create_group(self, trigger):
"""
Create a new group trigger.
:param trigger: Group member trigger to be created
:return: The created group Trigger
"""
data = self._serialize_object(trigger)
return Trigger(self._post(self._service_url(['triggers', 'groups']), ... | [
"def",
"create_group",
"(",
"self",
",",
"trigger",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"trigger",
")",
"return",
"Trigger",
"(",
"self",
".",
"_post",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
"... | Create a new group trigger.
:param trigger: Group member trigger to be created
:return: The created group Trigger | [
"Create",
"a",
"new",
"group",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L202-L210 | train | Create a new group trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.group_members | def group_members(self, group_id, include_orphans=False):
"""
Find all group member trigger definitions
:param group_id: group trigger id
:param include_orphans: If True, include orphan members
:return: list of asociated group members as trigger objects
"""
param... | python | def group_members(self, group_id, include_orphans=False):
"""
Find all group member trigger definitions
:param group_id: group trigger id
:param include_orphans: If True, include orphan members
:return: list of asociated group members as trigger objects
"""
param... | [
"def",
"group_members",
"(",
"self",
",",
"group_id",
",",
"include_orphans",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'includeOrphans'",
":",
"str",
"(",
"include_orphans",
")",
".",
"lower",
"(",
")",
"}",
"url",
"=",
"self",
".",
"_service_url",
"... | Find all group member trigger definitions
:param group_id: group trigger id
:param include_orphans: If True, include orphan members
:return: list of asociated group members as trigger objects | [
"Find",
"all",
"group",
"member",
"trigger",
"definitions"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L212-L222 | train | Find all group members trigger definitions in a group. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.update_group | def update_group(self, group_id, trigger):
"""
Update an existing group trigger definition and its member definitions.
:param group_id: Group trigger id to be updated
:param trigger: Trigger object, the group trigger to be updated
"""
data = self._serialize_object(trigge... | python | def update_group(self, group_id, trigger):
"""
Update an existing group trigger definition and its member definitions.
:param group_id: Group trigger id to be updated
:param trigger: Trigger object, the group trigger to be updated
"""
data = self._serialize_object(trigge... | [
"def",
"update_group",
"(",
"self",
",",
"group_id",
",",
"trigger",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"trigger",
")",
"self",
".",
"_put",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
",",
"group... | Update an existing group trigger definition and its member definitions.
:param group_id: Group trigger id to be updated
:param trigger: Trigger object, the group trigger to be updated | [
"Update",
"an",
"existing",
"group",
"trigger",
"definition",
"and",
"its",
"member",
"definitions",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L224-L232 | train | Update an existing group trigger definition and its member definitions. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.delete_group | def delete_group(self, group_id, keep_non_orphans=False, keep_orphans=False):
"""
Delete a group trigger
:param group_id: ID of the group trigger to delete
:param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers
:param keep_orphans: if True ... | python | def delete_group(self, group_id, keep_non_orphans=False, keep_orphans=False):
"""
Delete a group trigger
:param group_id: ID of the group trigger to delete
:param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers
:param keep_orphans: if True ... | [
"def",
"delete_group",
"(",
"self",
",",
"group_id",
",",
"keep_non_orphans",
"=",
"False",
",",
"keep_orphans",
"=",
"False",
")",
":",
"params",
"=",
"{",
"'keepNonOrphans'",
":",
"str",
"(",
"keep_non_orphans",
")",
".",
"lower",
"(",
")",
",",
"'keepOr... | Delete a group trigger
:param group_id: ID of the group trigger to delete
:param keep_non_orphans: if True converts the non-orphan member triggers to standard triggers
:param keep_orphans: if True converts the orphan member triggers to standard triggers | [
"Delete",
"a",
"group",
"trigger"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L234-L243 | train | Delete a group trigger from the cache |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.create_group_member | def create_group_member(self, member):
"""
Create a new member trigger for a parent trigger.
:param member: Group member trigger to be created
:type member: GroupMemberInfo
:return: A member Trigger object
"""
data = self._serialize_object(member)
return ... | python | def create_group_member(self, member):
"""
Create a new member trigger for a parent trigger.
:param member: Group member trigger to be created
:type member: GroupMemberInfo
:return: A member Trigger object
"""
data = self._serialize_object(member)
return ... | [
"def",
"create_group_member",
"(",
"self",
",",
"member",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"member",
")",
"return",
"Trigger",
"(",
"self",
".",
"_post",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'"... | Create a new member trigger for a parent trigger.
:param member: Group member trigger to be created
:type member: GroupMemberInfo
:return: A member Trigger object | [
"Create",
"a",
"new",
"member",
"trigger",
"for",
"a",
"parent",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L245-L254 | train | Create a new member trigger for a parent trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.set_group_conditions | def set_group_conditions(self, group_id, conditions, trigger_mode=None):
"""
Set the group conditions.
This replaces any existing conditions on the group and member conditions for all trigger modes.
:param group_id: Group to be updated
:param conditions: New conditions to repla... | python | def set_group_conditions(self, group_id, conditions, trigger_mode=None):
"""
Set the group conditions.
This replaces any existing conditions on the group and member conditions for all trigger modes.
:param group_id: Group to be updated
:param conditions: New conditions to repla... | [
"def",
"set_group_conditions",
"(",
"self",
",",
"group_id",
",",
"conditions",
",",
"trigger_mode",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"conditions",
")",
"if",
"trigger_mode",
"is",
"not",
"None",
":",
"url",
"=",
"... | Set the group conditions.
This replaces any existing conditions on the group and member conditions for all trigger modes.
:param group_id: Group to be updated
:param conditions: New conditions to replace old ones
:param trigger_mode: Optional TriggerMode used
:type conditions: ... | [
"Set",
"the",
"group",
"conditions",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L256-L277 | train | Set the group conditions. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.set_conditions | def set_conditions(self, trigger_id, conditions, trigger_mode=None):
"""
Set the conditions for the trigger.
This sets the conditions for all trigger modes, replacing existing conditions for all trigger modes.
:param trigger_id: The relevant Trigger definition id
:param trigger... | python | def set_conditions(self, trigger_id, conditions, trigger_mode=None):
"""
Set the conditions for the trigger.
This sets the conditions for all trigger modes, replacing existing conditions for all trigger modes.
:param trigger_id: The relevant Trigger definition id
:param trigger... | [
"def",
"set_conditions",
"(",
"self",
",",
"trigger_id",
",",
"conditions",
",",
"trigger_mode",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"conditions",
")",
"if",
"trigger_mode",
"is",
"not",
"None",
":",
"url",
"=",
"self... | Set the conditions for the trigger.
This sets the conditions for all trigger modes, replacing existing conditions for all trigger modes.
:param trigger_id: The relevant Trigger definition id
:param trigger_mode: Optional Trigger mode
:param conditions: Collection of Conditions to set.
... | [
"Set",
"the",
"conditions",
"for",
"the",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L279-L299 | train | Set the conditions for the relevant trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.conditions | def conditions(self, trigger_id):
"""
Get all conditions for a specific trigger.
:param trigger_id: Trigger definition id to be retrieved
:return: list of condition objects
"""
response = self._get(self._service_url(['triggers', trigger_id, 'conditions']))
return... | python | def conditions(self, trigger_id):
"""
Get all conditions for a specific trigger.
:param trigger_id: Trigger definition id to be retrieved
:return: list of condition objects
"""
response = self._get(self._service_url(['triggers', trigger_id, 'conditions']))
return... | [
"def",
"conditions",
"(",
"self",
",",
"trigger_id",
")",
":",
"response",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"trigger_id",
",",
"'conditions'",
"]",
")",
")",
"return",
"Condition",
".",
"list_to_objec... | Get all conditions for a specific trigger.
:param trigger_id: Trigger definition id to be retrieved
:return: list of condition objects | [
"Get",
"all",
"conditions",
"for",
"a",
"specific",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L301-L309 | train | Get all conditions for a specific trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.dampenings | def dampenings(self, trigger_id, trigger_mode=None):
"""
Get all Dampenings for a Trigger (1 Dampening per mode).
:param trigger_id: Trigger definition id to be retrieved.
:param trigger_mode: Optional TriggerMode which is only fetched
:type trigger_mode: TriggerMode
:re... | python | def dampenings(self, trigger_id, trigger_mode=None):
"""
Get all Dampenings for a Trigger (1 Dampening per mode).
:param trigger_id: Trigger definition id to be retrieved.
:param trigger_mode: Optional TriggerMode which is only fetched
:type trigger_mode: TriggerMode
:re... | [
"def",
"dampenings",
"(",
"self",
",",
"trigger_id",
",",
"trigger_mode",
"=",
"None",
")",
":",
"if",
"trigger_mode",
"is",
"not",
"None",
":",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"trigger_id",
",",
"'dampenings'",
",",
... | Get all Dampenings for a Trigger (1 Dampening per mode).
:param trigger_id: Trigger definition id to be retrieved.
:param trigger_mode: Optional TriggerMode which is only fetched
:type trigger_mode: TriggerMode
:return: List of Dampening objects | [
"Get",
"all",
"Dampenings",
"for",
"a",
"Trigger",
"(",
"1",
"Dampening",
"per",
"mode",
")",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L311-L326 | train | Get all Dampenings for a given Trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.create_dampening | def create_dampening(self, trigger_id, dampening):
"""
Create a new dampening.
:param trigger_id: TriggerId definition attached to the dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Created dampening
"""
... | python | def create_dampening(self, trigger_id, dampening):
"""
Create a new dampening.
:param trigger_id: TriggerId definition attached to the dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Created dampening
"""
... | [
"def",
"create_dampening",
"(",
"self",
",",
"trigger_id",
",",
"dampening",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"dampening",
")",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"trigger_id",
",",
"'dampenings... | Create a new dampening.
:param trigger_id: TriggerId definition attached to the dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Created dampening | [
"Create",
"a",
"new",
"dampening",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L328-L339 | train | Create a new dampening. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.delete_dampening | def delete_dampening(self, trigger_id, dampening_id):
"""
Delete an existing dampening definition.
:param trigger_id: Trigger definition id for deletion.
:param dampening_id: Dampening definition id to be deleted.
"""
self._delete(self._service_url(['triggers', trigger_i... | python | def delete_dampening(self, trigger_id, dampening_id):
"""
Delete an existing dampening definition.
:param trigger_id: Trigger definition id for deletion.
:param dampening_id: Dampening definition id to be deleted.
"""
self._delete(self._service_url(['triggers', trigger_i... | [
"def",
"delete_dampening",
"(",
"self",
",",
"trigger_id",
",",
"dampening_id",
")",
":",
"self",
".",
"_delete",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"trigger_id",
",",
"'dampenings'",
",",
"dampening_id",
"]",
")",
")"
] | Delete an existing dampening definition.
:param trigger_id: Trigger definition id for deletion.
:param dampening_id: Dampening definition id to be deleted. | [
"Delete",
"an",
"existing",
"dampening",
"definition",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L341-L348 | train | Delete an existing dampening definition. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.update_dampening | def update_dampening(self, trigger_id, dampening_id):
"""
Update an existing dampening definition.
Note that the trigger mode can not be changed using this method.
:param trigger_id: Trigger definition id targeted for update.
:param dampening_id: Dampening definition id to be up... | python | def update_dampening(self, trigger_id, dampening_id):
"""
Update an existing dampening definition.
Note that the trigger mode can not be changed using this method.
:param trigger_id: Trigger definition id targeted for update.
:param dampening_id: Dampening definition id to be up... | [
"def",
"update_dampening",
"(",
"self",
",",
"trigger_id",
",",
"dampening_id",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"dampening",
")",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"trigger_id",
",",
"'dampeni... | Update an existing dampening definition.
Note that the trigger mode can not be changed using this method.
:param trigger_id: Trigger definition id targeted for update.
:param dampening_id: Dampening definition id to be updated.
:return: Updated Dampening | [
"Update",
"an",
"existing",
"dampening",
"definition",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L350-L361 | train | Update an existing dampening definition. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.create_group_dampening | def create_group_dampening(self, group_id, dampening):
"""
Create a new group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Group Dampening created
"""
... | python | def create_group_dampening(self, group_id, dampening):
"""
Create a new group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Group Dampening created
"""
... | [
"def",
"create_group_dampening",
"(",
"self",
",",
"group_id",
",",
"dampening",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"dampening",
")",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
",",
"group_id"... | Create a new group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening: Dampening definition to be created.
:type dampening: Dampening
:return: Group Dampening created | [
"Create",
"a",
"new",
"group",
"dampening"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L363-L374 | train | Create a new group dampening. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.update_group_dampening | def update_group_dampening(self, group_id, dampening_id, dampening):
"""
Update an existing group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening_id: id of the dampening to be updated
:return: Group Dampening created
"""
data = ... | python | def update_group_dampening(self, group_id, dampening_id, dampening):
"""
Update an existing group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening_id: id of the dampening to be updated
:return: Group Dampening created
"""
data = ... | [
"def",
"update_group_dampening",
"(",
"self",
",",
"group_id",
",",
"dampening_id",
",",
"dampening",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"dampening",
")",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'grou... | Update an existing group dampening
:param group_id: Group Trigger id attached to dampening
:param dampening_id: id of the dampening to be updated
:return: Group Dampening created | [
"Update",
"an",
"existing",
"group",
"dampening"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L376-L386 | train | Update an existing group dampening |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.delete_group_dampening | def delete_group_dampening(self, group_id, dampening_id):
"""
Delete an existing group dampening
:param group_id: Group Trigger id to be retrieved
:param dampening_id: id of the Dampening to be deleted
"""
self._delete(self._service_url(['triggers', 'groups', group_id, '... | python | def delete_group_dampening(self, group_id, dampening_id):
"""
Delete an existing group dampening
:param group_id: Group Trigger id to be retrieved
:param dampening_id: id of the Dampening to be deleted
"""
self._delete(self._service_url(['triggers', 'groups', group_id, '... | [
"def",
"delete_group_dampening",
"(",
"self",
",",
"group_id",
",",
"dampening_id",
")",
":",
"self",
".",
"_delete",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
",",
"group_id",
",",
"'dampenings'",
",",
"dampening_id",
"]",
"... | Delete an existing group dampening
:param group_id: Group Trigger id to be retrieved
:param dampening_id: id of the Dampening to be deleted | [
"Delete",
"an",
"existing",
"group",
"dampening"
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L388-L395 | train | Delete an existing group dampening |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.set_group_member_orphan | def set_group_member_orphan(self, member_id):
"""
Make a non-orphan member trigger into an orphan.
:param member_id: Member Trigger id to be made an orphan.
"""
self._put(self._service_url(['triggers', 'groups', 'members', member_id, 'orphan']), data=None, parse_json=False) | python | def set_group_member_orphan(self, member_id):
"""
Make a non-orphan member trigger into an orphan.
:param member_id: Member Trigger id to be made an orphan.
"""
self._put(self._service_url(['triggers', 'groups', 'members', member_id, 'orphan']), data=None, parse_json=False) | [
"def",
"set_group_member_orphan",
"(",
"self",
",",
"member_id",
")",
":",
"self",
".",
"_put",
"(",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
",",
"'members'",
",",
"member_id",
",",
"'orphan'",
"]",
")",
",",
"data",
"=",
"N... | Make a non-orphan member trigger into an orphan.
:param member_id: Member Trigger id to be made an orphan. | [
"Make",
"a",
"non",
"-",
"orphan",
"member",
"trigger",
"into",
"an",
"orphan",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L397-L403 | train | Make a non - orphan member trigger into an orphan. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.set_group_member_unorphan | def set_group_member_unorphan(self, member_id, unorphan_info):
"""
Make an orphan member trigger into an group trigger.
:param member_id: Orphan Member Trigger id to be assigned into a group trigger
:param unorphan_info: Only context and dataIdMap are used when changing back to a non-or... | python | def set_group_member_unorphan(self, member_id, unorphan_info):
"""
Make an orphan member trigger into an group trigger.
:param member_id: Orphan Member Trigger id to be assigned into a group trigger
:param unorphan_info: Only context and dataIdMap are used when changing back to a non-or... | [
"def",
"set_group_member_unorphan",
"(",
"self",
",",
"member_id",
",",
"unorphan_info",
")",
":",
"data",
"=",
"self",
".",
"_serialize_object",
"(",
"unorphan_info",
")",
"data",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'groups'",
",",... | Make an orphan member trigger into an group trigger.
:param member_id: Orphan Member Trigger id to be assigned into a group trigger
:param unorphan_info: Only context and dataIdMap are used when changing back to a non-orphan.
:type unorphan_info: UnorphanMemberInfo
:return: Trigger for ... | [
"Make",
"an",
"orphan",
"member",
"trigger",
"into",
"an",
"group",
"trigger",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L405-L416 | train | Set an orphan member trigger into a group trigger. |
hawkular/hawkular-client-python | hawkular/alerts/triggers.py | AlertsTriggerClient.enable | def enable(self, trigger_ids=[]):
"""
Enable triggers.
:param trigger_ids: List of trigger definition ids to enable
"""
trigger_ids = ','.join(trigger_ids)
url = self._service_url(['triggers', 'enabled'], params={'triggerIds': trigger_ids, 'enabled': 'true'})
sel... | python | def enable(self, trigger_ids=[]):
"""
Enable triggers.
:param trigger_ids: List of trigger definition ids to enable
"""
trigger_ids = ','.join(trigger_ids)
url = self._service_url(['triggers', 'enabled'], params={'triggerIds': trigger_ids, 'enabled': 'true'})
sel... | [
"def",
"enable",
"(",
"self",
",",
"trigger_ids",
"=",
"[",
"]",
")",
":",
"trigger_ids",
"=",
"','",
".",
"join",
"(",
"trigger_ids",
")",
"url",
"=",
"self",
".",
"_service_url",
"(",
"[",
"'triggers'",
",",
"'enabled'",
"]",
",",
"params",
"=",
"{... | Enable triggers.
:param trigger_ids: List of trigger definition ids to enable | [
"Enable",
"triggers",
"."
] | 52371f9ebabbe310efee2a8ff8eb735ccc0654bb | https://github.com/hawkular/hawkular-client-python/blob/52371f9ebabbe310efee2a8ff8eb735ccc0654bb/hawkular/alerts/triggers.py#L418-L426 | train | Enable all the triggers in the specified list of trigger ids. |
aiidateam/aiida-codtools | aiida_codtools/cli/workflows/cif_clean.py | launch_cif_clean | def launch_cif_clean(cif_filter, cif_select, group_cif_raw, group_cif_clean, group_structure, group_workchain, node,
max_entries, skip_check, parse_engine, daemon):
"""Run the `CifCleanWorkChain` on the entries in a group with raw imported CifData nodes.
It will use the `cif_filter` and `cif_select` script... | python | def launch_cif_clean(cif_filter, cif_select, group_cif_raw, group_cif_clean, group_structure, group_workchain, node,
max_entries, skip_check, parse_engine, daemon):
"""Run the `CifCleanWorkChain` on the entries in a group with raw imported CifData nodes.
It will use the `cif_filter` and `cif_select` script... | [
"def",
"launch_cif_clean",
"(",
"cif_filter",
",",
"cif_select",
",",
"group_cif_raw",
",",
"group_cif_clean",
",",
"group_structure",
",",
"group_workchain",
",",
"node",
",",
"max_entries",
",",
"skip_check",
",",
"parse_engine",
",",
"daemon",
")",
":",
"# pyli... | Run the `CifCleanWorkChain` on the entries in a group with raw imported CifData nodes.
It will use the `cif_filter` and `cif_select` scripts of `cod-tools` to clean the input cif file. Additionally, if
the `group-structure` option is passed, the workchain will also attempt to use the given parse engine to pars... | [
"Run",
"the",
"CifCleanWorkChain",
"on",
"the",
"entries",
"in",
"a",
"group",
"with",
"raw",
"imported",
"CifData",
"nodes",
"."
] | da5e4259b7a2e86cf0cc3f997e11dd36d445fa94 | https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/cli/workflows/cif_clean.py#L46-L176 | train | Launch a CifCleanWorkChain on the entries in a group with raw imported CifData nodes. |
chaoss/grimoirelab-cereslib | cereslib/events/events.py | Bugzilla.eventize | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 pro... | python | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 pro... | [
"def",
"eventize",
"(",
"self",
",",
"granularity",
")",
":",
"issue",
"=",
"{",
"}",
"issue",
"[",
"Bugzilla",
".",
"ISSUE_ID",
"]",
"=",
"[",
"]",
"issue",
"[",
"Bugzilla",
".",
"ISSUE_EVENT",
"]",
"=",
"[",
"]",
"issue",
"[",
"Bugzilla",
".",
"I... | This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 provides events about the rest of the status upd... | [
"This",
"splits",
"the",
"JSON",
"information",
"found",
"at",
"self",
".",
"events",
"into",
"the",
"several",
"events",
".",
"For",
"this",
"there",
"are",
"three",
"different",
"levels",
"of",
"time",
"consuming",
"actions",
":",
"1",
"-",
"soft",
"2",
... | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/events/events.py#L231-L292 | train | This method splits the JSON information found at self. items into several events. |
chaoss/grimoirelab-cereslib | cereslib/events/events.py | BugzillaRest.eventize | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 pro... | python | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 pro... | [
"def",
"eventize",
"(",
"self",
",",
"granularity",
")",
":",
"issue",
"=",
"{",
"}",
"issue",
"[",
"BugzillaRest",
".",
"ISSUE_ID",
"]",
"=",
"[",
"]",
"issue",
"[",
"BugzillaRest",
".",
"ISSUE_EVENT",
"]",
"=",
"[",
"]",
"issue",
"[",
"BugzillaRest",... | This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about open and closed issues.
Level 2 provides events about the rest of the status upd... | [
"This",
"splits",
"the",
"JSON",
"information",
"found",
"at",
"self",
".",
"events",
"into",
"the",
"several",
"events",
".",
"For",
"this",
"there",
"are",
"three",
"different",
"levels",
"of",
"time",
"consuming",
"actions",
":",
"1",
"-",
"soft",
"2",
... | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/events/events.py#L320-L392 | train | This function splits the JSON information found at self. items into several events. |
chaoss/grimoirelab-cereslib | cereslib/events/events.py | Git.eventize | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events abo... | python | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events abo... | [
"def",
"eventize",
"(",
"self",
",",
"granularity",
")",
":",
"df_columns",
"=",
"{",
"}",
"# Init common columns",
"self",
".",
"_init_common_fields",
"(",
"df_columns",
")",
"# First level granularity",
"df_columns",
"[",
"Git",
".",
"COMMIT_ID",
"]",
"=",
"["... | This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events about files
Level 3 provides other event... | [
"This",
"splits",
"the",
"JSON",
"information",
"found",
"at",
"self",
".",
"events",
"into",
"the",
"several",
"events",
".",
"For",
"this",
"there",
"are",
"three",
"different",
"levels",
"of",
"time",
"consuming",
"actions",
":",
"1",
"-",
"soft",
"2",
... | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/events/events.py#L464-L600 | train | This function splits the JSON information found at self. events into several events. |
chaoss/grimoirelab-cereslib | cereslib/events/events.py | Gerrit.eventize | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events abo... | python | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events abo... | [
"def",
"eventize",
"(",
"self",
",",
"granularity",
")",
":",
"changeset",
"=",
"{",
"}",
"# First level granularity",
"changeset",
"[",
"Gerrit",
".",
"CHANGESET_ID",
"]",
"=",
"[",
"]",
"changeset",
"[",
"Gerrit",
".",
"CHANGESET_EVENT",
"]",
"=",
"[",
"... | This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about commits
Level 2 provides events about files
Level 3 provides other event... | [
"This",
"splits",
"the",
"JSON",
"information",
"found",
"at",
"self",
".",
"events",
"into",
"the",
"several",
"events",
".",
"For",
"this",
"there",
"are",
"three",
"different",
"levels",
"of",
"time",
"consuming",
"actions",
":",
"1",
"-",
"soft",
"2",
... | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/events/events.py#L632-L760 | train | This function splits the JSON information found at self. items into a Pandas dataframe with splitted events. |
chaoss/grimoirelab-cereslib | cereslib/events/events.py | Email.eventize | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about emails
Level 2 not implemented
... | python | def eventize(self, granularity):
""" This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about emails
Level 2 not implemented
... | [
"def",
"eventize",
"(",
"self",
",",
"granularity",
")",
":",
"email",
"=",
"{",
"}",
"# First level granularity",
"email",
"[",
"Email",
".",
"EMAIL_ID",
"]",
"=",
"[",
"]",
"email",
"[",
"Email",
".",
"EMAIL_EVENT",
"]",
"=",
"[",
"]",
"email",
"[",
... | This splits the JSON information found at self.events into the
several events. For this there are three different levels of time
consuming actions: 1-soft, 2-medium and 3-hard.
Level 1 provides events about emails
Level 2 not implemented
Level 3 not implemented
:param g... | [
"This",
"splits",
"the",
"JSON",
"information",
"found",
"at",
"self",
".",
"events",
"into",
"the",
"several",
"events",
".",
"For",
"this",
"there",
"are",
"three",
"different",
"levels",
"of",
"time",
"consuming",
"actions",
":",
"1",
"-",
"soft",
"2",
... | 5110e6ca490a4f24bec3124286ebf51fd4e08bdd | https://github.com/chaoss/grimoirelab-cereslib/blob/5110e6ca490a4f24bec3124286ebf51fd4e08bdd/cereslib/events/events.py#L791-L855 | train | This function splits the JSON information found at self. items into several events. |
totalgood/twip | twip/tweets.py | geocode | def geocode(location, *args, **kwargs):
"""Guess a location lat/lon from the provided string
Returns:
str: +##.####,+###.####,### latitude, longitude, distance
A location and radius in twitter geocode format
>>> geocode('')
'45.52,-122.6819,20mi'
"""
location = LOCATIONS.get(l... | python | def geocode(location, *args, **kwargs):
"""Guess a location lat/lon from the provided string
Returns:
str: +##.####,+###.####,### latitude, longitude, distance
A location and radius in twitter geocode format
>>> geocode('')
'45.52,-122.6819,20mi'
"""
location = LOCATIONS.get(l... | [
"def",
"geocode",
"(",
"location",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"location",
"=",
"LOCATIONS",
".",
"get",
"(",
"location",
",",
"location",
")",
"if",
"len",
"(",
"args",
")",
":",
"location",
"=",
"[",
"location",
"]",
"+",... | Guess a location lat/lon from the provided string
Returns:
str: +##.####,+###.####,### latitude, longitude, distance
A location and radius in twitter geocode format
>>> geocode('')
'45.52,-122.6819,20mi' | [
"Guess",
"a",
"location",
"lat",
"/",
"lon",
"from",
"the",
"provided",
"string"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/tweets.py#L43-L66 | train | Guess a location lat / lon from the provided string
|
totalgood/twip | twip/tweets.py | get_twitter | def get_twitter(app_key=None, app_secret=None, search='python', location='', **kwargs):
"""Location may be specified with a string name or latitude, longitude, radius"""
if not app_key:
from settings_secret import TWITTER_API_KEY as app_key
if not app_secret:
from settings_secret import TWIT... | python | def get_twitter(app_key=None, app_secret=None, search='python', location='', **kwargs):
"""Location may be specified with a string name or latitude, longitude, radius"""
if not app_key:
from settings_secret import TWITTER_API_KEY as app_key
if not app_secret:
from settings_secret import TWIT... | [
"def",
"get_twitter",
"(",
"app_key",
"=",
"None",
",",
"app_secret",
"=",
"None",
",",
"search",
"=",
"'python'",
",",
"location",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"app_key",
":",
"from",
"settings_secret",
"import",
"TWITTER_A... | Location may be specified with a string name or latitude, longitude, radius | [
"Location",
"may",
"be",
"specified",
"with",
"a",
"string",
"name",
"or",
"latitude",
"longitude",
"radius"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/tweets.py#L69-L76 | train | Get a list of Twitter objects |
totalgood/twip | twip/tweets.py | limitted_dump | def limitted_dump(cursor=None, twitter=None, path='tweets.json', limit=450, rate=TWITTER_SEARCH_RATE_LIMIT, indent=-1):
"""Dump a limitted number of json.dump-able objects to the indicated file
rate (int): Number of queries per 15 minute twitter window
"""
if not twitter:
twitter = get_twitter(... | python | def limitted_dump(cursor=None, twitter=None, path='tweets.json', limit=450, rate=TWITTER_SEARCH_RATE_LIMIT, indent=-1):
"""Dump a limitted number of json.dump-able objects to the indicated file
rate (int): Number of queries per 15 minute twitter window
"""
if not twitter:
twitter = get_twitter(... | [
"def",
"limitted_dump",
"(",
"cursor",
"=",
"None",
",",
"twitter",
"=",
"None",
",",
"path",
"=",
"'tweets.json'",
",",
"limit",
"=",
"450",
",",
"rate",
"=",
"TWITTER_SEARCH_RATE_LIMIT",
",",
"indent",
"=",
"-",
"1",
")",
":",
"if",
"not",
"twitter",
... | Dump a limitted number of json.dump-able objects to the indicated file
rate (int): Number of queries per 15 minute twitter window | [
"Dump",
"a",
"limitted",
"number",
"of",
"json",
".",
"dump",
"-",
"able",
"objects",
"to",
"the",
"indicated",
"file"
] | 5c0411d2acfbe5b421841072814c9152591c03f7 | https://github.com/totalgood/twip/blob/5c0411d2acfbe5b421841072814c9152591c03f7/twip/tweets.py#L87-L114 | train | Dump a limitted number of json. dump -able objects to the specified file |
Capitains/MyCapytain | MyCapytain/resolvers/dts/api_v1.py | HttpDtsResolver.getTextualNode | def getTextualNode(
self,
textId: str,
subreference: Union[str, BaseReference]=None,
prevnext: bool=False,
metadata: bool=False
) -> DtsResolverDocument:
""" Retrieve a text node from the API
:param textId: CtsTextMetadata Identifier
... | python | def getTextualNode(
self,
textId: str,
subreference: Union[str, BaseReference]=None,
prevnext: bool=False,
metadata: bool=False
) -> DtsResolverDocument:
""" Retrieve a text node from the API
:param textId: CtsTextMetadata Identifier
... | [
"def",
"getTextualNode",
"(",
"self",
",",
"textId",
":",
"str",
",",
"subreference",
":",
"Union",
"[",
"str",
",",
"BaseReference",
"]",
"=",
"None",
",",
"prevnext",
":",
"bool",
"=",
"False",
",",
"metadata",
":",
"bool",
"=",
"False",
")",
"->",
... | Retrieve a text node from the API
:param textId: CtsTextMetadata Identifier
:type textId: str
:param subreference: CapitainsCtsPassage Reference
:type subreference: str
:param prevnext: Retrieve graph representing previous and next passage
:type prevnext: boolean
... | [
"Retrieve",
"a",
"text",
"node",
"from",
"the",
"API"
] | b11bbf6b6ae141fc02be70471e3fbf6907be6593 | https://github.com/Capitains/MyCapytain/blob/b11bbf6b6ae141fc02be70471e3fbf6907be6593/MyCapytain/resolvers/dts/api_v1.py#L147-L172 | train | Retrieve a text node from the API and return it as a DtsResolverDocument object. |
SHDShim/pytheos | pytheos/eqn_therm_Dorogokupets2007.py | altshuler_grun | def altshuler_grun(v, v0, gamma0, gamma_inf, beta):
"""
calculate Gruneisen parameter for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pressure
:... | python | def altshuler_grun(v, v0, gamma0, gamma_inf, beta):
"""
calculate Gruneisen parameter for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pressure
:... | [
"def",
"altshuler_grun",
"(",
"v",
",",
"v0",
",",
"gamma0",
",",
"gamma_inf",
",",
"beta",
")",
":",
"x",
"=",
"v",
"/",
"v0",
"return",
"gamma_inf",
"+",
"(",
"gamma0",
"-",
"gamma_inf",
")",
"*",
"np",
".",
"power",
"(",
"x",
",",
"beta",
")"
... | calculate Gruneisen parameter for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pressure
:param beta: volume dependence of Gruneisen parameter
:return... | [
"calculate",
"Gruneisen",
"parameter",
"for",
"Altshuler",
"equation"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Dorogokupets2007.py#L9-L21 | train | calculate Gruneisen parameter for Altshuler equation |
SHDShim/pytheos | pytheos/eqn_therm_Dorogokupets2007.py | altshuler_debyetemp | def altshuler_debyetemp(v, v0, gamma0, gamma_inf, beta, theta0):
"""
calculate Debye temperature for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pre... | python | def altshuler_debyetemp(v, v0, gamma0, gamma_inf, beta, theta0):
"""
calculate Debye temperature for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pre... | [
"def",
"altshuler_debyetemp",
"(",
"v",
",",
"v0",
",",
"gamma0",
",",
"gamma_inf",
",",
"beta",
",",
"theta0",
")",
":",
"x",
"=",
"v",
"/",
"v0",
"if",
"isuncertainties",
"(",
"[",
"v",
",",
"v0",
",",
"gamma0",
",",
"gamma_inf",
",",
"beta",
","... | calculate Debye temperature for Altshuler equation
:param v: unit-cell volume in A^3
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pressure
:param beta: volume dependence of Gruneisen parameter
:param th... | [
"calculate",
"Debye",
"temperature",
"for",
"Altshuler",
"equation"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Dorogokupets2007.py#L24-L43 | train | calculate Debye temperature for Altshuler equation |
SHDShim/pytheos | pytheos/eqn_therm_Dorogokupets2007.py | dorogokupets2007_pth | def dorogokupets2007_pth(v, temp, v0, gamma0, gamma_inf, beta, theta0, n, z,
three_r=3. * constants.R, t_ref=300.):
"""
calculate thermal pressure for Dorogokupets 2007 EOS
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at... | python | def dorogokupets2007_pth(v, temp, v0, gamma0, gamma_inf, beta, theta0, n, z,
three_r=3. * constants.R, t_ref=300.):
"""
calculate thermal pressure for Dorogokupets 2007 EOS
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at... | [
"def",
"dorogokupets2007_pth",
"(",
"v",
",",
"temp",
",",
"v0",
",",
"gamma0",
",",
"gamma_inf",
",",
"beta",
",",
"theta0",
",",
"n",
",",
"z",
",",
"three_r",
"=",
"3.",
"*",
"constants",
".",
"R",
",",
"t_ref",
"=",
"300.",
")",
":",
"v_mol",
... | calculate thermal pressure for Dorogokupets 2007 EOS
:param v: unit-cell volume in A^3
:param temp: temperature in K
:param v0: unit-cell volume in A^3 at 1 bar
:param gamma0: Gruneisen parameter at 1 bar
:param gamma_inf: Gruneisen parameter at infinite pressure
:param beta: volume dependence ... | [
"calculate",
"thermal",
"pressure",
"for",
"Dorogokupets",
"2007",
"EOS"
] | be079624405e92fbec60c5ead253eb5917e55237 | https://github.com/SHDShim/pytheos/blob/be079624405e92fbec60c5ead253eb5917e55237/pytheos/eqn_therm_Dorogokupets2007.py#L46-L75 | train | calculate thermal pressure for Dorogokupets 2007 |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.bind | def bind(cls, app, *paths, methods=None, name=None, view=None):
"""Connect to admin interface and application."""
# Register self in admin
if view is None:
app.ps.admin.register(cls)
if not paths:
paths = ('%s/%s' % (app.ps.admin.cfg.prefix, name or cls.na... | python | def bind(cls, app, *paths, methods=None, name=None, view=None):
"""Connect to admin interface and application."""
# Register self in admin
if view is None:
app.ps.admin.register(cls)
if not paths:
paths = ('%s/%s' % (app.ps.admin.cfg.prefix, name or cls.na... | [
"def",
"bind",
"(",
"cls",
",",
"app",
",",
"*",
"paths",
",",
"methods",
"=",
"None",
",",
"name",
"=",
"None",
",",
"view",
"=",
"None",
")",
":",
"# Register self in admin",
"if",
"view",
"is",
"None",
":",
"app",
".",
"ps",
".",
"admin",
".",
... | Connect to admin interface and application. | [
"Connect",
"to",
"admin",
"interface",
"and",
"application",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L70-L78 | train | Connect to admin interface and application. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.action | def action(cls, view):
"""Register admin view action."""
name = "%s:%s" % (cls.name, view.__name__)
path = "%s/%s" % (cls.url, view.__name__)
cls.actions.append((view.__doc__, path))
return cls.register(path, name=name)(view) | python | def action(cls, view):
"""Register admin view action."""
name = "%s:%s" % (cls.name, view.__name__)
path = "%s/%s" % (cls.url, view.__name__)
cls.actions.append((view.__doc__, path))
return cls.register(path, name=name)(view) | [
"def",
"action",
"(",
"cls",
",",
"view",
")",
":",
"name",
"=",
"\"%s:%s\"",
"%",
"(",
"cls",
".",
"name",
",",
"view",
".",
"__name__",
")",
"path",
"=",
"\"%s/%s\"",
"%",
"(",
"cls",
".",
"url",
",",
"view",
".",
"__name__",
")",
"cls",
".",
... | Register admin view action. | [
"Register",
"admin",
"view",
"action",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L81-L86 | train | Register admin view action. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.dispatch | async def dispatch(self, request, **kwargs):
"""Dispatch a request."""
# Authorize request
self.auth = await self.authorize(request)
# Load collection
self.collection = await self.load_many(request)
# Load resource
self.resource = await self.load_one(request)
... | python | async def dispatch(self, request, **kwargs):
"""Dispatch a request."""
# Authorize request
self.auth = await self.authorize(request)
# Load collection
self.collection = await self.load_many(request)
# Load resource
self.resource = await self.load_one(request)
... | [
"async",
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"# Authorize request",
"self",
".",
"auth",
"=",
"await",
"self",
".",
"authorize",
"(",
"request",
")",
"# Load collection",
"self",
".",
"collection",
"=",
"await... | Dispatch a request. | [
"Dispatch",
"a",
"request",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L88-L120 | train | Dispatch a request. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.filter | async def filter(self, request):
"""Filter collection."""
collection = self.collection
self.filter_form.process(request.query)
data = self.filter_form.data
self.filter_form.active = any(o and o is not DEFAULT for o in data.values())
for flt in self.columns_filters:
... | python | async def filter(self, request):
"""Filter collection."""
collection = self.collection
self.filter_form.process(request.query)
data = self.filter_form.data
self.filter_form.active = any(o and o is not DEFAULT for o in data.values())
for flt in self.columns_filters:
... | [
"async",
"def",
"filter",
"(",
"self",
",",
"request",
")",
":",
"collection",
"=",
"self",
".",
"collection",
"self",
".",
"filter_form",
".",
"process",
"(",
"request",
".",
"query",
")",
"data",
"=",
"self",
".",
"filter_form",
".",
"data",
"self",
... | Filter collection. | [
"Filter",
"collection",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L138-L150 | train | Filter collection. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.sort | async def sort(self, request, reverse=False):
"""Sort collection."""
return sorted(
self.collection, key=lambda o: getattr(o, self.columns_sort, 0), reverse=reverse) | python | async def sort(self, request, reverse=False):
"""Sort collection."""
return sorted(
self.collection, key=lambda o: getattr(o, self.columns_sort, 0), reverse=reverse) | [
"async",
"def",
"sort",
"(",
"self",
",",
"request",
",",
"reverse",
"=",
"False",
")",
":",
"return",
"sorted",
"(",
"self",
".",
"collection",
",",
"key",
"=",
"lambda",
"o",
":",
"getattr",
"(",
"o",
",",
"self",
".",
"columns_sort",
",",
"0",
"... | Sort collection. | [
"Sort",
"collection",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L152-L155 | train | Sort the related objects in the database. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.get_form | async def get_form(self, request):
"""Base point load resource."""
if not self.form:
return None
formdata = await request.post()
return self.form(formdata, obj=self.resource) | python | async def get_form(self, request):
"""Base point load resource."""
if not self.form:
return None
formdata = await request.post()
return self.form(formdata, obj=self.resource) | [
"async",
"def",
"get_form",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"self",
".",
"form",
":",
"return",
"None",
"formdata",
"=",
"await",
"request",
".",
"post",
"(",
")",
"return",
"self",
".",
"form",
"(",
"formdata",
",",
"obj",
"=",
... | Base point load resource. | [
"Base",
"point",
"load",
"resource",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L161-L166 | train | Base point load resource. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.save_form | async def save_form(self, form, request, **resources):
"""Save self form."""
if not self.can_create and not self.resource:
raise muffin.HTTPForbidden()
if not self.can_edit and self.resource:
raise muffin.HTTPForbidden()
resource = self.resource or self.populate... | python | async def save_form(self, form, request, **resources):
"""Save self form."""
if not self.can_create and not self.resource:
raise muffin.HTTPForbidden()
if not self.can_edit and self.resource:
raise muffin.HTTPForbidden()
resource = self.resource or self.populate... | [
"async",
"def",
"save_form",
"(",
"self",
",",
"form",
",",
"request",
",",
"*",
"*",
"resources",
")",
":",
"if",
"not",
"self",
".",
"can_create",
"and",
"not",
"self",
".",
"resource",
":",
"raise",
"muffin",
".",
"HTTPForbidden",
"(",
")",
"if",
... | Save self form. | [
"Save",
"self",
"form",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L168-L178 | train | Save self form. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.get | async def get(self, request):
"""Get collection of resources."""
form = await self.get_form(request)
ctx = dict(active=self, form=form, request=request)
if self.resource:
return self.app.ps.jinja2.render(self.template_item, **ctx)
return self.app.ps.jinja2.render(self... | python | async def get(self, request):
"""Get collection of resources."""
form = await self.get_form(request)
ctx = dict(active=self, form=form, request=request)
if self.resource:
return self.app.ps.jinja2.render(self.template_item, **ctx)
return self.app.ps.jinja2.render(self... | [
"async",
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"form",
"=",
"await",
"self",
".",
"get_form",
"(",
"request",
")",
"ctx",
"=",
"dict",
"(",
"active",
"=",
"self",
",",
"form",
"=",
"form",
",",
"request",
"=",
"request",
")",
"if",
... | Get collection of resources. | [
"Get",
"collection",
"of",
"resources",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L184-L190 | train | Get collection of resources. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.post | async def post(self, request):
"""Create/Edit items."""
form = await self.get_form(request)
if not form.validate():
raise muffin.HTTPBadRequest(
text=json.dumps(form.errors), content_type='application/json')
await self.save_form(form, request)
raise mu... | python | async def post(self, request):
"""Create/Edit items."""
form = await self.get_form(request)
if not form.validate():
raise muffin.HTTPBadRequest(
text=json.dumps(form.errors), content_type='application/json')
await self.save_form(form, request)
raise mu... | [
"async",
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"form",
"=",
"await",
"self",
".",
"get_form",
"(",
"request",
")",
"if",
"not",
"form",
".",
"validate",
"(",
")",
":",
"raise",
"muffin",
".",
"HTTPBadRequest",
"(",
"text",
"=",
"json"... | Create/Edit items. | [
"Create",
"/",
"Edit",
"items",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L192-L199 | train | Create or edit items. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.columns_formatter | def columns_formatter(cls, colname):
"""Decorator to mark a function as columns formatter."""
def wrapper(func):
cls.columns_formatters[colname] = func
return func
return wrapper | python | def columns_formatter(cls, colname):
"""Decorator to mark a function as columns formatter."""
def wrapper(func):
cls.columns_formatters[colname] = func
return func
return wrapper | [
"def",
"columns_formatter",
"(",
"cls",
",",
"colname",
")",
":",
"def",
"wrapper",
"(",
"func",
")",
":",
"cls",
".",
"columns_formatters",
"[",
"colname",
"]",
"=",
"func",
"return",
"func",
"return",
"wrapper"
] | Decorator to mark a function as columns formatter. | [
"Decorator",
"to",
"mark",
"a",
"function",
"as",
"columns",
"formatter",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L202-L207 | train | Decorator to mark a function as columns formatter. |
klen/muffin-admin | muffin_admin/handler.py | AdminHandler.render_value | def render_value(self, data, column):
"""Render value."""
renderer = self.columns_formatters.get(column, format_value)
return renderer(self, data, column) | python | def render_value(self, data, column):
"""Render value."""
renderer = self.columns_formatters.get(column, format_value)
return renderer(self, data, column) | [
"def",
"render_value",
"(",
"self",
",",
"data",
",",
"column",
")",
":",
"renderer",
"=",
"self",
".",
"columns_formatters",
".",
"get",
"(",
"column",
",",
"format_value",
")",
"return",
"renderer",
"(",
"self",
",",
"data",
",",
"column",
")"
] | Render value. | [
"Render",
"value",
"."
] | 404dc8e5107e943b7c42fa21c679c34ddb4de1d5 | https://github.com/klen/muffin-admin/blob/404dc8e5107e943b7c42fa21c679c34ddb4de1d5/muffin_admin/handler.py#L209-L212 | train | Render the value of a column. |
crdoconnor/commandlib | commandlib/command.py | Command.env | def env(self):
"""
Dict of all environment variables that will be run with this command.
"""
env_vars = os.environ.copy()
env_vars.update(self._env)
new_path = ":".join(
self._paths + [env_vars["PATH"]] if "PATH" in env_vars else [] + self._paths
)
... | python | def env(self):
"""
Dict of all environment variables that will be run with this command.
"""
env_vars = os.environ.copy()
env_vars.update(self._env)
new_path = ":".join(
self._paths + [env_vars["PATH"]] if "PATH" in env_vars else [] + self._paths
)
... | [
"def",
"env",
"(",
"self",
")",
":",
"env_vars",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env_vars",
".",
"update",
"(",
"self",
".",
"_env",
")",
"new_path",
"=",
"\":\"",
".",
"join",
"(",
"self",
".",
"_paths",
"+",
"[",
"env_vars",
... | Dict of all environment variables that will be run with this command. | [
"Dict",
"of",
"all",
"environment",
"variables",
"that",
"will",
"be",
"run",
"with",
"this",
"command",
"."
] | b630364fd7b0d189b388e22a7f43235d182e12e4 | https://github.com/crdoconnor/commandlib/blob/b630364fd7b0d189b388e22a7f43235d182e12e4/commandlib/command.py#L72-L85 | train | Returns a copy of the environment variables that will be run with this command. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.