Code Structure¶
Classes and methods¶
pyHaFAS is built object-orientated with a lot of classes. You may know already the HafasClient
and the profileG classes but there a lot more classes for internal use only.
For example the BaseProfile
class consists among others of BaseRequestHelper
, BaseJourneyRequest
and very important the ProfileInterface
Every class in a profileG has an interface that defines abstract methods that the profile class must implement.
A more detailed view of the construction of a profileG is given on the page Profile (Developer).
File Structure¶
pyHaFAS’s code is split in multiple files. These files are sorted as shown in the structure below.
/pyhafas - base directory of source code
profile - contains the profiles (every subdirectory should have the same structure as base)
interfaces - contains all abstract classes
base - Base profile - contains the default handling classes and methods
__init__.py - contains the Profile
helper - contains helper functions that are used by multiple requests
mappings - contains mapping Enum classes
requests - contains code responsible for requests (there is a file for each request-type containing all methods belonging to it)
PROFILENAME - contains the files for the profile (only files and directories with changes)
types - Base directory of all types valid for all profiles
exceptions.py - exceptions pyHaFAS can raise
fptf.py - most of the types important for pyHaFAS
hafas_response.py - contains the
HafasRepsonse
class
client.py - contains the
HafasClient