Skip to content

Commit b2239da

Browse files
author
Joohwan Oh
committed
Update script for travis, pep8 fixes
1 parent 48e8d02 commit b2239da

15 files changed

+104
-74
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ language: python
22
python:
33
- "2.7"
44
before_install:
5-
- "sh setup_arangodb_2.3.sh"
5+
- "sh setup_arangodb_2.4.sh"
66
install:
77
- "pip install ."
88
script: nosetests

arango/batch.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import re
21
import json
3-
import logging
42
import inspect
53
from urllib import urlencode
64

@@ -20,15 +18,14 @@ def execute_batch(self, requests):
2018
for content_id, request in enumerate(requests, start=1):
2119
try:
2220
func, args, kwargs = request
23-
argspec = inspect.getargspec(func)[0]
24-
except TypeError, ValueError:
21+
except (TypeError, ValueError):
2522
raise BatchInvalidError(
2623
"pos {}: malformed request".format(content_id)
2724
)
2825
if "_batch" not in inspect.getargspec(func)[0]:
2926
raise BatchInvalidError(
3027
"pos {}: ArangoDB method '{}' does not support "
31-
"batch execution".format(content_id , func.__name__)
28+
"batch execution".format(content_id, func.__name__)
3229
)
3330
kwargs["_batch"] = True
3431
res = func(*args, **kwargs)
@@ -40,7 +37,7 @@ def execute_batch(self, requests):
4037
res = self._api.post(
4138
"/_api/batch",
4239
headers={
43-
"Content-Type": "multipart/form-data; boundary=XXXsubpartXXX"
40+
"Content-Type": "multipart/form-data; boundary=XXXsubpartXXX"
4441
},
4542
data=data,
4643
)

arango/clients/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from abc import ABCMeta, abstractmethod
44

5-
from arango.response import ArangoResponse
6-
75

86
class BaseArangoClient(object):
97
"""Base ArangoDB HTTP client."""

arango/collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import json
44

5-
from arango.utils import camelify, uncamelify, filter_keys
5+
from arango.utils import camelify, uncamelify
66
from arango.exceptions import *
77
from arango.cursor import CursorFactory
88

arango/database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def execute_query(self, query, count=False, batch_size=None, ttl=None,
160160
:type batch_size: int
161161
:param ttl: time-to-live for the cursor (in seconds)
162162
:type ttl: int
163-
:param bind_vars: key/value list of bind parameters
164-
:type bind_vars: list
163+
:param bind_vars: key-value pairs of bind parameters
164+
:type bind_vars: dict
165165
:param full_count: whether or not to include count before last LIMIT
166166
:param max_plans: maximum number of plans the optimizer generates
167167
:type max_plans: None or int

arango/method.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
# TODO Future implementation to replace the hacky _batch arguments
34
class ArangoRequest(object):
45

@@ -16,10 +17,10 @@ def javascript(self, *args, **kwargs):
1617

1718
def __call__(self, *args, **kwargs):
1819
request = self.request_info(*args, **kwargs)
19-
method = getattr(self._api, request["method"])
20+
http_method = getattr(self._api, request["method"])
2021
method_kwargs = {}
2122
for component in ["path", "params", "data", "headers"]:
2223
if component in request:
2324
method_kwargs[component] = request[component]
24-
endpoint = request["endpoint"]
25-
return handle_response(http_method(**method_kwargs))
25+
method_kwargs["endpoint"] = request["endpoint"]
26+
return self.handle_response(http_method(**method_kwargs))

arango/tests/test_aql_functions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
from arango import Arango
66
from arango.exceptions import *
77
from arango.tests.utils import (
8-
get_next_col_name,
98
get_next_db_name
109
)
1110

12-
class AQLFunctionManagementTest(unittest.TestCase):
1311

12+
class AQLFunctionManagementTest(unittest.TestCase):
1413

1514
def setUp(self):
1615
self.arango = Arango()

arango/tests/test_batch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
get_next_graph_name,
99
)
1010

11+
1112
class BatchRequestTest(unittest.TestCase):
1213

1314
def setUp(self):
@@ -28,8 +29,8 @@ def setUp(self):
2829
self.graph = self.db.add_graph(
2930
name=self.graph_name,
3031
edge_definitions=[{
31-
"collection" : self.edge_col_name,
32-
"from" : [self.vertex_col_name],
32+
"collection": self.edge_col_name,
33+
"from": [self.vertex_col_name],
3334
"to": [self.vertex_col_name]
3435
}],
3536
)

