chellow 1733390302.0.0__py3-none-any.whl → 1733501869.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.

Files changed (46) hide show
  1. chellow/__init__.py +0 -1
  2. chellow/e/bill_parsers/mm.py +27 -5
  3. chellow/e/computer.py +1 -7
  4. chellow/e/views.py +4 -10
  5. chellow/gas/engine.py +1 -3
  6. chellow/gas/views.py +3 -2
  7. chellow/reports/report_109.py +2 -3
  8. chellow/reports/report_111.py +2 -3
  9. chellow/reports/report_169.py +2 -3
  10. chellow/reports/report_181.py +2 -3
  11. chellow/reports/report_183.py +3 -4
  12. chellow/reports/report_187.py +2 -3
  13. chellow/reports/report_219.py +2 -3
  14. chellow/reports/report_231.py +2 -3
  15. chellow/reports/report_233.py +2 -3
  16. chellow/reports/report_241.py +2 -3
  17. chellow/reports/report_247.py +2 -3
  18. chellow/reports/report_29.py +2 -3
  19. chellow/reports/report_291.py +2 -3
  20. chellow/reports/report_33.py +2 -3
  21. chellow/reports/report_387.py +2 -3
  22. chellow/reports/report_41.py +2 -3
  23. chellow/reports/report_429.py +2 -3
  24. chellow/reports/report_59.py +2 -3
  25. chellow/reports/report_81.py +2 -3
  26. chellow/reports/report_87.py +3 -7
  27. chellow/reports/report_asset_comparison.py +2 -3
  28. chellow/reports/report_batches.py +2 -3
  29. chellow/reports/report_bills.py +4 -3
  30. chellow/reports/report_csv_llfcs.py +2 -3
  31. chellow/reports/report_csv_site_hh_data.py +2 -3
  32. chellow/reports/report_csv_site_snags.py +2 -3
  33. chellow/reports/report_ecoes_comparison.py +2 -3
  34. chellow/reports/report_g_monthly_duration.py +2 -3
  35. chellow/reports/report_g_supplies_snapshot.py +2 -3
  36. chellow/reports/report_g_supply_virtual_bill.py +2 -3
  37. chellow/reports/report_g_virtual_bills.py +2 -3
  38. chellow/reports/report_g_virtual_bills_hh.py +2 -3
  39. chellow/reports/report_sscs.py +2 -3
  40. chellow/reports/report_supply_contacts.py +2 -3
  41. chellow/templates/e/dc_contract_properties_edit.html +10 -10
  42. chellow/utils.py +0 -2
  43. chellow/views.py +33 -48
  44. {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/METADATA +1 -1
  45. {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/RECORD +46 -46
  46. {chellow-1733390302.0.0.dist-info → chellow-1733501869.0.0.dist-info}/WHEEL +0 -0
@@ -2,7 +2,7 @@ import csv
2
2
  import threading
3
3
  import traceback
4
4
 
5
- from flask import g
5
+ from flask import g, redirect
6
6
 
7
7
  from sqlalchemy import or_, select
8
8
  from sqlalchemy.sql.expression import null, true
@@ -32,7 +32,6 @@ from chellow.utils import (
32
32
  req_int,
33
33
  to_ct,
34
34
  )
35
- from chellow.views import chellow_redirect
36
35
 
37
36
 
38
37
  def _process_era(
@@ -202,10 +201,7 @@ def create_csv(f, sess, start_date, finish_date, contract_id):
202
201
  )
203
202
  writer.writerow(csv_make_val(vals.get(t)) for t in titles)
204
203
  except BadRequest as e:
205
- raise BadRequest(
206
- f"Problem with {chellow.utils.url_root}eras/{era.id}/edit "
207
- f"{e.description}"
208
- )
204
+ raise BadRequest(f"Problem with /e/eras/{era.id}/edit {e.description}")
209
205
 
210
206
  sess.rollback() # Avoid long-running transaction
211
207
 
@@ -243,4 +239,4 @@ def do_get(sess):
243
239
  threading.Thread(
244
240
  target=content, args=(start_date, finish_date, contract_id, g.user.id)
245
241
  ).start()
246
- return chellow_redirect("/downloads", 303)
242
+ return redirect("/downloads", 303)
@@ -4,7 +4,7 @@ import threading
4
4
  import traceback
5
5
  from io import StringIO
6
6
 
7
- from flask import g, request
7
+ from flask import g, redirect, request
8
8
 
9
9
  from sqlalchemy import select
10
10
  from sqlalchemy.orm import joinedload
@@ -14,7 +14,6 @@ from werkzeug.exceptions import BadRequest
14
14
 
15
15
  from chellow.dloads import open_file
16
16
  from chellow.models import Contract, Era, ReportRun, Session, Site, SiteEra, User
17
- from chellow.views import chellow_redirect
18
17
 
19
18
  STATUSES_ACTIVE = ("IN USE / IN SERVICE", "STORED SPARE")
20
19
  STATUSES_INACTIVE = ("DEMOLISHED", "SOLD", "ABANDONED")
@@ -194,4 +193,4 @@ def do_post(sess):
194
193
  sess.commit()
195
194
  args = user.id, StringIO(file_item.read().decode("utf8")), report_run.id
196
195
  threading.Thread(target=content, args=args).start()
197
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
196
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -2,7 +2,7 @@ import csv
2
2
  import threading
3
3
  import traceback
4
4
 
5
- from flask import g
5
+ from flask import g, redirect
6
6
 
7
7
  from sqlalchemy.sql import func, select
8
8
 
@@ -16,7 +16,6 @@ from chellow.models import (
16
16
  User,
17
17
  )
18
18
  from chellow.utils import csv_make_val
19
- from chellow.views import chellow_redirect
20
19
 
21
20
 
22
21
  def content(user_id):
@@ -142,4 +141,4 @@ def content(user_id):
142
141
 
143
142
  def do_get(sess):
144
143
  threading.Thread(target=content, args=(g.user.id,)).start()
145
- return chellow_redirect("/downloads", 303)
144
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
  from collections import defaultdict
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  from sqlalchemy import select
9
9
  from sqlalchemy.orm import joinedload
@@ -11,7 +11,6 @@ from sqlalchemy.orm import joinedload
11
11
  from chellow.dloads import open_file
12
12
  from chellow.models import Batch, Bill, Session, User
13
13
  from chellow.utils import csv_make_val, req_int
14
- from chellow.views import chellow_redirect
15
14
 
16
15
 
17
16
  def _content(sess, writer, batch_id):
@@ -36,6 +35,7 @@ def _content(sess, writer, batch_id):
36
35
  "vat_2_percent",
37
36
  "vat_2_net",
38
37
  "vat_2_vat",
38
+ "breakdown",
39
39
  ]
40
40
  writer.writerow(titles)
41
41
 
@@ -79,6 +79,7 @@ def _content(sess, writer, batch_id):
79
79
  "vat_2_percent": None,
80
80
  "vat_2_net": None,
81
81
  "vat_2_vat": None,
82
+ "breakdown": bill.breakdown,
82
83
  }
