common

Moduł zawierajacy pliki używane w wielu miejscach kodu. Są to klasy i metody pomocnicze głównie w parsowaniu i walidacji danych.

Common

class common.common.Common[source]
__init__()

Initialize self. See help(type(self)) for accurate signature.

static dict_to_string(json_dict)[source]
static file_to_dict(filename)[source]
static list_flattening(l)[source]
static parse_to_list(data)[source]

Parsuje plik do listy

static save_dict_to_file(filename, data_dict)[source]
static save_list_to_file(fielname, data_list, separator='\n')[source]

Converter

class common.converter.Converter[source]

Most common conversion operations

__init__()

Initialize self. See help(type(self)) for accurate signature.

static dict_sort(d)[source]
Return type

Dict

static flatten_list(l)[source]

Python trick to make the list flat

Return type

List

static json_to_dict(data)[source]

Takes json file and return python dictionary

Return type

Dict

static remove_duplicates(l)[source]

Removes duplicates and sort list

Return type

List

DictX

class common.dict_x.DictX[source]

Przeglądanei zagnieżdzonych jsonów narzędznie online http://jsonviewer.stack.hu/

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

clear() → None. Remove all items from D.
copy() → a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D’s values

TextParser

class common.text_parser.TextParser[source]
__init__()

Initialize self. See help(type(self)) for accurate signature.

static get_cve_list_from_file(filename)[source]
static get_unique_list(flat_list)[source]
static read_file_with_cves(filename)[source]
static save_cve_list(cve_flat_list, software_name)[source]