@@ -18,7 +18,7 @@ install:
|
||||
- pip install -r requirements-travis.txt
|
||||
|
||||
before_script:
|
||||
- flake8 ./exercises/ --max-line-length=99 --select=E,W
|
||||
- flake8
|
||||
|
||||
script:
|
||||
- ./test/check-exercises.py
|
||||
|
||||
@@ -34,13 +34,9 @@ python test/check-exercises.py
|
||||
|
||||
## Code Style
|
||||
|
||||
The Python code in this repo is meant to largely obey the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/).
|
||||
The Python code in this repo is meant to follow the [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/).
|
||||
|
||||
This repo uses [flake8](http://flake8.readthedocs.org/en/latest/) to enforce the coding standard. When you submit a PR, it needs to pass the flake8 tool with no warnings, or it won't be accepted. Here are the settings used by the build system:
|
||||
|
||||
```
|
||||
flake8 [your-code-here.py] --max-line-length=99 --select=E,W
|
||||
```
|
||||
This repo uses [flake8](http://flake8.readthedocs.org/en/latest/) with default settings to enforce the coding standard. When you submit a PR, it needs to pass the flake8 tool with no warnings, or it won't be accepted.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class Point(object):
|
||||
return self.x == other.x and self.y == other.y
|
||||
|
||||
def __ne__(self, other):
|
||||
return not(self == other)
|
||||
return not (self == other)
|
||||
|
||||
|
||||
DIRECTIONS = (Point(1, 0), Point(1, -1), Point(1, 1), Point(-1, -1),
|
||||
@@ -40,15 +40,16 @@ class WordSearch(object):
|
||||
return self.rows[coordinate.y][coordinate.x]
|
||||
|
||||
def find(self, word, position, direction):
|
||||
current = copy.copy(position)
|
||||
for letter in word:
|
||||
if self.find_char(current) != letter:
|
||||
return
|
||||
current += direction
|
||||
return position, current - direction
|
||||
current = copy.copy(position)
|
||||
for letter in word:
|
||||
if self.find_char(current) != letter:
|
||||
return
|
||||
current += direction
|
||||
return position, current - direction
|
||||
|
||||
def search(self, word):
|
||||
positions = (Point(x, y) for x in range(self.width) for y in range(self.height))
|
||||
positions = (Point(x, y)
|
||||
for x in range(self.width) for y in range(self.height))
|
||||
for pos in positions:
|
||||
for d in DIRECTIONS:
|
||||
result = self.find(word, pos, d)
|
||||
|
||||
Reference in New Issue
Block a user