-
Notifications
You must be signed in to change notification settings - Fork 0
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
RDFread #7
Conversation
# Conflicts: # CGRtools/files/RDFrw.py
CGRtools/files/RDFrw.py
Outdated
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вынеси проверку на буфер выше к остальным важным условиям
CGRtools/files/RDFrw.py
Outdated
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()] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
твой сплит может сделать фигню. ибо пробелы в строчке бывают но есть способ. грепать онли паттерн
CGRtools/files/RDFrw.py
Outdated
def __len__(self): | ||
if self.__shifts: | ||
return len(self.__shifts) - 1 | ||
raise NotImplementedError(self.__error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тогда уж сам класс ошибки вынеси. к чему полумеры
CGRtools/files/RDFrw.py
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
мы эту ошибку уже обсудили. исправь
CGRtools/files/RDFrw.py
Outdated
next(self.__data) | ||
if self.__shifts[0] != new_pos: | ||
self._file.seek(new_pos) | ||
elif 0 < current_pos < len(self.__shifts): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
зачем так сложно проверять. проверил бы что оно не 0. и все.
CGRtools/files/RDFrw.py
Outdated
self.__file = iter(self._file.readline, '') | ||
self._file.seek(0) | ||
next(self.__data) | ||
if self.__shifts[0] != new_pos: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше через offset.
CGRtools/files/RDFrw.py
Outdated
if self.__shifts[0] != new_pos: | ||
self._file.seek(new_pos) | ||
elif 0 < current_pos < len(self.__shifts): | ||
self.__data.send(new_pos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сендить можно что угодно. так что шли просто трушку
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
иначе будут тут смысл искать
No description provided.