Merge Christoph Holtermann's 'PR-python2to3' into maint.

This commit is contained in:
John Ralls 2019-04-14 14:24:16 -07:00
commit 8823f7283f
14 changed files with 19 additions and 19 deletions

View File

@ -117,7 +117,7 @@ def next_period_start(start_year, start_month, period_type):
def period_end(start_year, start_month, period_type): def period_end(start_year, start_month, period_type):
if period_type not in PERIODS: if period_type not in PERIODS:
raise Exception("%s is not a valid period, should be %s" % ( raise Exception("%s is not a valid period, should be %s" % (
period_type, str(PERIODS.keys()) ) ) period_type, str(list(PERIODS.keys())) ) )
end_year, end_month = next_period_start(start_year, start_month, end_year, end_month = next_period_start(start_year, start_month,
period_type) period_type)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python3
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
##@file ##@file

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
##@file ##@file

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# new_book_with_opening_balances.py -- Replicate the account structure of a # new_book_with_opening_balances.py -- Replicate the account structure of a
# book and apply basis opening balances from the original # book and apply basis opening balances from the original
@ -334,7 +334,7 @@ def main():
simple_opening_name_used = False simple_opening_name_used = False
for (namespace, mnemonic), (opening_trans, opening_amount) in \ for (namespace, mnemonic), (opening_trans, opening_amount) in \
opening_balance_per_currency.iteritems() : opening_balance_per_currency.items() :
simple_opening_name_used = create_opening_balance_transaction( simple_opening_name_used = create_opening_balance_transaction(
commodtable, namespace, mnemonic, commodtable, namespace, mnemonic,
new_book_root, new_book, new_book_root, new_book,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Test file for price database stuff # Test file for price database stuff
# To update the price database call # To update the price database call
# $PATH/gnucash --add-price-quotes $PATHTOFILE # $PATH/gnucash --add-price-quotes $PATHTOFILE

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# Another test file for price database stuff # Another test file for price database stuff
# To update the price database call # To update the price database call
# $PATH/gnucash --add-price-quotes $PATHTOFILE # $PATH/gnucash --add-price-quotes $PATHTOFILE

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# quotes_historic.py -- Example Script to read historic quote data into gnucash # quotes_historic.py -- Example Script to read historic quote data into gnucash
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python3
''' '''
@ -843,7 +843,7 @@ def getSubAccounts(account):
flat_accounts = [] flat_accounts = []
if 'subaccounts' in account.keys(): if 'subaccounts' in list(account.keys()):
for n, subaccount in enumerate(account['subaccounts']): for n, subaccount in enumerate(account['subaccounts']):
flat_accounts.append(subaccount) flat_accounts.append(subaccount)
flat_accounts = flat_accounts + getSubAccounts(subaccount) flat_accounts = flat_accounts + getSubAccounts(subaccount)
@ -1824,7 +1824,7 @@ def gnc_numeric_from_decimal(decimal_value):
numerator_place_value = 1 numerator_place_value = 1
# add each digit to the final value multiplied by the place value # add each digit to the final value multiplied by the place value
# from least significant to most sigificant # from least significant to most sigificant
for i in xrange(len(digits)-1,-1,-1): for i in range(len(digits)-1,-1,-1):
numerator += digits[i] * numerator_place_value numerator += digits[i] * numerator_place_value
numerator_place_value *= TEN numerator_place_value *= TEN

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
## @file ## @file
# @brief Simple example for a book # @brief Simple example for a book

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# simple_business_create.py -- Set up a set of books for business feature use # simple_business_create.py -- Set up a set of books for business feature use
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# simple_invoice_insert.py -- Add an invoice to a set of books # simple_invoice_insert.py -- Add an invoice to a set of books
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
## @file ## @file
# @brief Example Script simple session # @brief Example Script simple session
# @ingroup python_bindings_examples # @ingroup python_bindings_examples
@ -14,7 +14,7 @@ FILE_2 = "/tmp/example_file.xac"
session = None session = None
try: try:
session = Session(FILE_1) session = Session(FILE_1)
except GnuCashBackendException, backend_exception: except GnuCashBackendException as backend_exception:
assert( ERR_FILEIO_FILE_NOT_FOUND in backend_exception.errors) assert( ERR_FILEIO_FILE_NOT_FOUND in backend_exception.errors)
@ -28,7 +28,7 @@ session.destroy()
session = Session(FILE_2) session = Session(FILE_2)
try: try:
session_2 = Session(FILE_2) session_2 = Session(FILE_2)
except GnuCashBackendException, backend_exception: except GnuCashBackendException as backend_exception:
assert( ERR_BACKEND_LOCKED in backend_exception.errors ) assert( ERR_BACKEND_LOCKED in backend_exception.errors )
session.end() session.end()
session.destroy() session.destroy()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
## @file ## @file
# @brief Example Script simple sqlite create # @brief Example Script simple sqlite create
# @ingroup python_bindings_examples # @ingroup python_bindings_examples

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
## @file ## @file
# @brief Creates a basic set of accounts and a couple of transactions # @brief Creates a basic set of accounts and a couple of transactions
# @ingroup python_bindings_examples # @ingroup python_bindings_examples