Example #1
0
 def updateWebProjects(self):
     if self.args.web:
         self.cache.update()  # throw out the old stuff
         self.web_projects = browser.getProjectsDict(self.CONFIG, self.cache)
         self.verbosePrintProject("WEB", self.web_projects)
         project.merge(self.local_projects, self.web_projects)
     else:
         self.web_projects = self.local_projects  # so that it gets printed
Example #2
0
def test():
    """
    sets up and tests functions from project.py using
    assert_equals and print functions
    """
    # setting up data
    female = pd.read_csv('test_women.csv')
    male = pd.read_csv('test_men.csv')
    # cleans and saves data depending on time use
    mp = clean_data_paid(male, 'Men')
    fp = clean_data_paid(female, 'Women')
    # merges data
    data = merge(mp, fp)
    # set up for breakdown_work_gender
    bwg = {'Gender': ['Male', 'Female'],
           'Mean Unpaid Hours': [2, 4.8],
           'Mean Paid Hours': [5, 2.4]}
    manualbwg = pd.DataFrame(bwg)
    testingbwg = breakdown_work_gender(data)
    # set up for difference_in_hours_country
    dhc = {'Country': ['Country1'],
           'Mean Difference in Unpaid Hours (f-m)': [2.5],
           'Mean Difference in Paid Hours (f-m)': [-4.0]}
    manualdhc = pd.DataFrame(dhc)
    testingdhc = difference_in_hours_country(data, 'Country1')
    # testing breakdown_work_gender
    assert_equals(True, manualbwg.equals(testingbwg))
    # testing difference_in_hours_country
    assert_equals(True, manualdhc.equals(testingdhc))
    # testing child labor manually
    # should print 'Country3' and 'Country5'
    # with ages 5 and 10 respectively
    print(child_labor(data))
Example #3
0
def main():
    """
    runs all functions in main.py to find how relevant
    the disparity in paid and unpaid hours is by gender.
    """
    female = pd.read_csv('women_data.csv')
    male = pd.read_csv('men_data.csv')
    # cleans and saves data depending on time use
    mp = clean_data_paid(male, 'Men')
    fp = clean_data_paid(female, 'Women')
    mu = clean_data_unpaid(male, 'Men')
    fu = clean_data_unpaid(female, 'Women')
    # merges data
    data = merge(mp, fp)
    # finds breakdown of work based on gender using
    # merged data
    print(breakdown_work_gender(data))
    # finds the difference hours (f-m) of time use
    # based on country (Belgium and USA)
    print(difference_in_hours_country(data, 'Belgium'))
    print(difference_in_hours_country(data, 'United States of America'))
    print(difference_in_hours_country(data, 'Cuba'))
    # returns a series indicating countries which have child labor
    # including the youngest working age
    print(child_labor(data))
    # plots change in hours of time use over the years based on
    # indicated gender and country
    plot_change_in_time(fp, fu, 'Women', 'Chile')
    plot_change_in_time(mp, mu, 'Men', 'Canada')
    plot_change_in_time(fp, fu, 'Women', 'United States of America')
    plot_change_in_time(mp, mu, 'Men', 'Finland')
Example #4
0
    import boinccmd

    local_projects = boinccmd.get_state()
    print 'LOCAL'
    project.pretty_print(local_projects)

    CONFIG, CACHE_DIR, _ = config.set_globals()
    cache = browser.Browser_file(CACHE_DIR)
    b = browser.BrowserSuper(cache)

    # web_p = browser.getProject('worldcommunitygrid.org', CONFIG, cache)
    # web_projects = dict()
    # web_projects[web_p.url] = web_p
    web_projects = browser.getProjectsDict(CONFIG, cache)

    wuprop_projects = browser.getProjects_wuprop(CONFIG, cache)
    print 'WUPROP'
    project.pretty_print(wuprop_projects, show_empty=True)
    
    project.mergeWuprop(wuprop_projects, local_projects)
    project.merge(local_projects, web_projects)
    print 'MERGED'
    project.pretty_print(web_projects, show_empty=True)
    #project.pretty_print(local_projects, show_empty=True)
    
    fig1 = plt.figure()
    fig2 = plt.figure()

    plotAll(fig1, fig2, web_projects, b)
    raw_input('=== Press enter to exit ===\n')