83
84
  for i, (percentage, vbd) in enumerate(sorted(vat_breakdown.items()), 1):
84
85
  vals[f"vat_{i}_percentage"] = percentage
@@ -111,4 +112,4 @@ def do_get(sess):
111
112
  batch_id = req_int("batch_id")
112
113
  args = g.user.id, batch_id
113
114
  threading.Thread(target=content, args=args).start()
114
- return chellow_redirect("/downloads", 303)
115
+ return redirect("/downloads", 303)
@@ -2,14 +2,13 @@ import csv
2
2
  import threading
3
3
  import traceback
4
4
 
5
- from flask import g
5
+ from flask import g, redirect
6
6
 
7
7
  from sqlalchemy.orm import joinedload
8
8
 
9
9
  from chellow.dloads import open_file
10
10
  from chellow.models import Llfc, Session, User
11
11
  from chellow.utils import hh_format
12
- from chellow.views import chellow_redirect
13
12
 
14
13
 
15
14
  def content(user_id):
@@ -64,4 +63,4 @@ def content(user_id):
64
63
  def do_get(sess):
65
64
  args = (g.user.id,)
66
65
  threading.Thread(target=content, args=args).start()
67
- return chellow_redirect("/downloads", 303)
66
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  from sqlalchemy import null, or_, select, true
9
9
  from sqlalchemy.orm import joinedload
@@ -11,7 +11,6 @@ from sqlalchemy.orm import joinedload
11
11
  from chellow.dloads import open_file
12
12
  from chellow.models import Era, Session, Site, SiteEra, Source, Supply, User
13
13
  from chellow.utils import req_date, req_int, write_row
14
- from chellow.views import chellow_redirect
15
14
 
16
15
 
17
16
  TYPE_ORDER = {"hh": 0, "amr": 1, "nhh": 2, "unmetered": 3}
@@ -122,4 +121,4 @@ def do_get(sess):
122
121
 
