Exemple #1
0
 def __init__(self):
     from sirutalib import SirutaDatabase
     self.siruta = SirutaDatabase()
     self.county_code = {}
     for entry in self.siruta._data.values():
         if entry['type'] == 40:
             name = strip_prefix(entry['name'].title())
             self.county_code[name] = entry['siruta']
 def __init__(self):
     from sirutalib import SirutaDatabase
     self.siruta = SirutaDatabase()
     self.county_code = {}
     for entry in self.siruta._data.values():
         if entry['type'] == 40:
             name = strip_prefix(entry['name'].title())
             self.county_code[name] = entry['siruta']
Exemple #3
0
class SirutaLoader:
    def __init__(self):
        from sirutalib import SirutaDatabase
        self.siruta = SirutaDatabase()
        self.county_code = {}
        for entry in self.siruta._data.values():
            if entry['type'] == 40:
                name = strip_prefix(entry['name'].title())
                self.county_code[name] = entry['siruta']

    def walk_siruta(self, code):
        name = self.siruta.get_name(code, prefix=False)
        yield name.title()
        for thing in self.siruta.get_inf_codes(code):
            yield from self.walk_siruta(thing)

    def get_siruta_names(self, county_name):
        code = self.county_code[county_name]
        names = set(self.walk_siruta(code))
        return sorted(names)
class SirutaLoader:

    def __init__(self):
        from sirutalib import SirutaDatabase
        self.siruta = SirutaDatabase()
        self.county_code = {}
        for entry in self.siruta._data.values():
            if entry['type'] == 40:
                name = strip_prefix(entry['name'].title())
                self.county_code[name] = entry['siruta']

    def walk_siruta(self, code):
        name = self.siruta.get_name(code, prefix=False)
        yield name.title()
        for thing in self.siruta.get_inf_codes(code):
            yield from self.walk_siruta(thing)

    def get_siruta_names(self, county_name):
        code = self.county_code[county_name]
        names = set(self.walk_siruta(code))
        return sorted(names)