easy-utils-dev 2.128__py3-none-any.whl → 2.130__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.

Potentially problematic release.


This version of easy-utils-dev might be problematic. Click here for more details.

easy_utils_dev/ept.py CHANGED
@@ -254,6 +254,83 @@ class EPTManager :
254
254
  data = lget(db.execute_dict(query) , 0 , {})
255
255
  return data
256
256
 
257
+ def _create_crossconnections_table(self) :
258
+ query = f"""
259
+ CREATE TABLE c_crossconnections AS
260
+ SELECT DISTINCT
261
+ p.owner as wdmdemand,
262
+ sh.number || '-' || sm.physicalslot || '-L' || p.portnumber as physicalslot ,
263
+ sh.type as shelftype ,
264
+ sh.number as shelfid ,
265
+ sm.physicalslot ,
266
+ ch.deployedname,
267
+ ch.name as eptname,
268
+ s.name as sitename ,
269
+ b.ot as boardtype ,
270
+ rch.name as channelnumber
271
+ FROM port p
272
+ JOIN circuitpack cp ON p.parentId = cp.id
273
+ JOIN shelf sh ON cp.parentId = sh.id
274
+ JOIN site s ON sh.grandparentId = s.id
275
+ JOIN OTtype b on b.OTtype = cp.type
276
+ JOIN wdmdemand ch ON p.owner = ch.id AND ch.category = 'Trail'
277
+ JOIN slot_mapping sm ON sh.type = sm.shelfType AND cp.slotid = sm.logicalSlot
278
+ JOIN channel rch ON rch.num = CAST(REPLACE(REPLACE(ch.assignedChannels_primary, '[', ''), ']', '') AS INTEGER)
279
+ WHERE ch.assignedChannels_primary IS NOT NULL
280
+ AND rch.name IS NOT NULL
281
+ AND cp.type IN (SELECT OTtype FROM OTtype WHERE otkind != 'alien' );
282
+ """
283
+ db = self.Database()
284
+ db.execute_dict(query)
285
+
286
+ def _create_card_inventory(self) :
287
+ query = f"""
288
+ CREATE TABLE c_card_inventory AS
289
+ SELECT DISTINCT
290
+ sh.number || '-' || pack.physicalslot AS slot,
291
+ sh.number AS shelfid,
292
+ pack.physicalslot,
293
+ s.name AS sitename,
294
+ pack.apn,
295
+ COALESCE(ott.ot, pack.type) AS boardname,
296
+ pack.source_table
297
+ FROM (
298
+ -- Circuitpack → logicalSlot → physicalslot via slot_mapping
299
+ SELECT cp.id,
300
+ cp.parentId,
301
+ sm.physicalslot,
302
+ cp.type,
303
+ cp.apn,
304
+ 'circuitpack' AS source_table
305
+ FROM circuitpack cp
306
+ JOIN shelf sh ON cp.parentId = sh.id
307
+ JOIN slot_mapping sm
308
+ ON sh.type = sm.shelfType
309
+ AND cp.slotid = sm.logicalSlot
310
+
311
+ UNION ALL
312
+
313
+ -- Commonpack → already has physicalslot
314
+ SELECT id,
315
+ parentId,
316
+ physicalslot,
317
+ type,
318
+ apn,
319
+ 'commonpack' AS source_table
320
+ FROM commonpack
321
+ ) pack
322
+ JOIN shelf sh
323
+ ON pack.parentId = sh.id
324
+ JOIN site s
325
+ ON sh.grandparentId = s.id
326
+ LEFT JOIN OAtype ota
327
+ ON ota.OAtype = pack.type
328
+ LEFT JOIN OTtype ott
329
+ ON ott.OTtype = pack.type;
330
+ """
331
+ db = self.Database()
332
+ db.execute_dict(query)
333
+
257
334
  def convert_design(self , drop_cols=[] ) :
258
335
  start = getTimestamp()
259
336
  db = self.Database()
@@ -262,6 +339,8 @@ class EPTManager :
262
339
  self.create_ept_rows()
263
340
  db.execute_script(f"{os.path.join(__LIBPATH__ , 'ept_sql' , 'create_dirs.sql')}")
264
341
  self._create_v_dirs()
342
+ self._create_crossconnections_table()
343
+ self._create_card_inventory()
265
344
  end = getTimestamp()
266
345
  if os.path.exists(self.tmp_design_path) :
267
346
  os.remove(self.tmp_design_path)
