Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit baf0a4a

Browse files
author
Travis Scrimshaw
committed
A little bit of reviewer cleanup.
1 parent 49be993 commit baf0a4a

File tree

2 files changed

+46
-47
lines changed

2 files changed

+46
-47
lines changed

src/sage/geometry/cone.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -510,16 +510,16 @@ def _ambient_space_point(body, data):
510510
Try to convert ``data`` to a point of the ambient space of ``body``.
511511
512512
INPUT:
513-
514-
- ``body`` -- a cone, fan, or lattice polytope with ``lattice()`` method.
515513
516-
- ``data`` -- anything.
514+
- ``body`` -- a cone, fan, or lattice polytope with ``lattice()`` method
515+
516+
- ``data`` -- anything
517517
518518
OUTPUT:
519519
520520
- integral, rational or numeric point of the ambient space of ``body``
521521
if ``data`` were successfully interpreted in such a way, otherwise a
522-
``TypeError`` exception is raised.
522+
``TypeError`` exception is raised
523523
524524
TESTS::
525525
@@ -531,7 +531,7 @@ def _ambient_space_point(body, data):
531531
Traceback (most recent call last):
532532
...
533533
TypeError: the point M(1, 1) and
534-
2-d cone in 2-d lattice N have incompatible lattices!
534+
2-d cone in 2-d lattice N have incompatible lattices
535535
sage: _ambient_space_point(c, [1,1/3])
536536
(1, 1/3)
537537
sage: _ambient_space_point(c, [1/2,1/sqrt(3)])
@@ -540,7 +540,7 @@ def _ambient_space_point(body, data):
540540
Traceback (most recent call last):
541541
...
542542
TypeError: [1, 1, 3] does not represent a valid point
543-
in the ambient space of 2-d cone in 2-d lattice N!
543+
in the ambient space of 2-d cone in 2-d lattice N
544544
"""
545545
L = body.lattice()
546546
try: # to make a lattice element...
@@ -549,7 +549,7 @@ def _ambient_space_point(body, data):
549549
# Special treatment for toric lattice elements
550550
if is_ToricLattice(parent(data)):
551551
raise TypeError("the point %s and %s have incompatible "
552-
"lattices!" % (data, body))
552+
"lattices" % (data, body))
553553
try: # ... or an exact point...
554554
return L.base_extend(QQ)(data)
555555
except TypeError:
@@ -560,7 +560,7 @@ def _ambient_space_point(body, data):
560560
pass
561561
# Raise TypeError with our own message
562562
raise TypeError("%s does not represent a valid point in the ambient "
563-
"space of %s!" % (data, body))
563+
"space of %s" % (data, body))
564564

565565

566566
def integral_length(v):
@@ -569,9 +569,11 @@ def integral_length(v):
569569
570570
INPUT:
571571
572-
- ``v`` - any object which can be converted to a list of rationals
572+
- ``v`` -- any object which can be converted to a list of rationals
573+
574+
OUTPUT:
573575
574-
OUTPUT: Rational number ``r`` such that ``v = r u``, where ``u`` is the
576+
Rational number `r`` such that ``v = r * u``, where ``u`` is the
575577
primitive integral vector in the direction of ``v``.
576578
577579
EXAMPLES::

src/sage/geometry/lattice_polytope.py

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def __contains__(self, point):
560560
False
561561
"""
562562
return self._contains(point)
563-
563+
564564
def __eq__(self, other):
565565
r"""
566566
Compare ``self`` with ``other``.
@@ -755,8 +755,7 @@ def _compute_facets(self):
755755
constants = (constants[1], constants[0])
756756
self.is_reflexive.set_cache(all(c == 1 for c in constants))
757757
if self.is_reflexive():
758-
polar = LatticePolytope(
759-
normals, compute_vertices=False, lattice=N)
758+
polar = LatticePolytope(normals, compute_vertices=False, lattice=N)
760759
polar.dim.set_cache(self.dim())
761760
polar.is_reflexive.set_cache(True)
762761
polar._polar = self
@@ -798,20 +797,17 @@ def _contains(self, point, region='whole polytope'):
798797
799798
INPUT:
800799
801-
- ``point`` -- anything. An attempt will be made to convert it into a
802-
single element of the ambient space of ``self``. If it fails,
803-
``False`` is returned;
800+
- ``point`` -- an attempt will be made to convert it into a
801+
single element of the ambient space of ``self``; if it fails,
802+
``False`` is returned
804803
805-
- ``region`` -- string. Can be either 'whole polytope' (default),
806-
'interior', or 'relative interior'.
804+
- ``region`` -- string; can be either ``'whole polytope'`` (default),
805+
``'interior'``, or ``'relative interior'``
807806
808807
OUTPUT:
809808
810809
- ``True`` if ``point`` is contained in the specified ``region`` of
811-
``self``, ``False`` otherwise.
812-
813-
Raises a ``ValueError`` if ``region`` is not one of the
814-
three allowed values.
810+
``self``, ``False`` otherwise
815811
816812
TESTS::
817813
@@ -822,9 +818,9 @@ def _contains(self, point, region='whole polytope'):
822818
try:
823819
point = _ambient_space_point(self, point)
824820
except TypeError as ex:
825-
if str(ex).endswith("have incompatible lattices!"):
821+
if str(ex).endswith("have incompatible lattices"):
826822
warnings.warn("you have checked if a cone contains a point "
827-
"from an incompatible lattice, this is False!",
823+
"from an incompatible lattice, this is False",
828824
stacklevel=3)
829825
return False
830826

@@ -1666,14 +1662,14 @@ def contains(self, *args):
16661662
16671663
INPUT:
16681664
1669-
- anything. An attempt will be made to convert all arguments into a
1670-
single element of the ambient space of ``self``. If it fails,
1671-
``False`` will be returned.
1665+
- an attempt will be made to convert all arguments into a
1666+
single element of the ambient space of ``self``; if it fails,
1667+
``False`` will be returned
16721668
16731669
OUTPUT:
16741670
16751671
- ``True`` if the given point is contained in ``self``, ``False``
1676-
otherwise.
1672+
otherwise
16771673
16781674
EXAMPLES::
16791675
@@ -1697,8 +1693,9 @@ def dim(self):
16971693
r"""
16981694
Return the dimension of this polytope.
16991695
1700-
EXAMPLES: We create a 3-dimensional octahedron and check its
1701-
dimension::
1696+
EXAMPLES:
1697+
1698+
We create a 3-dimensional octahedron and check its dimension::
17021699
17031700
sage: o = lattice_polytope.cross_polytope(3)
17041701
sage: o.dim()
@@ -1763,9 +1760,9 @@ def distances(self, point=None):
17631760
[0 2 2 0 1]
17641761
sage: p.distances((1/2, 3, 0))
17651762
(9/2, -3/2, -5/2, 7/2)
1766-
1763+
17671764
This point is not even in the affine subspace of the polytope::
1768-
1765+
17691766
sage: p.distances((1, 1, 1))
17701767
(3, 1, -1, 1)
17711768
"""
@@ -2121,24 +2118,24 @@ def faces(self, dim=None, codim=None):
21212118
def facet_constant(self, i):
21222119
r"""
21232120
Return the constant in the ``i``-th facet inequality of this polytope.
2124-
2125-
This is equivalent to ``facet_constants()[i]``
2121+
2122+
This is equivalent to ``facet_constants()[i]``.
21262123
21272124
INPUT:
21282125
2129-
- ``i`` - integer, the index of the facet
2126+
- ``i`` -- integer; the index of the facet
21302127
21312128
OUTPUT:
21322129
21332130
- integer -- the constant in the ``i``-th facet inequality.
21342131
21352132
.. SEEALSO::
2136-
2133+
21372134
:meth:`facet_constants`,
21382135
:meth:`facet_normal`,
21392136
:meth:`facet_normals`,
21402137
:meth:`facets`.
2141-
2138+
21422139
EXAMPLES::
21432140
21442141
sage: o = lattice_polytope.cross_polytope(3)
@@ -2158,15 +2155,15 @@ def facet_constants(self):
21582155
21592156
OUTPUT:
21602157
2161-
- an integer vector.
2158+
- an integer vector
21622159
21632160
.. SEEALSO::
2164-
2161+
21652162
:meth:`facet_constant`,
21662163
:meth:`facet_normal`,
21672164
:meth:`facet_normals`,
21682165
:meth:`facets`.
2169-
2166+
21702167
EXAMPLES:
21712168
21722169
For reflexive polytopes all constants are 1::
@@ -2207,23 +2204,23 @@ def facet_normal(self, i):
22072204
r"""
22082205
Return the inner normal to the ``i``-th facet of this polytope.
22092206
2210-
This is equivalent to ``facet_normals()[i]``
2207+
This is equivalent to ``facet_normals()[i]``.
22112208
22122209
INPUT:
22132210
2214-
- ``i`` -- integer, the index of the facet
2211+
- ``i`` -- integer; the index of the facet
22152212
22162213
OUTPUT:
22172214
22182215
- a vector
2219-
2216+
22202217
.. SEEALSO::
2221-
2218+
22222219
:meth:`facet_constant`,
22232220
:meth:`facet_constants`,
22242221
:meth:`facet_normals`,
22252222
:meth:`facets`.
2226-
2223+
22272224
EXAMPLES::
22282225
22292226
sage: o = lattice_polytope.cross_polytope(3)
@@ -2247,12 +2244,12 @@ def facet_normals(self):
22472244
:meth:`dual_lattice` of ``self``.
22482245
22492246
.. SEEALSO::
2250-
2247+
22512248
:meth:`facet_constant`,
22522249
:meth:`facet_constants`,
22532250
:meth:`facet_normal`,
22542251
:meth:`facets`.
2255-
2252+
22562253
EXAMPLES:
22572254
22582255
Normals to facets of an octahedron are vertices of a cube::

0 commit comments

Comments
 (0)