Skip to content

Commit 1d0057a

Browse files
committed
vk_upload PEP8 fixes
1 parent 9a27147 commit 1d0057a

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

vk_api/vk_upload.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
"""
44
@author: Kirill Python
5-
@contact: http://vk.com/python273
5+
@contact: https://vk.com/python273
66
@license Apache License, Version 2.0, see LICENSE file
77
8-
Copyright (C) 2014
8+
Copyright (C) 2015
99
"""
1010

1111

@@ -47,9 +47,9 @@ def photo(self, photos, album_id,
4747
url = self.vk.method('photos.getUploadServer', values)['upload_url']
4848

4949
# Загружаем
50-
photos_files = openPhotos(photos)
50+
photos_files = open_photos(photos)
5151
response = self.vk.http.post(url, files=photos_files).json()
52-
closePhotos(photos_files)
52+
close_photos(photos_files)
5353

5454
# Олег Илларионов:
5555
# это не могу к сожалению просто пофиксить
@@ -84,9 +84,9 @@ def photo_messages(self, photos):
8484
url = self.vk.method('photos.getMessagesUploadServer', values)
8585
url = url['upload_url']
8686

87-
photos_files = openPhotos(photos)
87+
photos_files = open_photos(photos)
8888
response = self.vk.http.post(url, files=photos_files)
89-
closePhotos(photos_files)
89+
close_photos(photos_files)
9090

9191
response = self.vk.method('photos.saveMessagesPhoto', response.json())
9292

@@ -113,9 +113,9 @@ def photo_wall(self, photos, user_id=None, group_id=None):
113113
response = self.vk.method('photos.getWallUploadServer', values)
114114
url = response['upload_url']
115115

116-
photos_files = openPhotos(photos)
116+
photos_files = open_photos(photos)
117117
response = self.vk.http.post(url, files=photos_files)
118-
closePhotos(photos_files)
118+
close_photos(photos_files)
119119

120120
values.update(response.json())
121121

@@ -148,17 +148,15 @@ def document(self, file_path, title=None, tags=None, group_id=None):
148148
return response
149149

150150

151-
def openPhotos(photos_paths):
151+
def open_photos(photos_paths):
152152
photos = {}
153153

154-
for x, filename in enumerate(photos_paths): # Открываем файлы
155-
photos.update(
156-
{'file%s' % x: open(filename, 'rb')}
157-
)
154+
for x, filename in enumerate(photos_paths):
155+
photos['file%s' % x] = open(filename, 'rb')
158156

159157
return photos
160158

161159

162-
def closePhotos(photos):
160+
def close_photos(photos):
163161
for i in photos:
164162
photos[i].close()

0 commit comments

Comments
 (0)