@@ -0,0 +1,82 @@
1
+ BEGIN;
2
+
3
+ -- 1) Mapping table: (shelfType, logicalSlot) -> physicalSlot
4
+ CREATE TABLE IF NOT EXISTS slot_mapping (
5
+ shelfType TEXT NOT NULL,
6
+ logicalSlot INTEGER NOT NULL,
7
+ physicalSlot INTEGER NOT NULL,
8
+ PRIMARY KEY (shelfType, logicalSlot)
9
+ );
10
+
11
+ -- Clean existing rows so script is idempotent without dialect-specific UPSERT
12
+ DELETE FROM slot_mapping;
13
+
14
+ -- PSS32 (32 slots)
15
+ INSERT INTO slot_mapping (shelfType, logicalSlot, physicalSlot) VALUES
16
+ ('PSS32',1,2),('PSS32',2,20),('PSS32',3,3),('PSS32',4,21),
17
+ ('PSS32',5,4),('PSS32',6,22),('PSS32',7,5),('PSS32',8,23),
18
+ ('PSS32',9,6),('PSS32',10,24),('PSS32',11,7),('PSS32',12,25),
19
+ ('PSS32',13,8),('PSS32',14,26),('PSS32',15,9),('PSS32',16,27),
20
+ ('PSS32',17,10),('PSS32',18,28),('PSS32',19,11),('PSS32',20,29),
21
+ ('PSS32',21,12),('PSS32',22,30),('PSS32',23,13),('PSS32',24,31),
22
+ ('PSS32',25,14),('PSS32',26,32),('PSS32',27,15),('PSS32',28,33),
23
+ ('PSS32',29,16),('PSS32',30,34),('PSS32',31,17),('PSS32',32,35);
24
+
25
+ -- PSS16II (16 slots)
26
+ INSERT INTO slot_mapping (shelfType, logicalSlot, physicalSlot) VALUES
27
+ ('PSS16II',1,3),('PSS16II',2,13),('PSS16II',3,4),('PSS16II',4,14),
28
+ ('PSS16II',5,5),('PSS16II',6,15),('PSS16II',7,6),('PSS16II',8,16),
29
+ ('PSS16II',9,7),('PSS16II',10,17),('PSS16II',11,8),('PSS16II',12,18),
30
+ ('PSS16II',13,9),('PSS16II',14,19),('PSS16II',15,10),('PSS16II',16,20);
31
+
32
+ -- PSS16 (same mapping as PSS16II)
33
+ INSERT INTO slot_mapping (shelfType, logicalSlot, physicalSlot) VALUES
34
+ ('PSS16',1,3),('PSS16',2,13),('PSS16',3,4),('PSS16',4,14),
35
+ ('PSS16',5,5),('PSS16',6,15),('PSS16',7,6),('PSS16',8,16),
36
+ ('PSS16',9,7),('PSS16',10,17),('PSS16',11,8),('PSS16',12,18),
37
+ ('PSS16',13,9),('PSS16',14,19),('PSS16',15,10),('PSS16',16,20);
38
+
39
+ -- PSS8 (8 slots)
40
+ INSERT INTO slot_mapping (shelfType, logicalSlot, physicalSlot) VALUES
41
+ ('PSS8',1,2),('PSS8',2,8),('PSS8',3,3),('PSS8',4,9),
42
+ ('PSS8',5,4),('PSS8',6,10),('PSS8',7,5),('PSS8',8,11);
43
+
44
+ -- 2) Helpful indexes
45
+ CREATE INDEX IF NOT EXISTS idx_circuitpack_parent ON circuitpack(parentId);
46
+ CREATE INDEX IF NOT EXISTS idx_circuitpack_wdmline ON circuitpack(wdmline);
47
+ CREATE INDEX IF NOT EXISTS idx_circuitpack_slotid ON circuitpack(slotid);
48
+ CREATE INDEX IF NOT EXISTS idx_shelf_id ON shelf(id);
49
+ CREATE INDEX IF NOT EXISTS idx_shelf_grandparent ON shelf(grandparentId);
50
+ CREATE INDEX IF NOT EXISTS idx_shelf_type ON shelf(type);
51
+ CREATE INDEX IF NOT EXISTS idx_line_id ON "line"(id);
52
+ CREATE INDEX IF NOT EXISTS idx_line_span ON "line"(span);
53
+ CREATE INDEX IF NOT EXISTS idx_site_id ON site(id);
54
+
55
+ -- 3) View that reproduces get_all_dirs()
56
+ DROP VIEW IF EXISTS v_dirs;
57
+ CREATE VIEW v_dirs AS
58
+ SELECT
59
+ src.name AS sourceNe,
60
+ dst.name AS destinationNe,
61
+ cp.type AS board,
62
+ sm.physicalSlot AS physicalslot,
63
+ (sh.number || '/' || sm.physicalSlot) AS slot,
64
+ sh.type AS shelfType,
65
+ cp.id AS circuitpack_id,
66
+ sh.id AS shelf_id,
67
+ l1.span AS span_id,
68
+ src.id AS source_site_id,
69
+ dst.id AS destination_site_id
70
+ FROM circuitpack cp
71
+ JOIN shelf sh ON sh.id = cp.parentId
72
+ JOIN site src ON src.id = sh.grandparentId
73
+ JOIN "line" l1 ON l1.id = cp.wdmline
74
+ JOIN "line" l2 ON l2.span = l1.span AND l2.grandparentId <> sh.grandparentId
75
+ JOIN site dst ON dst.id = l2.grandparentId
76
+ WHERE cp.packIDRef IS NOT NULL
77
+ AND cp.type IN (
78
+ SELECT packName FROM OAtype
79
+ WHERE packName IS NOT NULL OR packName != ''
80
+ );
81
+
82
+ COMMIT;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easy-utils-dev
3
- Version: 2.128
3
+ Version: 2.130
4
4
  Keywords: python3
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Requires-Dist: psutil
@@ -11,7 +11,7 @@ easy_utils_dev/custom_env.py,sha256=vxrjikpSNJlKfoBE-ef88UExlpXucUe-HcwHMn3gfB0,
11
11
  easy_utils_dev/debugger.py,sha256=08lYSg9Mx0l440aCk4Z1ofNUlN9pTL9um2CL_cCyUKs,18305
