Skip to content

Commit 52557d4

Browse files
committed
Merge pull request #34 from exxeleron/qpython-1.1-dev
qpython 1.1
2 parents 72b874d + 48bba4a commit 52557d4

28 files changed

+902
-836
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
language: python
2+
3+
sudo: false
4+
25
python:
36
- "2.7"
7+
- "3.3"
8+
- "3.4"
49

510
# command to install dependencies
611
install: pip install -r requirements.txt -U

CHANGELOG.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
------------------------------------------------------------------------------
2+
qPython 1.1.0 [2015.11.25]
3+
------------------------------------------------------------------------------
4+
5+
- Compatibility with Python 2.7, 3.3, and 3.4
6+
17
------------------------------------------------------------------------------
28
qPython 1.0.2 [2015.09.03]
39
------------------------------------------------------------------------------

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ qPython is a Python library providing support for interprocess communication bet
88
- Support for kdb+ protocol and types: v3.0, v2.6, v<=2.5
99
- Uncompression of the IPC data stream
1010
- Internal representation of data via numpy arrays (lists, complex types) and numpy data types (atoms)
11-
- Supported on Python 2.7 and numpy 1.8
11+
- Supported on Python 2.7/3.3/3.4 and numpy 1.8
1212

1313
For more details please refer to the `documentation`_.
1414

conda.recipe/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: qpython
3-
version: 1.0.2
3+
version: "1.1.0"
44

55
build:
66
number: 1

doc/source/connection.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ can be used with a ``with`` statement:
2626
::
2727

2828
with qconnection.QConnection(host = 'localhost', port = 5000) as q:
29-
print q
30-
print q('{`int$ til x}', 10)
29+
print(q)
30+
print(q('{`int$ til x}', 10))
3131

3232

3333
Types conversion configuration

doc/source/pandas.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,35 @@ For example:
1717

1818
>>> with qconnection.QConnection(host = 'localhost', port = 5000, pandas = True) as q:
1919
>>> ds = q('(1i;0Ni;3i)', pandas = True)
20-
>>> print ds
20+
>>> print(ds)
2121
0 1
2222
1 NaN
2323
2 3
2424
dtype: float64
25-
>>> print ds.meta
25+
>>> print(ds.meta)
2626
metadata(qtype=6)
2727

2828
>>> df = q('flip `name`iq`fullname!(`Dent`Beeblebrox`Prefect;98 42 126;("Arthur Dent"; "Zaphod Beeblebrox"; "Ford Prefect"))')
29-
>>> print df
29+
>>> print(df)
3030
name iq fullname
3131
0 Dent 98 Arthur Dent
3232
1 Beeblebrox 42 Zaphod Beeblebrox
3333
2 Prefect 126 Ford Prefect
34-
>>> print df.meta
34+
>>> print(df.meta)
3535
metadata(iq=7, fullname=0, qtype=98, name=11)
36-
>>> print q('type', df)
36+
>>> print(q('type', df))
3737
98
3838

3939
>>> df = q('([eid:1001 0N 1003;sym:`foo`bar`] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))')
40-
>>> print df
40+
>>> print(df)
4141
pos dates
4242
eid sym
4343
1001 foo d1 2001-01-01
4444
NaN bar d2 2000-05-01
4545
1003 d3 NaT
46-
>>> print df.meta
46+
>>> print(df.meta)
4747
metadata(dates=14, qtype=99, eid=7, sym=11, pos=11)
48-
>>> print q('type', df)
48+
>>> print(q('type', df))
4949
99
5050

5151

doc/source/queries.rst

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,26 +35,26 @@ Synchronous queries
3535

3636
Executes a q expression:
3737

38-
>>> print q.sync('til 10')
38+
>>> print(q.sync('til 10'))
3939
[0 1 2 3 4 5 6 7 8 9]
4040

4141
Executes an anonymous q function with a single parameter:
4242

43-
>>> print q.sync('{til x}', 10)
43+
>>> print(q.sync('{til x}', 10))
4444
[0 1 2 3 4 5 6 7 8 9]
4545

4646
Executes an anonymous q function with two parameters:
4747

48-
>>> print q.sync('{y + til x}', 10, 1)
48+
>>> print(q.sync('{y + til x}', 10, 1))
4949
[ 1 2 3 4 5 6 7 8 9 10]
50-
>>> print q.sync('{y + til x}', *[10, 1])
50+
>>> print(q.sync('{y + til x}', *[10, 1]))
5151
[ 1 2 3 4 5 6 7 8 9 10]
5252

5353
The :class:`.QConnection` class implements the
5454
:func:`~qpython.qconnection.QConnection.__call__` method. This allows
5555
:class:`.QConnection` instance to be called as a function:
5656

57-
>>> print q('{y + til x}', 10, 1)
57+
>>> print(q('{y + til x}', 10, 1))
5858
[ 1 2 3 4 5 6 7 8 9 10]
5959

6060

@@ -84,25 +84,25 @@ For example:
8484
- Retrieves query result along with meta-information:
8585

