Skip to content

Commit

Permalink
fix repr replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
headtr1ck committed Dec 15, 2023
1 parent 28f37e4 commit ca7215a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/netCDF4/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

import os
from typing import TypeAlias, Literal, Any, NoReturn, Iterable, Mapping, Union, Sequence
from typing_extensions import Buffer

from cftime import num2date, date2num, date2index
import numpy as np
import numpy.typing as npt
import os
import datetime
import cftime
from cftime import num2date, date2num, date2index

__all__ = [
'Dataset', 'Variable', 'Dimension', 'Group', 'MFDataset', 'MFTime', 'CompoundType',
Expand Down Expand Up @@ -204,13 +204,13 @@ class Dataset:


class Group(Dataset):
def __init__( self, parent: Group | Dataset, name: str, **kwargs: Any) -> None: ...
def __init__(self, parent: Group | Dataset, name: str, **kwargs: Any) -> None: ...

def close(self) -> NoReturn: ...


class Dimension:
def __init__( self, grp: Group, name: str, size: int | None = None, **kwargs: Any) -> None: ...
def __init__(self, grp: Group, name: str, size: int | None = None, **kwargs: Any) -> None: ...

@property
def name(self) -> str: ...
Expand Down
8 changes: 4 additions & 4 deletions src/netCDF4/_netCDF4.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2556,7 +2556,7 @@ strings.
return self.__str__()

def __str__(self):
ncdump = [repr(type(self)).replace("_netCDF4", "")]
ncdump = [repr(type(self)).replace("._netCDF4", "")]
dimnames = tuple(_tostr(dimname)+'(%s)'%len(self.dimensions[dimname])\
for dimname in self.dimensions.keys())
varnames = tuple(\
Expand Down Expand Up @@ -4450,7 +4450,7 @@ behavior is similar to Fortran or Matlab, but different than numpy.
cdef int ierr, no_fill
if not dir(self._grp):
return 'Variable object no longer valid'
ncdump = [repr(type(self)).replace("_netCDF4", "")]
ncdump = [repr(type(self)).replace("._netCDF4", "")]
show_more_dtype = True
if self._iscompound:
kind = 'compound'
Expand Down Expand Up @@ -6984,7 +6984,7 @@ Example usage (See `MFDataset.__init__` for more details):
return all(map(lambda dset: dset.isopen(), self._cdf))

def __repr__(self):
ncdump = [repr(type(self)).replace("_netCDF4", "")]
ncdump = [repr(type(self)).replace("._netCDF4", "")]
dimnames = tuple(str(dimname) for dimname in self.dimensions.keys())
varnames = tuple(str(varname) for varname in self.variables.keys())
grpnames = ()
Expand Down Expand Up @@ -7048,7 +7048,7 @@ class _Variable:
except:
raise AttributeError(name)
def __repr__(self):
ncdump = [repr(type(self)).replace("_netCDF4", "")]
ncdump = [repr(type(self)).replace("._netCDF4", "")]
dimnames = tuple(str(dimname) for dimname in self.dimensions)
ncdump.append('%s %s%s' % (self.dtype, self._name, dimnames))
for name in self.ncattrs():
Expand Down

0 comments on commit ca7215a

Please sign in to comment.