intersect with all numbers at right position in code
This commit is contained in:
parent
44b299ad70
commit
187e6ab3b8
1 changed files with 4 additions and 4 deletions
|
@ -84,19 +84,19 @@ class Lectures(list):
|
||||||
return self[-1].number - 1
|
return self[-1].number - 1
|
||||||
|
|
||||||
def parse_range_string_section(self, arg):
|
def parse_range_string_section(self, arg):
|
||||||
all_numbers = [lecture.number for lecture in self]
|
|
||||||
if 'all' in arg:
|
if 'all' in arg:
|
||||||
return all_numbers
|
return [lecture.number for lecture in self]
|
||||||
|
|
||||||
if '-' in arg:
|
if '-' in arg:
|
||||||
start, end = [self.parse_lecture_spec(bit) for bit in arg.split('-')]
|
start, end = [self.parse_lecture_spec(bit) for bit in arg.split('-')]
|
||||||
return list(set(all_numbers) & set(range(start, end + 1)))
|
return list(range(start, end + 1))
|
||||||
|
|
||||||
return [self.parse_lecture_spec(arg)]
|
return [self.parse_lecture_spec(arg)]
|
||||||
|
|
||||||
def parse_range_string(self, arg):
|
def parse_range_string(self, arg):
|
||||||
|
all_numbers = [lecture.number for lecture in self]
|
||||||
sets = [set(self.parse_range_string_section(part)) for part in arg.split(',')]
|
sets = [set(self.parse_range_string_section(part)) for part in arg.split(',')]
|
||||||
return list(set.union(*sets))
|
return list(set.union(*sets) & set(all_numbers))
|
||||||
|
|
||||||
def new_lecture(self):
|
def new_lecture(self):
|
||||||
if len(self) != 0:
|
if len(self) != 0:
|
||||||
|
|
Loading…
Reference in a new issue