json2graph.modules.utils_general

Diverse util and auxiliary functions.

Module Contents

Functions

count_elements_types(element_type_list, element_counting)

Returns the number of elements (in the already counted data) of the types given in a list.

get_date_time(date_time_format)

Return a string with date and time according to the specified format received as argument.

json2graph.modules.utils_general.count_elements_types(element_type_list, element_counting)

Returns the number of elements (in the already counted data) of the types given in a list. Receives a dictionary of number of items and returns the value corresponding to the provided argument.

Parameters:
  • element_type_list (list[str]) – List of types of elements to have their count value returned.

  • element_counting (dict) – Dictionary with types and corresponding number of occurrences.

Returns:

Number of occurrences of the element of the given type.

Return type:

int

json2graph.modules.utils_general.get_date_time(date_time_format)

Return a string with date and time according to the specified format received as argument. For valid formats: https://docs.python.org/3.11/library/datetime.html#strftime-and-strptime-format-codes

Parameters:

date_time_format (str) – Valid format accepted by the datetime function.

Returns:

Formatted current date and time.

Return type:

str