コード例 #1
0
ファイル: infoboard.py プロジェクト: FOSSRIT/infoboard
    # Resize files to 80px x 80px
    pixbuf = GdkPixbuf.Pixbuf.new_from_file(local_path)
    size = scale * 100
    pixbuf = pixbuf.scale_simple(size, size, GdkPixbuf.InterpType.BILINEAR)
    img = Gtk.Image.new_from_pixbuf(pixbuf)
    return img


def mk_label(text):
    label = Gtk.Label()
    label.set_markup(text)
    label.set_line_wrap(True)
    return label


if __name__ == "__main__":
    # Load conf file
    yaml_location = os.path.join(os.path.split(__file__)[0], 'settings.yaml')
    with open(yaml_location) as yaml_file:
        conf = yaml.load(yaml_file)

    # Set up Knowledge
    engine = create_engine(conf['db_uri'])
    init_model(engine)
    metadata.create_all(engine)

    win = InfoWin(conf)
    win.connect("delete-event", Gtk.main_quit)

    Gtk.main()
コード例 #2
0
ファイル: scraper.py プロジェクト: FOSSRIT/infoboard
                if not Entity.by_name(event['repo']):
                    client.repo_information(event['repo'])
        except:
            print("Something went wrong updating the events for {0}." \
                  .format(user['login']))
            continue


    print("You have {0} of {1} calls left this hour."
          .format(*client.rate_limiting))


if __name__ == '__main__':
    yaml_location = os.path.join(os.path.split(__file__)[0], 'settings.yaml')
    with open(yaml_location) as yaml_file:
        conf = yaml.load(yaml_file)

    # Set up Knowledge
    engine = create_engine(conf['db_uri'])
    init_model(engine)
    metadata.create_all(engine)

    if conf['user'] and conf['password']:
        client = Github((conf['user'], conf['password']))
    else:
        client = Github()

    while True:
        cache_events(client, conf['organization'])
        sleep(conf['interval'])
コード例 #3
0
ファイル: test.py プロジェクト: Qalthos/polyscraper
 def setUp(self):
     engine = create_engine('sqlite:///:memory:')
     init_model(engine)
     metadata.create_all(engine)
     PolyScraper().consume('http://www.data.gov/raw/994')
     self.entity = Entity.by_name('data.gov')
コード例 #4
0
ファイル: test_basic.py プロジェクト: FOSSRIT/knowledge
 def setUp(self):
     engine = create_engine('sqlite:///:memory:')
     init_model(engine)
     metadata.create_all(engine)