Skip to content

Commit

Permalink
fix and activate pep E305 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton authored Dec 21, 2023
1 parent 4d0e825 commit 824c1c6
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- name: Run pycodestyle
shell: bash -l {0}
# We currently only check for some warnings. We should enable & fix more of them.
run: pycodestyle --select=E111,E221,E222,E225,E227,E228,E302,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E721 spherogram_src/
run: pycodestyle --select=E111,E221,E222,E225,E227,E228,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E721 dev/
run: pycodestyle --select=E111,E221,E222,E225,E227,E228,E302,E305,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E721 spherogram_src/
run: pycodestyle --select=E111,E221,E222,E225,E227,E228,E305,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E721 dev/
- name: Run cython-lint
shell: bash -l {0}
run: cython-lint .
Expand Down
4 changes: 4 additions & 0 deletions dev/DTcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ def partition_list(L, parts):
# equivalent to interchanging the other pair. So in practice we
# only interchange the North-South pair.


South, East, North, West = 0, 1, 2, 3


class FlippingError(Exception):
pass


class EmbeddingError(Exception):
pass


class DTvertex(tuple):
"""
A vertex of the 4-valent graph which is described by a DT code.
Expand Down
8 changes: 6 additions & 2 deletions dev/dev_malik/fast_jones_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,23 @@ def all_labels(strand_vars):
return strand_labels


def combine_strands(v1,v2, common_label):
def combine_strands(v1, v2, common_label):
labels1 = var_to_strand_labels(v1)
labels2 = var_to_strand_labels(v2)
l1 = labels1[1 - labels1.index(common_label)]
l2 = labels2[1 - labels2.index(common_label)]
l1, l2 = sorted([l1,l2])
return sympy.Symbol('P'+str(l1)+'c'+str(l2))


def remove_squares(monomial):
A, B = sympy.symbols('A,B')
strand_vars = monomial.free_symbols - set([A,B])
for v in strand_vars:
monomial = monomial.subs(v*v,-A**2-(1/A)**2)
return monomial


def remove_loops(monomial):
A, B = sympy.symbols('A,B')
strand_vars = monomial.free_symbols - set([A,B])
Expand All @@ -144,11 +146,13 @@ def remove_loops(monomial):


def var_to_strand_labels(v):
return map(int,str(v)[1:].split('c'))
return map(int, str(v)[1:].split('c'))


def join_strands(v1, v2):
pass


"""
def jones_ring(n):
names_dict = {(i,j):'P'+str(i)+'c'+str(j) for i in range(2*n) for j in range(i,2*n)}
Expand Down
Loading

0 comments on commit 824c1c6

Please sign in to comment.