partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
_V2ProtobufEncoder.fits
Checks if the new span fits in the max payload size.
py_zipkin/encoding/_encoders.py
def fits(self, current_count, current_size, max_size, new_span): """Checks if the new span fits in the max payload size.""" return current_size + len(new_span) <= max_size
def fits(self, current_count, current_size, max_size, new_span): """Checks if the new span fits in the max payload size.""" return current_size + len(new_span) <= max_size
[ "Checks", "if", "the", "new", "span", "fits", "in", "the", "max", "payload", "size", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_encoders.py#L309-L311
[ "def", "fits", "(", "self", ",", "current_count", ",", "current_size", ",", "max_size", ",", "new_span", ")", ":", "return", "current_size", "+", "len", "(", "new_span", ")", "<=", "max_size" ]
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V2ProtobufEncoder.encode_span
Encodes a single span to protobuf.
py_zipkin/encoding/_encoders.py
def encode_span(self, span): """Encodes a single span to protobuf.""" if not protobuf.installed(): raise ZipkinError( 'protobuf encoding requires installing the protobuf\'s extra ' 'requirements. Use py-zipkin[protobuf] in your requirements.txt.' )...
def encode_span(self, span): """Encodes a single span to protobuf.""" if not protobuf.installed(): raise ZipkinError( 'protobuf encoding requires installing the protobuf\'s extra ' 'requirements. Use py-zipkin[protobuf] in your requirements.txt.' )...
[ "Encodes", "a", "single", "span", "to", "protobuf", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_encoders.py#L313-L322
[ "def", "encode_span", "(", "self", ",", "span", ")", ":", "if", "not", "protobuf", ".", "installed", "(", ")", ":", "raise", "ZipkinError", "(", "'protobuf encoding requires installing the protobuf\\'s extra '", "'requirements. Use py-zipkin[protobuf] in your requirements.txt...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
get_decoder
Creates encoder object for the given encoding. :param encoding: desired output encoding protocol :type encoding: Encoding :return: corresponding IEncoder object :rtype: IEncoder
py_zipkin/encoding/_decoders.py
def get_decoder(encoding): """Creates encoder object for the given encoding. :param encoding: desired output encoding protocol :type encoding: Encoding :return: corresponding IEncoder object :rtype: IEncoder """ if encoding == Encoding.V1_THRIFT: return _V1ThriftDecoder() if enc...
def get_decoder(encoding): """Creates encoder object for the given encoding. :param encoding: desired output encoding protocol :type encoding: Encoding :return: corresponding IEncoder object :rtype: IEncoder """ if encoding == Encoding.V1_THRIFT: return _V1ThriftDecoder() if enc...
[ "Creates", "encoder", "object", "for", "the", "given", "encoding", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L25-L41
[ "def", "get_decoder", "(", "encoding", ")", ":", "if", "encoding", "==", "Encoding", ".", "V1_THRIFT", ":", "return", "_V1ThriftDecoder", "(", ")", "if", "encoding", "==", "Encoding", ".", "V1_JSON", ":", "raise", "NotImplementedError", "(", "'{} decoding not ye...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder.decode_spans
Decodes an encoded list of spans. :param spans: encoded list of spans :type spans: bytes :return: list of spans :rtype: list of Span
py_zipkin/encoding/_decoders.py
def decode_spans(self, spans): """Decodes an encoded list of spans. :param spans: encoded list of spans :type spans: bytes :return: list of spans :rtype: list of Span """ decoded_spans = [] transport = TMemoryBuffer(spans) if six.byte2int(spans) ...
def decode_spans(self, spans): """Decodes an encoded list of spans. :param spans: encoded list of spans :type spans: bytes :return: list of spans :rtype: list of Span """ decoded_spans = [] transport = TMemoryBuffer(spans) if six.byte2int(spans) ...
[ "Decodes", "an", "encoded", "list", "of", "spans", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L60-L80
[ "def", "decode_spans", "(", "self", ",", "spans", ")", ":", "decoded_spans", "=", "[", "]", "transport", "=", "TMemoryBuffer", "(", "spans", ")", "if", "six", ".", "byte2int", "(", "spans", ")", "==", "TType", ".", "STRUCT", ":", "_", ",", "size", "=...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._convert_from_thrift_endpoint
Accepts a thrift decoded endpoint and converts it to an Endpoint. :param thrift_endpoint: thrift encoded endpoint :type thrift_endpoint: thrift endpoint :returns: decoded endpoint :rtype: Encoding
py_zipkin/encoding/_decoders.py
def _convert_from_thrift_endpoint(self, thrift_endpoint): """Accepts a thrift decoded endpoint and converts it to an Endpoint. :param thrift_endpoint: thrift encoded endpoint :type thrift_endpoint: thrift endpoint :returns: decoded endpoint :rtype: Encoding """ i...
def _convert_from_thrift_endpoint(self, thrift_endpoint): """Accepts a thrift decoded endpoint and converts it to an Endpoint. :param thrift_endpoint: thrift encoded endpoint :type thrift_endpoint: thrift endpoint :returns: decoded endpoint :rtype: Encoding """ i...
[ "Accepts", "a", "thrift", "decoded", "endpoint", "and", "converts", "it", "to", "an", "Endpoint", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L82-L108
[ "def", "_convert_from_thrift_endpoint", "(", "self", ",", "thrift_endpoint", ")", ":", "ipv4", "=", "None", "ipv6", "=", "None", "port", "=", "struct", ".", "unpack", "(", "'H'", ",", "struct", ".", "pack", "(", "'h'", ",", "thrift_endpoint", ".", "port", ...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._decode_thrift_annotations
Accepts a thrift annotation and converts it to a v1 annotation. :param thrift_annotations: list of thrift annotations. :type thrift_annotations: list of zipkin_core.Span.Annotation :returns: (annotations, local_endpoint, kind)
py_zipkin/encoding/_decoders.py
def _decode_thrift_annotations(self, thrift_annotations): """Accepts a thrift annotation and converts it to a v1 annotation. :param thrift_annotations: list of thrift annotations. :type thrift_annotations: list of zipkin_core.Span.Annotation :returns: (annotations, local_endpoint, kind)...
def _decode_thrift_annotations(self, thrift_annotations): """Accepts a thrift annotation and converts it to a v1 annotation. :param thrift_annotations: list of thrift annotations. :type thrift_annotations: list of zipkin_core.Span.Annotation :returns: (annotations, local_endpoint, kind)...
[ "Accepts", "a", "thrift", "annotation", "and", "converts", "it", "to", "a", "v1", "annotation", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L110-L144
[ "def", "_decode_thrift_annotations", "(", "self", ",", "thrift_annotations", ")", ":", "local_endpoint", "=", "None", "kind", "=", "Kind", ".", "LOCAL", "all_annotations", "=", "{", "}", "timestamp", "=", "None", "duration", "=", "None", "for", "thrift_annotatio...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._convert_from_thrift_binary_annotations
Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation.
py_zipkin/encoding/_decoders.py
def _convert_from_thrift_binary_annotations(self, thrift_binary_annotations): """Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation. """ tags = {} local_endpoint = None remote_endpoint = None for binary_annotation in thrift_binar...
def _convert_from_thrift_binary_annotations(self, thrift_binary_annotations): """Accepts a thrift decoded binary annotation and converts it to a v1 binary annotation. """ tags = {} local_endpoint = None remote_endpoint = None for binary_annotation in thrift_binar...
[ "Accepts", "a", "thrift", "decoded", "binary", "annotation", "and", "converts", "it", "to", "a", "v1", "binary", "annotation", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L146-L178
[ "def", "_convert_from_thrift_binary_annotations", "(", "self", ",", "thrift_binary_annotations", ")", ":", "tags", "=", "{", "}", "local_endpoint", "=", "None", "remote_endpoint", "=", "None", "for", "binary_annotation", "in", "thrift_binary_annotations", ":", "if", "...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._decode_thrift_span
Decodes a thrift span. :param thrift_span: thrift span :type thrift_span: thrift Span object :returns: span builder representing this span :rtype: Span
py_zipkin/encoding/_decoders.py
def _decode_thrift_span(self, thrift_span): """Decodes a thrift span. :param thrift_span: thrift span :type thrift_span: thrift Span object :returns: span builder representing this span :rtype: Span """ parent_id = None local_endpoint = None annot...
def _decode_thrift_span(self, thrift_span): """Decodes a thrift span. :param thrift_span: thrift span :type thrift_span: thrift Span object :returns: span builder representing this span :rtype: Span """ parent_id = None local_endpoint = None annot...
[ "Decodes", "a", "thrift", "span", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L185-L235
[ "def", "_decode_thrift_span", "(", "self", ",", "thrift_span", ")", ":", "parent_id", "=", "None", "local_endpoint", "=", "None", "annotations", "=", "{", "}", "tags", "=", "{", "}", "kind", "=", "Kind", ".", "LOCAL", "remote_endpoint", "=", "None", "times...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._convert_trace_id_to_string
Converts the provided traceId hex value with optional high bits to a string. :param trace_id: the value of the trace ID :type trace_id: int :param trace_id_high: the high bits of the trace ID :type trace_id: int :returns: trace_id_high + trace_id as a string
py_zipkin/encoding/_decoders.py
def _convert_trace_id_to_string(self, trace_id, trace_id_high=None): """ Converts the provided traceId hex value with optional high bits to a string. :param trace_id: the value of the trace ID :type trace_id: int :param trace_id_high: the high bits of the trace ID ...
def _convert_trace_id_to_string(self, trace_id, trace_id_high=None): """ Converts the provided traceId hex value with optional high bits to a string. :param trace_id: the value of the trace ID :type trace_id: int :param trace_id_high: the high bits of the trace ID ...
[ "Converts", "the", "provided", "traceId", "hex", "value", "with", "optional", "high", "bits", "to", "a", "string", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L237-L256
[ "def", "_convert_trace_id_to_string", "(", "self", ",", "trace_id", ",", "trace_id_high", "=", "None", ")", ":", "if", "trace_id_high", "is", "not", "None", ":", "result", "=", "bytearray", "(", "32", ")", "self", ".", "_write_hex_long", "(", "result", ",", ...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._convert_unsigned_long_to_lower_hex
Converts the provided unsigned long value to a hex string. :param value: the value to convert :type value: unsigned long :returns: value as a hex string
py_zipkin/encoding/_decoders.py
def _convert_unsigned_long_to_lower_hex(self, value): """ Converts the provided unsigned long value to a hex string. :param value: the value to convert :type value: unsigned long :returns: value as a hex string """ result = bytearray(16) self._write_hex_l...
def _convert_unsigned_long_to_lower_hex(self, value): """ Converts the provided unsigned long value to a hex string. :param value: the value to convert :type value: unsigned long :returns: value as a hex string """ result = bytearray(16) self._write_hex_l...
[ "Converts", "the", "provided", "unsigned", "long", "value", "to", "a", "hex", "string", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L258-L268
[ "def", "_convert_unsigned_long_to_lower_hex", "(", "self", ",", "value", ")", ":", "result", "=", "bytearray", "(", "16", ")", "self", ".", "_write_hex_long", "(", "result", ",", "0", ",", "value", ")", "return", "result", ".", "decode", "(", "\"utf8\"", "...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
_V1ThriftDecoder._write_hex_long
Writes an unsigned long value across a byte array. :param data: the buffer to write the value to :type data: bytearray :param pos: the starting position :type pos: int :param value: the value to write :type value: unsigned long
py_zipkin/encoding/_decoders.py
def _write_hex_long(self, data, pos, value): """ Writes an unsigned long value across a byte array. :param data: the buffer to write the value to :type data: bytearray :param pos: the starting position :type pos: int :param value: the value to write :type...
def _write_hex_long(self, data, pos, value): """ Writes an unsigned long value across a byte array. :param data: the buffer to write the value to :type data: bytearray :param pos: the starting position :type pos: int :param value: the value to write :type...
[ "Writes", "an", "unsigned", "long", "value", "across", "a", "byte", "array", "." ]
Yelp/py_zipkin
python
https://github.com/Yelp/py_zipkin/blob/0944d9a3fb1f1798dbb276694aeed99f2b4283ba/py_zipkin/encoding/_decoders.py#L270-L288
[ "def", "_write_hex_long", "(", "self", ",", "data", ",", "pos", ",", "value", ")", ":", "self", ".", "_write_hex_byte", "(", "data", ",", "pos", "+", "0", ",", "(", "value", ">>", "56", ")", "&", "0xff", ")", "self", ".", "_write_hex_byte", "(", "d...
0944d9a3fb1f1798dbb276694aeed99f2b4283ba
test
date_fixup_pre_processor
Replace illegal February 29, 30 dates with the last day of February. German banks use a variant of the 30/360 interest rate calculation, where each month has always 30 days even February. Python's datetime module won't accept such dates.
mt940/processors.py
def date_fixup_pre_processor(transactions, tag, tag_dict, *args): """ Replace illegal February 29, 30 dates with the last day of February. German banks use a variant of the 30/360 interest rate calculation, where each month has always 30 days even February. Python's datetime module won't accept suc...
def date_fixup_pre_processor(transactions, tag, tag_dict, *args): """ Replace illegal February 29, 30 dates with the last day of February. German banks use a variant of the 30/360 interest rate calculation, where each month has always 30 days even February. Python's datetime module won't accept suc...
[ "Replace", "illegal", "February", "29", "30", "dates", "with", "the", "last", "day", "of", "February", "." ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/processors.py#L17-L31
[ "def", "date_fixup_pre_processor", "(", "transactions", ",", "tag", ",", "tag_dict", ",", "*", "args", ")", ":", "if", "tag_dict", "[", "'month'", "]", "==", "'02'", ":", "year", "=", "int", "(", "tag_dict", "[", "'year'", "]", ",", "10", ")", "_", "...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
mBank_set_transaction_code
mBank Collect uses transaction code 911 to distinguish icoming mass payments transactions, adding transaction_code may be helpful in further processing
mt940/processors.py
def mBank_set_transaction_code(transactions, tag, tag_dict, *args): """ mBank Collect uses transaction code 911 to distinguish icoming mass payments transactions, adding transaction_code may be helpful in further processing """ tag_dict['transaction_code'] = int( tag_dict[tag.slug].split...
def mBank_set_transaction_code(transactions, tag, tag_dict, *args): """ mBank Collect uses transaction code 911 to distinguish icoming mass payments transactions, adding transaction_code may be helpful in further processing """ tag_dict['transaction_code'] = int( tag_dict[tag.slug].split...
[ "mBank", "Collect", "uses", "transaction", "code", "911", "to", "distinguish", "icoming", "mass", "payments", "transactions", "adding", "transaction_code", "may", "be", "helpful", "in", "further", "processing" ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/processors.py#L41-L50
[ "def", "mBank_set_transaction_code", "(", "transactions", ",", "tag", ",", "tag_dict", ",", "*", "args", ")", ":", "tag_dict", "[", "'transaction_code'", "]", "=", "int", "(", "tag_dict", "[", "tag", ".", "slug", "]", ".", "split", "(", "';'", ")", "[", ...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
mBank_set_iph_id
mBank Collect uses ID IPH to distinguish between virtual accounts, adding iph_id may be helpful in further processing
mt940/processors.py
def mBank_set_iph_id(transactions, tag, tag_dict, *args): """ mBank Collect uses ID IPH to distinguish between virtual accounts, adding iph_id may be helpful in further processing """ matches = iph_id_re.search(tag_dict[tag.slug]) if matches: # pragma no branch tag_dict['iph_id'] = mat...
def mBank_set_iph_id(transactions, tag, tag_dict, *args): """ mBank Collect uses ID IPH to distinguish between virtual accounts, adding iph_id may be helpful in further processing """ matches = iph_id_re.search(tag_dict[tag.slug]) if matches: # pragma no branch tag_dict['iph_id'] = mat...
[ "mBank", "Collect", "uses", "ID", "IPH", "to", "distinguish", "between", "virtual", "accounts", "adding", "iph_id", "may", "be", "helpful", "in", "further", "processing" ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/processors.py#L56-L66
[ "def", "mBank_set_iph_id", "(", "transactions", ",", "tag", ",", "tag_dict", ",", "*", "args", ")", ":", "matches", "=", "iph_id_re", ".", "search", "(", "tag_dict", "[", "tag", ".", "slug", "]", ")", "if", "matches", ":", "# pragma no branch", "tag_dict",...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
mBank_set_tnr
mBank Collect states TNR in transaction details as unique id for transactions, that may be used to identify the same transactions in different statement files eg. partial mt942 and full mt940 Information about tnr uniqueness has been obtained from mBank support, it lacks in mt940 mBank specification.
mt940/processors.py
def mBank_set_tnr(transactions, tag, tag_dict, *args): """ mBank Collect states TNR in transaction details as unique id for transactions, that may be used to identify the same transactions in different statement files eg. partial mt942 and full mt940 Information about tnr uniqueness has been obtaine...
def mBank_set_tnr(transactions, tag, tag_dict, *args): """ mBank Collect states TNR in transaction details as unique id for transactions, that may be used to identify the same transactions in different statement files eg. partial mt942 and full mt940 Information about tnr uniqueness has been obtaine...
[ "mBank", "Collect", "states", "TNR", "in", "transaction", "details", "as", "unique", "id", "for", "transactions", "that", "may", "be", "used", "to", "identify", "the", "same", "transactions", "in", "different", "statement", "files", "eg", ".", "partial", "mt94...
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/processors.py#L73-L87
[ "def", "mBank_set_tnr", "(", "transactions", ",", "tag", ",", "tag_dict", ",", "*", "args", ")", ":", "matches", "=", "tnr_re", ".", "search", "(", "tag_dict", "[", "tag", ".", "slug", "]", ")", "if", "matches", ":", "# pragma no branch", "tag_dict", "["...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
Transactions.parse
Parses mt940 data, expects a string with data Args: data (str): The MT940 data Returns: :py:class:`list` of :py:class:`Transaction`
mt940/models.py
def parse(self, data): '''Parses mt940 data, expects a string with data Args: data (str): The MT940 data Returns: :py:class:`list` of :py:class:`Transaction` ''' # Remove extraneous whitespace and such data = '\n'.join(self.strip(data.split('\n'))) ...
def parse(self, data): '''Parses mt940 data, expects a string with data Args: data (str): The MT940 data Returns: :py:class:`list` of :py:class:`Transaction` ''' # Remove extraneous whitespace and such data = '\n'.join(self.strip(data.split('\n'))) ...
[ "Parses", "mt940", "data", "expects", "a", "string", "with", "data" ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/models.py#L375-L458
[ "def", "parse", "(", "self", ",", "data", ")", ":", "# Remove extraneous whitespace and such", "data", "=", "'\\n'", ".", "join", "(", "self", ".", "strip", "(", "data", ".", "split", "(", "'\\n'", ")", ")", ")", "# The pattern is a bit annoying to match by rege...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
parse
Parses mt940 data and returns transactions object :param src: file handler to read, filename to read or raw data as string :return: Collection of transactions :rtype: Transactions
mt940/parser.py
def parse(src, encoding=None): ''' Parses mt940 data and returns transactions object :param src: file handler to read, filename to read or raw data as string :return: Collection of transactions :rtype: Transactions ''' def safe_is_file(filename): try: return os.path.isf...
def parse(src, encoding=None): ''' Parses mt940 data and returns transactions object :param src: file handler to read, filename to read or raw data as string :return: Collection of transactions :rtype: Transactions ''' def safe_is_file(filename): try: return os.path.isf...
[ "Parses", "mt940", "data", "and", "returns", "transactions", "object" ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/parser.py#L34-L78
[ "def", "parse", "(", "src", ",", "encoding", "=", "None", ")", ":", "def", "safe_is_file", "(", "filename", ")", ":", "try", ":", "return", "os", ".", "path", ".", "isfile", "(", "src", ")", "except", "ValueError", ":", "# pragma: no cover", "return", ...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
join_lines
Join strings together and strip whitespace in between if needed
mt940/utils.py
def join_lines(string, strip=Strip.BOTH): ''' Join strings together and strip whitespace in between if needed ''' lines = [] for line in string.splitlines(): if strip & Strip.RIGHT: line = line.rstrip() if strip & Strip.LEFT: line = line.lstrip() li...
def join_lines(string, strip=Strip.BOTH): ''' Join strings together and strip whitespace in between if needed ''' lines = [] for line in string.splitlines(): if strip & Strip.RIGHT: line = line.rstrip() if strip & Strip.LEFT: line = line.lstrip() li...
[ "Join", "strings", "together", "and", "strip", "whitespace", "in", "between", "if", "needed" ]
WoLpH/mt940
python
https://github.com/WoLpH/mt940/blob/fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb/mt940/utils.py#L28-L43
[ "def", "join_lines", "(", "string", ",", "strip", "=", "Strip", ".", "BOTH", ")", ":", "lines", "=", "[", "]", "for", "line", "in", "string", ".", "splitlines", "(", ")", ":", "if", "strip", "&", "Strip", ".", "RIGHT", ":", "line", "=", "line", "...
fd71c88f7ec8372f4194f831f4c29c6f9bd9d0eb
test
json_or_text
Turns response into a properly formatted json or text object
dbl/http.py
async def json_or_text(response): """Turns response into a properly formatted json or text object""" text = await response.text() if response.headers['Content-Type'] == 'application/json; charset=utf-8': return json.loads(text) return text
async def json_or_text(response): """Turns response into a properly formatted json or text object""" text = await response.text() if response.headers['Content-Type'] == 'application/json; charset=utf-8': return json.loads(text) return text
[ "Turns", "response", "into", "a", "properly", "formatted", "json", "or", "text", "object" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L42-L47
[ "async", "def", "json_or_text", "(", "response", ")", ":", "text", "=", "await", "response", ".", "text", "(", ")", "if", "response", ".", "headers", "[", "'Content-Type'", "]", "==", "'application/json; charset=utf-8'", ":", "return", "json", ".", "loads", ...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
limited
Handles the message shown when we are ratelimited
dbl/http.py
async def limited(until): """Handles the message shown when we are ratelimited""" duration = int(round(until - time.time())) mins = duration / 60 fmt = 'We have exhausted a ratelimit quota. Retrying in %.2f seconds (%.3f minutes).' log.warn(fmt, duration, mins)
async def limited(until): """Handles the message shown when we are ratelimited""" duration = int(round(until - time.time())) mins = duration / 60 fmt = 'We have exhausted a ratelimit quota. Retrying in %.2f seconds (%.3f minutes).' log.warn(fmt, duration, mins)
[ "Handles", "the", "message", "shown", "when", "we", "are", "ratelimited" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L200-L205
[ "async", "def", "limited", "(", "until", ")", ":", "duration", "=", "int", "(", "round", "(", "until", "-", "time", ".", "time", "(", ")", ")", ")", "mins", "=", "duration", "/", "60", "fmt", "=", "'We have exhausted a ratelimit quota. Retrying in %.2f secon...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
HTTPClient.request
Handles requests to the API
dbl/http.py
async def request(self, method, url, **kwargs): """Handles requests to the API""" rate_limiter = RateLimiter(max_calls=59, period=60, callback=limited) # handles ratelimits. max_calls is set to 59 because current implementation will retry in 60s after 60 calls is reached. DBL has a 1h block so o...
async def request(self, method, url, **kwargs): """Handles requests to the API""" rate_limiter = RateLimiter(max_calls=59, period=60, callback=limited) # handles ratelimits. max_calls is set to 59 because current implementation will retry in 60s after 60 calls is reached. DBL has a 1h block so o...
[ "Handles", "requests", "to", "the", "API" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L78-L148
[ "async", "def", "request", "(", "self", ",", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "rate_limiter", "=", "RateLimiter", "(", "max_calls", "=", "59", ",", "period", "=", "60", ",", "callback", "=", "limited", ")", "# handles ratelimits. ...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
HTTPClient.get_bot_info
Gets the information of the given Bot ID
dbl/http.py
async def get_bot_info(self, bot_id): '''Gets the information of the given Bot ID''' resp = await self.request('GET', '{}/bots/{}'.format(self.BASE, bot_id)) resp['date'] = datetime.strptime(resp['date'], '%Y-%m-%dT%H:%M:%S.%fZ') for k in resp: if resp[k] == '': ...
async def get_bot_info(self, bot_id): '''Gets the information of the given Bot ID''' resp = await self.request('GET', '{}/bots/{}'.format(self.BASE, bot_id)) resp['date'] = datetime.strptime(resp['date'], '%Y-%m-%dT%H:%M:%S.%fZ') for k in resp: if resp[k] == '': ...
[ "Gets", "the", "information", "of", "the", "given", "Bot", "ID" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L177-L184
[ "async", "def", "get_bot_info", "(", "self", ",", "bot_id", ")", ":", "resp", "=", "await", "self", ".", "request", "(", "'GET'", ",", "'{}/bots/{}'", ".", "format", "(", "self", ".", "BASE", ",", "bot_id", ")", ")", "resp", "[", "'date'", "]", "=", ...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
HTTPClient.get_bots
Gets an object of bots on DBL
dbl/http.py
async def get_bots(self, limit, offset): '''Gets an object of bots on DBL''' if limit > 500: limit = 50 return await self.request('GET', '{}/bots?limit={}&offset={}'.format(self.BASE, limit, offset))
async def get_bots(self, limit, offset): '''Gets an object of bots on DBL''' if limit > 500: limit = 50 return await self.request('GET', '{}/bots?limit={}&offset={}'.format(self.BASE, limit, offset))
[ "Gets", "an", "object", "of", "bots", "on", "DBL" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/http.py#L190-L194
[ "async", "def", "get_bots", "(", "self", ",", "limit", ",", "offset", ")", ":", "if", "limit", ">", "500", ":", "limit", "=", "50", "return", "await", "self", ".", "request", "(", "'GET'", ",", "'{}/bots?limit={}&offset={}'", ".", "format", "(", "self", ...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.guild_count
Gets the guild count from the Client/Bot object
dbl/client.py
def guild_count(self): """Gets the guild count from the Client/Bot object""" try: return len(self.bot.guilds) except AttributeError: return len(self.bot.servers)
def guild_count(self): """Gets the guild count from the Client/Bot object""" try: return len(self.bot.guilds) except AttributeError: return len(self.bot.servers)
[ "Gets", "the", "guild", "count", "from", "the", "Client", "/", "Bot", "object" ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L76-L81
[ "def", "guild_count", "(", "self", ")", ":", "try", ":", "return", "len", "(", "self", ".", "bot", ".", "guilds", ")", "except", "AttributeError", ":", "return", "len", "(", "self", ".", "bot", ".", "servers", ")" ]
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.post_guild_count
This function is a coroutine. Posts the guild count to discordbots.org .. _0 based indexing : https://en.wikipedia.org/wiki/Zero-based_numbering Parameters ========== shard_count: int[Optional] The total number of shards. shard_no: int[Optional] ...
dbl/client.py
async def post_guild_count( self, shard_count: int = None, shard_no: int = None ): """This function is a coroutine. Posts the guild count to discordbots.org .. _0 based indexing : https://en.wikipedia.org/wiki/Zero-based_numbering Parameters ...
async def post_guild_count( self, shard_count: int = None, shard_no: int = None ): """This function is a coroutine. Posts the guild count to discordbots.org .. _0 based indexing : https://en.wikipedia.org/wiki/Zero-based_numbering Parameters ...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L96-L115
[ "async", "def", "post_guild_count", "(", "self", ",", "shard_count", ":", "int", "=", "None", ",", "shard_no", ":", "int", "=", "None", ")", ":", "await", "self", ".", "http", ".", "post_guild_count", "(", "self", ".", "bot_id", ",", "self", ".", "guil...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.get_guild_count
This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init Returns ======= stats: dict ...
dbl/client.py
async def get_guild_count(self, bot_id: int=None): """This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init...
async def get_guild_count(self, bot_id: int=None): """This function is a coroutine. Gets a guild count from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Defaults to the Bot provided in Client init...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L117-L139
[ "async", "def", "get_guild_count", "(", "self", ",", "bot_id", ":", "int", "=", "None", ")", ":", "if", "bot_id", "is", "None", ":", "bot_id", "=", "self", ".", "bot_id", "return", "await", "self", ".", "http", ".", "get_guild_count", "(", "bot_id", ")...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.get_bot_info
This function is a coroutine. Gets information about a bot from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Returns ======= bot_info: dict Information on the bot you looked up. ...
dbl/client.py
async def get_bot_info(self, bot_id: int = None): """This function is a coroutine. Gets information about a bot from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Returns ======= bot_...
async def get_bot_info(self, bot_id: int = None): """This function is a coroutine. Gets information about a bot from discordbots.org Parameters ========== bot_id: int[Optional] The bot_id of the bot you want to lookup. Returns ======= bot_...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L159-L179
[ "async", "def", "get_bot_info", "(", "self", ",", "bot_id", ":", "int", "=", "None", ")", ":", "if", "bot_id", "is", "None", ":", "bot_id", "=", "self", ".", "bot_id", "return", "await", "self", ".", "http", ".", "get_bot_info", "(", "bot_id", ")" ]
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.get_bots
This function is a coroutine. Gets information about listed bots on discordbots.org Parameters ========== limit: int[Optional] The number of results you wish to lookup. Defaults to 50. Max 500. offset: int[Optional] The amount of bots to skip. Defaults ...
dbl/client.py
async def get_bots(self, limit: int = 50, offset: int = 0): """This function is a coroutine. Gets information about listed bots on discordbots.org Parameters ========== limit: int[Optional] The number of results you wish to lookup. Defaults to 50. Max 500. ...
async def get_bots(self, limit: int = 50, offset: int = 0): """This function is a coroutine. Gets information about listed bots on discordbots.org Parameters ========== limit: int[Optional] The number of results you wish to lookup. Defaults to 50. Max 500. ...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L181-L201
[ "async", "def", "get_bots", "(", "self", ",", "limit", ":", "int", "=", "50", ",", "offset", ":", "int", "=", "0", ")", ":", "return", "await", "self", ".", "http", ".", "get_bots", "(", "limit", ",", "offset", ")" ]
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.generate_widget_large
This function is a coroutine. Generates a custom large widget. Do not add `#` to the color codes (e.g. #FF00FF become FF00FF). Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. top: str The hex color code of the top ...
dbl/client.py
async def generate_widget_large( self, bot_id: int = None, top: str = '2C2F33', mid: str = '23272A', user: str = 'FFFFFF', cert: str = 'FFFFFF', data: str = 'FFFFFF', label: str = '99AAB5', highlight: str = '2C2F...
async def generate_widget_large( self, bot_id: int = None, top: str = '2C2F33', mid: str = '23272A', user: str = 'FFFFFF', cert: str = 'FFFFFF', data: str = 'FFFFFF', label: str = '99AAB5', highlight: str = '2C2F...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L223-L267
[ "async", "def", "generate_widget_large", "(", "self", ",", "bot_id", ":", "int", "=", "None", ",", "top", ":", "str", "=", "'2C2F33'", ",", "mid", ":", "str", "=", "'23272A'", ",", "user", ":", "str", "=", "'FFFFFF'", ",", "cert", ":", "str", "=", ...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.get_widget_large
This function is a coroutine. Generates the default large widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the widget: str
dbl/client.py
async def get_widget_large(self, bot_id: int = None): """This function is a coroutine. Generates the default large widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
async def get_widget_large(self, bot_id: int = None): """This function is a coroutine. Generates the default large widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L269-L288
[ "async", "def", "get_widget_large", "(", "self", ",", "bot_id", ":", "int", "=", "None", ")", ":", "if", "bot_id", "is", "None", ":", "bot_id", "=", "self", ".", "bot_id", "url", "=", "'https://discordbots.org/api/widget/{0}.png'", ".", "format", "(", "bot_i...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.generate_widget_small
This function is a coroutine. Generates a custom large widget. Do not add `#` to the color codes (e.g. #FF00FF become FF00FF). Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. avabg: str The hex color code of the ba...
dbl/client.py
async def generate_widget_small( self, bot_id: int = None, avabg: str = '2C2F33', lcol: str = '23272A', rcol: str = '2C2F33', ltxt: str = 'FFFFFF', rtxt: str = 'FFFFFF' ): """This function is a coroutine. Generates ...
async def generate_widget_small( self, bot_id: int = None, avabg: str = '2C2F33', lcol: str = '23272A', rcol: str = '2C2F33', ltxt: str = 'FFFFFF', rtxt: str = 'FFFFFF' ): """This function is a coroutine. Generates ...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L290-L328
[ "async", "def", "generate_widget_small", "(", "self", ",", "bot_id", ":", "int", "=", "None", ",", "avabg", ":", "str", "=", "'2C2F33'", ",", "lcol", ":", "str", "=", "'23272A'", ",", "rcol", ":", "str", "=", "'2C2F33'", ",", "ltxt", ":", "str", "=",...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.get_widget_small
This function is a coroutine. Generates the default small widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the widget: str
dbl/client.py
async def get_widget_small(self, bot_id: int = None): """This function is a coroutine. Generates the default small widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
async def get_widget_small(self, bot_id: int = None): """This function is a coroutine. Generates the default small widget. Parameters ========== bot_id: int The bot_id of the bot you wish to make a widget for. Returns ======= URL of the wi...
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L330-L349
[ "async", "def", "get_widget_small", "(", "self", ",", "bot_id", ":", "int", "=", "None", ")", ":", "if", "bot_id", "is", "None", ":", "bot_id", "=", "self", ".", "bot_id", "url", "=", "'https://discordbots.org/api/widget/lib/{0}.png'", ".", "format", "(", "b...
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Client.close
This function is a coroutine. Closes all connections.
dbl/client.py
async def close(self): """This function is a coroutine. Closes all connections.""" if self._is_closed: return else: await self.http.close() self._is_closed = True
async def close(self): """This function is a coroutine. Closes all connections.""" if self._is_closed: return else: await self.http.close() self._is_closed = True
[ "This", "function", "is", "a", "coroutine", "." ]
DiscordBotList/DBL-Python-Library
python
https://github.com/DiscordBotList/DBL-Python-Library/blob/c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa/dbl/client.py#L351-L359
[ "async", "def", "close", "(", "self", ")", ":", "if", "self", ".", "_is_closed", ":", "return", "else", ":", "await", "self", ".", "http", ".", "close", "(", ")", "self", ".", "_is_closed", "=", "True" ]
c1461ae0acc644cdeedef8fd6b5e36f76d81c1aa
test
Port.read
Read incoming message.
priv/python3/erlport/erlproto.py
def read(self): """Read incoming message.""" packet = self.packet with self.__read_lock: buffer = self.__buffer while len(buffer) < packet: buffer += self._read_data() length = self.__unpack(buffer[:packet])[0] + packet while len(bu...
def read(self): """Read incoming message.""" packet = self.packet with self.__read_lock: buffer = self.__buffer while len(buffer) < packet: buffer += self._read_data() length = self.__unpack(buffer[:packet])[0] + packet while len(bu...
[ "Read", "incoming", "message", "." ]
hdima/erlport
python
https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlproto.py#L84-L95
[ "def", "read", "(", "self", ")", ":", "packet", "=", "self", ".", "packet", "with", "self", ".", "__read_lock", ":", "buffer", "=", "self", ".", "__buffer", "while", "len", "(", "buffer", ")", "<", "packet", ":", "buffer", "+=", "self", ".", "_read_d...
246b7722d62b87b48be66d9a871509a537728962
test
Port.write
Write outgoing message.
priv/python3/erlport/erlproto.py
def write(self, message): """Write outgoing message.""" data = encode(message, compressed=self.compressed) length = len(data) data = self.__pack(length) + data with self.__write_lock: while data: try: n = os.write(self.out_d, data) ...
def write(self, message): """Write outgoing message.""" data = encode(message, compressed=self.compressed) length = len(data) data = self.__pack(length) + data with self.__write_lock: while data: try: n = os.write(self.out_d, data) ...
[ "Write", "outgoing", "message", "." ]
hdima/erlport
python
https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlproto.py#L97-L113
[ "def", "write", "(", "self", ",", "message", ")", ":", "data", "=", "encode", "(", "message", ",", "compressed", "=", "self", ".", "compressed", ")", "length", "=", "len", "(", "data", ")", "data", "=", "self", ".", "__pack", "(", "length", ")", "+...
246b7722d62b87b48be66d9a871509a537728962
test
Port.close
Close port.
priv/python3/erlport/erlproto.py
def close(self): """Close port.""" os.close(self.in_d) os.close(self.out_d)
def close(self): """Close port.""" os.close(self.in_d) os.close(self.out_d)
[ "Close", "port", "." ]
hdima/erlport
python
https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlproto.py#L115-L118
[ "def", "close", "(", "self", ")", ":", "os", ".", "close", "(", "self", ".", "in_d", ")", "os", ".", "close", "(", "self", ".", "out_d", ")" ]
246b7722d62b87b48be66d9a871509a537728962
test
decode
Decode Erlang external term.
priv/python3/erlport/erlterms.py
def decode(string): """Decode Erlang external term.""" if not string: raise IncompleteData(string) if string[0] != 131: raise ValueError("unknown protocol version: %r" % string[0]) if string[1:2] == b'P': # compressed term if len(string) < 16: raise Incomplete...
def decode(string): """Decode Erlang external term.""" if not string: raise IncompleteData(string) if string[0] != 131: raise ValueError("unknown protocol version: %r" % string[0]) if string[1:2] == b'P': # compressed term if len(string) < 16: raise Incomplete...
[ "Decode", "Erlang", "external", "term", "." ]
hdima/erlport
python
https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlterms.py#L168-L188
[ "def", "decode", "(", "string", ")", ":", "if", "not", "string", ":", "raise", "IncompleteData", "(", "string", ")", "if", "string", "[", "0", "]", "!=", "131", ":", "raise", "ValueError", "(", "\"unknown protocol version: %r\"", "%", "string", "[", "0", ...
246b7722d62b87b48be66d9a871509a537728962
test
encode
Encode Erlang external term.
priv/python3/erlport/erlterms.py
def encode(term, compressed=False): """Encode Erlang external term.""" encoded_term = encode_term(term) # False and 0 do not attempt compression. if compressed: if compressed is True: # default compression level of 6 compressed = 6 elif compressed < 0 or compresse...
def encode(term, compressed=False): """Encode Erlang external term.""" encoded_term = encode_term(term) # False and 0 do not attempt compression. if compressed: if compressed is True: # default compression level of 6 compressed = 6 elif compressed < 0 or compresse...
[ "Encode", "Erlang", "external", "term", "." ]
hdima/erlport
python
https://github.com/hdima/erlport/blob/246b7722d62b87b48be66d9a871509a537728962/priv/python3/erlport/erlterms.py#L317-L332
[ "def", "encode", "(", "term", ",", "compressed", "=", "False", ")", ":", "encoded_term", "=", "encode_term", "(", "term", ")", "# False and 0 do not attempt compression.", "if", "compressed", ":", "if", "compressed", "is", "True", ":", "# default compression level o...
246b7722d62b87b48be66d9a871509a537728962
test
SdSecureClient.get_default_falco_rules_files
**Description** Get the set of falco rules files from the backend. The _files programs and endpoints are a replacement for the system_file endpoints and allow for publishing multiple files instead of a single file as well as publishing multiple variants of a given file that are...
sdcclient/_secure.py
def get_default_falco_rules_files(self): '''**Description** Get the set of falco rules files from the backend. The _files programs and endpoints are a replacement for the system_file endpoints and allow for publishing multiple files instead of a single file as well as p...
def get_default_falco_rules_files(self): '''**Description** Get the set of falco rules files from the backend. The _files programs and endpoints are a replacement for the system_file endpoints and allow for publishing multiple files instead of a single file as well as p...
[ "**", "Description", "**", "Get", "the", "set", "of", "falco", "rules", "files", "from", "the", "backend", ".", "The", "_files", "programs", "and", "endpoints", "are", "a", "replacement", "for", "the", "system_file", "endpoints", "and", "allow", "for", "publ...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L112-L178
[ "def", "get_default_falco_rules_files", "(", "self", ")", ":", "res", "=", "self", ".", "_get_falco_rules_files", "(", "\"default\"", ")", "if", "not", "res", "[", "0", "]", ":", "return", "res", "else", ":", "res_obj", "=", "res", "[", "1", "]", "[", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.save_default_falco_rules_files
**Description** Given a dict returned from get_default_falco_rules_files, save those files to a set of files below save_dir. The first level below save_dir is a directory with the tag name. The second level is a directory per file. The third level is a directory per variant. Fi...
sdcclient/_secure.py
def save_default_falco_rules_files(self, fsobj, save_dir): '''**Description** Given a dict returned from get_default_falco_rules_files, save those files to a set of files below save_dir. The first level below save_dir is a directory with the tag name. The second level is a directory p...
def save_default_falco_rules_files(self, fsobj, save_dir): '''**Description** Given a dict returned from get_default_falco_rules_files, save those files to a set of files below save_dir. The first level below save_dir is a directory with the tag name. The second level is a directory p...
[ "**", "Description", "**", "Given", "a", "dict", "returned", "from", "get_default_falco_rules_files", "save", "those", "files", "to", "a", "set", "of", "files", "below", "save_dir", ".", "The", "first", "level", "below", "save_dir", "is", "a", "directory", "wi...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L180-L241
[ "def", "save_default_falco_rules_files", "(", "self", ",", "fsobj", ",", "save_dir", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "save_dir", ")", ":", "try", ":", "if", "os", ".", "path", ".", "isdir", "(", "save_dir", ")", ":", "shutil", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.load_default_falco_rules_files
**Description** Given a file and directory layout as described in save_default_falco_rules_files(), load those files and return a dict representing the contents. This dict is suitable for passing to set_default_falco_rules_files(). **Arguments** - save_dir: a directory path ...
sdcclient/_secure.py
def load_default_falco_rules_files(self, save_dir): '''**Description** Given a file and directory layout as described in save_default_falco_rules_files(), load those files and return a dict representing the contents. This dict is suitable for passing to set_default_falco_rules_files(). ...
def load_default_falco_rules_files(self, save_dir): '''**Description** Given a file and directory layout as described in save_default_falco_rules_files(), load those files and return a dict representing the contents. This dict is suitable for passing to set_default_falco_rules_files(). ...
[ "**", "Description", "**", "Given", "a", "file", "and", "directory", "layout", "as", "described", "in", "save_default_falco_rules_files", "()", "load", "those", "files", "and", "return", "a", "dict", "representing", "the", "contents", ".", "This", "dict", "is", ...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L281-L334
[ "def", "load_default_falco_rules_files", "(", "self", ",", "save_dir", ")", ":", "tags", "=", "os", ".", "listdir", "(", "save_dir", ")", "if", "len", "(", "tags", ")", "!=", "1", ":", "return", "[", "False", ",", "\"Directory {} did not contain exactly 1 entr...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_policy_events_duration
**Description** Fetch all policy events that occurred in the last duration_sec seconds. This method is used in conjunction with :func:`~sdcclient.SdSecureClient.get_more_policy_events` to provide paginated access to policy events. **Arguments** - duration_sec: Fetch all poli...
sdcclient/_secure.py
def get_policy_events_duration(self, duration_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events that occurred in the last duration_sec seconds. This method is used in conjunction with :func:`~sdcclient.SdSecureClient....
def get_policy_events_duration(self, duration_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events that occurred in the last duration_sec seconds. This method is used in conjunction with :func:`~sdcclient.SdSecureClient....
[ "**", "Description", "**", "Fetch", "all", "policy", "events", "that", "occurred", "in", "the", "last", "duration_sec", "seconds", ".", "This", "method", "is", "used", "in", "conjunction", "with", ":", "func", ":", "~sdcclient", ".", "SdSecureClient", ".", "...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L391-L426
[ "def", "get_policy_events_duration", "(", "self", ",", "duration_sec", ",", "sampling", "=", "None", ",", "aggregations", "=", "None", ",", "scope_filter", "=", "None", ",", "event_filter", "=", "None", ")", ":", "epoch", "=", "datetime", ".", "datetime", "....
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_policy_events_id_range
**Description** Fetch all policy events with id that occurred in the time range [from_sec:to_sec]. This method is used in conjunction with :func:`~sdcclient.SdSecureClient.get_more_policy_events` to provide paginated access to policy events. **Arguments** - id: the id of the...
sdcclient/_secure.py
def get_policy_events_id_range(self, id, from_sec, to_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events with id that occurred in the time range [from_sec:to_sec]. This method is used in conjunction with :func:`~sdccli...
def get_policy_events_id_range(self, id, from_sec, to_sec, sampling=None, aggregations=None, scope_filter=None, event_filter=None): '''**Description** Fetch all policy events with id that occurred in the time range [from_sec:to_sec]. This method is used in conjunction with :func:`~sdccli...
[ "**", "Description", "**", "Fetch", "all", "policy", "events", "with", "id", "that", "occurred", "in", "the", "time", "range", "[", "from_sec", ":", "to_sec", "]", ".", "This", "method", "is", "used", "in", "conjunction", "with", ":", "func", ":", "~sdcc...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L428-L462
[ "def", "get_policy_events_id_range", "(", "self", ",", "id", ",", "from_sec", ",", "to_sec", ",", "sampling", "=", "None", ",", "aggregations", "=", "None", ",", "scope_filter", "=", "None", ",", "event_filter", "=", "None", ")", ":", "options", "=", "{", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.create_default_policies
**Description** Create a set of default policies using the current system falco rules file as a reference. For every falco rule in the system falco rules file, one policy will be created. The policy will take the name and description from the name and description of the corresponding...
sdcclient/_secure.py
def create_default_policies(self): '''**Description** Create a set of default policies using the current system falco rules file as a reference. For every falco rule in the system falco rules file, one policy will be created. The policy will take the name and description from the name an...
def create_default_policies(self): '''**Description** Create a set of default policies using the current system falco rules file as a reference. For every falco rule in the system falco rules file, one policy will be created. The policy will take the name and description from the name an...
[ "**", "Description", "**", "Create", "a", "set", "of", "default", "policies", "using", "the", "current", "system", "falco", "rules", "file", "as", "a", "reference", ".", "For", "every", "falco", "rule", "in", "the", "system", "falco", "rules", "file", "one...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L533-L551
[ "def", "create_default_policies", "(", "self", ")", ":", "res", "=", "requests", ".", "post", "(", "self", ".", "url", "+", "'/api/policies/createDefault'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "retu...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.delete_all_policies
**Description** Delete all existing policies. The falco rules file is unchanged. **Arguments** - None **Success Return Value** The string "Policies Deleted" **Example** `examples/delete_all_policies.py <https://github.com/draios/python-sdc-clien...
sdcclient/_secure.py
def delete_all_policies(self): '''**Description** Delete all existing policies. The falco rules file is unchanged. **Arguments** - None **Success Return Value** The string "Policies Deleted" **Example** `examples/delete_all_policies.py <...
def delete_all_policies(self): '''**Description** Delete all existing policies. The falco rules file is unchanged. **Arguments** - None **Success Return Value** The string "Policies Deleted" **Example** `examples/delete_all_policies.py <...
[ "**", "Description", "**", "Delete", "all", "existing", "policies", ".", "The", "falco", "rules", "file", "is", "unchanged", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L553-L571
[ "def", "delete_all_policies", "(", "self", ")", ":", "res", "=", "requests", ".", "post", "(", "self", ".", "url", "+", "'/api/policies/deleteAll'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "if", "not"...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.set_policy_priorities
**Description** Change the policy evaluation order **Arguments** - priorities_json: a description of the new policy order. **Success Return Value** A JSON object representing the updated list of policy ids. **Example** `examples/set_policy_order...
sdcclient/_secure.py
def set_policy_priorities(self, priorities_json): '''**Description** Change the policy evaluation order **Arguments** - priorities_json: a description of the new policy order. **Success Return Value** A JSON object representing the updated list of policy ids...
def set_policy_priorities(self, priorities_json): '''**Description** Change the policy evaluation order **Arguments** - priorities_json: a description of the new policy order. **Success Return Value** A JSON object representing the updated list of policy ids...
[ "**", "Description", "**", "Change", "the", "policy", "evaluation", "order" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L608-L629
[ "def", "set_policy_priorities", "(", "self", ",", "priorities_json", ")", ":", "try", ":", "json", ".", "loads", "(", "priorities_json", ")", "except", "Exception", "as", "e", ":", "return", "[", "False", ",", "\"priorities json is not valid json: {}\"", ".", "f...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_policy
**Description** Find the policy with name <name> and return its json description. **Arguments** - name: the name of the policy to fetch **Success Return Value** A JSON object containing the description of the policy. If there is no policy with the given ...
sdcclient/_secure.py
def get_policy(self, name): '''**Description** Find the policy with name <name> and return its json description. **Arguments** - name: the name of the policy to fetch **Success Return Value** A JSON object containing the description of the policy. If there i...
def get_policy(self, name): '''**Description** Find the policy with name <name> and return its json description. **Arguments** - name: the name of the policy to fetch **Success Return Value** A JSON object containing the description of the policy. If there i...
[ "**", "Description", "**", "Find", "the", "policy", "with", "name", "<name", ">", "and", "return", "its", "json", "description", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L631-L657
[ "def", "get_policy", "(", "self", ",", "name", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/policies'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "if", "not", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.add_policy
**Description** Add a new policy using the provided json. **Arguments** - policy_json: a description of the new policy **Success Return Value** The string "OK" **Example** `examples/add_policy.py <https://github.com/draios/python-sdc-client/blob...
sdcclient/_secure.py
def add_policy(self, policy_json): '''**Description** Add a new policy using the provided json. **Arguments** - policy_json: a description of the new policy **Success Return Value** The string "OK" **Example** `examples/add_policy.py <ht...
def add_policy(self, policy_json): '''**Description** Add a new policy using the provided json. **Arguments** - policy_json: a description of the new policy **Success Return Value** The string "OK" **Example** `examples/add_policy.py <ht...
[ "**", "Description", "**", "Add", "a", "new", "policy", "using", "the", "provided", "json", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L659-L681
[ "def", "add_policy", "(", "self", ",", "policy_json", ")", ":", "try", ":", "policy_obj", "=", "json", ".", "loads", "(", "policy_json", ")", "except", "Exception", "as", "e", ":", "return", "[", "False", ",", "\"policy json is not valid json: {}\"", ".", "f...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.delete_policy_name
**Description** Delete the policy with the given name. **Arguments** - name: the name of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** `examples/delete_policy.py <https://github.co...
sdcclient/_secure.py
def delete_policy_name(self, name): '''**Description** Delete the policy with the given name. **Arguments** - name: the name of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** ...
def delete_policy_name(self, name): '''**Description** Delete the policy with the given name. **Arguments** - name: the name of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** ...
[ "**", "Description", "**", "Delete", "the", "policy", "with", "the", "given", "name", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L712-L735
[ "def", "delete_policy_name", "(", "self", ",", "name", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/policies'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "if", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.delete_policy_id
**Description** Delete the policy with the given id **Arguments** - id: the id of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** `examples/delete_policy.py <https://github.com/draio...
sdcclient/_secure.py
def delete_policy_id(self, id): '''**Description** Delete the policy with the given id **Arguments** - id: the id of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** `examples...
def delete_policy_id(self, id): '''**Description** Delete the policy with the given id **Arguments** - id: the id of the policy to delete **Success Return Value** The JSON object representing the now-deleted policy. **Example** `examples...
[ "**", "Description", "**", "Delete", "the", "policy", "with", "the", "given", "id" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L737-L752
[ "def", "delete_policy_id", "(", "self", ",", "id", ")", ":", "res", "=", "requests", ".", "delete", "(", "self", ".", "url", "+", "'/api/policies/{}'", ".", "format", "(", "id", ")", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.add_compliance_task
**Description** Add a new compliance task. **Arguments** - name: The name of the task e.g. 'Check Docker Compliance'. - module_name: The name of the module that implements this task. Separate from task name in case you want to use the same module to run separate tasks with d...
sdcclient/_secure.py
def add_compliance_task(self, name, module_name='docker-bench-security', schedule='06:00:00Z/PT12H', scope=None, enabled=True): '''**Description** Add a new compliance task. **Arguments** - name: The name of the task e.g. 'Check Docker Compliance'. - module_name: The...
def add_compliance_task(self, name, module_name='docker-bench-security', schedule='06:00:00Z/PT12H', scope=None, enabled=True): '''**Description** Add a new compliance task. **Arguments** - name: The name of the task e.g. 'Check Docker Compliance'. - module_name: The...
[ "**", "Description", "**", "Add", "a", "new", "compliance", "task", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L754-L777
[ "def", "add_compliance_task", "(", "self", ",", "name", ",", "module_name", "=", "'docker-bench-security'", ",", "schedule", "=", "'06:00:00Z/PT12H'", ",", "scope", "=", "None", ",", "enabled", "=", "True", ")", ":", "task", "=", "{", "\"id\"", ":", "None", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.list_compliance_tasks
**Description** Get the list of all compliance tasks. **Arguments** - None **Success Return Value** A JSON list with the representation of each compliance task.
sdcclient/_secure.py
def list_compliance_tasks(self): '''**Description** Get the list of all compliance tasks. **Arguments** - None **Success Return Value** A JSON list with the representation of each compliance task. ''' res = requests.get(self.url + '/api/compl...
def list_compliance_tasks(self): '''**Description** Get the list of all compliance tasks. **Arguments** - None **Success Return Value** A JSON list with the representation of each compliance task. ''' res = requests.get(self.url + '/api/compl...
[ "**", "Description", "**", "Get", "the", "list", "of", "all", "compliance", "tasks", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L779-L790
[ "def", "list_compliance_tasks", "(", "self", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/complianceTasks'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "return", "se...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_compliance_task
**Description** Get a compliance task. **Arguments** - id: the id of the compliance task to get. **Success Return Value** A JSON representation of the compliance task.
sdcclient/_secure.py
def get_compliance_task(self, id): '''**Description** Get a compliance task. **Arguments** - id: the id of the compliance task to get. **Success Return Value** A JSON representation of the compliance task. ''' res = requests.get(self.url + '/...
def get_compliance_task(self, id): '''**Description** Get a compliance task. **Arguments** - id: the id of the compliance task to get. **Success Return Value** A JSON representation of the compliance task. ''' res = requests.get(self.url + '/...
[ "**", "Description", "**", "Get", "a", "compliance", "task", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L792-L803
[ "def", "get_compliance_task", "(", "self", ",", "id", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/complianceTasks/{}'", ".", "format", "(", "id", ")", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.update_compliance_task
**Description** Update an existing compliance task. **Arguments** - id: the id of the compliance task to be updated. - name: The name of the task e.g. 'Check Docker Compliance'. - module_name: The name of the module that implements this task. Separate from task n...
sdcclient/_secure.py
def update_compliance_task(self, id, name=None, module_name=None, schedule=None, scope=None, enabled=None): '''**Description** Update an existing compliance task. **Arguments** - id: the id of the compliance task to be updated. - name: The name of the task e.g. 'Chec...
def update_compliance_task(self, id, name=None, module_name=None, schedule=None, scope=None, enabled=None): '''**Description** Update an existing compliance task. **Arguments** - id: the id of the compliance task to be updated. - name: The name of the task e.g. 'Chec...
[ "**", "Description", "**", "Update", "an", "existing", "compliance", "task", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L805-L834
[ "def", "update_compliance_task", "(", "self", ",", "id", ",", "name", "=", "None", ",", "module_name", "=", "None", ",", "schedule", "=", "None", ",", "scope", "=", "None", ",", "enabled", "=", "None", ")", ":", "ok", ",", "res", "=", "self", ".", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.delete_compliance_task
**Description** Delete the compliance task with the given id **Arguments** - id: the id of the compliance task to delete
sdcclient/_secure.py
def delete_compliance_task(self, id): '''**Description** Delete the compliance task with the given id **Arguments** - id: the id of the compliance task to delete ''' res = requests.delete(self.url + '/api/complianceTasks/{}'.format(id), headers=self.hdrs, verify=...
def delete_compliance_task(self, id): '''**Description** Delete the compliance task with the given id **Arguments** - id: the id of the compliance task to delete ''' res = requests.delete(self.url + '/api/complianceTasks/{}'.format(id), headers=self.hdrs, verify=...
[ "**", "Description", "**", "Delete", "the", "compliance", "task", "with", "the", "given", "id" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L836-L847
[ "def", "delete_compliance_task", "(", "self", ",", "id", ")", ":", "res", "=", "requests", ".", "delete", "(", "self", ".", "url", "+", "'/api/complianceTasks/{}'", ".", "format", "(", "id", ")", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", ...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.list_compliance_results
**Description** Get the list of all compliance tasks runs. **Arguments** - limit: Maximum number of alerts in the response. - direction: the direction (PREV or NEXT) that determines which results to return in relation to cursor. - cursor: An opaque string represe...
sdcclient/_secure.py
def list_compliance_results(self, limit=50, direction=None, cursor=None, filter=""): '''**Description** Get the list of all compliance tasks runs. **Arguments** - limit: Maximum number of alerts in the response. - direction: the direction (PREV or NEXT) that determin...
def list_compliance_results(self, limit=50, direction=None, cursor=None, filter=""): '''**Description** Get the list of all compliance tasks runs. **Arguments** - limit: Maximum number of alerts in the response. - direction: the direction (PREV or NEXT) that determin...
[ "**", "Description", "**", "Get", "the", "list", "of", "all", "compliance", "tasks", "runs", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L849-L869
[ "def", "list_compliance_results", "(", "self", ",", "limit", "=", "50", ",", "direction", "=", "None", ",", "cursor", "=", "None", ",", "filter", "=", "\"\"", ")", ":", "url", "=", "\"{url}/api/complianceResults?cursor{cursor}&filter={filter}&limit={limit}{direction}\...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_compliance_results_csv
**Description** Retrieve the details for a specific compliance task run result in csv. **Arguments** - id: the id of the compliance task run to get. **Success Return Value** A CSV representation of the compliance task run result.
sdcclient/_secure.py
def get_compliance_results_csv(self, id): '''**Description** Retrieve the details for a specific compliance task run result in csv. **Arguments** - id: the id of the compliance task run to get. **Success Return Value** A CSV representation of the compliance ...
def get_compliance_results_csv(self, id): '''**Description** Retrieve the details for a specific compliance task run result in csv. **Arguments** - id: the id of the compliance task run to get. **Success Return Value** A CSV representation of the compliance ...
[ "**", "Description", "**", "Retrieve", "the", "details", "for", "a", "specific", "compliance", "task", "run", "result", "in", "csv", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L884-L898
[ "def", "get_compliance_results_csv", "(", "self", ",", "id", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/complianceResults/{}/csv'", ".", "format", "(", "id", ")", ",", "headers", "=", "self", ".", "hdrs", ",", "ver...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.list_commands_audit
**Description** List the commands audit. **Arguments** - from_sec: the start of the timerange for which to get commands audit. - end_sec: the end of the timerange for which to get commands audit. - scope_filter: this is a SysdigMonitor-like filter (e.g 'container...
sdcclient/_secure.py
def list_commands_audit(self, from_sec=None, to_sec=None, scope_filter=None, command_filter=None, limit=100, offset=0, metrics=[]): '''**Description** List the commands audit. **Arguments** - from_sec: the start of the timerange for which to get commands audit. - end...
def list_commands_audit(self, from_sec=None, to_sec=None, scope_filter=None, command_filter=None, limit=100, offset=0, metrics=[]): '''**Description** List the commands audit. **Arguments** - from_sec: the start of the timerange for which to get commands audit. - end...
[ "**", "Description", "**", "List", "the", "commands", "audit", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L900-L930
[ "def", "list_commands_audit", "(", "self", ",", "from_sec", "=", "None", ",", "to_sec", "=", "None", ",", "scope_filter", "=", "None", ",", "command_filter", "=", "None", ",", "limit", "=", "100", ",", "offset", "=", "0", ",", "metrics", "=", "[", "]",...
47f83415842048778939b90944f64386a3bcb205
test
SdSecureClient.get_command_audit
**Description** Get a command audit. **Arguments** - id: the id of the command audit to get. **Success Return Value** A JSON representation of the command audit.
sdcclient/_secure.py
def get_command_audit(self, id, metrics=[]): '''**Description** Get a command audit. **Arguments** - id: the id of the command audit to get. **Success Return Value** A JSON representation of the command audit. ''' url = "{url}/api/commands/{i...
def get_command_audit(self, id, metrics=[]): '''**Description** Get a command audit. **Arguments** - id: the id of the command audit to get. **Success Return Value** A JSON representation of the command audit. ''' url = "{url}/api/commands/{i...
[ "**", "Description", "**", "Get", "a", "command", "audit", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_secure.py#L932-L948
[ "def", "get_command_audit", "(", "self", ",", "id", ",", "metrics", "=", "[", "]", ")", ":", "url", "=", "\"{url}/api/commands/{id}?from=0&to={to}{metrics}\"", ".", "format", "(", "url", "=", "self", ".", "url", ",", "id", "=", "id", ",", "to", "=", "int...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.get_notifications
**Description** Returns the list of Sysdig Monitor alert notifications. **Arguments** - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **to_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **state**: fi...
sdcclient/_monitor.py
def get_notifications(self, from_ts, to_ts, state=None, resolved=None): '''**Description** Returns the list of Sysdig Monitor alert notifications. **Arguments** - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **to_ts**: filter even...
def get_notifications(self, from_ts, to_ts, state=None, resolved=None): '''**Description** Returns the list of Sysdig Monitor alert notifications. **Arguments** - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **to_ts**: filter even...
[ "**", "Description", "**", "Returns", "the", "list", "of", "Sysdig", "Monitor", "alert", "notifications", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L36-L69
[ "def", "get_notifications", "(", "self", ",", "from_ts", ",", "to_ts", ",", "state", "=", "None", ",", "resolved", "=", "None", ")", ":", "params", "=", "{", "}", "if", "from_ts", "is", "not", "None", ":", "params", "[", "'from'", "]", "=", "from_ts"...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.update_notification_resolution
**Description** Updates the resolution status of an alert notification. **Arguments** - **notification**: notification object as returned by :func:`~SdcClient.get_notifications`. - **resolved**: new resolution status. Supported values are ``True`` and ``False``. **S...
sdcclient/_monitor.py
def update_notification_resolution(self, notification, resolved): '''**Description** Updates the resolution status of an alert notification. **Arguments** - **notification**: notification object as returned by :func:`~SdcClient.get_notifications`. - **resolved**: new...
def update_notification_resolution(self, notification, resolved): '''**Description** Updates the resolution status of an alert notification. **Arguments** - **notification**: notification object as returned by :func:`~SdcClient.get_notifications`. - **resolved**: new...
[ "**", "Description", "**", "Updates", "the", "resolution", "status", "of", "an", "alert", "notification", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L71-L92
[ "def", "update_notification_resolution", "(", "self", ",", "notification", ",", "resolved", ")", ":", "if", "'id'", "not", "in", "notification", ":", "return", "[", "False", ",", "'Invalid notification format'", "]", "notification", "[", "'resolved'", "]", "=", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.create_alert
**Description** Create a threshold-based alert. **Arguments** - **name**: the alert name. This will appear in the Sysdig Monitor UI and in notification emails. - **description**: the alert description. This will appear in the Sysdig Monitor UI and in notification emails. ...
sdcclient/_monitor.py
def create_alert(self, name=None, description=None, severity=None, for_atleast_s=None, condition=None, segmentby=[], segment_condition='ANY', user_filter='', notify=None, enabled=True, annotations={}, alert_obj=None): '''**Description** Create a threshold-ba...
def create_alert(self, name=None, description=None, severity=None, for_atleast_s=None, condition=None, segmentby=[], segment_condition='ANY', user_filter='', notify=None, enabled=True, annotations={}, alert_obj=None): '''**Description** Create a threshold-ba...
[ "**", "Description", "**", "Create", "a", "threshold", "-", "based", "alert", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L94-L170
[ "def", "create_alert", "(", "self", ",", "name", "=", "None", ",", "description", "=", "None", ",", "severity", "=", "None", ",", "for_atleast_s", "=", "None", ",", "condition", "=", "None", ",", "segmentby", "=", "[", "]", ",", "segment_condition", "=",...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.update_alert
**Description** Update a modified threshold-based alert. **Arguments** - **alert**: one modified alert object of the same format as those in the list returned by :func:`~SdcClient.get_alerts`. **Success Return Value** The updated alert. **Example** ...
sdcclient/_monitor.py
def update_alert(self, alert): '''**Description** Update a modified threshold-based alert. **Arguments** - **alert**: one modified alert object of the same format as those in the list returned by :func:`~SdcClient.get_alerts`. **Success Return Value** The up...
def update_alert(self, alert): '''**Description** Update a modified threshold-based alert. **Arguments** - **alert**: one modified alert object of the same format as those in the list returned by :func:`~SdcClient.get_alerts`. **Success Return Value** The up...
[ "**", "Description", "**", "Update", "a", "modified", "threshold", "-", "based", "alert", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L172-L189
[ "def", "update_alert", "(", "self", ",", "alert", ")", ":", "if", "'id'", "not", "in", "alert", ":", "return", "[", "False", ",", "\"Invalid alert format\"", "]", "res", "=", "requests", ".", "put", "(", "self", ".", "url", "+", "'/api/alerts/'", "+", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.delete_alert
**Description** Deletes an alert. **Arguments** - **alert**: the alert dictionary as returned by :func:`~SdcClient.get_alerts`. **Success Return Value** ``None``. **Example** `examples/delete_alert.py <https://github.com/draios/python-sdc-client...
sdcclient/_monitor.py
def delete_alert(self, alert): '''**Description** Deletes an alert. **Arguments** - **alert**: the alert dictionary as returned by :func:`~SdcClient.get_alerts`. **Success Return Value** ``None``. **Example** `examples/delete_alert.py <h...
def delete_alert(self, alert): '''**Description** Deletes an alert. **Arguments** - **alert**: the alert dictionary as returned by :func:`~SdcClient.get_alerts`. **Success Return Value** ``None``. **Example** `examples/delete_alert.py <h...
[ "**", "Description", "**", "Deletes", "an", "alert", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L191-L211
[ "def", "delete_alert", "(", "self", ",", "alert", ")", ":", "if", "'id'", "not", "in", "alert", ":", "return", "[", "False", ",", "'Invalid alert format'", "]", "res", "=", "requests", ".", "delete", "(", "self", ".", "url", "+", "'/api/alerts/'", "+", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.get_explore_grouping_hierarchy
**Description** Return the user's current grouping hierarchy as visible in the Explore tab of Sysdig Monitor. **Success Return Value** A list containing the list of the user's Explore grouping criteria. **Example** `examples/print_explore_grouping.py <https://github...
sdcclient/_monitor.py
def get_explore_grouping_hierarchy(self): '''**Description** Return the user's current grouping hierarchy as visible in the Explore tab of Sysdig Monitor. **Success Return Value** A list containing the list of the user's Explore grouping criteria. **Example** ...
def get_explore_grouping_hierarchy(self): '''**Description** Return the user's current grouping hierarchy as visible in the Explore tab of Sysdig Monitor. **Success Return Value** A list containing the list of the user's Explore grouping criteria. **Example** ...
[ "**", "Description", "**", "Return", "the", "user", "s", "current", "grouping", "hierarchy", "as", "visible", "in", "the", "Explore", "tab", "of", "Sysdig", "Monitor", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L213-L244
[ "def", "get_explore_grouping_hierarchy", "(", "self", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/groupConfigurations'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "i...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.set_explore_grouping_hierarchy
**Description** Changes the grouping hierarchy in the Explore panel of the current user. **Arguments** - **new_hierarchy**: a list of sysdig segmentation metrics indicating the new grouping hierarchy.
sdcclient/_monitor.py
def set_explore_grouping_hierarchy(self, new_hierarchy): '''**Description** Changes the grouping hierarchy in the Explore panel of the current user. **Arguments** - **new_hierarchy**: a list of sysdig segmentation metrics indicating the new grouping hierarchy. ''' ...
def set_explore_grouping_hierarchy(self, new_hierarchy): '''**Description** Changes the grouping hierarchy in the Explore panel of the current user. **Arguments** - **new_hierarchy**: a list of sysdig segmentation metrics indicating the new grouping hierarchy. ''' ...
[ "**", "Description", "**", "Changes", "the", "grouping", "hierarchy", "in", "the", "Explore", "panel", "of", "the", "current", "user", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L246-L266
[ "def", "set_explore_grouping_hierarchy", "(", "self", ",", "new_hierarchy", ")", ":", "body", "=", "{", "'id'", ":", "'explore'", ",", "'groups'", ":", "[", "{", "'groupBy'", ":", "[", "]", "}", "]", "}", "for", "item", "in", "new_hierarchy", ":", "body"...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.get_dashboards
**Description** Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users. **Success Return Value** A dictionary containing the list of available sampling intervals. **Examp...
sdcclient/_monitor.py
def get_dashboards(self): '''**Description** Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users. **Success Return Value** A dictionary containing the list of available...
def get_dashboards(self): '''**Description** Return the list of dashboards available under the given user account. This includes the dashboards created by the user and the ones shared with her by other users. **Success Return Value** A dictionary containing the list of available...
[ "**", "Description", "**", "Return", "the", "list", "of", "dashboards", "available", "under", "the", "given", "user", "account", ".", "This", "includes", "the", "dashboards", "created", "by", "the", "user", "and", "the", "ones", "shared", "with", "her", "by"...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L296-L307
[ "def", "get_dashboards", "(", "self", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "self", ".", "_dashboards_api_endpoint", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", "re...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.find_dashboard_by
**Description** Finds dashboards with the specified name. You can then delete the dashboard (with :func:`~SdcClient.delete_dashboard`) or edit panels (with :func:`~SdcClient.add_dashboard_panel` and :func:`~SdcClient.remove_dashboard_panel`) **Arguments** - **name**: the name of the das...
sdcclient/_monitor.py
def find_dashboard_by(self, name=None): '''**Description** Finds dashboards with the specified name. You can then delete the dashboard (with :func:`~SdcClient.delete_dashboard`) or edit panels (with :func:`~SdcClient.add_dashboard_panel` and :func:`~SdcClient.remove_dashboard_panel`) **Argu...
def find_dashboard_by(self, name=None): '''**Description** Finds dashboards with the specified name. You can then delete the dashboard (with :func:`~SdcClient.delete_dashboard`) or edit panels (with :func:`~SdcClient.add_dashboard_panel` and :func:`~SdcClient.remove_dashboard_panel`) **Argu...
[ "**", "Description", "**", "Finds", "dashboards", "with", "the", "specified", "name", ".", "You", "can", "then", "delete", "the", "dashboard", "(", "with", ":", "func", ":", "~SdcClient", ".", "delete_dashboard", ")", "or", "edit", "panels", "(", "with", "...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L309-L333
[ "def", "find_dashboard_by", "(", "self", ",", "name", "=", "None", ")", ":", "res", "=", "self", ".", "get_dashboards", "(", ")", "if", "res", "[", "0", "]", "is", "False", ":", "return", "res", "else", ":", "def", "filter_fn", "(", "configuration", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.remove_dashboard_panel
**Description** Removes a panel from the dashboard. The panel to remove is identified by the specified ``name``. **Arguments** - **name**: name of the panel to find and remove **Success Return Value** A dictionary showing the details of the edited dashboard. ...
sdcclient/_monitor.py
def remove_dashboard_panel(self, dashboard, panel_name): '''**Description** Removes a panel from the dashboard. The panel to remove is identified by the specified ``name``. **Arguments** - **name**: name of the panel to find and remove **Success Return Value** ...
def remove_dashboard_panel(self, dashboard, panel_name): '''**Description** Removes a panel from the dashboard. The panel to remove is identified by the specified ``name``. **Arguments** - **name**: name of the panel to find and remove **Success Return Value** ...
[ "**", "Description", "**", "Removes", "a", "panel", "from", "the", "dashboard", ".", "The", "panel", "to", "remove", "is", "identified", "by", "the", "specified", "name", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L521-L560
[ "def", "remove_dashboard_panel", "(", "self", ",", "dashboard", ",", "panel_name", ")", ":", "#", "# Clone existing dashboard...", "#", "dashboard_configuration", "=", "copy", ".", "deepcopy", "(", "dashboard", ")", "#", "# ... find the panel", "#", "def", "filter_f...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.create_dashboard_from_view
**Description** Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard. **Arguments** - **newdashname**: the name of the dashboard that will be created. - **viewname**: the name of the view to use ...
sdcclient/_monitor.py
def create_dashboard_from_view(self, newdashname, viewname, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard. **Arguments** - **newdashname...
def create_dashboard_from_view(self, newdashname, viewname, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the Sysdig Monitor views as a template. You will be able to define the scope of the new dashboard. **Arguments** - **newdashname...
[ "**", "Description", "**", "Create", "a", "new", "dasboard", "using", "one", "of", "the", "Sysdig", "Monitor", "views", "as", "a", "template", ".", "You", "will", "be", "able", "to", "define", "the", "scope", "of", "the", "new", "dashboard", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L619-L651
[ "def", "create_dashboard_from_view", "(", "self", ",", "newdashname", ",", "viewname", ",", "filter", ",", "shared", "=", "False", ",", "public", "=", "False", ")", ":", "#", "# Find our template view", "#", "gvres", "=", "self", ".", "get_view", "(", "viewn...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.create_dashboard_from_dashboard
**Description** Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard. **Arguments** - **newdashname**: the name of the dashboard that will be created. - **viewname**: the name of the dasboard to us...
sdcclient/_monitor.py
def create_dashboard_from_dashboard(self, newdashname, templatename, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard. **Arguments** - **newd...
def create_dashboard_from_dashboard(self, newdashname, templatename, filter, shared=False, public=False): '''**Description** Create a new dasboard using one of the existing dashboards as a template. You will be able to define the scope of the new dasboard. **Arguments** - **newd...
[ "**", "Description", "**", "Create", "a", "new", "dasboard", "using", "one", "of", "the", "existing", "dashboards", "as", "a", "template", ".", "You", "will", "be", "able", "to", "define", "the", "scope", "of", "the", "new", "dasboard", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L653-L696
[ "def", "create_dashboard_from_dashboard", "(", "self", ",", "newdashname", ",", "templatename", ",", "filter", ",", "shared", "=", "False", ",", "public", "=", "False", ")", ":", "#", "# Get the list of dashboards from the server", "#", "res", "=", "requests", "."...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.create_dashboard_from_file
**Description** Create a new dasboard using a dashboard template saved to disk. See :func:`~SdcClient.save_dashboard_to_file` to use the file to create a dashboard (usefl to create and restore backups). The file can contain the following JSON formats: 1. dashboard object in the form...
sdcclient/_monitor.py
def create_dashboard_from_file(self, dashboard_name, filename, filter, shared=False, public=False): ''' **Description** Create a new dasboard using a dashboard template saved to disk. See :func:`~SdcClient.save_dashboard_to_file` to use the file to create a dashboard (usefl to create and res...
def create_dashboard_from_file(self, dashboard_name, filename, filter, shared=False, public=False): ''' **Description** Create a new dasboard using a dashboard template saved to disk. See :func:`~SdcClient.save_dashboard_to_file` to use the file to create a dashboard (usefl to create and res...
[ "**", "Description", "**", "Create", "a", "new", "dasboard", "using", "a", "dashboard", "template", "saved", "to", "disk", ".", "See", ":", "func", ":", "~SdcClient", ".", "save_dashboard_to_file", "to", "use", "the", "file", "to", "create", "a", "dashboard"...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L698-L751
[ "def", "create_dashboard_from_file", "(", "self", ",", "dashboard_name", ",", "filename", ",", "filter", ",", "shared", "=", "False", ",", "public", "=", "False", ")", ":", "#", "# Load the Dashboard", "#", "with", "open", "(", "filename", ")", "as", "data_f...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.save_dashboard_to_file
**Description** Save a dashboard to disk. See :func:`~SdcClient.create_dashboard_from_file` to use the file to create a dashboard (usefl to create and restore backups). The file will contain a JSON object with the following properties: * version: dashboards API version (e.g. 'v2') ...
sdcclient/_monitor.py
def save_dashboard_to_file(self, dashboard, filename): ''' **Description** Save a dashboard to disk. See :func:`~SdcClient.create_dashboard_from_file` to use the file to create a dashboard (usefl to create and restore backups). The file will contain a JSON object with the follow...
def save_dashboard_to_file(self, dashboard, filename): ''' **Description** Save a dashboard to disk. See :func:`~SdcClient.create_dashboard_from_file` to use the file to create a dashboard (usefl to create and restore backups). The file will contain a JSON object with the follow...
[ "**", "Description", "**", "Save", "a", "dashboard", "to", "disk", ".", "See", ":", "func", ":", "~SdcClient", ".", "create_dashboard_from_file", "to", "use", "the", "file", "to", "create", "a", "dashboard", "(", "usefl", "to", "create", "and", "restore", ...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L753-L773
[ "def", "save_dashboard_to_file", "(", "self", ",", "dashboard", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "outf", ":", "json", ".", "dump", "(", "{", "'version'", ":", "self", ".", "_dashboards_api_version", ",", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.delete_dashboard
**Description** Deletes a dashboard. **Arguments** - **dashboard**: the dashboard object as returned by :func:`~SdcClient.get_dashboards`. **Success Return Value** `None`. **Example** `examples/delete_dashboard.py <https://github.com/draios/pyth...
sdcclient/_monitor.py
def delete_dashboard(self, dashboard): '''**Description** Deletes a dashboard. **Arguments** - **dashboard**: the dashboard object as returned by :func:`~SdcClient.get_dashboards`. **Success Return Value** `None`. **Example** `examples/d...
def delete_dashboard(self, dashboard): '''**Description** Deletes a dashboard. **Arguments** - **dashboard**: the dashboard object as returned by :func:`~SdcClient.get_dashboards`. **Success Return Value** `None`. **Example** `examples/d...
[ "**", "Description", "**", "Deletes", "a", "dashboard", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L775-L795
[ "def", "delete_dashboard", "(", "self", ",", "dashboard", ")", ":", "if", "'id'", "not", "in", "dashboard", ":", "return", "[", "False", ",", "\"Invalid dashboard format\"", "]", "res", "=", "requests", ".", "delete", "(", "self", ".", "url", "+", "self", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClient.convert_scope_string_to_expression
**Description** Internal function to convert a filter string to a filter object to be used with dashboards.
sdcclient/_monitor.py
def convert_scope_string_to_expression(scope): '''**Description** Internal function to convert a filter string to a filter object to be used with dashboards. ''' # # NOTE: The supported grammar is not perfectly aligned with the grammar supported by the Sysdig backend. ...
def convert_scope_string_to_expression(scope): '''**Description** Internal function to convert a filter string to a filter object to be used with dashboards. ''' # # NOTE: The supported grammar is not perfectly aligned with the grammar supported by the Sysdig backend. ...
[ "**", "Description", "**", "Internal", "function", "to", "convert", "a", "filter", "string", "to", "a", "filter", "object", "to", "be", "used", "with", "dashboards", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor.py#L811-L866
[ "def", "convert_scope_string_to_expression", "(", "scope", ")", ":", "#", "# NOTE: The supported grammar is not perfectly aligned with the grammar supported by the Sysdig backend.", "# Proper grammar implementation will happen soon.", "# For practical purposes, the parsing will have equivalent res...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_notification_ids
**Description** Get an array of all configured Notification Channel IDs, or a filtered subset of them. **Arguments** - **channels**: an optional array of dictionaries to limit the set of Notification Channel IDs returned. If not specified, IDs for all configured Notification Channels ar...
sdcclient/_common.py
def get_notification_ids(self, channels=None): '''**Description** Get an array of all configured Notification Channel IDs, or a filtered subset of them. **Arguments** - **channels**: an optional array of dictionaries to limit the set of Notification Channel IDs returned. If not ...
def get_notification_ids(self, channels=None): '''**Description** Get an array of all configured Notification Channel IDs, or a filtered subset of them. **Arguments** - **channels**: an optional array of dictionaries to limit the set of Notification Channel IDs returned. If not ...
[ "**", "Description", "**", "Get", "an", "array", "of", "all", "configured", "Notification", "Channel", "IDs", "or", "a", "filtered", "subset", "of", "them", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L126-L204
[ "def", "get_notification_ids", "(", "self", ",", "channels", "=", "None", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/notificationChannels'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", "."...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.post_event
**Description** Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts. **Arguments** - **name**: the name of the new event. - **description**: a longer description offering detailed informa...
sdcclient/_common.py
def post_event(self, name, description=None, severity=None, event_filter=None, tags=None): '''**Description** Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts. **Arguments** - **name**: th...
def post_event(self, name, description=None, severity=None, event_filter=None, tags=None): '''**Description** Send an event to Sysdig Monitor. The events you post are available in the Events tab in the Sysdig Monitor UI and can be overlied to charts. **Arguments** - **name**: th...
[ "**", "Description", "**", "Send", "an", "event", "to", "Sysdig", "Monitor", ".", "The", "events", "you", "post", "are", "available", "in", "the", "Events", "tab", "in", "the", "Sysdig", "Monitor", "UI", "and", "can", "be", "overlied", "to", "charts", "....
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L350-L379
[ "def", "post_event", "(", "self", ",", "name", ",", "description", "=", "None", ",", "severity", "=", "None", ",", "event_filter", "=", "None", ",", "tags", "=", "None", ")", ":", "options", "=", "{", "'name'", ":", "name", ",", "'description'", ":", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_events
**Description** Returns the list of Sysdig Monitor events. **Arguments** - **name**: filter events by name. - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). - **to_ts**: filter events by end time. Timestamp format is in UTC (secon...
sdcclient/_common.py
def get_events(self, name=None, from_ts=None, to_ts=None, tags=None): '''**Description** Returns the list of Sysdig Monitor events. **Arguments** - **name**: filter events by name. - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). ...
def get_events(self, name=None, from_ts=None, to_ts=None, tags=None): '''**Description** Returns the list of Sysdig Monitor events. **Arguments** - **name**: filter events by name. - **from_ts**: filter events by start time. Timestamp format is in UTC (seconds). ...
[ "**", "Description", "**", "Returns", "the", "list", "of", "Sysdig", "Monitor", "events", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L381-L405
[ "def", "get_events", "(", "self", ",", "name", "=", "None", ",", "from_ts", "=", "None", ",", "to_ts", "=", "None", ",", "tags", "=", "None", ")", ":", "options", "=", "{", "'name'", ":", "name", ",", "'from'", ":", "from_ts", ",", "'to'", ":", "...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.delete_event
**Description** Deletes an event. **Arguments** - **event**: the event object as returned by :func:`~SdcClient.get_events`. **Success Return Value** `None`. **Example** `examples/delete_event.py <https://github.com/draios/python-sdc-client/blob/...
sdcclient/_common.py
def delete_event(self, event): '''**Description** Deletes an event. **Arguments** - **event**: the event object as returned by :func:`~SdcClient.get_events`. **Success Return Value** `None`. **Example** `examples/delete_event.py <https:/...
def delete_event(self, event): '''**Description** Deletes an event. **Arguments** - **event**: the event object as returned by :func:`~SdcClient.get_events`. **Success Return Value** `None`. **Example** `examples/delete_event.py <https:/...
[ "**", "Description", "**", "Deletes", "an", "event", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L407-L426
[ "def", "delete_event", "(", "self", ",", "event", ")", ":", "if", "'id'", "not", "in", "event", ":", "return", "[", "False", ",", "\"Invalid event format\"", "]", "res", "=", "requests", ".", "delete", "(", "self", ".", "url", "+", "'/api/events/'", "+",...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_data
**Description** Export metric data (both time-series and table-based). **Arguments** - **metrics**: a list of dictionaries, specifying the metrics and grouping keys that the query will return. A metric is any of the entries that can be found in the *Metrics* section of the Explore page ...
sdcclient/_common.py
def get_data(self, metrics, start_ts, end_ts=0, sampling_s=0, filter='', datasource_type='host', paging=None): '''**Description** Export metric data (both time-series and table-based). **Arguments** - **metrics**: a list of dictionaries, specifying the metrics a...
def get_data(self, metrics, start_ts, end_ts=0, sampling_s=0, filter='', datasource_type='host', paging=None): '''**Description** Export metric data (both time-series and table-based). **Arguments** - **metrics**: a list of dictionaries, specifying the metrics a...
[ "**", "Description", "**", "Export", "metric", "data", "(", "both", "time", "-", "series", "and", "table", "-", "based", ")", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L428-L474
[ "def", "get_data", "(", "self", ",", "metrics", ",", "start_ts", ",", "end_ts", "=", "0", ",", "sampling_s", "=", "0", ",", "filter", "=", "''", ",", "datasource_type", "=", "'host'", ",", "paging", "=", "None", ")", ":", "reqbody", "=", "{", "'metri...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_sysdig_captures
**Description** Returns the list of sysdig captures for the user. **Arguments** - from_sec: the start of the timerange for which to get the captures - end_sec: the end of the timerange for which to get the captures - scope_filter: this is a SysdigMonitor-like fil...
sdcclient/_common.py
def get_sysdig_captures(self, from_sec=None, to_sec=None, scope_filter=None): '''**Description** Returns the list of sysdig captures for the user. **Arguments** - from_sec: the start of the timerange for which to get the captures - end_sec: the end of the timerange f...
def get_sysdig_captures(self, from_sec=None, to_sec=None, scope_filter=None): '''**Description** Returns the list of sysdig captures for the user. **Arguments** - from_sec: the start of the timerange for which to get the captures - end_sec: the end of the timerange f...
[ "**", "Description", "**", "Returns", "the", "list", "of", "sysdig", "captures", "for", "the", "user", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L476-L498
[ "def", "get_sysdig_captures", "(", "self", ",", "from_sec", "=", "None", ",", "to_sec", "=", "None", ",", "scope_filter", "=", "None", ")", ":", "url", "=", "'{url}/api/sysdig?source={source}{frm}{to}{scopeFilter}'", ".", "format", "(", "url", "=", "self", ".", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.poll_sysdig_capture
**Description** Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with :func:`~SdcClient.create_sysdig_capture`. **Arguments** - **capture**: the capture object as returned by :func:`~SdcClient.get_sysdi...
sdcclient/_common.py
def poll_sysdig_capture(self, capture): '''**Description** Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with :func:`~SdcClient.create_sysdig_capture`. **Arguments** - **capture**: the captur...
def poll_sysdig_capture(self, capture): '''**Description** Fetch the updated state of a sysdig capture. Can be used to poll the status of a capture that has been previously created and started with :func:`~SdcClient.create_sysdig_capture`. **Arguments** - **capture**: the captur...
[ "**", "Description", "**", "Fetch", "the", "updated", "state", "of", "a", "sysdig", "capture", ".", "Can", "be", "used", "to", "poll", "the", "status", "of", "a", "capture", "that", "has", "been", "previously", "created", "and", "started", "with", ":", "...
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L500-L519
[ "def", "poll_sysdig_capture", "(", "self", ",", "capture", ")", ":", "if", "'id'", "not", "in", "capture", ":", "return", "[", "False", ",", "'Invalid capture format'", "]", "url", "=", "'{url}/api/sysdig/{id}?source={source}'", ".", "format", "(", "url", "=", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.create_sysdig_capture
**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will be taken. - **capture_name**: the name of the capture. - **duration**: the duration of...
sdcclient/_common.py
def create_sysdig_capture(self, hostname, capture_name, duration, capture_filter='', folder='/'): '''**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will b...
def create_sysdig_capture(self, hostname, capture_name, duration, capture_filter='', folder='/'): '''**Description** Create a new sysdig capture. The capture will be immediately started. **Arguments** - **hostname**: the hostname of the instrumented host where the capture will b...
[ "**", "Description", "**", "Create", "a", "new", "sysdig", "capture", ".", "The", "capture", "will", "be", "immediately", "started", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L521-L563
[ "def", "create_sysdig_capture", "(", "self", ",", "hostname", ",", "capture_name", ",", "duration", ",", "capture_filter", "=", "''", ",", "folder", "=", "'/'", ")", ":", "res", "=", "self", ".", "get_connected_agents", "(", ")", "if", "not", "res", "[", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.download_sysdig_capture
**Description** Download a sysdig capture by id. **Arguments** - **capture_id**: the capture id to download. **Success Return Value** The bytes of the scap
sdcclient/_common.py
def download_sysdig_capture(self, capture_id): '''**Description** Download a sysdig capture by id. **Arguments** - **capture_id**: the capture id to download. **Success Return Value** The bytes of the scap ''' url = '{url}/api/sysdig/{id}/dow...
def download_sysdig_capture(self, capture_id): '''**Description** Download a sysdig capture by id. **Arguments** - **capture_id**: the capture id to download. **Success Return Value** The bytes of the scap ''' url = '{url}/api/sysdig/{id}/dow...
[ "**", "Description", "**", "Download", "a", "sysdig", "capture", "by", "id", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L565-L581
[ "def", "download_sysdig_capture", "(", "self", ",", "capture_id", ")", ":", "url", "=", "'{url}/api/sysdig/{id}/download?_product={product}'", ".", "format", "(", "url", "=", "self", ".", "url", ",", "id", "=", "capture_id", ",", "product", "=", "self", ".", "...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.create_user_invite
**Description** Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address. **Arguments** - **user_email**: the email address of the user that will be invited to use Sysdig Monitor - **first_name**: the first name of the us...
sdcclient/_common.py
def create_user_invite(self, user_email, first_name=None, last_name=None, system_role=None): '''**Description** Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address. **Arguments** - **user_email**: the email address of th...
def create_user_invite(self, user_email, first_name=None, last_name=None, system_role=None): '''**Description** Invites a new user to use Sysdig Monitor. This should result in an email notification to the specified address. **Arguments** - **user_email**: the email address of th...
[ "**", "Description", "**", "Invites", "a", "new", "user", "to", "use", "Sysdig", "Monitor", ".", "This", "should", "result", "in", "an", "email", "notification", "to", "the", "specified", "address", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L583-L618
[ "def", "create_user_invite", "(", "self", ",", "user_email", ",", "first_name", "=", "None", ",", "last_name", "=", "None", ",", "system_role", "=", "None", ")", ":", "# Look up the list of users to see if this exists, do not create if one exists", "res", "=", "requests...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.delete_user
**Description** Deletes a user from Sysdig Monitor. **Arguments** - **user_email**: the email address of the user that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draios/python-sdc-client/blob/master/examples/user_...
sdcclient/_common.py
def delete_user(self, user_email): '''**Description** Deletes a user from Sysdig Monitor. **Arguments** - **user_email**: the email address of the user that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draio...
def delete_user(self, user_email): '''**Description** Deletes a user from Sysdig Monitor. **Arguments** - **user_email**: the email address of the user that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draio...
[ "**", "Description", "**", "Deletes", "a", "user", "from", "Sysdig", "Monitor", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L620-L637
[ "def", "delete_user", "(", "self", ",", "user_email", ")", ":", "res", "=", "self", ".", "get_user_ids", "(", "[", "user_email", "]", ")", "if", "res", "[", "0", "]", "==", "False", ":", "return", "res", "userid", "=", "res", "[", "1", "]", "[", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_teams
**Description** Return the set of teams that match the filter specified. The *team_filter* should be a substring of the names of the teams to be returned. **Arguments** - **team_filter**: the team filter to match when returning the list of teams **Success Return Value** ...
sdcclient/_common.py
def get_teams(self, team_filter=''): '''**Description** Return the set of teams that match the filter specified. The *team_filter* should be a substring of the names of the teams to be returned. **Arguments** - **team_filter**: the team filter to match when returning the list of...
def get_teams(self, team_filter=''): '''**Description** Return the set of teams that match the filter specified. The *team_filter* should be a substring of the names of the teams to be returned. **Arguments** - **team_filter**: the team filter to match when returning the list of...
[ "**", "Description", "**", "Return", "the", "set", "of", "teams", "that", "match", "the", "filter", "specified", ".", "The", "*", "team_filter", "*", "should", "be", "a", "substring", "of", "the", "names", "of", "the", "teams", "to", "be", "returned", "....
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L687-L701
[ "def", "get_teams", "(", "self", ",", "team_filter", "=", "''", ")", ":", "res", "=", "requests", ".", "get", "(", "self", ".", "url", "+", "'/api/teams'", ",", "headers", "=", "self", ".", "hdrs", ",", "verify", "=", "self", ".", "ssl_verify", ")", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.get_team
**Description** Return the team with the specified team name, if it is present. **Arguments** - **name**: the name of the team to return **Success Return Value** The requested team. **Example** `examples/user_team_mgmt.py <https://github.com/dra...
sdcclient/_common.py
def get_team(self, name): '''**Description** Return the team with the specified team name, if it is present. **Arguments** - **name**: the name of the team to return **Success Return Value** The requested team. **Example** `examples/user...
def get_team(self, name): '''**Description** Return the team with the specified team name, if it is present. **Arguments** - **name**: the name of the team to return **Success Return Value** The requested team. **Example** `examples/user...
[ "**", "Description", "**", "Return", "the", "team", "with", "the", "specified", "team", "name", "if", "it", "is", "present", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L703-L722
[ "def", "get_team", "(", "self", ",", "name", ")", ":", "res", "=", "self", ".", "get_teams", "(", "name", ")", "if", "res", "[", "0", "]", "==", "False", ":", "return", "res", "for", "t", "in", "res", "[", "1", "]", ":", "if", "t", "[", "'nam...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.create_team
**Description** Creates a new team **Arguments** - **name**: the name of the team to create. - **memberships**: dictionary of (user-name, team-role) pairs that should describe new memberships of the team. - **filter**: the scope that this team is able to access w...
sdcclient/_common.py
def create_team(self, name, memberships=None, filter='', description='', show='host', theme='#7BB0B2', perm_capture=False, perm_custom_events=False, perm_aws_data=False): ''' **Description** Creates a new team **Arguments** - **name**: the name of the...
def create_team(self, name, memberships=None, filter='', description='', show='host', theme='#7BB0B2', perm_capture=False, perm_custom_events=False, perm_aws_data=False): ''' **Description** Creates a new team **Arguments** - **name**: the name of the...
[ "**", "Description", "**", "Creates", "a", "new", "team" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L752-L804
[ "def", "create_team", "(", "self", ",", "name", ",", "memberships", "=", "None", ",", "filter", "=", "''", ",", "description", "=", "''", ",", "show", "=", "'host'", ",", "theme", "=", "'#7BB0B2'", ",", "perm_capture", "=", "False", ",", "perm_custom_eve...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.edit_team
**Description** Edits an existing team. All arguments are optional. Team settings for any arguments unspecified will remain at their current settings. **Arguments** - **name**: the name of the team to edit. - **memberships**: dictionary of (user-name, team-role) pairs that sh...
sdcclient/_common.py
def edit_team(self, name, memberships=None, filter=None, description=None, show=None, theme=None, perm_capture=None, perm_custom_events=None, perm_aws_data=None): ''' **Description** Edits an existing team. All arguments are optional. Team settings for any arguments unspecif...
def edit_team(self, name, memberships=None, filter=None, description=None, show=None, theme=None, perm_capture=None, perm_custom_events=None, perm_aws_data=None): ''' **Description** Edits an existing team. All arguments are optional. Team settings for any arguments unspecif...
[ "**", "Description", "**", "Edits", "an", "existing", "team", ".", "All", "arguments", "are", "optional", ".", "Team", "settings", "for", "any", "arguments", "unspecified", "will", "remain", "at", "their", "current", "settings", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L806-L875
[ "def", "edit_team", "(", "self", ",", "name", ",", "memberships", "=", "None", ",", "filter", "=", "None", ",", "description", "=", "None", ",", "show", "=", "None", ",", "theme", "=", "None", ",", "perm_capture", "=", "None", ",", "perm_custom_events", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.delete_team
**Description** Deletes a team from Sysdig Monitor. **Arguments** - **name**: the name of the team that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draios/python-sdc-client/blob/master/examples/user_team_mgmt.py>`_
sdcclient/_common.py
def delete_team(self, name): '''**Description** Deletes a team from Sysdig Monitor. **Arguments** - **name**: the name of the team that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draios/python-sdc-client/b...
def delete_team(self, name): '''**Description** Deletes a team from Sysdig Monitor. **Arguments** - **name**: the name of the team that will be deleted from Sysdig Monitor **Example** `examples/user_team_mgmt.py <https://github.com/draios/python-sdc-client/b...
[ "**", "Description", "**", "Deletes", "a", "team", "from", "Sysdig", "Monitor", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L877-L895
[ "def", "delete_team", "(", "self", ",", "name", ")", ":", "res", "=", "self", ".", "get_team", "(", "name", ")", "if", "res", "[", "0", "]", "==", "False", ":", "return", "res", "t", "=", "res", "[", "1", "]", "res", "=", "requests", ".", "dele...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.list_memberships
**Description** List all memberships for specified team. **Arguments** - **team**: the name of the team for which we want to see memberships **Result** Dictionary of (user-name, team-role) pairs that should describe memberships of the team. **Example** ...
sdcclient/_common.py
def list_memberships(self, team): ''' **Description** List all memberships for specified team. **Arguments** - **team**: the name of the team for which we want to see memberships **Result** Dictionary of (user-name, team-role) pairs that should descr...
def list_memberships(self, team): ''' **Description** List all memberships for specified team. **Arguments** - **team**: the name of the team for which we want to see memberships **Result** Dictionary of (user-name, team-role) pairs that should descr...
[ "**", "Description", "**", "List", "all", "memberships", "for", "specified", "team", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L897-L924
[ "def", "list_memberships", "(", "self", ",", "team", ")", ":", "res", "=", "self", ".", "get_team", "(", "team", ")", "if", "res", "[", "0", "]", "==", "False", ":", "return", "res", "raw_memberships", "=", "res", "[", "1", "]", "[", "'userRoles'", ...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.save_memberships
**Description** Create new user team memberships or update existing ones. **Arguments** - **team**: the name of the team for which we are creating new memberships - **memberships**: dictionary of (user-name, team-role) pairs that should describe new memberships **Ex...
sdcclient/_common.py
def save_memberships(self, team, memberships): ''' **Description** Create new user team memberships or update existing ones. **Arguments** - **team**: the name of the team for which we are creating new memberships - **memberships**: dictionary of (user-name, ...
def save_memberships(self, team, memberships): ''' **Description** Create new user team memberships or update existing ones. **Arguments** - **team**: the name of the team for which we are creating new memberships - **memberships**: dictionary of (user-name, ...
[ "**", "Description", "**", "Create", "new", "user", "team", "memberships", "or", "update", "existing", "ones", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L926-L952
[ "def", "save_memberships", "(", "self", ",", "team", ",", "memberships", ")", ":", "res", "=", "self", ".", "list_memberships", "(", "team", ")", "if", "res", "[", "0", "]", "is", "False", ":", "return", "res", "full_memberships", "=", "res", "[", "1",...
47f83415842048778939b90944f64386a3bcb205
test
_SdcCommon.remove_memberships
**Description** Remove user memberships from specified team. **Arguments** - **team**: the name of the team from which user memberships are removed - **users**: list of usernames which should be removed from team **Example** `examples/user_team_mgmt_exte...
sdcclient/_common.py
def remove_memberships(self, team, users): ''' **Description** Remove user memberships from specified team. **Arguments** - **team**: the name of the team from which user memberships are removed - **users**: list of usernames which should be removed from team...
def remove_memberships(self, team, users): ''' **Description** Remove user memberships from specified team. **Arguments** - **team**: the name of the team from which user memberships are removed - **users**: list of usernames which should be removed from team...
[ "**", "Description", "**", "Remove", "user", "memberships", "from", "specified", "team", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_common.py#L954-L980
[ "def", "remove_memberships", "(", "self", ",", "team", ",", "users", ")", ":", "res", "=", "self", ".", "list_memberships", "(", "team", ")", "if", "res", "[", "0", "]", "is", "False", ":", "return", "res", "old_memberships", "=", "res", "[", "1", "]...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClientV1.create_dashboard
**Description** Creates an empty dashboard. You can then add panels by using ``add_dashboard_panel``. **Arguments** - **name**: the name of the dashboard that will be created. **Success Return Value** A dictionary showing the details of the new dashboard. *...
sdcclient/_monitor_v1.py
def create_dashboard(self, name): ''' **Description** Creates an empty dashboard. You can then add panels by using ``add_dashboard_panel``. **Arguments** - **name**: the name of the dashboard that will be created. **Success Return Value** A dictionar...
def create_dashboard(self, name): ''' **Description** Creates an empty dashboard. You can then add panels by using ``add_dashboard_panel``. **Arguments** - **name**: the name of the dashboard that will be created. **Success Return Value** A dictionar...
[ "**", "Description", "**", "Creates", "an", "empty", "dashboard", ".", "You", "can", "then", "add", "panels", "by", "using", "add_dashboard_panel", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor_v1.py#L81-L106
[ "def", "create_dashboard", "(", "self", ",", "name", ")", ":", "dashboard_configuration", "=", "{", "'name'", ":", "name", ",", "'schema'", ":", "2", ",", "'items'", ":", "[", "]", "}", "#", "# Create the new dashboard", "#", "res", "=", "requests", ".", ...
47f83415842048778939b90944f64386a3bcb205
test
SdMonitorClientV1.add_dashboard_panel
**Description** Adds a panel to the dashboard. A panel can be a time series, or a top chart (i.e. bar chart), or a number panel. **Arguments** - **dashboard**: dashboard to edit - **name**: name of the new panel - **panel_type**: type of the new panel. Valid valu...
sdcclient/_monitor_v1.py
def add_dashboard_panel(self, dashboard, name, panel_type, metrics, scope=None, sort_by=None, limit=None, layout=None): """**Description** Adds a panel to the dashboard. A panel can be a time series, or a top chart (i.e. bar chart), or a number panel. **Arguments** - **dashboard...
def add_dashboard_panel(self, dashboard, name, panel_type, metrics, scope=None, sort_by=None, limit=None, layout=None): """**Description** Adds a panel to the dashboard. A panel can be a time series, or a top chart (i.e. bar chart), or a number panel. **Arguments** - **dashboard...
[ "**", "Description", "**", "Adds", "a", "panel", "to", "the", "dashboard", ".", "A", "panel", "can", "be", "a", "time", "series", "or", "a", "top", "chart", "(", "i", ".", "e", ".", "bar", "chart", ")", "or", "a", "number", "panel", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_monitor_v1.py#L108-L247
[ "def", "add_dashboard_panel", "(", "self", ",", "dashboard", ",", "name", ",", "panel_type", ",", "metrics", ",", "scope", "=", "None", ",", "sort_by", "=", "None", ",", "limit", "=", "None", ",", "layout", "=", "None", ")", ":", "panel_configuration", "...
47f83415842048778939b90944f64386a3bcb205
test
SdScanningClient.add_image
**Description** Add an image to the scanner **Arguments** - image: Input image can be in the following formats: registry/repo:tag - dockerfile: The contents of the dockerfile as a str. - annotations: A dictionary of annotations {str: str}. - autosubsc...
sdcclient/_scanning.py
def add_image(self, image, force=False, dockerfile=None, annotations={}, autosubscribe=True): '''**Description** Add an image to the scanner **Arguments** - image: Input image can be in the following formats: registry/repo:tag - dockerfile: The contents of the docker...
def add_image(self, image, force=False, dockerfile=None, annotations={}, autosubscribe=True): '''**Description** Add an image to the scanner **Arguments** - image: Input image can be in the following formats: registry/repo:tag - dockerfile: The contents of the docker...
[ "**", "Description", "**", "Add", "an", "image", "to", "the", "scanner" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_scanning.py#L22-L55
[ "def", "add_image", "(", "self", ",", "image", ",", "force", "=", "False", ",", "dockerfile", "=", "None", ",", "annotations", "=", "{", "}", ",", "autosubscribe", "=", "True", ")", ":", "itype", "=", "self", ".", "_discover_inputimage_format", "(", "ima...
47f83415842048778939b90944f64386a3bcb205
test
SdScanningClient.import_image
**Description** Import an image from the scanner export **Arguments** - image_data: A JSON with the image information. **Success Return Value** A JSON object representing the image that was imported.
sdcclient/_scanning.py
def import_image(self, image_data): '''**Description** Import an image from the scanner export **Arguments** - image_data: A JSON with the image information. **Success Return Value** A JSON object representing the image that was imported. ''' ...
def import_image(self, image_data): '''**Description** Import an image from the scanner export **Arguments** - image_data: A JSON with the image information. **Success Return Value** A JSON object representing the image that was imported. ''' ...
[ "**", "Description", "**", "Import", "an", "image", "from", "the", "scanner", "export" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_scanning.py#L57-L72
[ "def", "import_image", "(", "self", ",", "image_data", ")", ":", "url", "=", "self", ".", "url", "+", "\"/api/scanning/v1/anchore/imageimport\"", "res", "=", "requests", ".", "post", "(", "url", ",", "data", "=", "json", ".", "dumps", "(", "image_data", ")...
47f83415842048778939b90944f64386a3bcb205
test
SdScanningClient.get_image
**Description** Find the image with the tag <image> and return its json description **Arguments** - image: Input image can be in the following formats: registry/repo:tag **Success Return Value** A JSON object representing the image.
sdcclient/_scanning.py
def get_image(self, image, show_history=False): '''**Description** Find the image with the tag <image> and return its json description **Arguments** - image: Input image can be in the following formats: registry/repo:tag **Success Return Value** A JSON objec...
def get_image(self, image, show_history=False): '''**Description** Find the image with the tag <image> and return its json description **Arguments** - image: Input image can be in the following formats: registry/repo:tag **Success Return Value** A JSON objec...
[ "**", "Description", "**", "Find", "the", "image", "with", "the", "tag", "<image", ">", "and", "return", "its", "json", "description" ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_scanning.py#L74-L103
[ "def", "get_image", "(", "self", ",", "image", ",", "show_history", "=", "False", ")", ":", "itype", "=", "self", ".", "_discover_inputimage_format", "(", "image", ")", "if", "itype", "not", "in", "[", "'tag'", ",", "'imageid'", ",", "'imageDigest'", "]", ...
47f83415842048778939b90944f64386a3bcb205
test
SdScanningClient.query_image_content
**Description** Find the image with the tag <image> and return its content. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - content_type: The content type can be one of the following types: - os: Operating System Packag...
sdcclient/_scanning.py
def query_image_content(self, image, content_type=""): '''**Description** Find the image with the tag <image> and return its content. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - content_type: The content type can be one of ...
def query_image_content(self, image, content_type=""): '''**Description** Find the image with the tag <image> and return its content. **Arguments** - image: Input image can be in the following formats: registry/repo:tag - content_type: The content type can be one of ...
[ "**", "Description", "**", "Find", "the", "image", "with", "the", "tag", "<image", ">", "and", "return", "its", "content", "." ]
draios/python-sdc-client
python
https://github.com/draios/python-sdc-client/blob/47f83415842048778939b90944f64386a3bcb205/sdcclient/_scanning.py#L122-L137
[ "def", "query_image_content", "(", "self", ",", "image", ",", "content_type", "=", "\"\"", ")", ":", "return", "self", ".", "_query_image", "(", "image", ",", "query_group", "=", "'content'", ",", "query_type", "=", "content_type", ")" ]
47f83415842048778939b90944f64386a3bcb205