Modules

Main functions for Codemelli.

codemelli.codemelli.city_codes_data() → dict[source]

Return a dict containing city codes.

Returns:city codes
Return type:dict
codemelli.codemelli.generator(city_code: str = None) → str[source]

Generate a random valid CodeMelli.

Parameters:city_code (str) – An string of numbers (length=3)
Returns:A valid CodeMelli
Return type:str
Raises:ValueError – if city code is defined and it is not 3-digit number
codemelli.codemelli.lookup(input_code: str) → dict[source]

Lookup state and city of the input code.

Parameters:input_code (str) – a CodeMelli string
Returns:state and city of the given CodeMelli in the following format: {state: example_state, city: example_city}
Return type:dict or None
codemelli.codemelli.validator(input_code: int, strict: bool = False) → bool[source]

Validate the input code by CodeMelli rules.

Parameters:
  • input_code (int) – a CodeMelli number
  • strict (bool) – Checks validation of city code
Returns:

validation result

Return type:

bool

Raises:
  • ValueError – if input code is not a 10-digit number
  • ValueError – if input code does not start with a valid city code