parsedmarc.source.util
🔗
Utitily Sources
These Sources are not intended to be used in production.
MalformedAggregateReportGenerator
🔗
MalformedAggregateReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces malformed AggregateReport
s
Useful for testing.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
MalformedForensicReportGenerator
🔗
MalformedForensicReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces malformed ForensicReport
s
Useful for testing.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
RandomAggregateReportGenerator
🔗
RandomAggregateReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces random AggregateReport
s
Useful for testing.
Note: reports are randomly generates which means that although unlikely it is possible that duplicate reports will be generated.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
RandomForensicReportGenerator
🔗
RandomForensicReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces random ForensicReport
s
Useful for testing.
Note: reports are randomly generates which means that although unlikely it is possible that duplicate reports will be generated.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
ReportConfig
🔗
StaticAggregateReportGenerator
🔗
StaticAggregateReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces the same AggregateReport
every time
Useful for duplicate report testing
Config
report: dict[str, Any]
: static report to use instead of the default one.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
StaticForensicReportGenerator
🔗
StaticForensicReportGenerator(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: UtilitySource
Source that produces the same ForensicReport
every time
Useful for duplicate report testing
Config
report: dict[str, Any]
: static report to use instead of the default one.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.
UtilityConfig
🔗
UtilitySource
🔗
UtilitySource(
name: str = "default",
parser: ReportParser | None = None,
config: dict[str, Any] | None = None,
)
Bases: Source
Base class for utility sources.
This class should not be used directly.
Child classes MUST implement self.make_report
.
New in 9.0.
PARAMETER | DESCRIPTION |
---|---|
name |
profile name for this instance, ideally should be unqiue to easily idenfity this instance and any log messages it produces
TYPE:
|
parser |
parser to use when generating reports
TYPE:
|
config |
config for this instance |
outstanding_jobs
property
🔗
outstanding_jobs: MappingProxyType[str, Job]
Read only view of outstanding jobs
ack_job
🔗
cleanup
🔗
Perform cleanup on this source.
This method is called as a part of self.shutdown
.
Child classes can override this method to implement their own logic.
It is still recomended to call super().cleanup()
.
register_job
🔗
register_job(job: Job) -> None
Register a job to this source so we can keep track of it
PARAMETER | DESCRIPTION |
---|---|
job |
the job to register
TYPE:
|
setup
🔗
Perform setup actions to ensure this Source is ready to produce.
Child classes can override this method to implement their own logic.
Child classes should
- check that
self._state == AppState.SHUTDOWN
- set
self._state = AppState.SETTING_UP
- do their setup actions
- if an error occurs set
self._state = AppState.SETUP_ERROR
- otherwise set
self._state = AppState.RUNNING
shutdown
🔗
validate_config
🔗
Validate the config of this instance
Child classes can override this method to implement their own logic.
It is still recomended to call super().validate_config()
.