Skip to content

Commit

Permalink
Drop py35 syntax
Browse files Browse the repository at this point in the history
Another weekend, another half day lost trying to get some combination
of RTD, autodoc, and conda to play nicely.  This one was really close,
but something just **really** didn't want to let me have that sweet
theme css.

Magic overrides I guess?  readthedocs/sphinx_rtd_theme#117 says I need
to use !important so that's cool too.
  • Loading branch information
numberoverzero committed Nov 7, 2016
1 parent b147e2a commit 4720729
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 35 deletions.
8 changes: 4 additions & 4 deletions bloop/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,10 @@ def __and__(self, other):
return other
# (a & b) & (c & d) -> (a & b & c & d)
elif self.operation == other.operation == "and":
return AndCondition(*self.values, *other.values)
return AndCondition(*(self.values + other.values))
# (a & b) & (c > 2) -> (a & b & (c > 2))
elif self.operation == "and":
return AndCondition(*self.values, other)
return AndCondition(*(self.values + [other]))
# (a > 2) & (b & c) -> ((a > 2) & b & c)
elif other.operation == "and":
return AndCondition(self, *other.values)
Expand Down Expand Up @@ -484,10 +484,10 @@ def __or__(self, other):
return other
# (a | b) | (c | d) -> (a | b | c | d)
elif self.operation == other.operation == "or":
return OrCondition(*self.values, *other.values)
return OrCondition(*(self.values + other.values))
# (a | b) | (c > 2) -> (a | b | (c > 2))
elif self.operation == "or":
return OrCondition(*self.values, other)
return OrCondition(*(self.values + [other]))
# (a > 2) | (b | c) -> ((a > 2) | b | c)
elif other.operation == "or":
return OrCondition(self, *other.values)
Expand Down
16 changes: 9 additions & 7 deletions bloop/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,12 @@ def delete(self, *objs, condition=None, atomic=False):
objs = set(objs)
validate_not_abstract(*objs)
for obj in objs:
self.session.delete_item({
item = {
"TableName": obj.Meta.table_name,
"Key": dump_key(self, obj),
**render(self, obj=obj, atomic=atomic, condition=condition)
})
"Key": dump_key(self, obj)
}
item.update(render(self, obj=obj, atomic=atomic, condition=condition))
self.session.delete_item(item)
object_deleted.send(self, engine=self, obj=obj)

def load(self, *objs, consistent=False):
Expand Down Expand Up @@ -247,11 +248,12 @@ def save(self, *objs, condition=None, atomic=False):
objs = set(objs)
validate_not_abstract(*objs)
for obj in objs:
self.session.save_item({
item = {
"TableName": obj.Meta.table_name,
"Key": dump_key(self, obj),
**render(self, obj=obj, atomic=atomic, condition=condition, update=True)
})
}
item.update(render(self, obj=obj, atomic=atomic, condition=condition, update=True))
self.session.save_item(item)
object_saved.send(self, engine=self, obj=obj)

def scan(self, model_or_index, filter=None, projection="all", consistent=False, parallel=None):
Expand Down
15 changes: 9 additions & 6 deletions bloop/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
MAP = "M"
LIST = "L"

PRIMITIVES = {"S", "N", "B"}
SETS = {"SS", "NS", "BS"}
DOCUMENTS = {"L", "M"}
ALL = {*PRIMITIVES, *SETS, *DOCUMENTS, BOOLEAN}
PRIMITIVES = ["S", "N", "B"]
SETS = ["SS", "NS", "BS"]
DOCUMENTS = ["L", "M"]
# TODO | revert this commit when RTD gets 3.5 support, because getting conda to work with autodoc was
# TODO | atrocious. It's actually easier to go through and drop all the nice 3.5 syntax than lose
# TODO | another 4 hours fucking around with RTD's build settings and a bunch of .yml files.
ALL = PRIMITIVES + SETS + DOCUMENTS + [BOOLEAN]

# Dynamo takes numbers as strings to reduce inter-language problems
DYNAMODB_CONTEXT = decimal.Context(
Expand All @@ -36,9 +39,9 @@
">": PRIMITIVES,
"<=": PRIMITIVES,
">=": PRIMITIVES,
"begins_with": {STRING, BINARY},
"begins_with": [STRING, BINARY],
"between": PRIMITIVES,
"contains": {*SETS, STRING, BINARY, LIST},
"contains": SETS + [STRING, BINARY, LIST],
"in": ALL
}

Expand Down
File renamed without changes.
22 changes: 5 additions & 17 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import sys

import pkg_resources
import sphinx_rtd_theme


extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
Expand All @@ -12,15 +10,13 @@
]

templates_path = ['_templates']
source_suffix = '.rst'

master_doc = 'index'

project = 'bloop'
copyright = '2016, Joe Cross'
author = 'Joe Cross'


try:
release = pkg_resources.get_distribution('bloop').version
except pkg_resources.DistributionNotFound:
Expand All @@ -33,28 +29,16 @@
version = '.'.join(release.split('.')[:2])

language = 'en'

exclude_patterns = ['_build']

pygments_style = 'sphinx'

html_use_smartypants = False

html_static_path = ["_static"]
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_context = {
"css_files": ["_static/css/bloop.css"],
"favicon": "favicon-cog.ico",
"show_sphinx": False,

# Render docs source links correctly
"github_user": "numberoverzero",
"github_repo": "bloop",
"github_version": "HEAD",
"conf_py_path": "/docs/",
"source_suffix": ".rst"

"show_sphinx": False
}

intersphinx_mapping = {
Expand All @@ -64,3 +48,7 @@
'blinker': ('https://pythonhosted.org/blinker/', None),
'boto3': ('http://boto3.readthedocs.io/en/latest', None)
}


def setup(app):
app.add_stylesheet("bloop.css")
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
basepython=python35
basepython=python3.5
envlist = unit, integ, docs

[testenv:unit]
Expand Down

0 comments on commit 4720729

Please sign in to comment.