Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDFread #7

Merged
merged 21 commits into from
Mar 21, 2019
Merged

RDFread #7

merged 21 commits into from
Mar 21, 2019

Conversation

salikhovi4
Copy link
Contributor

No description provided.

super().__init__(*args, **kwargs)
super(CGRread, self).__init__(file)
self.__data = self.__reader()

if indexable and platform != 'win32':
self.__file = iter(self._file.readline, '')
if not self._is_buffer and next(self.__data):
Copy link
Owner

Choose a reason for hiding this comment

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

вынеси проверку на буфер выше к остальным важным условиям

self.__file = iter(self._file.readline, '')
if not self._is_buffer and next(self.__data):
self.__shifts = [int(x.split(':', 1)[0])
for x in check_output(["grep", "-bE", "\$[RM]FMT", self._file.name]).decode().split()]
Copy link
Owner

Choose a reason for hiding this comment

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

твой сплит может сделать фигню. ибо пробелы в строчке бывают но есть способ. грепать онли паттерн

def __len__(self):
if self.__shifts:
return len(self.__shifts) - 1
raise NotImplementedError(self.__error)
Copy link
Owner

Choose a reason for hiding this comment

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

тогда уж сам класс ошибки вынеси. к чему полумеры

is_reaction = True
ir = 3
meta = defaultdict(list)
else:
next(self._file) # skip header
if not self._is_buffer: # opened file is RXN or RDF
Copy link
Owner

Choose a reason for hiding this comment

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

мы эту ошибку уже обсудили. исправь

next(self.__data)
if self.__shifts[0] != new_pos:
self._file.seek(new_pos)
elif 0 < current_pos < len(self.__shifts):
Copy link
Owner

Choose a reason for hiding this comment

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

зачем так сложно проверять. проверил бы что оно не 0. и все.

self.__file = iter(self._file.readline, '')
self._file.seek(0)
next(self.__data)
if self.__shifts[0] != new_pos:
Copy link
Owner

Choose a reason for hiding this comment

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

тут лучше через offset.

if self.__shifts[0] != new_pos:
self._file.seek(new_pos)
elif 0 < current_pos < len(self.__shifts):
self.__data.send(new_pos)
Copy link
Owner

Choose a reason for hiding this comment

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

сендить можно что угодно. так что шли просто трушку

Copy link
Owner

Choose a reason for hiding this comment

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

иначе будут тут смысл искать

@stsouko stsouko merged commit 41bbce4 into stsouko:master Mar 21, 2019
@stsouko stsouko mentioned this pull request Mar 26, 2019
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.

None yet

2 participants