geoips.interfaces package#
Subpackages#
- geoips.interfaces.class_based package
- Submodules
- geoips.interfaces.class_based.algorithms module
- geoips.interfaces.class_based.colormappers module
- geoips.interfaces.class_based.coverage_checkers module
- geoips.interfaces.class_based.databases module
- geoips.interfaces.class_based.filename_formatters module
- geoips.interfaces.class_based.interpolators module
- geoips.interfaces.class_based.output_checkers module
BaseOutputCheckerPluginBaseOutputCheckerPlugin.compare_outputs()BaseOutputCheckerPlugin.data_treeBaseOutputCheckerPlugin.get_compare_products()BaseOutputCheckerPlugin.get_out_diff_fname()BaseOutputCheckerPlugin.gunzip_product()BaseOutputCheckerPlugin.is_gz()BaseOutputCheckerPlugin.perform_comparisons()BaseOutputCheckerPlugin.test_products()
OutputCheckersInterfaceget_missing_products()gunzip_product()is_gz()write_bad_comparisons_to_file()write_good_comparisons_to_file()write_missing_comparisons_to_file()write_missing_products_to_file()write_remove_temp_files_to_file()
- geoips.interfaces.class_based.output_formatters module
- geoips.interfaces.class_based.procflows module
- geoips.interfaces.class_based.readers module
- geoips.interfaces.class_based.sector_adjusters module
- geoips.interfaces.class_based.sector_metadata_generators module
- geoips.interfaces.class_based.sector_spec_generators module
- geoips.interfaces.class_based.title_formatters module
- geoips.interfaces.class_based.validators module
- geoips.interfaces.class_based.workflow module
- Module contents
- geoips.interfaces.yaml_based package
- Submodules
- geoips.interfaces.yaml_based.feature_annotators module
- geoips.interfaces.yaml_based.gridline_annotators module
- geoips.interfaces.yaml_based.product_defaults module
- geoips.interfaces.yaml_based.products module
- geoips.interfaces.yaml_based.sectors module
- geoips.interfaces.yaml_based.workflows module
- Module contents
Submodules#
geoips.interfaces.base module#
Base classes for interfaces, plugins, and plugin validation machinery.
- class geoips.interfaces.base.BaseClassInterface[source]#
Bases:
BaseClassInterfaceBase class for class-based interfaces.
This class should not be instantiated directly. Instead, a package should implement custom interfaces that inherit from the children of this class. Those custom interfaces would then be accessed by importing them from
geoips.interfaces. For example:` from geoips.interfaces import algorithms `will retrieve an instance ofAlgorithmsInterfacewhich will provide access to the geoips algorithm plugins.- apiVersion = 'geoips/v1'#
- class geoips.interfaces.base.BaseYamlInterface[source]#
Bases:
BaseYamlInterfaceBase class for GeoIPS yaml-based plugin interfaces.
This class should not be instantiated directly. Instead, interfaces should be accessed by importing them from
geoips.interfaces. For example:` from geoips.interfaces import products `will retrieve an instance ofProductsInterfacewhich will provide access to the GeoIPS products plugins.- apiVersion = 'geoips/v1'#
- validator = <geoips.interfaces.base.YamlPluginValidator object>#
- class geoips.interfaces.base.YamlPluginValidator[source]#
Bases:
objectPluginValidator class.
- property schemas#
Return a list of jsonschema schemas for GeoIPS.
This performs a lazy-load for the schema to avoid loading them if not needed. This reduces the import time for geoips.interfaces.
- validate(plugin, validator_id=None)[source]#
Validate a YAML plugin against the relevant schema.
The relevant schema is determined based on the interface and family of the plugin.
- validate_list(plugin)[source]#
Validate a list of YAML plugins.
Some interfaces allow a ‘list’ family. These list plugins will contain a property that is the same as the interface’s name. Under that is a list of individual plugins.
This function will add the interface property to each plugin in the list, then validate each plugin.
- property validators#
Return schema validators.
This performs a lazy-load for the validators to avoid loading them if not needed. This reduces the import time for geoips.interfaces.
- geoips.interfaces.base.get_validators(schema_dict, validator_class)[source]#
Create validators for each schema in schema_dict.
- Parameters:
schema_dict (dict) – A dictionary whose keys are schema $id and whose values are the full schema.
- Returns:
A dictionary whose keys are schema $id and whose values are jsonschema validator instances.
- Return type:
dict
geoips.interfaces.class_based_plugin module#
Implements a base class for class-based plugins.
The base class implemented here would expose the call signature of the child plugin class as __call__() while also providing hooks for pre- and post-processing.
The hooks are available as _pre_call() and _post_call(). They should be used to implement common functionality that all plugins of this type should posess but which we don’t want developers to need to implement. They are intended to be overridden by the child plugin-type class (e.g. BaseReaderPlugin). They should define what kwargs they accept when defined on the plugin-type class but should accept their arguments from **kwargs from __call__().
The call() method should be overridden on the actual plugin class. It should provide the data processing for the plugin. __call__()’s signature will be identical to that of call() except that call() should not accept **kwargs. That should be consumed by the hooks.
__call__() should not be overridden anywhere.
I removed this for now, but maybe consider again later: I still need to do more research to understand the effects of ParamSpec, TypeVar, and Generic, but they are supposed to help make this class and its children interact with IDE, static analysis tools, and other type checkers correctly.
- class geoips.interfaces.class_based_plugin.BaseClassPlugin(module=None)[source]#
Bases:
ABCThe base class for GeoIPS class-based plugins.
All plugins are required to carry the following class attributes:
interface: The interface type the plugin belongs to (e.g. ‘readers’, ‘products’). This is typically provided by the interface-level plugin class and not the individual plugin class.
family: The family name of the plugin. This should be defined by the plugin class.
name: The specific name of the plugin. This should be defined by the plugin class.
Subclasses of this base class must also implement the following methods:
call(): The main method that performs the plugin’s functionality. This method should be implemented by the plugin class.
_pre_call(): A hook method that can be overridden to preprocess data before calling the main call() method. This method should accept the same arguments as call() via *args and **kwargs and should, typically, be implemented by the interface-level plugin class.
_post_call(): A hook method that can be overridden to post-process data after calling the main call() method. This method should accept the same arguments as call() via *args and **kwargs and should, typically, be implemented by the interface-level plugin class.
The purpose of _pre_call() and _post_call() is to allow for common functionality that all plugins of a certain type should possess, without requiring developers to implement this functionality in every plugin class. Initially, this will be used to convert inputs from DataTree to other formats and back to DataTree after processing, but it could be used for other common tasks as well.
- data_tree = False#
- required_attributes = ['interface', 'family', 'name']#
Module contents#
GeoIPS interface module.