-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
431 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import repo_crawler | ||
from . import repo_database | ||
from . import repo_database | ||
from . import misc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.0.1' | ||
__version__ = '0.0.1' # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
import datetime | ||
|
||
def get_packages_from_crates(conn,limit=None): | ||
''' | ||
From a connection to a crates.io database, output the list of packages as expected by RepoCrawler.add_packages() | ||
package id, package name, created_at (datetime.datetime),repo_url | ||
''' | ||
|
||
cursor = conn.cursor() | ||
|
||
|
||
if limit is not None: | ||
if not isinstance(limit,int): | ||
raise ValueError('limit should be an integer, given {}'.format(limit)) | ||
else: | ||
limit_str = ' LIMIT {}'.format(limit) | ||
else: | ||
limit_str = '' | ||
|
||
|
||
cursor.execute(''' | ||
SELECT id,name,created_at,repository FROM crates {} | ||
;'''.format(limit_str)) | ||
|
||
|
||
|
||
return cursor.fetchall() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.