123
122
  args = start_date, finish_date, site_id, g.user.id
124
123
  threading.Thread(target=content, args=args).start()
125
- return chellow_redirect("/downloads", 303)
124
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
  from datetime import datetime as Datetime, timedelta as Timedelta
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  import pytz
9
9
 
@@ -13,7 +13,6 @@ from sqlalchemy.sql.expression import null
13
13
  from chellow.dloads import open_file
14
14
  from chellow.models import Session, Site, Snag, User
15
15
  from chellow.utils import hh_format
16
- from chellow.views import chellow_redirect
17
16
 
18
17
 
19
18
  def content(user_id):
@@ -81,4 +80,4 @@ def content(user_id):
81
80
  def do_get(sess):
82
81
  args = (g.user.id,)
83
82
  threading.Thread(target=content, args=args).start()
84
- return chellow_redirect("/downloads", 303)
83
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  import requests
9
9
 
@@ -26,7 +26,6 @@ from chellow.models import (
26
26
  User,
27
27
  )
28
28
  from chellow.utils import csv_make_val, req_bool
29
- from chellow.views import chellow_redirect
30
29
 
31
30
 
32
31
  FNAME = "ecoes_comparison"
@@ -615,4 +614,4 @@ def do_get(sess):
615
614
  sess.commit()
616
615
  args = g.user.id, show_ignored, report_run.id
617
616
  threading.Thread(target=content, args=args).start()
618
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
617
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -1,7 +1,7 @@
1
1
  import threading
2
2
  import traceback
3
3
 
4
- from flask import g, request
4
+ from flask import g, redirect, request
5
5
 
6
6
  import odio
7
7
 
@@ -42,7 +42,6 @@ from chellow.utils import (
42
42
  to_utc,
43
43
  utc_datetime_now,
44
44
  )
45
- from chellow.views import chellow_redirect
46
45
 
47
46
 
48
47
  def write_spreadsheet(fl, compressed, site_rows, era_rows):
@@ -535,4 +534,4 @@ def do_get(sess):
535
534
  args = scenario_props, g.user.id, compression, now, base_name
536
535
 
537
536
  threading.Thread(target=content, args=args).start()
538
- return chellow_redirect("/downloads", 303)
537
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  from sqlalchemy import or_
9
9
  from sqlalchemy.orm import joinedload
@@ -16,7 +16,6 @@ from chellow.e.computer import contract_func
16
16
  from chellow.gas.engine import GDataSource, forecast_date
17
17
  from chellow.models import GEra, GSupply, Session
18
18
  from chellow.utils import csv_make_val, req_date, req_int
19
- from chellow.views import chellow_redirect
20
19
 
21
20
 
22
21
  def content(date, g_supply_id, user):
@@ -136,4 +135,4 @@ def do_get(session):
136
135
 
137
136
  args = (date, g_supply_id, user)
138
137
  threading.Thread(target=content, args=args).start()
139
- return chellow_redirect("/downloads", 303)
138
+ return redirect("/downloads", 303)
@@ -2,7 +2,7 @@ import csv
2
2
  import threading
3
3
  import traceback
4
4
 
5
- from flask import g
5
+ from flask import g, redirect
6
6
 
7
7
  from sqlalchemy import or_
8
8
  from sqlalchemy.sql.expression import null, true
@@ -14,7 +14,6 @@ from chellow.e.computer import forecast_date
14
14
  from chellow.gas.engine import GDataSource, g_contract_func
15
15
  from chellow.models import GEra, GSupply, Session, Site, SiteGEra
16
16
  from chellow.utils import csv_make_val, hh_format, hh_max, hh_min, req_date, req_int
17
- from chellow.views import chellow_redirect
18
17
 
19
18
 
20
19
  def content(g_supply_id, file_name, start_date, finish_date, user):
@@ -107,4 +106,4 @@ def do_get(sess):
107
106
  args = (g_supply_id, file_name, start_date, finish_date, g.user)
108
107
 
109
108
  threading.Thread(target=content, args=args).start()
110
- return chellow_redirect("/downloads", 303)
109
+ return redirect("/downloads", 303)
@@ -4,7 +4,7 @@ import threading
4
4
  import traceback
5
5
 
6
6
 
7
- from flask import g
7
+ from flask import g, redirect
8
8
 
9
9
  from sqlalchemy import or_
10
10
  from sqlalchemy.sql.expression import null, true
@@ -25,7 +25,6 @@ from chellow.utils import (
25
25
  req_int,
26
26
  to_ct,
27
27
  )
28
- from chellow.views import chellow_redirect
29
28
 
