Skip to content

Commit

Permalink
Merge pull request #16 from gridnevvvit/fix-tests
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
gridnevvvit authored Feb 20, 2022
2 parents 58d9e09 + bf8eaff commit c6ce18a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Python package

on: [push]
on:
push:
pull_request:

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__pycache__
ydb.egg-info/
4 changes: 2 additions & 2 deletions tests/aio/test_async_iter_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async def test_read_shard_table(driver, database):

data_by_shard_id = {}
with session.transaction() as tx:
max_value = 2 ** 64
max_value = 2**64
shard_key_bound = max_value >> 3
data = []

Expand All @@ -75,7 +75,7 @@ async def test_read_shard_table(driver, database):
table_row = {
"Key1": shard_id * shard_key_bound + idx,
"Key2": idx + 1000,
"Value": str(idx ** 4),
"Value": str(idx**4),
}
data_by_shard_id[shard_id].append(table_row)
data.append(table_row)
Expand Down
4 changes: 2 additions & 2 deletions ydb/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _construct_channel_options(driver_config, endpoint_options=None):
:param endpoint_options: Endpoint options
:return: A channel initialization options
"""
_max_message_size = 64 * 10 ** 6
_max_message_size = 64 * 10**6
_default_connect_options = [
("grpc.max_receive_message_length", _max_message_size),
("grpc.max_send_message_length", _max_message_size),
Expand Down Expand Up @@ -269,7 +269,7 @@ def _cancel_callback(f):
return self.rendezvous, self.result_future


_nanos_in_second = 10 ** 9
_nanos_in_second = 10**9


def _set_duration(duration_value, seconds_float):
Expand Down
12 changes: 6 additions & 6 deletions ydb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@


_SHIFT_BIT_COUNT = 64
_SHIFT = 2 ** 64
_SIGN_BIT = 2 ** 63
_DecimalNanRepr = 10 ** 35 + 1
_DecimalInfRepr = 10 ** 35
_DecimalSignedInfRepr = -(10 ** 35)
_SHIFT = 2**64
_SIGN_BIT = 2**63
_DecimalNanRepr = 10**35 + 1
_DecimalInfRepr = 10**35
_DecimalSignedInfRepr = -(10**35)
_primitive_type_by_id = {}


Expand Down Expand Up @@ -49,7 +49,7 @@ def _pb_to_decimal(type_pb, value_pb, table_client_settings):
elif int128_value == _DecimalSignedInfRepr:
return decimal.Decimal("-Inf")
return decimal.Decimal(int128_value) / decimal.Decimal(
10 ** type_pb.decimal_type.scale
10**type_pb.decimal_type.scale
)


Expand Down
10 changes: 3 additions & 7 deletions ydb/driver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import ydb

from . import credentials as credentials_impl, table, scheme, pool
from . import tracing
import six
import os

Expand Down Expand Up @@ -41,7 +40,7 @@ def parse_connection_string(connection_string):


def default_credentials(credentials=None, tracer=None):
tracer = tracer if tracer is not None else ydb.Tracer(None)
tracer = tracer if tracer is not None else tracing.Tracer(None)
with tracer.trace("Driver.default_credentials") as ctx:
if credentials is not None:
ctx.trace({"credentials.prepared": True})
Expand Down Expand Up @@ -117,7 +116,6 @@ def __init__(
grpc_lb_policy_name="round_robin",
discovery_request_timeout=10,
):
# type:(str, str, str, str, Any, ydb.Credentials, bool, bytes, bytes, bytes, float, ydb.TableClientSettings, list, str, ydb.Tracer) -> None
"""
A driver config to initialize a driver instance
Expand Down Expand Up @@ -158,7 +156,7 @@ def __init__(
self.grpc_keep_alive_timeout = grpc_keep_alive_timeout
self.table_client_settings = table_client_settings
self.primary_user_agent = primary_user_agent
self.tracer = tracer if tracer is not None else ydb.Tracer(None)
self.tracer = tracer if tracer is not None else tracing.Tracer(None)
self.grpc_lb_policy_name = grpc_lb_policy_name
self.discovery_request_timeout = discovery_request_timeout

Expand Down Expand Up @@ -235,8 +233,6 @@ def __init__(
credentials=None,
**kwargs
):
# type:(DriverConfig, str, str, str, bytes, ydb.AbstractCredentials, **Any) -> None

"""
Constructs a driver instance to be used in table and scheme clients.
It encapsulates endpoints discovery mechanism and provides ability to execute RPCs
Expand Down
2 changes: 1 addition & 1 deletion ydb/ydb_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "1.1.15"
VERSION = "2.1.0"

0 comments on commit c6ce18a

Please sign in to comment.