12
12
  easy_utils_dev/easy_oracle.py,sha256=Jyc3HSl6eyLayjS8NoE4GOaf8otQlonR5_qOg2h1DjE,2157
13
13
  easy_utils_dev/encryptor.py,sha256=f5Zjn0DGtXCyhldpVnBtfcTb4h4Wp0eQPHusEYwIags,1512
14
- easy_utils_dev/ept.py,sha256=SQfp77FwXbWohfS2JzMghoIhWRjo-oqbOZacWiVm49k,12918
14
+ easy_utils_dev/ept.py,sha256=Xt5jck4PpBlump7oaF76qwCVWIKMBiKVb91MtUQ5AEY,15817
15
15
  easy_utils_dev/exceptions.py,sha256=6eTYBa8AIXC0wI6zgkqsLreSXyPf459G-ToO7ziQuK4,1669
16
16
  easy_utils_dev/filescompressor.py,sha256=iKAtLfkEXOuvvqF56jH0D9KAAeZ7iaa_sRaJnyYkxiE,2875
17
17
  easy_utils_dev/generate_license.py,sha256=fr_eoSjKCmDmAEBc6FWFXZxGQOHx9XO6hEK8dcyVUlA,3319
@@ -29,7 +29,8 @@ easy_utils_dev/utils.py,sha256=BmVnbxc336c6WTeDFcEHN6Mavt7fJrIEyK4GXODV3gI,13345
29
29
  easy_utils_dev/winserviceapi.py,sha256=2ZP6jaSt1-5vEJYXqwBhwX-1-eQ3V3YzntsoOoko2cw,18804
30
30
  easy_utils_dev/wsnoclib.py,sha256=tC-RmjddaLpihPCRBLGC2RnRpFJqexhvExUr1KncoQM,29063
31
31
  easy_utils_dev/wsselib.py,sha256=YweScnoAAH_t29EeIjBpkQ6HtX0Rp9mQudRsRce2SE8,7920
32
- easy_utils_dev-2.128.dist-info/METADATA,sha256=Sj8wdN5Dz9Wk0OFol4zVd6a7vATyfrb3KYUUiCjNjDA,510
33
- easy_utils_dev-2.128.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
34
- easy_utils_dev-2.128.dist-info/top_level.txt,sha256=7vBsrpq7NmilkdU3YUvfd5iVDNBaT07u_-ut4F7zc7A,15
35
- easy_utils_dev-2.128.dist-info/RECORD,,
32
+ easy_utils_dev/ept_sql/create_dirs.sql,sha256=Tdd7eaZ1BmIe9DY4gnt2VQ0y_TSYWe9DxObfW2UbL-c,3510
33
+ easy_utils_dev-2.130.dist-info/METADATA,sha256=mgX9tbXKj4qsu2O4nWqTK6InvEKnyVrjoSLzdTMJMsA,510
34
+ easy_utils_dev-2.130.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
35
+ easy_utils_dev-2.130.dist-info/top_level.txt,sha256=7vBsrpq7NmilkdU3YUvfd5iVDNBaT07u_-ut4F7zc7A,15
36
+ easy_utils_dev-2.130.dist-info/RECORD,,