30
29
 
31
30
  def content(start_date, finish_date, g_contract_id, user_id):
@@ -137,4 +136,4 @@ def do_get(sess):
137
136
 
138
137
  args = start_date, finish_date, g_contract_id, g.user.id
139
138
  threading.Thread(target=content, args=args).start()
140
- return chellow_redirect("/downloads", 303)
139
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  from sqlalchemy import or_
9
9
  from sqlalchemy.sql.expression import null, true
@@ -14,7 +14,6 @@ from chellow.e.computer import contract_func
14
14
  from chellow.gas.engine import GDataSource
15
15
  from chellow.models import GEra, GSupply, Session, Site, SiteGEra
16
16
  from chellow.utils import csv_make_val, hh_format, hh_range, req_date, req_int
17
- from chellow.views import chellow_redirect
18
17
 
19
18
 
20
19
  def content(g_supply_id, start_date, finish_date, user):
@@ -105,4 +104,4 @@ def do_get(sess):
105
104
 
106
105
  args = g_supply_id, start_date, finish_date, g.user
107
106
  threading.Thread(target=content, args=args).start()
108
- return chellow_redirect("/downloads", 303)
107
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import threading
3
3
  import traceback
4
4
 
5
5
 
6
- from flask import g, request
6
+ from flask import g, redirect, request
7
7
 
8
8
  import odio
9
9
 
@@ -15,7 +15,6 @@ from werkzeug.exceptions import BadRequest
15
15
  from chellow.dloads import open_file
16
16
  from chellow.models import MeasurementRequirement, Session, Ssc, Tpr, User
17
17
  from chellow.utils import req_bool
18
- from chellow.views import chellow_redirect
19
18
 
20
19
 
21
20
  def write_spreadsheet(
@@ -114,4 +113,4 @@ def do_get(sess):
114
113
 
115
114
  args = (user.id, compression)
116
115
  threading.Thread(target=content, args=args).start()
117
- return chellow_redirect("/downloads", 303)
116
+ return redirect("/downloads", 303)
@@ -3,7 +3,7 @@ import sys
3
3
  import threading
4
4
  import traceback
5
5
 
6
- from flask import g
6
+ from flask import g, redirect
7
7
 
8
8
  from sqlalchemy import select
9
9
  from sqlalchemy.orm import joinedload
@@ -21,7 +21,6 @@ from chellow.models import (
21
21
  Supply,
22
22
  User,
23
23
  )
24
- from chellow.views import chellow_redirect
25
24
 
26
25
 
27
26
  FNAME = "supply_contacts"
@@ -127,4 +126,4 @@ def do_get(sess):
127
126
  report_run = ReportRun.insert(sess, FNAME, g.user, FNAME, {})
128
127
  sess.commit()
129
128
  threading.Thread(target=content, args=(g.user.id, report_run.id)).start()
130
- return chellow_redirect(f"/report_runs/{report_run.id}", 303)
129
+ return redirect(f"/report_runs/{report_run.id}", 303)
@@ -39,17 +39,17 @@
39
39
  "private_key": "private_key", /* Remove if using password */
40
40
  "directories": ["downloads1", "downloads2"],
41
41
  "mpan_map": { /* Optional */
42
- "99 0993 2821 985": {
43
- "mpan": null, /* Ignore MPAN */
44
- "from": 2024-12-04T10:00:00Z,
42
+ "99 0993 2821 985": {
43
+ "mpan": null, /* Ignore MPAN */
44
+ "from": 2024-12-04T10:00:00Z,
45
45
  "to": 2025-01-12:00:00Z,
46
- },
47
- "99 0873 1942 952": {
48
- "mpan": "99 7821 8541 389",
49
- "from": 2024-11-16T22:00:00Z,
50
- "to": 2025-02-18:00:00Z,
51
- },
52
- },
46
+ },
47
+ "99 0873 1942 952": {
48
+ "mpan": "99 7821 8541 389",
49
+ "from": 2024-11-16T22:00:00Z,
50
+ "to": 2025-02-18:00:00Z,
51
+ },
52
+ },
53
53
  }
54
54
  </pre>
55
55
  </code>
chellow/utils.py CHANGED
@@ -17,8 +17,6 @@ from werkzeug.exceptions import BadRequest
17
17
 
18
18
  from zish import ZishException, loads
19
19
 
20
- url_root = ""
21
-
22
20
  HH = relativedelta(minutes=30)
23
21
  MONTH = relativedelta(months=1)
24
22
  YEAR = relativedelta(years=1)