From a2fcb32245df463cf445e2e36bcaa7f4c2dd0cc2 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 24 Oct 2018 10:00:42 -0700 Subject: [PATCH] Escape backslashes in Python comments. The latest version of flake8 diagnoses these as invalid escape sequences, so properly escape them. --- lib/codegen/meta-python/base/instructions.py | 2 +- lib/codegen/meta-python/cdsl/instructions.py | 2 +- lib/codegen/meta-python/cdsl/test_ti.py | 2 +- lib/codegen/meta-python/cdsl/ti.py | 4 ++-- lib/codegen/meta-python/cdsl/typevar.py | 2 +- lib/codegen/meta-python/cdsl/xform.py | 2 +- lib/codegen/meta-python/semantics/__init__.py | 6 +++--- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/codegen/meta-python/base/instructions.py b/lib/codegen/meta-python/base/instructions.py index 2993d6de49..498a75727f 100644 --- a/lib/codegen/meta-python/base/instructions.py +++ b/lib/codegen/meta-python/base/instructions.py @@ -1134,7 +1134,7 @@ srem_imm = Instruction( irsub_imm = Instruction( 'irsub_imm', """ - Immediate reverse wrapping subtraction: :math:`a := Y - x \pmod{2^B}`. + Immediate reverse wrapping subtraction: :math:`a := Y - x \\pmod{2^B}`. Also works as integer negation when :math:`Y = 0`. Use :inst:`iadd_imm` with a negative immediate operand for the reverse immediate diff --git a/lib/codegen/meta-python/cdsl/instructions.py b/lib/codegen/meta-python/cdsl/instructions.py index e4c7186333..f158ecbd4b 100644 --- a/lib/codegen/meta-python/cdsl/instructions.py +++ b/lib/codegen/meta-python/cdsl/instructions.py @@ -345,7 +345,7 @@ class Instruction(object): `(inst, typevars)` pair. This version in `Instruction` itself allows non-polymorphic - instructions to duck-type as `BoundInstruction`\s. + instructions to duck-type as `BoundInstruction`\\s. """ assert not self.is_polymorphic, self return (self, ()) diff --git a/lib/codegen/meta-python/cdsl/test_ti.py b/lib/codegen/meta-python/cdsl/test_ti.py index d3baa4d3c5..0e7a01023e 100644 --- a/lib/codegen/meta-python/cdsl/test_ti.py +++ b/lib/codegen/meta-python/cdsl/test_ti.py @@ -98,7 +98,7 @@ def check_concrete_typing_rtl(var_types, rtl): Check that a concrete type assignment var_types (Dict[Var, TypeVar]) is valid for an Rtl rtl. Specifically check that: - 1) For each Var v \in rtl, v is defined in var_types + 1) For each Var v \\in rtl, v is defined in var_types 2) For all v, var_types[v] is a singleton type diff --git a/lib/codegen/meta-python/cdsl/ti.py b/lib/codegen/meta-python/cdsl/ti.py index bc2c16d5b1..0a7df053ca 100644 --- a/lib/codegen/meta-python/cdsl/ti.py +++ b/lib/codegen/meta-python/cdsl/ti.py @@ -419,7 +419,7 @@ class TypeEnv(object): E.g. if we have a root of the tree that looks like: typeof_a typeof_b - \ / + \\ / typeof_x | half_width(1) @@ -430,7 +430,7 @@ class TypeEnv(object): resulting graph is: typeof_a typeof_b - \ / + \\ / typeof_x """ source_tvs = set([v.get_typevar() for v in self.vars]) diff --git a/lib/codegen/meta-python/cdsl/typevar.py b/lib/codegen/meta-python/cdsl/typevar.py index d1d7c7137d..9d2dace044 100644 --- a/lib/codegen/meta-python/cdsl/typevar.py +++ b/lib/codegen/meta-python/cdsl/typevar.py @@ -120,7 +120,7 @@ def legal_bool(bits): # type: (int) -> bool """ True iff bits is a legal bit width for a bool type. - bits == 1 || bits \in { 8, 16, .. MAX_BITS } + bits == 1 || bits \\in { 8, 16, .. MAX_BITS } """ return bits == 1 or \ (bits >= 8 and bits <= MAX_BITS and is_power_of_two(bits)) diff --git a/lib/codegen/meta-python/cdsl/xform.py b/lib/codegen/meta-python/cdsl/xform.py index 607c1776a2..5b2ee24b55 100644 --- a/lib/codegen/meta-python/cdsl/xform.py +++ b/lib/codegen/meta-python/cdsl/xform.py @@ -113,7 +113,7 @@ class Rtl(object): # type: (Rtl) -> None """ Given that there is only 1 possible concrete typing T for self, assign - a singleton TV with type t=T[v] for each Var v \in self. Its an error + a singleton TV with type t=T[v] for each Var v \\in self. Its an error to call this on an Rtl with more than 1 possible typing. This modifies the Rtl in-place. """ diff --git a/lib/codegen/meta-python/semantics/__init__.py b/lib/codegen/meta-python/semantics/__init__.py index 260ecae331..6b3586db1f 100644 --- a/lib/codegen/meta-python/semantics/__init__.py +++ b/lib/codegen/meta-python/semantics/__init__.py @@ -19,11 +19,11 @@ def verify_semantics(inst, src, xforms): Verify that the semantics transforms in xforms correctly describe the instruction described by the src Rtl. This involves checking that: 0) src is a single instance of inst - 1) For all x\in xforms x.src is a single instance of inst + 1) For all x \\in xforms x.src is a single instance of inst 2) For any concrete values V of Literals in inst: For all concrete typing T of inst: - Exists single x \in xforms that applies to src conretazied to V - and T + Exists single x \\in xforms that applies to src conretazied to + V and T """ # 0) The source rtl is always a single instance of inst assert len(src.rtl) == 1 and src.rtl[0].expr.inst == inst