Skip to content

Commit

Permalink
Merge pull request #754 from Hugovdberg/drop_pytz
Browse files Browse the repository at this point in the history
Drop pytz
  • Loading branch information
Hugovdberg authored Jun 21, 2024
2 parents ff35c27 + bafb8cd commit 87b1b01
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ formats: all
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true
fail_on_warning: false

python:
install:
Expand Down
6 changes: 3 additions & 3 deletions PIconnect/_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import datetime
from typing import Union

import pytz
import zoneinfo

from PIconnect import AF, PIConfig
from PIconnect.AFSDK import System
Expand Down Expand Up @@ -69,7 +69,7 @@ def timestamp_to_index(timestamp: System.DateTime) -> datetime.datetime:
-------
`datetime`: Datetime with the timezone info from :data:`PIConfig.DEFAULT_TIMEZONE <PIconnect.config.PIConfigContainer.DEFAULT_TIMEZONE>`.
""" # noqa: E501
local_tz = pytz.timezone(PIConfig.DEFAULT_TIMEZONE)
local_tz = zoneinfo.ZoneInfo(PIConfig.DEFAULT_TIMEZONE)
return (
datetime.datetime(
timestamp.Year,
Expand All @@ -80,6 +80,6 @@ def timestamp_to_index(timestamp: System.DateTime) -> datetime.datetime:
timestamp.Second,
timestamp.Millisecond * 1000,
)
.replace(tzinfo=pytz.utc)
.replace(tzinfo=datetime.timezone.utc)
.astimezone(local_tz)
)
9 changes: 6 additions & 3 deletions PIconnect/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ class PIConfigContainer:
This should not be instantiated directly, but accessed through the `PIConfig` object.
"""

_default_timezone: str = "UTC"
_default_timezone: str = ""

def __init__(self) -> None:
self.DEFAULT_TIMEZONE = "UTC"

@property
def DEFAULT_TIMEZONE(self) -> str:
Expand All @@ -16,9 +19,9 @@ def DEFAULT_TIMEZONE(self) -> str:

@DEFAULT_TIMEZONE.setter
def DEFAULT_TIMEZONE(self, value: str) -> None:
import pytz
import zoneinfo

if value not in pytz.all_timezones:
if value not in zoneinfo.available_timezones():
raise ValueError("{v!r} not found in pytz.all_timezones".format(v=value))
self._default_timezone = value

Expand Down
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ name = "pypi"
[packages]
numpy = "<2"
pandas = "*"
pytz = "*"
wrapt = "*"
pythonnet = "*"
piconnect = {editable = true, path = "."}
Expand Down
3 changes: 1 addition & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/api/PIAF/PIconnect.PIAF.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ PIconnect.PIAF module
:undoc-members:
:inherited-members:
:show-inheritance:

.. autoclass:: PIconnect.PIAF.PIAFTable
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/api/PIAF/PIconnect.PIAFAttribute.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PIconnect.PIData module
=======================

.. automodule:: PIconnect.PIAFAttribute
:members:
:undoc-members:
:show-inheritance:
2 changes: 0 additions & 2 deletions docs/api/PIconnect.PIConsts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ PIconnect.PIConsts module
.. automodule:: PIconnect.PIConsts
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
6 changes: 3 additions & 3 deletions docs/api/PIconnect.time.rst → docs/api/PIconnect._time.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PIconnect.time module
=====================
PIconnect._time module
======================

.. automodule:: PIconnect.time
.. automodule:: PIconnect._time
:members:
:undoc-members:
:inherited-members:
Expand Down
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@ def __getattr__(cls, name) -> MagicMock: # type: ignore
extlinks = {"afsdk": ("https://docs.osisoft.com/bundle/af-sdk/page/html/%s", "")}

intersphinx_mapping = {
"python": ("https://docs.python.org/3.8", None),
"python": ("https://docs.python.org/3.10", None),
"pandas": ("https://pandas.pydata.org/docs", None),
"pytz": ("http://pytz.sourceforge.net", None),
}

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/piaf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ the latter element could be accessed directly as follows:

.. _finding_attributes:

************************************
***************************************
Searching attributes based on full path
************************************
***************************************

To get the direct attribute based on the entire element/attributes path
you can use the :any:`PIAFDatabase.search` method. You can provide a single string or list of strings with
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ packages =
install_requires =
pandas
wrapt
pytz
pythonnet
python_requires = >= 3.9
include_package_data = True
Expand Down

0 comments on commit 87b1b01

Please sign in to comment.