From 51b069c5eef8dd484dad91c8d9e1b56a5ef995a9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 15:35:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/xncml/core.py | 2 +- src/xncml/generated/ncml_2_2.py | 172 ++++++++++++++++---------------- tests/test_parser.py | 2 +- 3 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/xncml/core.py b/src/xncml/core.py index 6bc8c0c..2f742e8 100644 --- a/src/xncml/core.py +++ b/src/xncml/core.py @@ -13,7 +13,7 @@ import xmltodict -class Dataset(object): +class Dataset: """A class for reading and manipulating NcML file. Note that NcML documents are used for two distinct purposes: diff --git a/src/xncml/generated/ncml_2_2.py b/src/xncml/generated/ncml_2_2.py index fc4a182..61594e2 100644 --- a/src/xncml/generated/ncml_2_2.py +++ b/src/xncml/generated/ncml_2_2.py @@ -51,7 +51,7 @@ class Meta: name = "cacheVariable" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", @@ -66,14 +66,14 @@ class Meta: name = "dimension" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - length: Optional[str] = field( + length: str | None = field( default=None, metadata={ "type": "Attribute", @@ -100,7 +100,7 @@ class Meta: "type": "Attribute", }, ) - org_name: Optional[str] = field( + org_name: str | None = field( default=None, metadata={ "name": "orgName", @@ -115,7 +115,7 @@ class Meta: name = "logicalReduce" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - dim_names: Optional[str] = field( + dim_names: str | None = field( default=None, metadata={ "name": "dimNames", @@ -131,7 +131,7 @@ class Meta: name = "logicalSection" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - section: Optional[str] = field( + section: str | None = field( default=None, metadata={ "type": "Attribute", @@ -146,7 +146,7 @@ class Meta: name = "logicalSlice" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - dim_name: Optional[str] = field( + dim_name: str | None = field( default=None, metadata={ "name": "dimName", @@ -154,7 +154,7 @@ class Meta: "required": True, }, ) - index: Optional[int] = field( + index: int | None = field( default=None, metadata={ "type": "Attribute", @@ -169,14 +169,14 @@ class Meta: name = "promoteGlobalAttribute" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - org_name: Optional[str] = field( + org_name: str | None = field( default=None, metadata={ "name": "orgName", @@ -191,38 +191,38 @@ class Meta: name = "values" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - start: Optional[float] = field( + start: float | None = field( default=None, metadata={ "type": "Attribute", }, ) - increment: Optional[float] = field( + increment: float | None = field( default=None, metadata={ "type": "Attribute", }, ) - npts: Optional[int] = field( + npts: int | None = field( default=None, metadata={ "type": "Attribute", }, ) - separator: Optional[str] = field( + separator: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - from_attribute: Optional[str] = field( + from_attribute: str | None = field( default=None, metadata={ "name": "fromAttribute", "type": "Attribute", }, ) - content: List[object] = field( + content: list[object] = field( default_factory=list, metadata={ "type": "Wildcard", @@ -238,7 +238,7 @@ class Meta: name = "attribute" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", @@ -251,33 +251,33 @@ class Meta: "type": "Attribute", }, ) - value: Optional[str] = field( + value: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - separator: Optional[str] = field( + separator: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - org_name: Optional[str] = field( + org_name: str | None = field( default=None, metadata={ "name": "orgName", "type": "Attribute", }, ) - is_unsigned: Optional[bool] = field( + is_unsigned: bool | None = field( default=None, metadata={ "name": "isUnsigned", "type": "Attribute", }, ) - content: List[object] = field( + content: list[object] = field( default_factory=list, metadata={ "type": "Wildcard", @@ -293,7 +293,7 @@ class Meta: name = "enumTypedef" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", @@ -306,7 +306,7 @@ class Meta: "type": "Attribute", }, ) - content: List[object] = field( + content: list[object] = field( default_factory=list, metadata={ "type": "Wildcard", @@ -315,7 +315,7 @@ class Meta: "choices": ( { "name": "enum", - "type": Type["EnumTypedef.EnumType"], + "type": type["EnumTypedef.EnumType"], }, ), }, @@ -323,14 +323,14 @@ class Meta: @dataclass class EnumType: - key: Optional[int] = field( + key: int | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - content: List[object] = field( + content: list[object] = field( default_factory=list, metadata={ "type": "Wildcard", @@ -346,14 +346,14 @@ class Meta: name = "remove" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - type: Optional[ObjectType] = field( + type: ObjectType | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", @@ -368,77 +368,77 @@ class Meta: name = "variable" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - attribute: List[Attribute] = field( + attribute: list[Attribute] = field( default_factory=list, metadata={ "type": "Element", }, ) - values: Optional[Values] = field( + values: Values | None = field( default=None, metadata={ "type": "Element", }, ) - variable: List["Variable"] = field( + variable: list[Variable] = field( default_factory=list, metadata={ "type": "Element", }, ) - logical_section: Optional[LogicalSection] = field( + logical_section: LogicalSection | None = field( default=None, metadata={ "name": "logicalSection", "type": "Element", }, ) - logical_slice: Optional[LogicalSlice] = field( + logical_slice: LogicalSlice | None = field( default=None, metadata={ "name": "logicalSlice", "type": "Element", }, ) - logical_reduce: Optional[LogicalReduce] = field( + logical_reduce: LogicalReduce | None = field( default=None, metadata={ "name": "logicalReduce", "type": "Element", }, ) - remove: List[Remove] = field( + remove: list[Remove] = field( default_factory=list, metadata={ "type": "Element", }, ) - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - type: Optional[DataType] = field( + type: DataType | None = field( default=None, metadata={ "type": "Attribute", }, ) - typedef: Optional[str] = field( + typedef: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - shape: Optional[str] = field( + shape: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - org_name: Optional[str] = field( + org_name: str | None = field( default=None, metadata={ "name": "orgName", @@ -453,7 +453,7 @@ class Meta: name = "group" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - choice: List[object] = field( + choice: list[object] = field( default_factory=list, metadata={ "type": "Elements", @@ -476,7 +476,7 @@ class Meta: }, { "name": "group", - "type": Type["Group"], + "type": type["Group"], }, { "name": "remove", @@ -485,14 +485,14 @@ class Meta: ), }, ) - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - org_name: Optional[str] = field( + org_name: str | None = field( default=None, metadata={ "name": "orgName", @@ -507,7 +507,7 @@ class Meta: name = "aggregation" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - choice: List[object] = field( + choice: list[object] = field( default_factory=list, metadata={ "type": "Elements", @@ -535,75 +535,75 @@ class Meta: ), }, ) - variable_agg: List["Aggregation.VariableAgg"] = field( + variable_agg: list[Aggregation.VariableAgg] = field( default_factory=list, metadata={ "name": "variableAgg", "type": "Element", }, ) - promote_global_attribute: List[PromoteGlobalAttribute] = field( + promote_global_attribute: list[PromoteGlobalAttribute] = field( default_factory=list, metadata={ "name": "promoteGlobalAttribute", "type": "Element", }, ) - cache_variable: List[CacheVariable] = field( + cache_variable: list[CacheVariable] = field( default_factory=list, metadata={ "name": "cacheVariable", "type": "Element", }, ) - netcdf: List["Netcdf"] = field( + netcdf: list[Netcdf] = field( default_factory=list, metadata={ "type": "Element", }, ) - scan: List["Aggregation.Scan"] = field( + scan: list[Aggregation.Scan] = field( default_factory=list, metadata={ "type": "Element", }, ) - scan_fmrc: List["Aggregation.ScanFmrc"] = field( + scan_fmrc: list[Aggregation.ScanFmrc] = field( default_factory=list, metadata={ "name": "scanFmrc", "type": "Element", }, ) - type: Optional[AggregationType] = field( + type: AggregationType | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - dim_name: Optional[str] = field( + dim_name: str | None = field( default=None, metadata={ "name": "dimName", "type": "Attribute", }, ) - recheck_every: Optional[str] = field( + recheck_every: str | None = field( default=None, metadata={ "name": "recheckEvery", "type": "Attribute", }, ) - time_units_change: Optional[bool] = field( + time_units_change: bool | None = field( default=None, metadata={ "name": "timeUnitsChange", "type": "Attribute", }, ) - fmrc_definition: Optional[str] = field( + fmrc_definition: str | None = field( default=None, metadata={ "name": "fmrcDefinition", @@ -613,7 +613,7 @@ class Meta: @dataclass class VariableAgg: - name: Optional[str] = field( + name: str | None = field( default=None, metadata={ "type": "Attribute", @@ -623,21 +623,21 @@ class VariableAgg: @dataclass class Scan: - location: Optional[str] = field( + location: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - reg_exp: Optional[str] = field( + reg_exp: str | None = field( default=None, metadata={ "name": "regExp", "type": "Attribute", }, ) - suffix: Optional[str] = field( + suffix: str | None = field( default=None, metadata={ "type": "Attribute", @@ -649,21 +649,21 @@ class Scan: "type": "Attribute", }, ) - older_than: Optional[str] = field( + older_than: str | None = field( default=None, metadata={ "name": "olderThan", "type": "Attribute", }, ) - date_format_mark: Optional[str] = field( + date_format_mark: str | None = field( default=None, metadata={ "name": "dateFormatMark", "type": "Attribute", }, ) - enhance: Optional[bool] = field( + enhance: bool | None = field( default=None, metadata={ "type": "Attribute", @@ -672,21 +672,21 @@ class Scan: @dataclass class ScanFmrc: - location: Optional[str] = field( + location: str | None = field( default=None, metadata={ "type": "Attribute", "required": True, }, ) - reg_exp: Optional[str] = field( + reg_exp: str | None = field( default=None, metadata={ "name": "regExp", "type": "Attribute", }, ) - suffix: Optional[str] = field( + suffix: str | None = field( default=None, metadata={ "type": "Attribute", @@ -698,28 +698,28 @@ class ScanFmrc: "type": "Attribute", }, ) - older_than: Optional[str] = field( + older_than: str | None = field( default=None, metadata={ "name": "olderThan", "type": "Attribute", }, ) - run_date_matcher: Optional[str] = field( + run_date_matcher: str | None = field( default=None, metadata={ "name": "runDateMatcher", "type": "Attribute", }, ) - forecast_date_matcher: Optional[str] = field( + forecast_date_matcher: str | None = field( default=None, metadata={ "name": "forecastDateMatcher", "type": "Attribute", }, ) - forecast_offset_matcher: Optional[str] = field( + forecast_offset_matcher: str | None = field( default=None, metadata={ "name": "forecastOffsetMatcher", @@ -734,27 +734,27 @@ class Meta: name = "netcdf" namespace = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" - read_metadata: Optional[object] = field( + read_metadata: object | None = field( default=None, metadata={ "name": "readMetadata", "type": "Element", }, ) - explicit: Optional[object] = field( + explicit: object | None = field( default=None, metadata={ "type": "Element", }, ) - iosp_param: Optional[object] = field( + iosp_param: object | None = field( default=None, metadata={ "name": "iospParam", "type": "Element", }, ) - choice: List[object] = field( + choice: list[object] = field( default_factory=list, metadata={ "type": "Elements", @@ -790,71 +790,71 @@ class Meta: ), }, ) - location: Optional[str] = field( + location: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - id: Optional[str] = field( + id: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - title: Optional[str] = field( + title: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - enhance: Optional[str] = field( + enhance: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - add_records: Optional[bool] = field( + add_records: bool | None = field( default=None, metadata={ "name": "addRecords", "type": "Attribute", }, ) - iosp: Optional[str] = field( + iosp: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - iosp_param_attribute: Optional[str] = field( + iosp_param_attribute: str | None = field( default=None, metadata={ "name": "iospParam", "type": "Attribute", }, ) - buffer_size: Optional[int] = field( + buffer_size: int | None = field( default=None, metadata={ "name": "bufferSize", "type": "Attribute", }, ) - ncoords: Optional[str] = field( + ncoords: str | None = field( default=None, metadata={ "type": "Attribute", }, ) - coord_value: Optional[str] = field( + coord_value: str | None = field( default=None, metadata={ "name": "coordValue", "type": "Attribute", }, ) - section: Optional[str] = field( + section: str | None = field( default=None, metadata={ "type": "Attribute", diff --git a/tests/test_parser.py b/tests/test_parser.py index 3784e09..ebfcc76 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -16,7 +16,7 @@ data = Path(__file__).parent / "data" -class CheckClose(object): +class CheckClose: """Check that files are closed after the test. Note that `close` has to be explicitly called within the context manager for this to work. """