Skip to content

Commit

Permalink
#6 Code rafactoring: formatted output
Browse files Browse the repository at this point in the history
  • Loading branch information
RozeQz committed Dec 8, 2022
1 parent c6c7312 commit e49f9ef
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ def output(self):
binary = self.create_binary_relation()

if binary.is_reflexive():
self.lbl_reflex.setText(" • Рефлексивно!")
reflex_text = "Рефлексивно"
elif binary.is_irreflexive():
self.lbl_reflex.setText(" • Иррефлексивно!")
reflex_text = "Иррефлексивно"
else:
self.lbl_reflex.setText(" • Нерефлексивно!")

self.lbl_symm.setText(
" • Симметрично!") if binary.is_symmetrical() else self.lbl_symm.setText(
" • Несимметрично!")
self.lbl_trans.setText(
" • Транзитивно!") if binary.is_transitive() else self.lbl_trans.setText(
" • Нетранзитивно!")
self.lbl_antisym.setText(
" • Антисимметрично!") if binary.is_antisymm() else self.lbl_antisym.setText(
" • Не антисимметрично!")
reflex_text = "Нерефлексивно"
self.lbl_reflex.setText(f" • {reflex_text}!")

symm_text = "Симметрично" if binary.is_symmetrical() else "Несимметрично"
self.lbl_symm.setText(f" • {symm_text}!")

trans_text = "Транзитивно" if binary.is_transitive() else "Нетранзитивно"
self.lbl_trans.setText(f" • {trans_text}!")

antisymm_text = "Антисимметрично" if binary.is_antisymm() else "Не антисимметрично"
self.lbl_antisym.setText(f" • {antisymm_text}!")

if binary.is_order():
hd = self.create_diagram(binary)
Expand Down Expand Up @@ -128,7 +128,7 @@ def button_click(self):
self.output()

def create_binary_relation(self) -> BinaryRelation:
return BinaryRelation(self.input()[0], self.input()[1])
return BinaryRelation(*self.input())

def input(self) -> list: # Ввод данных
rubbish_text = re.sub(r'\([^()]*\)', '', self.edt_setR.toPlainText())
Expand Down Expand Up @@ -178,7 +178,7 @@ def create_random_binary_relation(self) -> BinaryRelation:
for i in range(1, num_A + 1):
A.append(i)

num_R = random.randrange(5, 10)
num_R = random.randrange(7, 12)
for i in range(num_R):
first = random.choice(A)
second = random.choice(A)
Expand Down

0 comments on commit e49f9ef

Please sign in to comment.