Skip to content

Commit

Permalink
add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
avaldebe committed Sep 28, 2023
1 parent 08f6a3b commit 762c8c0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pyaerocom/io/readungriddedbase.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import abc
import glob
import logging
Expand Down Expand Up @@ -207,7 +209,7 @@ def read(self, vars_to_retrieve=None, files=[], first_file=None, last_file=None)

### Concrete implementations of methods that are the same for all (or most)
# of the derived reading classes
def __init__(self, data_id=None, data_dir=None):
def __init__(self, data_id: str | None = None, data_dir: str | None = None):
self.data = None # object that holds the loaded data
self._data_id = None
self.files = []
Expand Down Expand Up @@ -246,7 +248,7 @@ def DATASET_PATH(self):
return self.data_dir

@property
def data_dir(self):
def data_dir(self) -> str:
"""
str: Location of the dataset
Expand Down
2 changes: 1 addition & 1 deletion pyaerocom/plugins/icos/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ReadICOS(ReadMEP):

PROVIDES_VARIABLES = list(VAR_MAPPING) + list(AUX_FUNS)

def __init__(self, data_id=None, data_dir=None):
def __init__(self, data_id: str | None = None, data_dir: str | None = None):
if data_dir is None:
data_dir = const.OBSLOCS_UNGRIDDED[const.ICOS_NAME]

Expand Down
2 changes: 1 addition & 1 deletion pyaerocom/plugins/mep/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ReadMEP(ReadUngriddedBase):

PROVIDES_VARIABLES = list(VAR_MAPPING) + list(AUX_FUNS)

def __init__(self, data_id=None, data_dir=None):
def __init__(self, data_id: str | None = None, data_dir: str | None = None):
if data_dir is None:
data_dir = const.OBSLOCS_UNGRIDDED[const.MEP_NAME]

Expand Down
2 changes: 1 addition & 1 deletion pyaerocom/ungriddeddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def copy(self):
return new

@property
def contains_vars(self):
def contains_vars(self) -> list[str]:
"""List of all variables in this dataset"""
return list(self.var_idx)

Expand Down

0 comments on commit 762c8c0

Please sign in to comment.