chellow 1711032714.0.0__py3-none-any.whl → 1712838153.0.0__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 chellow might be problematic. Click here for more details.

chellow/e/elexon.py CHANGED
@@ -120,13 +120,6 @@ class Elexon(threading.Thread):
120
120
  with Session() as sess:
121
121
  try:
122
122
  config = Contract.get_non_core_by_name(sess, "configuration")
123
- props = config.make_properties()
124
- scripting_key = props.get(ELEXON_PORTAL_SCRIPTING_KEY_KEY)
125
- if scripting_key is None:
126
- raise BadRequest(
127
- f"The property {ELEXON_PORTAL_SCRIPTING_KEY_KEY} "
128
- f"cannot be found in the configuration properties."
129
- )
130
123
  state = config.make_state()
131
124
  try:
132
125
  elexon_state = state[ELEXON_STATE_KEY]
@@ -135,7 +128,14 @@ class Elexon(threading.Thread):
135
128
 
136
129
  elexon_state[LAST_RUN_KEY] = utc_datetime_now()
137
130
  config.update_state(state)
131
+ props = config.make_properties()
132
+ scripting_key = props.get(ELEXON_PORTAL_SCRIPTING_KEY_KEY)
138
133
  sess.commit()
134
+ if scripting_key is None:
135
+ raise BadRequest(
136
+ f"The property {ELEXON_PORTAL_SCRIPTING_KEY_KEY} "
137
+ f"cannot be found in the configuration properties."
138
+ )
139
139
  run_import(sess, self.log, self.set_progress, scripting_key)
140
140
  except BaseException as e:
141
141
  msg = f"{e.description} " if isinstance(e, BadRequest) else ""
chellow/e/views.py CHANGED
@@ -1569,7 +1569,6 @@ def era_edit_form_get(era_id):
1569
1569
  try:
1570
1570
  era = Era.get_by_id(g.sess, era_id)
1571
1571
  ct_now = ct_datetime_now()
1572
- cops = g.sess.scalars(select(Cop).order_by(Cop.code))
1573
1572
  comms = g.sess.scalars(select(Comm).order_by(Comm.code))