8686
>>> q.query(qconnection.MessageType.SYNC,'{x}', 10)
87-
>>> print q.receive(data_only = False, raw = False)
87+
>>> print(q.receive(data_only = False, raw = False))
8888
QMessage: message type: 2, data size: 13, is_compressed: False, data: 10
8989

9090
- Retrieves parsed query result:
9191

9292
>>> q.query(qconnection.MessageType.SYNC,'{x}', 10)
93-
>>> print q.receive(data_only = True, raw = False)
93+
>>> print(q.receive(data_only = True, raw = False))
9494
10
9595

96-
>>> q.sync('asynchMult:{[a;b] res:a*b; (neg .z.w)(res) }');
96+
>>> q.sync('asynchMult:{[a;b] res:a*b; (neg .z.w)(res) }')
9797
>>> q.async('asynchMult', 2, 3)
98-
>>> print q.receive()
98+
>>> print(q.receive())
9999
6
100100

101101
- Retrieves not-parsed (raw) query result:
102102

103103
>>> from binascii import hexlify
104104
>>> q.query(qconnection.MessageType.SYNC,'{x}', 10)
105-
>>> print hexlify(q.receive(data_only = True, raw = True))
105+
>>> print(hexlify(q.receive(data_only = True, raw = True)))
106106
fa0a000000
107107

108108

@@ -120,24 +120,25 @@ These methods accepts the `options` keywords arguments::
120120
>>> query = "{[x] 0Nd, `date$til x}"
121121
122122
>>> # retrieve function call as raw byte buffer
123-
>>> print binascii.hexlify(q(query, 5, raw = True))
123+
>>> from binascii import hexlify
124+
>>> print(binascii.hexlify(q(query, 5, raw = True)))
124125
0e0006000000000000800000000001000000020000000300000004000000
125126

126127
>>> # perform a synchronous call and parse dates vector to numpy array
127-
>>> print q.sync(query, 5, numpy_temporals = True)
128+
>>> print(q.sync(query, 5, numpy_temporals = True))
128129
['NaT' '2000-01-01' '2000-01-02' '2000-01-03' '2000-01-04' '2000-01-05']
129130

130131
>>> # perform a synchronous call
131132
>>> q.query(qconnection.MessageType.SYNC, query, 3)
132133
>>> # retrieve query result and represent dates vector as raw data wrapped in QTemporalList
133-
>>> print q.receive(numpy_temporals = False)
134+
>>> print(q.receive(numpy_temporals = False))
134135
[NaT [metadata(qtype=-14)] 2000-01-01 [metadata(qtype=-14)]
135136
2000-01-02 [metadata(qtype=-14)] 2000-01-03 [metadata(qtype=-14)]]
136137
137138
>>> # serialize single element strings as q characters
138-
>>> print q.sync('{[x] type each x}', ['one', 'two', '3'], single_char_strings = False)
139+
>>> print(q.sync('{[x] type each x}', ['one', 'two', '3'], single_char_strings = False))
139140
[ 10, 10, -10]
140141
141142
>>> # serialize single element strings as q strings
142-
>>> print q.sync('{[x] type each x}', ['one', 'two', '3'], single_char_strings = True)
143-
[10, 10, 10]
143+
>>> print(q.sync('{[x] type each x}', ['one', 'two', '3'], single_char_strings = True))
144+
[10, 10, 10]

doc/source/type-conversion.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ for ``month``\s etc.) and provides accessors which allow to convert raw data to
201201
::
202202

203203
>>> v = q.sync("2001.01.01 2000.05.01 0Nd", numpy_temporals = False)
204-
>>> print '%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v)
204+
>>> print('%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v))
205205
<class 'qpython.qcollection.QTemporalList'> dtype: int32 qtype: -14: [2001-01-01 [metadata(qtype=-14)] 2000-05-01 [metadata(qtype=-14)]
206206
NaT [metadata(qtype=-14)]]
207207
208208
>>> v = q.sync("2000.01.04D05:36:57.600 0Np", numpy_temporals = False)
209-
>>> print '%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v)
209+
>>> print('%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v))
210210
<class 'qpython.qcollection.QTemporalList'> dtype: int64 qtype: -12: [2000-01-04T05:36:57.600000000+0100 [metadata(qtype=-12)]
211211
NaT [metadata(qtype=-12)]]
212212

@@ -221,11 +221,11 @@ via :class:`~.qconnection.QConnection` constructor or as parameter to functions:
221221
::
222222
223223
>>> v = q.sync("2001.01.01 2000.05.01 0Nd", numpy_temporals = True)
224-
>>> print '%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v)
224+
>>> print('%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v))
225225
<class 'qpython.qcollection.QList'> dtype: datetime64[D] qtype: -14: ['2001-01-01' '2000-05-01' 'NaT']
226226
227227
>>> v = q.sync("2000.01.04D05:36:57.600 0Np", numpy_temporals = True)
228-
>>> print '%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v)
228+
>>> print('%s dtype: %s qtype: %d: %s' % (type(v), v.dtype, v.meta.qtype, v))
229229
<class 'qpython.qcollection.QList'> dtype: datetime64[ns] qtype: -12: ['2000-01-04T05:36:57.600000000+0100' 'NaT']
230230
231231

0 commit comments

Comments
 (0)