Pārlūkot izejas kodu

HAHA WHAT ARE ITERATORS

tags/v1.0^2
Ben Kurtovic pirms 10 gadiem
vecāks
revīzija
5d8ac664fe
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +4
    -3
      bitshift/parser/python.py

+ 4
- 3
bitshift/parser/python.py Parādīt failu

@@ -159,16 +159,17 @@ def parse_py(codelet):

def strip_encoding(lines):
"""Strips the encoding line from a file, which breaks the parser."""
it = iter(lines)
try:
first = next(lines)
first = next(it)
if not encoding_re.match(first):
yield first
second = next(lines)
second = next(it)
if not encoding_re.match(second):
yield second
except StopIteration:
return
for line in lines:
for line in it:
yield line

try:


Notiek ielāde…
Atcelt
Saglabāt