Skip to content

Commit f18b586

Browse files
committed
Merge branch 'master' of github.com:neo4j/neo4j-python-driver
Conflicts: setup.py
2 parents 932b97c + d773e72 commit f18b586

File tree

5 files changed

+36
-41
lines changed

5 files changed

+36
-41
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Neo4j Bolt Driver for Python
44

55
.. code:: python
66
7-
import neo4j
8-
driver = neo4j.driver("bolt://localhost")
7+
from neo4j import GraphDatabase
8+
driver = GraphDatabase.driver("bolt://localhost")
99
session = driver.session()
1010
session.run("CREATE (a:Person {name:'Bob'})")
1111
for name, in session.run("MATCH (a:Person) RETURN a.name AS name"):

neo4j/bench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
(default: 1,2,4,8,16)
5252
5353
Environment:
54-
NEO4J_URI - base URI of Neo4j database, e.g. neo4j://localhost
54+
NEO4J_URI - base URI of Neo4j database, e.g. bolt://localhost
5555
5656
Report bugs to nigel@neotechnology.com
5757
"""

neo4j/packstream.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
- Boolean (true or false)
4141
- Integer (signed 64-bit integer)
4242
- Float (64-bit floating point number)
43-
- Text (UTF-8 encoded text data)
43+
- String (UTF-8 encoded string data)
4444
- List (ordered collection of values)
4545
- Map (keyed collection of values)
4646
- Structure (composite set of values with a type signature)
@@ -162,12 +162,12 @@
162162
+2 147 483 648 | +9 223 372 036 854 775 807 | INT_64
163163
164164
165-
Text
165+
String
166166
----
167167
168-
Text data is represented as UTF-8 encoded binary data. Note that sizes used
169-
for text are the byte counts of the UTF-8 encoded data, not the character count
170-
of the original text.
168+
String data is represented as UTF-8 encoded binary data. Note that sizes used
169+
for string are the byte counts of the UTF-8 encoded data, not the character count
170+
of the original string.
171171
172172
Marker | Size | Maximum size
173173
========|=============================================|=====================
@@ -176,12 +176,12 @@
176176
D1 | 16-bit big-endian unsigned integer | 65 535 bytes
177177
D2 | 32-bit big-endian unsigned integer | 4 294 967 295 bytes
178178
179-
For encoded text containing fewer than 16 bytes, including empty strings,
179+
For encoded string containing fewer than 16 bytes, including empty strings,
180180
the marker byte should contain the high-order nibble `1000` followed by a
181181
low-order nibble containing the size. The encoded data then immediately
182182
follows the marker.
183183
184-
For encoded text containing 16 bytes or more, the marker 0xD0, 0xD1 or 0xD2
184+
For encoded string containing 16 bytes or more, the marker 0xD0, 0xD1 or 0xD2
185185
should be used, depending on scale. This marker is followed by the size and
186186
the UTF-8 encoded data. Examples follow below:
187187
@@ -253,7 +253,7 @@
253253
the marker byte should contain the high-order nibble `1010` followed by a
254254
low-order nibble containing the size. The items within the map are then
255255
serialised in key-value-key-value order immediately after the marker. Keys
256-
are typically text values.
256+
are typically string values.
257257
258258
For maps containing 16 pairs or more, the marker 0xD8, 0xD9 or 0xDA should be
259259
used, depending on scale. This marker is followed by the size and map
@@ -315,10 +315,10 @@
315315

316316
if sys.version_info >= (3,):
317317
INTEGER_TYPE = int
318-
TEXT_TYPE = str
318+
STRING_TYPE = str
319319
else:
320320
INTEGER_TYPE = (int, long)
321-
TEXT_TYPE = unicode
321+
STRING_TYPE = unicode
322322

323323
__all__ = ["Packer", "pack", "packb", "Unpacker", "unpack", "unpackb"]
324324

@@ -349,7 +349,7 @@
349349
INT_32_STRUCT = ">i"
350350
INT_64_STRUCT = ">q"
351351

352-
TINY_TEXT = [bytes(bytearray([x])) for x in range(0x80, 0x90)]
352+
TINY_STRING = [bytes(bytearray([x])) for x in range(0x80, 0x90)]
353353
TINY_LIST = [bytes(bytearray([x])) for x in range(0x90, 0xA0)]
354354
TINY_MAP = [bytes(bytearray([x])) for x in range(0xA0, 0xB0)]
355355
TINY_STRUCT = [bytes(bytearray([x])) for x in range(0xB0, 0xC0)]
@@ -365,9 +365,9 @@
365365
BYTES_8 = b"\xCC"
366366
BYTES_16 = b"\xCD"
367367
BYTES_32 = b"\xCE"
368-
TEXT_8 = b"\xD0"
369-
TEXT_16 = b"\xD1"
370-
TEXT_32 = b"\xD2"
368+
STRING_8 = b"\xD0"
369+
STRING_16 = b"\xD1"
370+
STRING_32 = b"\xD2"
371371
LIST_8 = b"\xD4"
372372
LIST_16 = b"\xD5"
373373
LIST_32 = b"\xD6"
@@ -498,10 +498,10 @@ def pack(self, value):
498498
self.pack_bytes_header(len(value))
499499
self.pack_raw(value)
500500

501-
# Text
502-
elif isinstance(value, TEXT_TYPE):
501+
# String
502+
elif isinstance(value, STRING_TYPE):
503503
value_bytes = value.encode(ENCODING)
504-
self.pack_text_header(len(value_bytes))
504+
self.pack_string_header(len(value_bytes))
505505
self.pack_raw(value_bytes)
506506

507507
# List
@@ -546,21 +546,21 @@ def pack_bytes_header(self, size):
546546
else:
547547
raise OverflowError("Bytes header size out of range")
548548

549-
def pack_text_header(self, size):
549+
def pack_string_header(self, size):
550550
stream = self.stream
551551
if size < PLUS_2_TO_THE_4:
552-
stream.write(TINY_TEXT[size])
552+
stream.write(TINY_STRING[size])
553553
elif size < PLUS_2_TO_THE_8:
554-
stream.write(TEXT_8)
554+
stream.write(STRING_8)
555555
stream.write(PACKED_UINT_8[size])
556556
elif size < PLUS_2_TO_THE_16:
557-
stream.write(TEXT_16)
557+
stream.write(STRING_16)
558558
stream.write(PACKED_UINT_16[size])
559559
elif size < PLUS_2_TO_THE_32:
560-
stream.write(TEXT_32)
560+
stream.write(STRING_32)
561561
stream.write(struct_pack(UINT_32_STRUCT, size))
562562
else:
563-
raise OverflowError("Text header size out of range")
563+
raise OverflowError("String header size out of range")
564564

565565
def pack_list_header(self, size):
566566
stream = self.stream
@@ -690,16 +690,16 @@ def unpack(self):
690690
byte_size = struct_unpack(UINT_32_STRUCT, stream_read(4))[0]
691691
value = stream_read(byte_size)
692692

693-
# Text
693+
# String
694694
elif marker_high == 0x80:
695695
value = stream_read(marker & 0x0F).decode(ENCODING)
696-
elif marker_byte == TEXT_8:
696+
elif marker_byte == STRING_8:
697697
byte_size = UNPACKED_UINT_8[stream_read(1)]
698698
value = stream_read(byte_size).decode(ENCODING)
699-
elif marker_byte == TEXT_16:
699+
elif marker_byte == STRING_16:
700700
byte_size = UNPACKED_UINT_16[stream_read(2)]
701701
value = stream_read(byte_size).decode(ENCODING)
702-
elif marker_byte == TEXT_32:
702+
elif marker_byte == STRING_32:
703703
byte_size = struct_unpack(UINT_32_STRUCT, stream_read(4))[0]
704704
value = stream_read(byte_size).decode(ENCODING)
705705

setup.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ def read(fname):
4545
"Operating System :: OS Independent",
4646
"Topic :: Database",
4747
"Topic :: Software Development",
48-
"Programming Language :: Python :: 2.6",
4948
"Programming Language :: Python :: 2.7",
50-
"Programming Language :: Python :: 3.3",
51-
"Programming Language :: Python :: 3.4",
52-
"Programming Language :: Python :: 3.5",
53-
"Programming Language :: Python :: Implementation :: Jython",
5449
],
5550
packages=["neo4j"])

test/test_packstream.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,28 +138,28 @@ def test_bytes_32(self):
138138
b = bytes(bytearray(80000))
139139
assert_packable(b, b"\xCE\x00\x01\x38\x80" + b)
140140

141-
def test_empty_text(self):
141+
def test_empty_string(self):
142142
assert_packable(u"", b"\x80")
143143

144-
def test_tiny_text(self):
144+
def test_tiny_string(self):
145145
assert_packable(u"hello", b"\x85hello")
146146

147-
def test_text_8(self):
147+
def test_string_8(self):
148148
t = u"A" * 40
149149
b = t.encode("utf-8")
150150
assert_packable(t, b"\xD0\x28" + b)
151151

152-
def test_text_16(self):
152+
def test_string_16(self):
153153
t = u"A" * 40000
154154
b = t.encode("utf-8")
155155
assert_packable(t, b"\xD1\x9C\x40" + b)
156156

157-
def test_text_32(self):
157+
def test_string_32(self):
158158
t = u"A" * 80000
159159
b = t.encode("utf-8")
160160
assert_packable(t, b"\xD2\x00\x01\x38\x80" + b)
161161

162-
def test_unicode_text(self):
162+
def test_unicode_string(self):
163163
t = u"héllö"
164164
b = t.encode("utf-8")
165165
assert_packable(t, bytes(bytearray([0x80 + len(b)])) + b)

0 commit comments

Comments
 (0)