Skip to content

Commit

Permalink
Fix mutable default arguments, as recommend in http://docs.python-gui…
Browse files Browse the repository at this point in the history
  • Loading branch information
xcgspring committed Apr 17, 2015
1 parent 20db134 commit c2ef9ab
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
5 changes: 4 additions & 1 deletion AXUI/XML/XML_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
ScreenshotLocation=default_configs["screenshot_location"]
ScreenshotOnFailure=default_configs["screenshot_on_failure"]

def config(configs=default_configs):
def config(configs=None):
'''call back function used by config module
set the global variables according to configuration
'''
if configs is None:
configs = default_configs

global AppMapLocation
global SchemaLocation
global TimeOut
Expand Down
5 changes: 4 additions & 1 deletion AXUI/driver/config_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

DriverUsed = default_configs["driver_used"]

def config(configs=default_configs):
def config(configs=None):
'''callback function used by config module
'''
if configs is None:
configs = default_configs

global DriverUsed
DriverUsed=configs["driver_used"]

Expand Down
5 changes: 4 additions & 1 deletion AXUI/driver/windows_driver/UIElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def _unpack(flag, name, *args):
class Method(object):
'''Wrapper class for UIA pattern method
'''
def __init__(self, function_object, name, args_expected=[]):
def __init__(self, function_object, name, args_expected=None):
if args_expected is None:
args_expected = []

self.function_object = function_object
self.name = name
self.args = []
Expand Down
5 changes: 4 additions & 1 deletion AXUI/image/image_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
GenDiffImage=default_configs["gen_diff_image"]
DiffImageLocation=default_configs["diff_image_location"]

def config(configs=default_configs):
def config(configs=None):
'''call back function used by config module
set the global variables according to configuration
'''
if configs is None:
configs = default_configs

global GenDiffImage
global DiffImageLocation

Expand Down
5 changes: 4 additions & 1 deletion AXUI/logger/_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
logging_color_configs = {"TRUE":True,
"FALSE":False }

def config(configs=default_configs):
def config(configs=None):
'''config logger with settings in configure file
'''
if configs is None:
configs = default_configs

logger_name=configs["logger_name"]

if configs["logging_level_file"].upper() in logging_levels:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
version = "0.1.5",
description = "UI auto framework",
author = "xcgspring",
author_email = "xcgspring@gmail.com",
author_email = "xcgspring@163.com",
license = "Apache Licence Version 2.0",
url = "https://github.com/xcgspring/AXUI",
download_url = "",
keywords = ["UI", "auto"],
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 2",
"Development Status :: 2 - Pre-Alpha",
"Environment :: Console",
"Intended Audience :: Developers",
Expand Down

0 comments on commit c2ef9ab

Please sign in to comment.