chellow 1707314900.0.0__py3-none-any.whl → 1707388338.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/dloads.py CHANGED
@@ -48,9 +48,13 @@ class DloadFile:
48
48
  if not self.running_name.exists():
49
49
  raise BadRequest("Output file has been deleted.")
50
50
 
51
+ def flush(self, *args, **kwargs):
52
+ self._check_exists()
53
+ return self.f.flush(*args, **kwargs)
54
+
51
55
  def write(self, *args, **kwargs):
52
56
  self._check_exists()
53
- self.f.write(*args, **kwargs)
57
+ return self.f.write(*args, **kwargs)
54
58
 
55
59
  def seek(self, *args, **kwargs):
56
60
  self._check_exists()
@@ -72,7 +76,7 @@ class DloadFile:
72
76
  self.close()
73
77
 
74
78
 
75
- def make_names(base, user):
79
+ def open_file(base, user, mode="r", newline=None, is_zip=False):
76
80
  global download_id
77
81
 
78
82
  base = base.replace("/", "").replace(" ", "")
@@ -95,11 +99,7 @@ def make_names(base, user):
95
99
  uname = un.replace("@", "").replace(".", "").replace("\\", "")
96
100
 
97
101
  names = tuple("_".join((serial, v, uname, base)) for v in ("RUNNING", "FINISHED"))
98
- return tuple(download_path / name for name in names)
99
-
100
-
101
- def open_file(base, user, mode="r", newline=None, is_zip=False):
102
- running_name, finished_name = make_names(base, user)
102
+ running_name, finished_name = tuple(download_path / name for name in names)
103
103
  return DloadFile(running_name, finished_name, mode, newline, is_zip)
104
104
 
105
105
 
@@ -1,4 +1,3 @@
1
- import os
2
1
  import sys
3
2
  import threading
4
3
  import traceback
@@ -14,7 +13,7 @@ from sqlalchemy.sql.expression import null
14
13
  from werkzeug.exceptions import BadRequest
15
14
 
16
15
  import chellow.e.computer
17
- from chellow.dloads import make_names, open_file
16
+ from chellow.dloads import open_file
18
17
  from chellow.e.computer import contract_func
19
18
  from chellow.gas.engine import GDataSource
20
19
  from chellow.models import (
@@ -203,8 +202,7 @@ def content(
203
202
  base_name.append(str(g_supply.id))
204
203
  sites = sites.filter(GEra.g_supply == g_supply)
205
204
 
206
- running_name, finished_name = make_names("_".join(base_name) + ".ods", user)
207
- rf = open(running_name, mode="wb")
205
+ rf = open_file("_".join(base_name) + ".ods", user, mode="wb")
208
206
  site_rows = []
209
207
  g_era_rows = []
210
208
 
@@ -345,7 +343,6 @@ def content(
345
343
  finally:
346
344
  try:
347
345
  rf.close()
348
- os.rename(running_name, finished_name)
349
346
  except BaseException:
350
347
  msg = traceback.format_exc()
351
348
  ef = open_file("error.txt", user, mode="w")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: chellow
3
- Version: 1707314900.0.0
3
+ Version: 1707388338.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)
@@ -2,7 +2,7 @@ chellow/__init__.py,sha256=_9hq4MlC2YB7kUh4iH9hwmx7BqMV6JeyvGVB8uWk8Cs,10127
2
2
  chellow/api.py,sha256=mk17TfweR76DPFC8lX2SArTjai6y6YshASxqO1w-_-s,11036
3
3
  chellow/bank_holidays.py,sha256=22EdNPvUQG_hFt82OKkeKzRFht78Urhu0Sc6Kpj-1wo,4488
4
4
  chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
5
- chellow/dloads.py,sha256=iNp8qcww8fRY57_Ctz0KTLkc1qcVTVhX6aoKh4_N1tg,5034
5
+ chellow/dloads.py,sha256=ce8EtOt5GeMczc0RWO8YaUv6cLt9MzIwXaeCsf_R7lw,5090
6
6
  chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
7
7
  chellow/general_import.py,sha256=4LduwzNipxOiHYHQLb0x96_m3RPuDnQMbJzOFDbOqTg,65039
8
8
  chellow/models.py,sha256=7EX1oRpIcVRsjpzIC4ROOr-zp1-C7kdoj3WSNp2AKr0,236400
@@ -95,7 +95,7 @@ chellow/reports/report_csv_llfcs.py,sha256=XbVGcTbjLSrJL7zdgqIPX_FvN4Pa_lUSMDtku
95
95
  chellow/reports/report_csv_site_hh_data.py,sha256=v6VKdPX0PcvOljVQvWtF977jmORktdTrnr4MykFGROE,4376
96
96
  chellow/reports/report_csv_site_snags.py,sha256=XrJmIW0G4SyhpMJFZw1rqLom84wzLVqid44EBS0UT9s,2747
97
97
  chellow/reports/report_ecoes_comparison.py,sha256=QT0bIA5YbCOU6eygep1sSS7B8wYua9EHZs_Jy5emaVE,21466
98
- chellow/reports/report_g_monthly_duration.py,sha256=balpjLEEF0b76GQBSUtCxUWKTr4CxAaUSHf66wXyxfE,12139
98
+ chellow/reports/report_g_monthly_duration.py,sha256=vI5FKAU8_oThjR5oflPZont7Z7sVAunr0qlMfJsaPJI,12004
99
99
  chellow/reports/report_g_supplies_snapshot.py,sha256=0M0x_0o0985Hu45gUJJJwzfx0DDOAuXBJ1UVUDbQ36g,4718
100
100
  chellow/reports/report_g_supply_virtual_bill.py,sha256=x_KtQ02dwgmXvAEUXJ1poK0BRwqxa-GcbJ5pddEina0,3694
101
101
  chellow/reports/report_g_virtual_bills.py,sha256=17jKVjSrvQ91qE924InSzdxSebLo_QkvR2M1ugnRglo,4604
@@ -363,6 +363,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
363
363
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
364
364
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
365
365
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
366
- chellow-1707314900.0.0.dist-info/METADATA,sha256=BPjOyNHRFVGZ3-l9jJ29kqnBk6ILZNbrm_SS215to88,12203
367
- chellow-1707314900.0.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
368
- chellow-1707314900.0.0.dist-info/RECORD,,
366
+ chellow-1707388338.0.0.dist-info/METADATA,sha256=AhyvitvJT46wtS3-60PA83X_l7kV0qbGN-jbpIcDBSk,12203
367
+ chellow-1707388338.0.0.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
368
+ chellow-1707388338.0.0.dist-info/RECORD,,