Niv Sardi commited on
Commit
b6ba314
1 Parent(s): 1f73e71

for some reason colab doesn't like NamedTuple

Browse files

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>

Files changed (2) hide show
  1. python/entity.py +1 -5
  2. python/write_data.py +1 -1
python/entity.py CHANGED
@@ -4,14 +4,10 @@ from typing import NamedTuple
4
 
5
  from common import defaults
6
 
7
- def update(d, i):
8
- d.update(i)
9
- return d
10
-
11
  def read_entities(fn = defaults.MAIN_CSV_PATH):
12
  with open(fn, newline='') as csvfile:
13
  reader = csv.DictReader(csvfile)
14
- bcos = { d['bco']:update(d, {'id': i}) for i, d in enumerate(reader)}
15
  return bcos
16
 
17
  class Entity(NamedTuple):
 
4
 
5
  from common import defaults
6
 
 
 
 
 
7
  def read_entities(fn = defaults.MAIN_CSV_PATH):
8
  with open(fn, newline='') as csvfile:
9
  reader = csv.DictReader(csvfile)
10
+ bcos = { d['bco']:d for d in reader}
11
  return bcos
12
 
13
  class Entity(NamedTuple):
python/write_data.py CHANGED
@@ -5,7 +5,7 @@ import argparse
5
  from common import defaults
6
 
7
  def gen_data_yaml(bcos):
8
- names = [f"{d.name}" for d in bcos.values()]
9
  return f'''
10
  train: ../data/squares
11
  val: ../data/squares
 
5
  from common import defaults
6
 
7
  def gen_data_yaml(bcos):
8
+ names = [f"{d['name']}" for d in bcos.values()]
9
  return f'''
10
  train: ../data/squares
11
  val: ../data/squares