From c3953449ffcd3c65cfb96c2d7d8ec4158fe4a4b1 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Tue, 27 Jun 2017 23:49:52 +0200 Subject: [PATCH] improve module --- src/JobShopParser/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/JobShopParser/__init__.py b/src/JobShopParser/__init__.py index 40615f6..b407706 100644 --- a/src/JobShopParser/__init__.py +++ b/src/JobShopParser/__init__.py @@ -1,6 +1,8 @@ from typing import List, Tuple, Sequence, Optional, Union import arpeggio +__all__ = ["jobshop1_parser", "jobshop2_parser"] + grammar = """ # starting point for jobshop1 input file job_shop1 = skip_preface @@ -78,7 +80,7 @@ class JobShopVisitor(arpeggio.PTNodeVisitor): if len(job_numbers) % 2 ==1: raise ParseError("Odd number of numbers in job data") # returns list of (duration, machine) tuples - return list(zip(job_numbers[1::2], job_numbers[0::2])) + return list(zip(job_numbers[1::2], job_numbers[0::2])) # [::2] returns only every second element of the list def visit_problem_data(self, node: arpeggio.ParseTreeNode, children: arpeggio.SemanticActionResults) -> JobShopProblem: if self.debug: