google.appengine.api.appinfo.EnvironmentVariables

Class representing a mapping of environment variable key/value pairs.

Inherits From: ValidatedDict, ValidatedBase, expected_type

**kwds keyword arguments will be validated and put into the dict.

Methods

CheckInitialized

View source

Checks for missing or conflicting attributes.

Subclasses should override this function and raise an exception for any errors. Always run this method when all assignments are complete.

Raises
ValidationError When there are missing or conflicting attributes.

GetValidator

View source

Check the key for validity and return a corresponding value validator.

Args
key The key that will correspond to the validator we are returning.

GetWarnings

View source

Return all the warnings we've got, along with their associated fields.

Returns
A list of tuples of (dotted_field, warning), both strings.

KEY_VALIDATOR

Regular expression validator.

Regular expression validator always converts value to string. Note that matches must be exact. Partial matches will not validate. For example:

class ClassDescr(Validated): ATTRIBUTES = { 'name': Regex(r'[a-zA-Z_][a-zA-Z_0-9]*'), 'parent': Type(type)` }

Alternatively, any attribute that is defined as a string is automatically interpreted to be of type Regex. It is possible to specify unicode regex strings as well. This approach is slightly less efficient, but usually is not significant unless parsing large amounts of data:

  class ClassDescr(Validated):
    ATTRIBUTES = { 'name': r'[a-zA-Z_][a-zA-Z_0-9]*',
                   'parent': Type(type),
                   }

  # This will raise a ValidationError exception.
  my_class(name='AName with space', parent=AnotherClass)

Merge

View source

Merges two EnvironmentVariables instances.

If a variable is specified by both instances, the value from env_variables_two is used.

Args
env_variables_one The first EnvironmentVariables instance or None.
env_variables_two The second EnvironmentVariables instance or None.

Returns
The merged EnvironmentVariables instance, or None if both input instances are None or empty.

Set

View source

Set a single value on Validated instance.

This method checks that a given key and value are valid and if so puts the item into this dictionary.

Args
key The name of the attributes.
value The value to set.

Raises
ValidationError When no validated attribute exists on class.

SetMultiple

View source

Set multiple values on Validated instance.

All attributes will be validated before being set.

Args
attributes A dict of attributes/items to set.

Raises
ValidationError When no validated attribute exists on class.

ToDict

View source

Convert ValidatedBase object to a dictionary.

Recursively traverses all of its elements and converts everything to simplified collections.

Subclasses should override this method.

Returns
A dictionary mapping all attributes to simple values or collections.

ToYAML

View source

Print validated object as simplified YAML.

Returns
Object as a simplified YAML string compatible with parsing using the SafeLoader.

clear

D.clear() -> None. Remove all items from D.

copy

D.copy() -> a shallow copy of D

fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Return the value for key if key is in the dictionary, else default.

items

D.items() -> a set-like object providing a view on D's items

keys

D.keys() -> a set-like object providing a view on D's keys

pop

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault

View source

Trap setdefaultss to ensure all key/value pairs are valid.

See the documentation for setdefault on dict for usage details.

Raises
ValidationError if the specified key is illegal or the value invalid.

update

View source

Trap updates to ensure all key/value pairs are valid.

See the documentation for update on dict for usage details.

Raises
ValidationError if any of the specified keys are illegal or values invalid.

values

D.values() -> an object providing a view on D's values

__contains__

True if the dictionary has the specified key, else False.

__eq__

Return self==value.

__ge__

Return self>=value.

__getitem__

x.getitem(y) <==> x[y]

__gt__

Return self>value.

__iter__

Implement iter(self).

__le__

Return self<=value.

__len__

Return len(self).

__lt__

Return self<value.

__ne__

Return self!=value.

__or__

Return self|value.

__ror__

Return value|self.