Skip to content

Commit 8cb49eb

Browse files
committed
more cp_model.py typing
1 parent d667c69 commit 8cb49eb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ortools/sat/python/cp_model.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -398,33 +398,33 @@ def __abs__(self) -> NoReturn:
398398
"please use CpModel.add_abs_equality"
399399
)
400400

401-
def __add__(self, arg) -> LinearExprT:
401+
def __add__(self, arg: LinearExprT) -> LinearExprT:
402402
if cmh.is_zero(arg):
403403
return self
404404
return _Sum(self, arg)
405405

406-
def __radd__(self, arg) -> LinearExprT:
406+
def __radd__(self, arg: LinearExprT) -> LinearExprT:
407407
if cmh.is_zero(arg):
408408
return self
409409
return _Sum(self, arg)
410410

411-
def __sub__(self, arg) -> LinearExprT:
411+
def __sub__(self, arg: LinearExprT) -> LinearExprT:
412412
if cmh.is_zero(arg):
413413
return self
414414
return _Sum(self, -arg)
415415

416-
def __rsub__(self, arg) -> LinearExprT:
416+
def __rsub__(self, arg: LinearExprT) -> LinearExprT:
417417
return _Sum(-self, arg)
418418

419-
def __mul__(self, arg) -> LinearExprT:
419+
def __mul__(self, arg: LinearExprT) -> LinearExprT:
420420
arg = cmh.assert_is_a_number(arg)
421421
if cmh.is_one(arg):
422422
return self
423423
elif cmh.is_zero(arg):
424424
return 0
425425
return _ProductCst(self, arg)
426426

427-
def __rmul__(self, arg) -> LinearExprT:
427+
def __rmul__(self, arg: LinearExprT) -> LinearExprT:
428428
arg = cmh.assert_is_a_number(arg)
429429
if cmh.is_one(arg):
430430
return self
@@ -492,7 +492,7 @@ def __bool__(self) -> NoReturn:
492492
"Evaluating a LinearExpr instance as a Boolean is not implemented."
493493
)
494494

495-
def __eq__(self, arg) -> BoundedLinearExprT:
495+
def __eq__(self, arg: LinearExprT) -> BoundedLinearExprT:
496496
if arg is None:
497497
return False
498498
if cmh.is_integral(arg):
@@ -501,21 +501,21 @@ def __eq__(self, arg) -> BoundedLinearExprT:
501501
else:
502502
return BoundedLinearExpression(self - arg, [0, 0])
503503

504-
def __ge__(self, arg) -> BoundedLinearExprT:
504+
def __ge__(self, arg: LinearExprT) -> BoundedLinearExprT:
505505
if cmh.is_integral(arg):
506506
arg = cmh.assert_is_int64(arg)
507507
return BoundedLinearExpression(self, [arg, INT_MAX])
508508
else:
509509
return BoundedLinearExpression(self - arg, [0, INT_MAX])
510510

511-
def __le__(self, arg) -> BoundedLinearExprT:
511+
def __le__(self, arg: LinearExprT) -> BoundedLinearExprT:
512512
if cmh.is_integral(arg):
513513
arg = cmh.assert_is_int64(arg)
514514
return BoundedLinearExpression(self, [INT_MIN, arg])
515515
else:
516516
return BoundedLinearExpression(self - arg, [INT_MIN, 0])
517517

518-
def __lt__(self, arg) -> BoundedLinearExprT:
518+
def __lt__(self, arg: LinearExprT) -> BoundedLinearExprT:
519519
if cmh.is_integral(arg):
520520
arg = cmh.assert_is_int64(arg)
521521
if arg == INT_MIN:
@@ -524,7 +524,7 @@ def __lt__(self, arg) -> BoundedLinearExprT:
524524
else:
525525
return BoundedLinearExpression(self - arg, [INT_MIN, -1])
526526

527-
def __gt__(self, arg) -> BoundedLinearExprT:
527+
def __gt__(self, arg: LinearExprT) -> BoundedLinearExprT:
528528
if cmh.is_integral(arg):
529529
arg = cmh.assert_is_int64(arg)
530530
if arg == INT_MAX:
@@ -533,7 +533,7 @@ def __gt__(self, arg) -> BoundedLinearExprT:
533533
else:
534534
return BoundedLinearExpression(self - arg, [1, INT_MAX])
535535

536-
def __ne__(self, arg) -> BoundedLinearExprT:
536+
def __ne__(self, arg: LinearExprT) -> BoundedLinearExprT:
537537
if arg is None:
538538
return True
539539
if cmh.is_integral(arg):

0 commit comments

Comments
 (0)