Skip to content

Conversation

ValeZh
Copy link
Owner

@ValeZh ValeZh commented Jul 19, 2023

Lab 2 dict films

ValeZh and others added 4 commits July 18, 2023 00:35
@ValeZh ValeZh requested a review from vloooo July 19, 2023 15:00
lab2/main.py Outdated
Comment on lines 42 to 43
most_popular_film = max(self.films, key=lambda x:x['popularity'])['original_title']
return most_popular_film
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
most_popular_film = max(self.films, key=lambda x:x['popularity'])['original_title']
return most_popular_film
return max(self.films, key=lambda x:x['popularity'])['original_title']

lab2/main.py Outdated
Comment on lines 38 to 39
x = slice(3,19,4)
return self.films[x]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x = slice(3,19,4)
return self.films[x]
return self.films[slice(3,19,4)]

ValeZh added 2 commits July 28, 2023 17:25
everything done
everything done
lab2/main.py Outdated
Comment on lines 14 to 15
"accept": "application/json",
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIzMTI3NGFmYTRlNTUyMjRjYzRlN2Q0NmNlMTNkOTZjOSIsInN1YiI6IjVkNmZhMWZmNzdjMDFmMDAxMDU5NzQ4OSIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.lbpgyXlOXwrbY0mUmP-zQpNAMCw_h-oaudAJB6Cn5c8"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double-quotes should be replaced with the single one

lab2/main.py Outdated
Comment on lines 46 to 47
return [f['original_title'] for f in self.films if word in f[
'overview']]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't have splited it up for two lines

lab2/main.py Outdated
Comment on lines 50 to 51
answer_collect = frozenset(n for f in self.films for n in f['genre_ids'])
return answer_collect
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in one line

lab2/main.py Outdated
Comment on lines 54 to 55
result = [f for f in self.films if int(id_genre_del) not in f['genre_ids']]
return result
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in one line

lab2/main.py Outdated

def make_collection(self):
result_lst_dic = [self.make_dict(f) for f in self.films] # named tuple
print(result_lst_dic)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete prints please

lab2/main.py Outdated
@staticmethod
def csv_file_maker(coll_dict):
with open('lab2.txt', mode='w') as csv_file:
fieldnames = ['Title', 'Popularity', 'Score', 'Last_day_in_cinema']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it a constant

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сверху вынести константой

with open('lab2.txt', mode='w') as csv_file:
fieldnames = ['Title', 'Popularity', 'Score', 'Last_day_in_cinema']
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary blank line

lab2/main.py Outdated
from copy import deepcopy


# from collections import Counter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you commented it. you definitely use counter in further code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants