<commit_before># Copyright 2012 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from support import *
from constants import *
from json import loads, dumps
from base64 import b64encode
from urllib2 import Request, urlopen
from keyring import set_password, get_password
from os.path import expanduser, exists
from pickle import dump, load
from re import compile, IGNORECASE
from getpass import getpass

def login(args):
    base_uri = 'https://' + args.subdomain + '.harvestapp.com/'
    password = <PASSWORD>()
    auth = b64encode(args.username + ':' + password)
    uri = base_uri + 'account/who_am_i'
    request = Request(uri)
    request.add_header('Content-Type', 'application/json')
    request.add_header('Accept', 'application/json')
    request.add_header('Authorization', 'Basic ' + auth)
    request.add_header('User-Agent', 'reap')
    try:
        response = urlopen(request)
        set_password(base_uri, args.username, password)
        save_info(base_uri, args.username)
        print 'Success!'
    except:
        print 'Failure, check info and try again.'

def status(args):
    request = get_request('daily')
    if request:
        response = urlopen(request)
        json = loads(''.join([line for line in response.readlines()]))
        print '\nToday\'s Projects:'
        for entry in json['day_entries']:
            if entry.has_key('timer_started_at'):
                print '**Currently Running Timer**\n',
            hours = int(entry['hours'])
            minutes = int(entry['hours'] % 1 * 60)
            print str.format(STATUS_TASK_FORMAT, entry = entry, hours = hours, minutes = minutes)

def bookmark(args):
    bookmarks = load_bookmarks()
    bookmarks[args.name] = (args.projectid, args.taskid)<commit_msg>Added daily total time to status message.<commit_after># Copyright 2012 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from support import *
from constants import *
from json import loads, dumps
from base64 import b64encode
from urllib2 import Request, urlopen
from keyring import set_password, get_password
from os.path import expanduser, exists
from pickle import dump, load
from re import compile, IGNORECASE
from getpass import getpass

def login(args):
    base_uri = 'https://' + args.subdomain + '.harvestapp.com/'
    password = <PASSWORD>()
    auth = b64encode(args.username + ':' + password)
    uri = base_uri + 'account/who_am_i'
    request = Request(uri)
    request.add_header('Content-Type', 'application/json')
    request.add_header('Accept', 'application/json')
    request.add_header('Authorization', 'Basic ' + auth)
    request.add_header('User-Agent', 'reap')
    try:
        response = urlopen(request)
        set_password(base_uri, args.username, password)
        save_info(base_uri, args.username)
        print 'Success!'
    except:
        print 'Failure, check info and try again.'

def status(args):
    request = get_request('daily')
    if request:
        response = urlopen(request)
        json = loads(''.join([line for line in response.readlines()]))
        print '\nToday\'s Projects:'
        total = 0
        for entry in json['day_entries']:
            if entry.has_key('timer_started_at'):
                print '**Currently Running Timer**\n',
            total += entry['hours']
            hours = int(entry['hours'])
            minutes = int(entry['hours'] % 1 * 60)
            print str.format(STATUS_TASK_FORMAT, entry = entry, hours = hours, minutes = minutes)
        print str.format('Total Hours For Today: {hours}:{minutes:02d}\n', hours = int(total), minutes = int(total % 1 * 60))

def bookmark(args):
    bookmarks = load_bookmarks()
    bookmarks[args.name] = (args.projectid, args.taskid)
{'fraction_non_alphanumeric': 0.10750636132315522, 'fraction_numerical': 0.008905852417302799, 'mean_word_length': 3.4416195856873824, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3473658', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1315, 'n_words': 455}