-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.py
More file actions
30 lines (25 loc) · 694 Bytes
/
utils.py
File metadata and controls
30 lines (25 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2016 Peng Liu <myme5261314@gmail.com>
#
# Distributed under terms of the gplv3 license.
"""
Some utility functions.
"""
from company import Company
def get_largest_duns_stored(session):
"""
this function returns the largest valid duns stored in the database.
"""
result = session.query(Company).order_by(Company.duns_id.desc())
if result.count() == 0:
return -1
else:
return result.one().duns_id
def get_next_duns(start=int(1e9)):
if start == -1:
start = int(1e9)
# for num in range(start, int(1e10)):
for num in range(start, int(start+1000000)):
yield num