<commit_before>#!/usr/bin/env python

# This script records inventory events (creation of mechanically assembled radios,
# removal of mechanical components from inventory stores) in The Public Radio's
# inventory management spreadsheet on Google Sheets.
#
# It takes in:
#	* Operation (mechanical assembly created OR order fulfilled)
#	* Username (just a string)


import gspread
import time
import os
import sys
from oauth2client.service_account import ServiceAccountCredentials

if (len(sys.argv) == '4'):
	print 'three'
	username = sys.argv[4]
elif (len(sys.argv) == '3'):
	print 'two'
	username = os.getusername()
else:
	print 'ERROR - wrong number of arguments.'
	print 'Usage: $ inventory_event.py <event> <username>'

print username

scope = ['https://spreadsheets.google.com/feeds']

credentials = ServiceAccountCredentials.from_json_keyfile_name('/home/pi/tpr-inv.json', scope)


c = gspread.authorize(credentials)
spreadsheet = c.open('PR9450 Part Usage')
print spreadsheet
worksheet = spreadsheet.worksheet("PR9027") 
print worksheet

print worksheet.acell('A2').value
row_to_add = ['foo', 'foo', 'three']
worksheet.append_row(["A", "B", "C"])<commit_msg>numbers?<commit_after>#!/usr/bin/env python

# This script records inventory events (creation of mechanically assembled radios,
# removal of mechanical components from inventory stores) in The Public Radio's
# inventory management spreadsheet on Google Sheets.
#
# It takes in:
#	* Operation (mechanical assembly created OR order fulfilled)
#	* Username (just a string)


import gspread
import time
import os
import sys
from oauth2client.service_account import ServiceAccountCredentials

if (len(sys.argv) == 4):
	print 'three'
	username = sys.argv[4]
elif (len(sys.argv) == 3):
	print 'two'
	username = os.getusername()
else:
	print 'ERROR - wrong number of arguments.'
	print 'Usage: $ inventory_event.py <event> <username>'

print username

scope = ['https://spreadsheets.google.com/feeds']

credentials = ServiceAccountCredentials.from_json_keyfile_name('/home/pi/tpr-inv.json', scope)


c = gspread.authorize(credentials)
spreadsheet = c.open('PR9450 Part Usage')
print spreadsheet
worksheet = spreadsheet.worksheet("PR9027") 
print worksheet

print worksheet.acell('A2').value
row_to_add = ['foo', 'foo', 'three']
worksheet.append_row(["A", "B", "C"])
{'fraction_non_alphanumeric': 0.12182522600086096, 'fraction_numerical': 0.011192423590185106, 'mean_word_length': 5.621082621082621, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '305877', 'n_tokens_mistral': 753, 'n_tokens_neox': 709, 'n_words': 217}