easysewer 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
easysewer/Rain.py CHANGED
@@ -8,6 +8,66 @@ time series data, and rainfall patterns for the drainage model.
8
8
  from .utils import *
9
9
 
10
10
 
11
+ class NamedList:
12
+ """A list-like collection that allows access by index or name.
13
+
14
+ This class implements common list methods and adds the ability to access items
15
+ by their name attribute.
16
+
17
+ Attributes:
18
+ data (list): The underlying list of items
19
+ """
20
+
21
+ def __init__(self, data=None):
22
+ self.data = data if data is not None else []
23
+
24
+ def __len__(self):
25
+ return len(self.data)
26
+
27
+ def __getitem__(self, key):
28
+ if isinstance(key, int):
29
+ return self.data[key]
30
+ elif isinstance(key, str):
31
+ for item in self.data:
32
+ if item.name == key:
33
+ return item
34
+ raise KeyError(f"No item found with name '{key}'")
35
+ else:
36
+ raise TypeError("Key must be an integer or a string")
37
+
38
+ def __iter__(self):
39
+ return iter(self.data)
40
+
41
+ def __contains__(self, item):
42
+ return item in self.data
43
+
44
+ def append(self, item):
45
+ """Add an item to the collection.
46
+
47
+ Args:
48
+ item: The item to add
49
+ """
50
+ self.data.append(item)
51
+
52
+
53
+ class TimeSeriesList(NamedList):
54
+ """A specialized collection for TimeSeries objects.
55
+
56
+ Inherits all functionality from NamedList and may add TimeSeries-specific
57
+ methods in the future.
58
+ """
59
+ pass
60
+
61
+
62
+ class RainGageList(NamedList):
63
+ """A specialized collection for RainGage objects.
64
+
65
+ Inherits all functionality from NamedList and may add RainGage-specific
66
+ methods in the future.
67
+ """
68
+ pass
69
+
70
+
11
71
  def parse_swmm_datetime(date_str=None, time_str=None):
12
72
  """Convert SWMM date and time strings to minutes since start of day
13
73
 
@@ -85,8 +145,8 @@ class Rain:
85
145
  ts_list (list): Collection of time series data
86
146
  """
87
147
  def __init__(self):
88
- self.ts_list = []
89
- self.gage_list = []
148
+ self.ts_list = TimeSeriesList()
149
+ self.gage_list = RainGageList()
90
150
 
91
151
  def __repr__(self):
92
152
  if len(self.gage_list) == 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easysewer
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: An urban drainage modeling toolkit
5
5
  Author-email: Yiran Ji <yiranji@zju.edu.cn>
6
6
  License-Expression: AGPL-3.0-only
@@ -4,7 +4,7 @@ easysewer/Link.py,sha256=tZWGPg5EMcii6hfswNPp5MMz3wLdZPzuil9Sjv6OqXc,11802
4
4
  easysewer/Node.py,sha256=trtXGPLDk1gkdKMXXwJ1hUOmsS6x2mVr4wh61Lxisqk,14092
5
5
  easysewer/Options.py,sha256=zsmyDpiQO0Swsrqkzw_vow4lNKbiLsLX_0YQ6XWsSBI,18425
6
6
  easysewer/OutputAPI.py,sha256=tD6-6VjBpG-DBlmvVhb9siZ_zgEe1lD1d0h2xPr72Qw,7519
7
- easysewer/Rain.py,sha256=Hu_XtEXreIquf4uLxMgAiG_eRNc0OzuansDnZ1ozGAQ,7597
7
+ easysewer/Rain.py,sha256=MCw-vmDwLANuRGmh_EEQS4kNB1RNdeGSvQ9L8GobbIA,9239
8
8
  easysewer/SolverAPI.py,sha256=H1KZkS_03Mv2ruSNX6-Rg_fesTwL9O6R5TRCil2eC7o,5612
9
9
  easysewer/UDM.py,sha256=DfEOFRyFR5guy7yEU_ve_XsRypXQ3k2nn5Slc5VAzOc,4385
10
10
  easysewer/__init__.py,sha256=XD2zR0vua7-FMz5brRDY9FCzF_QNkPozfrOl7dvYALc,175
@@ -13,7 +13,7 @@ easysewer/libs/linux/libswmm5.so,sha256=UI5v1fCZ7LU9zkjLQMJqqJtzDefkFnL1iy3jmAlF
13
13
  easysewer/libs/linux/swmm-output.so,sha256=248JHb0PUGyeo3tLj9fL4L114ySTSLBrUUA_k3VHnCQ,30928
14
14
  easysewer/libs/win/swmm-output.dll,sha256=tN0K2ZRk7rlQZ-cLxlGLYZ6w269uvc5JuH1oVumADD0,71168
15
15
  easysewer/libs/win/swmm5.dll,sha256=7LjGQXUyj8bdVuFzzY8-pObQV0VcUDI5KsAz-hstWls,915968
16
- easysewer-0.0.1.dist-info/METADATA,sha256=GGX1eS11v3_hpeMxS1QsuqwJQi9wfJzEVZfVWTja_es,586
17
- easysewer-0.0.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
18
- easysewer-0.0.1.dist-info/top_level.txt,sha256=YJi065ohgpDZhPb0XuXfE6ExHMhHPlwveH40BgZ7kt4,10
19
- easysewer-0.0.1.dist-info/RECORD,,
16
+ easysewer-0.0.2.dist-info/METADATA,sha256=Gzv6CSbBmfTvrNfdkHR1calbcDmKpjlFx-JLTbZQiEs,586
17
+ easysewer-0.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
18
+ easysewer-0.0.2.dist-info/top_level.txt,sha256=YJi065ohgpDZhPb0XuXfE6ExHMhHPlwveH40BgZ7kt4,10
19
+ easysewer-0.0.2.dist-info/RECORD,,