existing.append(issue.title)

#print (existing)

for f in listdir(abstimmungs_dir):
    d = os.path.join(abstimmungs_dir, f)
    if os.path.isdir(d) and f.startswith('019'):
        abstimmungs_file = os.path.join(d, "index.md")
        if os.path.isfile(abstimmungs_file):
            #print (abstimmungs_file)
            abstimmung = Abstimmung()
            abstimmung.parse_abstimmung(abstimmungs_file)
            abst_key = "%03d-%02d" % (abstimmung.get_bundestagssitzung(),
                                      abstimmung.get_abstimmung())

            title = abstimmung.get_title().replace(
                "Abstimmung: ", "") + " (019-" + abst_key + ")"

            if title in existing:
                continue

            #print (abstimmung.get_title().replace ("Abstimmung: ", ""))

            print("creating ticket for " + title)

            text = "* Sitzung: " + str(
                abstimmung.get_bundestagssitzung()) + "\n\
* Abstimmung: " + str(abstimmung.get_abstimmung()) + "\n\
* Datum: " + str(abstimmung.get_datum()) + "\n\n\
### Ergebnis:\n\
\n\
Party | Ja | Nein | Enthaltungen | Ungültig | Nicht Abgegeben | Gesamt\n\
예제 #2
0
#!/usr/bin/env python3

abstimmungs_dir = '..'
import os
import re
import json
import sys
from os import listdir
from os.path import isfile, join
sys.path.append (abstimmungs_dir)
from abstimmungsparser import Abstimmung

pages = {}

for f in listdir (abstimmungs_dir):
  d = os.path.join (abstimmungs_dir, f)
  if os.path.isdir (d) and "-" in f and f[0] == '0':
    abstimmungs_file = os.path.join (d, "index.md")
    if os.path.isfile (abstimmungs_file):
      # abstimmung parsen und den titel ausgeben
      abstimmung = Abstimmung ()
      abstimmung.parse_abstimmung (abstimmungs_file)
      pages[f] =  ('* [' + abstimmung.get_title().replace ("Abstimmung: ", "") + ']('+f+'/) ('+str(abstimmung.get_bundestagssitzung())+'. Sitzung des '+str(abstimmung.get_legislaturperiode())+'. Deutschen Bundestages, '+abstimmung.get_datum()+')')


for key, value in sorted(pages.items(), key=lambda x: x[0], reverse=True):
  print (value)
  
예제 #3
0
import sys
sys.path.append(abstimmungs_dir)
from abstimmungsparser import Abstimmung

for subdir, dirs, files in os.walk(abstimmungs_dir):
    for directory in dirs:
        # abtimmungsverzeichnisse starten alle mit "018-"
        if "018-" in directory:
            # die abstimmungsdaten sind im file "index.md"
            abstimmungs_file = os.path.join(subdir, directory, "index.md")
            if os.path.isfile(abstimmungs_file):
                # abstimmung parsen und den titel ausgeben
                abstimmung = Abstimmung()
                abstimmung.parse_abstimmung(abstimmungs_file)
                preview = abstimmung.get_preview()

                # search for a date in the preview
                if preview:
                    m = re.search(
                        'am\s*\S+,\s*([0-9]{1,2}.)\s*(\S*)\s*(201[0-9])',
                        preview)
                    if (m):
                        # found a date -> explicitely set it
                        abstimmung.set_datum(
                            m.group(1) + " " + m.group(2) + " " + m.group(3))
                        abstimmung.write_abstimmung(abstimmungs_file)
                    else:
                        # did not find a date!?
                        print "did not find date for " + abstimmung.get_title(
                        ) + " (" + abstimmungs_file + ")"
예제 #4
0
for f in listdir(abstimmungs_dir):
    d = os.path.join(abstimmungs_dir, f)
    if os.path.isdir(d) and f.startswith('019'):
        abstimmungs_file = os.path.join(d, "index.md")
        if os.path.isfile(abstimmungs_file):
            # abstimmung parsen und den titel ausgeben
            abstimmung = Abstimmung()
            abstimmung.parse_abstimmung(abstimmungs_file)
            abst_key = "%03d-%02d" % (abstimmung.get_bundestagssitzung(),
                                      abstimmung.get_abstimmung())
            p = [
                abstimmung.get_bundestagssitzung(),
                abstimmung.get_abstimmung(),
                abstimmung.get_datum(),
                abstimmung.get_title().replace("Abstimmung: ", ""),
                "https://wahlbilanz.de/abstimmungen/019-" + abst_key
            ]
            ergebnisse = abstimmung.get_abstimmungs_ergebnisse()
            print(ergebnisse)
            for party in parties:
                p.append(
                    (ergebnisse[party]['ja'] - ergebnisse[party]['nein']) /
                    ergebnisse[party]['gesamt'])

            pages.append(p)
            # if (len (pages) > 5):
            # break

cols = ["Sitzung", "Abstimmung", "Datum", "Titel", "Link"]
for party in parties: