edmctool¶
Elite Dangerous Market Connector Tool
Base Module¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-07
Purpose: EDMC plugins individual logging subsystem base classes.
- class jsktoolbox.edmctool.base.BLogProcessor[source]¶
Bases:
BDataBLogProcessor base class.
Container for logger processor methods.
- property th_log: Thread¶
Return the thread logger handler instance.
### Returns: Thread - The thread responsible for log processing.
- property qlog: Queue | SimpleQueue¶
Return the logging queue instance.
### Returns: Union[Queue, SimpleQueue] - The queue used for log message passing.
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- property log_processor: LogProcessor¶
Return the log processor handler.
### Returns: LogProcessor - The processor instance responsible for log message handling.
Data Structures¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-10
Purpose: Data container classes.
- class jsktoolbox.edmctool.data.RscanData[source]¶
Bases:
BDataData container for username and current system.
- property jump_system: StarsSystem¶
Return the jump destination StarsSystem object.
### Returns: StarsSystem - The jump target system instance.
- property stars_system: StarsSystem¶
Return the current StarsSystem object.
### Returns: StarsSystem - The current system instance.
- property jump_range: float¶
Return the ship’s maximum jump range.
### Returns: float - Jump range value in light years.
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
ED API¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-08
Purpose: Elite Dangerous journal event keys definition container.
EDSM Integration¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-08
Purpose: EDSM API client classes.
- class jsktoolbox.edmctool.edsm.Url[source]¶
Bases:
BDataUrl.
Class for serving HTTP/HTTPS requests.
- bodies_url(s_system)[source]¶
Returns proper API url for getting bodies information data.
### Arguments: * s_system: StarsSystem - System object containing name or address.
### Returns: str - Formatted URL for bodies query.
### Raises: * TypeError: If s_system is not a StarsSystem instance.
- Parameters:
s_system (StarsSystem)
- Return type:
- system_url(s_system)[source]¶
Returns proper API url for getting system data.
### Arguments: * s_system: StarsSystem - System object containing name.
### Returns: str - Formatted URL for system query.
### Raises: * TypeError: If s_system is not a StarsSystem instance.
- Parameters:
s_system (StarsSystem)
- Return type:
- radius_url(s_system, radius)[source]¶
Returns proper API url for getting systems data in radius.
### Arguments: * s_system: StarsSystem - System object containing name. * radius: int - Search radius in light years (clamped to 5-100).
### Returns: str - Formatted URL for sphere-systems query.
### Raises: * TypeError: If s_system is not a StarsSystem instance.
- Parameters:
s_system (StarsSystem)
radius (int)
- Return type:
- cube_url(s_system, size)[source]¶
Returns proper API url for getting systems data in cube.
### Arguments: * s_system: StarsSystem - System object containing name. * size: int - Cube size in light years (clamped to 10-200).
### Returns: str - Formatted URL for cube-systems query.
### Raises: * TypeError: If s_system is not a StarsSystem instance.
- Parameters:
s_system (StarsSystem)
size (int)
- Return type:
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- system_query(s_system)[source]¶
Returns result of query for system data.
### Arguments: * s_system: StarsSystem - System object containing name.
### Returns: Optional[Dict] - System data from EDSM API or None on failure.
### Raises: * TypeError: If s_system is not a StarsSystem instance.
- Parameters:
s_system (StarsSystem)
- Return type:
Dict | None
EDSM Keys¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-08
Purpose: EDSM API response keys definition container.
Logging¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-07
Purpose: EDMC plugins individual logging subsystem classes.
- class jsktoolbox.edmctool.logs.Log(level)[source]¶
Bases:
BDataCreate Log container class.
- Parameters:
level (int)
- class jsktoolbox.edmctool.logs.LogProcessor(name, logs_dir=None, max_bytes=100000, backup_count=5)[source]¶
Bases:
BDataLog processor access API.
- __init__(name, logs_dir=None, max_bytes=100000, backup_count=5)[source]¶
Create instance class object for processing single message.
### Arguments: * name: str - Name of the application or logger. * logs_dir: Optional[str] - Directory path for log files. Defaults to tmpdir if not provided. * max_bytes: int - Maximum size of log file in bytes before rotation. Defaults to 100000. * backup_count: int - Number of backup log files to keep. Defaults to 5.
- send(message)[source]¶
Send single message to log engine.
### Arguments: * message: Log - Log object containing messages and log level.
### Raises: * TypeError: Provided argument is not a Log instance.
- Parameters:
message (Log)
- Return type:
None
- class jsktoolbox.edmctool.logs.LogClient(queue)[source]¶
Bases:
BDataLog client class API.
- Parameters:
queue (Queue | SimpleQueue)
- __init__(queue)[source]¶
Create instance class object.
### Arguments: * queue: Union[Queue, SimpleQueue] - Queue object for sending log messages.
- Parameters:
queue (Queue | SimpleQueue)
- Return type:
None
- class jsktoolbox.edmctool.logs.LogLevels[source]¶
Bases:
NoDynamicAttributesLog levels keys.
This is a container class with properties that return the proper logging levels defined in the logging module.
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
Math Utilities¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-10
Purpose: Mathematical algorithms for route optimization in Elite Dangerous.
- class jsktoolbox.edmctool.math.IAlg[source]¶
Bases:
ABCInterface for algorithm class .
- abstract debug(currentframe, message)[source]¶
Debug formatter for logger.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- class jsktoolbox.edmctool.math.Euclid(queue, r_data)[source]¶
Bases:
BLogClientEuclid.
A class that calculates the length of a vector in Cartesian space.
- Parameters:
queue (Union[Queue, SimpleQueue])
r_data (RscanData)
- __init__(queue, r_data)[source]¶
Create class object.
### Arguments: * queue: Union[Queue, SimpleQueue] - Queue for communication and logging. * r_data: RscanData - Route scan data container.
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- benchmark()[source]¶
Do benchmark test.
Compare the computational efficiency of functions for real data and choose the right priority of their use.
- Return type:
None
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- class jsktoolbox.edmctool.math.AlgAStar(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientA* pathfinding algorithm implementation for route optimization.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Initialize A* pathfinding algorithm.
Sets up the A* algorithm for finding optimal routes between star systems considering jump range constraints and using Euclidean distance calculations.
### Arguments: * start: StarsSystem - Starting point for pathfinding. * systems: List[StarsSystem] - List of available star systems to navigate through. * jump_range: int - Maximum jump distance allowed between systems. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for logging operations. * euclid_alg: Euclid - Euclidean distance calculation algorithm instance. * plugin_name: str - Name of the plugin using this algorithm.
### Raises: * TypeError: If log_queue is not Queue or SimpleQueue type. * TypeError: If euclid_alg is not Euclid type. * TypeError: If jump_range is not int type. * TypeError: If start is not StarsSystem type. * TypeError: If systems is not list type.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
- class jsktoolbox.edmctool.math.AlgTsp(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientTravelling salesman problem.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Construct instance object.
### Arguments: * start: StarsSystem - Starting position object. * systems: List[StarsSystem] - List of points of interest to visit. * jump_range: int - Maximum jump range in light years. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for LogClient communication. * euclid_alg: Euclid - Initialized Euclidean distance calculation object. * plugin_name: str - Name of the plugin for debug logging.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
- class jsktoolbox.edmctool.math.AlgGeneric(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientGeneric optimization algorithm for route planning.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Construct instance object.
### Arguments: * start: StarsSystem - Starting position object. * systems: List[StarsSystem] - List of points of interest to visit. * jump_range: int - Maximum jump range in light years. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for LogClient communication. * euclid_alg: Euclid - Initialized Euclidean distance calculation object. * plugin_name: str - Name of the plugin for debug logging.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- run()[source]¶
Algorytm Genetyczny wyszukujący najkrótszą ścieżkę od punktu start, poprzez punkty z listy systems przy założeniach:
boki grafu o długości przekraczającej jump_range są wykluczone,
algorytm ma przejść przez jak największą liczbę punktów,
każdy punkt odwiedzany jest tylko raz,
wynikowa lista punktów bez punktu startowego umieszczana jest w self.__final
- Return type:
None
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
- class jsktoolbox.edmctool.math.AlgGenetic(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientGenetic algorithm solving the problem of finding the best path.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Construct instance object.
### Arguments: * start: StarsSystem - Starting position object. * systems: List[StarsSystem] - List of points of interest to visit. * jump_range: int - Maximum jump range in light years. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for LogClient communication. * euclid_alg: Euclid - Initialized Euclidean distance calculation object. * plugin_name: str - Name of the plugin for debug logging.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
- class jsktoolbox.edmctool.math.AlgGenetic2(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientGenetic algorithm implementation (version 2) for route optimization.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Construct instance object.
### Arguments: * start: StarsSystem - Starting position object. * systems: List[StarsSystem] - List of points of interest to visit. * jump_range: int - Maximum jump range in light years. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for LogClient communication. * euclid_alg: Euclid - Initialized Euclidean distance calculation object. * plugin_name: str - Name of the plugin for debug logging.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
- class jsktoolbox.edmctool.math.AlgSimulatedAnnealing(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Bases:
IAlg,BLogClientSimulated annealing algorithm for finding optimal routes.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Optional[Union[Queue, SimpleQueue]])
euclid_alg (Euclid)
plugin_name (str)
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- __init__(start, systems, jump_range, log_queue, euclid_alg, plugin_name)[source]¶
Construct instance object.
### Arguments: * start: StarsSystem - Starting position object. * systems: List[StarsSystem] - List of points of interest to visit. * jump_range: int - Maximum jump range in light years. * log_queue: Optional[Union[Queue, SimpleQueue]] - Queue for LogClient communication. * euclid_alg: Euclid - Initialized Euclidean distance calculation object. * plugin_name: str - Name of the plugin for debug logging.
- Parameters:
start (StarsSystem)
systems (List[StarsSystem])
jump_range (int)
log_queue (Queue | SimpleQueue | None)
euclid_alg (Euclid)
plugin_name (str)
- Return type:
None
- property logger: LogClient¶
Return the logger client handler.
### Returns: LogClient - The client interface for logging operations.
- calculate_total_distance(path)[source]¶
Calculate the total distance of the path, starting from the start point.
- Parameters:
path (List[StarsSystem])
- Return type:
- accept_solution(current_distance, new_distance, temperature)[source]¶
Decide whether to accept the new solution based on the current temperature.
- debug(currentframe, message='')[source]¶
Build debug message.
- Parameters:
currentframe (FrameType | None)
message (str)
- Return type:
None
- property final_distance: float¶
Calculate the total distance of the final route.
### Returns: float - Total distance in light years, or 0.0 if no route found.
- property get_final: List[StarsSystem]¶
Return final data.
### Returns: List[StarsSystem] - List of star systems in the final route.
Stars Module¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-07
Purpose: StarsSystem container.
- class jsktoolbox.edmctool.stars.StarsSystem(name=None, address=None, star_pos=None)[source]¶
Bases:
BDataStarsSystem container class.
- __init__(name=None, address=None, star_pos=None)[source]¶
Create Star System object.
### Arguments: * name: Optional[str] - Name of the star system. * address: Optional[int] - System address identifier. * star_pos: Optional[List] - Position coordinates of the star.
- property address: int | None¶
Returns address of the star system.
### Returns: Optional[int] - The system address, or None if not set.
- property data: Dict¶
Returns data container.
This is dictionary object for storing various elements.
### Returns: Dict - Dictionary containing system data.
- property name: str | None¶
Returns name of the star system.
### Returns: Optional[str] - The system name, or None if not set.
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- property pos_x: float | int | None¶
Returns pos_x of the star system.
### Returns: Optional[Union[float, int]] - X coordinate value, or None if not set.
- property pos_y: float | int | None¶
Returns pos_y of the star system.
### Returns: Optional[Union[float, int]] - Y coordinate value, or None if not set.
- property pos_z: float | int | None¶
Returns pos_z of the star system.
### Returns: Optional[Union[float, int]] - Z coordinate value, or None if not set.
- property star_class: str¶
Returns star class string.
### Returns: str - Star classification identifier.
System Module¶
Author: Jacek ‘Szumak’ Kotlarski –<szumak@virthost.pl> Created: 2024-10-07
Purpose: EDMC plugins system classes.
- class jsktoolbox.edmctool.system.Directory[source]¶
Bases:
BDataContainer class to store the directory path.
- is_directory(path_string)[source]¶
Check if the given string is a directory.
### Arguments: * path_string: str - Path string to verify.
### Returns: bool - True when path exists and is a directory, False otherwise.
- class jsktoolbox.edmctool.system.EnvLocal[source]¶
Bases:
EnvEnvironmental class.
- check_dir(directory)[source]¶
Check if dir exists, return dir or else HOME.
### Arguments: * directory: str - Directory path to verify.
### Returns: str - Validated directory path or home directory when invalid.
- __setattr__(name, value)¶
Prevent dynamic attribute assignment on instances.
### Raises: * AttributeError: Attribute not previously declared.
- property home: str¶
Return the detected home directory path.
### Returns: str - The path to the detected home directory.
- property is_64bits: bool¶
Return True when the interpreter runs in 64-bit mode.
### Returns: bool - True if running in 64-bit mode, False otherwise.
- os_arch()¶
Return the operating system architecture description.
### Returns: str - Human-readable architecture string (e.g. 64-bit).
- Return type: