Skip to content

Молоденова Александра#13

Open
Alexsun8 wants to merge 4 commits into
kib-courses:masterfrom
Alexsun8:master
Open

Молоденова Александра#13
Alexsun8 wants to merge 4 commits into
kib-courses:masterfrom
Alexsun8:master

Conversation

@Alexsun8

Copy link
Copy Markdown

No description provided.

@romvano romvano left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

не реализован правильный Patient.create, из-за этого кривая логика в PatientCollection. Плюс обратить внимание на работу с файлами в PatientCollection. В остальном архитектура решения норм

Comment thread homework/DataIsValid.py Outdated

def dateIsReal(date):
year = int(date[:4])
if year < 1900 or year > 2020:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

это всё проще сделать с помощью модуля datetime

Comment thread homework/DataIsValid.py
name = sub(pattern, "", name_)
if len(name)==0:
return False
return name

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

логика объект/булево значение редко используется. Лучше либо True/False, либо объект/None

Comment thread homework/DataIsValid.py Outdated
return False

if month == 2 and day == 29:
print("WOW!")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

воистину

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

лучше всё-таки не велосипедить, потому что при такой логике 29 февраля может быть и в невисокосном годе

Comment thread homework/DataIsValid.py
# print(dateIsReal("1978-01-05"))

def phoneIsValid( phone_):
pattern = "[^+,0,1,2,3,4,5,6,7,8,9]"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

\D

Comment thread homework/Descriptor.py Outdated
instance.paterr.error('Invalid name.')
instance.paterr.error("Error. User was not created.")
raise TypeError("not str")
elif instance.created:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

не думаю, что атрибут created должен быть обозначен как public

Comment thread homework/PatientCollection.py Outdated
counter = 0
fileBytePos = 0
while True:
inFile = open(self.filepath)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

with

Comment thread homework/PatientCollection.py Outdated


class PatientCollection:
pat = Patient()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

конкретного пациента не нужно хранить в коллекции

Comment thread homework/PatientCollection.py Outdated
return
counter = 0
fileBytePos = 0
while True:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

while True - очень неочевидно. Стоит использовать for с учетом количества объектов

Comment thread homework/PatientCollection.py Outdated
inFile.close()
return
self.pat.create(*data.split(' '))
yield self.pat

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

исполнение функции приостанавливается, а файловый дескриптор в этот момент остается открытым

Comment thread homework/patient.py
@@ -1,17 +1,117 @@
import csv

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ну тут код повторяется, надо бы убрать ненужный файл

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

те два файла, а этот оставить =) правда, я уже комментарии там написал

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