Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tesi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Aceti
Tesi
Commits
46653c89
Verified
Commit
46653c89
authored
2 years ago
by
Marco Aceti
Browse files
Options
Downloads
Patches
Plain Diff
Use isoformat instead of timestamp in train export
parent
9190d399
Branches
extractor
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#2720
passed
2 years ago
Stage: test
Stage: lint
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/train_extractor.py
+6
-4
6 additions, 4 deletions
src/train_extractor.py
with
6 additions
and
4 deletions
src/train_extractor.py
+
6
−
4
View file @
46653c89
...
@@ -5,6 +5,7 @@ import pickle
...
@@ -5,6 +5,7 @@ import pickle
from
datetime
import
date
,
datetime
,
timedelta
from
datetime
import
date
,
datetime
,
timedelta
from
pathlib
import
Path
from
pathlib
import
Path
from
src.const
import
TIMEZONE
from
src.scraper.train
import
Train
from
src.scraper.train
import
Train
from
src.scraper.train_stop
import
TrainStopTime
from
src.scraper.train_stop
import
TrainStopTime
from
src.utils
import
parse_input_format_output_args
from
src.utils
import
parse_input_format_output_args
...
@@ -36,6 +37,7 @@ def load_file(file: Path) -> dict[int, Train]:
...
@@ -36,6 +37,7 @@ def load_file(file: Path) -> dict[int, Train]:
year
=
dep_date
.
year
,
year
=
dep_date
.
year
,
month
=
dep_date
.
month
,
month
=
dep_date
.
month
,
day
=
dep_date
.
day
,
day
=
dep_date
.
day
,
tzinfo
=
TIMEZONE
,
)
)
if
dt
.
hour
<
4
:
if
dt
.
hour
<
4
:
...
@@ -119,17 +121,17 @@ def to_csv(data: dict[int, Train], output_file: Path) -> None:
...
@@ -119,17 +121,17 @@ def to_csv(data: dict[int, Train], output_file: Path) -> None:
stop
.
station
.
code
,
stop
.
station
.
code
,
stop
.
stop_type
.
value
,
stop
.
stop_type
.
value
,
stop
.
platform_actual
or
stop
.
platform_expected
,
stop
.
platform_actual
or
stop
.
platform_expected
,
stop
.
arrival
.
expected
.
timestamp
()
stop
.
arrival
.
expected
.
isoformat
()
if
stop
.
arrival
and
stop
.
arrival
.
expected
if
stop
.
arrival
and
stop
.
arrival
.
expected
else
None
,
else
None
,
stop
.
arrival
.
actual
.
timestamp
()
stop
.
arrival
.
actual
.
isoformat
()
if
stop
.
arrival
and
stop
.
arrival
.
actual
if
stop
.
arrival
and
stop
.
arrival
.
actual
else
None
,
else
None
,
stop
.
arrival
.
delay
()
if
stop
.
arrival
else
None
,
stop
.
arrival
.
delay
()
if
stop
.
arrival
else
None
,
stop
.
departure
.
expected
.
timestamp
()
stop
.
departure
.
expected
.
isoformat
()
if
stop
.
departure
and
stop
.
departure
.
expected
if
stop
.
departure
and
stop
.
departure
.
expected
else
None
,
else
None
,
stop
.
departure
.
actual
.
timestamp
()
stop
.
departure
.
actual
.
isoformat
()
if
stop
.
departure
and
stop
.
departure
.
actual
if
stop
.
departure
and
stop
.
departure
.
actual
else
None
,
else
None
,
stop
.
departure
.
delay
()
if
stop
.
departure
else
None
,
stop
.
departure
.
delay
()
if
stop
.
departure
else
None
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment