accounting.report.period package

Submodules

accounting.report.period.chooser module

The period chooser.

This file is largely taken from the NanoParma ERP project, first written in 2021/9/16 by imacat (imacat@nanoparma.com).

class accounting.report.period.chooser.PeriodChooser(get_url: Callable[[Period], str])

Bases: object

The period chooser.

all_url: str

The URL for all period.

available_years: list[int]

The available years.

data_start: date | None

The start of the data.

has_data: bool

Whether there is any data.

has_last_month: bool

Where there is data in last month.

has_last_year: bool

Whether there is data in last year.

has_yesterday: bool

Whether there is data in yesterday.

last_month_url: str

The URL for last month.

last_year_url: str

The URL for last year.

since_last_month_url: str

The URL since last mint.

this_month_url: str

The URL for this month.

this_year_url: str

The URL for this year.

today_url: str

The URL for today.

url_template: str

The URL template.

year_url(year: int) str

Returns the period URL of a year.

Parameters:

year – The year

Returns:

The period URL of the year.

yesterday_url: str

The URL for yesterday.

accounting.report.period.description module

The period description composer.

accounting.report.period.description.get_desc(start: date | None, end: date | None) str

Returns the period description.

Parameters:
  • start – The start of the period.

  • end – The end of the period.

Returns:

The period description.

accounting.report.period.month_end module

The utility to return the end of a month.

accounting.report.period.month_end.month_end(day: date) date

Returns the end day of month for a date.

Parameters:

day – The date.

Returns:

The end day of the month of that day.

accounting.report.period.parser module

The period specification parser.

accounting.report.period.parser.DATE_SPEC_RE: str = '(\\d{4})(?:-(\\d{2})(?:-(\\d{2}))?)?'

The regular expression of a date specification.

accounting.report.period.parser.get_period(spec: str | None = None) Period

Returns a period instance.

Parameters:

spec – The period specification, or omit for the default.

Returns:

The period instance.

Raises:

ValueError – When the period specification is invalid.

accounting.report.period.period module

The date period.

This file is largely taken from the NanoParma ERP project, first written in 2021/9/16 by imacat (imacat@nanoparma.com).

class accounting.report.period.period.Period(start: date | None, end: date | None)

Bases: object

A date period.

property before: Self | None

Returns the period before this period.

Returns:

The period before this period.

desc: str

The text description.

end: date | None

The end of the period.

is_a_day: bool

Whether the period is a single day.

is_a_month: bool

Whether the period is a whole month.

is_a_year: bool

Whether the period is a whole year.

is_all: bool

Whether the period is all time.

is_default: bool

Whether this is the default period.

is_last_month: bool

Whether the period is last month.

is_last_year: bool

Whether the period is last year.

is_since_last_month: bool

Whether the period is since last month.

is_this_month: bool

Whether the period is this month.

is_this_year: bool

Whether the period is this year.

is_today: bool

Whether the period is today.

property is_type_arbitrary: bool

Returns whether this period is an arbitrary period.

Returns:

True if this is an arbitrary period, or False otherwise.

is_type_month: bool

Whether the period is for the month chooser.

is_year(year: int) bool

Returns whether the period is the specific year period.

Parameters:

year – The year.

Returns:

True if the period is the year period, or False otherwise.

is_yesterday: bool

Whether the period is yesterday.

spec: str

The period specification.

start: date | None

The start of the period.

accounting.report.period.shortcuts module

The named shortcut periods.

class accounting.report.period.shortcuts.AllTime

Bases: Period

The period of all time.

class accounting.report.period.shortcuts.LastMonth

Bases: Period

The period of this month.

class accounting.report.period.shortcuts.LastYear

Bases: Period

The period of last year.

class accounting.report.period.shortcuts.SinceLastMonth

Bases: Period

The period of this month.

class accounting.report.period.shortcuts.TemplatePeriod

Bases: Period

The period template.

class accounting.report.period.shortcuts.ThisMonth

Bases: Period

The period of this month.

class accounting.report.period.shortcuts.ThisYear

Bases: Period

The period of this year.

class accounting.report.period.shortcuts.Today

Bases: Period

The period of today.

class accounting.report.period.shortcuts.YearPeriod(year: int)

Bases: Period

A year period.

class accounting.report.period.shortcuts.Yesterday

Bases: Period

The period of yesterday.

accounting.report.period.specification module

The period specification composer.

accounting.report.period.specification.get_spec(start: date | None, end: date | None) str

Returns the period specification.

Parameters:
  • start – The start of the period.

  • end – The end of the period.

Returns:

The period specification.

Module contents

The period utility.