arango/tests/test_document.py

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def setUp(self):
1717
self.arango = Arango()
1818
self.db_name = get_next_db_name(self.arango)
1919
self.db = self.arango.add_database(self.db_name)
20-
self.col_name = get_next_col_name(self.arango)
21-
self.col = self.arango.add_collection(self.col_name)
20+
self.col_name = get_next_col_name(self.db)
21+
self.col = self.db.add_collection(self.col_name)
2222
self.col.add_geo_index(["coord"])
2323
self.col.add_skiplist_index(["value"])
2424
self.col.add_fulltext_index(["text"])
@@ -199,8 +199,8 @@ def test_get_first_example(self):
199199
self.assertIn(
200200
strip_system_keys(self.col.get_first_example({"value": 1})),
201201
[
202-
{"name": "test_doc_01", "value" :1},
203-
{"name": "test_doc_02", "value" :1}
202+
{"name": "test_doc_01", "value": 1},
203+
{"name": "test_doc_02", "value": 1}
204204
]
205205
)
206206

@@ -213,7 +213,7 @@ def test_get_by_example(self):
213213
self.assertEqual(
214214
sorted(strip_system_keys(self.col.get_by_example({"value": 1}))),
215215
sorted([
216-
{"name": "test_doc_01", "value" :1},
216+
{"name": "test_doc_01", "value": 1},
217217
{"name": "test_doc_02", "value": 1},
218218
])
219219
)
@@ -296,10 +296,10 @@ def test_range(self):
296296

297297
def test_near(self):
298298
self.col.bulk_import([
299-
{"name": "test_doc_01", "coord": [1,1]},
300-
{"name": "test_doc_02", "coord": [1,4]},
301-
{"name": "test_doc_03", "coord": [4,1]},
302-
{"name": "test_doc_03", "coord": [4,4]},
299+
{"name": "test_doc_01", "coord": [1, 1]},
300+
{"name": "test_doc_02", "coord": [1, 4]},
301+
{"name": "test_doc_03", "coord": [4, 1]},
302+
{"name": "test_doc_03", "coord": [4, 4]},
303303
])
304304
self.assertEqual(
305305
strip_system_keys(
@@ -310,39 +310,16 @@ def test_near(self):
310310
)
311311
),
312312
[
313-
{"name": "test_doc_01", "coord": [1,1]}
313+
{"name": "test_doc_01", "coord": [1, 1]}
314314
]
315315
)
316316

317-
# TODO enable when the endpoint is fixed
318-
#def test_within(self):
319-
#self.col.bulk_import([
320-
#{"name": "test_doc_01", "coord": [1,1]},
321-
#{"name": "test_doc_02", "coord": [1,4]},
322-
#{"name": "test_doc_03", "coord": [4,1]},
323-
#{"name": "test_doc_03", "coord": [4,4]},
324-
#])
325-
#self.assertEqual(
326-
#strip_system_keys(
327-
#self.col.within(
328-
#latitude=0,
329-
#longitude=0,
330-
#radius=3.5,
331-
#)
332-
#),
333-
#[
334-
#{"name": "test_doc_01", "coord": [1,1]},
335-
#{"name": "test_doc_02", "coord": [1,4]},
336-
#{"name": "test_doc_03", "coord": [4,1]},
337-
#]
338-
#)
339-
340317
def test_fulltext(self):
341318
self.col.bulk_import([
342-
{"name": "test_doc_01", "text": "Hello World!"},
343-
{"name": "test_doc_02", "text": "foo"},
344-
{"name": "test_doc_03", "text": "bar"},
345-
{"name": "test_doc_03", "text": "baz"},
319+
{"name": "test_doc_01", "text": "Hello World!"},
320+
{"name": "test_doc_02", "text": "foo"},
321+
{"name": "test_doc_03", "text": "bar"},
322+
{"name": "test_doc_03", "text": "baz"},
346323
])
347324
self.assertEqual(
348325
strip_system_keys(self.col.fulltext("text", "foo,|bar")),

arango/tests/test_index.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ def test_add_geo_index_with_one_attr(self):
9797
ignore_null=False
9898
)
9999
self.assertEquals(
100-
sorted(self.col.indexes.values()),
101-
sorted([
100+
sorted(self.col.indexes.values()),
101+
sorted([
102102
{
103103
"type": "primary",
104104
"fields": ["_key"],
@@ -123,8 +123,8 @@ def test_add_geo_index_with_two_attrs(self):
123123
ignore_null=False
124124
)
125125
self.assertEquals(
126-
sorted(self.col.indexes.values()),
127-
sorted([
126+
sorted(self.col.indexes.values()),
127+
sorted([
128128
{
129129
"type": "primary",
130130
"fields": ["_key"],
@@ -158,8 +158,8 @@ def test_add_fulltext_index(self):
158158
min_length=10,
159159
)
160160
self.assertEquals(
161-
sorted(self.col.indexes.values()),
162-
sorted([
161+
sorted(self.col.indexes.values()),
162+
sorted([
163163
{
164164
"type": "primary",
165165
"fields": ["_key"],

0 commit comments

Comments
 (0)