Skip to content

Commit 37ff1cc

Browse files
committed
[EN-1570] docstrings refactoring
1 parent 4b737f5 commit 37ff1cc

File tree

4 files changed

+61
-67
lines changed

4 files changed

+61
-67
lines changed

dxfeed/core/DXFeedPy.pyx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ cdef class SubscriptionClass:
9696
cdef void *u_data
9797

9898
def __init__(self):
99-
"""
100-
Parameters
101-
----------
102-
data_len: int
103-
Sets maximum amount of events, that are kept in Subscription class
104-
"""
10599
self.subscription = NULL
106100
self.__event_handler = None
107101

@@ -199,7 +193,7 @@ def dxf_create_connection_auth_bearer(address: Union[str, unicode, bytes],
199193
raise RuntimeError(f"In underlying C-API library error {error_code} occurred!")
200194
return cc
201195

202-
def dxf_create_subscription(ConnectionClass cc, event_type: str, data_len: int = 100000):
196+
def dxf_create_subscription(ConnectionClass cc, event_type: str):
203197
"""
204198
Function creates subscription and writes all relevant information to SubscriptionClass.
205199

dxfeed/core/utils/handler.pyx

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ from typing import Iterable
55

66

77
cdef class EventHandler:
8-
"""
9-
Master class for user defined event handlers. `update` method should be considered as abstract.
10-
11-
Attributes
12-
----------
13-
columns: list
14-
After attaching listener the field contains one-word descriptors of the values in upcoming event the order
15-
coincides
16-
"""
178
def __init__(self):
9+
"""
10+
Master class for user defined event handlers. `update` method should be considered as abstract.
11+
12+
Attributes
13+
----------
14+
columns: list
15+
After attaching listener the field contains one-word descriptors of the values in upcoming event the order
16+
coincides
17+
"""
1818
self.columns = list()
1919

2020
cdef void cython_internal_update_method(self, event) nogil:
@@ -34,19 +34,19 @@ cdef class EventHandler:
3434
warn(Warning('You have not implemented update method in your EventHandler, that is called, when event comes!'))
3535

3636
cdef class DefaultHandler(EventHandler):
37-
"""
38-
The class implements one possible event handler, which is considered as default. This class just stores upcoming
39-
events in custom deque with thread lock and has methods to get data as list or as pandas.DataFrame.
40-
41-
Attributes
42-
----------
43-
data_len: int
44-
The length of internal DequeWithLock object. Default is 100000.
45-
columns: list
46-
After attaching listener the field contains one-word descriptors of the values in upcoming event the order
47-
coincides.
48-
"""
4937
def __init__(self, data_len: int=100000):
38+
"""
39+
The class implements one possible event handler, which is considered as default. This class just stores upcoming
40+
events in custom deque with thread lock and has methods to get data as list or as pandas.DataFrame.
41+
42+
Attributes
43+
----------
44+
data_len: int
45+
The length of internal DequeWithLock object. Default is 100000.
46+
columns: list
47+
After attaching listener the field contains one-word descriptors of the values in upcoming event the order
48+
coincides.
49+
"""
5050
super().__init__()
5151
self.__data = deque_wl(maxlen=data_len)
5252

dxfeed/wrappers/endpoint.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44

55

66
class Endpoint(object):
7-
"""
8-
Class for connection management. After successful creation Instance will be connected to server
9-
with provided credentials
10-
11-
Attributes
12-
----------
13-
connection_address: str
14-
One of possible connection addresses:
15-
16-
- the single address: `host:port` or just `host`
17-
- address with credentials: `host:port[username=xxx,password=yyy]`
18-
- multiple addresses: `(host1:port1)(host2)(host3:port3[username=xxx,password=yyy])`
19-
20-
Default: demo.dxfeed.com:7300
21-
connect: bool
22-
When True `connect` method is called during instance creation. Default - True
23-
"""
247
def __init__(self, connection_address: str = 'demo.dxfeed.com:7300', connect: bool = True):
8+
"""
9+
Class for connection management. After successful creation Instance will be connected to server
10+
with provided credentials
11+
12+
Attributes
13+
----------
14+
connection_address: str
15+
One of possible connection addresses:
16+
17+
- the single address: `host:port` or just `host`
18+
- address with credentials: `host:port[username=xxx,password=yyy]`
19+
- multiple addresses: `(host1:port1)(host2)(host3:port3[username=xxx,password=yyy])`
20+
21+
Default: demo.dxfeed.com:7300
22+
connect: bool
23+
When True `connect` method is called during instance creation. Default - True
24+
"""
2525
self.__con_address = connection_address
2626
self.__connection = ConnectionClass()
2727
if connect:

dxfeed/wrappers/subscription.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@
66

77

88
class Subscription(object):
9-
"""
10-
Class for subscription management. Recommended to be created only via create_subscription method in Endpoint class.
11-
Also stores incoming events
12-
13-
Attributes
14-
----------
15-
connection: dxfeed.core.DXFeedPy.ConnectionClass
16-
Core class written in cython, that handle connection related details on the low level
17-
event_type: str
18-
One of possible event types: 'Trade', 'Quote', 'Summary', 'Profile', 'Order', 'TimeAndSale', 'Candle',
19-
'TradeETH', 'SpreadOrder', 'Greeks', 'TheoPrice', 'Underlying', 'Series', 'Configuration' or ''
20-
date_time: str or datetime.datetime
21-
If present timed subscription will be created (conflated stream). For sting date format is following:
22-
%Y-%m-%d %H:%M:%S.%f. If None - stream subscription will be created (non-conflated). Default - None.
23-
exact_format: bool
24-
If False no warning will be thrown in case of incomplete date_time parameter. Default - True
25-
26-
Note
27-
----
28-
Some event types (e.g. Candle) support only timed subscription.
29-
30-
"""
319
def __init__(self, connection, event_type: str, date_time: Union[str, datetime], exact_format: bool = True):
10+
"""
11+
Class for subscription management. Recommended to be created only via create_subscription method in Endpoint class.
12+
Also stores incoming events
13+
14+
Attributes
15+
----------
16+
connection: dxfeed.core.DXFeedPy.ConnectionClass
17+
Core class written in cython, that handle connection related details on the low level
18+
event_type: str
19+
One of possible event types: 'Trade', 'Quote', 'Summary', 'Profile', 'Order', 'TimeAndSale', 'Candle',
20+
'TradeETH', 'SpreadOrder', 'Greeks', 'TheoPrice', 'Underlying', 'Series', 'Configuration' or ''
21+
date_time: str or datetime.datetime
22+
If present timed subscription will be created (conflated stream). For sting date format is following:
23+
%Y-%m-%d %H:%M:%S.%f. If None - stream subscription will be created (non-conflated). Default - None.
24+
exact_format: bool
25+
If False no warning will be thrown in case of incomplete date_time parameter. Default - True
26+
27+
Note
28+
----
29+
Some event types (e.g. Candle) support only timed subscription.
30+
31+
"""
3232
self.__event_type = event_type
3333
if date_time is None:
3434
self.__sub = dxf_create_subscription(cc=connection,

0 commit comments

Comments
 (0)