Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint alerts corrections as part of an intervention experiment 5 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions sync-sheet-on-org.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,29 +531,32 @@ def setup_program_session(info, relazioni, relatori):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))
elif kind == 'talk':
LOGGER.info(f"SETUP PROGRAM=: {label} TALK")
relatore = talk['author']
if relatore not in relazioni:
LOGGER.error(f"Relatore {relatore} non in RELAZIONI")
raise "RELATORE NON IN RELAZIONI"
intervento = relazioni[relatore]
D_relazioni.append((relatore, talk))
relatoreX = re.sub(r"\d","",relatore)
if relatoreX not in relatori:
LOGGER.error(f"Relatore {relatoreX} non in RELATORI")
raise "RELATOREX NON IN RELAZIONI"
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
if len(talk['altri'])>0:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))
else:
LOGGER.error(f"Relatore {altro} non in RELATORI")
raise "RELATORE NON IN RELAZIONI"
_handle_talk(relazioni, relatori, D_relazioni, D_relatori, label, talk)
LOGGER.info(f"SETUP PROGRAM SESSION/: {label}")
return session, D_relazioni, D_relatori

def _handle_talk(relazioni, relatori, D_relazioni, D_relatori, label, talk):
LOGGER.info(f"SETUP PROGRAM=: {label} TALK")
relatore = talk['author']
if relatore not in relazioni:
LOGGER.error(f"Relatore {relatore} non in RELAZIONI")
raise "RELATORE NON IN RELAZIONI"
intervento = relazioni[relatore]
D_relazioni.append((relatore, talk))
relatoreX = re.sub(r"\d","",relatore)
if relatoreX not in relatori:
LOGGER.error(f"Relatore {relatoreX} non in RELATORI")
raise "RELATOREX NON IN RELAZIONI"
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
if len(talk['altri'])>0:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))
else:
LOGGER.error(f"Relatore {altro} non in RELATORI")
raise "RELATORE NON IN RELAZIONI"


#### ---------------------------------------- READ FUNCTIONS

Expand Down
72 changes: 41 additions & 31 deletions sync-sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,22 +493,7 @@ def setup_program_session(info, relazioni, relatori):
D_relatori = list()
for label,talk in program:
kind = talk['kind']
line = []
for num, field in enumerate(('Ora','Durata','author', 'title')):
method = None
name = f'setup_{kind}_{field}'
if name in globals():
method = globals()[name]
else:
name = f'setup_{field}'
if name in globals():
method = globals()[name]
if method:
value = method(talk, relazioni, relatori)
else:
value = talk[field]
talk[f'OUT_{num:02d}_{field}'] = value
line.append(value)
line = _handle_fields(relazioni, relatori, talk, kind)
title = line.pop()
author = line.pop()
line.append('')
Expand All @@ -519,24 +504,49 @@ def setup_program_session(info, relazioni, relatori):
line[-1] += "</span>"
session.append('|'.join(line))
if kind == 'roundtable':
relatoreX = re.sub("\d","",relatore)
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))
_handle_round_table(relatori, D_relatori, talk)
elif kind == 'talk':
relatore = talk['author']
intervento = relazioni[relatore]
D_relazioni.append((relatore, talk))
relatoreX = re.sub("\d","",relatore)
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))
_handle_talk(relazioni, relatori, D_relazioni, D_relatori, talk)
return session, D_relazioni, D_relatori

def _handle_talk(relazioni, relatori, D_relazioni, D_relatori, talk):
relatore = talk['author']
intervento = relazioni[relatore]
D_relazioni.append((relatore, talk))
relatoreX = re.sub("\d","",relatore)
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))

def _handle_round_table(relatori, D_relatori, talk):
relatoreX = re.sub("\d","",relatore)
D_relatori.append((relatore, relatori[relatoreX] ))
if 'altri' in talk:
for altro in talk['altri'].split(','):
if altro in relatori:
D_relatori.append((altro,relatori[altro]))

def _handle_fields(relazioni, relatori, talk, kind):
line = []
for num, field in enumerate(('Ora','Durata','author', 'title')):
method = None
name = f'setup_{kind}_{field}'
if name in globals():
method = globals()[name]
else:
name = f'setup_{field}'
if name in globals():
method = globals()[name]
if method:
value = method(talk, relazioni, relatori)
else:
value = talk[field]
talk[f'OUT_{num:02d}_{field}'] = value
line.append(value)
return line


#### ---------------------------------------- READ FUNCTIONS

Expand Down