Skip to content

Commit a5f2cc5

Browse files
committed
Remove six and enum34 requirements
1 parent a4d26e2 commit a5f2cc5

File tree

9 files changed

+17
-33
lines changed

9 files changed

+17
-33
lines changed

requirements.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
beautifulsoup4
22
requests
3-
enum34;python_version<"3.4"
43
websocket-client
5-
six

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
license='Apache License, Version 2.0, see LICENSE file',
3939

4040
packages=['vk_api', 'jconfig'],
41-
install_requires=['requests', 'enum34;python_version<"3.4"', 'six'],
41+
install_requires=['requests'],
4242
extras_require={
4343
'vkstreaming': ['websocket-client'],
4444
'vkaudio': ['beautifulsoup4'],

vk_api/audio_url_decoder.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from six.moves import range
3-
42
from .exceptions import VkAudioUrlDecodeError
53

64
VK_STR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN0PQRSTUVWXYZO123456789+/="

vk_api/execute.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
:copyright: (c) 2019 python273
77
"""
88

9-
import six
10-
119
from .utils import sjson_dumps
1210
from .vk_api import VkApi, VkApiMethod
1311

@@ -35,7 +33,7 @@ def __init__(self, code, args=None, clean_args=None, return_raw=False):
3533
def compile(self, args):
3634
compiled_args = {}
3735

38-
for key, value in six.iteritems(args):
36+
for key, value in args.items():
3937
if key in self.clean_args:
4038
compiled_args[key] = str(value)
4139
else:
@@ -74,7 +72,7 @@ def minify(code):
7472
def parse_args(function_args, args, kwargs):
7573
parsed_args = {}
7674

77-
for arg_name in six.iterkeys(kwargs):
75+
for arg_name in kwargs.keys():
7876
if arg_name in function_args:
7977
parsed_args[arg_name] = kwargs[arg_name]
8078
else:

vk_api/keyboard.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from enum import Enum
99

10-
import six
1110

1211
from .utils import sjson_dumps
1312

@@ -109,7 +108,7 @@ def add_button(self, label, color=VkKeyboardColor.SECONDARY, payload=None):
109108
if isinstance(color, VkKeyboardColor):
110109
color_value = color_value.value
111110

112-
if payload is not None and not isinstance(payload, six.string_types):
111+
if payload is not None and not isinstance(payload, str):
113112
payload = sjson_dumps(payload)
114113

115114
button_type = VkKeyboardButton.TEXT.value
@@ -145,7 +144,7 @@ def add_callback_button(self, label, color=VkKeyboardColor.SECONDARY, payload=No
145144
if isinstance(color, VkKeyboardColor):
146145
color_value = color_value.value
147146

148-
if payload is not None and not isinstance(payload, six.string_types):
147+
if payload is not None and not isinstance(payload, str):
149148
payload = sjson_dumps(payload)
150149

151150
button_type = VkKeyboardButton.CALLBACK.value
@@ -174,7 +173,7 @@ def add_location_button(self, payload=None):
174173
'This type of button takes the entire width of the line'
175174
)
176175

177-
if payload is not None and not isinstance(payload, six.string_types):
176+
if payload is not None and not isinstance(payload, str):
178177
payload = sjson_dumps(payload)
179178

180179
button_type = VkKeyboardButton.LOCATION.value
@@ -204,7 +203,7 @@ def add_vkpay_button(self, hash, payload=None):
204203
'This type of button takes the entire width of the line'
205204
)
206205

207-
if payload is not None and not isinstance(payload, six.string_types):
206+
if payload is not None and not isinstance(payload, str):
208207
payload = sjson_dumps(payload)
209208

210209
button_type = VkKeyboardButton.VKPAY.value
@@ -242,7 +241,7 @@ def add_vkapps_button(self, app_id, owner_id, label, hash, payload=None):
242241
'This type of button takes the entire width of the line'
243242
)
244243

245-
if payload is not None and not isinstance(payload, six.string_types):
244+
if payload is not None and not isinstance(payload, str):
246245
payload = sjson_dumps(payload)
247246

248247
button_type = VkKeyboardButton.VKAPPS.value
@@ -274,7 +273,7 @@ def add_openlink_button(self, label, link, payload=None):
274273
if len(current_line) >= MAX_BUTTONS_ON_LINE:
275274
raise ValueError(f'Max {MAX_BUTTONS_ON_LINE} buttons on a line')
276275

277-
if payload is not None and not isinstance(payload, six.string_types):
276+
if payload is not None and not isinstance(payload, str):
278277
payload = sjson_dumps(payload)
279278

280279
button_type = VkKeyboardButton.OPENLINK.value

vk_api/longpoll.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from enum import IntEnum
1212

1313
import requests
14-
import six
15-
from six.moves import range
1614

1715
CHAT_START_ID = int(2E9) # id с которого начинаются беседы
1816

@@ -300,7 +298,7 @@ class VkChatEventType(IntEnum):
300298
def get_all_event_attrs():
301299
keys = set()
302300

303-
for l in six.itervalues(EVENT_ATTRS_MAPPING):
301+
for l in EVENT_ATTRS_MAPPING.values():
304302
keys.update(l)
305303

306304
return tuple(keys)
@@ -309,7 +307,7 @@ def get_all_event_attrs():
309307
ALL_EVENT_ATTRS = get_all_event_attrs()
310308

311309
PARSE_PEER_ID_EVENTS = [
312-
k for k, v in six.iteritems(EVENT_ATTRS_MAPPING) if 'peer_id' in v
310+
k for k, v in EVENT_ATTRS_MAPPING.items() if 'peer_id' in v
313311
]
314312
PARSE_MESSAGE_FLAGS_EVENTS = [
315313
VkEventType.MESSAGE_FLAGS_REPLACE,
@@ -398,7 +396,7 @@ def _list_to_attr(self, raw, attrs):
398396
self.__setattr__(attrs[i], raw[i])
399397

400398
def _dict_to_attr(self, values):
401-
for k, v in six.iteritems(values):
399+
for k, v in values.items():
402400
self.__setattr__(k, v)
403401

404402
def _parse_peer_id(self):

vk_api/requests_pool.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from collections import namedtuple
1010

11-
from six.moves import range
12-
1311
from .exceptions import VkRequestsPoolException
1412
from .execute import VkFunction
1513
from .utils import sjson_dumps

vk_api/utils.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@
1010

1111
import random
1212

13-
import six
14-
1513
try:
1614
import simplejson as json
1715
except ImportError:
1816
import json
1917

20-
try:
21-
from http.cookiejar import Cookie
22-
except ImportError: # python2
23-
from cookielib import Cookie
18+
from http.cookiejar import Cookie
2419

2520

2621
def search_re(reg, string):
@@ -82,7 +77,7 @@ def sjson_dumps(*args, **kwargs):
8277

8378
def cookie_to_dict(cookie):
8479
cookie_dict = {
85-
k: v for k, v in six.iteritems(cookie.__dict__) if k in HTTP_COOKIE_ARGS
80+
k: v for k, v in cookie.__dict__.items() if k in HTTP_COOKIE_ARGS
8681
}
8782

8883
cookie_dict['rest'] = cookie._rest
@@ -148,10 +143,11 @@ def send(self, request, **kwargs):
148143
body = body[:1024] + '[STRIPPED]'
149144

150145
print(
151-
'{:0.2f} {} {} {} {} {}'.format(
146+
'{:0.2f} {} {} {} {} {} {}'.format(
152147
total,
153148
request.method,
154149
request.url,
150+
request.headers,
155151
repr(body),
156152
response.status_code,
157153
response.history

vk_api/vk_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import urllib.parse
1616

1717
import requests
18-
import six
1918

2019
import jconfig
2120
from .enums import VkUserPermissions
@@ -701,7 +700,7 @@ def __getattr__(self, method):
701700
)
702701

703702
def __call__(self, **kwargs):
704-
for k, v in six.iteritems(kwargs):
703+
for k, v in kwargs.items():
705704
if isinstance(v, (list, tuple)):
706705
kwargs[k] = ','.join(str(x) for x in v)
707706

0 commit comments

Comments
 (0)