-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: setup.py
- Loading branch information
Showing
23 changed files
with
589 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: python | ||
python: | ||
- 2.6 | ||
- 2.7 | ||
- 3.2 | ||
- 3.3 | ||
- 3.4 | ||
- pypy | ||
env: | ||
- DJANGO=1.6.11 | ||
- DJANGO=1.7.7 | ||
- DJANGO=1.8.3 | ||
before_install: | ||
- export DJANGO_SETTINGS_MODULE=jet.tests.settings | ||
install: | ||
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install importlib; fi | ||
- pip install -q Django==$DJANGO --use-mirrors | ||
- pip install . --use-mirrors | ||
- pip install coveralls | ||
script: | ||
- coverage run --source=jet --omit=*/migrations/*,*/south_migrations/*,*/tests/* manage.py test jet | ||
after_success: | ||
- coverage report | ||
- coveralls | ||
matrix: | ||
exclude: | ||
- python: 2.6 | ||
env: DJANGO=1.6.11 | ||
- python: 2.6 | ||
env: DJANGO=1.7.7 | ||
- python: 2.6 | ||
env: DJANGO=1.8.3 |
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,6 +1,13 @@ | ||
Changelog | ||
========= | ||
|
||
0.0.6 | ||
----- | ||
|
||
* [Feature] Added initial unit tests | ||
* [Fixes] Compatibility fixes | ||
|
||
|
||
0.0.5 | ||
----- | ||
|
||
|
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.5' | ||
VERSION = '0.0.6' |
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
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import collections | ||
|
||
|
||
class OrderedSet(collections.MutableSet): | ||
def __init__(self, iterable=None): | ||
self.end = end = [] | ||
end += [None, end, end] # sentinel node for doubly linked list | ||
self.map = {} # key --> [key, prev, next] | ||
if iterable is not None: | ||
self |= iterable | ||
|
||
def __len__(self): | ||
return len(self.map) | ||
|
||
def __contains__(self, key): | ||
return key in self.map | ||
|
||
def add(self, key): | ||
if key not in self.map: | ||
end = self.end | ||
curr = end[1] | ||
curr[2] = end[1] = self.map[key] = [key, curr, end] | ||
|
||
def discard(self, key): | ||
if key in self.map: | ||
key, prev, next = self.map.pop(key) | ||
prev[2] = next | ||
next[1] = prev | ||
|
||
def __iter__(self): | ||
end = self.end | ||
curr = end[2] | ||
while curr is not end: | ||
yield curr[0] | ||
curr = curr[2] | ||
|
||
def __reversed__(self): | ||
end = self.end | ||
curr = end[1] | ||
while curr is not end: | ||
yield curr[0] | ||
curr = curr[1] | ||
|
||
def pop(self, last=True): | ||
if not self: | ||
raise KeyError('set is empty') | ||
key = self.end[1][0] if last else self.end[2][0] | ||
self.discard(key) | ||
return key | ||
|
||
def __repr__(self): | ||
if not self: | ||
return '%s()' % (self.__class__.__name__,) | ||
return '%s(%r)' % (self.__class__.__name__, list(self)) | ||
|
||
def __eq__(self, other): | ||
if isinstance(other, OrderedSet): | ||
return len(self) == len(other) and list(self) == list(other) | ||
return set(self) == set(other) | ||
|
||
|
||
if __name__ == '__main__': | ||
s = OrderedSet('abracadaba') | ||
t = OrderedSet('simsalabim') | ||
print(s | t) | ||
print(s & t) | ||
print(s - t) |
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
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 was deleted.
Oops, something went wrong.
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,3 @@ | ||
from jet.tests.test_dashboard import DashboardTestCase | ||
from jet.tests.test_utils import UtilsTestCase | ||
from jet.tests.test_views import ViewsTestCase |
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,33 @@ | ||
from jet import modules | ||
from jet.dashboard import Dashboard | ||
|
||
|
||
class TestIndexDashboard(Dashboard): | ||
columns = 3 | ||
init_with_context_called = False | ||
|
||
class Media: | ||
js = ('file.js', 'file2.js') | ||
css = ('file.css', 'file2.css') | ||
|
||
def init_with_context(self, context): | ||
self.init_with_context_called = True | ||
self.available_children.append(modules.LinkList) | ||
self.available_children.append(modules.Feed) | ||
|
||
# append a recent actions module | ||
self.children.append(modules.RecentActions( | ||
'Recent Actions', | ||
10, | ||
column=0, | ||
order=1 | ||
)) | ||
|
||
# append a feed module | ||
self.children.append(modules.Feed( | ||
'Latest Django News', | ||
feed_url='http://www.djangoproject.com/rss/weblog/', | ||
limit=5, | ||
column=1, | ||
order=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,11 @@ | ||
from django.db import models | ||
from django.utils.encoding import python_2_unicode_compatible | ||
|
||
|
||
@python_2_unicode_compatible | ||
class TestModel(models.Model): | ||
field1 = models.CharField(max_length=255) | ||
field2 = models.IntegerField() | ||
|
||
def __str__(self): | ||
return '%s%d' % (self.field1, self.field2) |
Oops, something went wrong.