1574
1573
  energisation_statuses = g.sess.scalars(
1575
1574
  select(EnergisationStatus).order_by(EnergisationStatus.code)
@@ -1781,6 +1780,11 @@ def era_edit_form_get(era_id):
1781
1780
  else:
1782
1781
  mtc_participant = None
1783
1782
 
1783
+ if mtc_participant is None:
1784
+ cops = g.sess.scalars(select(Cop).order_by(Cop.code))
1785
+ else:
1786
+ cops = Cop.get_valid(g.sess, mtc_participant.meter_type)
1787
+
1784
1788
  if pc.code == "00":
1785
1789
  imp_llfcs_q = (
1786
1790
  select(Llfc)
chellow/models.py CHANGED
@@ -510,6 +510,17 @@ class Cop(Base, PersistentClass):
510
510
  raise BadRequest(f"The CoP with code {code} can't be found.")
511
511
  return typ
512
512
 
513
+ @staticmethod
514
+ def get_valid(sess, meter_type):
515
+
516
+ if meter_type.code == "C5":
517
+ q = select(Cop).where(Cop.code.in_(["1", "2", "3", "4", "5"]))
518
+ elif meter_type.code in ["6A", "6B", "6C", "6D"]:
519
+ q = select(Cop).where(Cop.code == meter_type.code.lower())
520
+ else:
521
+ q = select(Cop)
522
+ return sess.scalars(q.order_by(Cop.code))
523
+
513
524
  __tablename__ = "cop"
514
525
  id = Column(Integer, primary_key=True)
515
526
  code = Column(String, unique=True, nullable=False)
@@ -3700,12 +3711,9 @@ class Era(Base, PersistentClass):
3700
3711
  f"{hh_format(finish_date)}."
3701
3712
  )
3702
3713
 
3703
- if (
3704
- self.mtc_participant.meter_type.code == "C5"
3705
- and cop.code not in ["1", "2", "3", "4", "5"]
3706
- or self.mtc_participant.meter_type.code in ["6A", "6B", "6C", "6D"]
3707
- and cop.code.upper() != self.mtc_participant.meter_type.code
3708
- ):
3714
+ if cop.code not in [
3715
+ c.code for c in Cop.get_valid(sess, self.mtc_participant.meter_type)
3716
+ ]:
3709
3717
  raise BadRequest(
3710
3718
  f"The CoP of {cop.code} is not compatible with the meter type code "
3711
3719
  f"of {self.mtc_participant.meter_type.code}."
@@ -6809,9 +6817,9 @@ def db_init(sess, root_path):
6809
6817
  GContract.insert_industry(sess, name, "", props, last_month_start, None, rs)
6810
6818
 
6811
6819
  sess.execute(
6812
- text(f"alter database {db_name} set default_transaction_deferrable = on")
6820
+ text(f'alter database "{db_name}" set default_transaction_deferrable = on')
6813
6821
  )
6814
- sess.execute(text(f"alter database {db_name} SET DateStyle TO 'ISO, YMD'"))
6822
+ sess.execute(text(f"""alter database "{db_name}" SET DateStyle TO 'ISO, YMD'"""))
6815
6823
  sess.commit()
6816
6824
  sess.close()
6817
6825
  engine.dispose()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1711032714.0.0
3
+ Version: 1712838153.0.0
4
4
  Summary: Web Application for checking UK energy bills.
5
5
  Project-URL: Homepage, https://github.com/WessexWater/chellow
6
6
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -12,7 +12,7 @@ Requires-Dist: flask==2.3.3
12
12
  Requires-Dist: odio==0.0.22
13
13
  Requires-Dist: openpyxl==3.1.2
14
14
  Requires-Dist: pep3143daemon==0.0.6
15
- Requires-Dist: pg8000==1.30.5
15
+ Requires-Dist: pg8000==1.31.1
16
16
  Requires-Dist: pip>=9.0.1
17
17
  Requires-Dist: psutil==5.9.5
18
18
  Requires-Dist: pympler==1.0.1
@@ -5,7 +5,7 @@ chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
5
  chellow/dloads.py,sha256=5SmP-0QPK6xCkd_wjIWh_8FAzN5OxNHCzyEQ1Xb-Y-M,5256
6
6
  chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
7
7
  chellow/general_import.py,sha256=4LduwzNipxOiHYHQLb0x96_m3RPuDnQMbJzOFDbOqTg,65039
8
- chellow/models.py,sha256=5ZWG1IexWNfwdq_ZlAjTyl0BlG2w682ydF09pEl31CY,237109
8
+ chellow/models.py,sha256=9SDx150OdxFnw4tfpvLn2fB0NsqlrE57VqdRPYz9OnE,237335
9
9
  chellow/national_grid.py,sha256=uxcv0qisHPyzw9AVIYPzsRqwt2XPAcZL-SBR12qcrS0,4364
10
10
  chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
11
11
  chellow/rate_server.py,sha256=vNuKzlr0lkAzZ4zG7zboStoo92_6iLKAxbw1yZ-ucII,5626
@@ -22,7 +22,7 @@ chellow/e/cfd.py,sha256=V1DTT5XBQbt8hO1gae1u3315fZ4iuYk3XC7J2sUbhKQ,14352
22
22
  chellow/e/computer.py,sha256=YL1JFUYfFW-i9DODfvSnp6gTL_MwIfwoWj1TWtOsxPg,67105
23
23
  chellow/e/dno_rate_parser.py,sha256=5MYEbcYngh7n6Szn2h9zLTwQKXH-WHKy6c80PYwNLLQ,20983
24
24
  chellow/e/duos.py,sha256=ISTcNqe9KNjVNM2Qs8IBoQxnmSXOt5W_G7tZxp4T78M,28870
25
- chellow/e/elexon.py,sha256=s8QdLUQMeylLhghxvvhLyOL3-0ifUnMfmo3vcbot_DY,5487
25
+ chellow/e/elexon.py,sha256=ALhXS9Es7PV0z9ukPbIramn3cf3iLyFi-PMWPSm5iOs,5487
26
26
  chellow/e/energy_management.py,sha256=aXC2qlGt3FAODlNl_frWzVYAQrJLP8FFOiNX3m-QE_Y,12388
27
27
  chellow/e/hh_importer.py,sha256=nhmlWDNBm8U4salBud8ivdaDGF1lkY82NqQCrGuPYRI,20483
28
28
  chellow/e/hh_parser_bg_csv.py,sha256=W5SU2MSpa8BGA0VJw1JXF-IwbCNLFy8fe35yxLZ7gEw,2453
@@ -38,7 +38,7 @@ chellow/e/system_price.py,sha256=3cPWohHmmBI9v7fENLBzXQkpAeC3r0s5xV29Nmr6k_E,583
38
38
  chellow/e/tlms.py,sha256=kHAy2A2d1Mma7x4GdNDyrzscJd5DpJtDBYiZEg241Dw,8538
39
39
  chellow/e/tnuos.py,sha256=KoMPJDIXfE4zwhSDuywGF1ooxjTYLVjtF7BkSFm6X24,4158
40
40
  chellow/e/triad.py,sha256=S6LEMHvUKhAZe0-yfLIRciYDZ8IKMn1jh1TmmsbQD3s,13588
41
- chellow/e/views.py,sha256=aZecpfM1sVn3xMwlKuiw9pE2f6s4uyd98obQXToKtqA,212466
41
+ chellow/e/views.py,sha256=p-zQa24HtNVLTHILqfiZ8UrixuljHSC163SrJuLQ3Ik,212590
42
42
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
44
44
  chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
@@ -361,6 +361,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
361
361
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
362
362
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
363
363
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
364
- chellow-1711032714.0.0.dist-info/METADATA,sha256=a9YFyBU_CMj0Zl39q_J8IwXQcQDRiNh70Yy8jR0QjEQ,12203
365
- chellow-1711032714.0.0.dist-info/WHEEL,sha256=bq9SyP5NxIRA9EpQgMCd-9RmPHWvbH-4lTDGwxgIR64,87
366
- chellow-1711032714.0.0.dist-info/RECORD,,
364
+ chellow-1712838153.0.0.dist-info/METADATA,sha256=Xtd86NDSwOVRdtBadWm_V5D9VIJ2WCa2T17MD_rBvG0,12203
365
+ chellow-1712838153.0.0.dist-info/WHEEL,sha256=as-1oFTWSeWBgyzh0O_qF439xqBe6AbBgt4MfYe5zwY,87
366
+ chellow-1712838153.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.22.3
2
+ Generator: hatchling 1.22.5
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any