Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Louis
pypimonitor
Commits
30a48484
Commit
30a48484
authored
Mar 05, 2016
by
Louis
Browse files
If no package is asked, get 10 random packages among the 1000 top packages
parent
5a4f4089
Changes
2
Hide whitespace changes
Inline
Side-by-side
TODO
deleted
100644 → 0
View file @
5a4f4089
- if no pkg nor user: random 10 packages
pipstats/__init__.py
View file @
30a48484
...
...
@@ -6,6 +6,7 @@ import datetime
import
itertools
import
jinja2
import
pkg_resources
import
random
import
slumber
import
sys
import
urllib
...
...
@@ -20,7 +21,10 @@ _client = xmlrpclib.ServerProxy("http://pypi.python.org/pypi")
class
PackageList
:
def
__init__
(
self
,
user
=
None
,
pkg
=
None
):
self
.
packages
=
{}
for
name
in
sorted
(
self
.
_get_packages
(
user
,
pkg
)):
package_list
=
list
(
self
.
_get_packages
(
user
,
pkg
))
if
not
package_list
:
package_list
=
random
.
sample
([
package
for
package
,
_
in
_client
.
top_packages
(
1000
)],
10
)
for
name
in
sorted
(
package_list
):
try
:
self
.
packages
[
name
]
=
Package
(
name
)
except
ValueError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment