comparison roundup/configuration.py @ 7845:0c71ac9cdcd0

chore(lint): change class props from mutable lists to tuples A number of class props were lists [] which are mutable. Change them to tuples. Better performance and no change of getting the contents changed.
author John Rouillard <rouilj@ieee.org>
date Sat, 30 Mar 2024 21:48:17 -0400
parents b95474b23440
children 8b31893f5930
comparison
equal deleted inserted replaced
7844:b95474b23440 7845:0c71ac9cdcd0
403 403
404 404
405 class IsolationOption(Option): 405 class IsolationOption(Option):
406 """Database isolation levels""" 406 """Database isolation levels"""
407 407
408 allowed = ['read uncommitted', 'read committed', 'repeatable read', 408 allowed = ('read uncommitted', 'read committed', 'repeatable read',
409 'serializable'] 409 'serializable')
410 class_description = "Allowed values: %s" % ', '.join("'%s'" % a 410 class_description = "Allowed values: %s" % ', '.join("'%s'" % a
411 for a in allowed) 411 for a in allowed)
412 412
413 def str2value(self, value): 413 def str2value(self, value):
414 _val = value.lower() 414 _val = value.lower()
418 418
419 419
420 class IndexerOption(Option): 420 class IndexerOption(Option):
421 """Valid options for indexer""" 421 """Valid options for indexer"""
422 422
423 allowed = ['', 'xapian', 'whoosh', 'native', 'native-fts'] 423 allowed = ('', 'xapian', 'whoosh', 'native', 'native-fts')
424 class_description = "Allowed values: %s" % ', '.join("'%s'" % a 424 class_description = "Allowed values: %s" % ', '.join("'%s'" % a
425 for a in allowed) 425 for a in allowed)
426 426
427 # FIXME this is the result of running: 427 # FIXME this is the result of running:
428 # SELECT cfgname FROM pg_ts_config; 428 # SELECT cfgname FROM pg_ts_config;
429 # on a postgresql 14.1 server. 429 # on a postgresql 14.1 server.
430 # So the best we can do is hardcode this. 430 # So the best we can do is hardcode this.
431 valid_langs = ["simple", 431 valid_langs = ("simple",
432 "custom1", 432 "custom1",
433 "custom2", 433 "custom2",
434 "custom3", 434 "custom3",
435 "custom4", 435 "custom4",
436 "custom5", 436 "custom5",
459 "serbian", 459 "serbian",
460 "spanish", 460 "spanish",
461 "swedish", 461 "swedish",
462 "tamil", 462 "tamil",
463 "turkish", 463 "turkish",
464 "yiddish"] 464 "yiddish")
465 465
466 def str2value(self, value): 466 def str2value(self, value):
467 _val = value.lower() 467 _val = value.lower()
468 if _val in self.allowed: 468 if _val in self.allowed:
469 return _val 469 return _val
861 class SessiondbBackendOption(Option): 861 class SessiondbBackendOption(Option):
862 """Make sure that sessiondb is compatible with the primary db. 862 """Make sure that sessiondb is compatible with the primary db.
863 Fail with error and suggestions if they are incompatible. 863 Fail with error and suggestions if they are incompatible.
864 """ 864 """
865 865
866 compatibility_matrix = [ 866 compatibility_matrix = (
867 ('anydbm', 'anydbm'), 867 ('anydbm', 'anydbm'),
868 ('anydbm', 'redis'), 868 ('anydbm', 'redis'),
869 ('sqlite', 'anydbm'), 869 ('sqlite', 'anydbm'),
870 ('sqlite', 'sqlite'), 870 ('sqlite', 'sqlite'),
871 ('sqlite', 'redis'), 871 ('sqlite', 'redis'),
872 ('mysql', 'mysql'), 872 ('mysql', 'mysql'),
873 ('postgresql', 'postgresql'), 873 ('postgresql', 'postgresql'),
874 ] 874 )
875 875
876 def validate(self, options): 876 def validate(self, options):
877 ''' make sure session db is compatible with primary db. 877 ''' make sure session db is compatible with primary db.
878 also if redis is specified make sure it's available. 878 also if redis is specified make sure it's available.
879 suggest valid session db backends include redis if 879 suggest valid session db backends include redis if

Roundup Issue Tracker: http://roundup-tracker.org/