pyams_catalog package ⊞¶
Subpackages¶
pyams_catalog.index¶
-
class
pyams_catalog.index.DatetimeIndexWithInterface(interface, discriminator, resolution=2, family=None)[source]¶ Bases:
pyams_catalog.index.FieldIndexWithInterfaceNormalized datetime index with interface support
-
class
pyams_catalog.index.FacetIndexWithInterface(interface, discriminator, facets, family=None)[source]¶ Bases:
pyams_catalog.index.InterfaceSupportIndexMixin,hypatia.facet.FacetIndexFacet index with interface support
-
class
pyams_catalog.index.FieldIndexWithInterface(interface, discriminator, family=None)[source]¶ Bases:
pyams_catalog.index.InterfaceSupportIndexMixin,hypatia.field.FieldIndexField index with interface support
-
class
pyams_catalog.index.InterfaceSupportIndexMixin(interface)[source]¶ Bases:
hypatia.util.BaseIndexMixinCustom index mixin handling objects interfaces
-
class
pyams_catalog.index.KeywordIndexWithInterface(interface, discriminator, family=None)[source]¶ Bases:
pyams_catalog.index.InterfaceSupportIndexMixin,hypatia.keyword.KeywordIndexKeyword index with interface support
-
class
pyams_catalog.index.TextIndexWithInterface(interface, discriminator, lexicon=None, language='english', index=None, family=None)[source]¶ Bases:
pyams_catalog.index.InterfaceSupportIndexMixin,hypatia.text.TextIndexText index with interface support
-
pyams_catalog.index.get_resolution(value, resolution)[source]¶ Set resolution of given date or datetime
>>> from pyams_catalog.interfaces import * >>> from pyams_catalog.index import get_resolution >>> from datetime import date, datetime
Starting with dates:
>>> today = date(2017, 7, 11) >>> get_resolution(today, YEAR_RESOLUTION) datetime.date(2017, 1, 1) >>> get_resolution(today, MONTH_RESOLUTION) datetime.date(2017, 7, 1) >>> get_resolution(today, DATE_RESOLUTION) datetime.date(2017, 7, 11)
Asking for a resolution higher than DATE with a date input only returns date:
>>> get_resolution(today, MINUTE_RESOLUTION) datetime.date(2017, 7, 11)
Same examples with datetimes:
>>> now = datetime(2017, 7, 11, 13, 22, 10) >>> get_resolution(now, YEAR_RESOLUTION) datetime.datetime(2017, 1, 1, 0, 0) >>> get_resolution(now, MONTH_RESOLUTION) datetime.datetime(2017, 7, 1, 0, 0) >>> get_resolution(now, DATE_RESOLUTION) datetime.datetime(2017, 7, 11, 0, 0) >>> get_resolution(now, HOUR_RESOLUTION) datetime.datetime(2017, 7, 11, 13, 0) >>> get_resolution(now, MINUTE_RESOLUTION) datetime.datetime(2017, 7, 11, 13, 22) >>> get_resolution(now, SECOND_RESOLUTION) datetime.datetime(2017, 7, 11, 13, 22, 10)