Skip to content

Commit d1474cd

Browse files
committed
dump version to 2.0.5
1 parent 28c529b commit d1474cd

File tree

6 files changed

+59
-24
lines changed

6 files changed

+59
-24
lines changed

setup.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
#!/usr/bin/env python
2-
# --------------------------------------------------------------------------------------------
2+
# --------------------------------------------------------------------
33
# Copyright (c) iEXBase. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# --------------------------------------------------------------------------------------------
4+
# Licensed under the MIT License.
5+
# See License.txt in the project root for license information.
6+
# --------------------------------------------------------------------
7+
8+
"""
9+
setup
10+
=====
11+
12+
Tron: A Python API for interacting with Tron (TRX)
13+
14+
:copyright: © 2018 by the iEXBase.
15+
:license: MIT License
16+
"""
617

718
import os
819
import platform
@@ -13,7 +24,7 @@
1324

1425
py_version = platform.python_version()
1526

16-
PACKAGE_VERSION = '2.0.4'
27+
PACKAGE_VERSION = '2.0.5'
1728

1829
tests_require = [
1930
'coverage',

tronapi/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# --------------------------------------------------------------------------------------------
1+
# --------------------------------------------------------------------
22
# Copyright (c) iEXBase. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for license information.
4-
# --------------------------------------------------------------------------------------------
3+
# Licensed under the MIT License.
4+
# See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------
6+
57
import sys
68
import warnings
79

tronapi/manager.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,20 @@
4141

4242
class TronManager(object):
4343
"""This class is designed to configure and define nodes
44-
for different types."""
45-
logger = logging.getLogger(__name__)
44+
for different types.
45+
46+
"""
47+
4648
_providers = None
4749

4850
def __init__(self, tron, providers):
51+
"""Create new manager tron instance
52+
53+
Args:
54+
tron: The tron implementation
55+
providers: List of providers
56+
57+
"""
4958
self.tron = tron
5059
self.providers = providers
5160
self.preferred_node = None
@@ -57,37 +66,49 @@ def __init__(self, tron, providers):
5766
if not providers[key]:
5867
self.providers[key] = HttpProvider(DEFAULT_NODES[key])
5968

69+
# If the type of the accepted provider is lower-case,
70+
# then we transform it to “HttpProvider”,
6071
if is_string(value):
6172
self.providers[key] = HttpProvider(value)
6273
self.providers[key].status_page = STATUS_PAGE[key]
6374

6475
@property
6576
def providers(self):
66-
"""Getting a list of all providers"""
77+
"""Getting a list of all providers
78+
79+
"""
6780
return self._providers or tuple()
6881

6982
@providers.setter
7083
def providers(self, value) -> None:
71-
"""Add a new provider"""
84+
"""Add a new provider
85+
86+
"""
7287
self._providers = value
7388

7489
@property
7590
def full_node(self) -> HttpProvider:
76-
"""Getting and managing paths to a full node"""
91+
"""Getting and managing paths to a full node
92+
93+
"""
7794
if 'full_node' not in self.providers:
7895
raise ValueError('Full node is not activated.')
7996
return self.providers.get('full_node')
8097

8198
@property
8299
def solidity_node(self) -> HttpProvider:
83-
"""Getting and managing paths to a solidity node"""
100+
"""Getting and managing paths to a solidity node
101+
102+
"""
84103
if 'solidity_node' not in self.providers:
85104
raise ValueError('Solidity node is not activated.')
86105
return self.providers.get('solidity_node')
87106

88107
@property
89108
def event_server(self) -> HttpProvider:
90-
"""Getting and managing paths to a event server"""
109+
"""Getting and managing paths to a event server
110+
111+
"""
91112
if 'event_server' not in self.providers:
92113
raise ValueError('Event server is not activated.')
93114
return self.providers.get('event_server')
@@ -101,19 +122,17 @@ def request(self, url, params=None, method=None):
101122
method (str): Request method
102123
103124
"""
104-
105-
if method is None:
106-
method = 'post'
125+
method = 'post' if method is None else method
107126

108127
# In this variable, we divide the resulting reference
109128
# into 2 parts to determine the type of node
110129
split = url[1:].split('/', 2)
111130

112-
if split[0] in ('walletsolidity', 'walletextension'):
131+
if split[0] in ('walletsolidity', 'walletextension',):
113132
return self.solidity_node.request(url, json=params, method=method)
114-
elif split[0] in 'wallet':
133+
elif split[0] in ('wallet',):
115134
return self.full_node.request(url, json=params, method=method)
116-
elif split[0] in ('event', 'healthcheck'):
135+
elif split[0] in ('event', 'healthcheck',):
117136
return self.event_server.request(url, json=params, method=method)
118137

119138
raise ValueError('Could not determine the type of node')

tronapi/providers/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Licensed under the MIT License.
44
# See License.txt in the project root for license information.
55
# --------------------------------------------------------------------
6+
67
from tronapi.utils.help import format_user_agent
78

89

tronapi/providers/http.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# See License.txt in the project root for license information.
55
# --------------------------------------------------------------------
66

7+
78
"""
89
tronapi.providers.http
910
======================
@@ -45,7 +46,7 @@ def __init__(self, node_url, request_kwargs=None):
4546

4647
self.node_url = node_url.rstrip('/')
4748
uri = urlparse(node_url)
48-
49+
4950
# This condition checks the node that will connect
5051
# to work with methods.
5152
if uri.scheme not in HTTP_SCHEMES:

tronapi/trx.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# --------------------------------------------------------------------------------------------
1+
# --------------------------------------------------------------------
22
# Copyright (c) iEXBase. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for license information.
4-
# --------------------------------------------------------------------------------------------
3+
# Licensed under the MIT License.
4+
# See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------
56

67
import math
78
from typing import Any

0 commit comments

Comments
 (0)