from threading import local into default name space. import module warnings. from django.conf import settings into default name space. from django.core import signals into default name space. from django.core.cache.backends.base import InvalidCacheBackendError, CacheKeyWarning and BaseCache into default name space. from django.core.exceptions import ImproperlyConfigured into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. from django.utils.module_loading import import_string into default name space. __all__ is an list containing 6 elements: 'get_cache', 'cache', 'DEFAULT_CACHE_ALIAS', 'InvalidCacheBackendError', 'CacheKeyWarning' and 'BaseCache' DEFAULT_CACHE_ALIAS is a string 'default'. if DEFAULT_CACHE_ALIAS is not contained in settings.CACHES, raise an exception ImproperlyConfigured with string "You must define a '%s' cache" as argument, with '%s' replaced with DEFAULT_CACHE_ALIAS converted into a string. define the function get_cache with backend and dictionary pair of elements kwargs as arguments. call the function warnings.warn with string "'get_cache' is deprecated in favor of 'caches'.", RemovedInDjango19Warning, and stacklevel set to 2 as arguments. call the _create_cache with backend and dictionary kwargs as arguments, substitute the result for cache. call the function signals.request_finished.connect with argument cache.close. return cache. define the function _create_cache with backend and dictionary pair of elements kwargs as arguments. try, try, substitute value under the backend key of settings.CACHES dictionary for conf. if KeyError exception is caught, try, call the function import_string with argument backend. if ImportError, renamed to e, exception is caught, raise and exception InvalidCacheBackendError with string "Could not find backend '%s': %s" as argument, replace '%s' with backend and e, respectively. remove 'LOCATION' key from kwargs dictionary and put it into location, or use an empty string if key doesnt exists. substitute kwargs for params. if not, call the function conf.copy, substitute it for params. call the function params.update with argument kwargs. remove 'BACKEND' key from params dictionary and put it into backend. remove 'LOCATION' key from kwargs dictionary and put it into location, or use an empty string if key doesnt exists. call the import_string with argument backend, substitute it for backend_cls. if ImportError, renamed to e, is caught, aise and exception InvalidCacheBackendError with string "Could not find backend '%s': %s" as argument, replace '%s' with backend and e, respectively. evaluate the function backend_cls with location and params as arguments, return the result. derive the class CacheHandler from the object base class. define the __init__ method with argument self. call the function local, substitute the result for self._caches. define the __getitem__ method with self and alias arguments. try, return value under the alias key of self._caches.caches dictionary. except if AttributeError is caught, self._caches.caches is an empty dictionary. except if KeyError exception is caught, do nothing. if alias is not contained in setting.CACHES, raise and exception InvalidCacheBackendError with string "Could not find config for '%s' in settings.CACHES" as argument, replace '%s' with alias. call the function _create_cache with argument alias. substitute cache for value under the alias key of self._caches.caches dictionary. reuturn cache. define the method all with argument self. get attribute 'caches' from the self._caches if exists, otherwise get an empty dictionary, call the values method on the return value, return it. call the CacheHandler function, substitute the result for caches. derive the class DefaultCacheProxy from the base class object. define the method __getattr__ with self and name as arguments. get attribute name from value under the DEFAULT_CACHE_ALIAS key of caches dictionary, return it. define the method __setattr__ with self, name and value as arguments. set the attribute name from value under the DEFAULT_CACHE_ALIAS key of caches dictionary to value, return it. define the method __delattr__ with self and name as arguments. delete the attribute name from the cache dictionary under the DEFAULT_CACHE_ALIAS key. define the method __contains__ with self and key as arguments. if key if contained in value under the DEFAULT_CACHE_ALIAS key of caches dictionary, return boolean True, otherwise return False. define the method __eq__ with self and other as arguments. if value under the DEFAULT_CACHE_ALIAS key of caches dictionary equals to other, return boolean True, otherwise return False. define the method __ne__ with self and other as arguments. if value under the DEFAULT_CACHE_ALIAS key of caches dictionary is not equal to other, return boolean True, otherwise return False. call the DefaultCacheProxy function, substitute it for cache. define the function close_caches with dictionary pair of elements kwargs as argument. for every cache in return value of the function caches.all. call the function cache.close. call the function signals.request_finished.connect with argument close_caches. from __future__ import unicode_literals into default name space. import module time. import module warnings. from django.core.exceptions import ImproperlyConfigured and DjangoRuntimeWarning into default name space. from django.utils.module_loading import import_string into default name space. derive class InvalidCacheBackendError from the ImproperlyConfigured base class. do nothing. derive class CacheKeyWarning from the DjangoRuntimeWarning base class. do nothing. DEFAULT_TIMEOUT is a instance of the class object. MEMCACHE_MAX_KEY_LENGTH is integer 250. define the function default_key_func with 3 arguments, key, key_prefix and version. convert key_prefix, version and key into strings, concatenate them respectively, with character ':' as delimiter, return the result. define the function get_key_func with argument key_func. if key_func is not of None type, if key_function is callable object, return key_func. if not, evaluate the function import_string with key_func as argument, return the result. return default_key_func. derive the class BaseCache from the object base class. define the initialization function __init__ with self class instance and params as arguments. call the params.get method with string 'TIMEOUT' and integer 300 as arguments, use the string 'timeout' and previous result as the arguments for the call to the params.get method, substitute the result for timeout. if timeout is not None, try, convert timeout into an integer. if ValueError or TypeError exceptions occurred, timeout is integer 300. substitute timeout for self.default_timeout. call the params.get with string 'OPTIONS' and empty dictionary as arguments, substitute the result for options. call the options.get method with string 'MAX_ENTRIES' and integer 300 as arguments, use the string 'max_entries' and previous result as the arguments for the call to the params.get method, substitute the result for max_entries. try, convert max_entries into a string, substitute it for self._max_entries. if ValueError or TypeError exceptions occurred, self._max_entries is integer 300. call the options.get method with string 'CULL_FREQUENCY' and integer 3 as arguments, use the string 'cull_frequency' and previous result as the arguments for the call to the params.get method, substitute the result for cull_frequency. try, convert cull_frequency into an integer and substitute it for self._cull_frequency. if ValueError or TypeError exceptions occurred, self._cull_frequency is integer 3. call the params.get method with string 'KEY_PREFIX' and an empty string as arguments, substitute the result for self._key_prefix. call the params.get method wit string 'VERSION' and integer 1 as arguments, substitute the result for self.version. call the method params.get with 2 arguments, string 'KEY_FUNCTION' and None, use the result as the argument for the call to the function get_key_func, substitute the result for the self.key_func. define the method get_backend_timeout with self class instance and timeout set to DEFAULT_TIMEOUT as arguments, if timeout equals to DEFAULT_TIMEOUT, substitute self.default_timeout for timeout. else if timeout equals to integer 0, timeout is a integer -1. if timeouts is None return None, otherwise return the sum of function time.time return value and timeout. define the function make_key with self class instance, key and version set to None as arguments. if version is None, substitute self.version for version. call the method self.key_function with key, self.key_prefix and version as arguments, substitute the result for new_key. return new_key. define the method add with 5 arguments, self, key, value, timeout defaulting to DEFAULT_TIMEOUT and version defaulting to None. docsring raise an exception of class NotImplementedError with string 'subclasses of BaseCache must provide an add() method' as argument. define the method get with 4 arguments, self, key, default set to None and version set to None. raise an exception of class NotImplementedError, with string 'subclasses of BaseCache must provide a get() method' as argument. define the method set with 5 arguments, self, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. raise an exception of class NotImplementedError, with string 'subclasses of BaseCache must provide a set() method' as argument. define delete method with self class instance, key and version set to None, as arguments. raise an exception of class NotImplementedError, with string 'subclasses of BaseCache must provide a delete() method' as argument. define the get_many method with self class instance, keys and version set to None as arguments. d is an empty dictionary. for every k in keys, call the self.get method with k and version set to version as arguments, substitute the result for val. if val is not None, substitute val for value under the k key of dictionary d. return d. define method has_key with self class instance, key and version set to None as arguments. call the self.get method with key and version set to version as arguments, return it if it is not None. define the method incr with 4 arguments, self class instance, key, delta defaulting to integer 1 and version defaulting to None. call the method self.get with key and version set to version as arguments, substitute the result for value. if value is None, raise an exception of class ValueError, with string "Key '%s' not found" as argument, where '%s' is substituted for key. add value and delta together, substitute the result for new_value. call the self.set method with key, new_value and version set to version as arguments. return new_value. define the method decr with arguments self, key, delta defaulting to integer 1 and version defaulting to None. call the self.incr method with key, negative delta and version set to version as arguments. define the private method __contains__ with self class instance and key as arguments. evaluate the self.has_key method with key as argument, return the result. define the method set_many with arguments, self, data, timeout defaulting to DEFAULT_TIMEOUT and version set to None. for every key and value in data.items method return value, call the method self.set with arguments key, value, timeout set to timeout, version set to version. define the method delete_many with arguments self, keys and version defaulting to None. for every key in keys, call the delete method with key and version set to version as arguments. define the method clear with self class instance as the argument, raise an exception NotImplementedError with string 'subclasses of BaseCache must provide a clear() method' as argument. define the method validate_key with self class instance and key as arguments. if length of key is greater than MEMCACHE_MAX_KEY_LENGTH, substitute '%s' in string 'Cache key will cause errors if used with memcached: %s (longer than %s)' with key, and MEMCACHE_MAX_KEY_LENGTH, call the function warnings.warn with previous string and CacheKeyWarning as arguments. for every char in key, if ascii value of char is smaller than integer 33 or is equal to integer 127, substitute '%r' in string 'Cache key contains characters that will cause errors if used with memcached: %r' with key, call the function warnings.warn with previous string and CacheKeyWarning as arguments. define the method incr_version with 4 arguments, self, key, delta defaulting to integer 1 and version defaulting to None. if version is None, substitute self.version for version. call the self.get method with arguments key and version set to version, substitute the result for value. if value is None, raise an exception of the class ValueError with string "Key '%s' not found" as argument, '%s' is substituted for key. call the method self.set with key, value, version incremented by delta, as arguments. call the self.delete method with key and version set to version as arguments. sum version and delta together, return the result. define the method decr_version with 4 arguments, self, key, delta defaulting to integer 1 and version defaulting to None. call the method self.incr_version with key, negative delta and version as arguments. define the close method with 2 arguments, self and dictionary of argument pairs kwargs. docstirng do nothing. import module base64. from datetime import datetime into default name space. try, from django.utils.six.moves import cPickle as pickle, into default namespace. if ImportError exception occurred, import pickle. from django.conf import settings into default name space. from django.core.cache.backends.base import BaseCache and DEFAULT_TIMEOUT into default name space. from django.db import connections, transaction, router and DatabaseError into default name space. from django.db.backends.utils import typecast_timestamp into default name space. from django.utils import timezone and six into default name space. from django.utils.encoding import force_bytes into default name space. derive class Options from the base class object. define the initialization method __init__ with self class instance and table as arguments. substitute table for self.db_table. self.app_label is a string 'django_cache'. self.model_name is a string 'cacheentry'. self.verbose_name is a string 'cache entry'. self.verbose_name_plural is a string 'cache entries'. self.object_name is a string 'CacheEntry'. self.abstract is boolean False. self.managed is boolean True. self.proxy is boolean False. derive class BaseDatabaseCache from BaseCache base class. define the initialization method __init__ with self, table and params as arguments. call the BaseCache.__init__ method with self class instance and params as the arguments. substitute table for self._table. derive CacheEntry class from the object base class. _meta is class Options class instance initialized with table argument. substitute CacheEntry for self.cache_model_class. derive DatabaseCache from the BaseDatabaseCache base class. define the method get with 4 arguments, self class instance, key, default set to None and version set to None. call the method self.make_key Whit key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the method router.db_for_read with self.cache_model_class as argument, substitute the result for db. call the ops.quote_name method with argument self._table on the value under the db key of connections dictionary, substitute the result for table. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "SELECT cache_key, value, expires FROM %s WHERE cache_key = %%s" as argument, substitute the '%s' with table and list containing key, respectively. call the cursor.fetchone method, substitute the result for row. if row is None, return default. call the timezone.now function, substitute the result for now. substitute third element of row list for expires. if features.needs_datetime_string_cast field of the object represented stored under the db key of connections dictionary is true, and expires is not an instance of datetime. convert expires to a string, use it as argument for the call to the function typecast_timestamp, substitute the result for expires. if expires is lesser than now, call the method router.db_for_write with argument self.cache_model_class, substitute the result for db. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "DELETE FROM %s WHERE cache_key = %%s" as argument, substitute the '%s' with table and list containing key, respectively. return default. call the method ops.process_clob with second element of row as argument, on the object under the db key of connections dictionary, substitute the result for value. call the function force_bytes with argument value, use the result as an argument for the call to the method base64.b64decode, use the result as the argument for the function call to the pickle.loads, return the result. define the method set with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with key as argument. call the method self._base_set with string 'set', key, value and timeout as arguments. define the method add with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with key as argument. call the method self._base_set with string 'add', key, value and timeout as arguments, return the result. define the protected method _base_set with 4 arguments, self class instance, key, value and timeout set to DEFAULT_TIMEOUT. call the method self.get_backend_timeout with argument timeout, substitute the result for timeout. call the method router.db_for_write with argument self.cache_model_class, substitute the result for db. call the ops.quote_name method with argument self._table on the object under the db key of connections dictionary, substitute the result for table. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "SELECT COUNT(*) FROM %s" as argument, substitute the '%s' with table. fetch one record from the database cursor points at, substitute the first element of return value for num. call the timezone.now function, substitute the result for now. call the function now.replace with microseconds set to integer 0, substitute the result for now. if timeout is None, substitute the datetime.max for exp. otherwise is settings.USE_TI is true, call the function datetime.utcfromtimestamp with argument timeout, substitute it for exp. if not, call the function datetime.fromtimestamp with argument timeout, substitute it for exp. call the exp.replace with microsecond set to integer 0, substitute the result for exp. if num is greater than self._max_entries, call the method self._cull with db, cursor and now as arguments. call the method pickle.dumps with value and pickle.HIGHEST_PROTOCOL as arguments, substitute it for pickled. call the method base64.b64encode with argument pickled, substitute the result for b64encoded. if six.PY3 is true, call the method b64encoded.decode with string 'latin1' as argument, substitute the result for b64encoded. try, with return value of the function transaction.atomic with using set to db as arguments, perform the following, call the method cursor.execute with string "SELECT cache_key, expires FROM %s WHERE cache_key = %%s" as argument, substitute the '%s' with table and list containing key, respectively. fetch one entry from the database that cursor points at, substitute it for the result. if result is true, substitute the second element of result for current_expires. if features.needs_datetime_string_cast field of object under the db key of connections dictionary is true and current_expires is not an instance of datetime object. convert current_expires to a string, use it as the argument for the call to the function typecast_timestamp, substitute the result for current_expires. on the object under the db key of connections dictionary call the method ops.value_to_db_datetime with argument exp, substitute the result for the exp. if mode equals to string 'add' and current_expires is lesser than now, or mode equals to string 'set', and result is true, call the method cursor.execute with string "UPDATE %s SET value = %%s, expires = %%s WHERE cache_key = %%s" as argument, substitute the '%s' with table and 3 elements of a list: b64encoded, exp and key, respectively. if not, call the method cursor.execute with string "INSERT INTO %s (cache_key, value, expires) VALUES (%%s, %%s, %%s)", substitute the '%s' with table and 3 elements of a list: b64encoded, exp and key, respectively. if DatabaseError exception is caught, return boolean False. if not, return boolean True. define the method delete with self class instance, key and version set to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the method router.db_for_write with argument self.cache_model_class, substitute the result for db. call the ops.quote_name method with argument self._table on the object under the db key of connections dictionary, substitute the result for table. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "DELETE FROM %s WHERE cache_key = %%s" as argument, substitute the '%s' with table and list containing key, respectively. define the method has_key with self class instance, key and version defaulting to None as arguments. call the self.make_key with key and version set to version as arguments, substitute the result for key. call the self.validate_key method with argument key. call the method router.db_for_write with argument self.cache_model_class, substitute the result for db. call the ops.quote_name method with argument self._table on the object under the db key of connections dictionary, substitute the result for table. if settings.USE_TZ is true, call the function datetime.utcnow, substitute the result for now. if not, call the function datetime.now, substitute the result to now. call the method now.replace with the argument microsecond set to integer 0, substitute the result for now. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "SELECT cache_key FROM %s WHERE cache_key = %%s and expires > %%s" as argument, substitute the '%s' with table and list containing return value of the method call ops.value_to_db_datetime with argument now on the object under the db key of connections dictionary, respectively. if exists return next entry from the database that cursor points at. define the protected method _cull with self class instance, db, cursor and now as arguments. if self._cull_frequency equals to integer 0. call the self.clear method. if not, call the method now.replace with argument tzinfo set to None, substitute it for now. call the ops.quote_name method with argument self._table on the object under the db key of connections dictionary, substitute the result for table. call the method cursor.execute with string "DELETE FROM %s WHERE expires < %%s" as argument, substitute the '%s' with table and list containing return value of the method call ops.value_to_db_datetime with argument now on the object under the db key of connections dictionary, respectively. call the method cursor.execute with string "SELECT COUNT(*) FROM %s" as argument, substitute the '%s' with table. fetch next entry for the database that cursor points into, substitute first element of it for num. if num is greater than self._max_entries, divide num by self._cull_frequency, floor the result and substitute it for cull_num. evaluate the method connections[db].ops.cache_key_culling_sql, evaluate the result by table modulus, call the method cursor.execute, with previous result and list containing cull_num, respectively as arguments. call the method cursor.execute with string "DELETE FROM %s WHERE cache_key < %%s" as argument, substitute the '%s' with table and list containing first element of cursor.fetchone method, respectively. define the method clear with argument self. call the method router.db_for_write with argument self.cache_model_class, substitute the result for db. call the ops.quote_name method with argument self._table on the object under the db key of connections dictionary, substitute the result for table. call the cursor method on the value under the db key of connections dictionary, preform following with return value named cursor, call the method cursor.execute with string "DELETE FROM %s" as argument, substitute the '%s' with table. derive the class CacheClass from the DatabaseCache base class. do nothing. from django.core.cache.backends.base import BaseCache and DEFAULT_TIMEOUT into default name space. derive the class DummyCache from the base class BaseCache. define initialization method __init__ with 4 arguments: self, host, list of arguments args and dictionary of arguments kwargs. call the BaseCache initialization method __init__ with 3 arguments self, list of arguments args and dictionary of arguments kwargs. define the method add with 5 arguments: self, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute it for key. call the method self.validate_key with argument key. return boolean True. define the method get with 4 arguments: self, key, default set to None and version set to None. call the method self.make_key with key and version set to version as arguments, substitute it for key. call the method self.validate_key with argument key. return default. define the method set with 5 arguments: self, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute it for key. call the method self.validate_key with argument key. define the method delete with 3 arguments: self, key, and version set to None. call the method self.make_key with key and version set to version as arguments, substitute it for key. call the method self.validate_key with argument key. define the method get_many with 3 arguments: self, keys, and version set to None. return an empty dictionary. define the method has_key with 3 arguments: self, key, and version set to None. call the method self.make_key with key and version set to version as arguments, substitute it for key. call the method self.validate_key with argument key. return boolean False. define the method set_many with 4 arguments: self, data, timeout set to DEFAULT_TIMEOUT and version set to None. do nothing define the method delete_many with 3 arguments: self, keys, and version set to None. do nothing. define the method clear with argument self. do nothing. derive the class CacheClass from the DummyCache base class. do nothing. import module errno. import module glob. import module hashlib. import module io. import module os. import module random. import module tempfile. import module time. import module zlib. from django.core.cache.backends.base import BaseCache and DEFAULT_TIMEOUT into default name space. from django.core.files.move import file_move_safe into default name space. from django.utils.encoding import force_bytes into default name space. try, from django.utils.six.moves import cPickle as pickle into default name space. if ImportError exception is caught, import pickle. derive the class FileBasedCache from BaseCache base class. cache_suffix is a string '.djcache'. define the initialization method __init__ with arguments: self class instance, dir and params. call method __init__ with argument params from the base class of the FileBaseCache. get absolute directory path of dir, substitute it for self._dir. call the self._createdir method. define the method add with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. evaluate method self.has_key with key and version as arguments, if the result is true, return boolean False. call the method self.set with key, value, timeout and version as arguments. return boolean True. define the method get with 5 arguments, self class instance, key, default set to None and version set to None. call the function self._key_to_file with key and version as arguments, substitute it for fname. if fname file path exists, try, with return value of the function io.open with fname and string 'rb' as arguments, named as f, evaluate self._is_expired method with f as argument, if the result is false, call f.read function, use the result as the argument for zlib.decompress function call, call the pickle.loads function with the previous result as argument, return the result. if IOError, renamed to e, exception is caught, if e.errno equals to errno.ENOENT, do nothing. return default. define the method set with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the self._createdir method. call the function self._key_to_file with key and version as arguments, substitute it for fname. call the method self._cull. call the method tempfile.mkstemp with dir set to self._dir, substitute result for fd and tmp_path, respectively. renamed is boolean False. try, with return value of the function io.open with fname and string 'rb' as arguments, named as f, call the method self.get_backend_timeout with argument timeout, substitute it for expiry. call the function pickle.dumps with expiry and integer -1 as arguments, use the result as the argument for the call to f.write function. call the function pickle.dumps with argument value, use the result and integer -1 as arguments for the call to the function zlib.compress, use the result as an argument for the call to the f.write method. call the function file_move_safe with tmp_path, fname, allow_overwrite set to boolean True as arguments. renamed is boolean True. finally perform, if renamed is boolean False, remove file tmp_path. define the method delete with self class instance, key and version defaulting to None as arguments. call the function self._key_to_file with key and version as arguments, use the result as an argument for the call to the self._delete method. define the method _delete with self and fname as arguments. if fname doesnt start with self._dir and fname file path doesnt exists, return nothing. try, call the function os.remove with argument fname. if exception OSError, renamed to e, is caught, if e.errno does not equals to errno.ENOENT, raise an exception. define the method has_key with self class instance, key and version defaulting to None as arguments. call the function self._key_to_file with key and version as arguments, substitute it for fname. if fname file path exists, with call to the io.open function with fname and string 'rb' as arguments, renamed to f, call the method self._is_expired with argument f, invert the boolean result and return it. return boolean False. define the method _cull with argument self. call the self._list_cache_files method, substitute the result for filelist. num_entries is length of filelist. if num_entries is lesser than self._max_entries, return nothing. if self._cull_frequency equals to integer 0. evaluate self.clear method and return the result. divide num_entries by self._cull_frequency, convert the result to an integer, call the random.sample function with filelist and previous result as arguments, substitute the result for filelist. for every fname in filelist, call self._delete method with argument fname. define the method _createdir with argument self. if self._dir path doesnt exists, try, call os.makedirs function with self._dir and hexadecimal 0o700 as arguments. if OSError, renamed to e, exception is caught, if e.errno is not equal to errno.EEXIST, raise an EnvironmentError exception with string "Cache directory '%s' does not exist and could not be created" as argument, substitute '%s' with self._dir converted to a string. define the method key_to_file with self class instance, key and version defaulting to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. join into a string: md5 hash sum of force_bytes(key) and self.cache_suffix, compose root file path out of self._dir and previous result, return it. define the method clear with argument self. if self._dir file path does not exists, return nothing. if fname is contained in self._list_cache_files method return value, call the self._delete method with argument fname. define the method _is_expired with self and f as arguments. call the function pickle.load with argument f, substitute the result for exp. if exp is not None and exp is lesser than return value of the function time.time, call close method on a file stream. call the self._delete method with argument f.name. return boolean True. return boolean False. define the method _list_cache_files with argument self. if self._dir file path does not exists, return an empty list. for every fname in return value of the glob.glob1 function called with 2 arguments: self._dir and , self.cache_suffix converted to a string, appended to the character '*', call os.path.join with self._dir and fname as arguments, filelist is a list containing all the previous results. return filelist. derive the class CacheClass from the base class FileBasedCache. do nothing. import module time. try, from django.utils.six.moves import cPickle as pickle into default name space. if ImportError exception is caught, import pickle. from django.core.cache.backends.base import BaseCache and DEFAULT_TIMEOUT into default name space. from django.utils.synch import RWLock into default name space. __caches is an empty dictionary. __expire_info is an empty dictionary. __locks is an empty dictionary. derive the class LocMemCache from the base class BaseCache. define the initialization method __init__ with 3 arguments: self, name and params. call the __init__ method with self and params arguments from the base class BaseCache. call the _caches.setdefault method with name and empty dictionary as arguments, substitute the result for self_cache. call the _expire_info.setdefault method with name and empty dictionary as arguments, substitute the result for self_expire_info. call the _lock.setdefault method with name and RWLock() as arguments, substitute the result for self_lock. define the method add with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the pickle.dumps function with value and pickle.HIGHEST_PROTOCOL as arguments. call the self._lock.writer method, with the result perform the following, evaluate self._has_expired with argument key, if the result is True, call the method self._set with key, pickled and timeout as arguments. return boolean True. return boolean False. define the method get with 4 arguments, self class instance, key, default set to None and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. substitute None for pickled. call the self._lock.reader method, with the result perform the following, evaluate the method self._has_expired with argument key, if it as False, substitute value under the key key of self._cache dictionary for pickled. if pickled is not None. try, evaluate pickle.loads with argument pickled, return the result. if pickle.PickleError exception is caught, return default. call the self._lock.writer method, with the result perform the following, try, delete the value under key key of self._cache dictionary. delete the value under key key of self._expire_info. if KeyError exception is caught, do nothing. return default. define the method _set with 4 arguments, self class instance, key, value and timeout set to DEFAULT_TIMEOUT. if length of self._cache is greater or equal to self._max_entries, call the self._cull method. substitute value for the value under the key key of self._cache dictionary. call the self.get_backend_timeout with argument timeout, substitute it for the value under the key key of self._expire_info dictionary. define the method get with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the function pickle.dumps with value and pickle.HIGHEST_PROTOCOL as the arguments, substitute the result for pickled. call the self._lock.writer method, with the result perform the following, call the method self._set with key, pickled and timeout as arguments. define the method incr with self class instance, key, delta set to integer 1 and version set to None, as arguments. call the self.get method with key and version set to version as arguments, substitute the result for value. if value is None, raise an ValueError exception with string "Key '%s' not found" as argument, substitute '%s' with key converted into a string. new_value is a sum of value and delta. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the function pickle.dumps with value and pickle.HIGHEST_PROTOCOL as the arguments, substitute the result for pickled. call the self._lock.writer method, with the result perform the following, substitute pickled for value under the key key of self._cache dictionary. return new_value. define the method has_key with self class instance, key and version defaulting to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the self._lock.reader method, with the result perform the following, if call to the _has_expired method with argument key evaluates to boolean False, return boolean True. call the self._lock.writer method, with the result perform the following, try, delete the value under the key key of self._cache dictionary. delete the value under the key key of self._expire_info dictionary. if KeyError exception is caught, do nothing. return boolean False. define the method _has_expired with self and key as arguments. call the method self._expire_info.get with key and integer -1 as arguments, substitute the result for exp. if exp is None or exp is greater than the return value of the call to the function time.time, return boolean False. return boolean True. define the method _cull with argument self. if self._cull_frequency equals to integer 0. call self.clear method. if not, for every i and k in enumerated values of self._cache, if i is divisible by self._cull_frequency, append k to doomed list. for every k in doomed, call the method self._delete with argument k. define the method _delete with arguments self and key. try, delete the value under the key key of self._cache dictionary. if KeyError exception is caught, do nothing. try, delete the value under the key key of the self._expire_info dictionary. if KeyError exception is caught, do nothing. define the method delete with self class instance, key and version defaulting to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self.validate_key with argument key. call the self._lock.writer method, with the result perform the following, call the method self._delete with argument key. define the method clear with argument self. call the method self._cache.clear. call the method self._expire_info.clear. derive the class CacheClass from the base class LocMemCache. do nothing. import module time. import module pickle. from django.core.cache.backends.base import BaseCache and DEFAULT_TIMEOUT into default name space. from django.utils import six into default name space. from django.utils.deprecation import RenameMethodsBase and RemovedInDjango19Warning into default name space. from django.utils.encoding import force_str into default name space. from django.utils.functional import cached_property into default name space. derive the class BaseMemcachedCacheMethods from RenameMethodsBase the base class. renamed methods is a tuple containing 3 elements: '_get_memcache_timeout', 'get_backend_timeout' and RemovedInDjango19Warning. derive the class BaseMemcachedCache from base class BaseMemcachedCacheMethods and BaseCache. define the method __init__ with, self, server, params, library, value_not_found_exception as arguments. call the initialization method with argument params for the base class of the BaseMemcachedCache class. if server is an instance of six.string_types, split server with ';' as delimiter, substitute the result for self._servers. if not, substitute server for self._servers. substitute value_not_found_exception for self.LibraryValueNotFoundException. substitute library for self._lib. call the params.get function with string 'OPTIONS' and None as arguments, substitute the result for self._options. property decorator, define the method _cache with argument self. if self object has an attribute '_client', call the self._lib.Client with argument self._servers, substitute the result for self._client. return self._client. define the method get_backend_timeout with self and timeout set to DEFAULT_TIMEOUT as arguments. if timeout equals to DEFAULT_TIMEOUT, substitute self.default_timeout for timeout. if timeout is None, return integer 0. else if timeout converted into an integer equals to integer 0, timeout is a integer -1. if timeout is greater than integer 2592000, convert return value of the function time.time to an integer, increment timeout by it. convert timeout into an integer, return it. define the method make_key with self class instance, key and version defaulting to None as arguments. call the method make_key with arguments key and version from the base class of the class BaseMemcachedCache, use it as an argument for the call to the function force_str, return the result. define the method add with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self._cache.add with key, value, self.get_backend_timeout(timeout) as arguments. define the method get with 5 arguments, self class instance, key, default set to None and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the self._cache.get method with argument key, substitute the result for val. if val is None, return default. return val. define the method set with 5 arguments, self class instance, key, value, timeout set to DEFAULT_TIMEOUT and version set to None. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self._cache.set with key, value, self.get_backend_timeout(timeout) as arguments. define the method delete with self, key and version set to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. call the method self._cache.delete with argument key. define the method get_many with self class instance, keys and version defaulting to None as arguments. define the method get_many with 3 arguments, self class instance, keys and version set to None. call the method self._cache.get_multi with argument new_keys, substitute the result for ret. if ret is true. _ is an empty dictionary. zip together new_keys and keys, convert it to dictionary, assign it to m. for every k and v in return value of the ret.items function, substitute v for value under the k-th element of m key of _ dictionary. substitute _ for ret. return ret. define the method close with self and dictionary pairs of elements kwargs. call the method self._cache.disconnect_all. define the method incr with self, key, delta defaulting to integer 1 and version defaulting to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. if delta is smaller than integer 0, evaluate the method self._cache.decr with key and negative delta as arguments, return the result. try, call the method self._cache.incr with key and delta as arguments, substitute the result for val. if self.LibraryValueNotFoundException exception is caught, val is None. if val is None, raise an ValueError exception with string "Key '%s' not found" as argument, substitute '%s' for key. return val. define the method decr with self, key, delta defaulting to integer 1 and version defaulting to None as arguments. call the method self.make_key with key and version set to version as arguments, substitute the result for key. if delta is smaller than integer 0. evaluate the method self._cache.incr with key and negative delta as arguments, return the result. try, call the method self._cache.decr with key and delta as arguments, substitute the result for val. if self.LibraryValueNotFoundException exception is caught, val is None. if val is None, raise an ValueError exception with string "Key '%s' not found" as argument, substitute '%s' for key. return val. define the method set_many with self, data, timeout set to DEFAULT_TIMEOUT and version set to None as arguments. safe_data is an empty dictionary. for every key and value in data.items function return value, call the method self.make_key with key and version set to version as arguments, substitute the result for key. substitute value for value under the key key of safe_data dictionary. call the method self._cache.set_multi with safe_data, self.get_backend_timeout(timeout) as arguments. define the function delete_many with self, keys and version set to None as arguments. l is lambda function with argument x, that calls the method self.make_key with x and version set to version as arguments. call the method self_cache.delete_multi with argument list containing keys mapped through function l. define the method clear with argument self. call the method self._cache_flush_all. derive the class MemcachedCache from the BaseMemcachedCache base class. define the method __init__ with argument self, server and params. import memcache. call method __init__ from the base class of the class MemcachedCache with arguments: server, params, library set to memcache and value_not_found_exception set to ValueError. property decorator, define the method _cache with self class instance as an argument. if attribute '_client' of the self object is None, call the method self._lib.Client with self._servers and pickleProtocol set to pickle.HIGHEST_PROTOCOL as arguments, substitute the result for self._client. return self._client. derive the class PyLibMCCache from BaseMemcachedCache base class. define the method __init__ with self, server and params as arguments. import pylibmc. call method __init__ from the base class of the class PyLibMCCache with arguments: server, params, library set to pylibmc and value_not_found_exception set to pylibmc.NotFound. decorator cached_property, define the method _cache with argument self. call the method self._lib.Client with argument self._servers. if self._options exists, substitute self._options for client.behaviors. return client. from __future__ import unicode_literals into default name space. import module hashlib. from django.utils.encoding import force_bytes into default name space. from django.utils.http import urlquote into default name space. TEMPLATE_FRAGMENT_KEY_TEMPLATE is a string 'template.cache.%s.%s'. define the function make_template_fragment_key with fragment_name and vary_on defaulting to None as arguments. if vary_on is None, vary_on is an empty tuple. call the function urlquote with argument var for every var in vary_on, join the results into a string separated by ':', substitute it for key. call the hashlib.md5 fuction with force_bytes(key) as argument. substitute '%s' in TEMPLATE_FRAGMENT_KEY_TEMPLATE string with fragment_name and args.hexdigest(), respectively, return the result. from __future__ import unicode_literals into default name space. from .messages import CheckMessage, Debug, Info, Warning, Error, Critical, DEBUG, INFO, WARNING, ERROR and CRITICAL into default name space. from .registry import register, run_checks, tag_exists and Tags into default name space. import module django.core.checks.compatibility.django_1_6_0. import module django.core.checks.compatibility.django_1_7_0. import module django.core.checks.model_checks. __all__ is a list containing next strings, 'CheckMessage', 'Debug', 'Info', 'Warning', 'Error', 'Critical', from __future__ import unicode_literals into default name space. from django.apps import apps into default name space. from .. import Warning, register and Tags into default name space. decorator register with argument Tags.compatibility. define the function check_1_6_compatibility with argument kwargs dictionary. errors is an empty list call the function _check_test_runner with dictionary kwargs as argument, use the result as an argument for the call to the function errors.extend. call the function _check_boolean_field_default_value with dictionary kwargs as argument, use the result as an argument for the call to the function errors.extend. return errors. define the function _check_test_runner with app_config set to None and kwargs dictionary as arguments. from django.conf import settings into default name space. weight is an integer 0. if call to the settings.is_overridden with string 'TEST_RUNNER' evaluates to boolean False. try, settings.SITE_ID. increment weight by integer 2. if AttributeError exception is caught, do nothing. try, settings.BASE_DIR. if AttributeError exception is caught, increment weight by integer 2. call the function settings.is_overridden with argument string 'TEMPLATE_LOADERS', if it evaluates to boolean True, increment weight by integer 2. call the function settings.is_overridden with argument string 'MANAGERS', if it evaluates to boolean True, increment weight by integer 2. call the function settings.is_overridden with argument string 'ADMINS', if it evaluates to boolean True, increment weight by integer 2. if string 'django.middleware.clickjacking.XFrameOptionsMiddleware' is not contained in settings.MIDDLEWARE_CLASSES set, increment weight by integer 2. if weight is greater or equal to integer 6, call the Warning function with 3 arguments: hint tuple containing one string, Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.", obj set to None and id set to a string '1_6.W001', put the result into a list and return it. if not, return an empty list. define the function _check_boolean_field_default_value with app_config set to None and kwargs dictionary as arguments. from django.db import models into default name space. append field to problem_fields list for every model in apps.get_models with argument kwargs dictionary, only if app_configs is None, or model._meta.app_config is contained in app_configs, for every field in model._meta.local_fields, #ANNOTATION only if field is an instance of models.BooleanField and field.has_default() evaluates to False. call the Warning function with 4 arguments: string "BooleanField does not have a default value.", from __future__ import unicode_literals into default name space. from .. import Warning, register and Tags into default name space. decorator register with argument Tags.compatibility. define the function check_1_7_compatibility with argument kwargs dictionary. errors is an empty list. call the function _check_middleware_classes with dictionary kwargs as argument, use the result as an argument for the call to the function errors.extend. return errors. define the function _check_middleware_classes with app_config set to None and kwargs dictionary as arguments. from django.conf import settings into default name space. call the function settings.is_overridden with argument string 'MIDDLEWARE_CLASSES', if the result is boolean False, call the Warning function with 4 arguments: string "MIDDLEWARE_CLASSES is not set.", hint tuple containing one string, "Django 1.7 changed the global defaults for the MIDDLEWARE_CLASSES. django.contrib.sessions.middleware.SessionMiddleware, django.contrib.auth.middleware.AuthenticationMiddleware, and django.contrib.messages.middleware.MessageMiddleware were removed from the defaults. If your project needs these middleware then you should configure this setting.", obj set to None, and id set to a string '1_7.W001', put the result into a list and return it. if not, return an empty list. from __future__ import unicode_literals into default name space. from django.utils.encoding import python_2_unicode_compatible and force_st into default name space. DEBUG is integer 10. INFO is integer 20. WARNING is integer 30. ERROR is integer 40. CRITICAL is integer 50. decorator python_2_unicode_compatible. derive class CheckMessage from object base class. define initialization method __init__ with self class instance, level, msg, hint defaulting to None, obj defaulting to None and if defaulting to None as arguments. if level is not an integer raise an error with message string "The first argument should be level.". substitute level for self.level. substitute msg for self.msg. substitute hint for self.hint. substitute obj for self.obj. substitute id for self.id. define private method __eq__ with self class instance and other as arguments. if for all attr in list of attributes 'level', 'msg', 'hint', 'obj' and 'id', self and other have the same attribute attr, return boolean True, otherwise return boolean False. define private method __ne__ with self class instance and other as arguments. if self equals to other return boolean False, otherwise return True. define private method __str__ with argument self. from django.db import models into default name space. if self.obj is None, obj is a string "?". otherwise if self.object is an instance of the models.base.ModelBase class, substitute self.obj for model. substitute model._meta.app_label for app. convert app and model._meta.object_name to strings, join them with separating '.' character, substitute it for obj. if not, call the function force_str with argument self.obj, substitute the result for obj. if self.id exists, convert self.id to a string, surround it with round brackets, substitute id for it, otherwise id is an empty string. if self.hint exists, replace '%s' in a string "\n\tHINT: %s" with value of self.hint, substitute it for hint, otherwise hint is an empty string. replace all '%s' from string "%s: %s%s%s" with values of obj, id, self.msg and hint, respectively, return the result. define private method __repr__ with argument self. in the string "<%s: level=%r, msg=%r, hint=%r, obj=%r, id=%r>", replace '%s' with the name of the type of this class instance, replace all the '%r' with self.level, self.msg, self.hint. self.obj and self.id, respectively, return the result. define the method is_serious with argument self. return boolean True if self.level is greater than or equals to ERROR, otherwise return boolean False. define the method is_silence with argument self. from django.conf import settings into default name space. if self.id is contained in settings.SILENCED_SYSTEM_CHECKS return boolean True, False otherwise. derive the class Debug from base class CheckMessage. define initialization method __init__ with self class instance, unpacked list args, unpacked dictionary kwargs as arguments. call the __init__ method with 3 arguments: DEBUG, unpacked list args and unpacked dictionary kwargs from the base class of Debug. derive the class Info from base class CheckMessage. define initialization method __init__ with self class instance, unpacked list args, unpacked dictionary kwargs as arguments. call the __init__ method with 3 arguments: INFO, unpacked list args and unpacked dictionary kwargs from the base class of Info. derive the class Warning from base class CheckMessage. define initialization method __init__ with self class instance, unpacked list args, unpacked dictionary kwargs as arguments. call the __init__ method with 3 arguments: WARNING, unpacked list args and unpacked dictionary kwargs from the base class of Warning. derive the class Error from base class CheckMessage. define initialization method __init__ with self class instance, unpacked list args, unpacked dictionary kwargs as arguments. call the __init__ method with 3 arguments: ERROR, unpacked list args and unpacked dictionary kwargs from the base class of Error. derive the class Critical from base class CheckMessage. define initialization method __init__ with self class instance, unpacked list args, unpacked dictionary kwargs as arguments. call the __init__ method with 3 arguments: CRITICAL, unpacked list args and unpacked dictionary kwargs from the base class of Critical. from __future__ import unicode_literals into default name space. from itertools import chain into default name space. import module types. from django.apps import apps into default name space. from . import Error, Tags and register into default name space. decorator register with Tags.models as an argument. define the function check_all_models with app_configs defaulting to None and unpacked dictionary kwargs as arguments. call the model.check method with unpacked dictionary kwargs for every model in return value of function apps.get_models, only if app_configs is None ot model._meta.app_config is contained in app_configs, error is a list containing all the previous elements. chain all errors elements into a list, return it. decorator register with Tags.models and Tags.signals as arguments. define the function check_model_signals with app_config defaulting to None and unpacked dictionary kwargs as arguments, from django.db import models into default name space. errors is an empty list. for name in attributes of models_signals object, get models.signals name attribute, store it in obj. if obj is instance of models.signals.ModelSignal class, for every reference and receivers in return value of the call of obj.unresolved_references.items method, for every receiver, _ and _ in receivers, if receiver is an instance of types.FunctionType type, description is a string "The '%s' function" replaced by value of receiver.__name__. if not, description is a string "An instance of the '%s' class" with '%s' replaced by value of receiver.__class__.__name__. call the Error function with 4 arguments, string "%s was connected to the '%s' signal with a lazy reference to the '%s' sender, which has not been installed." with all the '%s' replaced by values of description, name and reference joined into a string delimited by '.', respectively, obj set to receiver.__module__, hint set to None and id set to string 'signals.E001', append the result to errors. return errors. from __future__ import unicode_literals into default name space. from itertools import chain into default name space. from django.utils.itercompat import is_iterable into default name space. derive the class Tags with base class object. admin is a string 'admin' compatibility is a string 'compatibility'. models is a string 'models' signal is a string 'signals' derive the class CheckRegistry with object as base class. define initialization method __init__ with argument self. self.registered_checks is an empty list. define the method register with self ans unpacked list tags as arguments. define the method inner with argument check. replace tags for check.tags. if check is not contained in self.registered_checks. call the method self.registered_checks.append with argument check. return check. return inner. define the method run_checks with self class instance, app_configs defaulting to None, tags defaulting to None as argument. errors is an empty list. if tags is not None. append check to checks list, for every check in self.register_checks, if check has an attribute 'tags' and check.tags and tags set intersection is a non empty set. if not. substitute self.registered_checks for checks. for every check in checks, call the check function with argument app_config set to app_config, substitute the result for new_errors. if new_errors is not an iterable object raise an error with error message "The function %r did not return a list. All functions registered with the checks registry must return a list.", with '%s' replaced by value of check. call the method errors.extend with argument new_errors. return errors. define the method tag_exists with self class instance and tag as arguments. return boolean True if tag is contained in self.tags_available method return value, return False otherwise. define the method tags_available with argument self. append check.tags into a list for every check in self.registered_checks if check has 'tags' attribute, put the elements into a set and return it. call the function CheckRegistry, substitute the result for registry. substitute registry.register for register. substitute registry.run_checks for run_checks. substitute registry.tag_exists for tag_exists. from __future__ import unicode_literals into default name space. from django.conf import settings into default name space. from django.middleware.csrf import get_token into default name space. from django.utils import six into default name space. from django.utils.encoding import smart_text into default name space. from django.utils.functional import lazy into default name space. define the function csrf with an argument request. define the function _get_val. call the function get_token with an argument request, substitute the result for token. if token is None, return string 'NOTPROVIDED'. if not, call the smart_text function with an argument token, return the result. call the function lazy with arguments _get_val and six.text_type, substitute the result for _get_val. return an dictionary containing 1 entry: return value of the function _get_val for 'csrf_token'. define the function debug with an argument request. context_extras is an empty dictionary. if settings.DEBUG is true and value of the request.META dictionary under the 'REMOTE_ADDR' key is contained in settings.INTERNAL_IPS, value under the 'debug' key of the context_extras dictionary is boolean True. from django.db import connection into default name space. substitute connection.queries for value under the 'debug' key of the context_extras dictionary. return context_extras. define the function i18n with an argument request. from django.utils import translation into default name space. context_extras is an empty dictionary. substitute settings.LANGUAGES for the value under the 'LANGUAGES' key of the context_extras dictionary. call the translation.get_language function, substitute the result for the value under the 'LANGUAGE_CODE' key of the context_extras dictionary. call the translation.get_language_bidi function, substitute the result for the value under the 'LANGUAGE_BIDI' key of the context_extras dictionary. return context_extras. define the function tz with an argument request. from django.utils import timezone into default name space. return an dictionary containing 1 entry: return value of the function timezone.get_current_timezone_name for 'TIME_ZONE'. define the function static with an argument request. return an dictionary containing 1 entry: settings.STATIC_URL for 'STATIC_URL'. define the function media with an argument request. return an dictionary containing 1 entry: settings.MEDIA_URL for 'MEDIA_URL'. define the function request with an argument request. return an dictionary containing 1 entry: request for 'request'. from functools import reduce into default name space. import module operator. from django.utils import six into default name space. from django.utils.encoding import force_text into default name space. derive the class DjangoRuntimeWarning from the RuntimeWarning base class. do nothing. derive the class AppRegistryNotReady from the Exception base class. do nothing. derive the class ObjectDoesNotExist from the Exception base class. silent_variable_failure is an boolean True. derive the class MultipleObjectsReturned from the Exception base class. do nothing. derive the class SuspiciousOperation from the Exception base class. derive the class SuspiciousMultipartForm from the SuspiciousOperation base class. do nothing. derive the class SuspiciousFileOperation from the SuspiciousOperation base class. do nothing. derive the class DisallowedHost from the SuspiciousOperation base class. do nothing. derive the class DisallowedRedirect from the SuspiciousOperation base class. do nothing. derive the class PermissionDenied from the Exception base class. do nothing. derive the class ViewDoesNotExist from the Exception base class. do nothing. derive the class MiddlewareNotUsed from the Exception base class. do nothing. derive the class ImproperlyConfigured from the Exception base class. do nothing. derive the class FieldError from the Exception base class. do nothing. NON_FIELD_ERRORS is an string '__all__'. derive the class ValidationError from the Exception base class. define the method __init__ with 4 arguments: self, message, code set to None and params set to None. call the __init__ method from the base class of the class ValidationError with arguments message, code and params. if message is an instance of ValidationError class, if message has an 'error_dict' attribute, substitute message.error_dict for message. alternatively, if six.PY3 is true check if message does not have an attribute 'message', if six.PY3 is false, check if message doesnt have an attribute 'code', perform the following, substitute message.error_list for message. if not, substitute message.message, message.code, message.params for message, code and params, respectively. if message is an instance of dict type, self.error_dict is an empty dictionary. for every field, messages in return value of the message.items method, if messages is not an instance of the ValidationError class, messages is an instance of the ValidationError class created with an argument messages. substitute messages.error_list for the value under the field key of the self.error_dict dictionary. otherwise if message is an instance of the list type. self.error_list is an empty list. for every message is message, if message is not an instance of the ValidationError class, message is an instance of the ValidationError class created with an argument message. extend the self.error_list list with message.error_list. if not, substitute message for self.message. substitute code for self.code. substitute params for self.params. substitute list containing element self for self.error_list. property getter decorator, define the method message_dict with an argument self. get attribute 'error_dict' from the self object. convert object self to a dictionary, return it. property getter decorator, define the messages with an argument self. if self has an 'error_dict' attribute, call the operator.add on the values of the self object converted into a dictionary, until it is reduced to a single value, return it. convert self to a list and return it. define the method update_error_dict with arguments self and error_dict. if self has an 'error_dict' attribute, for every field, error_list in self.error_dict.items method return value, call the method extend with an argument error_list on the return value of the method error_dict.setdefault called with 2 arguments: field and an empty list. if not, call the method extend with an argument error_list on the return value of the method error_dict.setdefault called with 2 arguments: NON_FIELD_ERRORS and an empty list. return error_dict. define the method __iter__ with an argument self. if self has an 'error_dict' attribute, for every field, errors in self.error_dict.items method return value, yield field and ValidationError object converted to an list, created with an argument errors. if not, for every error in self.error_list, substitute error.message for message. if error.params is true, divide message by error.params, substitute the residue of the division for message. call the force_text with an argument message, yield the result. define the method __str__ with an argument self. if self has an attribute 'error_dict', return the printable representation of the self object converted to a dictionary. return the printable representation of the self object converted to a list. define the method __repr__ with an argument self. return the string 'ValidationError(%s)', replace '%s' with self. from django.core.files.base import File into default name space. __all__ is an list containing a string 'File'. from __future__ import unicode_literals into default name space. import module os. from io import BytesIO, StringIO and UnsupportedOperation into default name space. from django.utils.encoding import smart_text into default name space. from django.core.files.utils import FileProxyMixin into default name space. from django.utils import six into default name space. from django.utils.encoding import force_bytes and python_2_unicode_compatible into default name space. decorator python_2_unicode_compatible, derive the class File from the FileProxyMixin base class. bring integer 2 to the power of 10, multiply it by 64, substitute the result for DEFAULT_CHUNK_SIZE. define the method __init__ with self class instance, file, and name defaulting to None as arguments. substitute file for self.file. if name is None, get 'name' attribute from the file object, if it doesnt exists use None, substitute it for name. substitute name for self.name. if file object has an attribute 'mode', substitute file.mode for self.mode. define the method __str__ with argument self. evaluate the function smart_text with argument self.name, if exists, or an empty string, if not, return the result. define the method __repr__ with argument self. substitute '%s' in string '<%s: %s>' with self.__class__.__name__ and self, if exists, or string 'None' if it doesnt, return it. define the method __bool__ with argument self. convert self.name into an boolean, return it. define the method __nonzero__ with argument self. call the __bool__ method with argument self, on the return value of the type function with argument self, return the result. define the method __len__ with argument self. return self.size. define the method _get_size_from_underlying_file with argument self. if self.file has an attribute 'size', return self.file.size. if self.file has an attribute 'name', try, call the os.path.getsize function with argument self.file.name, return the result. if OSError or TypeError errors occurred. do nothing. if self.file has an attribute 'tell' and an attribute 'seek', get the position of the self.file file pointer, substitute it for pos. position the file self.file pointer at the end. get the position of the file self.file pointer, substitute it for size. position file self.file pointer at the pos position. return size. raise an AttributeError exception with string "Unable to determine the file's size." as argument. define the method _get_size with argument self. if self has an attribute '_size'. return self._size. call the method self._get_size_from_underlying_file, substitute the result for self._size. return self._size. define the method _set_size with arguments self and size. substitute size for self._size. size is a property object with _get_size as getter method and _set_size as setter method. define the method _get_closed with argument self. if self.file is false or self.file.closed is true, return boolean true, otherwise return boolean false. closed is a property object with _get_closed as a getter method. define the method chunks with arguments self and chunk_size defaulting to None. if chunk_size is false, substitute the self.DEFAULT_CHUNK_SIZE for chunk_size. try, position the file pointer at the beginning of self file. if AttributeError or UnsupportedOperation exception occurred. do nothing. endless loop, call the self.read method with argument chunk_size, substitute the result for data. if data is false, break from the smallest enclosing loop. yield one element of data iterable. define the method __multiple_chunks__ with arguments self and chunk_size defaulting to None. if chunk_size is false, substitute self.DEFAULT_CHUNK_SIZE for chunk_size. if self.size is greater than chunk_size, return boolean True, otherwise return boolean False. define the method __iter__ with argument self. buffer_ is None. for every chunk in return value of the method self.chunks, evaluate the function BytesIO with argument chunk, substitute it for chunk_buffer. for every line in chunk_buffer, if buffer_ is true, increment line by buffer_. buffer_ is None. if last element of line is newline or carriage return character, yield one element of line iterable. if not, substitute line for buffer_. if buffer_ is not None, yield one element from the buffer_ iterable. define the method __enter__ with argument self. return self. define the method __exit__ with self, exc_type, exc_value and tb as arguments. close the file self. define the method open with arguments self and mode defaulting to None. if file self is not closed, position the file pointer at the beginning of self file. otherwise if self.name exists and self.name file path exists, open the file self.name in mode or self.mode mode, whichever exists, assign the file handler to self.file. if not, raise an ValueError exception with string "The file cannot be reopened." as an argument. define the method close with argument self. call the method self.file.close. decorator python_2_unicode_compatible, derive the class ContentFile from File base class. define the method __init__ with arguments self, content and name defaulting to None. if six.PY3 is boolean True, substitute StringIO for stream_class if content is an instance of six.text_type, otherwise substitute BytesIO for stream_class. if not, substitute BytesIO for stream_class. call the function force_bytes with argument content, substitute it for content. call the __init__ method with stream_class(content) and name set to name arguments, from the base class of the ContentFile class. substitute length of content for self.size. define the method __str__ with argument self. return a string 'Raw content'. define the method __bool__ with argument self. return boolean True. define the method __nonzero__ with argument self. evaluate the method type(self).__bool__ with argument self, return the result. define the method open with arguments self and mode set to None. call the self.seek method with argument integer 0. define the method close with argument self. do nothing. import module zlib. from django.core.files import File into default name space. derive class ImageFile from the base class File. define method _get_width with self class instance as the argument. return the first element of the return value of the call to the self._det_image_dimensions method. get property attribute _get_width, and substitute it for width. define method _get_height with self class instance as the argument. return the second element of the return value of the call to the self._det_image_dimensions method. get property attribute _get_height, and substitute it for width. define the method _get_image_dimensions with self class instance as the argument. if self does not have an attribute named '_dimensions_cache'. substitute self.closed for close. call the method self.open() evaluate the method get_image_dimensions with self class instance and close set to close as the arguments, substitute the result for self._dimensions_cache. return self._dimensions_cache. define the function get_image_dimension with file_or_path and close set to boolean False as the arguments. from PIL module import ImageFile as PillowImageFile. p is image parser object, set by calling the PillowImageFile.Parser method. if file_or_path has an attribute 'read', substitute file_or_path for file. get the position in bytes from the start of the file, store it in file_pos. set the file position pointer at the beginning. if not, open file named file_or_path for reading, store the file object handle in file. close is boolean True. try, chunk_size is an integer 1024. endless while loop, read chunk_size bytes from file and store it in data. if data is empty. break from the endless loop. try, feed data to the parser p. if zlib.error as e exception is raised, if e.args list first element starts with string "Error -5", do nothig. if not, raise an exception. if p.image is not empty, return size of the image that was fed to the parser p. double the chunk size. return None. execute regardless of the exception being raised, if close is True, close file file. if not, set the file position pointer at file_pos. import module os. __all__ is a tuple containing strings: 'LOCK_EX', 'LOCK_SH', 'LOCK_NB', 'lock' and 'unlock'. define the _fd function with argument f. return result of the f.fileno method if f has an 'fileno' attribute, otherwise return f. if os.name equals to 'nt', import msvcrt. from ctypes import sizeof, c_ulong, c_void_p, c_int64, Structure, Union, POINTER, windll and byref into default name space. from ctypes.wintypes import BOOL, DWORD and HANDLE into default name space. LOCK_SH is a integer 0. LOCK_NB is a hexadecimal 1. LOCK_EX is a hexadecimal 2. if size of c_ulong does not equals to size of c_void_p, substitute c_int64 for ULONG_PTR. if not, substitute c_ulong for ULONG_PTR. substitute c_void_p for PVOID. derive the class _OFFSET from the Structure base class. _fields_ is a list containing 2 tuples: first tuple contains: string 'Offset' and DWORD, second contains: string 'OffsetHigh' and DWORD. derive the class _OFFSET_UNION from the Union base class. _anonymous_ is a list containing one string: '_offset'. _fields_ is a list containing 2 tuples: first tuple contains: string '_offset' and _OFFSET, second contains: string 'Pointer' and PVOID. derive the class OVERLAPPED from the Structure base class. _anonymous_ is a list containing one string: '_offset_union'. _fields_ is a list containing 4 tuples: first tuple contains: string 'Internal' and ULONG_PTR, second contains: string 'InternalHigh and ULONG_PTR, third: '_offset_union' and _OFFSET_UNION, forth 'hEvent' and HANDLE. call the function POINTER with argument OVERLAPPED, substitute the result for LPOVERLAPPED. substitute windll.kernel32.LockFileEx for LockFileEx. substitute BOOL for LockFileEx.restype. LockFileEx.argtypes is a list containing 6 elements: HANDLE, DWORD, DWORD, DWORD, DWORD and LPOVERLAPPED. substitute windll.kernel32.UnlockFileEx for UnlockFileEx. substitute BOOL for UnlockFileEx.restype. UnlockFileEx.argtypes is a list containing 5 elements: HANDLE, DWORD, DWORD, DWORD and LPOVERLAPPED. define the function lock with arguments f and flags. call the function msvcrt.get_osfhandle with return value of the _fd(f) function as argument, substitute the result for hfile. call the OVERLAPPED function, substitute the result for overlapped. call the LockFileEx function with 6 arguments: hfile, flags, integer 0, integer 0, hexadecimal value FFFF0000, return value of the byref function called with argument overlapped, substitute the result for ret. convert ret to a boolean, return it. define the function unlock with argument f. call the function msvcrt.get_osfhandle with return value of the _fd(f) function as argument, substitute the result for hfile. call the OVERLAPPED function, substitute the result for overlapped. call the LockFileEx function with 5 arguments: hfile, integer 0, integer 0, hexadecimal value FFFF0000, return value of the byref function called with argument overlapped, substitute the result for ret. convert ret to a boolean, return it. if not, try, import fcntl. substitute fcntl.LOCK_SH for LOCK_SH. substitute fcntl.LOCK_NB for LOCK_NB. substitute fcntl.LOCK_EX for LOCK_EX. if ImportError or AttributeError exception occurred, LOCK_EX, LOCK_SH and LOCK_NB are all equal to integer 0. define the function lock with arguments f and flags. return boolean False. define the function unlock with argument f. return boolean True. if not, define the function lock with arguments f and flags. call the function fcntl.flock with return value of the _fd(f) function and flags as arguments, substitute the result for ret. if ret equals to integer 0, return boolean True, otherwise return boolean False. define the function unlock with argument f. all the function fcntl.flock with return value of the _fd(f) function and fcntl.LOCK_UN as arguments, substitute the result for ret. if ret equals to integer 0, return boolean True, otherwise return boolean False. import module os. from django.core.files import locks into default name space. try, from shutil import copystat into default name space. if ImportError exception occurred, import stat. define the function copystat with arguments src and dst. call the os.stat function with argument src, substitute the result for st. call the function stat.S_IMODE with argument st.st_mode, substitute the result for mode. if os has an attribute 'utime', call the os.utime function with arguments dst and tuple containing 2 elements: st.st_atime and st.st_mtime. if os has an attribute 'chmod', call the function os.chmod with arguments dst and mode. __all__ is a list containing a string 'file_move_safe'. define the function _samefile with arguments src and dst. if os.path has an attribute 'samefile', try, call the os.path.samefile with arguments src and dst, return the result. if exception OSError occurred, return boolean False. if file path of src and dst files are the same, return boolean True, otherwise return boolean False. define the function file_move_safe with 4 arguments: old_file_name, new_file_name, chunk_size set to multiple of integers 1024 and 64, if call to the function _samefile with old_file_name and new_file_name evaluates to boolean True, return nothing. try, if allow_overwrite is boolean False and call to the os.access function with arguments new_file_name and os.F_OK evaluates to boolean True, raise an IOError exception with string "Destination file %s exists and allow_overwrite is False" as argument, where '%s' is replaced by new_file_name. call the os.rename function with arguments old_file_name and new_file_name. return nothing. if OSError exception is caught, do nothing. open file old_file_name in read bytes mode, with file descriptor as f, evaluate the binary expression with 4 operands: os.O_WRONLY, binary or os.O_CREATE, binary or 'O_BINARY' attribute of object os, binary or os.O_EXCL if allow_overwrite is boolean False, use the previous as the mode to open new_file_name file, assign the file descriptor to fd. try, call the function locks.lock with arguments fd and locks.LOCK_EX. current_chunk is None. as long as current_chunk is not an empty string, read chunk_size bytes from the old_file file, substitute the result for current_chunk. write current_chunk to file fd. finally perform, call the function locks.unlock with fd as argument. close the file fd. call the function copystat with old_file_name and new_file_name as arguments. tr, remove the old_file_name file. if OSError, renamed to e, is caught, if attribute 'winerror' of object e is not equal to integer 32 and if 'errno' attribute is not equal to integer 13, raise an exception. import module os. import module errno. import module itertools. from datetime import datetime into default name space. from django.conf import settings into default name space. from django.core.exceptions import SuspiciousFileOperation into default name space. from django.core.files import locks and File into default name space. from django.core.files.move import file_move_safe into default name space. from django.utils.encoding import force_text and filepath_to_uri into default name space. from django.utils.functional import LazyObject into default name space. from django.utils.module_loading import import_string into default name space. from django.utils.six.moves.urllib.parse import urljoin into default name space. from django.utils.text import get_valid_filename into default name space. from django.utils._os import safe_join and abspathu into default name space. from django.utils.deconstruct import deconstructible into default name space. __all__ is a tuple containing strings: 'Storage', 'FileSystemStorage', 'DefaultStorage' and 'default_storage'. derive the class Storage from the object base class. define the method open with arguments self, name and mode defaulting to string 'rb'. call the self._open method with name and mode arguments, return the result. define the method save with arguments self, name and content. if name is None, substitute content.name for name. if content has an 'chunks' attribute, content is a File object instance created with content argument. call the method self.get_available_name with argument name, substitute it for name. call the method self._save with arguments name and content, substitute it for name. replace all the strings '\\' with '/' in the string name, use it as an argument for the call to the force_text function, return the result. define the method det_valid_name with arguments self and name. call the get_valid_filename with argument name, return the result. define the method get_available_name with arguments self and name. call the os.path.split with argument name, assign the result to the dir_name and file_name respectively. call the os.path.splitext with argument file_name, assign the result to the file_root and file_ext respectively. call the itertools.count function with argument integer 1, substitute the result for count. as long as self.exists function with argument name evaluates to boolean True, substitute '%s' in string "%s_%s%s" with: file_root, next(count) and file_ext, join the dir_name and previous string into a valid file path, substitute it for name. return name. define the method path with arguments self and name. raise an NotImplementedError exception with argument string "This backend doesn't support absolute paths.". define the method delete with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a delete() method'. define the method exists with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide an exists() method'. define the method listdir with arguments self and path. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a listdir() method'. define the method size with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a size() method'. define the method url with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a url() method'. define the method accessed_time with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide an accessed_time() method'. define the method created_time with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a created_time() method'. define the method modified_time with arguments self and name. raise an NotImplementedError exception with argument string 'subclasses of Storage must provide a modified_time() method'. decorator deconstructible, derive the class FileSystemStorage from the Storage base class. define the method __init__ with 5 arguments: self, location set to None, base_url set to None, file_permissions_mode set to None, and directory_permissions_mode set to None. if location is None, substitute the settings.MEDIA_ROOT for location. substitute the location for self.base_location. substitute the return value of the function abspathu with self.base_location as argument for self.location. if base_url is None, substitute settings.MEDIA_URL for base_url. otherwise if base_url does not ends with '/' character, append character '/' to the base_url. substitute base_url for self.base_url. self.file_permissions_mode is a tuple containing: file_permissions_mode if file_permissions_mode is not None, or settings.FILE_UPLOAD_PERMISSIONS if it is. self.directory_permissions_mode is a tuple containing: directory_permissions_mode if directory_permissions_mode is not None, or settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS if it is. define the method _open with arguments self, name and mode defaulting to string 'rb'. call the function self.path with argument name, use it and mode as arguments for the call to the function open, use it as an argument for creatinon of a File object instance, return it. define the method _save with arguments self, name and content. substitute result of the self.path function with argument name for full_path. call the function os.path.dirname with argument full_path, substitute the result for directory. if call to the function os.path.exists with argument directory evaluates to boolean False, try, if self.directory_permissions_mode is not None, call the os.umask function with argument integer 0, substitute the result for old_umask. try, call the os.makedirs function with directory and self.directory_permissions_mode as arguments. finally perform, call the os.umask function with argument old_umask. if not, call the function os.makedirs with argument directory. if exception OSError, renamed to e, occurred, if e.errno is not equal to errno.EEXIST, raise an exception. if directory is not an directory, raise an IOError exception with argument string "%s exists and is not a directory.", where '%s' is replaced by directory. endless loop, try, if content has an attribute 'temporary_file_path', call the function file_move_safe with content.temporary_file_path function result and full_path. if not, evaluate binary expression with 4 operands: os.O_WRONLY, binary or os.O_CREAT, binary or os.O_EXCL, binary or 'O_BINARY' attribute of the os object, or integer 0 if it doesnt exists. call the os.open function with full_path, flags and octal number 0o666 as arguments, substitute the result for fd. _file is None. try, call the function locks.lock with fd and locks.LOCK_EX as arguments. for every chunk in content.chunks function return value, if _file is None, mode is a string 'wb' is chunk is instance of the type bytes, otherwise mode is a string 'wt'. call the function os.fdopen with arguments fd and mode, substitute it for _file. write the chunk to the file _file. finally perform, call the function locks.unlock with argument fd. if _file is not None, close the _file file. if not, close fd file. if OSError, renamed to e, is caught, if e.errno equals to errno.EEXIST, call the method self.get_available_name with argument name, substitute the result for name. call the method self.path with argument name, substitute the result for full_path. if not, raise an exception. if not, break from the smallest enclosing loop. if self.file_permissions_mode is not None, call the function os.chmod with arguments full_path and self.file_permissions_mode. return name. define the method delete with arguments self and name. if name is boolean False raise an assert error with message string "The name argument is not allowed to be empty.". call the self.path with argument name, substitute it for name. if os.path.exists function with argument name, evaluates to boolean True, try, call the os.remove function with argument name. if OSError, renamed to e, is caught, if e.errno equals to errno.EEXIST, raise an exception. define the method exists with arguments self and name. call the self.path function with argument name, use the result as the argument for the call to the os.path.exists function, return the result. define the method listdir with arguments self and path. call the self.path function with argument path, substitute it for path. directories, files are empty lists. for every entry in os.listdir function return value called with the argument path, join path and entry into a file path, if it exists, append entry to the directories list. if not, append entry to files list. return directories and files. define the method path with arguments self and name. try, call the safe_join function with arguments self.location and name, substitute it for path. if ValueError exception is caught, raise an SuspiciousFileOperation exception with string "Attempted access to '%s' denied." as argument, replace '%s' with name. call the os.path.normpath with argument path, return the result. define the method size with arguments self and name. call the self.path with argument name, use the result as an argument for the call to the os.path.getsize function, return the result. define the method url with arguments self and name. if self.base_url is None, raise an ValueError with string "This file is not accessible via a URL." as argument. call the urljoin function with arguments: self.base_url and result of the call to the function filepath_to_uri with argument name, return the result. define the method accessed_time with arguments self and name. call the function self.path with argument name, use the result as an argument for the call to the function os.path.getatime, use the result as an argument for the call to the function datetime.fromtimestamp, return the result. define the method created_time with arguments self and name. call the function self.path with argument name, use the result as an argument for the call to the function os.path.getctime, use the result as an argument for the call to the function datetime.fromtimestamp, return the result. define the method modified_time with arguments self and name. call the function self.path with argument name, use the result as an argument for the call to the function os.path.getmtime, use the result as an argument for the call to the function datetime.fromtimestamp, return the result. define the function get_storage_class with argument import_path=None defaulting to None. call the import_string with argument: import_path if exists or settings.DEFAULT_FILE_STORAGE, if not, return the result. derive the class DefaultStorage from the LazyObject base class. define the _setup method with argument self. call the function that is the return value of get_storage_class method, substitute the result for self._wrapped. call the DefaultStorage method, substitute the result for default_storage. import module os. import module tempfile. from django.core.files.utils import FileProxyMixin into default name space. __all__ is a tuple, containing strings 'NamedTemporaryFile' and 'gettempdir'. if module os field name equals to string 'nt', derive class TemporaryFile from the base class FileProxyMixin. define method __init__ with self class instance, mode string 'w+b', bufsize set to integer -1, suffix and prefix set to empty strig, dir set to None as the arguments. call the method tmpfile.mkstemp with suffix set to suffix, prefix set to prefix and dir set to dir, store the result in the fd and name, respective. substitute name for self.name. call the os.fdopen function with fd, mode and bufsize as the arguments, assign the file handle object to self.file. substitute False for self.close_called. substitute os.unlink for unlink. define the method close with self class instance as the argument. if self.close_called is False, substitute True for self.close_called. try, close the file object. if OSError or IOError exceptions were raised, do nothing. try, call the method unlink on self with self.name as the argument. if OSError exception was raised, do nothing. property decorator, to be called by property built-in function. define the method closed with self as the argument. return self.file.closed. define __del__ method with self as the argument. call the method close on self. define __enter__ method with self as the argument. call the file.__enter__ method on self. return self. define method __exit__ with self, exc, value and tb as the arguments. call the file.__exit__ method on self with exc, value and tb as the arguments. substitute TemporaryFile for NamedTemporaryFile. if not, substitute tempfile.NamedTemporaryFile for NamedTemporaryFile. substitute tempfile.gettempdir for gettempdir. import module errno. import module os. from io import BytesIO into default name space. from django.conf import settings into default name space. from django.core.files.base import File into default name space. from django.core.files import temp as tempfile into default name space. from django.utils.encoding import force_str into default name space. __all__ is a tuple containing strings: 'UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile' and 'SimpleUploadedFile'. derive the UploadedFile class from the File base class. bring integer 2 to the power of 10, multiply it by integer 64, substitute the result for DEFAULT_CHUNK_SIZE. define the method __init__ with 7 arguments: self, file set to None, name set to None, content_type set to None, size set to None, charset set to None and content_type_extra set to None. call the __init__ method with arguments file and name, from the base class of the UploadedFile class. substitute size for self.size. substitute content_type for self.content_type. substitute charset for self.charset. substitute content_type_extra for self.content_type_extra. define the method __repr__ with argument self. substitute '%s' from string "<%s: %s (%s)>" with self.__class__.__name__, self.name and self.content_type, respectively, use it as an argument for the call to the function force_str, return the result. define the method _get_name with argument self. return self._name. define the method _set_name with arguments self and name. if name is not None, call the function os.path.basename with argument name, substitute the result for name. if length of name is greater than integer 255, call the os.path.splitex with argument name, assign the result to name and ext, respectively. substitute the first 255 elements of ext for ext. subtract length of the ext from the integer 255, take first elements of the name list up to the previous result index, append ext to the end of it, substitute the resulting list for name. substitute name for self._name. name is a property object with _get_name as a getter method and _set_name as a setter method. derive the TemporaryUploadedFile class from the UploadedFile base class. define the __init__ method with 6 arguments: self, name, content_type, size, charset and content_type_extra set to None. if settings.FILE_UPLOAD_TEMP_DIR is true, call the method tempfile.NamedTemporaryFile with arguments: suffix set to string '.upload' and dir set to settings.FILE_UPLOAD_TEMP_DIR. if not, call the method tempfile.NamedTemporaryFile with argument suffix set to string '.upload'. call the method __init__ from the base class of the TemporaryUploadedFile class with arguments: file, name, content_type, size, charset and content_type_extra. define the method temporary_file_path with argument self. return self.file.name. define the method close with argument self. try, call the self.file.close method, return the result. if OSError, renamed to e, exception is caught, if e.errno is not equal to errno.ENOENT, raise an exception. derive the InMemoryUploadedFile class from the UploadedFile base class. define the method __init__ with 8 arguments: self, file, field_name, name, content_type, size, charset and content_type_extra set to None. call the method __init__ from the base class of the InMemoryUploadedFile base class, with 6 arguments: file, name, content_type, size, charset, content_type_extra. substitute field_name for self.field_name. define the method open with arguments self and mode set to None. set the file pointer at the beginning of the self.file file. define the method chunks with arguments self ad chunk_size set to None. set the file pointer at the beginning of the self.file file. read the whole self file and yield it as a generator return value. define the method multiple_chunks with arguments self and hunk_size set to None. return boolean False. derive the SimpleUploadedFile class from the InMemoryUploadedFile base class. define the method __init__ with 4 arguments: self, name, content and content_type defaulting to a string 'text/plain'. if content is empty, substitute it for an empty string. call the __init__ method from the base class of the SimpleUploadedFile class with 7 arguments: BytesIO(content), None, name, content_type, length of content, None and None. decorator classmethod. define the method from_dict with argument cls and file_dict. call the method cls with 3 arguments: value under the 'filename' key of file_dict, value under the 'content' key of file_dict, from __future__ import unicode_literals into default name space. from io import BytesIO into default name space. from django.conf import settings into default name space. from django.core.files.uploadedfile import TemporaryUploadedFile and InMemoryUploadedFile into default name space. from django.utils.encoding import python_2_unicode_compatible into default name space. from django.utils.module_loading import import_string into default name space. __all__ is a string containing strings: 'UploadFileException', 'StopUpload', 'SkipFile', 'FileUploadHandler', 'TemporaryFileUploadHandler', 'MemoryFileUploadHandler', 'load_handler' and 'StopFutureHandlers'. derive the class UploadFileException from the Exception base class. do nothing. decorator python_2_unicode_compatible, derive the class StopUpload from the UploadFileException base class. define the method __init__ with arguments self and connection_reset defaulting to boolean False. substitute connection_reset for self.connection_reset. define the method __str__ with argument self. if self.connection_reset is true, return string 'StopUpload: Halt current upload.'. if not, return string 'StopUpload: Consume request data, then halt.'. derive the class SkipFile from the UploadFileException base class. do nothing. derive the class StopFutureHandlers from the UploadFileException base class. do nothing. derive the class FileUploadHandler from the object base class. bring integer 2 to the power of 10, multiply it by integer 64, substitute the result for chunk_size. define the method __init__ with arguments self and request defaulting to None. self.file_name is None. self.content_type is None. self.content_length is None. self.charset is None. self.content_type_extra is None. self.request is None. define the method handle_raw_input with arguments: self, input_data, META, content_length, boundary and encoding set to None. do nothing. define the method new_file with arguments: self, field_name, file_name, content_type, content_length, charset set to None, substitute field_name for self.field_name. substitute file_name for self.file_name. substitute content_type for self.content_type. substitute content_length for self.content_length. substitute charset for self.charset. substitute content_type_extra for self.content_type_extra. define the method receive_data_chunk with arguments: self, raw_data and start. raise an NotImplementedError with argument string 'subclasses of FileUploadHandler must provide a receive_data_chunk() method'. define the method file_complete with arguments: self and file_size. raise an NotImplementedError with argument string 'subclasses of FileUploadHandler must provide a file_complete() method'. define the method upload_complete with argument self. do nothing. derive the class TemporaryFileUploadHandler from the FileUploadHandler base class. define the method __init__ with arguments self, argument list args and dictionary of arguments kwargs. call the __init__ method from the base class of the TemporaryFileUploadHandler class with arguments: unpacked list args, and unpacked dictionary kwargs. define the method new_file with arguments: self, file_name, unpacked list args and unpacked dictionary kwargs. call the method new_file from the base class of the TemporaryFileUploadHandler class with arguments: file_name, unpacked list args and unpacked dictionary kwargs. self.file is a instance of a class TemporaryUploadedFile initialized with arguments: self.file_name, self.content_type, integer 0, self.charset and self.content_type_extra. define the method receive_data_chunk with arguments: self, raw_data and start. call the method self.file.write with argument raw_data. define the method file_complete with arguments self and file_size. position the file pointer at the start of the self.file file. substitute file_size for self.file.size. return self.file. derive the class MemoryFileUploadHandler from the FileUploadHandler base class. define the method handle_raw_input with arguments: self, input_data, META, content_length, boundary and encoding set to None. if content_length is greater than settings.FILE_UPLOAD_MAX_MEMORY_SIZE, self.activated is boolean False. if not, self.activated is boolean True. define the method new_file with arguments: self, unpacked list args and unpacked dictionary kwargs. call the new_file method form the base class from the MemoryFileUploadHandler class with arguments: unpacked list args and unpacked list kwargs. if self.activated is boolean True, call the function BytesIO, substitute the result for self.file. raise an exception StopFutureHandlers. define the function receive_data_chunk with arguments self, raw_data and start. if self.activated is boolean True, write raw_data to self.file file. if not, return raw_data. define the function file_complete with arguments self and file_size. if self.activated is boolean False, return nothing. set file pointer at the beginning of the self.file file. initialize the object of a InMemoryUploadedFile class with arguments: file set to self.file, field_name set to self.field_name, name set to self.file_name, content_type set to self.content_type, size set to file_size, charset set to self.charset, and content_type_extra set to self.content_type_extra, return it. define the function load_handler with arguments: path, unpacked list args and unpacked dictionary kwargs. call the import_string with arguments path, call the return function with arguments: unpacked list args and unpacked dictionary kwargs, return the result. derive class FileProxyMixin from the base class object, making it a new-style class. define lambda function that returns self.file.encoding field, use it as an argument for property function, put the result in encoding. define lambda function that returns self.file.fileno field, use it as an argument for property function, put the result in fileno. define lambda function that returns self.file.flush field, use it as an argument for property function, put the result in flush. define lambda function that returns self.file.isatty field, use it as an argument for property function, put the result in isatty. define lambda function that returns self.file.newlines field, use it as an argument for property function, put the result in newlines. define lambda function that returns self.file.read field, use it as an argument for property function, put the result in read. define lambda function that returns self.file.readinto field, use it as an argument for property function, put the result in readinto. define lambda function that returns self.file.readline field, use it as an argument for property function, put the result in readline. define lambda function that returns self.file.readlines field, use it as an argument for property function, put the result in readlines. define lambda function that returns self.file.seek field, use it as an argument for property function, put the result in seek. define lambda function that returns self.file.softspace field, use it as an argument for property function, put the result in softspace. define lambda function that returns self.file.tell field, use it as an argument for property function, put the result in tell. define lambda function that returns self.file.truncate field, use it as an argument for property function, put the result in truncate. define lambda function that returns self.file.write field, use it as an argument for property function, put the result in write. define lambda function that returns self.file.writelines field, use it as an argument for property function, put the result in writelines. define lambda function that returns self.file.xreadlines field, use it as an argument for property function, put the result in xreadlines. define iterator method __iter__ with self as the argument. return iterator object based on the self.file collection object. from __future__ import unicode_literals into default name space. import module logging. import module sys. import module types. from django import http into default name space. from django.conf import settings into default name space. from django.core import urlresolvers into default name space. from django.core import signals into default name space. from django.core.exceptions import MiddlewareNotUsed, PermissionDenied and SuspiciousOperation into default name space. from django.db import connections and transaction into default name space. from django.utils.encoding import force_text into default name space. from django.utils.module_loading import import_string into default name space. from django.utils import six into default name space. from django.views import debug into default name space. call the function logging.getLogger with string 'django.request' as the argument, assign the return object handle to logger. derive class BaseHandler, derive from the base class object, making this a new style class. response_fixes is a list with http.fix_location_header and http.conditional_content_removal as elements. define initialization method __init__, with self class instance as the argument. set class fields _request_middleware, _view_middleware, _template_response_middleware, _response_middleware and _exception_middleware to None. define method load_middleware with class instance self as the argument. self._view_middleware is an empty list. self._template_response_middleware is an empty list. _response_middleware is an empty list. exception_middleware is an empty list. request_middleware is an empty list. for every middleware_path in settings.MIDDLEWARE_CLASSES: evaluate the function import_string with middleware_path as argument, substitute the result for my_class. try, call the mw_class function, store the result in the mw_instance. if MiddlewareNotUsed exception is raised, skip this iteration of he smallest enclosing loop. if mw_instance has an attribute named 'process_request'. append mw_instance.process_request at the end of request_middleware. if mw_instance has an attribute named 'process_view'. append mw_instance.process_view at the end of self._view_middleware. if mw_instance has an attribute named 'process_template_response'. insert mw_instance.process_template_response at the beginning of self._template_response_middleware. if mw_instance has an attribute named 'process_response'. insert mw_instance.process_response at the beginning of self._response_middleware. if mw_instance has an attribute named 'process_exception'. insert mw_instance.process_exception at the beginning of self._exception_middleware. substitute self._request_middleware for request_middleware. define the method make_view_atomic, with self class instance and view as the arguments. get attribute '_non_atomic_requests' from the view object, if the attribute doesnt exist return the empty set, substitute the result for non_atomic_requests. call the method connections.all(), perform the following for every db in the result, if value under the key 'ATOMIC_REQUESTS of db.settings_dic dictionary is True and db.alias is not present in the non_atomic_requests, call the function transaction.atomic, with using set to db.alias as the argument, return value is a function which is called, with the argument view, store the result in the view. return view define method get_exception_response, with self class instance, request, resolver and status_code as the arguments. try, call the function resolver.resolve_error_handler with status_code as an argument, assign the result to the callback and param_dict, respectively. call the callback function with request and dictionary argument param_dict as the arguments, substitute it for response. if an exception occurred, call the method signals.got_request_exception.send with the sender set to the type of this class, and request set to request as the arguments. call the method self.handle_uncaught_exception with request, resolver and return value of the function sys.exec_info as the arguments. return response define the method get_response, with self class instance and request as the arguments. substitute settings.ROOT_URLCONF for urlconf. call the method urlresolvers.set_urlconf with urlconf as the argument. call the method urlresolvers.RegexURLResolver with raw literal string '^/' and urlconf as the arguments, substitute the result for resolver. try, set response to None. for every middleware_method in self._request_middleware, call the middleware_method with the request as an argument, substitute the result for response. if response is True, breaks from the smallest enclosing loop execution. if response is None, if request has an attribute named 'urlconf', substitute request.urlconf for urlconf. call the function urlresolvers.set_urlconf with urlconf as the argument. call the method urlresolvers.RegexURLResolver with raw literal string '^/' and urlconf as the arguments, substitute the result for resolver. call to the resolver.resolve method with request.path_info as an argument. assign the values to the callback, callback_args, callback_kwargs, respectively, from the resolver_match tuple. substitute resolver_match for request.resolver_match. for every middleware_method in self._view_middleware, call the middleware_method with request, callback, callback_args and callback_kwargs as the arguments, substitute the result for response. if response is True, break from the smallest enclosing loop execution. if response is None, call the method self.make_view_atomic with callback as the argument, substitute the result for the wrapped_callback. try, call the function wrapped_callback with request, list or arguments callback_args and dictionary arguments callback_kwargs, as the arguments, substitute the result for response. if Exception, renamed to e, exception is caught, for every middleware_method in self._exception_middleware, call the middleware_method with request and e as the arguments, substitute the result for response. if response is True, break from the smallest enclosing loop execution. if response is None, raise the exception. if response is None, if callback is of instance types.FunctionType, get the name of the callback, substitute it for view_name. if not, get the name of the type of the callback, append the string '.__call__' to it, substitute it for view_name. substitute the '%s' in the string "The view %s.%s didn't return an HttpResponse object. It returned None instead.", with the name of the module callback is in and the view_name, respectively, use it as the argument for the ValueError exception raise. if response has an attribute named 'render' and response.render is a callable function, for every middleware_method in self._template_response_middleware, call the function middleware_method with the request and response as the arguments, assign the result to response. if response is None, replace '%s' in the string "%s.process_template_response didn't return an HttpResponse object. It returned None instead.", with name of the class type of the middleware_method instance, use it as the argument for call to the ValueError exception raise. call the response.render() method and assign the return to the response. if exception http.Http404 as e is caught, substitute '%s' in 'Not Found: %s' with request.path, extra is an dictionary with two pairs of elements 'status_code' with value 404, and 'request with value request, respectively use the previous as the arguments for the call to the logger.warning function. if settings.DEBUG is True, call the function debug.technical_404_response with request and e as arguments, assign the result to response. if not, call the method self.get_exception_response with request, resolver and integer 404 as the arguments, assign the result to response. if exception PermissionDenied is caught, substitute '%s' in 'Forbidden (Permission denied): %s' with request.path, extra is an dictionary with two pairs of elements, 'status_code' with value 403, and 'request with value request, respectively use the previous as the arguments for the call to the logger.warning function. call the method self.get_exception_response with request, resolver and integer 403 as the arguments, assign the result to response. if exception SuspiciousOperation as e is caught, substitute '%s' in 'django.security.%s' with the name of the type of the class object e, use it as the argument for the call to the, function logging.getLogger, assign the result to the security_logger. evaluate the function force_text with e as an argument, extra is an dictionary with two pair of elements, 'status code' with integer value of 400 and 'request' with value request, respectively use the previous to call the function security_logger.error. if settings.DEBUG is True, evaluate the function debug.technical_500_response with request, evaluated value of function sys.exc_info as a list, status code set to integer 400, return the result. call the method self.get_exception_response with the request, resolver and integer 400 as the arguments, substitute the result for response. if SystemExit exception is caught, raise an exception. otherwise if any other exception is caught, call the method signals.got_request_exception.send with sender set to type of the self class instance and request set to request. call to the self.handle_uncaught_exception method with request, resolver and value of the evaluated function sys.exec_info, as the arguments, substitute the result for response. try, for every middleware_method in self._response_middleware, call the function middleware_method with request and response as the arguments, substitute the result for response. if response is None, substitute '%s' is "%s.process_response didn't return an HttpResponse object. It returned None instead.", with the name of the type of the self class instance of the middleware_method, raise the ValueError with the previous as the argument. call the method self.apply_response_fixes with the request and response as the arguments, substitute the result for response. if any exception is caught, call the signals.got_request_exception.send method with sender set to type of the self class instance and request set to request. call to the self.handle_uncaught_exception method with request, resolver and value of the evaluated function sys.exec_info, as the arguments, substitute the result for response. append the request to the end of the protected class member response._closable_objects. return response. define the method handle_uncaught_exception with self class instance, request, resolver and exec_info as arguments. if settings.DEBUG_PROPAGATE_EXCEPTIONS is True, raise an exception. substitute '%s' in 'Internal Server Error: %s' with request.path, exc_info set to exc_info, extra is an dictionary with two pairs of elements 'status_code' with value 500, and 'request with value request, respectively use the previous as the arguments for the call to the logger.error function. if settings.DEBUG is True, evaluate debug.technical_500_response with request and list of arguments exec_info, return the result. if resolver.urlconf_module is None: call the function reraise from the module six, with list of arguments exec_info. call the resolver.resolve_error_handler with integer 500 as the argument, assign the resulting tuple elements to the callback, and param_dict, respectively. evaluate the function callback with request and dictionary of parameters param_dict as the arguments, return the result. define the method apply_response_fixes with self class instance, request and response as the arguments. for every func in self.response_fixes, call the function func with request and response as arguments, assign the result to response. return response. from __future__ import unicode_literals into default name space. import module cgi. import module codecs. import module logging. import module sys. from io import BytesIO into default name space. from threading import Lock into default name space. import module warnings. from django import http into default name space. from django.conf import settings into default name space. from django.core import signals into default name space. from django.core.handlers import base into default name space. from django.core.urlresolvers import set_script_prefix into default name space. from django.utils import datastructures into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. from django.utils.encoding import force_str and force_text into default name space. from django.utils.functional import cached_property into default name space. from django.utils import six into default name space. from django.http.response import REASON_PHRASES as STATUS_CODE_TEXT # NOQA into default name space. call logging.getLogger method with string 'django.request' as argument, store the result in logger. ISO_8859_1 is a string 'iso-8859-1', UTF_8 is a string 'utf-8'. derive class LimitedStream from the object base class, making it a new-style class. def initialization method __init__ with self class instance, stream, limit and buf_size set to integer value of the product 64*1024*1024. substitute stream for self.stream. substitute limit for self.remaining. substitute empty bytes string for self.buffer. substitute buf_size for self.buf_size. define the method _read_limited with self class instance and size set to None as arguments. if size is None or size is greater than self.remaining, substitute self.remaining for size. if size equals to integer zero. return empty bytes string. read size number of bytes from self.stream stream, store the result in the result. decrement self.remaining by length of result. return result. define the method read with self class instance and size set to None as arguments. if size is None, add self.buffer and self._read_limited method return value together, store it in result. substitute empty bytes string for self.buffer. otherwise if size is less than length of self.buffer, substitute first size elements of self.buffer for result. truncate first size number of elements of self.buffer. if not, call the method self.read_limited with length of self.buffer subtracted from size as argument, add result to self.buffer, store it in result. substitute empty bytes string for self.buffer. return result. define method readline with self class instance and size set to None. while newline character is not contained in self.buffer and, size is None or length of self.buffer is less than size, if size is not zero, call the self._read_limiter with length of self.buffer subtracted from size as argument, store the result into chunk. if not, call the method self._read_limited, store the return value into chunk. if chunk is empty, break the execution of the smallest enclosing loop. increment self.buffer by chunk. call the function BytesIO with self.buffer as argument, store the result is sio. if size is not empty, call the sio.readline method with size as an argument, substitute the result for line. if not, call the sio.readline method, substitute the result for line. call the sio.read method, substitute the result for self.buffer. return line. derive the class WSGIRequest from base class http.HttpRequest. define the initialization method __init__ with self class instance and environ as arguments. call the get_script_name function with environ as argument, substitute the result for script_name. call the get_path_info function with environ as argument, substitute the result for path_info. if path_info is empty, path_info is a character '/'. substitute environ for self.environ. substitute path_info for self.path_info. strip trailing '/' from the script_name string, remove first occurrence of '/' in path_info string, append second result to the first, separated with '/', assign the result to self.path. substitute environ for self.META. assign path_info to the value under the 'PATH_INFO' key of the self.META dictionary. assign script_name to the value under the 'SCRIP_NAME' key of the self.META dictionary. convert value under the 'REQUEST_METHOD' key of the environ dictionary to uppercase, substitute it for self.method. get the value under the 'CONTENT_TYPE' key of environ dictionary, if the key doesnt exist get the empty string, use it to call the cgi.parse_header method, assign the result to the _ and content_params respectively. if string 'charset' is contained in content_params, try, get the value under the 'charset' key of content_params dictionary, use it to call the codec.lookup method. if exception LookupError is caught, do nothing. if not, get the value under the 'charset' key of content_params dictionary, substitute it for self.encoding. self._post_parse_error is boolean False. try, convert value under the 'CONTENT_LENGTH' key of the environ dictionary to an integer, substitute it for content_length. if exception ValueError or TypeError is caught, content_length is integer 0. self._stream is a class instance of a LimitedStream class, initialized with self.environ dictionary value under the 'wsgi.input' key, and content_length. self._read_started is boolean False. self.resolver_match is None. define the method _get_scheme with self class instance as argument. return value under the 'wsgi.url_scheme' key of self.environ dictionary. define the method _get_request with self class instance as argument. call the warnings.warn method with string '`request.REQUEST` is deprecated, use `request.GET` or `request.POST` instead.', RemovedInDjango19Warning and integer 2 as arguments. if self does not have an '_request' attribute, call the datastructures.MergeDict with self.POST and self.GET as arguments, assign the result to self._request. return self._request. decorator cached_property. define method GET with self class instance as an argument. call the get_bytes_from_wsgi function with self.environ, string 'QUERY_STRING' and empty string as arguments, substitute the return value for raw_query_string. evaluate the http.QueryDict method with raw_query_string and encoding set to self._encoding as arguments, return the result. def _get_post method with self class instance as the argument. if self does not has an '_post' attribute. call the self._load_post_and_files method. return self._post. define the _set_post method with self class instance and post as the arguments. substitute post for self._post. decorator cached_property. define COOKIES method with self as the argument. call get_str_from_wsgi function with self.environ, string 'HTTP_COOKIE' and empty string as arguments, substitute it for raw_cookie. evaluate the function http.parse_cookie with raw_cookie as an argument, return the result. define _get_files method with self class instance as the argument. if self does not have '_files' attribute, call the method self._load_post_and_files. return self._files. _get_post is a getter function and _set_post is a setter function for POST attribute of this class. _get_files is getter function for FILES attribute of this class. _get_request is getter function for REQUEST attribute of this class. derive the WSGIHandler class from the base class base.BaseHandler. evaluate function Lock() assign the result to initLock. substitute WSGIRequest for request_class. define private method __call__ with self class instance, environ and start_response as the arguments. if self._request_middleware is None, with self.initLock, try, if self._request_middleware is None, call the self.load_middleware method. if exception is caught, self._request_middleware is None. re raise an exception. call the get_script_name function with environ as argument, use the result as an argument for call to the set_script_prefix function. call the signals.request_started.send method with sender set to self.__class__ as argument. try, call the self.request_class method with environ as an argument, substitute the result for request. if UnicodeDecodeError exception is caught, call the logger.warning method with string 'Bad Request (UnicodeDecodeError)', exec_info set to sys.exec_info() and dictionary extra with one entry 'status_code' is integer 400, as arguments. call the http.HttpResponseBadRequest function, assign the result to the response. if not, call the self.get_response with request as the argument, substitute the result for response. substitute self.__class__ for response._handler_class. replace '%s' in the string '%s %s' with response.status_code and response.reason_phrase, respectively, substitute it for status. convert to k and v to strings for every k and v in return value of the response.item method, response_headers is a list containing all the above iteration elements. for every c in return value of the method response.cookies.values, convert 'Set-Cookie' to a string and convert the return value of method c.output(header='') call to a string, format the previous in a tuple, append the tuple to the response_headers. call the start_response function with force_str(status) method return value and response_headers as arguments. return response. define the get_path_info function with environ as the argument. call the function get_bytes_from_wsgi with environ, string 'PATH_INFO' and character '/' as arguments, substitute the result for path_info. return path_info.decode method return value called with UTF_8 as the argument. define get_script_name function with environ as an argument. if settings.FORCE_SCRIPT_NAME is not None, evaluate the force_text function with settings.FORCE_SCRIPT_NAME as argument, return the result. call the get_bytes_from_wsgi function with environ, string 'SCRIPT_URL' and empty strings as arguments, substitute the result for script_url. if script_url is false, call the get_bytes_from_wsgi function with environ, string 'REDIRECT_URL' and empty strings as arguments, substitute the result for script_url. if script_url is true, call the get_bytes_from_wsgi function with environ, string 'PATH_INFO' and empty strings as arguments, substitute the result for path_info. take all but the length of path_info last elements of script_url, substitute it for script_name. if not, call the get_bytes_from_wsgi function with environ, string 'SCRIPT_NAME' and empty strings as arguments, substitute the result for script_name. return scrip_name.decode method result called with UTF_8 as argument. define the function get_bytes_from_wsgi with environ, key and default as arguments. convert key and default to strings, get the value under the key string key of the environ dictionary, if it does not exists use the, default string value, substitute it for value. return value if six.PY2 is true, if not return value.encode(ISO_8859_1). define the get_str_from_wsgi function with environ, key and default as arguments. convert key and default to strings, get the value under the key string key of the environ dictionary, if it does not exists use the, default string value, substitute it for value. return value if six.PY2 is true, if not return value.encode(ISO_8859_1).decode(UTF_8). from __future__ import unicode_literals into default name space. from django.conf import settings into default name space. from django.utils.module_loading import import_string into default name space. from django.core.mail.utils import CachedDnsName and DNS_NAME into default name space. from django.core.mail.message import EmailMessage, EmailMultiAlternatives, SafeMIMEText, SafeMIMEMultipart, DEFAULT_ATTACHMENT_MIME_TYPE, make_msgid, BadHeaderError and forbid_multi_line_headers into default name space. __all__ is a list of strings, 'CachedDnsName', 'DNS_NAME', 'EmailMessage', 'EmailMultiAlternatives', 'SafeMIMEText', 'SafeMIMEMultipart', 'DEFAULT_ATTACHMENT_MIME_TYPE', 'make_msgid', 'BadHeaderError', 'forbid_multi_line_headers', 'get_connection', 'send_mail', 'send_mass_mail', 'mail_admins' and 'mail_managers'. define function get_connection with backend set to None, fail_silently set to boolean False and dictionary kwds as arguments. call the function import_string with backend if exists or settings.EMAIL_BACKEND if not, store the result into klass. call the klass method with fail_silently set to fail_silently and dictionary arguments kwds as arguments, return the result. define send_mail funtion with subject, message, from_email, recipient_list, fail_silently set to boolean False, if connection exists dont modify it, if not call get_connection function with username set to auth_user, password set to auth_password, fail_silently set to fail_silently as arguments, assign it to connection. call the EmailMultiAlternatives function with, subject, message, from_email, recipient_list and connection set to connection, as arguments, assign the result to mail. if html_message is True, call the mail.attach_alternative method with html_message and string 'text/html' as arguments. return the evaluated result of the mail.send method. define the function send_mass_mail with, datatuple, fail_silently set to False, auth_user set to None, auth_password set to None, if connection exists dont change it, if not call the get_connection function with username set to auth_user, password set to auth_password, fail_silently set to fail_silently as arguments, assign the result to connection. call the EmailMessage function wit subject, message, sender, recipient and connection set to connection, for every subject, message, sender and recipient in datatuple, store the results in the messages list. return evaluated result of the method connection.send_messages with messages as argument. define the function mail_admins with subject, message, fails_silently set to boolean False, connection set to None, if settings.ADMINS is false, return nothing. call the function EmailMultiAlternatives with settings.EMAIL_SUBJECT_PREFIX and subject converted to strings and concatenated, message, settings.SERVER_EMAIL, list of second elements of a for every a in settings.Managers and connection set to connection, as arguments, assign the result to mail. if html_message is true, call method mail.attach_alternative as html_message and string 'text/hmtl' as arguments. call the mail.send method with fail_silently=fail_silently as argument. define the function mail_managers with subject, message, fails_silently set to boolean False, connection set to None, if settings.MANAGERS does not exist, return nothing. call the function EmailMultiAlternatives with settings.EMAIL_SUBJECT_PREFIX and subject converted to strings and concatenated, message, settings.SERVER_EMAIL, list of second elements of a for every a in settings.Managers and connection set to connection, as arguments, assign the result to mail. if html_message is true, call the mail.attach_alternative method with html_message and string 'text/html' as arguments. call the mail.send method with fail_silently set to fail_silently as argument. derive the class BaseEmailBackend from the object base class. define the method __init__ with arguments: self, fail_silently set to boolean False and unpacked dictionary kwargs. substitute fail_silently for self.fail_silently. define the method open with argument self. do nothing. define the method close with argument self. do nothing define the method __enter__ with argument self. call the method self.open. return self. define the method __exit__ with arguments: self, exc_type, exc_value and traceback. call the method self.close. define the method send_messages with arguments self and email_messages. raise an NotImplementedError exception with argument string 'subclasses of BaseEmailBackend must override send_messages() method'. import module sys. import module threading. from django.core.mail.backends.base import BaseEmailBackend into default name space. from django.utils import six into default name space. derive the class EmailBackend from the BaseEmailBackend base class. define the __init__ method with arguments: self, unpacked list args and unpacked dictionary kwargs. pop the value under the 'stream' key of the kwargs dictionary, if it exists replace it for self.stream, if not replace sys.stdout for self.stream. call the method threading.RLock, substitute the result for self._lock. call the __init__ method from the base class of the EmailBackend class, with arguments: unpacked list args and unpacked dictionary kwargs. define the method write_message with arguments self and message. call the method message.message, substitute the result for msg. call the method msg.as_bytes, substitute the result for msg_data. if six.PY3 is boolean True, if method msg.get_charset evaluates to true, call the get_output_charset method on the return value of the msg.get_charset method, substitute the result for charset, otherwise if it is false, substitute the string 'utf-8' for charset. call the method msg_data.decode with argument charset, substitute the result for msg_data. call the method self.stream.write with argument string '%s\n', with '%s' replaced with msg_data. write 79 '-' characters into self.stream file stream. write a newline into a self.stream file stream. define the method send_messages with arguments self and email_messages. if email_messages is false, return. msg_count is an integer 0. call the method self._lock, with the result, try, call the method self.open, substitute the result for stream_created. for every message in email_messages, call the method self.write_message with argument message. call the method self.stream.flush. increment msg_count by one. if stream_created is true, call the method self.close. if Exception exception is caught, if self.fail_silently is boolean False, raise an exception. return msg_count. from django.core.mail.backends.base import BaseEmailBackend into default name space. derive the class EmailBackend from the BaseEmailBackend base class. define the method send_messages with arguments self and email_messages. create list out of email_messages, return the length of the list. import module datetime. import module os. from django.conf import settings into default name space. from django.core.exceptions import ImproperlyConfigured into default name space. from django.core.mail.backends.console import EmailBackend as ConsoleEmailBackend into default name space. from django.utils import six into default name space. derive the class EmailBackend from the ConsoleEmailBackend base class. define the __init__ method with arguments: self, unpacked list args and unpacked dictionary kwargs. self._fname is None. if 'file_path' is contained in kwargs, pop the value under the 'file_path' key of kwargs dictionary, substitute it for self.file_path. if not, get 'EMAIL_FILE_PATH' from the settings, if it exists, substitute it for self.file_path, if not substitute None for self.file_path. if self.file_path is not an instance of six.string_types, raise an ImproperlyConfigured exception with argument string 'Path for saving emails is invalid: %r', replace '%r' with self.file_path. call the os.path.abspath with argument self.file_path, substitute the result for self.file_path. if self.file_path file path exists and it is not a directory, raise an ImproperlyConfigured exception with argument string 'Path for saving email messages exists, but is not a directory: %s', replace '%s' with self.file_path. otherwise if self.file_path file path doesnt exists, try, call the os.makedirs with argument self.file_path. if OSError, renamed to err, is caught, raise an ImproperlyConfigured exception with argument string 'Could not create directory for saving email messages: %s (%s)', replace '%s' with self.file_path and err, respectively. if self.file_path file is not writable, raise an ImproperlyConfigured exception with argument string 'Could not write to directory: %s', replace '%s' with self.file_path. set value under the 'stream' key of kwargs dictionary to None. call the __init__ method of the base class of the EmailBackend class with arguments: unpacked list args and unpacked dictionary kwargs. define the method write_message with arguments self and message. call the as_bytes method on the return value of the message.message method append to it '\n' character, use it as the argument for the call to the self.stream.write method. write 79 '-' characters into self.stream file stream. write a newline character into self.stream file stream. define the method _get_filename with argument self. if self._fname is None: call the strftime function with argument string "%Y%m%d-%H%M%S" on the return value of the function datetime.datetime.now, substitute the result for timestamp. fname is a string "%s-%s.log", with '%s' replaced by timestamp and absolute value of the return value of the function id with argument self, respectively. join self.file_path and fname into a valid file path, substitute it for self._fname. return self._fname. define the method open with argument self. if self.stream is None: open the file in mode 'ab' and with file name obtained by calling the self._get_filename method. return boolean True. return boolean True. define the method close with argument self. try, if self.stream is not None, call the self.stream.close function. finally perform, self.stream is None. from django.core import mail into default name space. from django.core.mail.backends.base import BaseEmailBackend into default name space. derive the class EmailBackend from the BaseEmailBackend base class. define the method __init__ with arguments: self, unpacked list args and unpacked dictionary kwargs. call the method __init__ from the base class of EmailBackend class, with arguments: unpacked list args and unpacked dictionary kwargs. if mail doesnt have an 'outbox' attribute, mail.outbox is an empty list. define the method send_messages with arguments self and messages. msg_count is integer 0. for every message in messages, call the method message.message. increment mes_count by one. call the method mail.outbox.extend with messages. return msg_count. import module smtplib. import module ssl. import module threading. from django.conf import settings into default name space. from django.core.mail.backends.base import BaseEmailBackend into default name space. from django.core.mail.utils import DNS_NAME into default name space. from django.core.mail.message import sanitize_address into default name space. derive the class EmailBackend from the BaseEmailBackend base class. define the method __init__ with arguments: self, host set to None, port set to None, username set to None, password set to None, use_tls set to None, fail_silently set to False, use_ssl set to None, timeout set to None and unpacked dictionary kwargs. call the __init__ method from the base class of the EmailBackend class with argument fail_silently set to fail_silently. if host exists substitute it for self.host, if not substitute settings.EMAIL_HOST for self.host. if port exists substitute it for self.host, if not substitute settings.EMAIL_PORT for self.port. if username is None substitute settings.EMAIL_HOST_USER for self.username, if not substitute username for self.username. if password is None substitute settings.EMAIL_HOST_PASSWORD for self.username, if not substitute password for self.password. if use_tls is None substitute settings.EMAIL_USE_TLS for self.username, if not substitute use_tls for self.use_tls. if use_ssl is None substitute settings.EMAIL_USE_SSL for self.username, if not substitute use_ssl for self.use_ssl. substitute timeout for self.timeout. if self.use_ssl and self.use_tls are boolean True, raise an ValueError exception with argument string "EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set one of those settings to True.". self.connection is None. call the method threading.RLock, substitute the result for self._lock. define the method open with argument self. if self.connection is true, return boolean False, substitute smtplib.SMTP_SSL for connection_class if self.use_ssl is true, if not substitute smtplib.SMTP for connection_class. connection_params is a dictionary with 1 initial entry: return value of the function DNS_NAME.get_fqdn for 'local_hostname'. if self.timeout is not None, set value under the 'timeout' key of the connection_params to self.timeout. try, self.connection is a instance of a class contained in connection_class, instantiated with arguments: self.host, self.port, and unpacked dictionary connection_params. if self.use_ssl and self.use_tls are false, call the method self.connection.ehlo. call the method self.connection.starttls. call the method self.connection.ehlo. if self.username and self.password are true, call the method self.connection.login with arguments self.username and self.password. return boolean True. if smtplib.SMTPException exception is caught, if self.fail_silently is boolean False, raise an exception. define the method close with argument self. if self.connection is None, return nothing. try, try, call the method self.connection.quit. if ssl.SSLError or smtplib.SMTPServerDisconnected exception occurred, call the method self.connection.close. if smtplib.SMTPException exception is caught, if self.fail_silently is boolean True, return nothing. raise an exception. finally perform, self.connection is None. define the method send_messages with arguments self and email_message. if email_messages is false, return nothing. call the method self._lock, with the return value, call the method self.open, substitute the result for the new_conn_created. if self.connection is false, return nothing. num_sent is an integer 0. for every message in email_messages: call the method self._send with argument message, substitute the result for sent. if sent is true, increment num_sent by one. if new_conn_created is true, call the self.close method. return num_sent. define the method _send with arguments self and email_message. call the email_message.recipients method, if it evaluates to false, return boolean False. call the function sanitize_address with arguments email_message.from_email and email_message.encoding, substitute the result for from_email. call the function sanitize_address with arguments addr and email_message.encoding, for every addr in return value of the function email_message.recipients, store the results in a recipients list. call the function email_message.message, substitute the result for message. try, call the method self.connection.sendmail with arguments: from_email, recipients and return value of the function message.as_bytes. if smtplib.SMTPException exception is caught, if self.fail_silently is false, raise an exception. return boolean False. return boolean True. from __future__ import unicode_literals into default name space. import module mimetypes. import module os. import module random. import module sys. import module time. from email import charset as Charset, encoders as Encoders, message_from_string and generator. from email.message import Message into default name space. from email.mime.text import MIMEText into default name space. from email.mime.multipart import MIMEMultipart into default name space. from email.mime.base import MIMEBase into default name space. from email.mime.message import MIMEMessage into default name space. from email.header import Header into default name space. from email.utils import formatdate, getaddresses, formataddr and parseaddr into default name space. from django.conf import settings into default name space. from django.core.mail.utils import DNS_NAME into default name space. from django.utils.encoding import force_text into default name space. from django.utils import six into default name space. call the function Charset.Charset with argument string 'utf-8', substitute the result for utf8_charset. utf8_charset.body_encoding is None. DEFAULT_ATTACHMENT_MIME_TYPE is a string 'application/octet-stream'. derive the class BadHeaderError from the ValueError base class. do nothing. define the function make_msgid with argument idstring set to None. call the function time.time, substitute the result for timeval. call the function time.gmtime with argument timeval, use string '%Y%m%d%H%M%S' and the previous result as an argument for the call to the time.strftime function, substitute the result for utcdate. try, call the function os.getpid, substitute it for pid. if AttributeError exception is caught, pid is integer 1. call the function random.randrange with argument integer 100000, substitute the result for randint. if idstring is None, idstring is an empty string. if not, append idstring to the '.' character, substitute it for idstring. substitute DNS_NAME for idhost. msgid is a string '<%s.%s.%s%s@%s>', replace '%s' with utcdate, pid, randint, idstring and idhost, respectively. return msgid. ADDRESS_HEADERS is a set containing strings: 'from', 'sender', 'reply-to', 'to', 'cc', 'bcc', 'resent-from', 'resent-sender', 'resent-to', 'resent-cc' and 'resent-bcc'. define the function forbid_multi_line_headers with arguments: name, val and encoding. if encoding does not exists substitute it for settings.DEFAULT_CHARSET. call the function force_text with argument val, substitute it for val. if characters '\n' or '\r' are contained in val, raise an BadHeaderError exception with argument string "Header values can't contain newlines (got %r for header %r)", where '%r' are replaced by val and name, respectively. try, call the method val.encode with argument string 'ascii'. if UnicodeEncodeError exception is caught, convert name to lower case, if it is contained in ADDRESS_HEADERS,s call the function sanitize_address with arguments addr and encoding, for every addr in return value of the getadresses function with tuple containing val as argument, join all the results into a string separated by ', ', substitute the result for val. if not, call the encode function on the Header class instance, created with arguments val and encoding, substitute the result for val. if not, if name converted to lower case equals to string 'subject', call the encode function on the Header class instance, created with argument val, substitute the result for val. return name converted to a string and val. define the function sanitize_address with arguments addr and encoding. if addr is a instance of six.string_types, call the parseaddr function with return value of the force_text with argument addr, as argument, substitute the result for addr. nm and addr are addr. try, call the encode function on the Header class instance, created with arguments nm and encoding, substitute the result for nm. if UnicodeEncodeError exception is caught, call the encode function on the Header class instance, created with arguments nm and string 'utf-8', substitute the result for nm. try, call the addr.encode method with string 'ascii' as an argument. if UnicodeEncodeError exception is caught, if character '@' is contained in addr, call the addr.split method with character '@' and integer 1 as arguments, substitute the result for localpart and domain, respectively. instantiate Header class with localpart and encoding, convert it to a string, substitute the result for localpart. call the decode function with argument string 'ascii' on the return value of the method domain.encode with argument string 'idna' substitute the result for domain. join localpart and domain in a string separated by '@' character, substitute it for addr. if not, call the encode function on the Header class instance, created with arguments addr and encoding, substitute the result for addr. call the formataddr function with argument tuple containing 2 elements nm and addr. derive the class MIMEMixin. define the method as_string with arguments self and unixfrom set to boolean False. fp is a instance of a class six.StringIO. g is an instance of a class generator.Generator called with fp and mangle_from_ set to False. call the method g.flatten with arguments self and unixfrom set to unixfrom. call the method fp.getvalue, return the result. if six.PY2 is boolean True, substitute as_string for as_bytes. if not, define the method as_bytes with arguments self and unixfrom set to boolean False. fp is a instance of a class six.BytesIO. g is an instance of a class generator.BytesGenerator called with fp and mangle_from_ set to False. call the method g.flatten with arguments self and unixfrom set to unixfrom. call the method fp.getvalue, return the result. derive the class SafeMIMEMessage from the MIMEMixin and MIMEMessage base class. define the method __setitem__ with arguments self, name and val. call the function forbid_multi_line_headers with 3 arguments: name, val and string 'ascii', substitute the result for name and val, respectively. call the method MIMEMessage.__setitem__ with arguments self, name and val. derive the class SafeMIMEText from the MIMEMixin and MIMEText base class. define the __init__ method with arguments: self, text, subtype and charset. substitute charset for self.encoding. if charset equals to string 'utf-8', call the method MIMEText.__init__ with 4 arguments: self, text, subtype and None. delete the value under the 'Content-Transfer-Encoding' key of self dictionary. if integers 3 and 2 in a tuple are smaller than the sys.version_info and sys.version_info is smaller than integers 3,4 and 4 in a tuple, respectively, call the method text.encode with argument utf8_charset.output_charset, substitute the result for payload. call the method payload.decode with 2 arguments: string 'ascii' and string 'surrogateescape', substitute the result for self._payload. call the method self.set_charset with utf8_charset as an argument. if not, call the method payload.decode with 2 arguments: text and utf8_charset, substitute the result for self._payload. call the method self.replace_header with argument string 'Content-Type', 'text/%s; charset="%s"', where '%s' symbols are replaced by: subtype and charset, respectively. if not, call the method MIMEText.__init__ with 4 arguments: self, text, subtype and charset. define the method __setitem__ with arguments self, name and val. call the function forbid_multi_line_headers with 3 arguments: name, val and self.encoding, substitute the result for name and val, respectively. call the method MIMEText.__setitem__ with arguments self, name and val. derive the class SafeMIMEMultipart from the MIMEMixin and MIMEMultipart base class. define the method __init__ with 6 arguments: self, _subtype set to string 'mixed', boundary set to None, _subparts set to None, encoding set to None and unpacked dictionary _params. substitute encoding for self.encoding. call the method MIMEMultipart.__init__ with 5 arguments: self, _subtype, boundary, _subparts and unpacked dictionary _params. define the method __setitem__ with arguments self, name and val. call the function forbid_multi_line_headers with 3 arguments: name, val and self.encoding, substitute the result for name and val, respectively. call the method MIMEMultipart.__setitem__ with arguments self, name and val. derive the class EmailMessage from the object base class. content_subtype is a string 'plain'. mixed_subtype is a string 'mixed'. encoding is None. define the method __init__ with 10 arguments: self, subject set to an empty string, body set to an empty string, if to is true, if to is not an six.string_types instance raise an error with message string '"to" argument must be a list or tuple'. put to into a list, assign it to self.to. if not, self.to is an empty list. if cc is true, if cc is not an six.string_types instance raise an error with message string '"cc" argument must be a list or tuple'. put cc into a list, assign it to self.cc. if not, self.cc is an empty list. if bcc is true, if bcc is not an six.string_types instance raise an error with message string '"bcc" argument must be a list or tuple'. put bcc into a list, assign it to self.bcc. if not, self.bcc is an empty list. if from_email exists substitute from_email for self.from_email, if not substitute settings.DEFAULT_FROM_EMAIL for self.from_email. substitute subject for self.subject. substitute body for self.body. if attachments exists substitute it for self.attachments, if not attachments is an empty list. if headers exists substitute it for self.extra_headers, if not extra_headers is an empty dictionary. substitute connection for self.connection. define the method get_connection with arguments self and fail_silently set to boolean False. from django.core.mail import get_connection into default name space. if self.connection is false, call the function get_connection with argument fail_silently set to fail_silently, substitute it for self.connection. return self.connection. define the method message with argument self. if self.encoding exists substitute it for encoding, if not substitute settings.DEFAULT_CHARSET for encoding. msg is a instance of a SafeMIMEText class created with arguments: self.body, self.content_subtype and encoding. call the self._create_message method with argument msg, substitute it for msg. substitute self.subject for value under the 'Subject' key of msg dictionary. call the method self.extra_headers.get with string 'From' and self.from_email as arguments, substitute the result for value under the 'From' key of msg dictionary. call the method self.extra_headers.get with arguments: string 'To' and joined string from self.to elements separated by ', ', substitute the result for value under the 'To' key of msg dictionary. if self.cc is true, join elements of self.cc into a string separated by ', ', substitute the result for value under the 'Cc' key of msg dictionary. call the key.lower method for every key in self.extra_headers, join the results into a header_names. if 'date' is not in header_names, call the formatdate function, substitute it for value under the 'Date' key of msg dictionary. if message-id' is not in header_names, call the make_msgid function, substitute it for value under the 'Message-ID' key of msg dictionary. for every name and value in return value of the method self.extra_headers.items, convert name to lower case if it equals to string 'from' or 'to, skip this loop execution, substitute value for value under name key of msg dictionary. return msg. define the method recipients with argument self. add together self.to, self.cc and self.bcc, return the result. define the method send with arguments self and fail_silently set to boolean False. call the method self.recipients, if it evaluates to false, return an integer 0. call the method self.get_connection with argument fail_silently, on the result call the method send_messages with one argument: list containing self, return the result. define the method attach with 4 arguments: self, filename set to None, content set to None and mimetype set to None. if filename is an instance of MIMEBase, if content is not None raise an error. if mimetype is not None raise an error. append filename to the self.attachments list. if not, if content is not None raise an error. append a tuple containing 3 elements: filename, content, mimetype to self.attachments list. define the method attach_file with arguments self, path and mimetype set to None. call the os.path.basename with path as argument, substitute the result for filename. open file named path in 'rb' mode, with file descriptor as f, read the whole file f, substitute the result for content. call the method self.attach with arguments filename, content and mimetype. define the method _create_message with arguments self and msg. call the method self._create_attachments with argument msg, return the result. define the method _create_attachments with arguments self and msg. if self.attachments is true, if self.encoding exists substitute it for encoding, if not substitute settings.DEFAULT_CHARSET for encoding. substitute msg for body_msg. msg is an instance of a class SafeMIMEMultipart, created with arguments: _subtype set to self.mixed_subtype and encoding set to encoding. if self.body is true, call the method msg.attach with an argument body_msg. for every attachment in self.attachments, if attachment is an instance of MIMEBase, call the method msg.attach with an argument attachment. if not, call the method self._create_attachment with an unpacked list attachment as an argument, use the result as an argument for the call to the msg.attach method. return msg. define the method _create_mime_attachment with arguments self, content and mimetype. call the method mimetype.split with arguments: character '/' and integer 1, substitute the result for basetype and subtype, respectively. if basetype equals a string 'text', if self.encoding exists substitute it for encoding, if not substitute settings.DEFAULT_CHARSET for encoding. attachment is an instance of a class SafeMIMEText, created with arguments: content, subtype and encoding. otherwise if basetype equals a string 'message' and subtype equals a string 'rfc822', if content is an instance of a EmailMessage class, call the method content.message, substitute the result for content. otherwise if content is not an instance of Message class, call the message_from_string function with an argument content, substitute the result for content. attachment is an instance of a class SafeMIMEMessage, created with the arguments content and subtype. if not, attachment is an instance of a class MIMEBase, created with the arguments basetype and subtype. call the method attachment.set_payload with an argument content. call the method Encoders.encode_base64 with an argument attachment. return attachment. define the method _create_attachment with 4 arguments: self, filename, content and mimetype set to None. if mimetype is None, call the mimetypes.guess_type with an argument filename, assign the result to the mimetype and _, respectively. if mimetype is None, substitute DEFAULT_ATTACHMENT_MIME_TYPE for mimetype. call the method self._create_mime_attachment with the arguments content and mimetype, substitute the result for attachment. if filename is true, try, call the method filename.encode with an argument string 'ascii' if UnicodeEncodeError exception is caught, if six.PY2 is true, call the method filename.encode with an argument string 'utf-8', substitute the result for filename. filename is a tuple containing 3 initial elements: string 'utf-8', and empty string and filename. call the method attachment.add_header with 3 arguments: string 'Content-Disposition', string 'attachment' and filename set to filename. return attachment. derive the class EmailMultiAlternatives from the EmailMessage base class. alternative_subtype is a string 'alternative'. define the method __init__ with 11 arguments: self, subject set to an empty string, body set to an empty string, call the method __init__ from the base class of the EmailMultiAlternatives class, with 9 arguments: subject, body, from_email, to, bcc, connection, attachments, headers and cc. if alternatives exists substitute it for self.alternatives, if not self.alternatives is an empty list. define the method attach_alternative with arguments self, content and mimetype. if content is None, raise an error. if mimetype is None, raise an error. append a tuple containing 2 elements: content and mimetype, to the self.alternatives list. define the method _create_message with arguments self and msg. call the method self._create_alternatives with an argument msg, use it as an argument for the call to the self._create_attachments method, return the result. define the method _create_alternatives with arguments self and msg. if self.encoding exists substitute it for encoding, if not substitute settings.DEFAULT_CHARSET for encoding. if self.alternatives is true, substitute msg for body_msg. msg is an instance of a class SafeMIMEMultipart, created with the arguments: _subtype set to self.alternative_subtype and encoding set to encoding. if self.body is true, call the msg.attach with an argument body_msg. for every alternative in self.alternatives, call the method self._create_mime_attachment with unpacked list alternative as an argument, use the result as an argument for the call to the msg.attach method. return msg. import module socket. derive class CachedDnsName from the object base class. define the method __str__ with argument self. evaluate the self.get_fqdn method, return the result. define the method get_fqdn with argument self. if self doesnt have an attribute '_fqdn', call the function socket.getfqdn, substitute the result for self._fqdn. return self._fqdn. DNS_NAME is a instance of CachedDnsName class. from __future__ import unicode_literals into default name space. import module collections. from importlib import import_module into default name space. import module os. import module sys. import module django. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core.exceptions import ImproperlyConfigured into default name space. from django.core.management.base import BaseCommand, CommandError, CommandParser and handle_default_options into default name space. from django.core.management.color import color_style into default name space. from django.utils import lru_cache into default name space. from django.utils import six into default name space. define the function find_commands with an argument management_dir. join management_dir and string 'commands' into a file path name, substitute it for command_dir. try, for every f in return value of the os.listdir function called with an argument command_dir, append f without 3 last elements to a list, only if f doesnt start with character '_' and doesnt ends with string '.py', return the resulting list. if OSError exception is caught, return an empty list. define the function load_command_class with arguments: app_name and name. replace '%s' in string '%s.management.commands.%s' with app_name and name, respectively, use it as an result for the call to the import_module function, substitute the result for module. return an instance of the module.Command class. decorator lru_cache.lru_cache with an argument maxsize set to None. define the function get_commands. commands is an dictionary containing elements: string 'django.core' for every name in the function find_commands return value, called with first element of __path__ as an argument. if settings.configured is false, return commands. for every app_config in reversed list created out of the return value of the function apps.get_app_configs, join app_config.path and string 'management' into a file path, substitute it for path. call the method commands.update, with an argument dictionary containing entries: app_config_name for name, for every name in return value of the function find_commands, called with an argument path. return commands. define the function call_command with 3 arguments: name, unpacked list args and unpacked dictionary options. try, call the function get_commands, substitute the value under the name key of the return value, for app_name. if KeyError exception is caught, raise an CommandError exception with an argument string "Unknown command: %r", with '%r' replaced by name. if app_name is an instance of BaseCommand, substitute app_namefor command. if not, call the function load_command_class with arguments: app_name and name, substitute the result for command. all the method command.create_parser with arguments: empty and name, substitute the result for parser. if command.use_argparse is true, call the method parser.parse_args with an argument args set to args, substitute the result for defaults. create dictionary out of the unpacked dictionary options, using defaults._get_kwargs as a mapping function, substitute the result for defaults. if not, call the method parser.parse_args with an arguments args set to an empty list, assign the result for defaults and _, respectively. create dictionary out of the unpacked dictionary options, using defaults.__dict__ as a mapping function, substitute the result for defaults. call the command.execute method with arguments: unpacked list args and unpacked dictionary defaults, return the result. derive the class ManagementUtility from object base class. define the method __init__ with arguments: self class instance and argv set to None. if argv is true, substitue it for self.argv, if not substitute sys.argv for self.argv. call the function os.path.basename with first element of self.argv as an argument, substitute the result for self.prog_name. self.settings_exception is None. define the method main_help_text with arguments: self class instance and commands_only set to boolean False. if commands_only is true, call the function get_commands, call the method keys on the result, substitute sorted result for usage. if not, usage is a list containing 4 entries: an empty string, string "Type '%s help ' for help on a specific subcommand.", where '%s' is replaced with self.prog_name, an empty string and string "Available subcommands:". call the method collections.defaultdict with a argument: lambda function without arguments that returns an empty list, substitute the result for commands_dict. for every name and app in return value of the function six.iteritems calle with return argument of function get_commands as an arugment, if app equals a string 'django.core', app is a string 'django' if not, call the method app.rpartition with an argument '.', substitute last element of the result for app. append name to the value of under the app key of the commands_dict. call the color_style function, substitute the result for style. for every app in sorted return value of the commands_dict.keys function, append an empty string to usage. call the style.NOTICE method with an argument string "[%s]", where '%s' is replaced with app, append the result to usage. for every name in sorted value under the app key of the commands_dict dictionary, append string " %s", where '%s' is replaced by name to the usage. if self.settings_exception is not None, call the method style.NOTICE with an argument string "Note that only Django core commands are listed as settings are not properly configured (error: %s).", where '%s' is replaced by self.settings_exception, append the result to usage. join usage elements in a string separated by newline characters, return it. define the method fetch_command, with arguments self and subcommand. call the function get_commands, substitute it for commands. try, substitute value under the subcommand key of the commands dictionary for app_name. if KeyError exception is caught, call settings.INSTALLED_APPS. call the method sys.stderr.write with an argument string "Unknown command: %r\nType '%s help' for usage.\n", where '%r' is replaced with subcommand and '%s' is replaced with self.prog_name. call the function sys.exit with an argument integer 1. if app_name is an instance of BaseCommands. substitute app_name for klass. if not, call the function load_command_class with arguments app_name and subcommand, substitute the result for klass. return klass. define the method autocomplete with an argument self. if string 'DJANGO_AUTO_COMPLETE' is not contained in os.environ, return nothing. slit by whitespace the value under the 'COMP_WORDS' key of the os.environ dictionary, substitute the result without the first element for cwords. convert to an integer value under the 'COMP_CWORD' key of the os.environ dictionary, substitute it for cword. try, substitute cwords element at the cword decremented by 1 index for curr. if IndexError exception is caugh, curr is an empty string. call the function get_commands, convert the result to a list, append string 'help' to it, substitute it for subcommands. options is a list containing a tuple with 2 entries: string '--help' and None. if cword equlals a integer 1, filter all the subcommands element through the lambda function with an argument x, that evaluates the method x.startswith, with an argument curr, sort the result and join it in a list separated with blank spaces, print it to the standard output. otherwise if first element of cwords is contanied in subcommands and is not equal to string 'help', call the method self.fetch_command with first element of cwords as an argument, substitute it for subcommand_cls. if first element of cwords equals a string 'runfcgi', from django.core.servers.fastcgi import FASTCGI_OPTIONS into default namespace, append tuple containing two entries: k and integer 1 to options, for every k in FASTCGI_OPTIONS. otherwise if first element of cwords is contanied in tuple with 8 entries: 'dumpdata', 'sql', 'sqlall', 'sqlclear', 'sqlcustom', try, call the method apps.get_app_configs, substitute the result for app_configs. append tuple containing two entries: app_config.label and integer 0 to options, for every app_config in app_configs. if ImportError exception is caught, do nothing. call the method subcommand_cls.create_parser with 2 argument an empty string an first element of cwords, substitute it for parser. if subcommand_cls.use_argparse is true, append to options a tuple containing 2 entries: firs element of sorted list of the s_opt.option_strings, and evaluated boolean expression s_opt.nargs doesnt equal to integer 0, for every s_opt in parser._actions, only if s_opt.option_strings is true, if not, append to options a tuple containing 2 entries: result of the method s_opt.get_opt_string and s_opt.nargs, for every s_opt in parser.option_list. for every x in slice of cwords from the second element to the element at the cword decremented by 1 index, split x by character '=' and append first element of the result to the prev_opts list. for every opt in options, if first element of opt is not contained in prev_opts, append opt to the list, substitute it for options. append tuple containing 2 elements: k and v to a list, for every k and v in options, only if k starts with curr, sort the result and substitute it for options. for every option in options, substitute first element of options for opt_label. if second element of options is true, append '=' to opt_label. print opt_label to the standard output. call the function sys.exit with an integer 1 as an argument. define the method execute with an argument self, try, substitute first element of self.argv for subcommand. if IndexError exception is caught, subcommand is a string 'help'. parser is an instance of CommandParser class, created with 3 arguments, None, usage as a string "%(prog)s subcommand [options] [args]" and add_help set to boolean False. call the method parser.add_argument with an argument string '--settings'. call the method parser.add_argument with an argument string '--pythonpath'. call the method parser.add_argument with arguments: string 'args' and nargs set to '*'. try, call the method parser.parse_known_args wiht an argument self.argv, without the first two elements, assign the result for options, and args, respectively. call the method handle_default_options with an argument options. if CommandError exception is caught, do nothing. no_settings_commands is a list containing entries: 'help', 'version', '--help', '--version', '-h', 'compilemessages', 'makemessages', 'startapp' and 'startproject'. try, call the settings.INSTALLED_APPS. if ImproperlyConfigured renamed to exc, exception is caught, substitute exc for self.settings_exception, if subcommand is contained in no_settings_commands, call the method settings.configure. if settings.configured is true, call the method django.setup. call the method self.autocomplete. if subcommand equals to a string 'help'. if string '--commands' is contained in args, call the method self.main_help_text with an argument commands_only set to boolean True, append new line to it, write it to sys.stdout. otherwise, length of options.args is lesser than integer 1, call the method self.main_help_text append new line to it, write it to sys.stdout. if not, call the method self.fetch_command with first element of options.args as argument, on the result call the method print_help, with 2 arguments: self.prog_name and first element of options.args. otherwise if subcommand equals a string 'version' or self.argv, without the first element equals a list containing a string '--version' call the method django.get_version append new line to it, write it to sys.stdout. if self.argv, without the first element is contained in a tuple with 2 entries: a list containing a string '--help', and a list containing a string '-h', call the method self.main_help_text, append new line to it, write it to sys.stdout. if not, call the method self.fetch_command with an argument command, call the method run_from_argv on the result with an argument self.argv. define the function execute_from_command_line with an argument argv set to None. utility is a instance of ManagementUtility class, created with an argument argv. call the method utility.execute. from __future__ import unicode_literals into default name space. import module os. import module sys. import module warnings. from argparse import ArgumentParser into default name space. from optparse import OptionParser into default name space. import module django. from django.core import checks into default name space. from django.core.exceptions import ImproperlyConfigured into default name space. from django.core.management.color import color_style and no_style into default name space. from django.utils.deprecation import RemovedInDjango19Warning and RemovedInDjango20Warning into default name space. from django.utils.encoding import force_st into default name space. derive the class CommandError from the base class Exception. do nothing. derive the CommandParser class from the ArgumentParser base class. define the method __init__ with arguments: self, cmd and unpacked dictionary kwargs. substitute cmd for self.cmd. call the method __init__ from the base class of the CommandParser class, with unpacked dictionary kwargs as argument. define the method parse_args with 3 arguments: self, args set to None and namespace set to None. if self.cmd has an attribute 'missing_args_message' and next statement is not true: args is true or any arg doesnt start with '-' for arg in args, call the method self.error with an argument self.cmd.missing_args_message. call the parse_args method with arguments args and namespace, from the base class of the CommandParser class. define the method error with arguments self and message. if self.cmd._called_from_command_line is true, call the method error with an argument message, from the base class of the class CommandParser. if not, raise an CommandError exception with an argument string "Error: %s", with '%s' replaced by message. define the function handle_default_options with an argument options. if options.settings is true, substitute options.settings for value under the 'DJANGO_SETTINGS_MODULE' key of the os.environ dictionary. if options.pythonpath is true, insert options.pythonpath at the beginning of sys.path. derive the OutputWrapper class from the object base class. define the method __init__ with 4 arguments: self, out, style, func set to None and endings set to newline character. substitute out for self._out. substitute None for self.style_func. if out has an 'isatty' argument and return value of the function out.isatty is true, substitute style_func for self.style_func. substitute ending for self.ending. define the method __getattr__ with arguments self and name. get name attribute of the self._out object, return it. define the method write with 4 arguments: self, msg, style_func with None and ending set None. if ending is None substitute self.ending for ending. if ending is true and msg doesnt end with ending, append ending to msg. if f is not None append it to a list for every f in tuple containing 3 elements: style_func, self.style_func, and lambda function returning x for x, substitute the firs element of resulting list for style_func. call the function style_func with an argument msg, use the result as an argument for the call to the function force_str, use the result as an argument for the call to the function self._out.write. derive the BaseCommand class from the object base class. options_list is an empty tuple. help is an empty string. args is an empty string. _called_from_command_line is boolean False. can_import_settings is boolean True. output_transaction is boolean False. leave_locale_alone is boolean False. define the method __init__ with an argument self. call the function color_style, substitute the result for self.style. if self has an 'requires_model_validation' attribute, has_old_option is boolean True, otherwise it is boolean False. if self has an 'requires_system_checks' attribute, has_new_option is boolean True, otherwise it is boolean False. if has_old_option is true, call the function warnings.warn with 2 arguments: string '"requires_model_validation" is deprecated ' 'in favor of "requires_system_checks".' and RemovedInDjango19Warning. if has_old_option and has_new_option are both true, raise an ImproperlyConfigured exception wiht an argument string 'Command %s defines both "requires_model_validation" ' 'and "requires_system_checks", which is illegal. Use only "requires_system_checks".', replace '%s' for self.__class__.__name__. call the method self.requires_system_checks with an argument: self.requires_system_checks if has_new_option is true, or if it is false, but has_old_option is true use self.requires_model_validation, if they are both false use boolean True as an argument. property decorator, define the method use_argparse with an argument self, convert self.option_list into a boolean, return the inverted value. define the method get_version with an arguments self. call the function django.get_version, return the result. define the method usage with arguments self and subcommand. substitute '%s' in the string '%%prog %s [options] %s' with subcommand and self.args, respectively, substitute it for usage. if self.help is true, join usage and self.help into a string, separated by 2 new line characters, return it. if not, return usage. define the method create_parser with 3 arguments: self, prog_name and subcommand. if self.use_argparse is false, call the function warnings.warn with 2 arguments: string "OptionParser usage for Django management commands " "is deprecated, use ArgumentParser instead" and RemovedInDjango20Warning. parser is an instance of the object OptionParser, created with arguments: prog set to prog_name, usage set to return value of the method self.usage called with an argument subcommand, version set to return value of the method self.get_version. call the method parser.add_option with 8 arguments: string '-v', string '--verbosity', action set to string 'store', dest set to string 'verbosity', default set to string '1', type set to string 'choice', choices is a list containing elements: '0', '1', '2', '3', and help as a string 'Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output'. call the method parser.add_option with 2 arguments: string '--settings' and help as a string 'The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.'. call the method parser.add_option with 2 arguments: string '--pythonpath' and help set to string 'A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".'. call the method parser.add_option with 3 arguments: string '--traceback', action set to a string 'store_true', and help='Raise on exception'. call the method parser.add_option with 5 arguments: string '--no-color', action set to a string 'store_true', dest set to string 'no_color' default set to boolean False and help set to a string "Don't colorize the command output.". for every opt in self.option_list, call the method parser.add_option with an argument opt. if not, parser is an instance of CommandParser class, created with 3 arguments: self, prog as a string created by joining: os.path.basename(prog_name) and subcommand, separated by whitespace and description set to self.help, if exists, or None, otherwise. call the method parser.add_option with 3 arguments: string '--version', action set to string 'version', and version set to result of the method self.get_version. call the method parser.add_option with 8 arguments: string '-v', string '--verbosity', action set to string 'store', dest set to string 'verbosity', default set to string '1', type set to int, choices is a list, containing integers: 0, 1, 2 and 3, call the method parser.add_option with 2 arguments: string '--settings' and help as a string 'The Python path to a settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.' call the method parser.add_option with 2 arguments: string '--pythonpath' and help set to a string 'A directory to add to the Python path, e.g. "/home/djangoprojects/myproject".' call the method parser.add_option with 3 arguments: string '--traceback', action set to a string 'store_true', and help set to string 'Raise on exception'. call the method parser.add_option with 5 arguments: string '--no-color', action is string 'store_true', dest is string 'no_color', default is boolean False, and help is a string "Don't colorize the command output.". if self.args is true, call the method parser.add_argument with 2 arguments: string 'args' and nargs set to '*'. call the method self.add_arguments with an argument parser. return parser define the method add_arguments with an argument self and parser. do nothing define the method print_help with 3 arguments: self, prog_name and subcommand. call the method self.create_parser with arguments prog_name and subcommand. call the method parser.print_help. define the method run_from_argv with arguments self and argv. self._called_from_command_line is boolean True. call the method self.create_parser with first and second element of argv, substitute the result for parser. if self.use_argparse is true, call the method parser.parse_args with argv, without the first 2 elements, substitute the result for options. call the function vars with an argument options, substitute the result for cmd_options. if 'args' is contained in options, substitute options.args for args. delete value under the 'args' key of the cmd_options dictionary. if not, args is an empty tuple. if not, call the method parser.parse_args with argv, without the first 2 elements, substitute the result for options and args. call the function vars with an argument options, substitute the result for cmd_options. call the function handle_default_options with an argument options. try, call the method self.execute, with 2 arguments: unpacked list args and unpacked dictionary cmd_options. if Exception, renamed to e, exception is caught, if options.traceback is true or e is not CommandError instance, raise an exception. if it exists, get 'stderr' attribute of self, substitute it for stderr, if not, stderr is an instance of OutputWrapper class, created with arguments sys.stderr and self.style.ERROR. replace '%s' in string '%s: %s' with e.__class__.__name__ and e, respectively, write it to the stderr stream. call the function sys.exit with an argument integer 1. define the method execute with 3 arguments: self, unpacked list args and unpacked dictionary options. self.stdout is an instance of OutputWrapper class created with an argument: value under the 'stdout' key of the options dictionary, if the key doesnt exists use sys.stdout as an argument. if value under the 'no_color' key of the options dictionary. call the function no_style, substitute the result for self.style. self.stderr is an OutputWrapper object instance, created with value under the 'stderr' key of the options dictionary as an argument, if the key doesnt exists use sys.stderr as an argument. if not, self.stderr is an instance of an OutputWrapper object, created with 2 arguments: value under the 'stderr' key of the options dictionary, if it doesnt exists use the sys.stderr instead, and self.style.ERROR. if self.can_import_settings is true, from django.conf import settings into default namespace, saved_locale is None. if self.leave_locale_alone is false, if self.can_import_settings is false, raise an CommandError exception with an argument string, "Incompatible values of 'leave_locale_alone' " "(%s) and 'can_import_settings' (%s) command options.", replace '%s' with self.leave_locale_alone and self.can_import_settings. from django.utils import translation into default namespace. call the method translation.get_language, substitute th result for saved_locale. call the method translation.activate with an argument string 'en-us'. try, if self.requires_system_checks is true and values under the 'skip_validation' and 'skip_checks' keys of the options dictionary are false, call the method self.check, call the method self.handle with 2 arguments unpacked list args and unpacked dictionary options, substitute the result for output. if output is true, if self.output_transaction is true, from django.db import connections and DEFAULT_DB_ALIAS into default namespace. get the value under the 'database' key of the options dictionary, if it doesnt exists use the DEFAULT_DB_ALIAS to address an element from the connections list, substitute it for connection. call the method connection.ops.start_transaction_sql, if it evaluates to true, call the method connection.ops.start_transaction_sql, use the result as an argument for the call to the method self.style.SQL_KEYWORD, write the result to the self.stdout stream. write output to self.stdout stream. if self.output_transaction is true, call the method connection.ops.end_transaction_sql, use the result as the argument for the call to the method self.style.SQL_KEYWORD, append the result to the '\n' string, write it to self.stdout. finally perform, if saved_locale is not None, call the method translation.activate with an argument saved_locale. define the method with 3 arguments: self, app_config set to None and display_num_errors set to boolean False. if app_config is None, app_configs is not None. if not, app_configs is a list containing app_config. call the method self.check with 2 arguments app_configs set to app_configs, display_num_errors set to display_num_errors, return the result. define the method check with 4 arguments: self, app_configs set to None, tags set to None, display_num_errors set to boolean False. call the method checks.run_checks with 2 arguments: app_configs set to app_configs, tags set t tags, substitute the result for all_issues. msg is an empty string. visible_issue_count is an integer 0. if all_issues is true, append e to debugs list for every e in all_issues, if e.level is lesser than checks.INFO and result of the method e.is_silenced in false. append e to infos list for every e in all_issues, if checks.INFO is lesser or equal to e.level, and e.level is lesser than checks.WARNING and result of the method e.is_silenced in false. append e to warnings list for every e in all_issues, if checks.WARNING is lesser than or equal to e.level, and e.level is lesser than checks.WARNING and result of the method e.is_silenced in false. append e to errors list for every e in all_issues, if checks.ERROR is lesser than or equal to e.level, and e.level is lesser than checks.CRITICAL. append e to criticals list for every e in all_issues, if checks.CRITICAL is lesser than or equal to e.level. sorted_issues is a list of tuples with 5 entries: criticals and 'CRITICALS', errors and 'ERRORS', warnings and 'WARNINGS', infos, 'INFOS' for every issues and group_name in sorted_issues, if issues is true, increment visible_issue_count for length of issues. if e.is_serious method evaluates to true, call the function color_style, on the result call the method ERROR with result of the force_str called with an argument e, if not call the function color_style on the result call the method ERROR with result of the force_str called with an argument e, for every e in issues, formatted is a tuple containing the previous result. sort elements formatted, join them in the list separated with newline character, substitute the result for formatted. substitute '%s' in the string '\n%s:\n%s\n', with group_name and formatted, substitute the result for msg. if msg is true, replace '%s' in string "System check identified some issues:\n%s" with msg, substitute it for msg. if display_num_errors is true, if msg is true, append newline character to msg. append string "System check identified %s (%s silenced)." to msg, replace first '%s' for: string "no issues", if visible_issue_count equals to integer 0, or for string "1 issue" if visible_issue_count equals integer 1, or for string "%s issues", with '%s' replaced by visible_issue_count, subtract visible_issue_count from length of all_issues, and substitute it for second '%s' in the stirting string. if any element in the return value of the e.is_serious method is true, and if return value of the method e.is_silenced is false, for every e in all_issues, raise an CommandError with argument msg, otherwise if msg and visible_issue_count are true, write msg to self.stderr stream. otherwise if msg is true, write msg to self.stderr stream. define the method handle with 3 arguments: self, unpacked args and unpacked dictionary options. raise an NotImplementedError exception with an argument string 'subclasses of BaseCommand must provide a handle() method'. derive the AppCommand class from the BaseCommand base class. missing_args_message is an string "Enter at least one application label.". define the method add_arguments with self and parser as arguments. call the method parser.add_argument with 4 arguments: string 'args', metavar set to 'app_label', nargs set to '+', and help set to string 'One or more application label.'. define the method handle with 3 arguments: self, unpacked list app_labels and unpacked dictionary options. from django.apps import apps into default name space. try, call the method apps.get_app_config with an argument app_lable, for every app_label in app_labels, append the results to app_configs list. if LookupError or ImportError, renamed to e, exceptions are caught, raise an CommandError with an argument string "%s. Are you sure your INSTALLED_APPS setting is correct?", with '%s' replaced by e. output is an empty list. for eery app_config in app_configs, call the self.handle_app_config method with app_config and options as arguments, substitute the result for app_output. if app_output is true, append app_output to output. join elements of output into a string, separated by newline characters, return it. define the method handle_app_config with 3 arguments: self, app_config and unpacked dictionary options. try, substitute self.handle_app for handle_app. if AttributeError exception is caught, raise an NotImplementedError with an argument string "Subclasses of AppCommand must provide a handle_app_config() method.". if not, call the function warnings.warn with 3 argument: string "AppCommand.handle_app() is superseded by AppCommand.handle_app_config().", RemovedInDjango19Warning and stacklevel set to integer 2. if app_config.models_module is None, raise an CommandError with an argument string "AppCommand cannot handle app '%s' in legacy mode because it doesn't have a models module.", where '%s' is replaced by app_config.label. call the function handle_app with 2 arguments: app_config.models_module and unpacked dictionary options. derive the LabelCommand class from the BaseCommand base class. label is a string 'label' substitute string "Enter at least one %s.", with '%s' replaced by label, for missing_args_message. define the method add_arguments with arguments self and parser. call the method parser.add_argument with 3 arguments: string 'args', metavar set to self.label and nargs set to '+'. define the method handle with 3 arguments: self, unpacked list labels and unpacked dictionary options. output is an empty list. for every label in labels, call the method self.handle_label with 2 arguments: label and unpacked dictionary options, substitute the result for label_output. if label_output is true, append label_output to output. join output into a string, separated by newline characters, return it. define the method handle_label with 3 arguments: self, label and unpacked dictionary options. raise an NotImplementedError exception with an argument string 'subclasses of LabelCommand must provide a handle_label() method'. derive the NoArgsCommand class from the BaseCommand base class. args is an empty string. define the method __init__ with an argument self. call the function warnings.warn with 2 arguments: string "NoArgsCommand class is deprecated and will be removed in Django 2.0. " "Use BaseCommand instead, which takes no arguments by default." and RemovedInDjango20Warning. call the __init__ method from the base class of the NoArgsCommand class. define the method handle with 3 arguments: self, unpacked list args and unpacked dictionary options. if args is true, raise an CommandError exception with an argument string "Command doesn't accept any arguments". call the self.handle_noargs method with with unpacked dictionary options as argument, return the result. define the method handle_noargs with 2 arguments: self and unpacked dictionary options. raise an NotImplementedError with an argument string 'subclasses of NoArgsCommand must provide a handle_noargs() method'. import module os. import module sys. from django.utils import termcolors into default name space. define the function supports_color, without arguments. substitute sys.platform for plat. evaluate the logic expression, plat does not equals to string 'Pocket PC', and plat does not equals to string 'win32' or string 'ANICON' is in os.environ, substitute the evaluated boolean for supported_platform. if sys.stdout has an attribute named 'isatty' and call to the sys.stdout.isatty returns boolean True, substitute True for is_a_tty. if supported_platform is False or is_a_tty is False, return boolean False. return boolean True. define function color_style, without input arguments. call the function supports_color, if evaluates to False, substitute return value of function no_style for style. if not, get the value under the key 'DJANGO_COLORS' of os.environ dictionary, if key doesnt exists return empty string, assign the result to DJANGO_COLORS. call the function termcolors.parse_color_setting with DJANGO_COLORS as an argument, assign the result to color_settings. if color_setting is True, define class dummy. do nothing. style is an instance of the dummy class. for every role in termcolors.PALETTES list at the index termcolors.NOCOLOR_PALETTE, assign the value of the dictionary color_settings under the key role to format, if key doesnt exist assign the empty dictionary. sets the role attribute of the style object to the value of the call to the termcolors.make_style function with dictionary format as an argument. substitute style.ERROR for style.ERROR_OUTPUT. if not, substitute return value of function no_style for style. return style. define function no_style, without input arguments. define class dummy. define private method __getattr__ with self class instance and attr as the arguments. create lambda identity function which returns x for input parameter x, return the function. return an instance of a dummy class. from __future__ import unicode_literals into default name space. from django.apps import apps into default name space. from django.core import checks into default name space. from django.core.checks.registry import registry into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. derive the class Command from the BaseCommand base class. help is a string "Checks the entire Django project for potential problems.". requires_system_checks is boolean False. define the method add_arguments with arguments self and parser. call the method parser.add_argument with 3 arguments: string 'args', metavar set to string 'app_label' and nargs set to '*'. call the method parser.add_argument with 5 arguments: string '--tag', string '-t', action set to string 'append', dest set to string 'tags' and help set to string 'Run only checks labeled with given tag.'. call the method parser.add_argument with 4 arguments: string '--list-tags', action set to string 'store_true', dest set to string 'list_tags' and help set to string 'List available tags.'. define method handle with arguments self, unapcked list app_labels and unpacked dictionary options. if value under the 'list_tags' key of options dictionay is true, call the method registry.tags_available, sort the result and join it into a string, separate by newlines, write it to self.stdout. return nothing. if app_labels is true, call the method apps.get_app_config with an argument app_label, for every app_label in app_labels, append the results to a list, substitute the resulting list for app_config. if not, app_configs is None. get the value under the 'tags' key of the options dictionary, if it exists substitute it for tags, if not, tags is None. if tags exists and if all elements in the return value of the method checks.tag_exists called with an argument tag, for every tag in tags, are false, for every tag in tags, if return value of the method checks.tag_exists called with an argument tag, evaluates to false, use tag as an argument to call the iterator method next, substitute the result for invalid_tag. raise an CommandError exception with an argument string 'There is no system check with the "%s" tag.', where '%s' is replaced with invalid_tag. call the method self.check with arguments: app_configs set to app_configs, tags set to tags, display_num_errors set to boolean True. from __future__ import unicode_literals into default name space. import module codecs. import module glob. import module os. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.management.utils import find_command and popen_wrapper into default name space. from django.utils._os import npath and upath into default name space. define the function has_bom with fn as argument. open the file fn in read mode, with file descriptor as f, read 4 bytes from file f and store it in sample. evaluate the boolean expression, if first three characters of sample equals to string of bytes '\xef\xbb\xbf\', of if sample starts with codecs.BOM_UTF16_LE or sample starts with codecs.BOM_UTF16_BE, return the evaluated boolean expression. define the function is_writable with path as argument, try, with open file path in append mode, call the os.utime unction, with path and None as arguments. if IOError or OSError exceptions occurred, return boolean False. return boolean True. derive class Command from base class BaseCommand. help is string 'Compiles .po files to .mo files for use with builtin gettext support.'. requires_system_checks is boolean False. leave_locale_alone is boolean True. program is string 'msgfmt' program_options is list containing string '--check-format'. define method add_arguments with self class instance and parser as arguments. call the method parser.add_argument with string '--locale', string '-l', dest set to string 'locale', action set to string 'append', default as an empty list and help as an string 'Locale(s) to process (e.g. de_AT). Default is to process all. Can be used multiple times.'. call the method parser.add_argument with string '--exclude', string '-x', dest set to string 'exclude', action set to string 'append', default as an empty list and help as an string 'Locales to exclude. Default is none. Can be used multiple times.'. define the handle method with self class instance and dictionary **options as arguments. get the value under the key 'locale' of the options dictionary, substitute it for locale. get the value under the key 'exclude' of the options dictionary, substitute it for exclude. get the value under the key 'exclude' of the options dictionary, convert it to an integer, substitute it for exclude. if evaluation of the function find_command with self.program as argument equals to None, raise CommandError exception, with sring "Can't find %s. Make sure you have GNU gettext tools 0.15 or newer installed." as argument, substitute '%s' with self.program. basedirs is a list containing tuple with strings, 'conf/locale' and 'locale'. if value under the 'DJANGO_SETTINGS_MODULE' key of os.environ dictionary exists. from django.conf import settings into default name space. call function update with path as the argument, for every path in settings.LOCALE_PATHS, extend basedirs list with previous items. create a list out of basedir elements for which function os.path.isdir returns true, apply the os.path.abspath function on every element, and put the results in a list, basedir is set of previous list elements. if basedirs is empty, raise CommandError exception with string "This script should be run from the Django Git checkout or your project or app tree, or with the settings module specified.", as argument. all_locales is an empty string. for every basedir in basedirs, locale_dirs is a list of elements from the list of path names that maths the basedir path with '/*' wild card characters for which call to the os.path.isdir returned true, assign it to locale_dirs. extend all_locales list with the elements of locale_dirs list on which os.path.basename function was applied. take locale or all_locales, whichever is not empty, respectively, and substitute it for locales. locales is relative complement of set exclude in set locales. for every basedir in basedirs, if locales in not empty, join basedir, l and string 'LC_MESSAGES' into a path separated by '/' for every l in locales, assign the list to dirs. if not, dirs is a list containing basedir. locations is an empty list. for every ldir in dirs, for dirpath, dirnames and filenames, respectively, in directory tree tuple starting from the ldir, extend locations with tuple containing dirpath and f, for every f in filenames, only if it ends with string '.po'. if locations is not empty, call the self.compile_messages with locations as argument, define compile_messages method with self class instance and locations as a arguments. for every i and tuple containing dirpath and f, in enumerated list of locations, if self.verbosity is greater than integer 0, call the self.stdout.write method with string 'processing file %s in %s\n' as argument, replacing all the occurrences of '%s' with f and dirpath, respectively. po_path is a string containing joined directory path from dirpath and f. evaluate function has_bom with po_path as argument. raise CommandError exception with string "The %s file has a BOM (Byte Order Mark). Django only supports .po files encoded in UTF-8 and without any BOM.", with '%s' replaced with po_path, as argument. call os.path.splitext function with po_path as argument, substitute the first element of the result for base_path. if i equals to integer 0 and call the self.stderr.write, with string "The po files under %s are in a seemingly not writable location. mo files will not be updated/created." as argument, with '%s' replaced by dirpath. return nothing. extend self.program list with self.program_options, string '-o', return value of the npath function with string '.mo' appended to the base_path as argument, and return value of the npath function with string '.po' appended to the base_path as argument, substitute it for args. call the popen_wrapper with args as the argument, assign the result to the output, errors and status, respectively. if status is True, if errors is True, msg is a string "Execution of %s failed: %s", with '%s' replaced by self.program and errors. if not, msg is a string "Execution of %s failed", with '%s' replaced by self.program. raise CommandError exception with msg as argument. from django.conf import settings into default name space. from django.core.cache import caches into default name space. from django.core.cache.backends.db import BaseDatabaseCache into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.db import connections, router, transaction, models and DEFAULT_DB_ALIAS into default name space. from django.db.utils import DatabaseError into default name space. from django.utils.encoding import force_text into default name space. derive the class Command from the BaseCommand base class. help is an string "Creates the tables needed to use the SQL cache backend.". requires_system_checks is boolean False. define the method add_arguments with arguments self and parser. call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'table_name', nargs set to '*' character, and help set to a string 'Optional table names. Otherwise, settings.CACHES is used to find cache tables.' . call the method parser.add_argument with 5 arguments: string '--database', action set to string 'store', dest as a string 'database', default set to DEFAULT_DB_ALIAS and help set to a string: 'Nominates a database onto which the cache tables will be installed. Defaults to the "default" database.' define the method handle with arguments self, unpacked list tablenames and unpacked dictionary options. get value under the 'database' key of the options dictionary, substitute it for db. get the value under the 'verbosity' key of the options dictionary, convet it to an integer and substitute for self.verbosity. if length of tablenames is greater than zero, for every tablename in tablenames, call the method self.create_table with arguments: db and tablename. if not, for every cache_alias in settings.CACHES, substitute value under the cache_alias key of the caches dictionary for cache. if cache is an instance of BaseDatabaseCache, all the method self.create_table with arguments: db and cache._table. define the method create_table with arguments self, database and tablename. cache is an instance of BaseDatabaseCache class, created with arguments: tablename and an empty dictionary. call the method router.allow_migrate with 2 arguments: database and cache.cache_model_class, if it evaluates to false, return nothing. substitute value under the database key of the connections dictionary for connection. if tablename is contained in return value of the method connection.introspection.table_names, if self.verbosity is greater than integer 0, replace '%s' in string "Cache table '%s' already exists." with tablename, write it to the self.stdout stream. return nothing. fields is an tuple containing 3 entries: return value of the method models.CharField called with 4 arguments: name set to a string 'cache_key', max_length set to integer 255, unique set to boolean True and primary_key set to boolean True, return value of the method models.TextField called with argument name set to a string 'value', and return value of the method models.DateTimeField called with 2 arguments: name set to string 'expires' and db_index set to True. table_output is an empty list. index_output is an empty list. substitute connection.ops.quote_name for qn. for every f in fields, field_output is an list containing 2 elements: return value of the function qn called with an argument f.name, and return value of the function f.db_type called with an argument connection set to connection. if f.null is false, append string append "NOT NULL" to field_output, otherwise append "NULL" to field_output. if f.primary_key is true, append string "PRIMARY KEY" to field_output. otherwise if f.unique is true, append string "UNIQUE" to field_output. if f.db_index is true, if f.unique is true, substitute "UNIQUE " for unique, otherwise unique is an empty string. replace '%s' in string "CREATE %sINDEX %s ON %s (%s);" with: unique, return value of the function qn called with an argument: a string '%s_%s', where '%s' is replaced with tablename and f.name, respectively, return value of the function qn called with an argument tablename and return value of the function qn called with an argument f.name. join field_output elements into a string, separated by whitespaces, append it to table_output. full_statement is a list containing: string "CREATE TABLE %s (", where %s is replaced by result of the function qn called with an argument tablename. for every i and line in enumerated iterable table_output, replace %s in string ' %s%s' with: line and character ',' if i is lesser than length of table_output decremented by one, or with an empty string if its not, append the resulting string to full_statement. append string ');' to full_statement. evaluate method transaction.atomic with arguments: using set to database and savepoint set to connection.features.can_rollback_ddl, with the result, evaluate method connection.cursor, with return value as curs, try, join full_statement into a string, separated by newlines, use it as an argument for the call to the method curs.execute. if DatabaseError, renamed to e, exception is caught, raise an CommandError with an argument string "Cache table '%s' could not be created.\nThe error was: %s.", replace '%s' with: tablename and return value of the function force_text called with an argument e, respectively. for every statement in index_output, execute statement on the database that curs points to. if self.verbosity is greater than integer 1, replace '%s' in string "Cache table '%s' created." with tablename, write it to self.stdout. from django.core.management.base import BaseCommand and CommandError into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the BaseCommand base class. help is a tuple containing a string "Runs the command-line client for specified database, or the default database if none is provided.". requires_system_checks is boolean False. define the method add_arguments with self and parser. call the method parser.add_argument with arguments: string '--database', action set to string 'store', dest set to string 'database', default set to DEFAULT_DB_ALIAS and help set to string 'Nominates a database onto which to open a shell. Defaults to the "default" database.'. define the method handle with arguments self and unpacked dictionary options. get the value under the 'database' key of the options dictionary, use it as a key to access the element under the connections dictionary, substitute it for connection. try, call the method connection.client.runshell. if OSError exception is caught, raise an CommandError exception with an argument string 'You appear not to have the %r program installed or on your path.', from django.core.management.base import BaseCommand into default name space. define the function module_to_dict with 2 arguments: module and omittable as a lambda function with an argument k, return dictionary created out of tuple elements k and printable representation of v, for every k and v in return value of the method module.__dict__.items, only if result of the method omittable called with an argument k is false. derive the class Command from the BaseCommand base class. requires_system_checks is boolean False. define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 5 arguments: string '--all', action set to string 'store_true', dest set to string 'all', default set to boolean False and help set to a string 'Display all settings, regardless of their value. Default values are prefixed by "###".' define the method handle with arguments self and unpacked dictionary options. from django.conf import settings, global_settings into default name space. call the method settings._setup. call the function module_to_dict with an argument settings._wrapped, substitute it for user_settings. call the function module_to_dict with an argument global_settings, substitute it for default_settings. output is an empty string. for every key in sorted list of user_settings, if key is not contained in default_settings, replace '%s' in string "%s = %s ###" with key and value under the key key of the user_setting dictionary, append it to the output. otherwise if value under the key key of the user_settings dictionary is not equal to the value under the key key of the default_settings dictionary, replace '%s' in string "%s = %s" with key and value under the key key of the user_setting dictionary, append it to the output. otherwise if value under the key 'all' of the options dictionary is true, replace '%s' in string "### %s = %s" with key and value under the key key of the user_setting dictionary, append it to the output. join elements of the output into a string, separated by newlies, return the string. import module warnings. from collections import OrderedDict into default name space. from django.apps import apps into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core import serializers into default name space. from django.db import router and DEFAULT_DB_ALIAS into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. derive the class Command from the BaseCommand base class. help is a tuple containing a string "Output the contents of the database as a fixture of the given " "format (using each model's default manager unless --all is specified).". define the method add_arguments with arguments self and parser. call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'app_label[.ModelName]', nargs set to '*' and help is a string 'Restricts dumped data to the specified app_label or app_label.ModelName.'. call the method parser.add_argument with 4 arguments: string '--format', default set to string 'json', dest set to 'format' and help is a string 'Specifies the output serialization format for fixtures.'. call the method parser.add_argument with 5 arguments: string '--indent', default set to None, dest set to 'indent', type set to int and help is a string 'Specifies the indent level to use when pretty-printing output.'. call the method parser.add_argument with 5 arguments: string '--database', default set to string 'store', dest set to 'database', add set to DEFAULT_DB_ALIAS and help is 'Nominates a specific database to dump fixtures from. Defaults to the "default" database.'. call the method parser.add_argument with 6 arguments: string '-e', string '--exclude', dest set to 'exclude', action set to 'append', default is a an empty list and help is a string '(use multiple --exclude to exclude multiple apps/models).'. call the method parser.add_argument with 6 arguments: string '-n', string '--natural', action is string 'store_true', dest is string 'use_natural_keys', default is boolean False and help is a string 'Use natural keys if they are available (deprecated: use --natural-foreign instead).'. call the method parser.add_argument with 5 arguments: string '--natural-foreign', action set to string 'store_true', dest is string 'use_natural_foreign_keys', default is boolean False and help is a string 'Use natural foreign keys if they are available.'. call the method parser.add_argument with 5 arguments: string '--natural-primary', action set to 'store_true', dest is 'use_natural_primary_keys', default is boolean False and help is a string 'Use natural primary keys if they are available.'. call the method parser.add_argument with 6 arguments: string '-a', string '--all', action set to 'store_true', dest is 'use_base_manager', default is boolean False and help is a string '(use multiple --exclude to exclude multiple apps/models).'. call the method parser.add_argument with 3 arguments: string '--pks', dest set to string 'primary_keys', and help is a string "Only dump objects with given primary keys. Accepts a comma separated list of keys. " "This option will only work when you specify one model.". call the method parser.add_argument with 5 arguments: string '-o', string '--output', default is None, dest set to string 'output', and help is a string 'Specifies file to which the output is written.'. define the method handle with arguments self, unpacked list app_labels and unpacked dictionary options. get the value under the 'format' key of the options dictionary, substitute the result for format. get the value under the 'indent' key of the options dictionary, substitute the result for indent. get the value under the 'database' key of the options dictionary, substitute the result for database. get the value under the 'exclude' key of the options dictionary, substitute the result for exclude. get the value under the 'output' key of the options dictionary, substitute the result for output. get the value under the 'traceback' key of the options dictionary, substitute the result for traceback. get the value under the 'use_natural_keys' key of the options dictionary, substitute the result for use_natural_keys. if use_natural_keys is true, call the function warnings.warn with an argument string "``--natural`` is deprecated; use ``--natural-foreign`` instead.", and RemovedInDjango19Warning. get the value under the ' use_natural_foreign_keys' key of the options dictionary, substitute the result for use_natural_foreign_keys. get the value under the 'use_natural_primary_keys' key of the options dictionary, substitute the result for use_natural_primary_keys. get the value under the 'use_base_manager' key of the options dictionary, substitute the result for use_base_manager. get the value under the 'primary_keys' key of the options dictionary, substitute the result for pks. if pks is true, split string pks by ',', substitute the result for primary_keys. if not, primary_keys is an empty list. excluded_apps is an empty set. excluded_models is an empty set. for every exclude in excludes, if '.' is contained in exclude, try, call the method apps.get_model with exclude as an argument, substitute it for model. if LookupError exception is caught, raise an CommandError exception with an argument string 'Unknown model in excludes: %s', where '%s' is replaced with exclude. add model to excluded_models set. if not, try, call the method apps.get_app_config with an argument exclude, substitute the result for app_config. if LookupError exception is caught, raise CommandError with an argument string 'Unknown app in excludes: %s', where '%s' is replaced with exclude. add app_config to excluded_apps set. if length of app_labels equals integer 0, if primary_keys is true, raise an CommandError exception with an argument string "You can only use --pks option with one model". app_list is an instance of OrderedDict class, created with an argument a tuple containing elements: app_config and None, for every app_config in return value of the method apps.get_app_configs, only if app_config.models_module is not None, and app_config is not contained in excluded_apps. if not, if length of app_labels is greater than integer 1 and primary_keys is true, raise an CommandError exception with an argument string "You can only use --pks option with one model". app_list is an instance of a class OrderedDict. for every label in app_labels, try, split label by '.', assign the result to app_label and model_label, respectively. try, call the method apps.get_app_config with an argument app_label, substitute the result for app_config. if LookupError exception is caught, raise CommandError with an argument string 'Unknown app in excludes: %s', where '%s' is replaced with exclude. if app_config.models_module is None or app_config is contained in excluded_apps, skip this loop iteration. try, call the method app_config.get_model with an argument model_label, substitute the result for model. if LookupError exception is caught, raise CommandError with an argument string 'Unknown model: %s', where '%s' is replaced with app_label and model_label, respectively. call the method app_list.setdefault with 2 arguments app_config and an empty list, substitute the result for app_list_value. if app_list_value is not None, if mode is not contained in app_list_value, append model to app_list_value. if ValueError exception is caught, if primary_keys is true, raise an CommandError exception with an argument string "You can only use --pks option with one model". substitute label for app_label. try, call the method apps.get_app_config with an argument app_label, substitute the result for app_config. if LookupError exception is caught, raise CommandError with an argument string 'Unknown application: %s', where '%s' is replaced with app_label. if app_config.models_module is None or app_config is contained in excluded_apps skip this loop iteration. value under the app_config key of the app_list is None. if format is not contained in return value of the method serializers.get_public_serializer_formats, try, call the method serializers.get_serializer with an argument format. if serializers.SerializerDoesNotExist exception is caught, do nothing. raise CommandError with an argument string 'Unknown serialization format: %s', where '%s' is replaced with format. define the function get_objects. call the method app_list.items, use the result as an argument for the call to the function sort_dependencies, for every model in result, if model is contained in excluded_models, skip this loop iteration. if model._meta.proxy is false and return value of the function router.allow_migrate called with arguments using and model is true, if use_base_manager is true, substitute model._base_manager for objects. if not, substitute model._default_manager for objects. call the method objects.using with an argument using, call the method order_by on the result with an argument model._meta.pk.name, substitute the result for queryset. if primary_keys is true, call the method queryset.filter with an argument pk__in set to primary_keys, substitute the result for queryset. for every obj in result of the method queryset.iterator, yield obj, as an return value of the generator. try, self.stdout.ending is None. open the output file in writing mode if output is true, assign the file descriptor to stream, otherwise stream is None. try, call the method serializers.serialize with 6 arguments: format, result of the function get_objects, indent set to indent, use_natural_foreign_keys set to use_natural_foreign_keys, use_natural_primary_keys set to use_natural_primary_keys, and stream set to stream, if the stream is true, otherwise stream set to self.stdout. finally perform, if stream is true, close the file stream. if Exception, renamed to e, exception is caught, if show_traceback is true, raise an exception. raise CommandError with an argument string "Unable to serialize database: %s", where '%s' is replaced with e. define the function sort_dependencies with an argument app_list. model_dependencies is an empty list. models is an empty set. for every app_config and model_list in app_list, if model_list is None, call the method app_config.get_models, substitute the result fr model_list. for every model in model_list, add model to models set. if model has an 'natural_key' attribute, get 'dependencies' attribute of the model.natural_key, substitute it for deps, if the attribute doesnt exist, deps in an empty list. if deps is true, for every dep in deps call the method apps.get_model with an argument dep, and append the result to the list, substitute it for deps. if not, deps is an empty list. for every field in model._meta.fields, if field.rel has an 'to' attribute, substitute field.rel.to with rel_model. if rel_model has an attribute 'natural_key' and rel_model is not equal to model, append rel_model to deps. for every field in model._meta.many_to_many, if field.rel.through._meta.auto_created is true, substitute field.rel.to for rel_model. if rel_model has an 'natural_key' attribute and rel_model is not equal to model, append rel_model to deps. append a tuple containing 2 elements: model and deps to model_dependencies. call the methof model_dependencies.reverse. model_list is an empty list. while model_dependencies is true, skipped is an empty list. changed is boolean False. while model_dependencies is true, remove first element from model_dependencies, assign it to model and deps, respectively. found is boolean True. for every d in deps, if d is not contained in models and d is contained in model_list add boolean True to a tuple, otherwise add boolean False, for every candidate in the result perform following, if candidate is false, found is boolean False. if found is true, append model to model_list. changed is boolean True. if not, append a tuple containing 2 elemetns: model and deps, to skipped. if changed is false, raise an CommandError with argument: string "Can't resolve dependencies for %s in serialized app list.", where '%s' is replaced with: model._meta.app_label and model._meta.object_name joined into a string, with separator '.', result joined into a string, separated by string ', ' for every model and deps in sorted list of elements skipped sorted by key: return value of the lambda function with an argument obj, and result the __name__ field of the first element of obj. substitute skipped for model_dependencies. return model_list. import module sys. from importlib import import_module into default name space. from django.apps import apps into default name space. from django.db import connections, router, transaction and DEFAULT_DB_ALIAS into default name space. from django.core.management import call_command into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.management.color import no_style into default name space. from django.core.management.sql import sql_flush and emit_post_migrate_signal into default name space. from django.utils.six.moves import input into default name space. from django.utils import six into default name space. derive the class Command from the BaseCommand base class. help is a tuple containing a string: 'Removes ALL DATA from the database, including data added during ' 'migrations. Unmigrated apps will also have their initial_data fixture reloaded. Does not achieve a "fresh install" state.' define the add_arguments with arguments self and parser. call the method parser.add_argument with 5 arguments: string '--noinput', action set to string 'store_false', dest set to string 'interactive', default set to boolean True, help as a string 'Tells Django to NOT prompt the user for input of any kind.'. call the method parser.add_argument with 5 arguments: string '--database', action set to string 'store', dest as a string 'database', default set to DEFAULT_DB_ALIAS and help as a string 'Nominates a database to flush. Defaults to the "default" database.'. call the method parser.add_argument with 5 arguments: string '--no-initial-data', action set to string 'store_false', dest set to string 'load_initial_data', default=True and help as a string 'Tells Django not to load any initial data after database synchronization.'. define the method handle with arguments self and unpacked dictionary options. substitute value under the 'database' key of the options dictionary for database. substitute value under the database key of the connections dictionary for connection. substitute value under the 'verbosity' key of the options dictionary for verbosity. substitute value under the 'interactive' key of the options dictionary for interactive. get the value 'reset_sequences' key of the options dictionary, if it exists substitute it for reset_sequences, otherwise reset_sequences is boolean True. get the value 'allow_cascade' key of the options dictionary, if it exists substitute it for allow_cascade, otherwise allow_cascade is boolean False. get the value 'inhibit_post_migrate' key of the options dictionary, if it exists substitute it for inhibit_post_migrate, otherwise inhibit_post_migrate is boolean False. call the function no_style, substitute it for self.style. for every app_config in return value of the method apps.get_app_configs, try, call the function import_module with 2 arguments: string .management and app_config.name. if ImportError exception is caught, do nothing. call the method sql_flush with 5 arguments: self.style, connection, only_django set to boolean True, reset_sequences set to reset_sequences, allow_cascade set to allow_cascade, substitute the result for sql_list. if interactive is true, request user input from the standard input, assign it o confirm, with the query string: "You have requested a flush of the database." "This will IRREVERSIBLY DESTROY all data currently in the %r database, and return each table to an empty state." "Are you sure you want to do this?"Type 'yes' to continue, or 'no' to cancel: ", where '%s' is replaced with value under the 'NAME' key of the connection.settings_dict dictionary. if not, confirm is a string 'yes'. if confirm equals a string 'yes', try, call the method transaction.atomic with 2 arguments: using set to database, savepoint set to connection.features.can_rollback_ddl, with the result, call the method connection.cursor, with the result as cursor, for every sql in sql_list, call the method cursor.execute with an argument sql. if Exception, renamed to e, exception is caught, new_msg is a tuple containing a string: "Database %s couldn't be flushed. Possible reasons:\n" " * The database isn't running or isn't configured correctly.\n * At least one of the expected database tables doesn't exist.\n" " * The SQL was invalid.\nHint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.\n" "The full error: %s", where '%s' is replaced by value under the 'NAME' key of the connection.settings_dict dictionary and e. call the function six.reraise with 3 arguments: CommandError, CommandError created with argument new_msg, and third element of the return value of the function sys.exc_info. if inhibit_post_migrate is false, call the method self.emit_post_migrate with arguments verbosity, interactive and database. if value under the 'load_initial_data' key of the options dictionary is true, call the function call_command with 3 arguments: string 'loaddata', string 'initial_data' and unpacked dictionary options. if not, write string "Flush cancelled.\n" to self.stdout stream. class static method, define the method emit_post_migrate with arguments verbosity, interactive and database. all_models is an empty list. for every app_config in return value of the method apps.get_app_configs, call the method router.get_migratable_models with arguments app_config, database and include_auto_created set to boolean True, extend all_models list with the result. call the function emit_post_migrate_signal with 4 arguments: all_models converted into a set, verbosity, interactive and database. from __future__ import unicode_literals into default name space. from collections import OrderedDict into default name space. import module keyword. import module re. from django.core.management.base import BaseCommand and CommandError into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the BaseCommand base class. help is an string "Introspects the database tables in the given database and outputs a Django model module.". requires_system_checks is boolean False. db_module is a string 'django.db'. define the method add_arguments with arguments self and parser. call the method parser.add_argument with 5 arguments: string '--database', action set to string 'store', dest as a string 'database', default set to DEFAULT_DB_ALIAS and help as a string 'Nominates a database to introspect. Defaults to using the "default" database.'. define the method handle with 2 arguments: self and unpacked dictionary options. try, for every line in return value of the method self.handle_inspection called with an argument options, append new line to line, write it to self.stdout stream. if NotImplementedError exception is caught, raise an CommandError exception with an argument "Database inspection isn't supported for the currently selected database backend.". define the method handle_inspection with 2 argument: self and options. get value under the 'database' key of the options dictionary, use it as a key to get the value from the connections dictionary, substitute the result for connection. get the value under the 'table_name_filter' key of the options dictionary, substitute it for table_name_filter. table2model is a lambda function with an argument table_name, return value is the return value of the re.sub method, called with 3 arguments: raw string '[^a-zA-Z0-9]', empty string and result of the method table_name.title. strip_prefix is a lambda function with an argument s, return value is s without the first element if s starts with string 'u'', otherwise returns s. call the method connection.cursor, with the result as cursor, yield string "# This is an auto-generated Django model module." as the result. yield string "# You'll have to do the following manually to clean this up:" as the result. yield string "# * Rearrange models' order" as the result. yield string "# * Make sure each model has one field with primary_key=True" as the result. yield string "# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table" as the result. yield string "# Feel free to rename the models, but don't rename db_table values or field names." as the result. yield string "#" as the result. yield string "# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [app_label]'" as the result. yield string "# into your database." as the result. yield string "from __future__ import unicode_literals" as the result. yield and empty string as the result. yield string 'from %s import models' % self.db_module as the result, where "%s" is replaced with self.db_module. known_models is an empty list. for every table_name in return value of the method connection.introspection.table_names called with an argument cursor, if table_name_filter is not None and table_name_filter is callable object, call the function table_name_filter with an argument table_name, if it evaluates to true, skip this loop iteration, yield and empty string as the result. yield and empty string as the result. yield string 'from %s import models' % self.db_module as the result, where "%s" is replaced with result of the call to the function, table2model with an argument table_name. call the function table2model with an argument table_name, append the result to known_models. try, call the method connection.introspection.get_relations with 2 arguments cursor, table_name and substitute the result for relations. if NotImplementedError exception is caught, relations is an empty dictionary. try, call the method connection.introspection.get_relations with 2 arguments cursor, table_name and substitute the result for indexes. if NotImplementedError exception is caught, indexes is an empty dictionary. used_column_names is an empty list. for every i and row in enumerated result of the method connection.introspection.get_table_description called with arguments: cursor and table_name, comment_notes is an empty list. extra_params is an instance of the class OrderedDict. substitute first element of row for column_name. if i is contained in relations, is_relation is boolean True, otherwise is_relation is boolean False. call the method self.normalize_col_name with 3 arguments column_name, used_column_names, is_relation, assign the result to att_name, params and notes, respectively. add params to extra_params dictionary. extend comment_notes list with notes. append att_name to used_column_names list. if column_name is contained in indexes, if value under the 'primary_key' key of the dictionary contained under the column_name key of the dictionary indexes is true, value under the 'primary_key' key of the extra_params dictionary is boolean True, otherwise if, if value under the 'unique' key of the dictionary contained under the column_name key of the dictionary indexes is true, value under the 'unique' key of the extra_params dictionary is boolean True, if is_relation is true, if second element of the i-th row of relations equals table_name, rel_to is string 'self', otherwise call the method table2model with second element of the i-th row of relations and substitute it for rel_to. if rel_to is contained in known_models, append rel_to to string 'ForeignKey(, substitute the result for field_type. if not, append rel_to to string 'ForeignKey(, append character "'" to it, substitute the result for field_type. if not, call the method self.get_field_type with 3 arguments connection, table_name and row, assign the result to field_type, field_params, field_notes, respectively. add field_params to extra_params dictionary. extend comment_notes list with field_notes. append '(' to field_type. if att_name equals string 'id' and extra_params equals a dictionary with 1 entry: boolean True for 'primary_key', if field_type equals a string 'AutoField(', skip this loop iteration. otherwise if field_type equals a string 'IntegerField(' and connection.features.can_introspect_autofield is false, append string 'AutoField?' to comment_notes. if seventh element of row is true, if field_type equals a string 'BooleanField(', field_type is a string 'NullBooleanField(' if not, value under the 'blank' key of the extra_params dictionary is boolean True. if field_type is not equal to string 'TextField(' or string 'CharField(', value under the 'null' key of the extra_params dictionary is boolean True. field_desc is a string '%s = %s%s', where '%s' is replaced with: att_name, an empty string if '.' is contained in field_type, or with string 'models.' if it is not and field_type. if extra_params is true, if field_desc doesnt end with '(', append string ', ' to field_desc. in string '%s=%s' replace '%s' with k and return value of the function strip_prefix with an argument printable representation of v, for every k and v in return value of the extra_params.items method, join all results into a string separated by a string ', ', substitute it for field_desc. append string ')' to field_desc. if comment_notes is true, join elements of comment_notes into a string, separated by whitespaces, append it to the string ' #', append the result to field_desc. yield string ' %s', where '%s' is replaced with field_desc. for meta_line in return value of the method self.get_meta called with an argument table_name. yield meta_line as the result. define the method normalize_col_name with 4 arguments: self, col_name, used_column_names and is_relation. field_params is an empty dictionary. field_notes is an empty list. convert col_name to lowercase, substitute the result for new_name. if new_name is not equal to col_name, append string 'Field name made lowercase.' to field_notes. if is_relation, if new_name ends with string '_id', substitute new_name, without the last 3 elements for new_name. if not, substitute col_name for value under the 'db_column' key of the field_params dictionary. cal the method re.subn with 3 arguments: raw string '\W', string '_' and new_name. if num_repl is greater than integer 0, append string 'Field renamed to remove unsuitable characters.' to field_notes. call the method new_name.find, with an argument string '__', if it evaluates to greater or equal than integer 0, while the result of the method new_name.find, called with an argument string '__' is greater or equals integer 0, replace all the occurrences of '__' with '_' in new_name. convert col_name to lowercase, on the result call the method find with an argument string '__', if the result is greater of equal to integer 0, append string "Field renamed because it contained more than one '_' in a row." to field_notes. if new_name starts with a string '_', convert new_name to a string and append it to string 'field', substitute the result for new_name. append string "Field renamed because it started with '_'." to field_notes. if new_name ends with a string '_', convert new_name to a string and append string 'field' to it, substitute the result for new_name. append string "Field renamed because it ended with '_'." to field_notes. call the method keyword.iskeyword with an argument new_name, if it evaluates to true, append string '_field' to new_name. append string "Field renamed because it was a Python reserved word." to field_notes. if first element of new_name is digit, convert new_name to a string and append it to string 'number_', substitute the result for new_name. append string "Field renamed because it wasn't a valid Python identifier." to field_notes. if new_name is contained in used_column_names, num is an integer 0. in string '%s_%d', replace '%s' with new_name and '%d' with num, while the result is contained in used_column_names, increment num by one. in string '%s_%d', replace '%s' with new_name and '%d' with num, substitute the result for new_name. append string "Field renamed because of name conflict." to field_notes. if col_name is not equal to new_name and field_notes is true, substitute col_name for value under the 'db_column' key of the field_params dictionary. return new_name, field_params and field_notes. define the method get_field_type with 4 arguments: self, connection, table_name and row. field_params is an instance of a class OrderedDict. field_notes is an empty list. try, call the method connection.introspection.get_field_type with 2 arguments: second element of row and row, substitute the result for field_type. if KeyError exception is caught, field_type is a string 'TextField'. append a string 'This field type is a guess.' to field_notes. if field_type is a tuple, substitute field_type for field_type and new_params, respectively. call the method field_params.update with an argument new_params.1 if field_type equals a string CharField' and fourth element of row is true, convert fourth element of row to an integer, substitute it for value under the 'max_digits' key of the field_params. if field_type equals a string 'DecimalField', if fifth and sixth elements of row are None, append string 'max_digits and decimal_places have been guessed, as this database handles decimal fields as float' to field_notes. if fifth element of row is not None, substitute it for value under the 'max_digits' key of the field_params, otherwise, value under the 'max_digits' key of the field_params is integer 10. if sixth element of row is not None, substitute it for value under the 'decimal_places' key of the field_params, otherwise, value under the 'decimal_places' key of the field_params is integer 5. if not substitute fifth element of row for value under the 'max_digits' key of the field_params. substitute sixth element of row for value under the 'decimal_places' key of the field_params. return field_type, field_params and field_notes. define the method get_meta with arguments self and table_name. return the list, containing 4 elements: an empty string, string " class Meta:", string " managed = False", from __future__ import unicode_literals into default name space. import module glob. import module gzip. import module os. import module warnings. import module zipfile. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core import serializers into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.management.color import no_style into default name space. from django.db import connections, router, transaction, DEFAULT_DB_ALIAS, IntegrityError and DatabaseError into default name space. from django.utils import lru_cache into default name space. from django.utils.encoding import force_text into default name space. from django.utils.functional import cached_property into default name space. from django.utils._os import upath into default name space. from itertools import product into default name space. try, import bz2. has_bz2 is boolean True. if ImportError exception is caught, has_bz2 is boolean False. derive the class Command from the BaseCommand base class. help is an string 'Installs the named fixture(s) in the database.'. missing_args_message is a tuple containing a string "No database fixture specified. Please provide the " "path of at least one fixture in the command line." define the method add_arguments with 2 arguments: self and parser. call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'fixture', nargs set to '+', and help set to 'Fixture labels.'. call the method parser.add_argument with 5 arguments: string '--database', action set to string 'store', dest as a string 'database', default set to DEFAULT_DB_ALIAS and help as a string 'Nominates a specific database to load fixtures into. Defaults to the "default" database.' call the method parser.add_argument with 5 arguments: string '--app', action as a string 'store', dest as a string 'app_label', default set to None, help is a string 'Only look for fixtures in the specified app.'. call the method parser.add_argument with 6 arguments: string '--ignorenonexistent', string '-i', action as a string 'store_true', dest as a string 'ignore', default set to boolean False and help set to string 'Ignores entries in the serialized data for fields that do not currently exist on the model.'. define the method handle with 3 arguments: self, unpacked list fixture_labels and unpacked dictionary options. get the value under the 'ignore' key of the options dictionary, substitute it for self.ignore. get the value under the 'database' key of the options dictionary, substitute it for self.database. get the value under the 'app_label' key of the options dictionary, substitute it for self.app_label. get the value under the 'hide_empty' key of the options dictionary, if the key exists substitute it for self.hide_empty, if not, self.hide_empty is boolean False. get the value under the 'verbosity' key of the options dictionary, substitute it for self.verbosity. call the method transaction.atomic with an argument using set to self.using, with the result, call the method self.loaddata with an argument fixture_labels. call the method transaction.get_autocommit with an argument self.using, if it evaluates to true, get the value under the self.using key of the connections dictionary, call the method close on it. define the method loaddata with 2 arguments self and fixture_labels. get the value under the self.using key of the connections dictionary, substitute it for connection. self.fixture_count is integer 0. self.loaded_object_count is integer 0. self.fixture_object_count is integer 0. self.models is an empty set. call the method serializers.get_public_serializer_formats, substitute the result for self.serialization_formats. self.compression_formats is an dictionary with 3 initial entries: tuple containing 2 elements: open and string 'rb' for None, tuple with 2 arguments: gzip.GzipFile and string 'rb' for 'gz', tuple with 2 arguments: SingleZipReader and string 'r' for 'gzip'. if has_bz2 is true, substitute tuple with 2 elements: bz2.BZ2File and string 'r' for value under the 'bz2' key of the self.compression_formats dictionary. call the method connection.constraint_checks_disabled, with the result perform, for every fixture_label in fixture_labels, call the method self.load_label with an argument fixture_label. for model in self.models append model._meta.db_table to a list, substitute the resulting list for table_names. try, call the method connection.check_constraints with an arguments table_names set to table_names. if Exception, renamed to e, exception is caught, e.args is a tuple, containing 1 element: string "Problem installing fixtures: %s", where '%s' is replaced with e. raise an exception. if self.loaded_object_count is greater than zero, call the method connection.ops.sequence_reset_sql with 2 arguments: return value of the no_style and self.models, substitute the result for sequence_sql. if sequence_sql is true, if self.verbosity is grater than, or equal to integer 2, write a string "Resetting sequences\n" to self.stdout stream. call the method connection.cursor, with the result renamed to cursor, perform the following, for every line in sequence_sql, call the method cursor.execute with an argument line. if self.verbosity is greater of equal to integer 1, if self.fixture_count equals integer 0 and self.hide_empty is true, do nothing. otherwise if self.fixture_object_count equals self.loaded_object_count, call the method self.stdout.write with an argument string "Installed %d object(s) from %d fixture(s)", where '%d' is replaced with self.loaded_object_count and self.fixture_count, respectively. if not, call the method self.stdout.write with an argument string "Installed %d object(s) (of %d) from %d fixture(s)", substitute '%d' with self.loaded_object_count, self.fixture_object_count and self.fixture_count. define the method load_label with self and fixture_label as arguments. for every fixture_file, fixture_dir and fixture_name in return value of the method self.find_fixtures called with an argument fixture_label, call the function os.path.basename with an argument fixture_file, use the result as an argument for the call to the method, self.parse_name, assign the result to _, ser_fmt and cmp_fmt, respectively. get the value under the cmp_fmt key of the self.compression_formats dictionary, assign it to open_method and mode. call the function open_method with arguments: fixture_file and mode, substitute the result for fixture. try, increment self.fixture_count by one. objects_in_fixture is integer 0. loaded_objects_in_fixture is integer 0. if self.verbosity is greater or equal to integer 2, call the method self.stdout.write with an argument string "Installing %s fixture '%s' from %s.", substitute '%s' with ser_fmt, fixture_name and return value of the function humanize called with an argument fixture_dir. call the method serializers.deserialize with 4 arguments: ser_fmt, fixture, using set to self.using, and ignorenonexistent set to self.ignore, substitute the result for objects. for every obj in objects, increment objects_in_fixture by one. call the method router.allow_migrate with 2 arguments: self.using and obj.object.__class__, if it evaluates to true, increment loaded_objects_in_fixture by one. add obj.object.__class__ to self.models set. try, call the method obj.save with an argument using set to self.using. if DatabaseError or IntegrityError, renamed to e, exceptions are caught, e.args is a tuple containing string "Could not load %(app_label)s.%(object_name)s(pk=%(pk)s): %(error_msg)s, where '%(app_label)s' is replaced for obj.object._meta.app_label, '%(object_name)s' is replaced with obj.object._meta.object_name, '%(pk)s' is replaced with obj.object.pk and '%(error_msg)s' is replaced with result of the function force_text with an argument e. raise an exceptions increment self.loaded_object_count by loaded_objects_in_fixture. increment self.fixture_object_count by objects_in_fixture. if Exception, renamed to e, exception is caught, if e is not an instance of CommandError class, e.args is a tuple containing string "Problem installing fixture '%s': %s", where '%s' is replaced with fixture_file, e. raise an exception. finally perform, call the method fixture.close. if objects_in_fixture equals integer 0, call the method warnings.warn with 2 arguments: string "No fixture data found for '%s'. (File format may be invalid.)", where '%s' is replaced with fixture_name, and RuntimeWarning. decorator method lru_cache.lru_cache with an argument maxsize set to None. define the method find_fixtures with arguments: self and fixture_label. call the method self.parse_name with an argument fixture_label, substitute the result for fixture_name, ser_fmt, cmp_fmt, respective. databases is a list containing 2 elements: self.using and None. call the method self.compression_formats.keys, convert it to list, substitute it for cmp_fmts if cmp_fmt is None, otherwise cmp_fmts is a list containing cmp_fmt. call the method serializers.get_public_serializer_formats, substitute the result for ser_fmts if ser_fmt is None, otherwise ser_fmts is a list containing ser_fmt. if self.verbosity is greater or equal to integer 2, call the method self.stdout.write with an argument string "Loading '%s' fixtures...", where '%s' is replaced with fixture_name. if fixture_name is an absolute file path, call the method os.path.dirname with an argument fixture_name, append it to a list, substitute resulting list for fixture_dirs. call the method os.path.basename with an argument fixture_name, substitute the result for fixture_name. if not, substitute self.fixture_dirs for fixture_dirs. if os.path.sep is contained in fixture_name, join dir_ and return value of the function os.path.dirname called with an argument fixture_name into a valid file path, append it to a list, perform the previous for every dir_ in fixture_dirs, substitute the resulting list for fixture_dirs. call the method os.path.basename with an argument fixture_name, substitute the result for fixture_name. for every ext in combo, if ext is true, join it to a string, separated by '.', put the result in a tuple, perform the previous for every combo in result of the function product called with 3 arguments: databases, ser_fmts and cmp_fmts, substitute the result for suffixes. join fixture_name and suffix into a string, separated by '.' for every suffix in suffixes, put the results in set, substitute it for targets. fixture_files is an empty list. for every fixture_dir in fixture_dirs, if self.verbosity is greater or equals to integer 2. call the method self.stdout.write with an argument string "Checking %s for fixtures...", where '%s' is replaced with result of the function humanize, called with an argument fixture_dir. fixture_files_in_dir is an empty list. join fixture_dir, fixture_name with appended character '*' into a valid file path, use it as an argument for the call to the glob.iglob, for every candidate in result, call the method os.path.basename with an argument candidate, is result is contained in targets, append tuple containing 3 elements: candidate, fixture_dir and fixture_name to list fixture_files_in_dir. if self.verbosity is greater or equals integer 2 and fixture_files_in_dir is false, call the method self.stdout.write with an argument string "No fixture '%s' in %s.", where '%s' is replaced with fixture_name, and result of the function humanize called with an argument fixture_dir. if length of fixture_files_in_dir is greater than 1, raise an CommandError exception with an argument string "Multiple fixtures named '%s' in %s. Aborting.", where '%s' is replaced with: fixture_name and result of the function humanize called with an argument fixture_dir. extend fixture_files list with fixture_files_in_dir. if fixture_name is not equal to string 'initial_data' and fixture_files is false, call the method warnings.warn with an argument string "No fixture named '%s' found." where '%s' is replaced with fixture_name. return fixture_files. decorator cached_property, define the method fixture_dirs with an argument self. dirs is an empty dictionary. for ever app_config in return value of the method apps.get_app_configs, if self.app_label is true and app_config.label is not equal to self.app_label, skip this loop iteration. join app_config.path and string 'fixtures' into a valid file path, substitute it for app_dir. if app_dir is a directory, append app_dir to dirs list. convert settings.FIXTURE_DIRS to a list, extend dirs by it. append an empty string to dirs list. call the function os.path.realpath with an argument d, use the result as an argument for the call to the function os.path.abspath, use the result as an argument for the call to the upath function, for every d in dirs, append the results into a list, substitute the resulting list for dirs. return dirs. define the method parse_name with arguments self and fixture_name. call the method fixture_name.rsplit with 2 arguments: character '.' and integer 2, substitute the result for parts. if length of parts is greater than integer 1 and last element of parts is contained in self.compression_formats, substitute the last element of parts for cmp_fmt. substitute the last element of parts for parts. if not, cmp_fmt is None. if length of parts is greater than integer 1. if last element of parts is contained in self.serialization_formats, substitute the last element of parts for ser_fmt. substitute the last element of parts for parts. if not, raise an CommandError with an argument string "Problem installing fixture '%s': %s is not a known serialization format.", replace '%s' with: elements of last element of parts joined into a string and last element of parts. if not, ser_fmt is None. join elements of parts into a string, separated with '.', substitute it for name. return name, ser_fmt and cmp_fmt. derive class SingleZipReader for zipfile.ZipFile base class. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. call the method zipfile.ZipFile.__init___ with the arguments self, unpacked list args and unpacked dictionary kwargs. call the method self.namelist, if the length of the result is not integer 1, raise an ValueError with an string "Zip-compressed fixtures must contain one file.". define the method read with an argument self. call the method zipfile.ZipFile.read with 2 arguments: self and first element of the result of the self.namelist method. define the function humanize with an argument dirname. if dirname is true, return dirname converted to a string and surounded by single quotes, if not return string 'absolute path'. from __future__ import unicode_literals into default name space. import module fnmatch. import module glob. import module io. import module os. import module re. import module sys. from itertools import dropwhile into default name space. import module django. from django.core.management.base import CommandError and BaseCommand into default name space. from django.core.management.utils import handle_extensions, find_command and popen_wrapper into default name space. from django.utils.encoding import force_st into default name space. from django.utils.functional import total_ordering into default name space. from django.utils import six into default name space. from django.utils.text import get_text_list into default name space. from django.utils.jslex import prepare_js_for_gettext into default name space. call the method re.compile with 2 arguments: raw string '^(?P"Plural-Forms.+?\\n")\s*$', and result of the bitwise OR performed on the re.MULTILINE and re.DOTALL operands, substitute the result for plural_forms_re/ STATUS_OK is integer 0. define the method check_programs with an argument unpacked list programs. for every program in programs, call the function find_command with an argument program, if it evaluates to None, raise an CommandError exception with an argument "Can't find %s. Make sure you have GNU gettext tools 0.15 or newer installed.", where '%s' is replaced with program. total_ordering decorator, derive the class TranslatableFile from the object class. define the method __init__ with 4 arguments: self, dirpath, file_name and locale_dir. substitute file_name for self.file_name. substitute dirpath for self.dirpath. substitute locale_dir for self.locale_dir. define the method __repr__with an argument self. join self.dirpath and self.file in a string, substitute with it '%s' in string "", return the result. define the method __eq__ with self and other arguments: if self.path equals other.path, return boolean True, if not return boolean False. define the mehod __lt__ with self and other. if self.path is lesser than other.path, return boolean True, otherwise return boolean False. property decorator. define the method path with an argument self. join self.dirpath and self.file into a file path, return it. define the method process with 3 arguments: self, command and domain. from django.conf import settings into default namespace. from django.utils.translation import templatize into default namespace. if command.verbosity is greater than integer 1, substitute '%s' is string 'processing file %s in %s\n' with self.file and self.dirpath, write it to command.stdout. call the method os.path.splitext with an argument self.file, assign the result to _ and file_ext. if domain equals a string 'djangojs' and file_ext is contained in command.extensions, is_templatized is boolean True. join self.dirpath and self.file into a file path, substitute it for orig_file. call the function io.open with orig_file and encoding set to settings.FILE_CHARSET, with the result renamed to fp, perform the following: call the method fp.read, substitute the result for src_data. call the function prepare_js_for_gettext with an argument src_data, substitute it for src_data. convert self.file to a string and append '.c' string to it, substitute the result for thefile. join self.dirpath and thefile in a string, substitute the result for work_file. call the function io.open with 3 arguments: work_file, string 'w' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: call the method fp.write with an arguments src_data. append command.xgettext_options to the list containing 10 elements: string 'xgettext', string '-d', domain, string '--language=C', string '--keyword=gettext_noop', string '--keyword=gettext_lazy', string '--keyword=ngettext_lazy:1,2', string '--keyword=pgettext:1c,2', string '--keyword=npgettext:1c,2,3' and string '--output=-', substitute it for args. append work_file to args. otherwise if domains equals a string django' and, file_ext equals '.py' or file_ext is contained in command.extensions, substitute self.file for thefile. join self.dirpath and self.file into a file path, substitute it for orig_file. if file_ext is contained in command.extensions, is_templatized is boolean True, otherwise it is boolean False. if is_templatized is true, call the function io.open with 3 arguments: work_file, string 'w' and encoding set to settings.FILE_CHARSET as arguments, with the result renamed to fp, perform the following: call the method fp.read, substitute the result for src_data. convert self.file to string and append string '.py' to it, substitute the result for thefile. call the function templatize with 2 arguments: src_data and sliced orig_file, without first 2 elements, substitute the result for content. call the function io.open with 3 arguments: self.dirpath and thefile joined into a file path, string 'w', and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: call the method fp.write with an argument content. join self.dirpath, thefile into a file path, substitute it for work_file. append command.xgettext_options to list containing 15 elements: string 'xgettext', string '-d', domain, string '--language=Python', string '--keyword=gettext_noop', string '--keyword=gettext_lazy', string '--keyword=ngettext_lazy:1,2', string '--keyword=ugettext_noop', string '--keyword=ugettext_lazy', string '--keyword=ungettext_lazy:1,2', string '--keyword=pgettext:1c,2', string '--keyword=npgettext:1c,2,3', string '--keyword=pgettext_lazy:1c,2', string '--keyword=npgettext_lazy:1c,2,3' and string '--output=-', substitute the result for args. append work_file to args. if not, return nothing. call the function popen_wrapper with argument args, assign the result to msgs, errors and status. if errors is true, if status is not equal to STATUS_OK, if is_templatized is true, call the function os.unlink with an argument work_file. raise an CommandError exception with an argument string "errors happened while running xgettext on %s\n%s", where '%s' are replaced by sel.file and errors, respectively. if command.verbosity is greater than integer 0, call the method command.stdout.write with an argument errors. if msgs is true, if six.PY2 is true, call the method msgs.decode with an argument string 'utf-8', substitute the result for msgs. join into a file path: self.locale_dir and string '.pot' appended to domain converted to string, substitute it for potfile. if is_templatized is true, if os.name equals string 'nt', append work_file to string '#: ', substitute it for old. append orig_file to string '#: ', substitute it for new. if not, append work_file to string '#: ', substitute it for old. append orig_file to string '#: ', substitute it for new. replace every occurrence of old for new in msgs, substitute the result for msgs. call the function write_pot_file with 2 arguments: potfile and msgs. if is_templatized is true, call the function os.unlink with an argument work_file. define the function write_pot_file with 2 arguments potfile and msgs. if potfile fie exists, call the function dropwhile with 2 arguments: function len and msgs spit into parts at newlines, join the result into a string, separated by newline, substitute it for msgs. if not, replace every occurrence of string 'charset=CHARSET' for string 'charset=UTF-8' in msgs, substitute the result for msgs. call the function io.open with 3 arguments: potfile, string 'a' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: call the method fp.write with an argument msgs. derive the class Command from the BaseCommands base class. help is a string "Runs over the entire source tree of the current directory and " "pulls out all strings marked for translation. It creates (or updates) a message " "file in the conf/locale (in the django tree) or locale (for projects and " "applications) directory.\n\nYou must run this command with one of either the " "--locale, --exclude or --all options.". requires_system_checks is boolean False. leave_locale_alone is boolean True msgmerge_options is an list with elements: strings '-q' and '--previous'. msguniq_options is an list with elements: string '--to-code=utf-8'. msgattrib_options is an list with elements: string '--no-obsolete'. xgettext_options is an list with elements: strings '--from-code=UTF-8' and '--add-comments=Translators'. define the method add_arguments with 2 arguments: self and parser. call the method parser.add_argument with 6 arguments: string '--locale', string '-l', default as an empty list, dest as a string 'locale', action as a string 'append' and help as a string, 'Creates or updates the message files for the given locale(s) (e.g. pt_BR). Can be used multiple times.'. call the method parser.add_argument with 5 arguments: string '--exclude', string '-x', default as a empty list, dest as a string 'exclude', action as a string 'append' and help as a string 'Locales to exclude. Default is none. Can be used multiple times.'. call the method parser.add_argument with 5 arguments: string '--domain', string '-d', default as a string 'django', dest set to string 'domain' and help as a string 'The domain of the message files (default: "django").'. call the method parser.add_argument with 6 arguments: string '--all', string '-a', action as a string'store_true', dest as a string 'all' default as boolean False and help as a string 'Updates the message files for all existing locales.'. call the method parser.add_argument with 5 arguments: string '--extension', string '-e', dest set to string 'extensions', help set to a string 'The file extension(s) to examine (default: "html,txt", or "js" ' 'if the domain is "djangojs"). Separate multiple extensions with commas, or use -e multiple times.' and action as a string 'append'. call the method parser.add_argument with 6 arguments: string '--symlinks', string '-s', action as a string 'store_true', dest as a string 'symlinks', default as boolean False and help as a string 'Follows symlinks to directories when examining ' 'source code and templates for translation strings.'. call the method parser.add_argument with 7 arguments: string '--ignore', string '-i', action as a string 'append', dest as a string 'ignore_patterns', default as an empty list, metavar as a string 'PATTERN', and help as a string 'Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.'. call the method parser.add_argument with 5 arguments: string '--no-default-ignore', action as a string 'store_false', dest as a string 'use_default_ignore_patterns', default set to boolean True, and help as a string "Don't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.". call the method parser.add_argument with 5 arguments: string '--no-wrap', action as a string 'store_true', dest as a string 'no_wrap', default as boolean False and help as a string "Don't break long message lines into several lines.". call the method parser.add_argument with 5 arguments: string '--no-location', action set to string 'store_true', dest set to string 'no_location', default as boolean False and help as a string "Don't write '#: filename:line' lines.". call the method parser.add_argument with 5 arguments: string '--no-obsolete', action as a string 'store_true', dest as a string 'no_obsolete', default as boolean False and help as a string "Remove obsolete message strings.". call the method parser.add_argument with 5 arguments: string '--keep-pot', action as a string 'store_true', dest as a string 'keep_pot', default as boolean False and help as a string "Keep .pot file after making messages. Useful when debugging." define the method handle with 3 arguments: self, unpacked list args and unpacked dictionary options. get the value under the 'locale' key of the options dictionary, substitute it for locale. get the value under the 'exclude' key of the options dictionary, substitute it for exclude. get the value under the 'domain' key of the options dictionary, substitute it for self.domain. get the value under the 'verbosity' key of the options dictionary, substitute it for self.verbosity. get the value under the 'all' key of the options dictionary, substitute it for process_all. get the value under the 'extensions' key of the options dictionary, substitute it for extensions. get the value under the 'symlinks' key of the options dictionary, substitute it for self.symlinks. get the value under the 'ignore_patterns' key of the options dictionary, substitute it for ignore_patterns. get the value under the 'use_default_ignore_patterns' key of the options dictionary, if it is true, append list containing 4 elements: 'CVS', '.*', '*~' and '*.pyc', to ignore_patterns. put elements of ignore_patterns into a set, substitute the length of it for self.ignore_patterns. get the value under the 'no_wrap' key of the options dictionary, if it is true, append list containing string '--no-wrap' to self.msgmerge_options append list containing string '--no-wrap' to self.msguniq_options. append list containing string '--no-wrap' to self.msgattrib_options. append list containing string '--no-wrap' to self.xgettext_options. get the value under the 'no_location' key of the options dictionary, if it is true, append list containing string '--no-location' to self.msgmerge_options. append list containing string '--no-location' to self.msguniq_options. append list containing string '--no-location' to self.msgattrib_options. append list containing string '--no-location' to self.xgettext_options. get the value under the 'no_obsolete' key of the options dictionary, substitute it for self.no_obsolete. get the value under the 'keep_pot' key of the options dictionary, substitute it for self.keep_pot. if self.domain is not equal to string 'django' or string 'djangojs', raise an CommandError exception with an argument string "currently makemessages only supports domains 'django' and 'djangojs'". if self.domain equals to string 'djangojs', if extensions is false, substitute it for exts, otherwise exts is a list containing string 'js'. if not, if extensions is false, substitute it for exts, otherwise exts is a list containing 2 elements: string 'html' and string 'txt'. call the function handle_extensions exts, substitute self.extensions. evaluate the boolean expression: locale is None and exclude is false and process_all is false, if the result is true or self.domain is not None, raise an CommandError exception with an argument string "Type '%s help %s' for usage information.", where '%s' are replaced by: return value of the function os.path.basename called with first element of sys.argv as an argument, and second element of sys.argv. from django.conf import settings into default namespace. if settings.configured, settings.USE_I18N is boolean True. if not, call the method settings.configure with an argument USE_I18N set to boolean True. if self.verbosity is integer 1, call the method self.stdout.write with an argument string 'examining files with the extensions: %s\n', substitute '%s' with return value of the function get_text_list called with 2 arguments:self.extensions converted into a list and string 'and'. self.invoked_for_django is boolean False. self.locale_paths is an empty list. self.default_locale_path is None. join 'conf' and 'locale' into a file path, if it is a directory, join 'conf' and 'locale' into a file path, use it as an argument for the call the method os.path.abspath, put the results into a list, substitute self.locale_paths for it. substitute first element of self.locale_paths for self.default_locale_path. self.invoked_for_django is boolean True. if not, convert settings.LOCALE_PATHS into a list and extend list self.locale_paths with it. if 'locale' is a directory, call the function os.path.abspath with an argument 'locale', append the result to self.locale_paths. if self.locale_paths is true, substitute first element of self.locale_paths for self.default_locale_path. if self.default_locale_path directory doesnt exists, create a directory self.default_locale_path. call the function glob.glob with an argument: string '/*' appended to self.default_locale_path converted into a string, filter out the results for which function os.path.isdir returns false, substitute the result for locale_dirs. map the locale_dirs elements with mapping function os.path.basename, substitute the result for all_locales. if process_all is true, substitute all_locales for locales. if not, if locale is not false or None, substitute it for locales, otherwise substitute all_locales for locales. locales is a difference between the locales and exclude sets. if locales is true, call the function check_programs with 3 arguments: strings 'msguniq', 'msgmerge' and 'msgattrib'. call the function check_programs with an argument string 'xgettext'. try, call the method self.build_potfiles, substitute the result for potfiles. for every locale in locales, if self.verbosity is greater than integer 0, replace '%s' in string "processing locale %s\n" with locale, write it to self.stdout. for every potfile in potfiles, call the method self.write_po_file with 2 arguments: potfile and locale. finally perform, if self.keep_pot is false, call the method self.remove_potfiles. define the method build_potfiles with an argument self. call the method self.find_files with an argument string '.', substitute the result for file_list. call the method self.remove_potfiles. for f in file_list, try, call the function f.process with 2 arguments: self and self.domain. if except UnicodeDecodeError exception is caught, substitute '%s' in string "UnicodeDecodeError: skipped file %s in %s" with f.file and f.dirpath, write it to self.stdout. potfiles is an empty list. for every path in self.locale_paths, join into a path: path and string '%s.pot', where '%s' is replaced with self.domain converted into a string. if potfile file path doesnt exist, skip this loop iteration. append self.msguniq_options to a list containing a string 'msguniq', append list containing potfile to the result, substitute it for args. call the function popen_wrapper with an argument args, assign the result to msgs, errors and status, respectively. if six.PY2 is true, call the method msgs.decode with an argument string 'utf-8', substitute it for msgs. if errors is true, if status is not equal to STATUS_OK, raise an CommandError exception with an argument string "errors happened while running msguniq\n%s", where '%s' is replaced with errors. otherwise if self.verbosity is greater than integer 0, write errors to self.stdout. call the function io.open with 3 arguments: potfile, string 'w' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: write msgs to fp. append potfile to potfiles. return potfiles. define the method remove_potfiles with an argument self. for every path in self.locale_paths, join into a file path: path and string '%s.pot', where '%s' is replaced with self.domain converted into a string, substitute the result for pot_path. if pot_path file path exists, call the method os.unlink with an argument pot_path. define the method find_potfiles with an arguments self and root. define the function is_ignored with arguments path and ignore_patterns. call the function os.path.basename with an arguments path, substitute the result for filename. ignore is a lambda function with pattern as an argument, return value is the return value of the function fnmatch.fnmatchcase, called with arguments: filename and pattern. call the function ignore with an argument pattern, for every pattern in ignore_patterns, if any resulting element is true, return boolean True, otherwise return boolean False. convert os.sep into a string and append '*' to it, substitute the result for dir_suffix. for p in self.ignore_patterns if p ends with dir_suffix take sliced list p from the start, to the negative length of the dir_suffix as the end index and append it to a list, if p doesnt end with dir_suffix, append p to a list, substitute resulting list for norm_patterns. all_files is an empty list. call the function os.walk with 3 arguments: root, topdown set to boolean True, followlinks set to self.symlinks, for every dirpath, dirnames and filenames in the result, for every dirname in list dirnames, join dirpath and dirname into a file path, use is as an argument for the call to the function os.path.join, use the result as an argument for the call to the os.path.join function, use the result and the norm_patterns as arguments for the call to the is_ignored function, if it evaluates to true, remove dirname from the dirnames. if self.verbosity is greater than integer 1, replace '%s' in string 'ignoring directory %s\n' with dirname, write it to self.stdout stream. otherwise if dirname equals string 'locale', remove dirname from the dirnames. call the method os.path.abspath with an argument dirpath, join the result and dirname into a file path, inset it at the beggining of self.locale_paths. for every filename in filenames, join dirpath and filename into path, use it as an argument for the call to the function os.path.normpath, substitute it for file_path. call the function is_ignored, with arguments: file_path and self.ignore_patterns, if it evaluates to true, if self.verbosity is greater than integer 1, replace '%s' in string 'ignoring file %s in %s\n' with filename and dirpath, write it to self.stdout. if not, locale_dir is None. for every path in self.locale_paths, call the function os.path.abspath with an argument dirpath, if it starts with return value of the method os.path.dirname, called with an argument path, substitute path for locale_dir. break the loop execution. if locale_dir is false, substitute self.default_locale_path for locale_dir. if locale_dir is false, raise an CommandError with an argument string "Unable to find a locale path to store translations for file %s", where '%s' is replaced with file_path. create an object TranslatableFile with arguments: dirpath, filename and locale_dir, append it to all_files. sort all_files and return it. define the method write_po_file with arguments self, potfile and locale. call the method os.path.dirname with an argument potfile, join the result, locale and string 'LC_MESSAGES' into a file path, substitute it for basedir. if basedir is not a directory, make basedir directory, convert self.domain into a string and append string '.po' to it, join basedir and result in file path, substitute it for pofile. if pofile path exists, append self.msgmerge_options to a list containing string 'msgmerge', append to it a list containing pofile and potfile, substitute the result for args. call the function popen_wrapper with an argument args, assign the result to msgs, errors and status. if six.PY2 is true, call the method msgs.decode with an argument string 'utf-8', substitute the result for msgs. if errors is true, if statue is not equal to STATUS_OK. raise an CommandError with an argument string "errors happened while running msgmerge\n%s", where '%s' is replaced with errors. otherwise if self.verbosity is greater than integer 0, write errors to self.stdout. if not, call the function io.open with 3 arguments: potfile, string 'r' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: read file fp and substitute the result for msgs. if self.invoked_for_django is false, call the method self.copy_plural_forms with arguments: msgs and locale, substitute it for msgs. substitute '%s' in string "#. #-#-#-#-# %s.pot (PACKAGE VERSION) #-#-#-#-#\n" with self.domain, replace all the occurrences of previous string in msgs for an empty string, substitute the result for msgs. call the function io.open with 3 arguments: pofile, string 'w' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: write msgs to fp. if self.no_obsolete is true, append self.msgattrib_options to a list containing string 'msgattrib', append to it a list containing string '-o', pofile and pofile, substitute the result for args. call the function popen_wrapper with an argument args, assign the result to msgs, errors and status, respectively. if errors is true, if status is not equal to STATUS_OK, raise an CommandError with an argument string "errors happened while running msgattrib\n%s", where '%s' is replaced with errors. otherwise if self.verbosity is greater than integer 0, write errors to self.stdout. define the method copy_plural_forms with arguments self, msgs and locale. call the function os.path.dirname with an argument django.__file__, join the result into a path, use it as an argument for the call to the function os.path.normpath, substitute the result for django_dir. if self.domain equals a string 'djangojs', domains is a tuple with 2 elements: strings 'djangojs' and 'django'. if not, domains is a tuple with element string 'django'. for every domain in domains, join into a file path: django_dir, 'conf', 'locale', locale, 'LC_MESSAGES' and string '.po' appended to domain, substitute the result for django_po. if django_po file path exists, call the function io.open with 3 arguments: django_po, string 'r' and encoding set to string 'utf-8' as arguments, with the result renamed to fp, perform the following: read data from file fp, use the result as an argument for the call to the function plural_forms_re.search, substitute it for m. if m is true, call the method m.group with an argument string 'value', use the result as an argument for the call to the force_str, substitute the result for plural_form_line. if self.verbosity is greater than integer 1, replace '%s' in string "copying plural forms: %s\n" with plural_form_line, write it to self.stdout. lines is an empty list. found is boolean False. split msgs by newline characters, for every line in result, if found is false and, line is false or return value of the function plural_forms_re.search called with an argument line is false, append newline to plural_form_line, substitute the result for line. found is boolean True. append line to lines. join elements of lines into a string, separated by newline characters, substitute it for msgs. break the loop execution. return msgs. import module sys. import module os. import module operator. from django.apps import apps into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.db.migrations import Migration into default name space. from django.db.migrations.loader import MigrationLoader into default name space. from django.db.migrations.autodetector import MigrationAutodetector into default name space. from django.db.migrations.questioner import MigrationQuestioner and InteractiveMigrationQuestioner into default name space. from django.db.migrations.state import ProjectState into default name space. from django.db.migrations.writer import MigrationWriter into default name space. from django.utils.six.moves import reduce into default name space. derive the class Command from the BaseCommand class. help is a string "Creates new migration(s) for apps.". define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'app_label', nargs set to character'*', and help as a string 'Specify the app label(s) to create migrations for.'. call the method parser.add_argument with 5 arguments: string '--dry-run', action as a string 'store_true', dest as string 'dry_run', default set to boolean False, help as a string "Just show what migrations would be made; don't actually write them.". call the method parser.add_argument with 5 arguments: string '--merge', action as a string 'store_true', dest as a string 'merge', default set to boolean False and help set to a string "Enable fixing of migration conflicts.". call the method parser.add_argument with 5 arguments: string '--empty', action as a string 'store_true', dest as a string 'empty', default set to boolean False and help as a string "Create an empty migration.". call the method parser.add_argument with 5 arguments: string '--noinput', action as a string 'store_false', dest as a string 'interactive', default set to boolean True, and help as a string 'Tells Django to NOT prompt the user for input of any kind.'. define the method handle with 3 arguments: self, unpacked list app_labels and unpacked dictionary options. get the value under the 'verbosity' key of the options dictionary, substitute it for self.verbosity. get the value under the 'interactive' key of the options dictionary, substitute it for self.interactive. get the value under the 'dry_run' key of the options dictionary, if the key exists substitute it for self.dry_run, if not, self.dry_run is boolean False. get the value under the 'merge' key of the options dictionary, if the key exists substitute it for self.merge, if not, self.merge is boolean False. get the value under the 'empty' key of the options dictionary, if the key exists substitute it for self.empty, if not, self.empty is boolean False. crate a set containing of app_labels elements, substitute it for app_labels. bad_app_labels is an empty set. for every app_label in app_labels, try, call the method apps.get_app_config with an argument app_label. if LookupError exception is caught, call the method bad_app_labels with an argument app_label, if bad_app_labels is true, for every app_label in bad_app_labels, write string "App '%s' could not be found. Is it in INSTALLED_APPS?" with '%s' where '%s' is replaced with app_label, write it for self.stderr. exit the program with the integer 2 as exit code. loader is an instance of MigrationLoader class, created with 2 arguments: None and ignore_no_migrations set to boolean True. call the method loader.detect_conflicts, substitute the result for conflicts. if conflicts is true and self.merge is false, for every app and names in result of the method conflicts.items, join names into a string, separated by ', ', join it with app into a string, separated with string '; ', substitute it for name_str. substitute '%s\ in string "Conflicting migrations detected (%s).\nTo fix them run 'python manage.py makemigrations --merge'", with name_str, use it as an argument to throw an CommandError exception. if self.merge is true and conflicts is false, write string "No conflicts detected to merge." to self.stdout stream. return nothing. if self.merge and conflicts are both true, call the method self.handle_merge with 2 arguments: loader and conflicts, return the result. autodetector is an instance of the MigrationAutodetector class, created with 3 arguments: result of the method loader.project_state, result of the method ProjectState.from_apps with an argument apps and result of the method InteractiveMigrationQuestioner, called with 2 arguments specified_apps set to app_labels and dry_run set to self.dry_run. if self.empty is true, if app_labels is false, raise an CommandError with an argument string "You must supply at least one app label when using --empty.". crate a dictionary with app mapping and from the class Migration, created with arguments: string 'custom' and app, for every app in app_labels. call the method autodetector.arrange_for_graph with 2 arguments: changes, loader.graph, substitute the result for changes. call the method self.write_migration_files with an argument changes. return nothing. call the method autodetector.changes with 3 arguments: graph set to loader.graph, trim_to_apps set to app_labels, if it exists or None if not and convert_apps set to app_labels, if it exists or None if not, substitute the result for changes. if changes is false and self.verbosity is greater than, or equal to iteger 1, if length of app_labels is equal to integer 1, substitute '%s' in string "No changes detected in app '%s'" with the result of the method app_labels.pop, write it to self.stdout. otherwise if length of app_labels is greater than integer 1, substitute '%s' in string "No changes detected in apps '%s'" with the app_labels joined into a string, separated by string "', '", write it to self.stdout. if not, write string "No changes detected" to self.stdout stream. return nothing. call the method self.write_migration_files with an argument changes. define the method write_migration_files with arguments self and changes. directory_created is an empty dictionary. for every app_label and app_migrations in result of the method changes.items, if self.verbosity is greater or equal to integer 1, substitute '%s' in a string "Migrations for '%s':" with app_label, append newline to it, use it as an argument for the call to the method self.style.MIGRATE_HEADING, write the result to self.stdout. for every migration in app_migrations, writer is an instance of MigrationWriter class, created with an argument migration. if self.verbosity is greater or equal to integer 1, substitute '%s' in a string " %s:\n" with return value of the self.style.MIGRATE_LABEL method called with argument writer.filename, write the result to self.stdout. for every operation in migration.operations, substitute '%s' in a string " - %s\n" with return value of the operation.describe method, write the result to self.stdout. if self.dry_run is false, call the function os.path.dirname with an argument writer.path, substitute the result for migrations_directory. get the value under the app_label key of the directory_created dictionary, if exists and it is false, if migrations_directory is not a directory, make a directory migrations_directory. join migrations_directory and string "__init__.py" into a file path, substitute it for init_path. if init_path is not a file, crate a file named init_path. value under the all_label key of the directory_created dictionary is boolean True. call the method writer.as_string, substitute the result for migration_string. open writer.path file in write mode, with the file descriptor as fh, perform, write migration_string to file fh. otherwise if self.verbosity equals integer 3, substitute '%s' in a string "Full migrations file '%s':" with writer.filename, append newline to it, use it as an argument for the call to the method self.style.MIGRATE_HEADING, write the result to self.stdout. call the method writer.as_string, append newline to the result, write it to self.stdout. define the method handle_merge with arguments self, loader and conflicts. if self.interactive is true, questioner is an instance of a InteractiveMigrationQuestioner class. if not, questioner is an instance of a InteractiveMigrationQuestioner class, created with an argument: defaults set to dictionary with entry: boolean True for 'ask_merge'. for every app_label and migration_names in result of the method conflicts.items, merge_migrations is an empty list. for every migration_name in migration_names, call the method loader.get_migration with arguments app_label and migration_name, substitute the result for migration. call the method loader.graph.forwards_plan with argument a tuple, with 2 elements: app_label and migration_name, substitute the result for migration.ancestry. append migration to merge_migrations. common_ancestor is None. for m in merge_migrations append m.ancestry to a list, zip the resulting list into tuples of pairs, for every level in result, apply operator.eq function to elements of level iterable, until level is reduced to a single value, if the result is true, substitute first element of level for common_ancestor. if not, break the loop execution, if common_ancestor is None, raise an ValueError with an argument string "Could not find common ancestor of %s", where '%s' is replaced with migration_names. for every migration in merge_migrations, call the method migration.ancestry.index with an argument common_ancestor, increment the result by one, slice migration.ancestry list from the last result as an starting index to the end, substitute the slice for migration.branch. migration.merged_operations is an empty list. for every node_app and node_name in migration.branch, call the method loader.get_migration with arguments node_app and node_name, extend the migration.merged_operations with the operations field of the result. if self.verbosity is greater than integer 1, substitute '%s' in a string "Merging %s" with app_label, use it as an argument for the call to the method self.style.MIGRATE_HEADING, write the result to self.stdout. for every migration in merge_migrations, substitute '%s' in a string " Branch %s" with migration.name, use it as an argument for the call to the method self.style.MIGRATE_HEADING, write the result to self.stdout. for every operation in migration.merged_operations, substitute '%s' in a string " - %s\n" with return value of the operation.describe method, write the result to self.stdout. call the method questioner.ask_merge with an argument app_label, if it evaluates to true, numbers is a list containing return value of the MigrationAutodetector.parse_number method called with an argument migration.name, for every migration in merge_migrations. try, biggest_number is maximum numbers element. if ValueError exception is caught, biggest_number is integer 1. subclass is a instance of a class named Migration, derived from the base class Migration, with 1 field: dependencies set to a list of tuples with 2 elements: app_label and migration.name for every migration in merge_migrations. call the method subsclass with 2 arguments: string "%04i_merge", replace '%04i' with biggest_number incremented by one, that occupies minimum 4 places within a string, and app_label, substitute the result for new_migration. writer is instance of MigrationWriter class, created with new_migration argument. open writer.path file in write mode, with the file descriptor as fh, perform the following, call the method writer.as_string, write the result to fh file. if self.verbosity is greater than integer 0, substitute '%s' in a string "\nCreated new merge migration %s" with writer path, write it to self.stdout. from __future__ import unicode_literals into default name space. from collections import OrderedDict into default name space. from importlib import import_module into default name space. import module itertools. import module traceback. from django.apps import apps into default name space. from django.core.management import call_command into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.management.color import no_style into default name space. from django.core.management.sql import custom_sql_for_model, emit_post_migrate_signal and emit_pre_migrate_signal into default name space. from django.db import connections, router, transaction and DEFAULT_DB_ALIAS into default name space. from django.db.migrations.executor import MigrationExecutor into default name space. from django.db.migrations.loader import MigrationLoader and AmbiguityError into default name space. from django.db.migrations.state import ProjectState into default name space. from django.db.migrations.autodetector import MigrationAutodetector into default name space. from django.utils.module_loading import module_has_submodule into default name space. derive the class Command from the base class BaseCommand. help is a string "Updates database schema. Manages both apps with migrations and those without.". define the method add_arguments with self class instance and parse as the arguments. call the method parser.add_argument with string 'app_label', nargs set to charcter '?', help containing string, 'App label of an application to synchronize the state.' as arguments. call the method parser.add_argument with string 'migration_name', nargs set to charcter '?', help containing string, 'Database state will be brought to the state after that migration.' as arguments. call the method parser.add_argument with string '--noinput', action containing string 'store_false', dest set to string 'interactive', default set to True, help containing string 'Tells Django to NOT prompt the user for input of any kind.' as arguments. call the method parser.add_argument with string '--no-initial-data', action containing string 'store_false', dest set to string 'load_initial_data', default set to True, help containing string 'Tells Django not to load any initial data after database synchronization.' as arguments. call the method parser.add_argument with string '--database', action containing string 'store', dest set to string 'database', default set to DEFAULT_DB_ALIAS, help containing string 'Nominates a database to synchronize. Defaults to the "default" database.' as arguments. call the method parser.add_argument with string '--fake', action containing string 'store_true', dest set to string 'fake', default set to False, help containing string 'Mark migrations as run without actually running them' as arguments. call the method parser.add_argument with string '--list', string '-l', action contains string 'store_true', dest set to string 'list', default set to False, help containing string 'Show a list of all known migrations and which are applied' as arguments. define the method handle with self instance of a class, list args, dictionary options as arguments. get the value from the options dictionary under the key 'verbosity', substitute it for self.verbosity. get the value from the options dictionary under the key 'interactive', substitute it for self.interactive. get the value from the options dictionary under the key 'traceback', substitute it for self.show_traceback. get the value from the options dictionary under the key 'load_initial_data', substitute it for self.load_initial_data. get the value from the options dictionary under the key 'test_database', or False if the key dont exists, substitute it for self.test_database. for every app_config in return value of the call to the function apps.get_app_configs, if call to the function module_has_submodule with app_config.module and "management" evaluates to True. import module '.management' from the package app_config.name. get the value under the key 'database' of the options dictionary, substitute it for db. substitute connections element at the index of the value db for connections. get the value under the 'list' key of options dictionary, if key doesnt exist return False, if the return value is True, call the method self.show_migration_list with connection as first argument, as second argument use value under the 'app_label' key of options dictionary, if exists, if not use None as the second argument, return the result. call the function MigrationExecutor with connection and self.migration_progress_callback as arguments, substitute the result fro executor. call the executor.loader.detect_conflicts, substitute the result fr conflicts. if conflicts is true, for every app and names in key, value tuple pairs of conflicts dictionary join names into a string separated by commas, in "%s in %s" substitute '%s' with names string and app, respective, join all the previous pairs into a string separated by ';', substitute it for name_str. raise CommandError exception, with "Conflicting migrations detected (%s).\nTo fix them run 'python manage.py makemigrations --merge'", with '%s' substituted for name_str, as argument. run_syncdb is boolean False. target_app_labels_only is boolean True. if values under the 'app_label' and 'migration_name' keys of the options dictionary are True, assign values under the 'app_label' and 'migration_name' keys of the options dictionary to the app_label and migration_name, respectively. if app_label is not contained in executor.loader.migrated_apps, raise CommandError exception with "App '%s' does not have migrations (you cannot selectively sync unmigrated apps)", with '%s' substituted for app_label, as arguments. if migration_name equals to string 'zero', targets is a list containing tuple with two elements, app_label and None. if not, try, call the executor.loader.get_migration_by_prefix with app_label and migration_name, substitute the result for migration. if AmbiguityError exception is caught, raise CommandError exception with "More than one migration matches '%s' in app '%s'. Please be more specific.", with '%s' substituted for migration_name and app_label, respectively, as arguments. if KeyError exception is caught, raise CommandError exception with "Cannot find a migration matching '%s' from app '%s'.", with '%s' substituted for migration_name and app_label, respectively, as arguments. targets is a list containing tuple with two elements, app_label and migration.name. target_app_labels_only is boolean False. otherwise if value under the 'app_label' key of options dictionary is true, substitute the value under the 'app_label' key of options dictionary for app_label. if app_label is not contained in executor.loader.migrated_apps, raise CommandError exception with "App '%s' does not have migrations (you cannot selectively sync unmigrated apps)", with '%s' substituted for app_label, as arguments. for every key in return vale of the method executor.loader.graph.leaf_nodes, check if the first element of key equals to app_label, if it does append it to targets list. if not, call the method executor.loader.graph.leaf_nodes and substitute its result for targets. run_syncdb is boolean True. call the executor.migration_plan method with targets as the argument, substitute the result for plan. if self.verbosity is greater or equal to integer 1. call the self.style.MIGRATE_HEADING method, with string "Operations to perform:" as an argument, use the result as an argument for the call to the self.stdout.write method. if run_syncdb and executor.loader.unmigrated_apps exist, join the executor.loader.unmigrated_apps into a string separated by string ', ' append it to the end of a string " Synchronize unmigrated apps: ", use it as an argument for the call to the self.style.MIGRATE_LABEL method, use the result of the previous method as an argument for the call to the self.stdout.write method. if target_app_labels_only is true, for every a and n in targets, put a into a set, join all the set elements into a string separated by string ', ', if set is empty return string '(none)' instead, append the previous to the string " Apply all migrations: ", use the previous string as the argument for the call to the method self.style.MIGRATE_LABEL, use the result as an argument for the call to the method self.stdout.write. if not, if element of targets in first row and second column is None, convert the first element of the first row of targets to string, append it to the string " Unapply all migrations: ", use the it as an argument for the call to the self.style.MIGRATE_LABEL method, use the result to cal the self.stdout.write method. if not, replace '%s' in string "%s, from %s" with second and first element of the first targets row, respectively, append it to the string " Target specific migration: ", use it as the argument for the call to the self.style.MIGRATE_LABEL method, call the self.stdout.write method with previous return value as an argument. if run_syncdb and executor.loader.unmigrated_apps is true, if self.verbosity is greater or equal to integer 1. call the self.style.MIGRATE_HEADING with string "Synchronizing apps without migrations:" as an argument, use the result as an argument for the call to the self.stdout.write. call the self.sync_apps method with connection and executor.loader.unmigrated_apps as arguments, substitute it for created_models. if not, create_models is an empty list. if the value under the 'test_flush' key of the options dictionary exists, call the function call_command with string 'flush', verbosity set to greater element, self.verbosity decremented by 1 or integer 0, interactive set to boolean False, database set to db, reset_sequences set to boolean False, inhibit_post_migrate set to boolean True. if self.verbosity is greater or equal to integer 1, call the self.style.MIGRATE_HEADING method with string "Running migrations:" as an argument, use the result as an argument for the call to the self.stdout.write method. if plan is not true, if self.verbosity is greater or equal to integer 1, call the method self.stdout.write with string " No migrations to apply." as an argument. call the MigrationAutodetector function with arguments, return value of the call to the method executor.loader.project_state, and return value of the call to the method ProjectState.from_apps with apps as an argument, assign it to the autodetector. call the method autodetector.changes with the graph set to executor.loader.graph as an argument, substitute it for the changes. if changes is true, call the method self.style.NOTICE with string " Your models have changes that are not yet reflected in a migration, and so won't be applied." as an argument, use the result as an argument for the call to the self.stdout.write method. call the method self.style.NOTICE with string " Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them." as an argument, use the result as an argument for the call to the self.stdout.write method. if not, call the executor.migrate method with, targets, plan and fake set to the value under the 'fake' key of options dictionary, if the 'fake' key doesnt exists set fake to boolean False, as arguments. call the method emit_post_migrate_signal with created_models, self.verbosity, self.interactive and connection.alias as arguments. define the method migration_progress_callback with self class instance, action, migration and fake set to boolean False as arguments. if self.verbosity is greater or equal to integer 1, if action equals to string "apply_start", call the self.stdout.write method, with string " Applying %s..." with '%s' replaced with migration and ending set to '', as arguments. flush the output buffer of the self.stdout object. otherwise if action equals to string 'apply_success', if fake is true, wrte to the standard output result of the call to the method self.style.MIGRATE_SUCCESS with string " FAKED" as a argument. if not, wrte to the standard output result of the call to the method self.style.MIGRATE_SUCCESS with string " OK" as a argument. otherwise if action equals to string 'unapply_start'. call the self.stdout.write method, with string " Unapplying %s..." with '%s' replaced with migration and ending set to '', as arguments. flush the output buffer of the self.stdout object. otherwise if action equals to string "unapply_success". if fake is true, wrte to the standard output result of the call to the method self.style.MIGRATE_SUCCESS with string " FAKED" as a argument. if not, wrte to the standard output result of the call to the method self.style.MIGRATE_SUCCESS with string " OK" as a argument. define the method sync_apps with self class instance, connection and app_labels as arguments. call the connection.cursor method, substitute the result for cursor. try, call the connection.introspection.table_names with cursor as argument, store the result in tables. call the connection.introspection.table_names with tables as argument, store the result in seen_models. created_models is a set. pending_references is a empty dictionary. for every app_config in return value of the method apps.get_app_configs if app_config.models_module is not None, and app_config.label is contained in app_labels, create a tuple containing app_config.label and return value of the method router.get_migratable_models called with app_config, connection.alias and include_auto_created set to True, append the tuple to the list all_models. define the method model_installed with model as an argument. substitute model._meta for opts. substitute connection.introspection.table_name_converter for converter. evaluate next boolean expression, value of converter function with opts.db_table as argument is contained in tables, or opts.auto_created is True and return value of converter function with opts.auto_created._meta.db_table is contained in tables, invert the evaluated expression and return it. manifest is OrderDict class instance, created with tuple of two elements, app_name and list of elements of model_list for which model_installed function returned true, for every app_name and model_list in all_modules. unpack the manifest.values function return value and feed it to the itertools.chain function, create_models is a set containing chanied list. call the emit_pre_migrate_signal with create_models, self.verbosity, self.interactive. connection.alias as arguments. if self.verbosity is greater or equal than integer 1, write the string " Creating tables...\n" to the standard output. with the call to the transaction.atomic method with using set to connection.alias, savepoint set to connection.features.can_rollback_ddl as arguments, for every app_name and model_list in return value of manifest.items function, for every model in model_list, if self.verbosity is greater or equal to 3, call the self.stdout.write method with string " Processing %s.%s model\n" as argument, with all occurrences of '%s' replaced with, app_name and model._meta.object_name, respectively. evaluate connection.creation.sql_create_model method with model, no_style() and seen_models as arguments, assign the result to the sql and references, respectively. add model to seen_models set. add model to created_models set. for every refto and refs in return value of references.items method. call the method extend with refs as argument, on the result call the pending_references.setdefault method with refto and empty list as arguments. if refto is contained in seen_models, call the connection.creation.sql_for_pending_references method with refto, no_style() and pending_references as arguments, use the result as the argument for the call to the sql.extend method. call the connection.creation.sql_for_pending_references method with refto, no_style() and pending_references as arguments, use the result as the argument for the call to the sql.extend method. if self.verbosity is greater or equal than integer 1 and sql is true, call the self.stdout.write method with string " Creating table %s\n" as argument, with all occurrences of '%s' replaced with model._meta.db_table. for statements is sql, call the cursor.execute method with statement as argument. evaluate the method connection.introspection.table_name_converter with model._meta.db_table as argument, append it to tables. finally, perform, call the cursor.close method. call the connection.cursor method, substitute it for cursor. try, if self.verbosity is greater or equal than integer 1, write the string " Installing custom SQL...\n" to the standard output. for every app_name and mode_list in return value of manifest.items method, for model in model_list, if model is contained in created_models, call the method custom_sql_for_model with model, no_style() and connection as arguments, substitute the result for custom_sql. if custom_sql is empty, if self.verbosity is greater or equal to integer 2, call the self.stdout.write method with string " Installing custom SQL for %s.%s model\n" as argument, with all occurrences of '%s' replaced with app_name and model._meta.object_name, respectively. try, with call to the function transaction.atomic with using set to connection.alias as argument, for every sql in custom_sql, call the cursor.execute method with sql as argument. if exception of class Exception, as e, is caught, call the self.stderr.write method with string " Failed to install custom SQL for %s.%s model: %s\n" as argument, with all occurrences of '%s' replaced with app_name and model._meta.object_name and e, respectively. if self.show_traceback is true, call the traceback.print_exc method. if not, if self.verbosity is greater or equal to integer 3, call the self.stderr.write method with string " No custom SQL for %s.%s model\n" as argument, with all occurrences of '%s' replaced with app_name and model._meta.object_name, respectively. if self.verbosity is greater or equal to integer 1, write string " Installing indexes...\n" to the standard output. for every app_name and model_list in return value of manifest.items method, for every model in model_list, if model is contained in created_models, call the connection.creation.sql_indexes_for_model with model and no_style() as arguments, substitute the result for index_squl. if index_sql is not empty, if self.verbosity is greater or equal to integer 2, call the self.stderr.write method with string " Installing index for %s.%s model\n" as argument, with all occurrences of '%s' replaced with app_name and model._meta.object_name, respectively. try, with call to the function transaction.atomic with using set to connection.alias and savepoint set to connection.features.can_rollback_ddl, as arguments. for every sql in index_sql, call the method cursor.execute with sql as argument. if exception of the class Exception, as e, is caught, call the self.stderr.write method with string " Failed to install index for %s.%s model: %s\n" as argument, with all occurrences of '%s' replaced with app_name and model._meta.object_name and e, respectively. finally perform, call the cursor.close method. if self.load_initial_data is not empty, for every app_label in app_labels, call the method call_command with string 'loaddata', string 'initial_data', verbosity set to self.verbosity, database set to connection.alias, skip_validation set to boolean True, app_label set to app_label and hide_empty set to boolean True. return created_models define show_migration_list with self class instance, connection and app_names set to None, as arguments. loader is instance of MigrationLoader initialized with connection as an argument. substitute loader.graph for graph. if app_names is not empty, invalid_apps is an empty list. for every app_name is app_names, if app_name is not contained in loader.migrated_apps, append app_name to the invalid_apps. if invalid_apps in not empty, raise a CommandError exception, with string "No migrations present for: %s" as argument, substitute '%s' in previous string with, string joined from invalided_apps list and separated with string ', '. if not, sort loader.migrated_apps, substitute it for app_names. for every app_name in app_names. call self.stdout.write method with app_name and self.style.MIGRATE_LABEL as arguments. shown is an empty set. for every node in return value of the graph.leaf_nodes method called with the app_name argument, for every plan_node in return value of the graph.forwards_plan method called with node as argument. if plan_node is not contained in shown and first element of plan_node equals to app_name, substitute second element of plan_node for title. if replaces filed of graph.nodes element at the plan_node index is true, substitute '%s' in the string " (%s squashed migrations)" with length of replaces filed of graph.nodes element at the plan_node index, append the string to the title. if plan_node is contained in loader.applied_migrations, substitute '%s' with title in the string " [X] %s", write it to the standard output. if not, substitute '%s' with title in the string " [ ] %s", write it to the standard output. add plan_node to the shown set. if shown is an empty set, call the self.stdout.write method with string " (no migrations)" and self.style.MIGRATE_FAILURE as arguments. import module argparse. import module warnings. from django.core.management.base import BaseCommand into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. derive the class Command from the BaseCommand class. help is a string "Runs this project as a FastCGI application. Requires flup.". define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 3 arguments: string 'args', nargs set to argparse.REMAINDER and help as a string 'Various KEY=val options.' define the method handle with 3 arguments: self, unpacked list args and unpacked dictionary options. call the method warnings.warn with 2 arguments: string "FastCGI support has been deprecated and will be removed in Django 1.9.", and RemovedInDjango19Warning. from django.conf import settings into default namespace. from django.utils import translation into default namespace. try, call the method translation.activate with an argument settings.LANGUAGE_CODE. if AttributeError exception is caught, do nothing. from django.core.servers.fastcgi import runfastcgi into default namespace. call the function runfastcgi with an argument args. define the method usage with 2 argument: self and subcommand. from django.core.servers.fastcgi import FASTCGI_HELP into default namespace. return FASTCGI_HELP. from __future__ import unicode_literals into default name space. from datetime import datetime into default name space. import module errno. import module os. import module re. import module sys. import module socket. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.servers.basehttp import run and get_internal_wsgi_application into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. from django.db.migrations.executor import MigrationExecutor into default name space. from django.utils import autoreload into default name space. from django.utils import six into default name space. from django.core.exceptions import ImproperlyConfigured into default name space. call the method re.compile with 2 arguments: raw string """^(?: (?P (?P\d{1,3}(?:\.\d{1,3}){3}) |""" """(?P\[[a-fA-F0-9:]+\]) | (?P[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*) ):)?(?P\d+)$""", re.X DEFAULT_PORT is a string "8000". derive the class Command from the BaseCommand class. help is a string "Starts a lightweight Web server for development.". requires_system_checks is boolean False. define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 3 arguments: string 'addrport', nargs='?' and help as a string 'Optional port number, or ipaddr:port'. call the method parser.add_argument with 6 arguments: string '--ipv6', string '-6', action set to string 'store_true', dest set to string 'use_ipv6', default set to boolean False and help set to string 'Tells Django to use an IPv6 address.'. call the method parser.add_argument with 5 arguments: string '--nothreading', action set to string 'store_false', dest set to string 'use_threading', default set to boolean True and help set to 'Tells Django to NOT use threading.'. call the method parser.add_argument with 5 arguments: string '--noreload', action set to string 'store_false', dest set to string 'use_reloader', default set to boolean True and help is a string 'Tells Django to NOT use the auto-reloader.'. def get_handler with 3 arguments: self, unpacked list args and unpacked dictionary options. call the function get_internal_wsgi_application, return the result. define the method handle with 3 arguments: self, unpacked list args and unpacked dictionary options. from django.conf import settings into default namespace. if not settings.DEBUG is true and settings.ALLOWED_HOSTS is false, raise an CommandError exception with an argument string 'You must set settings.ALLOWED_HOSTS if DEBUG is False.'. substitute value under the 'use_ipv6' key of the options dictionary for self.use_ipv6. if self.use_ipv6 is true and socket.has_ipv6 is false, raise an CommandError exception with an argument string 'Your Python does not support IPv6.'. self._raw_ipv6 is boolean False. get the value under the 'addrport' key of the options dictionary, if it is false, self.addr is an empty string. substitute DEFAULT_PORT for self.port. if not, call the method re.match with 2 arguments: naiveip_re and value under the 'addrport' key of the options dictionary, substitute the result for m. if m is None, raise an CommandError exception with an argument string '"%s" is not a valid port number or address:port pair.', where '%s' is replaced with value under the 'addrport' key of the options dictionary. call the method m.groups, assign the result to self.addr, _ipv4, _ipv6, _fqdn and self.port, respectively. call the method self.port.isdigit, if it evaluates to false, raise an CommandError exception with an argument string "%r is not a valid port number.", where '%r' is repaced with self.port. if self.addr is true, if _ipv6 is true, substitute self.addr without the first and last element for self.addr. self.use_ipv6 is boolean True. self._raw_ipv6 is boolean True. otherwise if self.use_ipv6 is true and _fqdn is false, raise an CommandError exception with an argument string '"%s" is not a valid IPv6 address.' where '%s' is replaced with self.addr. if self.addr is false, if self.use_ipv6 substitute string '::1' for self.addr, if not substitute '127.0.0.1' for self.addr. convert self.use_ipv6 to boolean, substitute it for self._raw_ipv6. call the self.run method with unpacked dictionary options as an argument. define the method run with 3 arguments: self and unpacked dictionary options. substitute value under the 'use_reloader' key of the options dictionary for use_reloader. if use_reloader is true, call the method autoreload.main with 3 arguments: self.inner_run, None and options. if not, call the method self.inner_run with 2 arguments: None and unpacked dictionary options. define the method inner_run with 3 arguments: self, unpacked list args and unpacked dictionary options. from django.conf import settings into default namespace. django.utils import translation into default namespace. substitute value under the 'use_threading' key of the options dictionary for threading. get the value under the 'shutdown_message' key of the options dictionary, if it exists substitute it for shutdown_message, if not, shutdown_message is an empty string. if sys.platform equals string win32', substitute string 'CTRL-BREAK' for quit_command, if not substitute string 'CONTROL-C' for quit_command. write string "Performing system checks...\n\n" to self.stdout stream. call the method self.validate with an argument display_num_errors set to boolean True. try, call the method self.check_migrations. if ImproperlyConfigured exception is caught, do nothing. call the function datetime.now, on the result call the method strftime with an argument string '%B %d, %Y - %X', substitute the result for now. if six.PY2 is true, call the method now.decode with an argument string 'utf-8', substitute the result for now. call the method self.stdout.write with an argument: string "%(started_at)s\nDjango version %(version)s, using settings %(settings)r\n" "Starting development server at http://%(addr)s:%(port)s/\n Quit the server with %(quit_command)s.\n", where '"%(started_at)s' is replaced with now, '%(version)s' is replaced with return value of the method self.get_version, '%(settings)r' is replaced with settings.SETTINGS_MODULE, '%(addr)s' is replaced with self.addr if self._raw_ipv6 is true, or with self.addr if it is false, '%(port)s' is replaced with self.port and '%(quit_command)s' is replaced with quit_command. call the method translation.activate with an argument settings.LANGUAGE_CODE. try, call the method self.get_handler with 2 arguments unpacked list args and unpacked dictionary options, substitute the result for handler. call the function run with 5 arguments: self.addr, self.port converted to an integer, handler, ipv6 set to self.use_ipv6, and threading set to threading. if socket.error, renamed to e, exception is caught, ERRORS is a dictionary with 3 initial entries: string "You don't have permission to access that port." for errno.EACCES, "That port is already in use." for errno.EADDRINUSE and "That IP address can't be assigned-to." for errno.EADDRNOTAVAIL. try, get the value under the e.errno key of the ERRORS dictionary, substitute it for error_text. if KeyError exception is caught. convert e to a string, substitute it for error_text. replace '%s' in a string "Error: %s" with error_text, write it to self.stderr. exit the program with the code integer 1. if KeyboardInterrupt exception is caught, if shutdown_message is true, write shutdown_message to self.stdout file stream. exit program with code integer 0. define the method check_migrations with an argument self. executor is an instance of the class MigrationExecutor created with an argument: value under the DEFAULT_DB_ALIAS key of the connections dictionary. call the method executor.migration_plan wiht return value of te method executor.loader.graph.leaf_nodes as argument, substitute it for plan. if plan is true, call the method self.style.NOTICE with an argument: string: "\nYou have unapplied migrations; your app may not work properly until they are applied.", write it to self.stdout. call the method self.style.NOTICE with an argument string "Run 'python manage.py migrate' to apply them.\n", write it to self.stdout. substitute Command for BaseRunserverCommand. import module os. from django.core.management.base import BaseCommand into default name space. derive the class Command from the BaseCommand class. help is a string "Runs a Python interactive interpreter. Tries to use IPython or bpython, if one of them is available.". requires_system_checks is boolean False. shells is a list containing 2 elements: string 'ipython' and string 'bpython'. define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 4 arguments: string '--plain', action set to string 'store_true', dest as a string 'plain', and help is a string 'Tells Django to use plain Python, not IPython or bpython.'. call the method parser.add_argument with 4 arguments: string '--no-startup', action as a string 'store_true', dest as a string 'no_startup' and help as a string 'When using plain Python, ignore the PYTHONSTARTUP environment variable and ~/.pythonrc.py script.'. call the method parser.add_argument with 5 arguments: string '-i', string '--interface', choices set to string self.shells, dest as a string 'interface' and help as a string 'Specify an interactive interpreter interface. Available options: "ipython" and "bpython"'. define the method _ipython_pre_011 with an argument self. from IPython.Shell import IPShell into default namespace. shell is an instance of IPShell class, created with an argument argv as an empty list. call the method shell.mainloop. define the method _ipython_pre_100 with an argument self. from IPython.frontend.terminal.ipapp import TerminalIPythonApp into default namespace. call the method instance of TerminalIPythonApp class, substitute the result for app. call the method app.initialize with an argument argv as an empty list. call the method app.start. define the method _ipython with an argument self. from IPython import start_ipython into default namespace. call the method start_ipython with an argument argv as an empty list. define the method ipython with an argument self. for every ip in tuple containing 3 elements: self._ipython, self._ipython_pre_100 and self._ipython_pre_011, try, call the function ip. if ImportError exception is caught, do nothing. if not, return nothing. raise an ImportError exception with an argument string "No IPython". define the method bpython with an argument self. import bpython. call the method bpython.embed. define the method run_shell with an arguments self and shell set to None. if shell is true substitute list with element shell for available_shells, if not substitute self.shells for available_shells. for every shell in available_shells, try, get shell attribute of the self object, call it and return the result. if ImportError exception is caught, do nothing. raise an ImportError exception. define the method handle with 3 arguments: self and unpacked dictionary options. try, if value under 'plain' key of the options dictionary is true, raise an ImportError exception. call the method self.run_shell with an argument shell set to value under the 'interface' key of the options dictionary. if ImportError exception is caught, import code. imported_objects is an empty dictionary. try, import readline. if ImportError exception is caught, do nothing. if not, import rlcompleter. call the method rlcompleter.Completer with an argument imported_objects, use the complete field of the result as an argument for the call to the method readline.set_completer. call the method readline.parse_and_bind with an argument string "tab:complete". get the value under the 'no_startup' key of the options dictionary, if it evaluates to false, for every pythonrc in tuple containing 2 elements: return value of the function os.environ.get called with a string "PYTHONSTARTUP", and string '~/.pythonrc.py' as tuples second element. if pythonrc is true, skip this loop iteration. call the function os.path.expanduser with an argument pythonrc, substitute the result for pythonrc. if pythonrc is not a file, skip this loop iteration. try, open pythonrc, with the file handle renamed to handle perform the following, compile the handle.read in mode 'exec' source is read from file pythonrc, execute the compiled script with imported_objects variables. if NameError exception is caught, do nothing. call the method code.interact with an argument local set to imported_objects. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_create into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the AppCommand base class. help is a string "Prints the CREATE TABLE SQL statements for the given app name(s).". output_transaction is boolean True. define the method add_arguments with 2 arguments self and parser. call the method add_arguments from the base class of the class Command, with an argument parser. call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to a string 'Nominates a database to print the SQL for. Defaults to the "default" database.'. define the method handle_app_config with 3 arguments: self, app_config and unpacked dictionary options. if app_config.models_module is None, return nothing. get the value under the 'database' key of the options dictionary, use it as the key to get the value from the connections dictionary, substitute the result for connection. call the function sql_create with 3 arguments: app_config, self.style and connection, substitute the result for statements. join statements into a string, separated by newlines, return it. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_all into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the AppCommand base class. help is a string "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s).". output_transaction is boolean True. define the method add_arguments with 2 arguments self and parser. call the method add_arguments from the base class of the class Command, with an argument parser. call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to a string 'Nominates a database to print the SQL for. Defaults to the "default" database.'. define the method handle_app_config with 3 arguments: self, app_config and unpacked dictionary options. if app_config.models_module is None, return nothing. get the value under the 'database' key of the options dictionary, use it as the key to get the value from the connections dictionary, substitute the result for connection. call the function sql_all with 3 arguments: app_config, self.style and connection, substitute the result for statements. join statements into a string, separated by newlines, return it. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_delete into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the AppCommand base class. help is a string "Prints the DROP TABLE SQL statements for the given app name(s).". output_transaction is boolean True. define the method add_arguments with 2 arguments self and parser. call the method add_arguments from the base class of the class Command, with an argument parser. call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to a string 'Nominates a database to print the SQL for. Defaults to the "default" database.'. define the method handle_app_config with 3 arguments: self, app_config and unpacked dictionary options. if app_config.models_module is None, return nothing. get the value under the 'database' key of the options dictionary, use it as the key to get the value from the connections dictionary, substitute the result for connection. call the function sql_destroy_indexes with 3 arguments: app_config, self.style and connection, substitute the result for statements. join statements into a string, separated by newlines, return it. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_custom into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive class Command from the base class AppCommand. help is a string, "Prints the custom table modifying SQL statements for the given app name(s).". substitute True for output_transaction. define method add_arguments with class instance self and parser as the input arguments. call the function add_arguments with parser as an argument, from the base class of the Command class. call the parser.add_argument method with the string '--database', default set to DEFAULT_DB_ALIAS and help containig string, 'Nominates a database to print the SQL for. Defaults to the "default" database.' as the arguments. define method handle_app_config with self class instance, app_config and dictionary options as arguments. if app_config.models_module is None, return nothing. extract the value under the key 'database' from the options dictionary, use the value for indexing connections list, substitute the result for connection. call the function sql_custom with app_config, self.style and connection as the arguments, substitute the result for statements. join the list of statements into a string separated by new lines, return it. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_destroy_indexes into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the AppCommand base class. help is an string "Prints the DROP INDEX SQL statements for the given model module name(s).". output_transaction is boolean True. define the method add_arguments with 2 arguments: self and parser. call the add_arguments method from the base class of the class Command with parser as an argument. call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to string 'Nominates a database to print the SQL for. Defaults to the "default" database.'. define the handle_app_config with 3 arguments self, app_config and unpacked dictionary options. if app_config.models_module is None. return nothing. get the value under the 'database' key of the options dictionary, use it as the key to get the value from the connections dictionary, substitute the result for connection. call the function sql_destroy_indexes with 3 arguments: app_config, self.style and connection, substitute the result for statements. join statements into a string, separated by newlines, return it. from __future__ import unicode_literals into default name space. from django.core.management.base import BaseCommand into default name space. from django.core.management.sql import sql_flush into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the base class BaseCommand. help is a string, containing "Returns a list of the SQL statements required to return all tables in the database to the state they were in just after they were installed.". output_transaction is boolean True. define method add_arguments with self class instance and parser as the arguments. call the parent class of Command class add_arguments method and parser as the arguments. call the add_argument method on parser object, use string '--database', default set to DEFAULT_DB_ALIAS and help set to string, 'Nominates a database to print the SQL for. Defaults to the "default" database.' as the arguments. define the method handle with self class instance and dictionary options as the arguments. call the sql_flush function with self.style, connections under the key with the value of options dictionary under the 'database' key, from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import sql_indexes into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the base class AppCommand. help is a string "Prints the CREATE INDEX SQL statements for the given model module name(s).". output_transaction is boolean True. define the method add_arguments with self class instance and parser as the arguments. call the add_arguments method with parser as argument form the base class of the class Command. call parse.add_argument method, with string '--database', default set to DEFAULT_DB_ALIAS, and help as a string 'Nominates a database to print the SQL for. Defaults to the "default" database.', as arguments. define the method handle_app_config with self class instance, app_config and dictionary options as arguments. if app_config.models_module is None, return nothing. get the value under the 'database' key of options dictionary, use it as a index to get connections list element, store it in connection. call the function sql_indexes with app_config, self.style and connection as arguments, store the result in statements. join statements in a string separated by newline, return the result. from __future__ import unicode_literals into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. from django.db.migrations.executor import MigrationExecutor into default name space. from django.db.migrations.loader import AmbiguityError into default name space. derive class Command from the base class BaseCommand. help is a string "Prints the SQL statements for the named migration." def method add_arguments with self class instance and parser as the arguments. call the add_argument method on the parser object, with string 'app_label', and help set to string 'App label of the application containing the migration.' as arguments. call the add_argument method on the parser object, with string 'migration_name', and help set to string 'Migration name to print the SQL for.' as arguments. call the add_argument method on the parser object, with string '--database', default set to DEFAULT_DB_ALIAS and help set to string 'Nominates a database to create SQL for. Defaults to the default" database.' as arguments. call the add_argument method on the parser object with string '--backwards', asction set to 'store_true', dest set to 'backwards', default set to False and help set to string'Creates SQL to unapply the migration, rather than to apply it' as arguments. define the method handle with self class instance, list of arguments args and options dictionary as the arguments. get the value under the key 'database' of the options dictionary, use it as a index to get an element from connections, substitute it for connection. call the MigrationExecutor with the connection as the argument, substitute it for executor. get the values under the keys 'app_label' and 'migration_name' of the options dictionary, substitute the results for app_label and migration_name, respectively. if app_label is not contained in executor.loader.migrated_apps, raise a exception of CommandError class, with string "App '%s' does not have migrations" with '%s' replaced with app_label as the argument. try, call the executor.loader.get_migration_by_prefix with app_label and migration_name with arguments, substitute the result fr migration. if AmbiguityError exception is raised, raise a exception of ComandError class with string "More than one migration matches '%s' in app '%s'. Please be more specific.", with all '%s' strings replaced with migration_name and app_label, respectively, as an argument. if KeyError exception is raised, raise a exception of CommandError class, with string "Cannot find a migration matching '%s' from app '%s'. Is it in INSTALLED_APPS?", replace all the '%s' occurrences with migration_name and app_label, respectively. target is a list containing tuple with two elements app_label and migration.name. get executor.loader.graph.nodes list item at the index of the first element of targets list, get the value under the 'backwards' key of options dictionary, put previous two elements is a tuple, tuple is contained in a plan list. call method executor.collect_sql with plan as the argument, substitute the result for sql_statements. for every statements in sql_statements: call method self.stdout.write with statement as an argument. from __future__ import unicode_literals into default name space. from django.core.management.base import AppCommand into default name space. from django.core.management.sql import check_for_migrations into default name space. from django.db import connections and DEFAULT_DB_ALIAS into default name space. derive the class Command from the AppCommand base class. help is a string 'Prints the SQL statements for resetting sequences for the given app name(s).'. output_transaction is boolean True. define the method add_arguments, with 2 arguments self and parser. call the method add_arguments from the base class of the Command class, with an argument parser. call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to string 'Nominates a database to print the SQL for. Defaults to the "default" database.'. define the method handle_app_config with 3 arguments: self, app_config and unpacked dictionary options. if app_config.models_module is None, return nothing. get the value under the 'database' key of the options dictionary, use the result as a key to get the value from the connections dictionary, substitute the result for connection. call the function check_for_migrations with 2 arguments: app_config and connection. call the method app_config.get_models with include_auto_created set to boolean True, substitute the result for models. call the method connection.ops.sequence_reset_sql with 2 arguments self.style and models, substitute the result for statements. join statements into a string, separated by newline characters, return it. from django.core.management.base import BaseCommand and CommandError into default name space. from django.utils import six into default name space. from django.db import connections, DEFAULT_DB_ALIAS and migrations into default name space. from django.db.migrations.loader import AmbiguityError into default name space. from django.db.migrations.executor import MigrationExecutor into default name space. from django.db.migrations.writer import MigrationWriter into default name space. from django.db.migrations.optimizer import MigrationOptimizer into default name space. derive the class Command from the BaseCommand class. help is a string "Squashes an existing set of migrations (from first until specified) into a single new one.". define the method add_arguments with 2 arguments self and parser. call the method parser.add_argument with 2 arguments: string 'app_label', and help is a string 'App label of the application to squash migrations for.'. call the method parser.add_argument with 2 arguments: string 'migration_name', and help is a string 'Migrations will be squashed until and including this migration.'. call the method parser.add_argument with 5 arguments: string '--no-optimize', action as a string 'store_true', dest as a string 'no_optimize', default set to boolean False and help as a string 'Do not try to optimize the squashed operations.'. call the method parser.add_argument with 5 arguments: string '--noinput', action set to string 'store_false', dest as a string 'interactive', default as boolean True help as a string 'Tells Django to NOT prompt the user for input of any kind.'. define the method handle with 3 arguments: self and unpacked dictionary options. get the value under the 'verbosity' key of the options dictionary, substitute it for self.verbosity. get the value under the 'interactive' key of the options dictionary, substitute it for self.interactive. get the values under the 'app_label' and 'migration_name' keys of the options dictionary, substitute them for app_label and migration_name, respectively. executor is an instance of MigrationExecutor, created with value under the DEFAULT_DB_ALIAS key of the connections dictionary. if app_label is not contained in executor.loader.migrated_apps, raise an CommandError with an argument string "App '%s' does not have migrations (so squashmigrations on it makes no sense)", where '%s' is replaced with app_label. try, call the method executor.loader.get_migration_by_prefix with arguments app_label, migration_name, substitute the result for migration. if AmbiguityError exception is caught, raise an CommandError with an argument string "More than one migration matches '%s' in app '%s'. Please be more specific.", where '%s' is replaced with migration_name and app_label. if KeyError exception is caught, raise an CommandError with an argument string "Cannot find a migration matching '%s' from app '%s'.", where '%s' is replaced with migration_name and app_label. migrations_to_squash is a list created dynamically with elements: return value of the method executor.loader.get_migration called, with arguments al and mn, for every al, mn in executor.loader.graph.forwards_plan method return value called with 2 arguments: migration.app_label, migration.name, only if al equals migration.app_label. if self.verbosity is greater than integer 0 or self.interactive is true, call the method self.style.MIGRATE_HEADING with an argument string "Will squash the following migrations:", write it to self.stdout. for every migration in migrations_to_squash, append migration.name to string ' - ', write it to self.stdout stream. if self.interactive is true, answer is None. while answer is false or answer is not contained in string "yn", perform the following, call the method six.moves.input with an argument string "Do you wish to proceed? [yN] ", substitute the result for answer. if answer is false, substitute 'n' for answer. break from the loop execution, if not, convert first element of answer to lowercase and substitute it for answer. if answer equals a string 'y', return nothing. operations is an empty list. for every smigration in migrations_to_squash, call the method operations.extend with an argument smigration.operations. if self.verbosity is greater than integer 0, call the method self.style.MIGRATE_HEADING with an argument string "Optimizing...", write it to self.stdout. optimizer is an instance of MigrationOptimizer class. call the method optimizer.optimize with 2 arguments operations and migration.app_label, substitute the result for new_operations. if self.verbosity is greater than integer 0, if lengths of new_operations and operations are the same, write string " No optimizations possible." to self.stdout stream. if not, replace '%s' in string " Optimized from %s operations to %s operations." with lengths of operations and ew_operations, respectively, write it to self.stdout stream. replaces is an empty list. for every migration in migrations_to_squash, if migration.replaces is true, extend replaces list with migration.replaces, if not, append tuple with 2 elements: migration.app_label and migration.name to replaces. subclass is a class named Migration, sub classed from migrations.Migration base class, with fields dependencies set to an empty list, dependencies set to new_operations and replaces set to replaces. call the function subclass with 2 arguments string "0001_squashed_%s", where '%s' is replaced with migration.name and app_label, substitute the result for new_migration. writer is an instance of a class MigrationWriter, created with an argument new_migration. open writer.path file in write mode, with file descriptor as fh, perform the following, call the method writer.as_string, write the result to file fh. if self.verbosity is greater than integer 0, replace '%s' in a string "Created new squashed migration %s" with writer.path, use it as an argument for the call to the method, self.style.MIGRATE_HEADING, write the result to self.stdout. write string " You should commit this migration but leave the old ones in place;" to self.stdout. write string " the new migration will be used for new installs. Once you are sure" to self.stdout. write string " all instances of the codebase have applied the migrations you squashed," to self.stdout. write string " you can delete them." to self.stdout. from importlib import import_module into default name space. from django.core.management.base import CommandError into default name space. from django.core.management.templates import TemplateCommand into default name space. derive the class Command from the TemplateCommand base class. help is a tuple containing a string "Creates a Django app directory structure for the given app name in the current directory or optionally in the given directory.". missing_args_message is a string "You must provide an application name.". define the method handle with 2 arguments: self and unpacked dictionary options. remove values under the keys 'name' and 'directory' of the options dictionary and substitute it for app_name and target, respectively. call the method self.validate_name with 2 arguments: app_name and string 'app'. try, call the function import_module with an argument app_name. if ImportError exception is caught, do nothing. in not, raise an CommandError exception with an argument string "%r conflicts with the name of an existing Python module and cannot be used " "as an app name. Please try another name.", where '%r' is replaced with app_name. call the method handle from the base class of Command class, with 4 arguments: string 'app', app_name, target and unpacked dictionary options. from importlib import import_module into default name space. from django.core.management.base import CommandError into default name space. from django.core.management.templates import TemplateCommand into default name space. from django.utils.crypto import get_random_string into default name space. derive class Command from the TemplateCommand base class. help is a tuple containing string "Creates a Django project directory structure for the given " "project name in the current directory or optionally in the given directory.". missing_args_message is a string "You must provide a project name.". define the method handle with arguments self and unpacked dictionary options. remove the elements from the 'name' and 'dictionary' keys of the options dictionary, substitute them for project_name and target, respectively. call the method self.validate_name with arguments project_name and string "project". try, call the function import_module with an argument project_name. if ImportError exception is caught, do nothing. if not, raise an exception CommandError, with argument string "%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name.", where '%r' is replaced with project_name. chars is a string 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'. call the function get_random_string with 2 arguments: integer 50 and chars, substitute it for value under the 'secret_key' of the options dictionary. call the handle method of the base class of the Command class, with 4 arguments: string 'project', project_name, target, import module warnings. from django.apps import apps into default name space. from django.contrib.auth import get_user_model into default name space. from django.db import DEFAULT_DB_ALIAS into default name space. from django.core.management import call_command into default name space. from django.core.management.base import BaseCommand into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. from django.utils.six.moves import input into default name space. derive class Command from the BaseCommand base class. help is a string "Deprecated - use 'migrate' instead.". define the method add_arguments with self and parser as arguments. call the method parser.add_argument with 5 arguments: string '--noinput', action set to string 'store_false', dest set to string 'interactive', default set to boolean True and help as 'Tells Django to NOT prompt the user for input of any kind.' call the method parser.add_argument with 5 arguments: string '--no-initial-data', action set to string 'store_false', dest set to string 'load_initial_data', default set to boolean True, and help as a string 'Tells Django not to load any initial data after database synchronization.' call the method parser.add_argument with 3 arguments: string '--database', default set to DEFAULT_DB_ALIAS, and help set to string 'Nominates a database to synchronize. Defaults to the "default" database.'. define the method handle with 2 arguments: self and unpacked dictionary options. call the method warnings.warn with 2 arguments: string "The syncdb command will be removed in Django 1.9" and RemovedInDjango19Warning. call the function call_command with 2 arguments: string migrate and unpacked dictionary options. try, call the method apps.get_model with 2 arguments: string 'auth' and string 'Permission'. if LookupError exception is caught. return nothing. call the function get_user_model, substitute the result for UserModel. if return value of the method UserModel._default_manager.exists is false and value under the 'interactive' key of the options dictionary is true, msg is a tuple containing string "\nYou have installed Django's auth system, and don't have any superusers defined.\nWould you like to create one now? (yes/no): ". call the method input with an argument msg and store the result in confirm. endless loop, if confirm is not equal to string 'yes' or string 'no', query a string 'Please enter either "yes" or "no": ' and store the result in confirm. skip this loop iteration. if confirm equals string 'yes', call the function call_command with 3 arguments: string "createsuperuser", interactive is boolean True, and database set to value under the 'database' key of the options dictionary. break the loop execution. import module logging. import module sys. import module os. from django.conf import settings into default name space. from django.core.management.base import BaseCommand into default name space. from django.test.utils import get_runner into default name space. derive class Command from the BaseCommand base class. help is a string 'Discover and run tests in the specified modules or the current directory.'. requires_system_checks is boolean False. define the method __init__ with an argument self. self.test_runner is None. call the method __init__ form the base class of the Command class. define the method run_from_argv with arguments self and argv. option is a string '--testrunner='. for arg in argv list without the first two elements, if arg starts with options, get the length of the options, use it as a starting index for the slicing arg list, substitute it for self.test_runner. break the loop execution. call the run_from_argv function from the base class of the Command class with argv as a argument,. define the method add_arguments with arguments self and parser. call the method parser.add_argument with 4 arguments: string 'args', metavar set to string 'test_label', nargs set to string '*', and help is a string 'Module paths to test; can be modulename, modulename.TestCase or modulename.TestCase.test_method'. call the method parser.add_argument with 5 arguments: string '--noinput', action set to 'store_false', dest set to 'interactive', default set to boolean True, help set to string 'Tells Django to NOT prompt the user for input of any kind.'. call the method parser.add_argument with 5 arguments: string '--failfast', action set to string 'store_true', dest set to 'failfast', default set to boolean False and help set to string 'Tells Django to stop running the test suite after first failed test.'. call the method parser.add_argument with 4 arguments: string '--testrunner', action set to string 'store', dest set to 'testrunner', and help set to a string 'Tells Django to use specified test runner class instead of the one specified by the TEST_RUNNER setting.'. call the method parser.add_argument with 5 arguments: string '--liveserver', action set to string 'store', dest set to 'liveserver', default set to None and help set to string 'Overrides the default address where the live server (used ' 'with LiveServerTestCase) is expected to run from. The default value is localhost:8081.' call the function get_runner with arguments settings and self.test_runner, substitute the result for test_runner_class. if test_runner_class has an 'option_list' attribute, raise an RuntimeError exception with an argument string "The method to extend accepted command-line arguments by the " "test management command has changed in Django 1.8. Please create an add_arguments class method to achieve this." if test_runner_class has an attribute 'add_arguments', call the method test_runner_class.add_arguments with an argument parser. define the method execute with 3 arguments self, unpacked list args and unpacked dictionary options. if value under the 'verbosity' key of the options dictionary is greater than zero, call the method logging.getLogger with an argument string 'py.warnings', substitute the result for logger. call the method logging.StreamHandler, substitute the result for handler. call the method logger.addHandler with an argument handler. call the method execute form the base class of the class Command, with 2 arguments: unpacked list args and unpacked dictionary options. if value under the 'verbosity' key of the options dictionary is greater than zero, call the method logger.removeHandler with an argument handler. define the method handle with 3 arguments: self, unpacked list test_labels and unpacked dictionary options. from django.conf import settings into default namespace. from django.test.utils import get_runner into default namespace. call the method get_runner with 2 arguments: settings and value under the 'testrunner' key of the options dictionary, substitute it for the TestRunner. if value under the 'liveserver' key of the options dictionary is not None, substitute value under the 'liveserver' key of the options dictionary for value under the 'DJANGO_LIVE_TEST_SERVER_ADDRESS' key of the os.environ dictionary. delete the value under the 'liveserver' key of the options dictionary. test_runner is an instance of TestRunner class, called with an argument unpacked dictionary options. call the method test_runner.run_tests with an argument test_labels, substitute it for failures. if failures is true, exit the program with failures converted to boolean as a message. from django.core.management import call_command into default name space. from django.core.management.base import BaseCommand into default name space. from django.db import connection into default name space. derive class Command from the BaseCommand base class. help is a string 'Runs a development server with data from the given fixture(s).'. args is a string '[fixture ...]'. requires_system_checks is boolean False. define the method with self class instance and parser as arguments. call parser.add_argument method with 'args', metavar set to string 'fixture', nargs set to string '*' and help set to string 'Path(s) to fixtures to load before running the server.'. call parser.add_argument method with '--noinput', action set to string 'store_false', dest set to string 'interactive', default set to boolean True and help set to string 'Tells Django to NOT prompt the user for input of any kind.'. call the parser.add_argument with string '--addrport', default set to an empty string and help as string 'Port number or ipaddr:port to run the server on.'. call parser.add_argument method with '--ipv6', string '-6', action set to string 'store_true', dest set to string 'use_ipv6', default set to boolean False and help set to string 'Tells Django to use an IPv6 address.'. define the method handle with self class instance, list of arguments fixture_labels and dictionary options as arguments. get the value under the key 'verbosity' of options dictionary, substitute it for verbosity. get the value under the key 'interactive' of options dictionary, substitute it for interactive. call the method connection.creation.create_test_db with verbosity set to verbosity, autoclobber set to inverse value of interactive, serialize set to boolean False, substitute the return value for db_name. call the method call_command with 3 arguments, string 'loaddata', unpacked list fixture_labels and unpacked dictionary containing 1 element: verbosity for 'verbosity'. replace '%r' from string '\nServer stopped.\nNote that the test database, %r, has not been deleted. You can explore it on your own.', with db_name, substitute it for shutdown_message. substitute connection.features.test_db_allows_multiple_connections for use_threading. call the function call_command with 6 arguments, string 'runserver', addrport as the value under the 'addrport' key of options dictionary, from __future__ import unicode_literals into default name space. import module warnings. from django.core.management.commands.check import Command as CheckCommand into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. derive class Command from CheckCommand base class. concatenate CheckCommand.help to string 'Deprecated. Use "check" command instead. ', substitute it for help. define the method handle with self class instance and dictionary pair of elements options as arguments. call the method warnings.warn with string '"validate" has been deprecated in favor of "check".' and RemovedInDjango19Warning as arguments. call the handle function with dictionary pair of elements options from the base class of the class Command. from __future__ import unicode_literals into default name space. import module codecs. import module os. import module re. import module warnings. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core.management.base import CommandError into default name space. from django.db import models and router into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. define the function check_for_migrations with 2 arguments: app_config and connection. from django.db.migrations.loader import MigrationLoader into default name space. loader is an instance of MigrationLoader class, created with an argument connection. if app_config.label is contained in loader.migrated_apps, raise an CommandError exception, with an arguent: string "App '%s' has migrations. Only the sqlmigrate and sqlflush commands can be used when an app has migrations.", where '%s' is replaced for app_config.label. define the function sql_create with 3 arguments: app_config, style and connection. call the function check_for_migrations with an arguments app_config, connection. if value under the 'ENGINE' key of the connection.settings_dict dictionary equals a string 'django.db.backends.dummy', raise an CommandError exception with an argument string "Django doesn't know which syntax to use for your SQL statements,\n" "because you haven't properly specified the ENGINE setting for the database.\n see: https://docs.djangoproject.com/en/dev/ref/settings/#databases". call the method app_config.get_models with an argument include_auto_created set to boolean True, substitute it for app_models. final_output is an empty list. call the method connection.introspection.table_names, substitute the result for tables. if model is not contained in app_models for every model in return value of the connection.introspection.installed_models function return value, add model to a set, substitute the result for known_models. pending_references is an empty dictionary. for every model in return value of the function router.get_migratable_models, called with arguments: app_config, connection.alias and include_auto_created set to boolean True. call the method connection.creation.sql_create_model with arguments model, style and known_models, substitute the result for output and references. call the method final_output.extend with an argument output. for every refto and refs in return value of the method references.items, call the method pending_references.setdefault with 2 arguments: refto and an empty list, extend the result with refs. if refto is contained in known_models, call the method connection.creation.sql_for_pending_references with 3 arguments: refo, style and pending_references, use the result as an argument for the call to the method final_output.extend. call the method connection.creation.sql_for_pending_references with 3 arguments: refo, style and pending_references, use the result as an argument for the call to the method final_output.extend. add model to known_models set. call the method pending_references.keys, put the result into a set and substitute it for not_installed_models. if not_installed_models is true, alter_sql is an empty list. for every model in not_installed_models, for every sql in return value of the function connection.creation.sql_for_pending_references called with arguments: model, style, and pending_references append sql to the string '-- ', put the results in a list, extend alter_sql with the result. if alter_sql, append string '-- The following references should be added but depend on non-existent tables:' to the final_output. extend final_output with alter_sql. return final_output. define the function sql_delete with 4 arguments: app_config, style, connection and close_connection set to boolean True. call the function check_for_migrations with arguments app_config and connection. try, call the method connection.cursor, substitute the result for cursor. if Exception exception is caught, cursor is None. try, if cursor is true, call the method connection.introspection.table_names with an argument cursor, substitute the result for table_names. if not, table_names is an empty list. output is an empty list. to_delete is an empty set. references_to_delete is an empty dictionary. call the method router.get_migratable_models with argument: app_config, connection.alias and include_auto_created set to True, substitute the result for app_models. for every model in app_models, if cursor is true and return value of the function connection.introspection.table_name_converter called with an arugment: model._meta.db_table is contained in table_names, substitute model._meta for opts. for every f in opts.local_fields, if f.rel and f.rel.to are not contained in to_delete, call the method references_to_delete.setdefault with arguments: r.rel.to and an empty list, append to the result tuple with 2 entries: model and f. call the method to_delete.add with an argument model. for every model in app_models, if return value of the function connection.introspection.table_name_converter called with an arugment: model._meta.db_table is contained in table_names call the method connection.creation.sql_destroy_model with arguments: model, references_to_delete and style, extend with the result the list output. finally perform, if both cursor and close_connection are true, call the method cursor.close, call the method connection.close, return reversed list output. define the function sql_flush with 4 arguments: style, connection, only_django set to boolean False, if only_django, call the method connection.introspection.django_table_names with an argument boolean true, substitute the result for tables. if not, call the method connection.introspection.table_names, substitute the result for tables. call the method connection.introspection.sequence_list if reset_sequences is true, substitute the result for seqs, if not, seqs is an empty tuple. call the method connection.ops.sql_flush with arguments: style, tables, seqs and allow_cascade, substitute the result for statements. return statements. define the function sql_custom with 3 arguments: app_config, style and connection. call the method check_for_migrations with arguments: app_config and connection. output is an empty list. call the method router.get_migratable_models with arguments app_config and connection.alias. for every model in app_models, call the function custom_sql_for_model with 3 arguments: model, style and connection, extend the output with the result. return output. define the function sql_indexes with 3 arguments: app_config, style and connection. call the function check_for_migrations with an arguments app_config and connection. outut is an empty list. for model in router.get_migratable_models method return value, called with 3 arguments: app_config, connection.alias, and include_auto_created set to boolean True, call the method connection.creation.sql_indexes_for_model with arguments model and style, extend output with the result. return output. define the function sql_destroy_indexes with 3 arguments: app_config, style and connection. call the function check_for_migrations with arguments app_config and connection. output is an empty list. for model in return value of the method router.get_migratable_models with arguments app_config, connection.alias, and include_auto_created set to boolean True, call the method connection.creation.sql_destroy_indexes_for_model with arguments model and style, extend the output with the result. return output. define the function sql_all with 3 arguments: app_config, style and connection. call the function check_for_migrations with arguments app_config and connection. use the app_config, style and connection as arguments for the call to the sql_create, sql_custom and sql_indexes functions, append the results respectively, return the result. define the function _split_statements with an argument content. call the function re.compile with an argument raw string "^((?:'[^']*'|[^'])*?)--.*$", substitute the result for comment_re. statements is an empty list. statement is an empty list. split content by newline character, for every line in result, call the method comment_re.sub with an arguments: raw string '\1' and line, strip the whitespaces surrounding the result, return it. if cleaned_line is false, skip this loop iteration, append cleaned_lien to statement. if cleaned_line ends with ';' character, join statements into a string, separated by white spaces, append it to statements. statement is an empty list. return statements. define the function custom_sql_for_model with 3 arguments: app_config, style and connection. substitute model._meta for opts. app_dirs is an empty list. call the method apps.get_app_config with an argument model._met.app_label, substitute path field of the result for app_dir. join app_dir and string 'sql' into a file path, use the result as an argument for the call to the function os.path.normpath, append the result to app_dirs. join app_dir and string 'models/sql' into a file path, use the result as an argument for the call to the function os.path.normpath, append the result to old_app_dirs. if file path old_app_dir exists, call the function warnings.warn with 2 arguments: string "Custom SQL location '/models/sql' is deprecated, use '/sql' instead." and RemovedInDjango19Warning. append old_app_dir to app_dirs. output is an empty list. if opts.managed is true, for every f in opts.local_fields that has an 'post_create_sql' attribute, append f to a list, substitute the resulting list for post_sql_fields. for every f in post_sql_fields, call the method f.post_create_sql with arguments: style and model._meta.db_table, extend the output with the result. once split at the '.' value under the 'ENGINE' key of the connection.settings_dict dictionary, substitute last element of the result for backend_name. sql_files is an empty list. for every app_dir in app_dirs, join into a file path: app_dir and string %s.%s.sql, where '%s' is replaced by opts.model_name and backend_name, respectively, append the result to sql_files. join into a file path: app_dir and string %s.%s.sql, where '%s' is replaced by opts.model_name, append the result to sql_files. for every sql_file in sql_files, if file path sql_file exists, call the function codecs.open with 3 arguments: sql_file, string 'r' and encoding set to settings.FILE_CHARSET, with the result renamed to fp, call the method connection.ops.prepare_sql_script with 2 arguments: return value of the function fp.read, and _allow_fallback set to boolean True, extend the output with the result. return output. define the function emit_pre_migrate_signal with 4 arguments: create_models, verbosity, interactive and db. for app_config in return value of the method apps.get_app_configs, if app_config.models_module is None, skip this loop iteration, if verbosity is greater or equal to integer 2, replace '%s' in string "Running pre-migrate handlers for application %s" with app_config.label, print it to the standard output. call the method models.signals.pre_migrate.send with 5 arguments: sender set to app_config, app_config set to app_config, verbosity set to verbosity, interactive set to interactive and using set to db. call the method models.signals.pre_syncdb.send with 6 arguments: sender set to app_config.models_module, app set to app_config.models_module, create_models set to create_models, verbosity set to verbosity, interactive set to interactive, and db set to db. define the function emit_post_migrate_signal with 4 arguments: created_models, verbosity, interactive and db. for app_config in return value of the method apps.get_app_configs, if app_config.models_module is None, skip this loop iteration, if verbosity is greater or equal to integer 2, replace '%s' in string "Running post-migrate handlers for application %s" with app_config.label, print it to the standard output. call the method models.signals.post_migrate.send with 5 arguments: sender set to app_config, app_config set to app_config, verbosity set to verbosity, interactive set to interactive and using set to db. call the method models.signals.post_syncdb.send with 6 arguments: sender set to app_config.models_module, import module cgi. import module errno. import module mimetypes. import module os. import module posixpath. import module re. import module shutil. import module stat. import module sys. import module tempfile. from os import path into default name space. import module django. from django.template import Template and Context into default name space. from django.utils import archive into default name space. from django.utils.six.moves.urllib.request import urlretrieve into default name space. from django.utils._os import rmtree_errorhandle into default name space. from django.core.management.base import BaseCommand and CommandError into default name space. from django.core.management.utils import handle_extensions into default name space. call the function re.compile with 2 arguments: string '^([a-z]):' and re.I, substitute the result for _drive_re. call the function re.compile with 2 arguments: string '^([a-z])[:|]' and re.I, substitute the result for _url_drive_re. derive the class TemplateCommand from the BaseCommand base class. requires_system_checks is boolean False. can_import_settings is boolean False. url_schemes is list of strings 'http', 'https' and 'ftp'. leave_locale_alone is boolean True. define the method add_aguments with arguments self and parser. call the method parser.add_argument with 2 arguments: string 'name' and help set to string 'Name of the application or project.'. call the method parser.add_argument with 3 arguments: string 'directory', nargs set to '?' and help set to string 'Name of the application or project.'. call the method parser.add_argument with 2 arguments: string '--template' and help set to string 'The path or URL to load the template from.'. call the method parser.add_argument with 6 arguments: string '--extension', string '-e', dest set to string 'extensions', action set to 'append', default is a list containing string 'py' and help set to string: 'The file extension(s) to render (default: "py"). Separate multiple extensions with commas, or use -e multiple times.'. call the method parser.add_argument with 6 arguments: string '--name', string '-n', dest set to string 'files', action set to string 'append', default as an empty list and help set to a string: 'The file name(s) to render. Separate multiple extensions with commas, or use -n multiple times.'. define the method handle with 5 arguments: self, app_or_project, name, target set to None and unpacked dictionary options. substitute app_or_project for self.app_or_project. self.paths_to_remove is an empty list. substitute value under the 'verbosity' key of the options dictionary for self.verbosity. call the method self.validate_name with 2 arguments name and app_or_project. if target is None, join the current working directory and name into a file path, substitute it for top_dir. try, make a directory top_dir. if OSError renamed to e, exception is caught, if e.errno equals errno.EEXIST, replace '%s' in string "'%s' already exists" with top_dir, substitute it for message. if not, substitute e for message. raise an CommandError exception with an argument message. if not, ge the absolute path of the return value of the function path.expanduser with the argument target, substitute it for top_dir. if file path top_dir doesnt exists, raise an CommandError exception with an argument string "Destination directory '%s' does not exist, please create it first.", where '%s' is replaced with top_dir. call the function handle_extensions with 2 arguments: value under the 'extensions' key of the options dictionary, and ignored as an empty tuple, convert the result into a tuple and substitute it for extensions. extra_files is an empty list. for every file in value under the 'files' key of the options dictionary. split file by ',' character, apply on its every element a lambda function which takes an argument x, and returns x striped of the surrounding whitespaces, extend the extra_files with the mapped list. if self.verbosity is greater or equal to integer 2, call the method self.stdout.write, with an argument string "Rendering %s template files with extensions: %s\n", where '%s' is replaced with app_or_project and extensions joined into a string, separated by a string ', '. call the method self.stdout.write, with an argument string "Rendering %s template files with filenames: %s\n", where '%s' is replaced with app_or_project and extra_files joined into a string, separated by a string ', '. append string '_name' to app_or_project, substitute it for base_name. append string '_template' to app_or_project, substitute it for base_subdir. append string '_directory' to app_or_project, substitute it for base_directory. if second last element of django.VERSION is not equal to a string 'final', docs_version is a string 'dev'. if not, convert first 2 elements of django.VERSION into a strings, join them together, separated by a '.', substitute the result for docs_version. context is an instance of a class Context, created with 2 arguments: dictionary created by apllying options to unpacked dictionary containing 3 entries: name for base_name, top_dir for base_directory and docs_version for 'docs_version' and autoescape set to boolean False. from django.conf import settings into a default name space, if settings.configured is false, call the method settings.configure. call the method self.handle_template with 2 arguments: value under the 'template' key of the options dictionary and base_subdir. increment length of template_dir by one and substitute it for prefix_length. for every root, dirs and files in subdirectory tree starting from the base dir template_dir, slice root starting from the prefix_length index to the end, substitute it for path_rest. call the method path_rest.replace with arguments base_name and name, substitute the result for relative_dir. if relative_dir is true, join top_dir and relative_dir into a file path, substitute it for target_dir. if target_dir path doesnt exists, make target_dir directory, for dirname in dirs, if dirname starts with character '.' or dirname equals a string '__pycache__', remove dirname key from dirs. for every filename in files, if filename ends with '.pyo', '.pyc' or '.py.class', skip this loop iteration, join root and filename into a file path, substitute it for old_path. join top_dir, relative_dir and return value of the function filename.replace called with 2 arguments: base_name and name, into a file path, substitute it for new_path. if new_path file path exists, raise a CommandError exception with an argument: string "%s already exists, overlaying a project or app into an existing directory won't replace conflicting files", where '%s" is replaced with new_path. open old_path file in 'rb' mode, with file descriptor renamed to template_file, call the method template_file.read, substitute it for content. if filename ends with extensions or filename is contained in extra_files, call the method content.decode with an argument string 'utf-8', substitute it for content. template is an instance of Template class, created with an argument content. call the method template.render with an argument context, substitute it for content. call the method content.encode with an argument string 'utf-8', substitute it for content. open new_path file in 'wb' mode, with file descriptor renamed to new_file, write content to new_file file. if self.verbosity is greater or equal to integer 2, replace '%s' in string "Creating %s\n" with new_path, write it to the self.stdout stream. try, call the function shutil.copymode with arguments old_path and new_path. call the method self.make_writeable with an argument new_path. if OSError exception is caught, replace '%s' in string "Notice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.", with new_path and self.style.NOTICE, respectively, write it to self.stderr stream. if self.paths_to_remove is true, if self.verbosity is greater or equal to integer 2, write string "Cleaning up temporary files.\n" to self.stdout stream. for every path_to_remove in self.paths_to_remove, if path_to_remove is file, remove file path_to_remove, if not, call the function shutil.rmtree with 2 arguments: path_to_remove and onerror set to rmtree_errorhandler. define the method handle_template with 3 arguments: self, template and subdir. if template is None, join first element of django.__path__, string 'conf' and subdir into a valid file path, return it. if not, if template starts with a string 'file://', remove first 7 elements form template. call the method path.expanduser with an argument template, substitute it for expanded_template. call the method path.normpath with an argument expanded_template, substitute it for expanded_template. if expanded_template is a directory, return expanded_template. call the method self.is_url with an argument template, if it evaluates to true, call the method self.download with an argument template, substitute the result for absolute_path. if not, get the absolute file path of the expanded_template, substitute it for absolute_path. if file path absolute_path exists, call the method self.extract with an argument absolute_path, return the result. raise an CommandError exception with an argument string "couldn't handle %s template %s.", replace '%s' with self.app_or_project and template. define validate_name with 3 arguments: self, name and app_or_project. if name is None, raise an CommandError exception with an argument string "you must provide %s %s name", where '%s' is replaced with string 'an', and app_or_project if app_or_project equals to string 'app', if not, it is replaced with 'a' and app_or_project. call the method re.search with 2 arguments: raw string '^[_a-zA-Z]\w*$' and name, if it evaluates to false, call the method re.search with 2 arguments: raw string '^[_a-zA-Z]' and name, if it evaluates to false, message is a string 'make sure the name begins with a letter or underscore'. if not, message is a string 'use only numbers, letters and underscores'. raise an CommandError with an argument string "%r is not a valid %s name. Please %s.", were '%r' is replaced with name, and '%s' is replaced with app_or_project and message, respectively. define the method download with arguments self and url. define the function cleanup_url with an argument url. strip url of surrounding '/' characters, substitute it for tmp. split tmp at '/' character, substitute the last element of the result for filename. if url ends with '/' character, append '/' to tmp, substitute it for display_url. if not, substitute url for display_url. return filename and display_url. replace '%s' in string 'django_%s_template_' with self.app_or_project. call the function tempfile.mkdtemp with arguments: prefix set to prefix and suffix set to string '_download'. append the tempdir to self.paths_to_remove. call the function cleanup_url with an argument url, assign the result to filename and display_url, respectively. if self.verbosity is greater or equal to integer 2, replace '%s' in string "Downloading %s\n", with display_url, write it to self.stdout stream. try, call the function urlretrieve with arguments url and tempdir and filename joined into a file path, assign the result to the_path, and info, respectively. if IOErro, renamed to e, exception is caught, raise an CommandError exception with an argument string "couldn't download URL %s to %s: %s", where '%s' is replaced with url, filename and e. split the_path at the '/' character, substitute last element of the result for used_name. get the value under the 'content-disposition' key of the info dictionary, substitute it for content_disposition. if content_disposition is true, call the method cgi.parse_header with an argument content_disposition, assign the result to _ and params, respectively. get the value under the 'filename' key of the params dictionary, if the key exists substitute it for guessed_filename, if not, substitute used_name for guessed_filename. if not, substitute used_name for guessed_filename. call the method self.splitext with an argument guessed_filename, substitute the second element of the result for ext. get the value under the 'content-type' key of the info dictionary, substitute it for content_type. if ext is false and content_type is true, call the method mimetypes.guess_extension with an argument content_type, substitute result for ext. if ext is true, append ext to guessed_filename. if used_name is not equal to guessed_filename, join tempdir and guessed_filename into a file path, substitute it for guessed_path. call the function shutil.move with arguments the_path and guessed_path. return guessed_path. return the_path. define the method splitext with arguments self and the_path. call the method posixpath.splitext with an argument the_path. convert base to lowercase, if it ends with string '.tar', take last four elements of base and append ext to it, substitute result for ext. substitute last four elements of base for base. return base and ext. define the function with arguments self and filename. replace '%s' in string 'django_%s_template_' with self.app_or_project, substitute it for prefix. call the method tempfile.mkdtemp with 2 arguments: prefix set to prefix, suffix set to string '_extract', substitute the result for tempdir. append tempdir to self.self.paths_to_remove. if self.verbosity is greater or equal to integer 2. substitute '%s' in string "Extracting %s\n" with filename, write it to self.stdout stream. try, call the method archive.extract with arguments: filename and tempdir. return tempdir. if archive.ArchiveException or IOError, renamed to e, exception are caught, raise an CommandError with an argument string "couldn't extract file %s to %s: %s", where '%s' is replaced with filename, tempdir and e. define the method is_url with arguments self and template. if character ':' is not contained in template, return boolean False. split template once at the first character ':', convert the first element to lowercase and substitute it for scheme. if scheme is countaine in self.url_schemes return boolean True, otherwise return False. define the method make_writeable with arguments self and filename. if sys.platform starts with string 'java', return nothing. if call to the method os.access with arguments: filename and os.W_OK, evaluates to false, call the function os.stat with an argument filename, substitute the result for st. call the method stat.S_IMODE with an argument st.st_mode, calculate binary OR with the result and stat.S_IWUSR, as operands, substitute the result for new_permission. call the function os.chmod wiht arguments filename and new_permissions. from __future__ import unicode_literals into default name space. import module os. from subprocess import PIPE and Popen into default name space. import module sys. from django.utils.encoding import force_text and DEFAULT_LOCALE_ENCODING into default name space. from django.utils import six into default name space. from .base import CommandError into default name space. define the function popen_wrapper with 2 arguments: args and os_err_exc_type set to CommandError. try, p is a instance of Popen class, created with 6 arguments: args, shell set to boolean False, stdout set to PIPE, stderr set to PIPE, close_fds set to boolean True is os.name is not equal to 'nt', universal_newlines set to boolean True. if OSError, renamed to e, exception is caught, call the force_text function with 3 arguments: e.strerror, DEFAULT_LOCALE_ENCODING and strings_only set to boolean True. call the method six.reraise 3 with arguments: os_err_exc_type, return value of the function os_err_exc_type, called with string as an argument 'Error executing %s: %s', where '%s' is replaced by: first element of args and strerror, respective, and third element of the result of the function sys.exc_info. call the method p.communicate, assign the result to output and errors, respectively. return a tuple containing 3 entries: output, result of the function force_text, called with 3 arguments: errors, DEFAULT_LOCALE_ENCODING and strings_only set to boolean True and p.returncode. define the function handle_extensions with 2 arguments: extensions set to tuple containing string 'html' and ignored set to tuple containing string 'py'. ext_list is an empty list, for every ext in extensions, delete all the whitespaces from ext, split it by ',' character, extend ext_list with the result. for every i and ext in enumerated iterable ext_list, if ext doesnt start with '.' character, prepend '.' to the i-th element of the ext_list. if striped x by '.' character is not contained in ignored, for every x in ext_list put x into a set, return the resulting set. define the function find_command with 3 arguments: cmd, path set to None and pathext set to None. if path is None, call the function os.environ.get with 2 arguments: string 'PATH' and an empty string, split the result at the os.pathsep, substitute the result for path. if path is an instance of six.string_types, path is an list containing path. if pathext is None, call the method os.environ.get with 2 arguments: strings 'PATHEXT' and '.COM;.EXE;.BAT;.CMD', split the result at os.pathsep, substitute it for pathext. for ext in pathext, if cmd ends with ext, pathext is an list containing an empty string. break the loop execution. for every p in path, join p and cmd into a file path, substitute it for f. if f is a file, return f. for every ext in pathext, add ext to f, substitute the result for fext. if fext is a file, return fext. return None. import module collections. from math import ceil into default name space. from django.utils import six into default name space. derive the class InvalidPage from the Exception base class. do nothing. derive the class PageNotAnInteger from the InvalidPage base class. do nothing. derive the class EmptyPage from the InvalidPage base class. do nothing. derive the class Paginator from the object base class. def the method __init__ with 5 arguments: self, object_list, per_page, orphans set to integer 0 and allow_empty_first_page set to boolean True. substitute object_list for self.object_list. convert per_page into an integer and substitute it for self.per_page. convert orphans into an integer and substitute it for self.orphans. substitute allow_empty_first_page for self.allow_empty_first_page. self._num_pages and self._count are None. define the method validate_number with self class instance and number as arguments. try, convert number into an integer and substitute it for number if TypeError or ValueError exceptions are caught, raise an exception PageNotAnInteger with string 'That page number is not an integer' as an argument. if number is lesser than integer 1, raise an EmptyPage exception with string 'That page number is less than 1' as an argument. if number is greater than self.num_pages, if number equals a integer 1 and self.allow_empty_first_page is true, do nothing. if not, raise an EmptyPage exception with string 'That page contains no results' as an argument. return number. define the method page with self class instance and number as arguments. call the method self.validate_number with an argument number, substitute it for number. decrement number by one, multiply it with self.per_page, substitute the result for bottom. sum bottom and self.per_page, substitute the result for top. if sum of the top and self.orphans is greater or equal to self.count, substitute self.count for top. call the self._get_pages method with 3 arguments: self.object_list from the bottom to the top index, number and self, return the result. define the method _get_page with self class instance, unpacked list args and unpacked dictionary kwargs as arguments. return a instance of the class Page, created with 2 arguments: unpacked list args and unpacked dictionary kwargs. define the method _get_count with an argument self. if self._count is None, try, substitute the return value of the method self.object_list.count for self._count. if TypeError or AttributeError exceptions are caught, substitute length of self.object_list for self._count. return self._count. count is a property object with _get_count as a getter method. define the method _get_num_pages with an argument self. if self._num_pages is None, if self.count equals a integer 0 and self.allow_empty_first_page is false, self._num_pages is a integer 0. if not, get greater value between integer 1 and result of subtraction of self.orphans from self.count, substitute it for hits. divide hits by a floating point number self.per_page, convert its ceiling value to an integer and substitute it for self._num_pages. return self._num_pages. num_pages is a property object with _get_num_pages as a getter method. define the method _get_page_range with an argument self. return all the integers from the integer 1 to the self.num_pages. page_range is a property object with _get_page_range as a getter method. substitute Paginator for QuerySetPaginator. derive the class Page from the collections.Sequence base class. define the method __init__ with 4 arguments: self, object_list, number, and paginator. substitute object_list for self.object_list. substitute number for self.number. substitute paginator for self.paginator. define the method __repr__ with an argument self. return the string '', with occurrences of '%s' replaced by self.number and self.paginator.num_pages, respectively. define the method __len__ with an argument self. return the length of self.object_list. define the method __getitem__ with arguments self and index. if index is not an instance of six.integer_types or tuple type, raise a TypeError exception, if self.object is not an instance of list type, convert self.object_list to a list. return self.object_list element at index. define the method has_next with an argument self. if self.number is lesser than self.paginator.num_pages, return boolean True, otherwise return boolean False. define the method has_previous with an argument self. if self.number is greater than integer 1, return boolean True, otherwise return boolean False. define the method has_other_pages with an argument self. call the method self.has_previous, if it evaluate to false, call the self.has_next method, return the result. define the method next_page_number with an argument self. call the method self.paginator.validate_number with self.number incremented by 1 as argument, return the result. define the method previous_page_number with an argument self. call the method self.paginator.validate_number with self.number decremented by 1 as argument, return the result. define the method start_index with an argument self. if self.paginator.count equals a integer 0, return integer 0. decrement self.number by one, multiply it by self.paginator.per_page, increment the result by one, return it. define the method end_index with an argument self. if self.number equals to self.paginator.num_pages, return self.paginator.count. multiply self.number and self.paginator.per_page, return the result. import module importlib. from django.conf import settings into default name space. from django.utils import six into default name space. from django.core.serializers.base import SerializerDoesNotExist into default name space. BUILTIN_SERIALIZERS is a dictionary containing 4 inital entries: "django.core.serializers.xml_serializer" for "xml", "django.core.serializers.python" for "python", "django.core.serializers.json" for "json", and "django.core.serializers.pyyaml" for "yaml". _serializers is an empty dictionary. derive the class BadSerializer from the object base class. internal_use_only is boolean False. define the __init__method with arguments self and exception. substitute exception for self.exception. define the __call__method with arguments self, unpacked list args and unpacked dictionary kwargs. raise an self.exception exception. define the function register_serializer with 3 arguments: format, serializer_module and serializers set to None. if serializers is None and _serializers is false, call the function _load_serializers. try, call the function importlib.import_module with an argument serializer_module, substitute it for module. if ImportError, renamed to exc, exception is caught, ba_serializer is a instance of BadSerializer class, created with an argument exc. create a instance of a class BadSerializerModule from the object base class, with elements Deserializer set to bad_serializer and Serializer set to bad_serializer. if serializers is None, substitute module for the value under the format key of the _serializers dictionary. if not, substitute module for the value under the format key of the serializers dictionary. define the function unregister_serializer with an argument format. if _serializers is false, call the function _load_serializers. if format is not contained in _serializers, raise a SerializerDoesNotExist exception with an argument format. delete the _serializers dictionary entry at the format key. define the function get_serializer with an argument format. if _serializers is false, call the function _load_serializers. if format is not contained in _serializers, raise a SerializerDoesNotExist exception with an argument format. get the value under the format key of the _serializers dictionary, return the Serializer filed of the result. define the function get_serializer_formats. if _serializers is false, call the function _load_serializers. convert _serializers into a list, return it. define the function get_public_serializer_formats. f _serializers is false, call the function _load_serializers. append k into a list for every k and v in return value of the six.iteritems function with an argument _serializers, only if v.Serializer.internal_use_only is false, return the resulting list. define the function get_deserializer with an argument format. f _serializers is false, call the function _load_serializers. if format is not contained in _serializers, raise a SerializerDoesNotExist exception with an argument format. get the value under the format key of the _serializers dictionary, return the Deserializer filed of the result. define the function serializer with 3 arguments: format, queryset and unpacked dictionary options. call the get_serializer function with an argument format, call the return value object and substitute it for s. call the s.serialize method with arguments queryset and unpacked dictionary options. evaluate the method s.getvalue, return the result. define the function deserialize with 3 arguments: format, stream_or_string and unpacked dictionary options. call the get_deserializer function with an argument format, substitute the result for d. call the object d with arguments stream_or_string and unpacked dictionary options, return the result. define the function _load_serializers. use the global variable _serializers. serializers is an empty dictionary. for every format in BUILTIN_SERIALIZERS, call the function register_serializer with 3 arguments: format, value under the format key of the BUILTIN_SERIALIZERS dictionary and serializers. if setting has an "SERIALIZATION_MODULES" attribute, for every format in settings.SERIALIZATION_MODULES, call the function register_serializer with 3 arguments: format, value under the format key of the settings.SERIALIZATION_MODULES dictionary and serializers. substitute serializers for _serializers. import module warnings. from django.db import models into default name space. from django.utils import six into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. derive the class SerializerDoesNotExist from the KeyError base class. do nothing. derive the class SerializationError from the Exception base class. do nothing. derive the class DeserializationError from the Exception base class. do nothing. derive the class Serializer from the object base class. internal_use_only is a boolean False. define the method serialize with 3 arguments: self, queryset and unpacked dictionary options. substitute options for self.options. remove the 'stream' key from the options dictionary and substitute it for self.stream, if the key doesnt exists call the six.String function and substitute the result for self.stream. remove the 'fields' key from the options dictionary and substitute it for self.selected_fields, if the key doesnt exists substitute None for self.selected_fields. remove the 'use_natural_keys' key from the options dictionary and substitute it for self.use_natural_keys, if the key doesnt exists substitute boolean False for self.use_natural_keys. if self.use_natural_keys is true, call the function warnings.warn with 2 arguments: string "``use_natural_keys`` is deprecated; use ``use_natural_foreign_keys`` instead." and RemovedInDjango19Warning. remove the 'use_natural_primary_keys' key from the options dictionary and substitute it for self.use_natural_foreign_keys, if the key doesnt exists substitute self.use_natural_keys for self.use_natural_foreign_keys. remove the 'use_natural_primary_keys' key from the options dictionary and substitute it for self.use_natural_primary_keys, if the key doesnt exists substitute boolean False for self.use_natural_primary_keys. call the method self.start_serialization self.first is boolean True. for every obj in queryset, call the self.start_object with an argument obj. substitute obj._meta.concrete_model for concrete_model. for every field in concrete_model._meta.local_fields, if field.serialize is true, if field.rel is None, if self.selected_fields is None or field.attname is contained in self.selected_fields call the method self.handle_field with arguments obj and filed. if not, if self.selected_fields is None or last three elements of field.attname are contained in self.selected_fields: call the method self.handle_fk_field with arguments obj and field. for every field in concrete_model._meta.many_to_many, if field.serialize is true, if self.selected_fields is None or field.attname is contained in self.selected_fields, call the method self.handle_m2m_field with arguments obj and filed. call the method self.end_object with an argument obj. if self.first is true, self.first is boolean False. call the method self.end_serialization. call the method self.getvalue, return the result. define the method start_serialization with an argument self. raise a NotImplementedError with an argument string 'subclasses of Serializer must provide a start_serialization() method'. define the method end_serialization with an argument self. do nothing. define the method start_object with argument self and obj. raise a NotImplementedError with an argument string 'subclasses of Serializer must provide a start_object() method'. define the method end_object with argument self and obj. do nothing. define the method handle_field with argument self, obj and field. raise a NotImplementedError with an argument string define the method handle_fk_field with argument self, obj and field. raise a NotImplementedError with an argument string define the method handle_m2m_field with argument self, obj and field. raise a NotImplementedError with an argument string 'subclasses of Serializer must provide an handle_m2m_field() method'. define the method getvalue with an argument self. get 'getvalue' attribute of the self.stream object, if it exists and is callable, evaluate self.stream.getvalue method, return the result. derive the class Deserializer from the six.Iterator base class. define the method __init__, with 3 arguments: self, stream_or_string and unpacked dictionary options. substitute options for self.options. if stream_or_string is an instance of six.string_types type. call the function six.StringIO with an argument stream_or_string, substitute the result for self.stream. if not, substitute stream_or_string for self.stream. define the method __iter__ with an argument self. return self. define the method __next__ with an argument self. raise a NotImplementedError with an argument string 'subclasses of Deserializer must provide a __next__() method'. derive the class DeserializedObject from the object base class. define the method __init__, with 3 arguments: self, m2m and data set None. substitute obj for self.object. substitute m2m_data for self.m2m_data. define the method __repr__ with an argument self. return a string "", where '%s' are replaced with self.object._meta.app_label, self.object._meta.object_name and self.object.pk, respectively. define the method save, with 3 arguments: self, save_m2m set to boolean True and using set to boolean True. call the models.Model.save_base method with arguments self.object, using as using and raw set to boolean True. if self.m2m.data and save_m2m are true, for every accessor_name and object_list is return value of the method self.m2m_data.items. set accessor_name of the self.object to object_list. self.m2m_data is None. define the function build_instance with 3 arguments: Model, data and db. obj is an instance of Model class, created with an unpacked dictionary data as argument. if obj.pk is None, and Model has an 'natural_key' attribute, and Model._default_manager has and 'get_by_natural_key', call the method obj.natural_key, substitute the result for natural_key. try, call the method Model._default_manager.db_manager with an argument db, on the result call the get_by_natural_key with, an unpacked list natural_key as argument, substitute the pk filed of the resulting object for obj.pk. if Model.DoesNotExist exception is caught, do nothing. return obj. from __future__ import absolute_import into default name space. from __future__ import unicode_literals into default name space. import module datetime. import module decimal. import module json. import module sys. from django.core.serializers.base import DeserializationError into default name space. from django.core.serializers.python import Serializer as PythonSerializer into default name space. from django.core.serializers.python import Deserializer as PythonDeserializer into default name space. from django.utils import six into default name space. from django.utils.timezone import is_aware into default name space. define the class Serializer from the PythonSerializer base class. internal_use_only is boolean False. define the method start_serialization with an argument self. call the method json.__version__.split with an argument '.', if the result is respectively greater than list containing strings '2', '1' and '3', call the method self.options.update with dictionary as an argument, containing 1 element: boolean False for 'use_decimal'. self._current is None. call the method self.options.copy, substitute the result for self.json_kwargs. remove the entry under the 'stream' key of the self.json_kwargs dictionary. remove the entry under the 'fields' key of the self.json_kwargs dictionary. get the value under the 'indent' key of self.options dictionary, if it is true, substitute a tuple with 2 elements: characters ',' and ': ' for value under the 'separators' key of the self.json_kwargs dictionary. write a '[' to the self.stream file stream. define the method end_serialization with an argument self. if value under the 'indent' key of the self.options dictionary is true, write a new line to the self.stream file stream. write ']' to the self.stream file stream. if value under the 'indent' key of the self.options dictionary is true, write a new line to the self.stream file stream. define the method end_object with arguments self and obj. get the value under the 'indent' key of the self.options dictionary, substitute it for indent. if self.first is false, write ',' to the self.stream file stream. if indent is false, write a white space to the self.stream file stream. if indent is true, write new line to the self.stream file stream. call the json.dump function with 4 arguments: return value of the method self.get_dump_object called with an argument obj, self.stream, cls set to DjangoJSONEncoder and unpacked dictionary self.json_kwargs. self._current is None. define the method getvalue with an argument self. call the getvalue method from the base class of the class PythonSerializer, return the result. define the function Deserializer with arguments stream_or_string and unpacked dictionary options. if stream_or_string is not an instance of bytes or six.string_types, call the stream_or_string.read function, substitute the result for stream_or_string. if stream_or_string is instance of bytes type, call the method stream_or_string.decode with an argument string 'utf-8', substitute the result for stream_or_string. try, call the function json.loads with an argument stream_or_string, substitute the result for objects. for every obj in PythonDeserializer called with arguments objects and unpacked dictionary options, yield obj as generator return value, if GeneratorExit exception is caught, raise an exception, if Exception, renamed to e, exception is caught, call the six.reraise function with 3 arguments: DeserializationError, DeserializationError called with an argument e, third element of the return value of the function sys.exc_info. define the class DjangoJSONEncoder from the json.JSONEncoder base class. define the method defalt with arguments self and o. if o is an instance of datetime.datetime object. call the method o.isoformat substitute the result for r. if o.microsecond is true, remove 3 elements from r starting at the index 23. if r ends with string '+00:00', cut the last 6 elemetns from r, append character 'Z' to it, substitute the result for r. return r. otherwise if o is an instance of datetime.date object, call the method o.isoformat, return the result. otherwise if o is an instance of datetime.time object, call the function is_aware with an argument o, if it evaluates to true, raise a ValueError exception with an argument string "JSON can't represent timezone-aware times.". call the method o.isoformat substitute the result for r. if o.microsecond is true, substitute first 12 elements of r for r. return r. otherwise if o is an instance of decimal.Decimal object, convert o to an string, return it. if not, call the method default with an argument o from the base class of the class DjangoJSONEncoder, return the result. substitute DjangoJSONEncoder for DateTimeAwareJSONEncoder. from __future__ import unicode_literals into default name space. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core.serializers import base into default name space. from django.db import models and DEFAULT_DB_ALIAS into default name space. from django.utils.encoding import smart_text and is_protected_type into default name space. from django.utils import six into default name space. derive Serializer from the base.Serializer base class. internal_use_only is boolean True. define the method start_serialization with an argument self. self._current is None. self.objects is an empty list. define the method end_serialization with an argument self. do nothing. define the method start_object with arguments self and obj. self.current is an empty dictionary. define the method end_object with arguments self and obj. call the self.get_dum_object method with an argument obj, use the result as an argument for the self.objects.append method. self._current is None. define the method get_dump_object with arguments self and obj. data is an dictionary with 2 initial entries: return value of the smart_text function with the argument obj._meta for 'model', and self._current for 'fields'. if self.use_natural_primary_keys is false or obj doesnt have a 'natural_key' attribute. call the smart_text function with 2 arguments: return value of the obj._get_pk_val function and string_only set to boolean True, substitute it for value under the 'pk' key of data dictionary. return data. define handle_field method with self, obj and field arguments. call the method field._get_val_from_obj with obj argument, substitute the result for value. call the function is_protected_type with an argument value, if it evaluates to true, substitute value for field.name key of self._current dictionary. if not, call the function field.value_to_string with an argument obj, substitute the result for value under the field.name key of self._current dictionary. define the method handle_fk_field with self, obj and field arguments. if self.use_natural_foreign_keys is true and field.rel.to has an 'natural_key' attribute. get field.name from the obj, substitute it for related. if related is true, call the method related.natural_key, substitute the result for value. if not, value is None. if not, get return value of the field.get_attname function attribute of the obj object, substitute it for value. substitute value for value under the field.name key of the self._current dictionary. define the method handle_m2m_field with self, obj and field arguments. if field.rel.through._meta.auto_created is true, if self.use_natural_foreign_keys is true and field.rel.to has an 'natural_key' attribute, m2m_value is an lambda function with value as an argument, return value is the result of the method value.natural_key. if not, m2m_value is a lambda function with an argument value, return value is the result of the function smart_text called with arguments: return value of the value._get_pk_val method and strings_only set to boolean True. call the function m2m_value with the argument related, for every related in itterator object generated from the attribute field.name, of the obj object, append the results in a list, substitute it for value under the field.name key of the self._current dictionary. define the method getvalue with an argument self. return self.objects. define the function Deserializer with arguments object_list and unpacked dictionary options. remove the value under the 'using' key from the options dictionary, assign it to the db, if the entry doesnt exists, substitute DEFAULT_DB_ALIAS for db. remove the value under the 'ignorenonexistent' key from the options dictionary, assign it to the ignore, if the entry doesnt exists, substitute boolean False for ignore. for every d in object_list, try, call the function _get_model with an argument value under the 'model' key of the d dictionary, substitute the result for Model. if base.DeserializationError exception is caught, if ignore is true, skip this loop iteration, if not, raise an exception. data is an empty dictionary, if 'pk' is contained in d, call the method Model._meta.pk.to_python with one argument: value under the 'pk' key of dictionary d, or None if previous doesnt exists, substitute the result for the value under the Model._meta.pk.attname key of data dictionary. m2m_data is an empty dictionary. call the method Model._meta.get_all_field_names, substitute the result for model_fields. for every field_name and field_value in return value of the function six.iteritems called with value under the 'fields' key of dictionary d, if ignore is true and field_name is not contained in model_fields, skip this loop iteration, if field_value is an instance of the str type, call the smart_text function with 3 arguments: field_value, value under the 'encoding' key of the options dictionary or, settings.DEFAULT_CHARSET if the key doesnt exists and strings_only set to boolean True. call the Model._meta.get_field method with an argument field_name, substitute the result for field. if field.rel is true, and field.rel is an instance of models.ManyToManyRel, if field.rel.to._default_manager has an attribute 'get_by_natural_key', define the function m2m_convert with an argument value. if value has an attribute '__iter__' and value is not an instance of six.text_type, call the method field.rel.to._default_manager.db_manager with an argument db on the return value call the method get_by_natural_key, with unpacked list value as an argument, return the pk field of the result. if not, call the method field.rel.to._meta.pk.to_python with an argument value, use the result as an argument for the call to the, smart_text function, return the result. if not, m2m_convert is a lambda function with an argument v, return value is the result of the function smart_text called with an argument: return value of the method field.rel.to._meta.pk.to_python called with an argument v. call the m2m_convert function with pk as argument, for every pk in field_value, substitute the value under the field.name key of the m2m_data dictionary. otherwise if field.rel is true and field.rel is an instance of the models.ManyToOneRel object, if field_value is not None, if field.rel.to._default_manager has an 'get_by_natural_key' attribute, if field_value has an attribute '__iter__' and is not an instance of six.text_type object, call the method field.rel.to._default_manager.db_manager with db as argument, call the get_by_natural_key method on the result with, unpacked list field_value as an argument, substitute the result for obj. get field.rel.field_name attribute of the object obj, substitute it for value. if field.rel.to._meta.pk.rel is true, substitute value.pk for value. if not, all the method field.rel.to._meta.get_field with field.rel.field_name as argument, call the to_python method on the result with, unpacked list field_value as an argument, substitute the result for value. substitute value for value under the field.attname key of the data dictionary. if not, all the method field.rel.to._meta.get_field with field.rel.field_name as argument, call the to_python method on the result with, unpacked list field_value as an argument, substitute the result for value of under the field.attname key of the data dictionary. if not, value under the field.attname key of the data dictionary is None. if not, call the field.to_python method with field_value, substitute the result for field.name key of the data dictionary. call the method base.build_instance with arguments Model, data and db, substitute the result for obj. call the function base.DeserializedObject with obj and m2m_data as arguments, yield the result as the generator return value. define the function _get_model with an argument model_identifier. try, call the method apps.get_model with an argument model_identifier. if LookupError or TypeError exceptions are caught, raise an base.DeserializationError exception with an argument string "Invalid model identifier: '%s'", where '%s' is replaced with model_identifier. import module decimal. import module yaml. import module sys. from io import StringIO into default name space. from django.db import models into default name space. from django.core.serializers.base import DeserializationError into default name space. from django.core.serializers.python import Serializer as PythonSerializer into default name space. from django.core.serializers.python import Deserializer as PythonDeserializer into default name space. from django.utils import six into default name space. try, from yaml import CSafeLoader as SafeLoader into default name space. yaml import CSafeDumper as SafeDumper into default name space. if ImportError exception is caught, from yaml import SafeLoader, SafeDumper into default name space. derive the class DjangoSafeDumper from the SafeDumper base class. define the method represent_decimal with arguments self and data. call the method self.represent_scalar with 2 arguments: string 'tag:yaml.org,2002:str' and data converted into a string, return the result. call the method DjangoSafeDumper.add_representer with arguments decimal.Decimal and DjangoSafeDumper.represent_decimal. derive the class Serializer from the PythonSerializer base class. internal_use_only is a boolean False. define the method handle_field with arguments self, obj and field. if field is an instance of models.TimeField and filed.name attribute of obj is not None, get field.name attribute of obj, convert it to a string, substitute it for the value under the filed.name key of self._current dictionary. if not, call the handle_filed method of the base class of the Serializer class, with arguments obj and field. define the method end_serialization with an argument self. call the function yaml.dump with 4 arguments: self.objects, self.stream, Dumper=DjangoSafeDumper and unpacked dictionary self.options. define the method getvalue with an argument self. call the getvalue method of the base class of the PythonSerializer class, return the result. define the function Deserializer with 2 arguments: stream_or_string and unpacked dictionary options. if stream_or_string is an instance of bytes, call the method stream_or_string.decode with string 'utf-8' as argument, substitute the result for stream_or_string. if stream_or_string is an instance of the six.string_types, call the function StringIO with an argument stream_or_string, substitute the result for stream. if not, substitute stream_or_string for stream. try, for every obj in return value of the PythonDeserializer created with 2 arguments: return value of the function yaml.load, with 2 arguments: stream and Loader set to SafeLoader, and unpacked dictionary options, yield one element of the itterable obj. if exception GeneratorExit is caught, raise an exception. if Exception, renamed to e, exception is caught, call the function six.reraise with 3 arguments: DeserializationError, return value of the DeserializationError called with an argument e, from __future__ import unicode_literals into default name space. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core.serializers import base into default name space. from django.db import models and DEFAULT_DB_ALIAS into default name space. from django.utils.xmlutils import SimplerXMLGenerator into default name space. from django.utils.encoding import smart_text into default name space. from xml.dom import pulldom into default name space. from xml.sax import handler into default name space. from xml.sax.expatreader import ExpatParser as _ExpatParser into default name space. derive the class Serializer from the base.Serializer base class. define the method indent with argument self and level. if value under the 'indend' key of the options dictionary exists and is not None, get the value under the 'indent' key of the options dictionary, multiply it with level, create a string containing number of whitespaces equal to the previous result, append it to the string containing newline character, use the result as the argument for the call to the self.xml.ignorableWhitespace method. define the method start_serialization with an argument self. self.xml is a instance of SimplerXMLGenerator class created with 2 arguments: self.stream and value under the 'encoding' key of the options dictionary, if the key doesnt exists use settings.DEFAULT_CHARSET instead. call the self.xml.startDocument method. call the method self.xml.startElement with 2 arguments, string "django-objects" and a dictionary containing 1 element: "1.0" for "version". define the method end_serialization with an argument self. call the self.indent method with integer 0 as an argument. call the method self.xml.endElement with an argument string "django-objects". call the self.xml.endDocument method. define the method start_object with arguments self and obj. if '_meta' is not an attribute of obj, raise an base.SerializationError exception with argument string "Non-model object (%s) encountered during serialization", replace '%s' with type of the obj object. call the method self.indent with argument integer 1. attrs is a dictionary containing 1 entry: return value of the smart_text function with argument obj._meta for 'model'. if self.use_natural_primary_keys is false and obj doesnt have 'natural_key' argument. substitute return value of the method obj._get_pk_val for obj_pk. if obj_pk is not None, substitute the return value of the smart_text function with an argument obj_pk for the value under the 'pk' key of the attrs dictionary. call the method self.xml.startElement with arguments string 'object' and attrs. define the method end_object with arguments self and obj. call the method self.indent with argument integer 1. call the method self.xml.endElement with an argument string 'object'. define the method handle_field with arguments self, obj and field. call the method self.indent with argument integer 2. call the method self.xml.startElement with 2 arguments: string 'field' and a dictionary containing 2 entries: field.name for 'name', and return value of the field.get_internal_type method for 'type'. if field.name attribute of obj is not None, call the method field.value_to_string with an argument obj, use the result as an argument for the call the method self.xml.characters. if not, call the method self.xml.addQuickElement with an argument string 'None'. call the method self.xml.endElement with an argument string 'field' define the method handle_fk_field with arguments self, obj and field. call the method self._start_relational_field with an argument field. evaluate the field.get_attname, use the result as the name of the obj attribute to get, substitute it for related_att. if related_att is not None, if self.use_natural_foreign_keys is true and field.rel.to has an attribute 'natural_key', get field.name attribute of the obj, substitute it for related. call the method related.natural_key, substitute the result for related. for every key_value in related, call the method self.xml.startElement with arguments string 'natural' and an empty dictionary. call the function smart_text with argument key_value, use the result as an argument for the call to the self.xml.characters method. call the method self.xml.endElement with an argument string 'natural' if not, call the function smart_text with argument related_att, use the result as an argument for the call to the self.xml.characters method. if not, call the method self.xml.addQuickElement with an argument string 'None'. call the method self.xml.endElement with an argument string 'field'. define the method handle_m2m_field with arguments self, obj and field. if field.rel.through._meta.auto_created is true, call the method self._start_relational_field with the argument field. if self.use_natural_foreign_keys is true and field.rel.to has an attribute 'natural_key', define the function handle_m2m with an argument value, call the value.natural_key method, substitute the result for natural. call the method self.xml.startElement with argument string 'object' and an empty dictionary. for every key_value in natural, call the method self.xml.startElement with argument string 'natural' and an empty dictionary. call the function smart_text with argument key_value, use the result as an argument for the call to the self.xml.characters method. call the method self.xml.startElement with an argument string 'natural'. call the method self.xml.startElement with an argument string 'object'. if not, define the function handle_m2m with an argument value, call the self.xml.addQuickElement method with 2 arguments: string 'object' and attr dictionary containing 1 entry: return value of the function smart_text with return value of the method value._get_pk_val as an argument for 'pk'. for every relobj in iterator generated from the field.name attribute of the obj object. call the function handle_m2m with an argument relobj. call the method self.xml.endElement with an argument string 'field'. define the method _start_relational_field with arguments self and field. call the method self.indent with argument integer 2. call the method self.xml.startElement with 2 arguments: string 'field' and dictionary containing 3 entries: field.name for 'name', field.rel.__class__.__name__ for 'rel' and return value of the function smart_text with an argument field.rel.to._meta for 'to'. derive the class Deserializer from the base.Deserializer base class. define the method __init__ with 3 arguments: self, stream_or_string and unpacked dictionary options. call the method __init__ from the base class of the Deserializer class with arguments stream_or_string and unpacked dictionary options. call the method pulldom.parse with arguments: self.stream and return value of the method self._make_parser, substitute the result for self.event_stream. remove the 'using' key from the options dictionary, substitute the return value for self.db, if the key doesnt exists substitute DEFAULT_DB_ALIAS for self.db. remove the 'ignorenonexistent' key from the options dictionary, substitute the return value for self.db, if the key doesnt exists substitute boolean False for self.ignore. define the method _make_parser with an argument self. return the instance of DefusedExpatParser class. define the method __next__ with an argument self. for every event and node in self.event_stream, if event equals a string "START_ELEMENT" and node.nodeName equals a string 'object', call the method self.event_stream.expandNode with an argument node. call the method self._handle_object with an argument node, return the result. raise an StopIteration exception. define the method _handle_object with arguments self and node. call the method self._get_model_from_node with arguments node and string 'model'. data is an empty dictionary. call the method node.hasAttribute with string 'pk' as an argument, if it evaluates to true, call the method node.getAttribute with an argument string 'pk', use the result as the argument for the call to the method, Model._meta.pk.to_python with, substitute the result for value under the Model._meta.pk.attname key of the data dictionary. m2m_data is an empty dictionary. call the method Model._meta.get_all_field_names, substitute the result for model_fields. for every field_node in return value of the method node.getElementsByTagName with an argument string 'field'. call the method field_node.getAttribute with an argument string 'name', substitute the result for field_name. if field_name is false, raise an base.DeserializationError exception with string " node is missing the 'name' attribute" as argument. if self.ignore is true and field_name is not contained in model_fields, skip this loop iteration. call the method Model._meta.get_field with an argument field_name, substitute it for field. if field.rel is true and field.rel is an instance of models.ManyToManyRel, call the method self._handle_m2m_field_node with an argument field_node and field, substitute the result for value under the field.name key of m2m_data dictionary. otherwise, if field.rel is true and field.rel is an instance of models.ManyToOneRel, call the method self._handle_fk_field_node with field_node and field as arguments, substitute the result for the value under the field.attname of the data dictionary. if not, call the method field_node.getElementsByTagName with an argument string 'None', if it evaluates to true, value is None. if not, call the function getInnerText with argument field_node, on the result call the method strip, use the result as an argument for the call to the field.to_python method, substitute the result for value. substitute value for value under the field.name key of the data dictionary. call the method base.build_instance with arguments Model, data and self.db, substitute the result for obj. call the method base.DeserializedObject with arguments obj and m2m_data, return the result. define the method _handle_fk_field_node with arguments self, node and field. call the method node.getElementsByTagName with an argument string 'None', if it evaluates to true, return None. if not, if field.rel.to._default_manager has an atttribute 'get_by_natural_key', call the method node.getElementsByTagName with the argument string 'natural', substitute the result for keys. if keys is true, call the function getInnerText with argument k, on the result call the method strip, for every k in keys, append the results to field_value list. call the method field.rel.to._default_manager.db_manager with an argument self.db, on the result call the method get_by_natural_key, with unpacked list field_value as an argument, substitute the result for obj. get the field.rel.field_name from the obj, substitute it for obj_pk. if field.rel.to._meta.pk.rel is true, substitute obj_pk.pk for obj_pk. if not, call the function getInnerText with an argument node, call the strip method on the result, substitute the result for field_value. call the field.rel.to._meta.get_field method with an field.rel.field_name argument, on the result call the method to_python, with field_value as an argument, substitute the result for obj_pk. return obj_pk. if not, call the function getInnerText with an argument node, call the strip method on the result, substitute the result for field_value. call the field.rel.to._meta.get_field method with an field.rel.field_name argument, on the result call the method to_python, with field_value as an argument, return the result. define the method _handle_m2m_field_node with arguments self, node and field. if field.rel.to._default_manager has an attribute 'get_by_natural_key', define the function m2m_convert with an argument n, call the method n.getElementsByTagName with string 'natural' as argument, substitute result for keys. if keys is true, call the function getInnerText with argument k, on the result call the method strip, for every k in keys, append the results to field_value list. call the method field.rel.to._default_manager.db_manager with an argument self.db, on the result call the method get_by_natural_key, with unpacked list field_value as an argument, substitute the field pk of the result for obj_pk. if not, call the method n.getAttribute with string 'pk' as argument, use the result as an argument for the call to the field.rel.to._meta.pk.to_python method, substitute the result for obj_pk. return obj_pk. if not, m2m_convert is an lambda function with an argument n, return value is the return value of the method field.rel.to._meta.pk.to_python, called with n.getAttribute('pk') method. call the m2m_convert function with an argument c, for every c in return value of the method node.getElementsByTagName, with an argument string 'object', return the result. define the method _get_model_from_node with arguments self, node and attr. call the method node.getAttribute with an argument attr, substitute the result for model_identifier. if model_identifier is false, raise an base.DeserializationError exception with an argument string "<%s> node is missing the required '%s' attribute", where '%s' is replaced with node.nodeName and attr. try, call the method apps.get_model with an argument model_identifier, return the result. if LookupError or TypeError exceptions are caught, raise an base.DeserializationError exception with an argument string "<%s> node has invalid model identifier: '%s'", where '%s' is replaced with node.nodeName and attr. define the function getInnerText with an argument node. inner_text is an empty list. for every child in node.childNodes, if child.nodeType equals to child.TEXT_NODE or child.nodeType equals to child.CDATA_SECTION_NODE, append child.data to the inner_text list. otherwise if child.nodeType equals to child.ELEMENT_NODE, call the function getInnerText with an argument child, use the result as an argument for the call to the method inner_text.extend. if not, do nothing. join inner_text elements into a string. derive the class DefusedExpatParser from the _ExpatParser base class. define the method __init__ with arguments self, unpacked list args and unpacked dictionary kwargs. call the method _ExpatParser.__init__ with arguments self, unpacked list args and unpacked dictionary kwargs. call the method self.setFeature with 2 arguments: handler.feature_external_ges and boolean False. call the method self.setFeature with 2 arguments: handler.feature_external_pes and boolean False. define the method start_doctype_decl with an arguments self, name, sysid, pubid and has_internal_subset. raise an DTDForbidden exception with arguments name, sysid and pubid. define the method entity_decl with arguments self, name, is_parameter_entity, value, base, sysid, pubid and notation_name. raise an EntitiesForbidden exception with arguments name, value, base, sysid, pubid and notation_name. define the method unparsed_entity_decl with arguments self, name, base, sysid, pubid and notation_name. raise an EntitiesForbidden exception with arguments name, None, base, sysid, pubid and notation_name. define the method external_entity_ref_handler with arguments self, context, base, sysid and pubid. raise an ExternalReferenceForbidden exception with arguments context, base, sysid and pubid. define the method reset with an argument self. call the method _ExpatParser.reset with an argumen sefl. substitute self._parser for parser. substitute self.start_doctype_decl for parser.StartDoctypeDeclHandler. substitute self.entity_decl for parser.EntityDeclHandler. substitute self.unparsed_entity_decl for parser.UnparsedEntityDeclHandler. substitute self.external_entity_ref_handler for parser.ExternalEntityRefHandler. derive the class DefusedXmlException from the ValueError base class. define the method __repr__ with an argument self. convert self into a string and return it. derive the class DTDForbidden from the DefusedXmlException base class. define the method __init__ with arguments self, name, sysid and pubid. call the method __init__ from the base class of the DTDForbidden class. substitute name for self.name. substitute sysid for self.sysid. substitute pubid for self.pubid. define the method __str__ with an argument self. tpl is an string "DTDForbidden(name='{}', system_id={!r}, public_id={!r})". call the method tpl.format with an arguments self.name, self.sysid and self.pubid. derive the class EntitiesForbidden from the DefusedXmlException base class. define the method __init__ with arguments self, name, value, base, sysid, pubid and notation_name. call the method __init__ from the base class of the EntitiesForbidden class. substitute name for self.name. substitute value for self.value. substitute base for self.base. substitute sysid for self.sysid. substitute pubid for self.pubid. substitute notation_name for self.notation_name. define the method __str__ with an argument self. tpl is an string "EntitiesForbidden(name='{}', system_id={!r}, public_id={!r})". call the method tpl.format with an arguments self.name, self.sysid and self.pubid. derive the class ExternalReferenceForbidden from the DefusedXmlException base class. define the method __init__ with arguments self, context, base, sysid and pubid. call the method __init__ from the base class of the ExternalReferenceForbidden class. substitute context for self.context. substitute base for self.base. substitute sysid for self.sysid. substitute pubid for self.pubid. define the method __str__ with an argument self. tpl is an string "ExternalReferenceForbidden(system_id='{}', public_id={})". call the method tpl.format with an arguments self.sysid and self.pubid. from __future__ import unicode_literals into default name space. import module socket. import module sys. from wsgiref import simple_server into default name space. from wsgiref.util import FileWrapper from django.core.exceptions import ImproperlyConfigured into default name space. from django.core.management.color import color_style into default name space. from django.core.wsgi import get_wsgi_application into default name space. from django.utils import six into default name space. from django.utils.module_loading import import_string into default name space. from django.utils.six.moves import socketserver into default name space. __all__ is a tuple containing 2 initial elements: strigs 'WSGIServer' and 'WSGIRequestHandler'. define the funtion get_internal_wsgi_application. from django.conf import settings into default name space. get 'WSGI_APPLICATION' attribute from the settings, substitute it for app_path. if app_path is None, call the function get_wsgi_application, return the result. try, call the import_string with app_path as an argument, return the result. if ImportError, rename it to e, exception is caught, msg is a tuple containing one initial entry: a string "WSGI application '%(app_path)s' could not be loaded; Error importing module: '%(exception)s'", where '%(app_path)s' is replaced by app_path and '%(exception)s' is replaced by e. call the function six.reraise with 3 arguments: ImproperlyConfigured, ImproperlyConfigured(msg) and third element of return value of the function sys.exc_info. derive the class WSGIServer from simple_server.WSGIServer and object base classes. request_queue_size is integer 10. define the __init__ method with 3 arguments: self, unpacked list args and unpacked dictionary **kwargs. pop value under the 'ipv6' key of the kwargs dictionary, if it is true, substitute socket.AF_INET6 for self.address_family. call the __init__ method from the base class of the WSGIServer class, with 2 arguments: unpacked list args and unpacked dictionary kwargs. define the function server_bind with an argument self. call the server_bind method from the base class of the WSGIServer class. call the self.setup_environ method. derive the class WSGIRequestHandler from simple_server.WSGIRequestHandler and object base classes. define the __init__ method with 3 arguments: self, unpacked list args and unpacked dictionary **kwargs. call the color_style method, substitute the result for self.style. call the __init__ method from the base class of the WSGIRequestHandler class, with 2 arguments: unpacked list args and unpacked dictionary kwargs. define the function address_string with an argument self. return the first element of self.client_address. define the function server_bind with an argument self. msg is a string "[%s] %s\n", where '%s' are replaced with return value of the method self.log_date_time_string and formated args. if first element of the second row of args equals a string '2', call the self.style.HTTP_SUCCESS with an argument msg, substitute it for msg. otherwise if first element of second row of args equals a string '1', call the self.style.HTTP_INFO with an argument msg, substitute it for msg. otherwise if second element of args equals a string '304', call the self.style.HTTP_NOT_MODIFIED with an argument msg, substitute it for msg. otherwise if first element of second row of args equals a string '3', call the self.style.HTTP_REDIRECT with an argument msg, substitute it for msg. otherwise if second element of args equals a string '404', call the self.style.HTTP_NOT_FOUND with an argument msg, substitute it for msg. otherwise if first element of second row of args equals a string '4', call the self.style.HTTP_BAD_REQUEST with an argument msg, substitute it for msg. if not, call the self.style.HTTP_SERVER_ERROR with an argument msg, substitute it for msg. call the sys.stderr.write function with an argument msg. define the function run with 5 arguments: addr, port, wsgi_handler, ipv6 set to boolean False and threading set to boolean False. server_address is a tuple containing 2 initial elements: addr and port. if threading is true, call the function type with 3 arguments: string 'WSGIServer', tuple containing 2 elements: socketserver.ThreadingMixIn and WSGIServer, and an empty dictionary, substitute the result for httpd_cls. if not, substitute WSGIServer for httpd_cls. call the httpd_cls function with 4 arguments: server_address, WSGIRequestHandler and ipv6 set to ipv6, substitute the result for httpd. if threading is true, httpd.daemon_threads is boolean True. call the method httpd.set_app with an argument wsgi_handler. call the method httpd.serve_forever. import module importlib. import module os. import module sys. __version__ is a string "0.1". __all__ is a list containing a string "runfastcgi". FASTCGI_OPTIONS is a dictionary containing 16 initial entries: 'fcgi' for 'protocol', None for 'host', None for 'port', define the method fastcgi_help with an argument message set to None. print FASTCGI_HELP to the standard output. if message is true, print message to the standard output. return boolean False. define the function runfastcgi with 2 arguments: argset set to an empty list and unpacked dictionary kwargs. call the method FASTCGI_OPTIONS.copy, substitute the result for options. call the options.update method with an argument kwargs. for every x in argset, if character '=' is contained in x, call the x.split method with arguments: character '=' and integer 1, store the result in k and v, respectively. if not, substitute x for k and boolean True for v. substitute v for value under the k converted to lower case key of options dictionary. if string 'help' is contained in options, call the fastcgi_help function, return the result. try, import flup if ImportError, renamed to e, exception is caught, call the method sys.stderr.write with an argument string "ERROR: %s\n", where '%s' is replaced by e. call the method sys.stderr.write with an argument string " Unable to load the flup package. In order to run django\n". call the method sys.stderr.write with an argument string " as a FastCGI application, you will need to get flup from\n". call the method sys.stderr.write with an argument string " http://www.saddi.com/software/flup/ If you've already\n". call the method sys.stderr.write with an argument string " installed flup, then make sure you have it in your PYTHONPATH.\n". return boolean False. append value under the 'protocol' key of the options dictionary to the string 'server.', substitute it for flup_module. if value under the 'method' key of the options dictionary equals to string 'perfork' or 'fork', wsgi_opts is a dictionary with 4 initial entries: value under the key 'maxspare' of options dictionary converted to an integer, for 'maxSpare', value under the key 'minspare' of options dictionary converted to an integer for 'minSpare', value under the key 'maxchildren' of options dictionary converted to an integer, for 'maxChildren', and value under the key 'maxrequests' of options dictionary converted to an integer, for 'maxRequests'. append string '_fork' to flup_module. otherwise if value under the 'method' key of optins dictionary equals to string 'thread' or 'threaded', wsgi_opts is a dictionary with 4 initial entries: value under the key 'maxspare' of options dictionary converted to an integer, for 'maxSpare', value under the key 'minspare' of options dictionary converted to an integer for 'minSpare', and value under the key 'maxchildren' of options dictionary converted to an integer, for 'maxThreads'. if not, call the function fastcgi_help with an argument string "ERROR: Implementation must be one of prefork or thread.", return the result. if value under the 'debug' key of options dictionary is not None, substitute it for value under the 'debug' key of wsgi_opts dictionary. try, call the function importlib.import_module with 2 arguments: flup_module converted to string and appended to '.' character, and string 'flup', substitute the result for module. substitute module.WSGIServer for WSGIServer. if Exception exception is caught, append flup_module to string "Can't import flup.", print it to the standard output. return boolean False. from django.core.servers.basehttp import get_internal_wsgi_application into default name space. if value under the 'socket' key of the options dictionary is false and values under the 'host' and 'port' keys of the options dictionary are true, set the value under the 'bindAddress' key of the wsgi_opts dictionary to a tuple containing 2 elements: value under the 'host' key, of the options dictionary and value under the 'port' key of the options dictionary converted into an integer. if value under the 'socket' key of the options dictionary is true and values under the 'host' and 'port' keys of the options dictionary are false, substitute the value under the 'socket' key of options dictionary for value under the 'bindAddress' key of wsgi_opts dictionary. if values under the 'socket', 'host' and 'port' keys of the options dictionary are false, set value under the 'bindAddress' key of wsgi_opts to None. if not, call the fastcgi_help function with an argument string "Invalid combination of host, port, socket.", return it. if value under the 'daemonize' of options dictionary is None, if the value under the 'bindAddress' key of the wsgi_opts dictionary is not None, set daemonize to boolean True, if not, set it to boolean False. if not, convert the value under the 'daemonize' key of options dictionary to lowercase, if it equals to string 'true', 'yes' or 't', daemonize is boolean True. convert the value under the 'daemonize' key of options dictionary to lowercase, if it equals to string 'false', 'no' or 'f', daemonize is boolean False. if not, call the fastcgi_help function with an argument string "ERROR: Invalid option for daemonize parameter.", return it. daemon_kwargs is an empty dictionary. if value under the 'outlog' key of options dictionary is true, substitute the value under the 'outlog' key of options dictionary for value under the 'out_log' key of daemon_kwargs dictionary. if value under the 'errlog' key of options dictionary is true, substitute the value under the 'errlog' key of options dictionary for value under the 'err_log' key of daemon_kwargs dictionary. if value under the 'umask' key of options dictionary is true, convert the value under the 'umask' key of options dictionary into an integer of base 8, substitute it for value under the 'umask' key of daemon_kwargs dictionary. if daemonize is true, from django.utils.daemonize import become_daemon into default name space. call the function become_daemon with 2 arguments: our_home_dir set to the value under the 'workdir' key of options dictionary and, unpacked dictionary daemon_kwargs. if value under the 'pidfile' of options dictionary exists, open the file whose name is stored in the value under the 'pidfile' key of options dictionary and mode 'w', with the file descriptor as fp, call the method fp.write with an argument string '%d\n", with '%d' replaced by os.getpid function return value. create the object WSGIServer with 2 arguments: get_internal_wsgi_application return value and unpacked dictionary wsgi_opts, call the method run on it. if __name__ equals a string '__main__'. call the function runfastcgi with an argument all the elements, except the first from the sys.argv list. from django.dispatch import Signal into default name space. request_started is a instance of a Signal class. request_finished is a instance of a Signal class. got_request_exception is a instance of a Signal class, created with an argument providing_args as the list containing string 'request'. from __future__ import unicode_literals into default name space. import module base64. import module json. import module time. import module zlib. from django.conf import settings into default name space. from django.utils import baseconv into default name space. from django.utils.crypto import constant_time_compare and salted_hmac into default name space. from django.utils.encoding import force_bytes, force_str and force_text into default name space. from django.utils.module_loading import import_string into default name space. derive the class BadSignature from the Exception base class. do nothing. derive the class SignatureExpired from the BadSignature base class. do nothing. define the function b64_encode with an argument s. call the method base64.urlsafe_b64encode with an argument s, on the result call the strip function with '=' as the argument, return the result. define the function b64_decode with an argument s. calculate negative length of s, by modulus integer 4, use the result as the number of '=' characters to be stored in pad. call the method base64.urlsafe_b64decode with sum of s and pad as argument. define the function b64_hmac with arguments salt, value and key. call the salted_hmac with 3 arguments: salt, value and key, call the digest method on the result, use the result as an argument for the call to the b64_encode function, return the result. define the function get_cookie_signer with an argument salt set to string 'django.core.signing.get_cookie_signer'. call the import_string function with an argument settings.SIGNING_BACKEND, substitute the result for Signer. call the force_bytes function with an argument settings.SECRET_KEY, substitute the result for key. create the Singer class with 2 arguments: key appended to string 'django.http.cookies' and salt set to salt, return it. derive the class JSONSerializer from the object base class. define the method dumps with arguments self and obj. call the json.dumps function with 2 arguments: obj and separators set to tuple containing ',' and ':' characters, call the encode method on the result with string 'latin-1' as an argument, return the result. define the method loads with arguments self and data. call the data.decode method with a string 'latin-1' as an argument, use the result as an argument for the call to the json.load function, return the result. define the function dumps with 5 arguments: obj, key set to None, salt set to string 'django.core.signing', call the serializer function, call the dumps method on the result with an argument obj, substitute result for data. is_compressed is boolean False. if compress is true, call the function zlib.compress with an argument data, substitute the result for compressed. if length of compressed is lesser than length of data decremented by 1, substitute compressed for data. is_compressed is boolean True. call the b64_encode function with an argument data, substitute the result for base64d. if is_compressed is true, prefix the base64d with a '.' character. instantiate the TimestampSigner object with arguments key and salt set to salt, call its method sign with an argument base64, return it. define the function loads with 5 arguments: s, key set to None, salt set to string 'django.core.signing', instantiate TimestampSigner object with arguments key and salt set to salt, call its method unsign with arguments: s and max_age set to max_age, use it as an argument for the force_bytes function, substitute the result for base64d. decompress is boolean False. if first element of base64d equals to a '.' character, substitute first element of base64d for base64d. decompress is boolean True. call the method b64_decode with an argument base64, substitute the result for data. if decompress is true, call the function zlib.decompress with an argument data, substitute the result for data. call the serializer function, call the loads method on the return value with an argument data, return the result. derive the class Signer from the object base class. define the method __init__ with 4 arguments: self, key set to None, sep set to ':' and salt set to None. call the function force_str with an argument sep, substitute the result for self.sep. if key exists, substitute it for self.key, if not substitute settings.SECRET_KEY for key. call the force_str function with an argument: salt, if it exists, if not with a string '%s.%s', with '%s' replaced by, self.__class__.__module__ and self.__class__.__name__, respectively, substitute the result for self.salt. define the method signature with arguments self and value. call the function base64_hmac with 3 arguments: string 'signer' appended to self.salt, value and self.key, substitute the result for signature. call the function force_str with an argument signature, return the result. define the method sign with arguments self and value. call the function force_str with an argument value, substitute the result for value. convert value, self.sep and return value of a method self.signature called with an argument value, concatenate them together, return the result. define the method unsign with arguments self and signed_value. call the function signed_value with an argument value, substitute the result for signed_value. if self.sep is not contained in signed_value, raise an BadSignature exception with an argument string 'No "%s" found in value', where '%s' is replaced by self.sep. call the signed_value.rsplit method with arguments self.sep and integer 1, substitute the result for value and sig, respectively. call the function constant_time_compare with 2 arguments: sig and return value of the self.signature method with an argument value, if it evaluates to true, call the force_text function with an argument value, return the result. raise an BadSignature exception with an argument string 'Signature "%s" does not match', where '%s' is replaced by sig. derive the class TimestampSigner from the Signer base class. define the method timestamp with an argument self. call the method baseconv.base62.encode with result of the time.time function converted to an integer, as an argument, return the result. define the method sign with arguments self and value. call the force_str function with an argument value, substitute the result for value. convert value, self.sep and return value of the function timestamp, concatenate them, substitute the result for value. call the sign method from the base class of the TimestampSigner class with an argument value, return the result define the method unsign with arguments self, value and max_age set to None. call the unsign method from the base class of the TimestampSigner class with an argument value, substitute the result for result. call the result.rsplit method with arguments self.sep and integer 1, substitute the result for value and timestamp, respectively. call the baseconv.base62.decode method with an argument timestamp, substitute the result for timestamp. if max_age is not None, subtract timestamp from the return value of the function time.time, substitute the result for age. if age is greater than max_age, raise an SignatureExpired exception with an argument string 'Signature age %s > %s seconds', where '%s' is replaced by age and max_age, respectively. return value. from __future__ import unicode_literals into default name space. import module functools. from importlib import import_module into default name space. import module re. from threading import local into default name space. import module warnings. from django.http import Http404 into default name space. from django.core.exceptions import ImproperlyConfigured and ViewDoesNotExist into default name space. from django.utils.datastructures import MultiValueDict into default name space. from django.utils.deprecation import RemovedInDjango20Warning into default name space. from django.utils.encoding import force_str, force_text and iri_to_uri into default name space. from django.utils.functional import lazy into default name space. from django.utils.http import urlquote into default name space. from django.utils.module_loading import module_has_submodule into default name space. from django.utils.regex_helper import normalize into default name space. from django.utils import six and lru_cache into default name space. from django.utils.translation import get_language into default name space. call the function local, substitute the result for _prefixes. call the function local, substitute the result _urlconf. derive the class ResolverMatch with object as base class. define the __init__ method with 7 arguments: self, func, args, kwargs, url_name set to None, app_name set to None and namespaces set to None. substitute func for self.func. substitute args for self.args. substitute kwargs for self.kwargs. substitute url_name for self.url_name. substitute app_name for self.app_name. if namespaces is true, append x to self.namespaces list for every x in namespaces, only if x is true. if not, self.namespaces is an empty list. join self.namespaces into a string separated with character ':', substitute it for self.namespace. if func doesnt have a attribute '__name__', join func.__class__.__module__ and func.__class__.__name__ into a string, separated by character '.', substitute it for self._func_path. if not, join func.__module__ and func.__name__ into a string, separated by character '.', substitute it for self._func_path. if url_name exists substitute it for view_path, if not substitute .self._func_path for view_path. append list containing view_path to self.namespaces list, join all the elements into a string separated by character ':', substitute it for self.view_name. define the method __getitem__ with arguments self and index. return the element at the index index of the tuple containing 3 elements: self.func, self.args and self.kwargs. define the method __repr__ with an argument self. in the string "ResolverMatch(func=%s, args=%s, kwargs=%s, url_name=%s, app_name=%s, namespaces=%s)", replace all the occurrences of: string '%s' with self._func_path, self.args, self.kwargs, self.url_name, self.app_name and self.namespaces, respectively. derive the class Resolver404 with Http404 as base class. do nothing. derive the class NoReverseMatch with Exception as base class. do nothing. method lru_cache.lru_cache with an argument maxsize set to None, as a decorator, define the function get_callable with arguments lookup_view and can_fail set to boolean False. if lookup_view is a callable object, return lookup_view. call the function get_mod_func with an argument lookup_view, store the result in mod_name and func_name, respectively. if func_name is false, if can_fail is true, return lookup_view. if not, raise an ImportError exception with an argument string "Could not import '%s'. The path must be fully qualified.", where '%s' is replaced by lookup_view. try, call the function import_module with an argument mod_name. if ImportError exception is caught. if can_fail is true, return lookup_view if not, call the function get_mod_func with an argument mod_name, store the result in parentmod and submod, respectively. if submod is true and return value of the function module_has_submodule called with 2 arguments: result of the function: import_module called with an argument parentmod and submod, evaluates to false. raise an ViewDoesNotExist exception with an argument string "Could not import '%s'. Parent module %s does not exist.", where string '%s' is replaced by lookup_view and mod_name, respectively. if not, raise an exception. if not, try, get func_name attribute from the mod object, substitute it for view_func. if AttributeError exception is caught. if can fail is true, return lookup_view if not, raise an ViewDoesNotExist exception with an argument string "Could not import '%s'. View does not exist in module %s.", where string '%s' is replaced by lookup_view and mod_name, respectively. if not, if view_function is not a callable function, raise an ViewDoesNotExist exception with an argument string "Could not import '%s.%s'. View is not callable.", where string '%s' is replaced by mod_name and func_name, respectively. return view_func. method lru_cache.lru_cache with an argument maxsize set to None, as a decorator, define the function get_resolver with an argument urlconf. if urlconf is None, from django.conf import settings into default name space. substitute settings.ROOT_URLCONF for urlconf. return an instance of a class RegexURLResolver created with arguments: raw string '^/' and urlconf. method lru_cache.lru_cache with an argument maxsize set to None, as a decorator, define the function get_ns_resolver with arguments ns_pattern and resolver. ns_resolver is class instance of a class RegexURLResolver, created with 2 arguments: ns_pattern and resolver.url_patterns. return an instance of a class RegexURLResolver created with arguments: raw string '^/' and a list containing an element ns_resolver. define the function get_mod_func with an argument callback. try, call the method callback.rindex with an argument character '.', substitute the result for dot. if ValueError exception is caught, return callback and a empty string. return callback split into two lists at the dot index, without the element at the dot index. derive the class LocaleRegexProvider with object as base class. define the method __init__ with arguments self and regex. substitute regex for self._regex. self._regex_dict is an empty dictionary. property decorator, define the method regex with an argument self. call the function get_language, substitute the result for language_code. if language_code is not contained in self._regex_dict, if self.regex is not an instance of six.string_types, substitute self._regex for regex. if not, call the function force_text with arguments self and _regex, substitute the result for regex. try, call the function re.compile with arguments regex and re.UNICODE, substitute the result for compiled_regex. if re.error, renamed to e, is caught, raise an ImproperlyConfigured exception with argument string '"%s" is not a valid regular expression: %s', where '%s' is replace by regex and return value of the function six.text_type with an argument e. substitute the compiled_regex for value under the language_code key of the self._regex_dict dictionary. return the value under the language_code key of the self._regex_dict dictionary. derive the class RegexURLPattern with LocaleRegexProvider as base class. define the method __init__ with 5 arguments: self, regex, callback, default_args set to None and name set to None. call the method LocaleRegexProvider.__init__ with arguments self and regex. if callback is an callable object, substitute callback for self._callback. if not, self._callback is None. substitute callback for self._callback_str. if default_args exists substitute it for self.default_args, if not, self.default_args is an empty dictionary. substitute name for self.name. define the method __repr__ with an argument self. substitute '%s' in string '<%s %s %s>' with self.__class__.__name__, self.name and self.regex.pattern, respectively, use it as an argument for the call to the force_str function, return the result. define the method add_prefix with arguments self and prefix. if prefix is false, and self doesnt have '_callback_str' attribute, return nothing. joint prefix, character '.' and self._callback_str together, substitute the result for self._callback_str. define the method resolve with arguments self and path. call the method self.regex.search with an argument path, substitute the result for match. if match is true, call the method match.groupdict, substitute the result for kwargs. if kwargs is true, args is an empty tuple. if not, call the method match.groups, substitute the result for args. call the method kwargs.update with an argument self.default_args. return an instance of a ResolverMatch class, crated with arguments self.callback, args, kwargs and self.name. property decorator, define the method callback with an argument self. if self._callback is not None, return self._callback. call the function get_callable with an argument self._callback_str, substitute the result for self._callback. return self._callback. derive the class RegexURLResolver with LocaleRegexProvider as base class. define the method __init__ with 6 arguments: self, regex, urlconf_name, default_kwargs set to None, app_name set to None and namespace set to None. call the method LocaleRegexProvider.__init__ with arguments self and regex. substitute urlconf_name for self.urlconf_name. if urlconf_name is not an instance of six.string_types class, substitute self.urlconf_name for self.urlconf_module. self.callback is None. if default_kwargs exists, substitute it for self.default_kwargs, otherwise self.default_kwargs is an empty dictionary. substitute namespace for self.namespace. substitute app_name for self.app_name. self._reverse_dict is an empty dictionary. self._namespace_dict is an empty dictionary. self._app_dict is an empty dictionary. self._callback_strs is an empty set. self._populated is boolean False. define the method __repr__ with an argument self. if self.urlconf_name is an instance of a list type and its length is not zero. replace '%s' in string '<%s list>' with __class__.__name__ field of first element of self.urlconf_name, substitute it for urlconf_repr. if not, create a printable representation of self.urlconf_name object, substitute it for urlconf_repr. replace all '%s' in string '<%s %s (%s:%s) %s>' with self.__class__.__name__, urlconf_repr, self.app_name, self.namespace and self.regex.pattern, respectively. return it. define the method _populate with an argument self. lookups is an instance of the MultiValueDict class. namespaces is an empty dictionary. apps is an empty dictionary. call the function get_language, substitute the result for language_code. for every pattern in reversed list self.url_patterns, if pattern has an attribute '_callback_str', call the method self._callback_strs.add with an argument pattern._callback_str. otherwise, if pattern has an '_callback' attribute. substitute pattern._callback for callback. if callback is an instance of functools.partial object, substitute callback.func for callback. if callback doesnt have '__name__' attribute, join callback.__module__, character "." and callback.__class__.__name__ together, substitute the result for lookup_str. if not, join together callback.__module__, character "." and callback.__name__, substitute the result for lookup_str. call the method self._callback_strs.add with an argument lookup_str. substitute pattern.regex.pattern for p_pattern. if p_pattern starts with a string '^', remove the first element from p_pattern. if pattern is an instance of RegexURLResolver class, if pattern.namespace is true, substitute the tuple containing 2 elements p_pattern and pattern for value under the pattern.namespace key of the namespaces dictionary. if pattern.app_name is true, call the method apps.setdefault with 2 arguments: pattern and an empty list, append to the resulting object pattern.namespace. if not, substitute pattern.regex.pattern for parent_pat. for every name in pattern.reverse_dict, for every matches, pat and defaults in return value of the method pattern.reverse_dict.getlist called with an argument name, call the method normalize with sum of parent_pat and pat as an argument, substitute the result for new_matches. call the method lookups.appendlist with 2 arguments: name and a tuple containing 3 elements: new_matches, sum of p_pattern and pat, and dictionary created by applying defaults mapping on the pattern.default_kwargs dictionary. for every namespace and tuple containing: prefix and sub_pattern, in return value of the method pattern.namespace_dict.items, substitute tuple containing 2 elements: sum of p_pattern and prefix, and sub_pattern for value under the namespace key of the namespace dictionary. for every app_name and namespace_list in pattern.app_dict.items method return value, call the method apps.setdefault with 2 arguments: app_name and an empty list, extend the resulting list with namespaces_list. call the method self._callback_strs.update with an argument pattern._callback_strs. if not, call the function normalize with an argument p_pattern, substitute the result for bits. call the method lookups.appendlist with 2 arguments: pattern.callback and a tuple containing 3 elements: bits, p_pattern, and pattern.default_args. if pattern.name is not None, call the method lookups.appendlist with 2 arguments: pattern.name and a tuple containing 3 elements: bits, p_pattern, and pattern.default_args. substitute lookups for the value under language_code key of the self._reverse_dict dictionary. substitute namespaces for the value under language_code key of the self._namespace_dict dictionary. substitute apps for the value under language_code key of the self._app_dict dictionary. self._populated is boolean True. property decorator, define the method reverse_dict with an argument self. call the function get_language, substitute the result for language_code. if language_code is not contained in self._reverse_dict call the method self._populate. return the value under the language_code key of the self._reverse_dict dictionary. property decorator, define the method namespace_dict with an argument self. call the method get_language, substitute the result for language_code. if language_code is not contained in self._namespace_dict, call the method self._populate. return the value under the language_code key of the self._namespace_dict dictionary. property decorator, define the method app_dict with an argument self. call the method get_language, substitute the result for language_code. if language_code is not containsed in self._app_dict call the method self._populate. return the value under the language_code key of the self._app_dict dictionary. define the method resolve with an argument self. call the function force_text with an argument path, substitute the result for path. tried is an empty list. call the function self.regex.search with an argument path, substitute the result for match. if match is true, slice the path list from the result of the match.end method as the start index to the end, substitute it for new_path. for every pattern in self.url_patterns, try, call the method pattern.resolve with an argument new_path, substitute the result for sub_match. if Resolver404, renamed to e, exception is caught, call the get method with an argument string 'tried' on the first element of the e.args, substitute the result for sub_tried. if sub_tried is not None, call the method tried.extend with an argument: t added to a list containing element pattern, for every t in sub_tried. if not, append list containing pattern to tried. if not, if sub_match is true, sub_match_dict is a dictionary created from self.default_kwargs dictionary using mapping function match.groupdict. call the method sub_match_dict.update with an argument sub_match.kwargs. return an instance of a class ResolverMatch created with 6 arguments: sub_match.func, sub_match.args, sub_match_dict, sub_match.url_name, self.app_name if it exists or if not sub_match.app_name and sub_match.namespaces list appended to self.name. append pattern to tried list. raise an Resolver404 exception with an argument dictionary containing 2 entries: new_path for 'path' and tried for 'tried'. raise an Resolver404 exception with an argument dictionary containing 1 entry: path for 'path'. property decorator, define the method urlconf_module with an argument self. try, return self._urlconf_module. if AttributeError exception is caught. call the function import_module with argument self.urlconf_name, substitute the result for self._urlconf_module. return self._urlconf_module. property decorator, define the method url_patterns with an argument self. get attribute "urlpatterns" form the self.urlconf_module, substitute it for patterns, if the attribute doesnt exist, substitute self.urlconf_module for self.urlconf_module. try, call the function iter with an argument patterns. if TypeError exception is caught, msg is a string ""The included urlconf '{name}' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import." raise an ImproperlyConfigured exception with an argument: return value of the method msg.format, called with an argument name set to self.urlconf_name. return patterns. define the method resolve_error_handler with arguments self and view_type. replace '%s' in the string 'handler%s' with view_type, use it as an name of the attribute to get from the self.urlconf_module, substitute it for callback, if the attribute doesnt exists, callback is None. if not callback, from django.conf import urls into default name space, replace '%s' in the string 'handler%s' with view_type, use it as an name of the attribute to get from the urls, substitute it for callback. call the function get_callable with an argument callback, return the result and an empty dictionary. define the method reverse with arguments self, lookup_view, unpacked list args and unpacked dictionary kwargs. call the method self._reverse_with_prefix with 4 arguments: lookup_view, an empty string, unpacked list args and unpacked dictionary kwargs. define the method _reverse_with_prefix with arguments self, lookup_view, _prefix, unpacked list args and unpacked dictionary kwargs. if args and kwargs are both true, raise an ValueError exception with an argument string "Don't mix *args and **kwargs in call to reverse()!". call the function force_text with an argument v, for every v in args, put the results in a text_args list. text_kwargs is a dictionary created from the result of the function force_text with an argument v, mapped through function k, for every k and v in return value of the kwargs.items. if self._populated is false, call the method self._populate, substitute lookup_view for original_lookup, try, if lookup_view is contained in self._callback_strs, call the function get_callable with arguments lookup_view and boolean True, substitute the result for lookup_view. if ImportError, AttributeError, renamed to e, exceptions are caught, raise an NoReverseMatch exception with an argument string "Error importing '%s': %s.", where '%s' is replaced with lookup_view and e, respectively. if not, if original_lookup and lookup_view are not callable objects, call the function warnings.warn with 3 arguments: string 'Reversing by dotted path is deprecated (%s).', with '%s' replaced with original_lookup, RemovedInDjango20Warning and stacklevel set to integer 3. call the method self.reverse_dict.getlist with an argument lookup_view, substitute the result for possibilities. call the function urlquote with an argument _prefix, use the result as an argument for the call to the normalize function, substitute the fitst element of the result for prefix_norm and prefix_args, respectively. for every possibility, pattern and defaults in possibilities, for every result and params in possibility, if args is true, if length of args is not equal to the sum of the lengths of params and prefix_args, skip this loop iteration. create a list of tuples out of 2 lists: appended params list to prefix_args and text_args, covert the result into a dictionary, substitute it for candidate_subs. if not, if the union of the kwargs and defaults dictionary keys converted into sets is not the same as the union of the defaults and prefix dictionary keys converted into sets, skip this loop iteration, matches is boolean True, for every k and v in return value of the function defaults.items, if the value of the kwargs dictionary under the key k is not equal to v, matches is boolean False. break from this loop execution. if matches is false, skip this loop iteration, substitute text_kwargs for candidate_subs. replace all the occurrences of the '%' string for '%%', append result to the previous result, substitute it for candidate_pat. call the function re.search with 3 arguments: string '^%s%s', with '%s' replaced for prefix_norm and pattern, respectively, candidate_pat formated with candidate_subs and re.UNICODE. candidate_subs is dictionary created from elements in return value of the function urlquote called with argument v, mapped with a function k, for every k and v in return value of the method candidate_subs.items. format candidate_pat with candidate_subs, return the result. get the attribute '__module__' from the getattr, if it exists substitute it for m, if not, m is None. get the attribute '__name__' from the getattr, if it exists substitute it for m, if not, m is None. if m and n are not None, join m and n into a string, separated by '.', substitute the result for lookup_view_s. if not, substitute lookup_view for lookup_view_s. append pattern into a list patterns, for every possibility, pattern and defaults in possibilities. raise an NoReverseMatch exception with an argument string "Reverse for '%s' with arguments '%s' and keyword ", "arguments '%s' not found. %d pattern(s) tried: %s", replace '%s' with lookup_view_s, args, kwargs, length of patterns, patterns, and respectively. derive the class LocaleRegexURLResolver with RegexURLResolver as base class. define the __init__ method with 5 arguments: self, urlconf_name, default_kwargs set to None, app_name set to None and namespace set to None. call the __init__ method of the base class of the class LocaleRegexURLResolver, with arguments: None, urlconf_name, default_kwargs, app_name and namespace. property decorator, define the method regex with an argument self. call the function get_language, substitute the result for language_code. if language_code is not contained in self._regex_dict, call the function re.compile with 2 arguments, string '^%s/', where '%s' is replaced with language_code and re.UNICODE, substitute the result for regex_compiled. substitute the regex_compiled for value under the language_code key of the self._regex_dict dictionary. return the value under the language_code of the self._regex_dict dictionary. define the function resolve with arguments path and urlconf set to None. if urlconf is None, call the function get_urlconf with an argument urlconf. call the function get_resolver with an argument urlconf, on the result call the method resolve with an argument path, return it. define the function reverse with 6 arguments: viewname, urlconf set to None, args set to None, kwargs set to None, prefix set to None, current_app set to None. if urlconf is None, call the function get_urlconf with an argument urlconf. call the function get_resolver with an argument urlconf, substitute the result for resolver. if args in None of boolean False, substitute it for an empty list. if args in None of boolean False, substitute it for an empty dictionary. if prefix is None, call the function get_script_prefix, substitute the result for prefix. if viewname is not an instance of the six.string_types object, substitute viewname for view. if not, call the method viewname.split, with an argument ':', substitute the result for parts. call the method parts.reverse. substitute first element of parts for view. substitute parts, without the first element, for path. resolved_path is an empty list. ns_pattern is an empty string. while path is true, pop the element form the path as substitute the result for ns. try, get the value under the ns key of the resolver.app_dict dictionary, substitute it for app_list. if current_app and is true and current_app is contained in app_list, substitute current_app for ns. otherwise if ns is not contained in app_list, substitute first element of app_list for ns. if KeyError exception is caught, do nothing. try, substitute the value under the ns key of the resolver.namespace_dict dictionary for extra and resolver, respectively. call the method resolved_path.append with an argument ns. add ns_pattern and extra, substitute the result for ns_pattern. if KeyError, renamed to key, exception is caught, if resolved_path is true, raise an NoReverseMatch exception with an argument string "%s is not a registered namespace inside '%s'", respectively replace '%s' with key and elements of the resolved_path joined into a string, separated by ':'. if not, raise an NoReverseMatch exception with an argument string "%s is not a registered namespace", with '%s' replaced with key. if ns_pattern is true, call the function get_ns_resolver with arguments ns_pattern and resolver, substitute the result for resolver. call the method resolver._reverse_with_prefix with 4 arguments: view, prefix, unpacked list args, unpacked dictionary kwargs, use the result as an argument for the call to the function iri_to_uri, return the result. call the function lazy with arguments reverse and str, substitute the results for reverse_lazy. define the function clear_url_caches. call the function get_callable.cache_clear. call the function get_resolver.cache_clear. call the function get_ns_resolver.cache_clear. define the function set_script_prefix with an argument prefix. if prefix doesnt end with character '/', append '/' to prefix. substitute prefix for _prefixes.values. define the function get_script_prefix. get 'value' attribute of the _prefixes, if it exists, return it, otherwise return '/'. define the function clear_script_prefix. try, delete _prefixes.values. if AttributeError exception is caught, do nothing. define the function set_urlconf with an argument urlconf_name. if urlconf_name is true, substitute urlconf_name for _urlconfs.value. if not, if _urlconfs has an attribute 'value', delete _urlconfs.value. define the function get_urlconf with an argument default set to None. get the 'value' attribute of the _urlconfs, if it exists return it, otherwise return defaults. define the function is_valid_path with arguments path and urlconf set to None. try, call the function resolve with arguments path and urlconf. return boolean True. if Resolver404 exception is caught, return boolean False. from __future__ import unicode_literals into default name space. import module re. from django.core.exceptions import ValidationError into default name space. from django.utils.deconstruct import deconstructible into default name space. from django.utils.translation import ugettext_lazy as _ and ungettext_lazy into default name space. from django.utils.encoding import force_text into default name space. from django.utils.ipv6 import is_valid_ipv6_address into default name space. from django.utils import six into default name space. from django.utils.six.moves.urllib.parse import urlsplit and urlunsplit into default name space. EMPTY_VALUES is a tuple containing 5 initial elements: None, empty string, empty list, empty tuple and an empty dictionary. decorator deconstructible, derive the class RegexValidator form the object base class. regex is an empty string. call a function _ with a string 'Enter a valid value.' as an argument, substitute the result for message. code is a string 'invalid' inverse_match is boolean False. flags is a integer 0. define the method __init__ with 6 arguments: self, regex set to None, message set to None, code set to None, inverse_match set to None and flags set to None. if regex is not None, substitute regex for self.regex. if message is not None, substitute message for self.message. if code is not None, substitute code for self.code. if inverse_match is not None, substitute inverse_match for self.inverse_match. if flags is not None, substitute flags for self.flags. if self.flags is true and self.regex is not an instance of a six.string_types type, raise an TypeError exception with an argument string "If the flags are set, regex must be a regular expression string.". if self.regex is not an instance of a six.string_types type, call the re.compile function with self.regex and self.flags as arguments, substitute the result for self.regex. define the method __call__ with arguments self and value. if self.inverse_match equals to return value of the self.regex.search method converted to boolean, called with argument force_text(value), raise a ValidationError exception with arguments self.message and code set to self.code. define the method __eq__ with arguments self and other. evaluate the logical expression, if other is an instance of RegexValidator and self.regex.pattern equals to other.regex.pattern, and self.regex.flags equals to other.regex.flags and self.message equals to other.message and self.code equals to other.code, and self.inverse_match equals to other.inverse_match, return the result. define the method __ne__ with arguments self and other. if self equals to other return boolean False, otherwise return boolean True. decorator deconstructible, derive the class URLValidator form the RegexValidator base class. call the re.compile function with 2 arguments: raw string "^(?:[a-z0-9\.\-]*)://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+", "(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}(?%(label)s%(errors)s%(field)s%(help_text)s', error_row set to a a string, '%s', row_ender set to a string '', help_text_html set to a string, '
%s' and errors_on_separate_row set to boolean False. define the method as_ul with an argument self. return the result of the method self._html_output, called with 5 arguments: normal_row to a string, '%(errors)s%(label)s %(field)s%(help_text)s', error_row set to a a string '
  • %s
  • ', row_ender set to a string '', help_text_html set to a string, ' %s', and errors_on_separate_row set to boolean False. define the method as_p with an argument self. return the result of the method self._html_output, called with 5 arguments: normal_row to a string, '%(label)s %(field)s%(help_text)s

    ', error_row set to a a string '%s', row_ender set to a string '

    ', help_text_html set to a string, %s' and errors_on_separate_row set to boolean True. define the method non_field_errors with an argument self. return the result of the method self.errors.get called with 2 arguments: NON_FIELD_ERRORS and return value of the method, self.error_class called with an argument error_class set to string 'nonfield'. define the method _raw_value with 2 arguments: self and fieldname. substitute the value under the fieldname key of the self.fields dictionary for field. call the method self.add_prefix with an argument fieldname, substitute it for prefix. return the result of the method field.widget.value_from_datadict called with 3 arguments: self.data, self.files and prefix. define the method add_error with 3 arguments: self, field and errors. if error is not an instance of ValidationError, error is an instance of ValidationError created with an argument error. if error has an attribute 'error_dict', if field is not None, raise an TypeError with an argument string "The argument `field` must be `None` when the `error`argument contains errors for multiple fields.". if not, substitute error.error_dict for error. if not, error is an dictionary with an initial entry error.error_list for filed if true, or NON_FIELD_ERRORS if not. call the method error.items, for every field and error_list in the result, if field is not contained in self.errors, if field is not equal to NON_FIELD_ERRORS and field is not contained in self.fields, raise an ValueError with an argument string "'%s' has no field named '%s'.", with '%s' replaced with self.__class__.__name__ and field, respectively. if field equals NON_FIELD_ERRORS, call the method self.error_class with an argument error_class as an string 'nonfield', substitute the result for value under the field key of the self._errors dictionary. if not, call the method self.error_class, substitute the result for value under the field key of the self._errors dictionary. extend the value under the field key of the self._errors dictionary with error_list. if field is contained in self.cleaned_data, delete the entry of self.cleaned_data dictionary under the key field. define the method has_error with 3 arguments: self, field and code set to None. if code is None, if field is contained in self.errors return boolean True, if not, return boolean False. if field is contained in self.errors, call the method self.errors.as_data, for every error for value under the filed key of the returned dictionary, if error.code equals code, return boolean True. return boolean False. define the method full_clean with an argument self. self._errors is an instance of ErrorDict. if self.is_bound is false, return nothing. self.cleaned_data is an empty dictionary. if self.empty_permitted is true and call to the method self.has_changed evaluates to false, return nothing. call the method self._clean_fields. call the method self._clean_form. call the method self._post_clean. define the method _clean_fields with an argument self. call the method self.fields.items, for every name and field in result, call the method field.widget.value_from_datadict with 3 arguments: self.data, self.files and return value of the method, self.add_prefix called with an argument name, substitute the result for value. try, if field is an instance of FileField, get the value under the name key of the self.initial dictionary, if it exists substitute it for initial, if not substitute field.initial for initial. call the method filed.clean with arguments value and initial, substitute the result for value. if not, call the method field.clean with an argument value, substitute the result for value. substitute value for the value under the name key of the self.cleaned_data dictionary. if self has an attribute 'clean_%s', where '%s' is replaced with name, get 'clean_%s', where '%s' is replaced with name' attribute of the self object, call the result as an function, substitute the result for value. substitute value for the value under the name key of the self.cleaned_data dictionary. if ValidationError renamed to e, exception is caught, call the method self.add_error with 2 arguments name and e. define the method _clean_form with an argument self. try, call the method self.clean, substitute the result for cleaned_data. if ValidationError renamed to e, exception is caught, call the method self.add_error with 2 arguments None and e. if not, if cleaned_data is not None, substitute cleaned_data for self.cleaned_data. define the method _post_clean with an argument self. do nothing. define the method clean with an argument self. return self.cleaned_data. define the method has_changed with an argument self. convert self.changed_data into boolean, return it. property decorator, define the method changed_data with an argument self. if self._changed_data is None, self._changed_data is an empty list. call the method self.fields.items, for every name and field in the result, call the method self.add_prefix with an argument name, substitute the result for prefixed_name. call the method field.widget.value_from_datadict with 3 arguments: self.data, self.files, prefixed_name, substitute the result for data_value. if field.show_hidden_initial is false, get the value under the name key of the self.initial dictionary, if it exists substitute it for initial_value, if not substitute field.initial for initial_value. if initial_value is an callable object, call the function initial_value, substitute the result for initial_value. if not, call the method self.add_initial_prefix with an argument name, substitute the result for initial_prefixed_name. call the method field.hidden_widget, substitute the result for field.hidden_widget. try, call the method (hidden_widget.value_from_datadict with 3 arguments: self.data, self.files and initial_prefixed_name, use the result as an argument for the call to the field.to_python method, substitute the result for initial_value. if ValidationError exception is caught, append name to self._changed_data. skip this loop iteration. call the method field._has_changed with 2 arguments: initial_value and data_value, if it evaluates to true, append name to self._changed_data list. return self._changed_data. property decorator, define the method media with an argument self. media is an instance of Media class. call the method self.fields.values, for every field in result, append field.widget.media to media, substitute the result for media. return media. define the method is_multipart with an argument self. call the method self.fields.values, for every field in result, if field.widget.needs_multipart_form is true, return boolean True. return boolean False. define the method hidden_fields with an argument self. for field in self if field.is_hidden is true, append field to a list, return the resulting list. define the method visible_fields with an argument self. for field in self if field.is_hidden is false, append field to a list, return the resulting list. derive the class Form from the base classes DeclarativeFieldsMetaclass and BaseForm. decorator python_2_unicode_compatible, derive the class BoundField from the base class object. define the method __init__ with 4 arguments: self, form, field and name. substitute form for self.form. substitute field for self.field. substitute name for self.name. call the method form.add_prefix with an argument self, substitute the result for self.html_name. call the method form.add_initial_prefix with an argument name, substitute the result for self.html_initial_name. call the method form.add_initial_prefix with an argument self.auto_id, substitute the result for self.html_initial_id. if self.field.label is None, call the method pretty_name with an argument name, substitute the result for self.label. if not, substitute self.field.label for self.label. if field.help_text is true, substitute field.help_text for self.help_text, if not self.help_text is an empty string. define the method __str__ with an argument self. if self.field.show_hidden_initial is true, call the method self.as_hidden with an argument only_initial set to boolean True, append the result to the result of the method, self.as_widget, return the resulting string. call the method self.as_widget, return the result. define the method __iter__ with an argument self. get the value under the 'id' key of the self.field.widget.attrs dictionary, if the key exists substitute it for id_, if not, substitute self.auto_id for id_. if if_is true attrs is an dictionary with initial entry: id_ for 'id', if not, attrs is an empty dictionary. call the method self.field.widget.subwidgets with 3 arguments: self.html_name, return value of the method self.value and attrs, for every subwidget in the result, yield subwidget, as the result of the generator. define the method __len__ with an argument self. convert result of the method self.__iter__ into a list, return its length. define the method __getitem__ with 2 arguments: self and idx. convert result of the method self.__iter__ into a list, return element at the idx index. property decorator, define the method errors with an argument self. get the value under the self.name key of the self.form.errors dictionary, if the key exists, return it, if not evaluate the method self.form.error_class and return the result. define the method as_widget with 4 arguments: self, widget set to None, attrs set to None, only_initial set to boolean False. if widget is false, substitute self.field.widget for widget. if self.field.localize is true, widget.is_localized is boolean True. if attrs is false, make it an empty dictionary. substitute self.auto_id for auto_id. if auto_id is true and 'id' is not contained in attrs and 'id' is not contained in widget.attrs, if only_initial is false, substitute auto_id for value under the 'id' key of the attrs dictionary. if not, substitute self.html_initial_id for value under the 'id' key of the attrs dictionary. if only_initial is false, substitute self.html_name for name. if not, substitute self.html_initial_name for name. call the method widget.render with 3 arguments: name, return value of the method self.value, attrs set to attrs, use it as an argument for the call to the function force_text, return the result. define the method as_text with 3 arguments: self, attrs set to None and unpacked dictionary kwargs. call the method self.as_widget with 3 arguments: instance of a class TextInput, attrs and unpacked dictionary kwargs, return the result. define the method as_textarea with 3 arguments: self, attrs set to None and unpacked dictionary kwargs. call the method self.as_widget with 3 arguments: instance of a class Textarea, attrs and unpacked dictionary kwargs, return the result. define the method as_hidden with 3 arguments: self, attrs set to None and unpacked dictionary kwargs. call the method self.as_widget with 3 arguments: return value of the method self.field.hidden_widget, attrs, and unpacked dictionary kwargs, return the result. property decorator, define the method data with an argument self. call the method self.field.widget.value_from_datadict with 3 arguments: self.form.data, self.form.files, self.html_name, return the result. define the method value with an argument self. if self.form.is_bound is false, get the value under the self.name key of the self.form.initial dictionary, if it exists, substitute it for data, if not, substitute self.field.initial for data. if data is an callable object, call the method data, substitute the result for data. if data is an instance of datetime.datetime or datetime.time classes, and supports_microseconds field of self.field.widget is false, call the method data.replace with an argument microsecond set to integer 0, substitute the result for data. if not, call the method self.field.bound_data with 2 arguments: self.data and value under the self.name key of the dictionary, self.form.initial, if it exists, or self.field.initial if not, substitute the result for data. call the method self.field.prepare_value with an argument data, return the result. define the method label_tag with 4 arguments: self, contents set to None, attrs set to None and label_suffix set to None. if contents is false, substitute self.label for contents. if label_suffix is None, if self.field.label_suffix is not None, substitute self.field.label_suffix for label_suffix, otherwise substitute self.form.label_suffix for label_suffix. if label_suffix and contents are both true and last element of contents is not contained in the result of the function _, called with an argument string ':?.!'. call the method format_html with 3 arguments: string '{0}{1}', contents and label_suffix, substitute the result for contents. substitute self.field.widget for widget. get the value under the 'id' key of the widget.attrs dictionary, if the key exists substitute it for id_, if not, substitute self.auto_id for id_. if id_ is true, call the method widget.id_for_label with an argument id_, substitute the result for id_for_label. if id_for_label is true, unpack a dictionary with an entry id_for_label for 'for', map it through attrs mapping if attrs is true, and convert it again to the dictionary, if attrs is false, leave it alone, substitute the result for attrs. if self.field.required is true and self.form has an attribute 'required_css_class', if attrs is false, make attrs an empty dictionary. if 'class' is contained in attrs, append self.form.required_css_class to a whitespace character, append it to the value under the 'class' key of the attrs dictionary. if not, substitute self.form.required_css_class for the value under the 'class' key of the attrs dictionary. if attrs is true, call the function flatatt with an argument attrs, substitute the result for attrs, if not attrs is an empty string. call the function format_html with 3 arguments string '{1}', attrs and contents, substitute the result for contents. if not, call the function conditional_escape with an argument contents, substitute the result for contents. call the function mark_safe with an argument contents, return the result. define the method css_classes with 2 arguments: self and extra_classes set to None. if extra_classes has an attribute 'split', split extra_classes into words, by whitespaces, substitute the result for extra_classes. if extra_classes is not empty put its elements into a set, substitute it for extra_classes, if not extra_classes is an empty set. if self.errors is true and self.form has an attribute 'error_css_class', add self.form.error_css_class to extra_classes set. if self.field.required is true and self.form has an attribute 'required_css_class' , add self.form.required_css_class to extra_classes set. join elements of extra_classes into a string separated by whitespaces, return it. property decorator, define the method is_hidden with an argument self. return self.field.widget.is_hidden, property decorator, define the method auto_id with an argument self. substitute self.form.auto_id for auto_id. if auto_id is true and '%s' is contained in result of the call to the function smart_text with an argument auto_id, call the function smart_text with an argument auto_id, format the result with self.html_name, return it. otherwise if auto_id is true, return self.html_name. return an empty string. property decorator, define the method id_for_label with an argument self. substitute self.field.widget for widget. get the value under the 'id' key of the widget.attrs dictionary, if the key exists substitute it for id_, if not, substitute self.auto_id for id_. call the method widget.id_for_label with an argument id_, return the result. from __future__ import unicode_literals into default name space. from django.core.exceptions import ValidationError into default name space. from django.forms import Form into default name space. from django.forms.fields import IntegerField and BooleanField into default name space. from django.forms.utils import ErrorList into default name space. from django.forms.widgets import HiddenInput into default name space. from django.utils.encoding import python_2_unicode_compatible into default name space. from django.utils.functional import cached_property into default name space. from django.utils.safestring import mark_safe into default name space. from django.utils import six into default name space. from django.utils.six.moves import xrange into default name space. from django.utils.translation import ungettext and ugettext as _ into default name space. __all__ is a tuple containing strings 'BaseFormSet', 'formset_factory' and 'all_valid'. TOTAL_FORM_COUNT is a string 'TOTAL_FORMS'. INITIAL_FORM_COUNT is a string 'INITIAL_FORMS'. MIN_NUM_FORM_COUNT is a string 'MIN_NUM_FORMS'. MAX_NUM_FORM_COUNT is a string 'MAX_NUM_FORMS'. ORDERING_FIELD_NAME is a string 'ORDER'. DELETION_FIELD_NAME is a string 'DELETE'. DEFAULT_MIN_NUM is an integer 0. DEFAULT_MAX_NUM is an integer 1000. derive the class ManagementForm from the Form base class. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. value under the TOTAL_FORM_COUNT of the self.base_fields dictionary is an instance of IntegerField class, created with an argument widget set to HiddenInput. value under the INITIAL_FORM_COUNT of the self.base_fields dictionary is an instance of IntegerField class, created with an argument widget set to HiddenInput. value under the MIN_NUM_FORM_COUNT of the self.base_fields dictionary is an instance of IntegerField class, created with 2 arguments: required as boolean False and widget set to HiddenInput. value under the MAX_NUM_FORM_COUNT of the self.base_fields dictionary is an instance of IntegerField class, created with 2 arguments: required as boolean False and widget set to HiddenInput. call the method __init__ from the base class of the class ManagementForm, called with 2 arguments: unpacked list args, and unpacked dictionary kwargs. python_2_unicode_compatible decorator, derive the class BaseFormSet from the object base class. define the method __init__ with 7 arguments: self, data set to None, files set to None, auto_id set to an string 'id_%s', if data is not None or files is not None, self.is_bound is boolean True, otherwise it is boolean False. if prefix is true, substitute it for self.prefix, otherwise call the method self.get_default_prefix, and substitute the result for self.prefix. substitute auto_id for self.auto_id. if data is true, substitute it for self.data, otherwise self.data is an empty dictionary. if data is true, substitute it for self.files, otherwise self.files is an empty dictionary. substitute initial_id for self.auto_id. substitute error_class for self.error_class. self._errors is None. self._non_form_errors is None. define the method __str__ with an argument self. call the method self.as_table, return the result. define the method __iter__ with an argument self. convert self.forms into an iterable, return it. define the method __getitem__ with an argument self. return self.forms element at the index index. define the method __len__ with an argument self. return the length of self.forms. define the method __bool__ with an argument self. return boolean True. define the method __nonzero__ with an argument self. get the type of self object, call the __bool__ method on the result with an argument self, return the result. property decorator, define the method management_form with an argument self. if self.is_bound is true, form is an instance of ManagementForm class, created with 3 arguments: self.data, auto_id as self.auto_id and prefix as self.prefix. call the form.is_valid method, if it evaluates to false, raise ValidationError with 2 arguments: return value of the function _ called with an argument string, 'ManagementForm data is missing or has been tampered with' and code as a string 'missing_management_form'. if not, form is an instance of ManagementForm class, created with 3 arguments: auto_id as self.auto_id, prefix as self.prefix, and initial as a dictionary with 4 entries: result of self.total_form_count method for TOTAL_FORM_COUNT, result of self.initial_form_count method for INITIAL_FORM_COUNT, self.min_num for MIN_NUM_FORM_COUNT and self.max_num for MAX_NUM_FORM_COUNT. return form. define the method total_form_count with an argument self. if self.is_bound is true, get the element with minimal value between the value under the TOTAL_FORM_COUNT key of self.management_form.cleaned_data dictionary, and self.absolute_max, return the result. if not, call the method self.initial_form_count, return the result initial_forms. get the element with maximal value between initial_forms and self.min_num, add self.extra to it, substitute the result for total_forms. if initial_forms is grater than self.max_num is grater or equal to integer 0, substitute initial_forms for total_forms. otherwise if total_forms is grater than self.max_num is grater or equal to integer 0, substitute self.max_num for total_forms. return total_forms. define the method initial_form_count with an argument self. if self.is_bound is true, return the value under the INITIAL_FORM_COUNT key of the self.management_form.cleaned_data dictionary. if not, if self.initial is true, substitute the length of self.initial for initial_forms, if not, initial_forms is integer 0. return initial_forms. cached_property decorator, define the method forms with an argument self. for every i in sequence of integers from 0 to result of the method self.total_form_count, call the method self._construct_form, with an argument i, append the result to a list, substitute the resulting list for forms. return forms. define the method _construct_form with 3 arguments: self, i and unpacked dictionary kwargs. defaults is an dictionary with 3 initial entries: self.auto_id for 'auto_id', result of the call to the method self.add_prefix, with an argument i, for 'prefix' and self.error_class for 'error_class'. if self.is_bound is true, substitute self.data for value under the 'data' key of the defaults dictionary. substitute self.files for value under the 'files' key of the defaults dictionary. if self.initial is true and 'initial' key is not contained in kwargs, try, substitute i-th element of self.initial for value under the 'initial' key of the defaults dictionary. if IndexError exception is caught, do nothing. if i is greater than, or equal to the result of the call to the method self.initial_form_count, and i is greater than or equal to self.min_num, value under the 'empty_permitted' key of the defaults dictionary is boolean True. update defaults dictionary with kwargs. call the method self.form with unpacked dictionary defaults as an argument, substitute it for form. call the method self.add_fields with arguments form and i). return form. property decorator, define the method initial_forms with an argument self. call the self.initial_form_count method, return the sublist of self.forms from the beginning to the previous result as the end index. property decorator, define the method extra_forms with an argument self. call the self.initial_form_count method, return the sublist of self.forms, using previous result as start index to the end. property decorator, define the method empty_form with an argument self. call the function empty_form with 3 arguments: auto_id as self.auto_id, prefix set to the return value of the self.add_prefix method, called with string '__prefix__' as an argument and empty_permitted as boolean True, substitute the result for form. call the method self.add_fields with arguments form and None. return form. property decorator, define the method cleaned_data with an argument self. call the method self.is_valid, if it evaluates to false, raise an AttributeError exception with an argument string: "'%s' object has no attribute 'cleaned_data'", where '%s' is replaced with self.__class__.__name__. for form in self.forms append form.cleaned_data to a list, return the resulting list. property decorator, define the method deleted_forms with an argument self. if call to the method self.is_valid, evaluates to false or self.can_delete is boolean false, return an empty list. if self doesnt have an '_deleted_form_indexes' attribute, self._deleted_form_indexes is an empty list. call the method self.total_form_count, for every i in sequence of integers, from 0 to the previous result, substitute i-th element of self.forms for form. if i is greater than or equal to the result of the method self.initial_form_count, and call to the method form.has_changed evaluates to false, skip this loop iteration, call the method self._should_delete_form with an argument form, if it evaluates to true, call the method self._deleted_form_indexes.append with an argument i. for i in self._deleted_form_indexes append i-th element of self.forms into a list, return the resulting list. property decorator, define the method ordered_forms with an argument self. if call to the self.is_valid method evaluates to false or self.can_order is false, raise an AttributeError exception with an argument string: "'%s' object has no attribute 'ordered_forms'", where '%s' is replaced with self.__class__.__name__. if self doesnt have an '_ordering' attribute, self._ordering is an empty list. for every i in sequence of integers, from 0 to the result of the method self.total_form_count, substitute i-th element of self.forms for form. if i is greater than or equal to the result of the method self.initial_form_count, and call to the method form.has_changed evaluates to false, skip this loop iteration, if self.can_delete is true and call to the method self._should_delete_form with an argument form, evaluates to true, skip this loop iteration, append tuple with 2 elements: i and value under the ORDERING_FIELD_NAME key of form.cleaned_data dictionary to self._ordering. define the function compare_ordering_key with an argument k. if second element of k is None, return a tuple with 2 elements: integers 1 and 0. return a tuple with 2 elements: integer 0 and second element of k. call the method self._ordering.sort with an argument key as compare_ordering_key. for i in self._ordering append to a list value under the first element of i key of the self.forms dictionary, return resulting list. classmethod decorator, define the method get_default_prefix with an argument cls. return string 'form'. define the method non_form_errors with an argument self. if self._non_form_errors is None, call the method self.full_clean. return self._non_form_errors. property decorator, define the method errors with an argument self. if self._errors is None, call the method self.full_clean. return self._errors. define the method total_error_count with an argument self. for every form_errors in self.errors sum length of return value of the method self.non_form_errors and length of form_errors, return the result. define the method _should_delete_form with an argument self. get the value under the DELETION_FIELD_NAME key of the form.cleaned_data dictionary, if it exists return it, if not, return boolean False. define the method is_valid with an argument self. if self.is_bound is false, return boolean False. forms_valid is True. call self.errors. for every i in sequence of integers, from 0 to the result of the method self.total_form_count, substitute i-th element of self.forms for form. if self.can_delete is true, call the method self._should_delete_form with an argument, if it evaluates to true, skip this loop iteration, call the method form.is_valid, perform bitwise and with the result and forms_valid as operands, substitute the result for forms_valid. if forms_valid is true and call to the method self.non_form_errors, evaluates to false, return boolean True, otherwise return False. define the method full_clean with an argument self. self._errors is an empty list. call the method self.error_class, substitute the result for self._non_form_errors. if self.is_bound is false, return nothing. for every i in sequence of integers, from 0 to the result of the method self.total_form_count, substitute i-th element of self.forms for form. append form.errors to self._errors. try, if self.validate_max is true, and length of self.deleted_forms subtracted from the return value of the method self.total_form_count, is greater than self.max_num, or if value under the TOTAL_FORM_COUNT key of the self.management_form.cleaned_data dictionary, is grater than self.absolute_max, raise an ValidationError with 2 arguments: return value of the function ungettext with 3 arguments: strings "Please submit %d or fewer forms.", "Please submit %d or fewer forms." and self.max_num, where '%d' is replaced with self.max_num, and code as a string 'too_many_forms'. if self.validate_min is true, and length of self.deleted_forms subtracted from the return value of the method self.total_form_count, is smaller than self.min_num, raise an ValidationError with 2 arguments: return value of the function ungettext with 3 arguments: strings "Please submit %d or more forms.", "Please submit %d or more forms." and self.min_num, where '%d' is replaced with self.min_num, and code as a string 'too_few_forms'. call the method self.clean. if ValidationError, renamed to e, exception is caught, call the method self.error_class with an argument e.error_list, substitute the result for self._non_form_errors. define the method clean with an argument self. do nothing. define the method has_changed with an argument self. for every form in self call the method form.has_changed if any of the results evaluates to true, return boolean True, if not return boolean False. define the method add_fields with 3 arguments: self, form and index. if self.can_order is true, if index is not None and index is smaller than return value of the method self.initial_form_count, value under the ORDERING_FIELD_NAME key of the form.fields is an instance of IntegerField class, created with 3 arguments: label set to return value of the function _ called with an string 'Order', initial set to index incremented by 1, and required as boolean False. if not, value under the ORDERING_FIELD_NAME key of the form.fields is an instance of IntegerField class, created with 2 arguments: label set to return value of the function _ called with an string 'Order' and required as boolean False. if self.can_delete is true, value under the DELETION_FIELD_NAME key of the form.fields is an instance of BooleanField class, created with 2 arguments: label set to return value of the function _ called with an string 'Delete' and required as boolean False. define the method add_prefix with an argument self. replace '%s' in sting '%s-%s' with self.prefix and index, return the result. define the method is_multipart with an argument self. if self.forms is true, call the method is_multipart on the first element of self.forms, return it. if not, call the method self.empty_form.is_multipart, return the result property decorator, define the method media with an argument self. if self.forms is true, return the media field of the first element of self.forms. if not, return self.empty_form.media. define the method as_table with an argument self. for every form in self call the form.as_table method, join the results in a string, separated by an empty string. join return value of the function six.text_type called with an argument self.management_form and forms into a string, separated by newline, use it as an argument for the call to the function mark_safe, return the result. define the method as_p with an argument self. for every form in self call the form.as_p method, join the results in a string, separated by an empty string. join return value of the function six.text_type called with an argument self.management_form and forms into a string, separated by newline, use it as an argument for the call to the function mark_safe, return the result. define the method as_ul with an argument self. for every form in self call the form.as_ul method, join the results in a string, separated by an empty string. join return value of the function six.text_type called with an argument self.management_form and forms into a string, separated by newline, use it as an argument for the call to the function mark_safe, return the result. define the function formset_factory with 9 arguments: form, formset set to BaseFormSet, extra set to integer 1, if min_num is None, substitute DEFAULT_MIN_NUM for min_num, if max_num is None, substitute DEFAULT_MAX_NUM for max_num, sum max_num and DEFAULT_MAX_NUM, substitute the result for absolute_max. attrs is an dictionary with 9 initial entries: form for 'form', extra for 'extra', can_order for 'can_order', can_delete for 'can_delete', min_num for 'min_num', max_num for 'max_num', absolute_max for 'absolute_max', validate_min for 'validate_min' for validate_max for 'validate_max'. create a class class which name is generated by converting 'FormSet' into a string and appending it to form.__name__, is derived from the formset base class and with fields contained in attrs, return an instance of the obtained class. define the function all_valid with an argument formsets. valid is boolean True. for every formset in formsets, call the function formset.is_valid, if it evaluates to false, valid is boolean False. return valid. from __future__ import unicode_literals into default name space. from collections import OrderedDict into default name space. import module warnings. django.core.exceptions import ImproperlyConfigured, ValidationError, NON_FIELD_ERRORS and FieldError into default namespace. from django.forms.fields import Field and ChoiceField into default name space. from django.forms.forms import DeclarativeFieldsMetaclass and BaseForm into default name space. from django.forms.formsets import BaseFormSet and formset_factory into default name space. from django.forms.utils import ErrorList into default name space. from django.forms.widgets import SelectMultiple, HiddenInput, MultipleHiddenInput into default namespace. from django.utils import six into default name space. from django.utils.deprecation import RemovedInDjango19Warning into default name space. from django.utils.encoding import smart_text and force_text into default name space. from django.utils.text import get_text_list and capfirst into default name space. from django.utils.translation import ugettext_lazy as _ and ugettext into default name space. __all__ is a tuple containing strings: 'ModelForm', 'BaseModelForm', 'model_to_dict', 'fields_for_model', 'save_instance', 'ModelChoiceField', 'ModelMultipleChoiceField', 'ALL_FIELDS', 'BaseModelFormSet', 'modelformset_factory', 'BaseInlineFormSet', and 'inlineformset_factory'. ALL_FIELDS is a string '__all__'. define the function construct_instance with 4 arguments: form, instance, fields set to None and exclude set to None. from django.db import models into default namespace. substitute instance._meta for opts. substitute form.cleaned_data for cleaned_data. file_field_list is an empty list. for every f in opts.fields, if f.editable is true and f is an instance of models.AutoField, or f.name is not contained in cleaned_data, skip this loop iteration. if fields is not None and f.name is not contained in fields, skip this loop iteration. if exclude is true and f.name is contained in exclude, skip this loop iteration. if f is an instance of models.FileField, append f to file_field_list. if not, call the method f.save_form_data with 2 arguments: instance and value under the f.name key of cleaned_data dictionary. for every f in file_field_list, call the method f.save_form_data with 2 arguments: instance and value under the f.name key of cleaned_data dictionary. return instance. define the function save_instance with 7 arguments: form, instance, fields set to None, fail_message as string 'saved', if construct is true, call the function construct_instance with 4 arguments form, instance, fields, exclude and substitute the result for instance. substitute instance._meta for opts. if form.errors is true, raise an ValueError with an argument string "The %s could not be %s because the data didn't validate.", where '%s' is replaced with opts.object_name and fail_message, respectively. define the function save_m2m. substitute form.cleaned_data for cleaned_data. append opts.virtual_fields to opts.many_to_many, for every f in the result, if f doesnt has an 'save_form_data' attribute, skip this loop iteration. if fields is true and f.name is not contained in fields, skip this loop iteration. if exclude is true and f.name is contained in exclude, skip this loop iteration. if f.name is contained in cleaned_data, call the method f.save_form_data with 2 arguments: instance and value under the f.name key of cleaned_data dictionary. if commit is true, call the method instance.save. call the function save_m2m. if not, substitute save_m2m for form.save_m2m. return instance. define the function model_to_dict with 3 arguments: instance, fields set to None and exclude set None. from django.db.models.fields.related import ManyToManyField. substitute instance._meta for opts. data is an empty dictionary. concatenate opts.concrete_fields, opts.virtual_fields and opts.many_to_many, for every f in the result, get 'editable' attribute from object f, if it doesnt exists or its true, skip this loop iteration. if fields is true and f.name is not contained in fields, skip this loop iteration. if exclude is true and f.name is contained in exclude, skip this loop iteration. if f is an instance of ManyToManyField, if instance.pk is None, value under f.name key of the dta dictionary is an empty list. if not, call the method f.value_from_object with an argument instance, substitute the result for qs. if qs._result_cache is not None, for every item in qu append item.pk to a list, substitute resulting list for value under f.name key of the data dictionary. if not, call the method qs.values_list with 2 arguments: string 'pk' and flat set to boolean True, put the results in a list, substitute the result for value under the f.name key of data dictionary. if not, call the method f.value_from_object with an argument instance, substitute the result for value under the f.name key of the data dictionary. return data. define the function fields_for_model with 9 arguments: model, fields set to None, exclude set to None, widgets set to None, field_list is an empty list. ignored is an empty list. substitute model._meta for opts. from django.db.models.fields import Field as ModelField. if f is an instance of ModelFiled, for every f in opts.virtual_fields, append f to a list, substitute the resulting list for sortable_virtual_fields. concatenate opts.concrete_fields, sortable_virtual_fields and opts.many_to_many, for every f in sorted result, get 'editable' attribute from object f, if it doesnt exists or its true, skip this loop iteration. if fields is not None and f.name is not contained in fields, skip this loop iteration. if exclude is true and f.name is contained in exclude, skip this loop iteration. kwargs is an empty dictionary, if widgets is true and f.name is contained in widgets, substitute value under the f.name key of the widgets dictionary for value under the 'widget' key of kwargs dictionary. if localized_fields equals ALL_FIELDS, or if localized_fields is true and f.name is contained in localized_fields, value under 'localize' key of kwargs dictionary is boolean True. if labels is true and f.name is contained in labels, substitute value under the f.name key of the labels dictionary for value under the 'label' key of kwargs dictionary. if help_texts is true and f.name is contained in help_texts, substitute value under the f.name key of the help_texts dictionary for value under the 'help_text' key of kwargs dictionary. if error_messages is true and f.name is contained in error_messages, substitute value under the f.name key of the error_messages dictionary for value under the 'error_messages' key of kwargs dictionary. if formfield_callback is None, call the method f.formfield with an argument, unpacked dictionary kwargs, substitute the result for formfield. otherwise if formfield_callback is not callable object, raise an TypeError with an string 'formfield_callback must be a function or callable'. if not, call the method formfield_callback with 2 arguments: f and unpacked dictionary kwargs, substitute the result for formfield. if formfield is true, append a tuple with 2 elements: f.name and formfield to field_list. if not, append f.name to ignored list. field_dict is an instance of OrderedDict class, created with an argument field_list. if fields is true, for every f in fields, if exclude is false, or if exclude is true and f is not contained in exclude, and only if f is not in ignored, append to list, a tuple with 2 elements: f and value under the f key of field_dict dictionary, use the resulting list as an argument, for the creation of the instance of OrderedDict class, substitute it for field_dict. return field_dict. derive the class ModelFormOptions from object base class. define the method __init__ with arguments: self and options set to None. get 'model' attribute from the options object, if it exists substitute it for self.model, if not self.model is None. get 'fields' attribute from the options object, if it exists substitute it for self.fields, if not self.fields is None. get 'exclude' attribute from the options object, if it exists substitute it for self.exclude, if not self.exclude is None. get 'widgets' attribute from the options object, if it exists substitute it for self.widgets, if not self.widgets is None. get 'localized_fields' attribute from the options object, if it exists substitute it for self.localized_fields, if not self.localized_fields is None. get 'labels' attribute from the options object, if it exists substitute it for self.labels, if not self.labels is None. get 'help_texts' attribute from the options object, if it exists substitute it for self.help_texts, if not self.help_texts is None. get 'error_messages' attribute from the options object, if it exists substitute it for self.error_messages, if not self.error_messages is None. derive the class ModelFormMetaclass from the DeclarativeFieldsMetaclass base class. define the method __new__ with 4 arguments: mcs, name, bases and attrs. remove entry under the 'formfield_callback' key of the attrs dictionary, if it exists substitute if for formfield_callback, if not formfield_callback is None. call the method __new__ from the base class of the class ModelFormMetaclass, with 4 arguments: mcs, name, bases and attrs, substitute the result for new_class. if bases equals a tuple with an element: class BaseModelForm. return new_class. instantiate class ModelFormOptions with argument: attribute 'Meta' of the new_class object. if it exists or None, if not, assign the result to opts and new_class._meta. for every opt in list containing 3 elements: strings 'fields', 'exclude' and 'localized_fields', get opt attribute of the opts object, substitute it for value. if value is an instance of six.string_types and value is not equal to ALL_FIELDS, msg is a string "%(model)s.Meta.%(opt)s cannot be a string. Did you mean to type: ('%(value)s',)?", where '%(model)s' is replaced, with new_class.__name__, '%(opt)s' is replaced with opt and '%(value)s' is replaced with value. raise an TypeError exception with an argument msg. if opts.model is true, if opts.fields is None and opts.exclude is None, raise an ImproperlyConfigured exception with an argument string "Creating a ModelForm without either the 'fields' attribute, "or the 'exclude' attribute is prohibited; form %s needs updating.", where '%s' is replaced with name. if opts.fields equals ALL_FIELDS, opts.fields is None. call the function fields_for_model with 9 arguments: opts.model, opts.fields, opts.exclude, opts.widgets, formfield_callback, opts.localized_fields, opts.labels, opts.help_texts and opts.error_messages, substitute the result for fields. for every k and v in return value of the function six.iteritems called with an argument fields, if n is false, append it to a list, substitute the resulting list for none_model_fields. missing_fields is difference between set containing none_model_fields and set containing result of the method, new_class.declared_fields.keys. if missing_fields is true, message is an string 'Unknown field(s) (%s) specified for %s'. join missing_fields into a string separated by string ', ', use it and opts.model.__name__ to format message, substitute the result for message. raise an FieldError exception with an argument message. update fields dictionary with new_class.declared_fields. if not, substitute new_class.declared_fields for fields. substitute fields for new_class.base_fields. return new_class. derive the class BaseModelForm from the BaseForm base class. define the method __init__ with 10 arguments: self, data set to None, files set to None, auto_id set to string 'id_%s', prefix set to None, initial set to None, error_class set to ErrorList, label_suffix set to None, empty_permitted set to boolean False, instance set to None. substitute self._meta for opts. if opts.model is None. raise an ValueError with an argument string 'ModelForm has no model class specified.'. if instance is None, call the method opts.model, substitute the result for self.instance. object_data is an empty dictionary. if not, substitute instance for self.instance. call the method model_to_dict with 3 arguments: instance, opts.fields, opts.exclude and substitute the result for object_data. if initial is not None, update object_data dictionary with initial. self._validate_unique is boolean False. call the method __init__ from the base class of the class BaseModelForm, with 8 arguments: data, files, auto_id, prefix, object_data, error_class, label_suffix and empty_permitted. for every field_name in self.fields, substitute value under the field_name key of the self.fields dictionary for formfield. if formfield has an attribute 'queryset', substitute formfield.limit_choices_to for limit_choices_to. if limit_choices_to is not None, if limit_choices_to is callable object, call the function limit_choices_to, substitute the result for limit_choices_to. call the method formfield.queryset.complex_filter with an argument limit_choices_to, substitute the result for formfield.queryset. define the method _get_validation_exclusions with an argument self. exclude is an empty list. for every f in self.instance._meta.fields, substitute f.name for field. if field is not contained in self.fields, append f.name to exclude. otherwise if self._meta.fields is true and field is not contained in self._meta.fields, append f.name to exclude. otherwise if self._meta.exclude is true and field is not contained in self._meta.exclude, append f.name to exclude. otherwise if field is contained in the result of the call to the method self._errors.keys, append f.name to exclude. if not, substitute value under the field key of the self.fields dictionary for form_field. get the value under the field key of the self.cleaned_data dictionary, if it exists substitute it for field_value, if not field_value is None. if f.blank is false and form_field.required is false and field_value is contained in form_field.empty_values, append f.name to exclude. return exclude. define the method clean with an argument self. self._validate_unique is boolean True. return self.cleaned_data. define the method _update_errors with 2 arguments: self and errors. substitute self._meta for opts. call the function errors.error_dict.items, for every field and messages in the result, if field equals NON_FIELD_ERRORS and opts.error_messages is true and NON_FIELD_ERRORS is contained in opts.error_messages, substitute value under the NON_FIELD_ERRORS key of opts.error_messages dictionary for error_messages. otherwise if field is contained in self.fields, get the value under the field key of self.fields dictionary, substitute error_messages field of the result for error_messages. if not, skip this loop iteration. for every message in messages, if message is an instance of ValidationError class and message.code is contained in error_messages, substitute error_messages under the message.code key of error_messages dictionary for message.message. call the method self.add_error with 2 arguments: None and errors. define the method _post_clean with an argument self. substitute self._meta for opts. call the method self._get_validation_exclusions, substitute the result for exclude. convert exclude elements to list, substitute it for construct_instance_exclude. call the method self.fields.items, for every name and field in result, if field is an instance of InlineForeignKeyField class, if value under the name key of self.cleaned_data dictionary is not None, and field _state.adding of value under the name key of self.cleaned_data dictionary is true, append name to construct_instance_exclude list. append name to exclude. call the function construct_instance with 4 arguments: self, self.instance, opts.fields and construct_instance_exclude, substitute the result for self.instance. try, call the method self.instance.full_clean with 2 arguments: exclude set to exclude and validate_unique set to boolean False. if ValidationError, renamed to e, exception is caught, call the method self._update_errors with an argument e. if self._validate_unique is true, call the method self.validate_unique. define the method validate_unique with an argument self. call the method self._get_validation_exclusions, substitute the result for exclude. try, call the method self.instance.validate_unique with an argument exclude set to exclude. if ValidationError, renamed to e, exception is caught, call the method self._update_errors with an argument e. define the method save with 2 arguments: self and commit set to boolean True. if self.instance.pk is None, fail_message is a string 'created'. if not, fail_message is a string changed'. call the function with 7 arguments: self, self.instance, self._meta.fields, fail_message, commit, self._meta.exclude, and construct as boolean False, return the result. save.alters_data is boolean True. derive the class ModelForm from the base class in the return value of the method six.with_metaclass, called with 2 arguments: ModelFormMetaclass and BaseModelForm. do nothing. define the function modelform_factory with 10 arguments: model, form set to ModelForm, fields set to None, exclude set to None, attrs is a dictionary with model for 'model'. if fields is not None, substitute fields for value under the 'fields' key of attrs dictionary. if exclude is not None, substitute exclude for value under the 'exclude' key of attrs dictionary. if widgets is not None, substitute widgets for value under the 'widgets' key of attrs dictionary. if localized_fields is not None, substitute localized_fields for value under the 'localized_fields' key of attrs dictionary. if labels is not None, substitute labels for value under the 'labels' key of attrs dictionary. if help_texts is not None, substitute help_texts for value under the 'help_texts' key of attrs dictionary. if error_messages is not None, substitute error_messages for value under the 'error_messages' key of attrs dictionary. parent is a tuple with 1 element, object. if form has an attribute 'Meta', parent is a tuple with 2 arguments: form.Meta and object. Meta is an instance of class with name 'Meta', parent base class and fields attrs. append string 'Form' to model.__name__, substitute the result for class_name. form_class_attrs is a dictionary with 2 entries: Meta for 'Meta' and formfield_callback for 'formfield_callback'. if 'fields' attribute of Meta object is None and 'exclude' attribute of Meta object is None, raise an ImproperlyConfigured with an argument string "Calling modelform_factory without defining 'fields' or 'exclude' explicitly is prohibited." get the type of form object, return an instance of resulting class created with 3 arguments: class_name, tuple with an element form, and form_class_attrs. derive the class BaseModelFormSet from the BaseFormSet base class. model is None. define the method __init__ with 7 arguments: self, data set to None, files set to None, auto_id set to string 'id_%s', prefix set to None, queryset set to None and unpacked dictionary kwargs. substitute queryset for self.queryset. remove entry under 'initial' key of the kwargs dictionary, substitute it for self.initial_extra if it exists, if not self.initial_extra is None. defaults is a dictionary with 4 entries: data for 'data', files for 'files', auto_id for 'auto_id' and prefix for 'prefix'. update defaults dictionary with kwargs. call the method __init__ from the base class of the class BaseModelFormSet, with an argument unpacked dictionary defaults. define the method initial_form_count with an argument self. if self.data and self.files are both False, call the method self.get_queryset, return the length of the result. call the method initial_form_count from the base class of the class BaseModelFormSet, return the result. define the method _existing_object with 2 arguments: self and pk. if self has an attribute '_object_dict', call the function dict with an argument tuple with 2 elements: o.pk and o, for every o in result of the method self.get_queryset, substitute the result for self._object_dict. return the value under the pk key of self._object_dict dictionary. define the method _get_to_python with 2 arguments: self and field. while field.rel is not None, call the method field.rel.get_related_field, substitute the result for field. return field.to_python. define the method _construct_form with 3 arguments: self, i and unpacked dictionary kwargs. if self.is_bound is true and i is smaller than self.initial_form_count, pk_key is a string "%s-%s", where '%s' is replaced with: result of the method self.add_prefix called with an argument i, and self.model._meta.pk.name. substitute the value under the pk_key key of the self.data dictionary for pk. substitute self.model._meta.pk for pk_field. call the method self._get_to_python with an argument pk_field, substitute the result for to_python. call the function to_python with an argument pk, substitute the result for pk. call the method self._existing_object with an argument pk, substitute the result for value under the 'instance' key of kwargs. if i is smaller than result of the method self.initial_form_count and key 'instance' is not contained in kwargs, call the method self.get_queryset, substitute i-th element of the result for value under the 'instance' key of kwargs dictionary. if i is greater or equal to the result of the method self.initial_form_count and self.initial_extra is true, try, subtract result of the method self.initial_form_count from i, use the result as an index to get the element from self.initial_extra, substitute it for value under the 'initial' key of kwargs dictionary. if IndexError exception is caught, do nothing. call the method _construct_form from the base class of the class BaseModelFormSet, with 2 arguments: i and unpacked dictionary kwargs. define the method get_queryset with an argument self. if self doesnt have '_queryset' attribute, if self.queryset is not None, substitute self.queryset for qs. if not, call the method self.model._default_manager.get_queryset with an argument qs. if qs.ordered is false, call the method qs.order_by with argument self.model._meta.pk.name, substitute the result for qs. substitute qs for self._queryset. return self._queryset. define the method save_new with 3 arguments: self, form and commit set to boolean True. call the method form.save with an argument commit as commit, return the result. define the method save_existing with 4 arguments: self, form, instance and commit set to boolean True. call the method form.save with an argument commit as commit, return the result. define the method save with 2 arguments: self and commit set to boolean True. if commit is true, self.saved_forms is an empty list. define the function save_m2m. for every form in self.saved_forms, call the function form.save_m2m. substitute save_m2m for self.save_m2m. sum results of method self.save_existing_objects called with an argument commit and of method self.save_new_objects, called with an argument commit, return the result. save.alters_data is boolean True. define the method clean with an argument self. call the method self.validate_unique. define the method validate_unique with an argument self. all_unique_checks is an empty set. all_date_checks is an empty set. substitute self.deleted_forms for forms_to_delete. for every form in self.forms append form to a list, if function form.is_valid evaluates to true, and form is not contained in forms_to_delete, substitute the resulting list for valid_forms. for every form in valid_forms, call the method form._get_validation_exclusions, substitute the result for exclude. call the method form.instance._get_unique_checks with an argument exclude as exclude, substitute the result for unique_checks, and date_checks, respectively. all_unique_checks is union of all_unique_checks set and unique_checks set. all_date_checks is union of all_date_checks set and date_checks set. errors is an empty list. for every uclass, unique_check in all_unique_checks, seen_data is an empty set. for every form in valid_forms, row_data is an generator object that returns value under the field key of form.cleaned_data dictionary, for every field in unique_check, if field is contained in form.cleaned_data. create a generator that for every d in row_data, if d has an '_get_pk_val' attribute, returns the result of the call the method d._get_pk_val, if not return d, put all the generator items into a tuple row_data. if row_data is true and None is not contained in row_data, if row_data is contained in seen_data, call the method self.get_unique_error_message with an argument unique_check, append the result to errors. call the method self.error_class with an argument list with a element: result of the method self.get_form_error, substitute the result for value under the NON_FIELD_ERRORS key of the form._errors dictionary. for every field in unique_check, if field is contained in form.cleaned_data, delete the form.cleaned_data dictionary entry under the field key. add row_data to seen_data set. for every date_check in all_date_checks, seen_data is an empty set. substitute date_check elements to uclass, lookup, field and unique_for, respectively. for every form in valid_forms, if form.cleaned_data is true and value under the field key of form.cleaned_data dictionary is not None, and value under the unique_for key of form.cleaned_data dictionary is not None, if lookup equals a string 'date', substitute value under the unique_for key of form.cleaned_data dictionary for date. date_data is a tuple with 3 elements: date.year, date.month and date.day. if not, date_data is a tuple with an entry: attribute lookup from the value under the unique_for key of the form.cleaned_data dictionary. create a tuple out of elements under the key field of the form.cleaned_data dictionary, add elements of date_data to it, substitute it for data. if data is contained in seen_data, call the method self.get_date_error_message with an argument date_check, append the result to errors. call the method self.error_class with an argument list with one element, return value of the method self.get_form_error, substitute the result for the value under the NON_FIELD_ERRORS key of form._errors dictionary. delete entry from form.cleaned_data dictionary under the field key. add data to seen_data set. if errors is true, raise an ValidationError exception with an argument errors. define the method get_unique_error_message with 2 arguments: self and unique_check. if length of unique_check equals integer 1, call the function ugettext with an argument string "Please correct the duplicate data for %(field)s.", where '%(field)s' is replaced with first element of unique_check, return the result. if not, call the function ugettext with an argument string "Please correct the duplicate data for %(field)s, which must be unique.", where '%(field)s' is replaced with return value of the get_text_list function called with 2 arguments: unique_check and return value of the function six.text_type called with return value of the function _ with an argument string 'and', return the result. define the method get_date_error_message with 2 arguments: self and date_check. call the function ugettext with an argument string "Please correct the duplicate data for %(field_name)s which must be unique for, the %(lookup)s in %(date_field)s.", where '%(field_name)s' is replaced with third element of data_check, '%(date_field)s' is replaced with fourth element of date_check and '%(lookup)s' is replaced with result of the function, six.text_type called with second element of date_check as an argument, return the result. define the method get_form_error with an argument self. call the function ugettext with an argument string "Please correct the duplicate values below.", return the result. define the method save_existing_objects with 2 arguments: self and commit set to boolean True. self.changed_objects is an empty list. self.deleted_objects is an empty list. if self.initial_forms is false, return an empty list. saved_instances is an empty list. substitute self.deleted_forms for forms_to_delete. for every form in self.initial_forms, substitute form.instance for obj. if form is contained in forms_to_delete, if obj.pk is None, skip this loop iteration. append obj to self.deleted_objects list. if commit is true, call the method obj.delete. otherwise if form.has_changed method evaluates to true, append a tuple with 2 elements: obj and form.changed_data to self.changed_objects. call the method self.save_existing with 3 arguments: form, obj and commit as commit, append the result to saved_instances. if commit is false, append form to self.saved_forms. return saved_instances. define the method save_new_objects with 2 arguments: self and commit set to boolean True. self.new_objects is an empty list. for every form in self.extra_forms, if function form.has_changed evaluates to false, skip this loop iteration. if self.can_delete is true and call to the function self._should_delete_form with an argument form evaluates to true, skip this loop iteration. call the method self.save_new with 2 arguments: form and commit as commit, append the result to self.new_objects. if commit is false, append form to self.saved_forms. return self.new_objects. define the method add_fields with 2 arguments: self, form and index. from django.db.models import AutoField, OneToOneField and ForeignKey. assign self.model._meta.pk to self._pk_field and pk. define the method pk_is_not_editable with an argument pk. if pk.editable is true, or pk.auto_created is true or pk is an instance of AutoField class, or if pk.rel is true, and pk.rel.parent_link is true and function pk_is_not_editable called with an argument pk.rel.to._meta.pk evaluates to true, if function pk_is_not_editable called with an argument pk evaluates to true, or pk.name is not contained in form.fields, if form.is_bound is true, substitute form.instance.pk for pk_value. if not, try, if index is not None, call the method self.get_queryset, substitute field pk under the result at the index index for pk_value. if not, pk_value is None. if IndexError exception is caught, pk_value is None. if pk is an instance of OneToOneField or ForeignKey classes, call the method pk.rel.to._default_manager.get_queryset, substitute the result for qs. if not, call the method self.model._default_manager.get_queryset with an argument qs. call the method qs.using with an argument form.instance._state.db, substitute the result for qs. if form._meta.widgets is true, get the value under self._pk_field.name key of form._meta.widgets dictionary, if it exists substitute it for widget, if not, widget is an instance of HiddenInput class. if not, widget is an instance of HiddenInput class value under the self._pk_field.name key of form.fields dictionary is an instance of ModelChoiceField class, created with 4 arguments: qs, initial as pk_value, required as boolean False and widget as widget. call the method add_fields from the base class of the class BaseModelFormSet, with 2 arguments: form and index. define the function modelformset_factory with 18 arguments: model, form set to ModelForm, formfield_callback set to None, get 'Meta' attribute from form object, if it exists substitute it for meta, if not meta is None. if meta is None, meta is an instance of a class named 'Meta', derived from the object base class, without any fields. if 'fields' attribute of meta is None, or if it doesnt exists if fields is None and if 'exclude' attribute of meta is None, or if it doesnt exists if exclude is None. raise an ImproperlyConfigured with an argument string "Calling modelformset_factory without defining 'fields' or 'exclude', explicitly is prohibited." call the function modelform_factory with 10 arguments: model, form as form, fields as fields, exclude as exclude, formfield_callback as formfield_callback, widgets as widgets, localized_fields as localized_fields, labels as labels, help_texts as help_texts and error_messages as error_messages, substitute the result for form. call the function formset_factory with 10 arguments: form, formset, extra as extra, min_num as min_num, max_num as max_num, can_order as can_order, can_delete as can_delete, validate_min as validate_min, validate_max as validate_max, substitute the result for form. substitute model for FormSet.model. return FormSet. derive the class BaseInlineFormSet from the BaseModelFormSet base class. define the method __init__ with 8 arguments: self, data set to None, files set to None, instance set to None, save_as_new set to boolean False, prefix set to None, queryset set to None and unpacked dictionary kwargs. if instance is None, call the method self.fk.rel.to, substitute the result for self.instance. if not, substitute instance for self.instance. substitute save_as_new for self.save_as_new. if queryset is None, substitute self.model._default_manager for queryset. if self.instance.pk is not None, call the method queryset.filter with an argument unpacked dictionary containing self.instance for self.fk.name, substitute the result for qs. if not, call the method queryset.none, substitute it for qs. call the method __init__ from the base class of the class BaseInlineFormSet, with 5 arguments: data, files, prefix set to prefix, queryset set to qs and unpacked dictionary kwargs. define the method initial_form_count with an argument self. if self.save_as_new is true, return integer 0. call the method initial_form_count from the base class of the class BaseInlineFormSet, return the result. define the method _construct_form with 3 arguments: self, i and unpacked dictionary kwargs. call the method _construct_form from the base class of the class BaseInlineFormSet, with 2 arguments: i, and unpacked dictionary kwargs, substitute the result for form. if self.save_as_new is true, call the method form.add_prefix with an argument self._pk_field.name, use the result as an key to get the value of the form.data dictionary, assign it value None. call the method form.add_prefix with an argument self.fk.name, use the result as an key to get the value of the form.data dictionary, assign it value None. use return value of the self.fk.get_attname as the name of the attribute of form.instance object to set, set it to self.instance.pk. return form. classmethod decorator, define the method get_default_prefix with an argument cls. from django.db.models.fields.related import RelatedObject into default namespace. instantiate RelatedObject class with 3 arguments: cls.fk.rel.to, cls.model and cls.fk, call the method get_accessor_name on the result, substitute all occurrences of '+' in the result with an empty string, return it. define the method save_new with 3 arguments: self, form and commit set to boolean True. call the method form.save, with an argument commit set to boolean False, substitute the result for obj. get self.instance get attribute 'pk' of the pk_value object, if it doesnt exists use pk_value, set to it self.fk.get_attname return value attribute, of the obj object. if commit is true, call the method obj.save. if commit is true and form has an attribute 'save_m2m', call the method form.save_m2m. return obj. define the method add_fields with 3 arguments: self, form and index. call the method add_fields from the base class of the class BaseInlineFormSet, with 2 arguments: form and index. if self._pk_field equals self.fk, substitute self._pk_field.name for name. kwargs is a dictionary with boolean True for 'pk_field'. if not, substitute self.fk.name for name. kwargs is a dictionary with an entry: attribute 'label' of the object under the name key of the form.fields dictionary for 'label', if it doesnt exists return value of the function capfirst with an argument self.fk.verbose_name for 'label'. if self.fk.rel.field_name is not equal to self.fk.rel.to._meta.pk.name, substitute self.fk.rel.field_name for value under the 'to_field' key of the kwargs dictionary. value under the name key of the form.fields dictionary is an instance of InlineForeignKeyField created with 2 arguments: self.instance and unpacked dictionary kwargs. if form._meta.fields is true, if form._meta.fields is an instance of tuple type, form._meta.fields is a list created out of form._meta.fields elements. append self.fk.name to form._meta.fields. define the method get_unique_error_message with 2 arguments: self and unique_check. unique_check is a list with elements field, for every field in unique_check if field is not equal to self.fk.name. call the method get_unique_error_message from the base class of the class BaseInlineFormSet, with an argument unique_check, return the result. define the function _get_foreign_key with 4 arguments: parent_model, model, fk_name set to None and can_fail set to boolean False. from django.db.models import ForeignKey. substitute model._meta for opts. if fk_name is true, fks_to_parent is a list containing f, for every f in opts.fields if f.name equals fk_name. if length of fks_to_parent equals integer 1. substitute first element of fks_to_parent for fk. if fk is not an instance of ForeignKey class, or fk.rel.to is not equal to parent_model, and fk.rel.to is not contained in result of the call to the method parent_model._meta.get_parent_list. raise an ValueError with an argument string "fk_name '%s' is not a ForeignKey to '%s.%'.", where '%s' is replaced with, fk_name, parent_model._meta.app_label and parent_model._meta.object_name, respectively. otherwise if length of fks_to_parent is zero, raise an ValueError with an argument string "'%s.%s' has no field named '%s'.", where '%s' is replaced with, model._meta.app_label, model._meta.object_name, fk_name, respectively. if not, fks_to_parent is a list containing f for every f in opts.fields, only if f is an instance of ForeignKey, and, if f.rel.toequals parent_model or f.rel.to is contained in result of the call to the method parent_model._meta.get_parent_list. if length of fks_to_parent is integer 1, substitute first element of fks_to_parent for fk. otherwise if length of fks_to_parent is zero, if can_fail is true, return nothing. raise an ValueError with an argument string "'%s.%s' has no ForeignKey to '%s.%s'.", where '%s' is replaced with, model._meta.app_label, model._meta.object_name, parent_model._meta.app_label, parent_model._meta.object_name, respectively. if not, raise an ValueError with an argument string "'%s.%s' has more than one ForeignKey to '%s.%s'.", where '%s' is replaced with, model._meta.app_label, model._meta.object_name, parent_model._meta.app_label, parent_model._meta.object_name, respectively. return fk. define the function inlineformset_factory with 20 arguments: parent_model, model, form set to ModelForm, call the function _get_foreign_key with 3 arguments: parent_model, model and fk_name=fk_name, substitute the result for fk. if fk.unique is boolean true, max_num is integer 1. kwargs is a dictionary with 17 entries: form for 'form', formfield_callback for 'formfield_callback', formset for 'formset', extra for 'extra', can_delete for 'can_delete', can_order for 'can_order', fields for 'fields', exclude for 'exclude', min_num for 'min_num', max_num for 'max_num', widgets for 'widgets', validate_min for 'validate_min', validate_max for 'validate_max', localized_fields for 'localized_fields', labels for 'labels', help_texts for 'help_texts', and error_messages for 'error_messages'. call the function modelformset_factory with 2 arguments: model and unpacked dictionary kwargs, substitute the result for FormSet. substitute fk for FormSet.fk. return FormSet. derive the class InlineForeignKeyField from the Field base class. substitute HiddenInput for widget. default_error_messages is an dictionary with an entry: return value of the function _ called with an argument, string 'The inline foreign key did not match the parent instance primary key.' for 'invalid_choice'. define the method __init__ with 4 arguments: self, parent_instance, unpacked list args and unpacked dictionary kwargs. substitute parent_instance for self.parent_instance. remove element from kwargs dictionary under the key 'pk_field', substitute it for self.pk_field if it exists, if not self.pk_field is boolean False. remove element from kwargs dictionary under the key 'to_field', substitute it for self.to_field if it exists, if not self.to_field is None. if self.parent_instance is not None, if self.to_field is true, get self.to_field attribute of self.parent_instance object, substitute it for value under the 'initial' key of the kwargs dictionary. if not, substitute self.parent_instance.pk for value under the 'initial' key of the kwargs dictionary. value under the 'required' key of the kwargs dictionary is boolean False. call the method __init__ from the base class of the class InlineForeignKeyField, with 2 arguments unpacked list args, and unpacked dictionary kwargs. define the method clean with 2 arguments: self and value. if value is contained in self.empty_values, if self.pk_field, return None. return self.parent_instance. if self.to_field is true, get self.to_field attribute of self.parent_instance, substitute it for orig. if not, substitute self.parent_instance.pk for orig. if return values of the function force_text called two times with 1 argument, with value, and with orig, are equal, raise an ValidationError with 2 arguments: self.error_messages dictionary value under the 'invalid_choice' key, and code set to a string 'invalid_choice'. return self.parent_instance. define the method _has_changed with 3 arguments: self, initial and data. return boolean False. derive the class ModelChoiceIterator from object base class. define the method __init__ with 2 arguments: self and field. substitute field for self.field. substitute field.queryset for self.queryset. define the method __iter__ with an argument self. if self.field.empty_label is not None, yield a tuple with 2 elements: an empty string and self.field.empty_label. if self.field.cache_choices is true, if self.field.choice_cache is None, self.field.choice_cache is a list containing results of the method self.choice called with an argument obj, for every obj in result of the method self.queryset.all. for every choice in self.field.choice_cache, yield choice. if not, for every obj in result of the call to the method self.queryset.all, call the method self.choice with an argument obj, yield the result. define the method __len__ with an argument self. sum length of self.quertset and integer 1 if self.field.empty_label is not None, or integer 0 if not, return the result. define the method choice with 2 arguments: self and obj. return a tuple with 2 elements: result of the method self.field.prepare_value called with an argument obj, and result of the method self.field.label_from_instance, called with an argument obj. derive the class ModelChoiceField from the ChoiceField base class. default_error_messages is a dictionary with an entry, result of the call to the function _ with an argument, string 'Select a valid choice. That choice is not one of the available choices.' for 'invalid_choice'. define the method __init__ with 13 arguments: self, queryset, empty_label set to a string "---------", cache_choices set to None, required set to boolean True, widget set to None, label set to None, initial set to None, help_text set to an empty string, to_field_name set to None, limit_choices_to set to None, unpacked list args and unpacked dictionary kwargs. if required is true and initial is not None, self.empty_label is None. if not, substitute empty_label for self.empty_label. if cache_choices is not None, call the function warnings.warn with 3 arguments: string "cache_choices has been deprecated and will be removed in Django 1.9.", RemovedInDjango19Warning and stacklevel set to integer 2. if not, substitute boolean False for cache_choices. substitute cache_choices for self.cache_choices. call the method Field.__init__ with 8 arguments: self, required, widget, label, initial, help_text, unpacked list args, and unpacked dictionary kwargs. substitute queryset for self.queryset. substitute limit_choices_to for self.limit_choices_to. self.choice_cache is None. substitute to_field_name for self.to_field_name define the method __deepcopy__ with 2 arguments: self and memo. call the method __deepcopy__ from the base class of the class ChoiceField, with an argument memo, substitute the result for result. substitute result.queryset for result.queryset. return result. define the method _get_queryset with an argument self. return self._queryset. define the method _set_queryset with 2 arguments: self and queryset. substitute queryset for self._queryset. substitute self.choices for self.widget.choices. queryset is an property object of this class, with _get_queryset getter and _set_queryset setter functions. define the method label_from_instance with 2 arguments: self and obj. call the function smart_text with an argument obj, return the result. define the method _get_choices with an argument self. if self has an attribute '_choices', return self._choices. return an instance of ModelChoiceIterator class, created with an argument self. choices is an property property object of this class, with _get_choices getter and ChoiceField._set_choices setter functions. define the method prepare_value with 2 arguments: self and value. if value has an attribute '_meta', if self.to_field_name is true, call the method value.serializable_value with an argument self.to_field_name, return the result. if not, return value.pk. call the method prepare_value from the base class of the class ModelChoiceField, with an argument value, return the result. define the method to_python with 2 arguments: self and value. if value is contained in self.empty_values, return None. try, substitute self.to_field_name, if exists, for key, if not substitute string 'pk' for key. call the method self.queryset.get with an argument, unpacked dictionary with an element: value for key, substitute the result for value. if ValueError or self.queryset.model.DoesNotExist exception is caught, raise an ValidationError exception with 2 arguments: value under the 'invalid_choice' key of the self.error_messages dictionary, code set to a string 'invalid_choice'. return value. define the method validate with 2 arguments: self and value. call the method Field.validate with 2 arguments: self and value, return the result. define the method _has_changed with 3 arguments: self, initial and data. if initial is not None, substitute initial for initial_value, otherwise initial_value is an empty string. if data is not None, substitute data for initial_value, otherwise data_value is an empty string. call the method self.prepare_value with an argument initial_value, use it as the argument for the call to the function force_text, if the result is equal to the result of the call to the function force_text with data_value as an argument, return boolean True, otherwise return boolean False. derive the class ModelMultipleChoiceField from the ModelChoiceField base class. substitute SelectMultiple for widget. substitute MultipleHiddenInput for hidden_widget. default_error_messages is an dictionary with 3 entries: return value of the function _ called with an argument, string 'Enter a list of values.' for 'list', return value of the function _ called with an argument, string 'Select a valid choice. %(value)s is not one of the available choices.' for 'invalid_choice', and return value of the function _ called with an argument string '"%(pk)s" is not a valid value for a primary key.' for 'invalid_pk_value'. define the method __init__ with 10 arguments: self, queryset, cache_choices set to None, required set to boolean True, widget set to None, label set to None, initial set to None, help_text set to an empty strign, unpacked list args and unpacked dictionary kwargs. call the method __init__ from the base class of the class ModelMultipleChoiceField, with 10 arguments: queryset, None, cache_choices, required, widget, label, initial, help_text, unpacked list args and unpacked dictionary kwargs. define the method to_python with 2 arguments: self and value. if value is false, return an empty list. instantiate base class of the class ModelMultipleChoiceField, substitute filed to_python of the result for to_py. return a list containing return values of the function to_py called with an argument val, for every val in value. define the method clean with 2 arguments: self and value. if self.required is true and value is false, raise an ValidationError with 2 arguments: dictionary self.error_messages value under the key 'required', and code set to string 'required. otherwise if self.required is false and value is false, call the method self.queryset.none, return the result. if value is not an instance of list or tuple types, raise an ValidationError with 2 arguments: dictionary self.error_messages value under the key 'list', and code set to string 'list. substitute self.to_field_name, if true, for key, or if not, substitute string 'pk' for key. for every pk in value, try, call the method self.queryset.filter with an argument, unpacked dictionary with an entry: pk for key. if ValueError exception is caught, raise an ValidationError with 3 arguments: dictionary self.error_messages value under the key 'invalid_pk_value', code set to string 'invalid_pk_value and params with an entry: pk for 'pk'. call the method self.queryset.filter with an argument, unpacked dictionary with an entry: value for string '__in' appended to key, substitute the result for qs. pks is a set containing results of the call to the function force_text with an argument, key attribute of the o object, for every o in opts. for every val in value, call the function force_text with an argument val, if the result is not contained in pks, raise an ValidationError with 3 arguments: dictionary self.error_messages value under the key 'invalid_choice', code set to string 'invalid_choice' and params as a dictionary with an entry, val for 'value'. call the method self.run_validators with an argument value. return qs. define the method prepare_value with 2 arguments: self and value. if value has an attribute '__iter__' and value is not an instance of six.text_type and value doesnt have an attribute '_meta', call the method prepare_value from the base class of the class ModelMultipleChoiceField, with an argument v, for every v in value, return the list of results. call the method prepare_value the base class of the class ModelMultipleChoiceField, with an argument value, return the result. define the method _has_changed with 3 arguments: self, initial and data. if initial is None, initial is an empty list. if data is None, data is an empty list. if lengths of initial and data are equal, return boolean True. initial_set is set created out of return values of the function force_text called with an argument value, for every value in result of the method self.prepare_value called with an argument initial. data_set is set created out of return values of the function force_text called with an argument value, for every value in data. if data_set is not equal to initial_set return boolean True, otherwise return boolean False. define the function modelform_defines_fields with an argument form_class. only if form_class is not None, and if form_class has an attribute '_meta' and form_class._meta.fields is not None, import module warnings. from django.utils.deprecation import RemovedInDjango19Warning into default name space. call the function warnings.warn with 3 arguments: string "The django.forms.util module has been renamed. " "Use django.forms.utils instead.", RemovedInDjango19Warning and stacklevel set to an integer 2. from django.forms.utils import everything into default name space. from __future__ import unicode_literals into default name space. import module json. import module sys. try, from collections import UserList into default namespace. if ImportError exception is caught. from UserList import UserList into default namespace. from django.conf import settings into default name space. from django.utils.encoding import force_text and python_2_unicode_compatible into default name space. from django.utils.html import format_html, format_html_join and escape into default name space. from django.utils import timezone into default name space. from django.utils.translation import ugettext_lazy as _ into default name space. from django.utils import six into default name space. from django.core.exceptions import ValidationError into default name space. define the function flatatt with an argument attrs. boolean_attrs is an empty list. convert items of attrs dictionary to list of tuples, for every attr and value in it, if value is boolean True, append tuple containing element attr to boolean_attrs. delete entry under the attr key of the attrs dictionary. otherwise if value is boolean False, delete entry under the attr key of the attrs dictionary. call the function format_html_join twice, first time with 3 elements: an empty string, string ' {0}="{1}"' and sorted return value of the items of the attrs dictionary, and second time with 3 arguments: an empty string, string ' {0}', and sorted list of boolean_attrs elements, concatenate the results and return the resulting list. python_2_unicode_compatible decorator, derive the class ErrorDict from the dict base class. define the method as_data with an argument self. return a dictionary generated with an expression, return value of the method e.as_data for f, for every f and e in list of tuples of self dictionary key, pair entries. define the method as_json with 2 argumens self and escape_html set to boolean False. call the method json.dumps with a dictionary generate with an expression as an argument, return value of the function e.get_json_data, with an argument escape_html for f, for every f and e in list of tuples of self dictionary key, pair entries, return the result. define the method as_ul with an argument self. if self is false, return an empty string. call the function format_html with 2 arguments: string '
      {0}
    ', and return value of the function, format_html_join, called with 3 arguments: empty string, string '
  • {0}{1}
  • ', tuple containing tuples with 2 elements: k and result of the function force_text with an argument v, for every k and v in items of the dictionary self, return the result. define the method as_text with an argument self. output is an empty list. call the method self.items, for every field and errors in the result. convert field into a string and concatenate it to a string '* ', append the result to output. for every e in errors convert e into a string and append it to a string ' * ', join all the results into a string separated by newlines, append the result to output. join elements of output into a string, separated by newline characters, return the result. define the method __str__ with an argument self. call the method self.as_ul, return the result. python_2_unicode_compatible decorator, derive the class ErrorList from the UserList and list base classes. define the method __init__ with 3 arguments: self, initlist set to None and error_class set to None. call the method __init__ with an argument initlist from the base class of the class ErrorList. if error_class is None, self.error_class is a string 'errorlist'. if not, append error_class converted into a string to string 'errorlist ', substitute the result for self.error_class. define the method as_text with an argument self. instantiate ValidationError class with an argument self.data, return its field error_list. define the method get_json_data with 2 arguments self and escape_html set to boolean False. errors is an empty list. call the method self.as_data, for every error in the result. convert elements of error into a list, substitute the first element for message. append to errors list a dictionary created with 2 etries, if escape_html is true, return value of the function escape with an argument message for 'message', or if not message for 'message' and error.code for 'code' in error.code is true, if not, an empty string for 'code'. return errors. define the method as_json with 2 arguments self and escape_html set to boolean False. call the method self.get_json_data with an argument escape_html, use the result as an argument for the call to the json.dumps function, return the result. define the method as_text with an argument self. if self.data is false, return an empty string. call the function format_html with 3 arguments: string '
      {1}
    ', self.error_class and return value of the function, format_html_join, called with 3 arguments: empty string, string '
  • {0}
  • ', tuple containing results of the function, force_text with an argument e, for every e in self, return the result. define the method as_text with an argument self. for every e in self, append convert e to an string and append it to string '* ', join all of the results into a string separated by newline character, return the result. define the method __str__ with an argument self. call the method self.as_ul, return the result. define the method __repr__ with an argument self. convert elements of self into a list, return the its printable representation. define the method __contains__ with an argument self. if item is contained in the list of the elements of self, return boolean True, otherwise return boolean False. define the method __eq__ with an argument self. if other equals list containing elements of self, return boolean True, otherwise return boolean False. define the method __ne__ with an argument self. if other is not equal to list containing elements of self, return boolean True, otherwise return boolean False. define the method __getitem__ with an argument self. substitute i-th element of self.data for error. if error is an instance of ValidationError, return first element of the list containing elements of error. call the function force_text with an argument error, return the result. define the function from_current_timezone with an argument value. if settings.USE_TZ is true and value is not None and call to the function timezone.is_naive with an argument value, evaluates to true, call the method timezone.get_current_timezone, substitute the result for current_timezone. try, call the function timezone.make_aware with arguments value and current_timezone, return the result. if Exception exception is caught, call the function _ with an argument string '%(datetime)s couldn\'t be interpreted in time zone %(current_timezone)s; it ' 'may be ambiguous or it may not exist.', substitute the result for message. params is an dictionary containing 2 initial entries: value for 'datetime' and current_timezone for 'current_timezone'. call the function six.reraise with 3 arguments: class ValidationError, class ValidationError, created with 3 arguments: message, code as a string 'ambiguous_timezone' and params as params, and third element of the return value of the function sys.exc_info. return value. define the function to_current_timezone with an argument value. if settings.USE_TZ is true and value is not None and call to the function timezone.is_aware with an argument value, evaluates to true, call the function timezone.get_current_timezone, substitute the result for current_timezone. call the function timezone.make_naive with 2 arguments value, current_timezone, return the result. return value. from __future__ import unicode_literals into default name space. import module copy. from itertools import chain into default name space. from django.conf import settings into default name space. from django.forms.utils import flatatt and to_current_timezone into default name space. from django.utils.datastructures import MultiValueDict and MergeDict into default name space. from django.utils.encoding import force_text and python_2_unicode_compatible into default name space. from django.utils.html import conditional_escape and format_html into default name space. from django.utils.translation import ugettext_lazy into default name space. from django.utils.safestring import mark_safe into default name space. from django.utils import formats and six into default name space. from django.utils.six.moves.urllib.parse import urljoin into default name space. __all__ is a tuple of strings: 'Media', 'MediaDefiningClass', 'Widget', 'TextInput', 'EmailInput', 'URLInput', 'NumberInput', 'PasswordInput', 'HiddenInput', 'MultipleHiddenInput', 'ClearableFileInput', 'FileInput', 'DateInput', 'DateTimeInput', 'TimeInput', 'Textarea', 'CheckboxInput', 'Select', 'NullBooleanSelect', 'SelectMultiple', 'RadioSelect','CheckboxSelectMultiple', 'MultiWidget', 'SplitDateTimeWidget' and 'SplitHiddenDateTimeWidget'. MEDIA_TYPES is a tuple with 2 strings: 'css' and 'js'. python_2_unicode_compatible decorator, derive the class Media from the object base class. define the method __init__ with 3 arguments: self, media set to None and unpacked dictionary kwargs. if media is true, substitute media.__dict__ for media_attrs. if not, substitute kwargs for media_attrs. self._css is an empty dictionary. self._js is an empty list. for every name in MEDIA_TYPES, append name to string 'add_' use it as the name of the attribute to get from object self, call the result as an function, with an argument: value under the name key of the media_attrs dictionary, if it exists, if not use None as an argument. define the method __str__ with an argument self. call the method self.render, return the result. define the method render with an argument self. call the function chain with an argument unpacked list, append name to string 'render_', and use it as the name of the attribute to get from the self object, call the result and append it to a list for every name in MEDIA_TYPES, join all the results into a string with newline separator, use the result as an argument for the call to the function mark_safe, return the result. define the method render_js with an argument self. return a list containing results of the function format_html called with 2 arguments: string '' and absolute file path of the path, for every path is self._js. define the method render_css with an argument self. call the method self._css.keys, sort the result and substitute it for media. return the result of the call to the function chain, with an argument unpacked list, containing the result of the function, format_html called with 3 arguments: string '', return value of the function self.absolute_path called with an argument path and medium, for every medium in media and for every path in value under the medium key of the self._css dictionary. define the method absolute_path with 3 arguments self, path and prefix set to None. if path starts with string 'http://' or string 'https://' or with string '/', return path, if prefix is None, if settings.STATIC_URL is None, substitute settings.MEDIA_URL for prefix. if not, substitute settings.STATIC_URL for prefix. join prefix and path into an url, return it. define the method __getitem__ with arguments self and name. if name is contained in MEDIA_TYPES, return an instance of the class Media, called with an unpacked dictionary with an entry: name appended to string '_', attribute of the self object for name converted into a string. raise an KeyError with an argument string 'Unknown media type "%s"', where '%s' is replaced with name. define the method __getitem__ with arguments self and name. if data is true, for every path in data, if path is not contained in self._js, append path to self._js. define the method add_css with arguments self and data. if data is true, call the method data.items, for every medium and paths in the result. for every path in paths, if call to the method self._css.get with an argument medium evaluates to false, or path is not contained in the value under the medium key of self._css dictionary. call the method self._css.setdefault with 2 arguments medium and an empty string, append path to the result. define the method __add__ with arguments self and other. combined is an instance of Media class. for every name in MEDIA_TYPES, append name to 'add_' use it as the name of the attribute to get from combined object , call the result with an argument: name appended to string '_', as the name of the attribute to get from self object, or if the previous doesnt exist, None. append name to 'add_' use it as the name of the attribute to get from combined object , call the result with an argument: name appended to string '_', as the name of the attribute to get from other object, or if the previous doesnt exist, None. return combined. define the function media_property with an argument cls. define the method _media with an argument self. sup_cls is base class of the class cls. try, substitute sup_cls.media for base. if AttributeError exception is caught, base is an instance of Media class. get the attribute 'Media' of the cls object, if it exists substitute it for definition, if not definition is None. if definition is true, get the attribute 'extend' of the cls object, if it exists substitute it for extend, if not extend is boolean True. if extend is true, if extend is boolean True, substitute base for m. if not, m is an instance of Media class. for every medium in extend, sum m and value under the medium key of the base dictionary, substitute it for m. sum m and class Media created with definition, return the result. if not, return an instance of Media class, created with definition as an argument. if not, return base. return property object with _media as getter function. derive the class MediaDefiningClass from the type base class. define the method __new__ with 4 arguments mcs, name, bases and attrs. call the method __new__ from the base class of the class MediaDefiningClass, called with 4 arguments: mcs, name, bases and attrs. if 'media' is not contained in attrs, call the method media_property with an argument new_class, substitute the result for new_class.media. return new_class. python_2_unicode_compatible decorator derive the class SubWidget from the object base class. define the method __init__ with 6 arguments self, parent_widget, name, value, attrs and choices. substitute parent_widget for self.parent_widget. substitute name and value for self.name and self.value. substitute attrs and choices for self.attrs and self.choices define the method __str__ with an argument self. args is an list with 3 initial elements self.name, self.value and self.attrs. if self.choices is true, append self.choices to args. call the method self.parent_widget.render with unpacked list args as an argument, return the result. derive the class Widget from the base class in the return value of the six.with_metaclass called with an argument MediaDefiningClass. needs_multipart_form is boolean False. is_localized is boolean False. is_required is boolean False. define the method __init__ with arguments self and attrs set to None. if attrs is not None, call the method attrs.copy, substitute the result for self.attrs. if not, self.attrs is an empty dictionary. define the method __deepcopy__ with arguments self and memo. call the method copy.copy, substitute the result for obj. call the method self.attrs.copy, substitute the result for obj.attrs. substitute obj for the value of the memo dictionary at the identity of the self object key. return obj. property decorator, define the method is_hidden with an argument self. if self.input_type equals string 'hidden' and self has an attribute 'input_type', return boolean True, otherwise return boolean False. define the method subwidgets with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. yield an instance of SubWidget class created with 5 arguments: self, name, value, attrs and choices. define the method render with 4 arguments: self, name, value and attrs set to None. raise an NotImplementedError with an argument string 'subclasses of Widget must provide a render() method'. define the method build_attrs with 3 arguments: self, extra_attrs set to None and unpacked dictionary kwargs. unpack dictionary kwargs, map it through self.attrs and convert to dictionary, substitute the result for attrs. if extra_attrs is true, update attrs dictionary with extra_attrs entry. return attrs. define the method render with 4 arguments: self, name, value and attrs set to None. get the value under the name key of the data dictionary, return it, if the previous doesnt exists, return None. define the method id_for_label with 2 arguments: self and id. return id_. derive the class Input from the Widget base class. input_type is None. define the method _format_value with 2 arguments: self and value. if self.is_localized is true, call the method formats.localize_input with an argument value, return the result. return value. define the method render with 4 arguments: self, name, value and attrs set to None. if value is None, value is an empty string. call the method self.build_attrs with 3 arguments: attrs, type as self.input_type, name as name, substitute the result for final_attrs. if value is not equal to an empty string, call the method self._format_value with an argument value, use the result as an argument for the call to the function force_text, substitute the result for final_attrs dictionary value under the 'value' key. call the function format_html with 2 arguments: string '', result of the function flatatt called with an argument final_attrs, return the result. derive the class TextInput from the Input base class. input_type is a string 'text'. define the method __init__ with 2 arguments: self and attrs set to None. if attrs is not None, remover the entry under the 'type' key of the attrs dictionary, substitute it for self.input_type, if the key doesnt exists, substitute self.input_type for self.input_type. call the method __init__ from the base class of the class TextInput, called with an argument attrs. derive the class NumberInput from the TextInput base class. input_type is a string 'number'. derive the class EmailInput from the TextInput base class. input_type is a string 'email'. derive the class URLInput from the TextInput base class. input_type is a string 'url'. derive the class PasswordInput from the TextInput base class. input_type is a string 'password'. define the method __init__ with 3 arguments: self, attrs set to None and render_value set to boolean False. call the method __init__ from the base class of the class PasswordInput, called with an argument attrs. substitute render_value for self.render_value. define the method render with 4 arguments: self, name, value and attrs set to None. if self.render_value is false, value is None. call the method render from the base class of the class PasswordInput, called with 3 arguments: name, value and attrs, return the result. derive the class HiddenInput from the Input base class. input_type is a string 'hidden'. derive the class MultipleHiddenInput from the HiddenInput base class. define the method __init__ with 3 arguments: self, attrs set to None and choices set to an empty tuple. call the method __init__ from the base class of the class MultipleHiddenInput, called with an argument attrs. substitute choices for self.choices. define the method render with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. if value is None, value is an empty list. call the method self.build_attrs with 3 arguments: attrs, type set to self.input_type, name set to name, substitute the result for final_attrs. get the value under the 'id' key of final_attrs dictionary, substitute if for id_ if the key doesnt exists, id_ is None. inputs is an empty list. for every i and v in enumerated iterable value, unpack dictionary final_attrs, map the values through force_text function with an argument v and convert it to a dictionary, again, substitute the result input_attrs. if id_, replace '%s' in string '%s_%s' with id_ and i, substitute the result for input_attrs dictionary value under the 'id' key. call the function format_html with 2 arguments: string '', return value of the function flatatt, called with an argument, input_attrs, append the result to inputs list. join inputs elements into a string, separated with newline character, use it as an argument for the call to the function mark_safe, return the result. define the method value_from_datadict with 4 arguments: self, data, files and name. if data is an instance of MultiValueDict or MergeDict class, call the method data.getlist with an argument name, return the result. return value under the name key of the data dictionary, if it doesnt exists, return None. derive the class FileInput from the Input base class. input_type is a string 'file'. needs_multipart_form is boolean True. define the method render with 4 arguments: self, name, value and attrs set to None. call the method render from the base class of the class FileInput, called with 3 arguments: name, None and attrs as attrs. define the method value_from_datadict with 4 arguments: self, data, files and name. return value under the name key of the files dictionary, if it doesnt exists, return None. FILE_INPUT_CONTRADICTION is an instance of object class. derive the class ClearableFileInput from the FileInput base class. call the function ugettext_lazy with an argument string 'Currently', substitute the result for initial_text. call the function ugettext_lazy with an argument string 'Change', substitute the result for input_text. call the function ugettext_lazy with an argument string 'Clear', substitute the result for clear_checkbox_label. template_with_initial is a string '%(initial_text)s: %(initial)s %(clear_template)s
    %(input_text)s: %(input)s'. template_with_clear is a string '%(clear)s '. url_markup_template is a string '{1}'. define the method clear_checkbox_name with 2 arguments: self and name. concatenate name and string '-clear', return it. define the method clear_checkbox_id with 2 arguments: self and name. concatenate name and string '_id', return it. define the method render with 4 arguments: self, name, value and attrs set to None. substitutions is a dictionary with 4 initial entries: self.initial_text for 'initial_text', self.input_text for 'input_text', an empty string for 'clear_template' and self.clear_checkbox_label for 'clear_checkbox_label'. template is a string '%(input)s'. call the method render from the base class of the class ClearableFileInput, called with 3 arguments: name, value and attrs, substitute the result for value under the 'input' key of the substitutions dictionary. if value is true and value has an attribute 'url', substitute self.template_with_initial for template. call the function format_html with 3 arguments: self.url_markup_template, value.url and return value of the function force_text, called with an argument value, substitute the result for value under the 'initial' key of the substitutions dictionary. if self.is_required is false, call the method self.clear_checkbox_name with an argument name, substitute the result for checkbox_name. call the method self.clear_checkbox_id with an argument checkbox_name, substitute the result for checkbox_id. call the function conditional_escape with an argument checkbox_name, substitute the result for value under the 'clear_checkbox_name' key of the substitutions dictionary. call the function conditional_escape with an argument checkbox_id, substitute the result for value under the 'clear_checkbox_id' key of the substitutions dictionary. call the method render from the instance of CheckboxInput class, with 3 arguments: checkbox_name, boolean False, attrs as a dictionary with an entry: checkbox_id for 'id', substitute the result for value under the 'clear' key of the substitutions dictionary. format self.template_with_clear with substitutions, substitute the result for value under the 'clear_template' key of, substitutions dictionary. call the function mark_safe with an argument template, formated with substitutions, return the result. define the method value_from_datadict with 4 arguments: self, data, files and name. call the method value_from_datadict from the base class of the class ClearableFileInput, called with 3 arguments: data, files and name, substitute the result for upload. if self.is_required is boolean false and call to the method value_from_datadict from the instance of CheckboxInput class, with 3 arguments: data, files and return value of the function self.clear_checkbox_name called with an argument name, evaluates to true, if upload is true, return FILE_INPUT_CONTRADICTION. return boolean False. return boolean upload. derive the class Textarea from the Widget base class. define the method __init__ with 2 arguments: self and attrs set to None. default_attrs is an dictionary with 2 initial entries: string '40' for 'cols' and string '10' for 'rows'. if attrs is true, update default_attrs dictionary with attrs entry. call the method __init__ from the base class of the class Textarea, with an argument default_attrs. define the method render with 4 arguments: self, name, value and attrs set to None. if value is None, value is an empty string. call the method self.build_attrs with 2 arguments: attrs and name set to name, substitute the result for final_attrs. call the function format_html with 3 arguments: string ('\r\n{1}', return value of the function flatatt, called with an argument final_attrs and return value of the function force_text called with an argument value, return the result. derive the class DateTimeBaseInput from the TextInput base class. format key is an empty string. supports_microseconds is boolean False. define the method __init__ with 3 arguments: self, attrs set to None and format is None. call the method __init__ from the base class of the class DateTimeBaseInput, with an argument attrs. substitute format for self.format if format is true, if not self.format is None. define the method _format_value with 2 arguments: self and value. call the function formats.localize_input with 2 arguments: value and self.format if true, if not, then the first element of the result of the function formats.get_format called with an argument self.format_key, return the result. derive the class DateInput from the DateTimeBaseInput base class. format_key is a string 'DATE_INPUT_FORMATS'. derive the class DateTimeInput from the DateTimeBaseInput base class. format_key is a string 'DATETIME_INPUT_FORMATS'. derive the class TimeInput from the DateTimeBaseInput base class. format_key is a string 'TIME_INPUT_FORMATS'. define the function boolean_check with an argument v. if v is boolean False or v is None or v is an empty string, return boolean False, otherwise return boolean True. derive the class CheckboxInput from the Widget base class. define the method __init__ with 3 arguments: self, attrs set to None and check_test set to None. call the method __init__ from the base class of the class CheckboxInput, with an argument attrs. substitute boolean_check for self.check_test if check_test is None, otherwise substitute check_test for self.check_test. define the method render with 4 arguments: self, name, value and attrs set to None. call the method self.build_attrs with 3 arguments: attrs, type as a string 'checkbox', name as name, substitute the result for final_attrs. call the method self.check_test with an argument value, if it evaluates to true, substitute string 'checked' for value under the 'checked' key of final_attrs dictionary. if value is boolean False or boolean True or value is None or value is an empty string, do not perform the following, call the function force_text with an argument value, substitute the result for value under the 'value' key of the final_attrs. return the result of the function format_html called with 2 arguments: string '', and result of the function flatatt, called with an argument final_attrs. define the method value_from_datadict with 4 arguments: self, data, files and name. if name is not contained in data, return boolean False. get the name key of the data dictionary, substitute it for value. values is an dictionary with 2 arguments: boolean False for 'false' and boolean True for 'true'. if value is an instance of six.string_types class, get the value of the values dictionary under the value converted to lowercase key, substitute it for value, if the key doesnt exists, substitute value for value. return value converted into a boolean. derive the class Select from the Widget base class. allow_multiple_selected is boolean False. define the method __init__ with 3 arguments: self, attrs set to None and choices set to an empty tuple. call the method __init__ from the base class of the class Select, with an argument attrs. convert elements of choices into a list, substitute it for self.choices. define the method render with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. if value is None, value is an empty string. call the method self.build_attrs with arguments attrs, name as name, substitute the result for final_attrs. output is a list containing an element: result of the function format_html called with 2 arguments: string '', and return value of the function flatatt called with an argument final_attrs, substitute the result for output. call the method self.render_options with 2 arguments: choices and list with an entry, value, substitute the result for options. if options is true, append options to output. append string '' to output. join elements of output into a string, separated by newline characters, use it as the argument for the call the function mark_safe, return the result. define the method render_option with 4 arguments: self, selected_choices, option_value and option_label. if option_value is None, option_value is an empty string. call the function force_text with an argument option_value, substitute the result for option_value. if option_value is contained in selected_choices, call the function mark_safe with an argument string ' selected="selected"', substitute the result for selected_html. if self.allow_multiple_selected is false, call the method selected_choices.remove with an argument option_value. if not, selected_html is an empty string. call the function format_html with 4 arguments: string '', option_value, selected_html, result of the function force_text with an argument option_label, return the result. define the method render_options with 3 arguments: self, choices and selected_choices. call the function force_text with an argument v, for every v in selected_choices, add results to a set, substitute the resulting set for selected_choices. output is an empty list. call the function chain with arguments self.choices and choices, for every option_value and option_label in the result, if option_label is an instance of list or tuple, call the function format_html with 2 arguments: string '' and return value of the function force_text, called with an argument option_value, append the result to output. for every option in option_label, call the method self.render_option with 2 arguments: selected_choices and unpacked list option, append the result to output. append string '' to output. if not, call the method self.render_option with 3 arguments: selected_choices, option_value and option_label, append the result to output. join elements of output in a string, separated by newlines, return it. derive the class NullBooleanSelect from the Select base class. define the method __init__ with 2 arguments: self and attrs set to None. choices is a tuple with 3 elements: tuple with 2 elements: string '1' and return value of the function ugettext_lazy, called with an argument string 'Unknown', tuple with 2 elements: string '2' and return value of the function ugettext_lazy, called with an argument string 'Yes' and tuple with 2 elements: string '3' and return value of the function ugettext_lazy, called with an argument string 'No'. call the method __init__ from the base class of the class NullBooleanSelect, with arguments attrs and choices. define the method render with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. try, get the value under value key of a dictionary with 4 entries: '2' for boolean True, '3' for boolean False, '2' for '2', and '3' for '3', substitute it for value. if KeyError exception is caught, value is an string '1'. call the method render from the base class of the class NullBooleanSelect, with 4 arguments: name, value, attrs and choices, return the result. define the method value_from_datadict with 4 arguments: self, data, files and name. get the value under the name key of the data dictionary, if it exists substitute it for value, if not, value is None. get the value under the value key of a dictionary with 6 entries: boolean True for '2', boolean True for boolean True, boolean True for 'True', boolean False for '3', boolean False for 'False' and boolean False for boolean False, return it if the key exists, if not return None. derive the class SelectMultiple from the Select base class. allow_multiple_selected is boolean True. define the method render with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. if value is None, value is an empty list. call the method self.build_attrs with 2 arguments: attrs and name set to name, substitute the result for final_attrs. output is a list containing an entry: result of the function format_html called with 2 arguments: string '' to output. join elements of output into a string, separated with newline character, use it as an argument for the call to the mark_safe function, return the result. define the method value_from_datadict with 4 arguments: self, data, files and name. if data is an instance of MultiValueDict or MergeDict, call the method data.getlist with an argument name, return the result. get the value under the name key of the data dictionary, if it exists return it, if not return None. python_2_unicode_compatible decorator, derive the class ChoiceInput from the SubWidget base class. input_type is None. define the method __init__ with 6 arguments: self, name, value, attrs, choice and index. substitute name for self.name. substitute value for self.value. substitute attrs for self.attrs. call the function force_text with first element of choice as an argument, substitute the result for self.choice_value. call the function force_text with second element of choice as an argument, substitute the result for self.choice_label. substitute index for self.index. if string 'id' is contained in self.attrs, convert self.index into a string and append it to '_' string, substitute it for value under the 'id' key of self.attrs dictionary. define the method __str__ with an argument self. call the method self.render, return the result. define the method render with 5 arguments: self, name set to None, value set to None, attrs set to None and choices set to an empty tuple. self.id_for_label is true, call the function format_html with 2 arguments: string ' for="{0}"' and self.id_for_label, substitute the result for label_for. if not, label_for is an empty string. call the function format_html with 4 arguments: string '{1} {2}', label_for, result of the method self.tag, and self.choice_label, return the result. define the method is_checked with an argument self. if self.value equals self.choice_value, return boolean True, if not, return boolean False. define the method tag with an argument self. call the method dict with 4: self.attrs, type as self.input_type, name as self.name, value as self.choice_value, substitute the result for final_attrs. call the method self.is_checked, if it evaluates to true, substitute string 'checked' for value under the 'checked' key of final_attrs dictionary. call the function format_html with 2 arguments: string '' and result of the function flatatt, called with an argument final_attrs, return the result. property decorator, define the method id_for_label with an argument self. get the value under the 'id' key of the self.attrs dictionary, return it, if the key doesnt exists return an empty string. derive the class RadioChoiceInput from the ChoiceInput base class. input_type is a string 'radio'. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. call the method __init__ from the base class of the class RadioChoiceInput, with 2 arguments: unpacked list args, and unpacked dictionary kwargs. call the function force_text with an argument self.value, substitute the result for self.value. derive the class CheckboxChoiceInput from the ChoiceInput base class. input_type is a string 'checkbox'. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. call the method __init__ from the base class of the class CheckboxChoiceInput, with 2 arguments: unpacked list args, and unpacked dictionary kwargs. for every v in self.value call the function force_text with an argument v, add the result to a set, substitute set of the results for self.value. define the method is_checked with an argument self. if self.choice_value is contained in self.value return boolean True, otherwise return boolean False. python_2_unicode_compatible decorator, derive the class ChoiceFieldRenderer from the object base class. choice_input_class is None. outer_html is a string '{content}'. inner_html is a string '
  • {choice_value}{sub_widgets}
  • '. define the method __init__ with 5 arguments: self, name, value, attrs and choices. substitute name for self.name. substitute value for self.value. substitute attrs for self.attrs. substitute choices for self.choices. define the method __getitem__ with 2 arguments: self and idx. substitute idx-th element of self.choices for choice. call the method self.choice_input_class with 5 arguments: self.name, self.value, result of the method self.attrs.copy, choice and idx, return the result. define the method __str__ with an argument self. call the method self.render, return the result. define the method render with an argument self. get the value under the 'id' key of the self.attrs dictionary, substitute it for id_ if the key exists, if not id_ is None. output is an empty list. for every i and choice in enumerated iterable self.choices, substitute choice for choice_value and choice_label, respectively. if choice_label is an instance of tuple or list, call the method self.attrs.copy, substitute the result for attrs_plus. if id_ is true, prepend string '_' to i converted to an string, append the result to the value under the 'id' key of the attrs_plus. sub_ul_renderer is an instance of ChoiceFieldRenderer class, created with 4 arguments: name as self.name, value as self.value, attrs as attrs_plus and choices as choice_label. substitute self.choice_input_class for sub_ul_renderer.choice_input_class. call the function format_html with 3 arguments: self.inner_html, choice_value set to choice_value, and sub_widgets set to return value of the function sub_ul_renderer.render, append the result to output. if not, call the method self.choice_input_class with 5 arguments: self.name, self.value, return value of the method self.attrs.copy, choice and i, substitute the result for w. call the function format_html with 3 arguments: self.inner_html, choice_value set to result of the function force_text, called with an argument w, and sub_widgets as an empty string, append the result to output. call the function format_html with 3 arguments: self.outer_html, if id_ is true id_attr set to return value of the function format_html, if not id_attr set to an empty string, content set to result of the function mark_safe with an argument: string created by joining elements of outputs, with '\n' separator, return the result. derive the class RadioFieldRenderer from the ChoiceFieldRenderer base class. substitute RadioChoiceInput for choice_input_class. derive the class CheckboxFieldRenderer from the ChoiceFieldRenderer base class. substitute CheckboxChoiceInput for choice_input_class. derive the class RendererMixin from the object base class. renderer is None. _empty_value is None. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. remove entry under 'render' key of the kwargs dictionary and substitute it for renderer, if the key doesnt exists, renderer is None. if renderer is true, substitute renderer for self.renderer. call the method __init__ from the base class of the class RendererMixin, with 2 arguments: unpacked list args, and unpacked dictionary kwargs. define the method subwidgets with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. call the method self.get_renderer with 4 arguments: name, value, attrs and choices, for every widget in result, yield widget. define the method get_renderer with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. if value is None, substitute self._empty_value for value. call the method self.build_attrs with an argument attrs, substitute the result for final_attrs. call the function chain with 2 arguments: self.choices and choices, convert the result into a list and substitute it for choices. call the method self.renderer with 4 arguments: name, value, final_attrs and choices, return the result. define the method render with 5 arguments: self, name, value, attrs set to None and choices set to an empty tuple. call the method self.get_renderer with 4 arguments: name, value, attrs and choices, call the render method on the result, return the result. define the method id_for_label with 2 arguments: self and id_. if id_ is true, append string '_0' to id_. return id_. derive the class RadioSelect from the RendererMixin and Select base classes. substitute RadioFieldRenderer for renderer. _empty_value is an empty string. derive the class CheckboxSelectMultiple from the RendererMixin and SelectMultiple base classes. substitute CheckboxFieldRenderer for renderer. _empty_value is an empty list. derive the class MultiWidget from the Widget base class. define the method __init__ with 3 arguments: self, widgets and attrs set to None. for every w in widgets, call the function w and append the result to a list, if w is an instance of type class, if not append w to the list, substitute the resulting list for self.widgets. call the method __init__ from the base class of the class MultiWidget, with an argument attrs. property decorator, define the method is_hidden with an argument self. for every w in self.widgets, if all elements w.is_hidden are true, return boolean True, otherwise return boolean False. define the method render with 4 arguments: self, name, value and attrs set to None. if self.is_localized is true, for every bwidget in self.widgets, substitute self.is_localized for widget.is_localized. if value is not an instance of list type, call the method self.decompress with an argument value, substitute the result for value. output is an empty list. call the method self.build_attrs with an argument attrs, substitute the result for final_attrs. get the value under the 'id' key of the final_attrs dictionary, substitute it for id_, if it doesnt exists, id_ is None. for every i and widget in enumerated iterable self.widgets, try, substitute i-th element of value for widget_value. if IndexError exception is caught, widget_value is None. if id_ is true, call the dict function with 2 arguments: final_attrs and id set to string '%s_%s', where '%s' is replaced with id_ and i, substitute the result for final_attrs. call the method widget.render with 3 arguments: string created by concatenation from: name, string '_' and i, widget_value, and final_attrs, append the result to output. call the method self.format_output with an argument output, use the result as an argument for the call to the function mark_safe, return the result. define the method id_for_label with 2 arguments: self and id_. if id_ is true, append string '_0' to id_. return id_. define the method value_from_datadict with 2 arguments: self, data, files and name. for every i and widget in enumerated iterable self.widgets, call the function widget.value_from_datadict with 3 arguments: data, files and string created with concatenation of: name, string '_' and i converted into a string, return the results in a list. define the method format_output with 2 arguments: self and rendered_widgets. join rendered_widgets into a string, return it. define the method decompress with 2 arguments: self and value. raise NotImplementedError exception with an argument string 'Subclasses must implement this method.'. define the method _get_media with an argument self. media is an instance of Media class. for every w in self.widgets, sum media and w.media, substitute the result for media. return media. media is a property object of the current class, with _get_media as getter function. define the method __deepcopy__ with 2 arguments: self and memo. call the method __deepcopy__ from the base class of the class MultiWidget, with an argument memo, substitute the result for obj. call the method copy.deepcopy with an argument self.widgets, substitute the result for obj.widgets. return obj. property decorator, define the method needs_multipart_form with an argument self. if any w.needs_multipart_form for every w in self.widgets is true, return boolean True, if not return boolean False. derive the class SplitDateTimeWidget from the MultiWidget base class. supports_microseconds is boolean False. define the method __init__ with 4 arguments: self, attrs set to None, date_format set to None and time_format set to None. widgets is a tuple with 2 elements: instance of DateInput class, created with 2 arguments: attrs as attrs and format as date_format, and instance of TimeInput class, created with 2 arguments: attrs set to attrs and format set to date_format. call the method __init__ from the base class of the class SplitDateTimeWidget, with 2 arguments: widgets and attrs. define the method decompress with 2 arguments: self and value. if value is true, call the function to_current_timezone with an argument, substitute the result for value. return a list containing 2 elements: return value of the value.date method and return value of the replace method, called with the argument microseconds set to integer 0, on the result of the method value.time. return list containing 2 elements: None and None. derive the class SplitHiddenDateTimeWidget from the SplitDateTimeWidget base class. define the method render with 4 arguments: self, attrs set to None, date_format set to None and time_format set to None. call the method __init__ from the base class of the class SplitHiddenDateTimeWidget, with 3 arguments: attrs, date_format, and time_format. for every widget in self.widgets:, widget.input_type is a string 'hidden'. from django.http.cookie import SimpleCookie and parse_cookie into default name space. from django.http.request import HttpRequest, QueryDict, RawPostDataException, UnreadablePostError and build_request_repr into default name space. from django.http.response import HttpResponse, StreamingHttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseNotModified, HttpResponseBadRequest, HttpResponseForbidden, HttpResponseNotFound, HttpResponseNotAllowed, HttpResponseGone, HttpResponseServerError, Http404, BadHeaderError, JsonResponse into default name space. from django.http.utils import fix_location_header and conditional_content_removal into default name space. __all__ is a list of strings, 'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict', 'RawPostDataException', from __future__ import unicode_literals into default name space. from django.utils.encoding import force_st into default name space. from django.utils import six into default name space. from django.utils.six.moves import http_cookies into default name space. call the function http_cookies.SimpleCookie, on the return value call the value_encode method, with the argument character ';', if the tuple result equals to tuple containing character ';' and string '"\\073"', respectively, assign _cookie_encodes_correctly the boolean True value, otherwise assign it False. assign return value of the call to the http_cookies.SimpleCookie function to _tc. try, call the _tc.load method with the 'foo:bar=1' converted to string as an argument. _cookie_allows_colon_in_names is a boolean True. if http_cookies.CookieError exception is caught, _cookie_allows_colon_in_names is boolean False. if _cookie_encodes_correctly and _cookie_allows_colon_in_names are boolean True, substitute http_cookies.SimpleCookie for SimpleCookie. if not, substitute http_cookies.Morsel for Morsel. derive class SimpleCookie from the base class http_cookies.SimpleCookie. if _cookie_encodes_correctly is boolean False, define method value_encode with self class instance and val as arguments. from the base class of the class SimpleCookie call the value_encode method with val as the argument, store the result in the val and encoded, respectively. in encoded, replace all the occurrences of unicode character "\\054" with ',' character and "\\073" with ';' characters. if encoded contains string "\\" and if encoded doesnt start with the double quote symbol, put the double qoutes around encoded. return val and encoded as a tuple. if _cookie_allows_colon_in_names is False, define the method load with self class instance and rawdata as arguments. self.bad_cookies is an empty set. if six.PY2 is true and rawdata is an instance of the type six.text_type. call the function force_str with raw data as an argument and substitute it for rawdata. from the base class of the SimpleCookie class call the method load with rawdata as argument. for every key is self.bad_cookies, delete self entry under the key key. define protected method _BaseCookie__set with self class instance, key, real_value and coded_value as arguments. evaluate the function force_str with key as the argument, substitute it for key. try, get the value under the key of the dictionary self, if key does not exists return evaluated result of the function Morsel, substitute it for M. call the M.set method with the key, real_value, coded_value as the arguments. call the private dict.__setitem__ method with self class instance, key and M as arguments. if http_cookies.CookieError exception is raised. if self does not have 'bad_cookies' attribute, self.bad_cookies is an empty set. add key to the self.bad_cookies set. call the private dict.__setitem__ method with self class instance, key and result of the function http_cookies.Morsel() as arguments. define the function parse_cookie with cookie as the argument. if cookie is an empty string, return an empty dictionary. if cookie is not an instance of http_cookies.BaseCookie, try, c is an instance of the class SimpleCookie. call the load method on the c class instance, with the cookie argument. if http_cookies.CookieError exception is raised, return an empty dictionary. if not, substitute cookie for c. cookiedict is an empty dictionary. for every key in return value of the method c.keys call, get the value filed from the return value of the call to the c.key with the argument key, add the value to the cookiedict under the key key. return cookiedict. from __future__ import unicode_literals into default name space. import module base64. import module binascii. import module cgi. import module sys. from django.conf import settings into default name space. from django.core.exceptions import SuspiciousMultipartF into default name space. from django.utils.datastructures import MultiValueDict into default name space. from django.utils.encoding import force_text into default name space. from django.utils import six into default name space. from django.utils.text import unescape_entities into default name space. from django.core.files.uploadhandler import StopUpload, SkipFile and StopFutureHandlers into default name space. __all__ is an tuple with 3 elements: strings 'MultiPartParser', 'MultiPartParserError' and 'InputStreamExhausted'. derive the class MultiPartParserError from the Exception base class. do nothing. derive the class InputStreamExhausted from the Exception base class. do nothing. RAW is a string "raw". FILE is a file". FIELD is a field". if six.PY2 is true, _BASE64_DECODE_ERROR is TypeError, if not, _BASE64_DECODE_ERROR is binascii.Error. derive the class MultiPartParser from the object base class. define the method __init__ wiht 5 arguments: self, META, input_data, upload_handlers and encoding set to None. get the value from META dictionary, under the 'HTTP_CONTENT_TYPE' key, if the key doesnt exist, return the value under the 'CONTENT_TYPE' of the META dictionary, if it doesnt exist return an empty string, substitute the result for content_type. if content_type doesnt start with string 'multipart/', raise an MultiPartParserError with an argument string 'Invalid Content-Type: %s', where '%s' is replaced with content_type. call the method boundary with an argument string 'ascii', use the result to call to the parse_header function, assign the result to ctypes and opts. get the value under the 'boundary' key of the opts dictionary, substitute it for boundary. if boundary is false or return value of the method cgi.valid_boundary called with an argument boundary evaluates to false, raise an MultiPartParserError with an argument string 'Invalid boundary in multipart: %s' is replaced with boundary. try, convert value under the 'HTTP_CONTENT_LENGTH' key of the META dictionary to an integer of base of value under the 'CONTENT_LENGTH' key of META dictionary, if the key doesnt exists use 0 as the base, substitute the result for content_length. if ValueError or TypeError are caught, content_length is integer 0. if content_length is lesser than integer 0, raise an MultiPartParserError with an argument string "Invalid content length: %r", where '%r' is replaced with content_length. if boundary is an instance of six.text_type class, call the method boundary.encode with an argument string 'ascii', substitute the result for boundary. substitute boundary for self._boundary. substitute input_data for self._input_data. for every x in upload_handlers if x.chunk_size is true, append x.chunk_size to a list, substitute the result for possible_sizes. bring integer 2 to the power of 31, subtract the result by 4, put the result into a list, append possible_sizes to it, substitute minimal element of the resulting list for self._chunk_size. substitute META for self._meta. if encoding is true, substitute it for self._encoding, if not substitute settings.DEFAULT_CHARSET for self._encoding. substitute content_length for self._content_length. substitute _upload_handlers for self.__upload_handlers. define the method parse with an argument self. from django.http import QueryDict into default namespace. substitute self._encoding for encoding. substitute self._upload_handlers for handlers. if self._content_length equals integer 0, instantiate QueryDict class with 2 arguments: an empty string and encoding set to self._encoding, instantiate a class MultiValueDict, return them. for every handler in handlers, call the method handler.handle_raw_input with 5 arguments: self._input_data, self._meta, self._content_length, self._boundary, and encoding, substitute the result for result. if result is not None, return first and second element of result. self._post is an instance of QueryDict class, created with an empty string and mutable set to boolean True. self._files is an instance of MultiValueDict class. instantiate class ChunkIter with 2 arguments: self._input_data and self._chunk_size, use it to instantiate LazyStream class, assign the handle to stream. old_field_name is None. counters is a list containing length of handlers number of zeros. try, call the Parser object with stream and self._boundary, for every item_type, meta_data and field_stream in return value, if old_field_name is true, call the method self.handle_file_complete with arguments old_field_name, counters. old_field_name is None. try, get the value under the 'content-disposition' key of the meta_data dictionary, substitute second element of it for disposition. get the value under the 'name' key of the disposition dictionary, strip it of whitespaces, substitute the result for field_name. if KeyError, IndexError and AttributeError exception is caught, skip this loop iteration, get the value under the 'content-transfer-encoding' key of the disposition meta_data, substitute it for transfer_encoding. if transfer_encoding is not None, strip of the whitespaces first element of transfer_encoding, substitute the result for transfer_encoding. call the function force_text with 3 arguments: field_name, encoding and errors as a string 'replace', substitute the result for field_name. if item_type equals FIELD, if transfer_encoding equals a string 'base64', call the method field_stream.read, substitute the result for raw_data. try, call the function base64.b64decode with an argument raw_data, substitute the result for data. if _BASE64_DECODE_ERROR exception is caught, substitute raw_data for data. if not, call the method field_stream.read, substitute the result for data. call the method self._post.appendlist with 2 arguments: field_name and result of the function force_text called with 3 arguments: data, encoding and errors as a string 'replace'. otherwise if item_type equals FILE, get the value under the 'filename' key of the disposition dictionary, substitute it for file_name. if file_name is false, skip this loop execution. call the function force_text with 3 arguments: file_name, encoding and errors set to string 'replace', substitute the result for file_name. call the function unescape_entities with an argument file_name, use the result as an argument for the call to the self.IE_sanitize, method, substitute the result for file_name. get the value under the 'content-type' of the meta_data dictionary, if it exists assign it to content_type, content_type_extra, if not, content_type is an empty string and content_type_extra is an empty dictionary. strip the content_type of the whitespaces, substitute it for content_type. get the value under the 'charset' key of the content_type_extra dictionary, substitute it for charset. try, convert to an integer first element of the value under the 'content-length' key of the meta_data dictionary, substitute it for content_length. if IndexError, TypeError or ValueError exception is caught, content_length is None. counters is a list containing length of handlers number of zeros. try, for every handler in handlers, try, call the method handler.new_file with 6 arguments: field_name, file_name, content_type, content_length, charset and content_type_extra. if StopFutureHandlers exception is caught. break the loop execution. for every chunk in field_stream, if transfer_encoding equals string 'base64', calculate length of chunk modulo integer 4, substitute the result for over_bytes. if over_bytes is true, call the method field_stream.read with an argument: over_bytes subtracted from integer 4, substitute the result for over_chunk. increment chunk by over_chunk. try, call the method base64.b64decode with an argument chunk, substitute the result for chunk. if Exception, renamed to e, exception is caught, msg is a string "Could not decode base64 data: %r", where '%r' is replace with e. call the method six.reraise with 3 arguments: MultiPartParserError, MultiPartParserError created with msg, and third element of the result of the function sys.exc_info. for every i and handler in enumerated iterable handlers, substitute length of chunk for chunk_length. call the method handler.receive_data_chunk with 2 arguments: chunk and i-th element of counters, substitute the result for chunk. increment i-th element of counters by chunk_length. if chunk is None, break the loop execution. if SkipFile exception is caught, call the method self._close_files. call the function exhaust with an argument field_stream. if not, substitute field_name for old_field_name. if not, call the function exhaust with an argument stream. if StopUpload, renamed to e, exception is caught, call the method self._close_files. if e.connection_reset is false, call the function exhaust with an argument self._input_data. if not, call the function exhaust with an argument self._input_data. for every handler in handlers, call the method handler.upload_complete, substitute the result for retval. if retval is true, break the loop execution. return self._post and self._files. define the method handle_file_complete with 3 arguments: self, old_field_name and counters. for every i and handler in enumerated iterator self._upload_handlers, call the method handler.file_complete with i-th element of counters as an argument, substitute the result for file_obj. if file_obj is true, call the function force_text with 3 arguments: old_field_name, self._encoding and errors as a string 'replace', use the result and file_obj as arguments for the call to the method self._files.appendlist. break the loop execution. define the method IE_sanitize with arguments self and filename. call the method filename.rfind with an argument string "\\", increment the result by one, slice the filename from the previous result as start index to the end, strip it of white spaces from both ends, if the result is not an empty string and filename is not an empty string, return boolean True, otherwise return boolean False. define the method _close_files with an argument self. for every handler in self._upload_handlers, if handler has an attribute 'file', call the method handler.file.close. derive the class LazyStream from the six.Iterator base class. define the method __init__ with 3 arguments: self, producer and length set to None. substitute producer for self._producer. self._empty is boolean False. self._leftover is an empty string. substitute length for self._length. self.position is an integer 0. substitute length for self._remaining. self._unget_history is an empty list. define the method tell with an argument self. return self.position. define the method read with arguments self and size set to None. define the function parts. if size is None substitute self._remaining for remaining, if not, substitute size for remaining. if remaining is None, join self into a bytes string, yield the result as the return value of the generator. return nothing. while remaining is not equal to integer 0, if remaining is not greater than 0, assert an error with the message string 'remaining bytes to read should never go negative'. get the next element of iterable self, substitute it for chunk. create list of first remaining elements of chunk, substitute it for emitting. call the method self.unget with list containing first remaining elements of chunk as an argument. decrement remaining by length of emitting. yield emitting as result of the generator. join result of the parts function into a bytes string, substitute it for out. return out. define the method __next__ with an argument self. if self._leftover is true, substitute self._leftover for output. self._leftover is an empty string. if not, get the next element of the self._producer iterable, substitute it for output. self._unget_history is an empty list. increment self.position by length of output. return output. define the method close with an argument self. self._producer is an empty list. define the method _iter with an argument self. return self. define the method unget with arguments self and bytes. if bytes is false, return nothing. call the method self._update_unget_history with length of bytes as an argument. decrement self.position by length of bytes. join bytes and self._leftover into a bytes string, substitute it for self._leftover. define the method _update_unget_history with arguments self and num_bytes. append first 49 elements of self._unget_history to list containing num_bytes, substitute the result for self._unget_history. append current_number to a list for current_number in self._unget_history, if current_number is equal to num_bytes, substitute the length of the resulting list for number_equal. if number_equal is greater than integer 40, raise SuspiciousMultipartForm exception with an argument string, "The multipart parser got stuck, which shouldn't happen with" " normal uploaded files. Check for malicious upload activity; if there is none, report this to the Django developers.". derive the class ChunkIter from the six.Iterator base class. define the method __init__ with arguments self, flo and chunk_size set to integer 64 multiplied by integer 1024. substitute flo for self.flo. substitute chunk_size for self.chunk_size. define the method __next__ with an argument self. try, call the method self.flo.read with an argument self.chunk_size, substitute the result for data. if InputStreamExhausted exception is caught, raise an StopIteration exception. if data is true, return data. if not, raise an StopIteration exception. define the method __iter__ with an argument self. return self. derive the class InterBoundaryIter from the six.Iterator base class. define the method __init__ with arguments self, stream and boundary. substitute stream for self._stream. substitute boundary for self.boundary. define the method __iter__ with an argument self. return self. define the method __next__ with an argument self. try, instantiate class BoundaryIter with 2 arguments: self._stream and self._boundary, use it to instantiate LazyStream class, return it. if InputStreamExhausted exception is caught, raise an StopIteration. derive the class BoundaryIter from the six.Iterator base class. define the method __init__ with arguments self, stream and boundary. substitute stream for self._stream. substitute boundary for self._boundary. self._done is boolean False. increment length of boundary by integer 6, substitute the result for self._rollback. call the method self._stream.read with an argument integer 1, substitute the result for unused_char. if unused_char is false, raise an InputStreamExhausted exception, call the method self._stream.unget with an argument unused_char. define the method __iter__ with an argument self. return self. define the method __next__ with an argument self. if self._done is true, raise an StopIteration exception, substitute self._stream for stream. substitute self._rollback for rollback. bytes_read is integer 0. chunks is an empty list. for every bytes in stream, increment bytes_read by length of bytes. append bytes to chunks. if bytes_read is greater than rollback, break the loop execution. if bytes is false, break the loop execution. if not, self._done is boolean True. if chunks is false, raise an StopIteration exception. join chunks into bytes string, substitute it for chunk. call the method self._find_boundary with 2 arguments: chunk and boolean if length of chunks is lesser than self._rollback, or boolean False if not, substitute the result for boundary. if boundary is true, substitute elements of tuple boundary to end and next, respectively. call the method stream.unget with elements of list chunk from the index next to the end. self._done is boolean True. return first end elements of list chunk. if not, slice chunk list to get the last rollback elements, if the new list is not empty, self._done is boolean True. return chunk. if not, call the method stream.unget with last rollback elements of chunk as an argument. return last rollback elements of chunk. define the method _find_boundary with an arguments self, data and eof set to boolean False. call the method data.find with an argument self._boundary, substitute the result for index. if index is lesser than integer 0, return None. if not, substitute index for end. sum index and length of self._boundary, substitute the result for next. substitute greater element between integer 0 and end decremented by one for last. element of data at the index last equals to newline bytes character. decrement end by one. substitute greater element between integer 0 and end decremented by one for last. element of data at the index last equals to carriage return bytes character. decrement end by one. return end ans next. define the function exhaust with an argument stream_or_iterable. iterator is None. try, iterator is iterator created out of stream_or_iterable. if TypeError exception is caught, iterator is an instance of ChunkIter class, created with arguments: stream_or_iterable and integer 16384. if iterator is None, raise an MultiPartParserError with an argument string 'multipartparser.exhaust() was passed a non-iterable or stream parameter'. for every __ in iterator, do nothing. define the function parse_boundary_stream with arguments stream and max_header_size. call the method stream.read with an argument max_header_size, substitute the result for chunk. call the method chunk.find with an argument bytes string '\r\n\r\n', substitute the result for header_end. define the method _parse_header with an argument line. call the function parse_header with an argument line, substitute the result for main_value_pair and params, respectively. try, split into two parts string main_value_pair at character ':', substitute the parts for name and value, respectively. if ValueError exception is caught, raise an ValueError with an argument string "Invalid header: %r", where '%s' is replaced with line. return name and tuple containing 2 elements value and params. if header_end equals integer negative 1, call the method stream.unget with an argument chunk. return tuple containing 3 elements: RAW, an empty dictionary and stream. substitute first header_end elements of chunk list for header. call the method stream.unget with list containing elements of chunk list from the header_end incremented by integer 4 as a start index to the end as argument. substitute RAW for TYPE. outdict is an empty dictionary. split header string at string '\r\n', for every line in result, try, call the method _parse_header with an argument line, assign the result to name and tuple with 2 elements: value and params, respectively. if ValueError exception is caught, skip this loop iteration. if name equals a string 'content-disposition', substitute FIELD for TYPE, get the value under the 'filename' key of the params dictionary, if it is true, substitute FILE for TYPE. assign value and params to the value under the name key of the outdict dictionary. if TYPE equals to RAW, call the method stream.unget with an argument chunk. return a tuple with 3 elements: TYPE, outdict and stream. derive the class Parser from the base class object. define the method __init__ with arguments self, stream and boundary. substitute stream for self._stream. append boundary to bytes string '--', substitute the result for self._separator. define the method __iter__ with an argument self. boundarystream is an instance of InterBoundaryIter class, created with self._stream and self._separator as arguments. for every sub_stream in boundarystream, call the function parse_boundary_stream with 2 arguments: sub_stream and integer 1024, yield the result as the return value of the generator. define the function parse_header with an argument line. append line to bytes string ';', use it as an argument for the call to the function _parse_header_params, substitute the result for plist. pop the first element from plist, convert it to lowercase, call the method decode on it, with string 'ascii' as an argument, substitute the result for key. pdict is an empty dictionary. for every p in plist, call the method p.find with bytes string '=' as an argument, substitute the result for i. if i is greater or equal to integer 0, take the first i elements of string p, strip the whitespaces from the both sides, convert it to lowercase and apply on it the method, decode with an argument string 'ascii', substitute the result for name. take elements of p from index i incremented by 1 to the end, strip the result of the whitespaces, substitute it for value. if length of value is greater or equal to integer 2 and first and last elements of value are an empty string, strip value of the first and last element. replace all the occurrences of '\\\\' in string value with '\\' and all occurrences of '\\"' for '"', substitute the result for value. substitute value for the vale under the name key of the pdict dictionary. return key and pdict. define the function _parse_header_params with an argument s. plist is an empty list. while first element of s is equal to bytes string ';', substitute s without the first element for s. call the method s.find with an argument bytes string ';', substitute the result for end. while end is greater than integer 0 and return value of the s.count called with 3 arguments: an empty string, integer 0 and end, is an even number, call the method s.find with 2 arguments: bytes string ';' and end incremented by one, substitute the result for end. if end is lesser than integer 0, substitute length of s for end. substitute first end elements of s for f. strip f of whitespaces and append it to plist. substitute elements of s from the end index to end for s. return plist. from __future__ import unicode_literals into default name space. import module copy. import module os. import module re. import module sys. from io import BytesIO into default name space. from itertools import chain into default name space. from pprint import pformat into default name space. from django.conf import settings into default name space. from django.core import signing into default name space. from django.core.exceptions import DisallowedHost and ImproperlyConfigured into default name space. from django.core.files import uploadhandler into default name space. from django.http.multipartparser import MultiPartParser and MultiPartParserError into default name space. from django.utils import six into default name space. from django.utils.datastructures import MultiValueDict and ImmutableList into default name space. from django.utils.encoding import force_bytes, force_text, force_str and iri_to_uri into default name space. from django.utils.six.moves.urllib.parse import parse_qsl, urlencode, quote, urljoin and urlsplit into default name space. RAISE_ERROR is an instance of object class. compile the regex "^https?://" with an argument re.I, substitute it for absolute_http_url_re. compile the regex "^([a-z0-9.-]+|\[[a-f0-9]*:[a-f0-9:]+\])(:\d+)?$", substitute it for host_validation_re. derive the class UnreadablePostError from the base class IOError. do nothing. derive the class RawPostDataException from the base class Exception. do nothing. derive the class HttpRequest from the object base class. _encoding is None. _upload_handlers is an empty list. define the method __init__ with an argument self. self.GET is an instance of QueryDict class created with an argument mutable set to boolean True. self.POST is an instance of QueryDict class created with an argument mutable set to boolean True. self.COOKIES is an empty dictionary. self.META is an empty dictionary. self.FILES is an instance of MultiValueDict class. self.path is an empty string. self.path_info is an empty string. self.method is None. self.resolver_match is None. self._post_parse_error is boolen False. define the method __repr__ with an argument self. call the method build_request_repr with an argument self, return the result. define the method get_host with an argument self. if settings.USE_X_FORWARDED_HOST is true and 'HTTP_X_FORWARDED_HOST' is contained in self.META. get the value under the 'HTTP_X_FORWARDED_HOST' key of the self.META dictionary, substitute the result for host. if 'HTTP_HOST' is contained in self.META, substitute the value under the 'HTTP_HOST' key of the self.META dictionary, substitute it for host. if not, substitute the value under the 'SERVER_NAME' key of the self.META dictionary, substitute it for host. convert the value under the 'SERVER_NAME' key of the self.META dictionary to a string, substitute result for server_port. if return value of the self.is_secure method is true and server_port is not equal to string '443', if return value of the self.is_secure is false and server port is not equal to string '80', join host and server_port into a string, separated with ':', substitute the result for host. if settings.DEBUG is true, return host. call the function split_domain_port with an argument host, assign the result to domain and port, respectively. if domain is true and return value of the function validate_host called with 2 arguments: domain and settings.ALLOWED_HOSTS, evaluates to true, return host. if not, msg is a string "Invalid HTTP_HOST header: %r.", replace '%r' with host. if domain is true, append string " You may need to add %r to ALLOWED_HOSTS." to msg, where '%s' is replaced with domain. if not, append string " The domain name provided is not valid according to RFC 1034/1035." to msg. raise an DisallowedHost exception with an argument msg. define the method get_full_path with an argument self. if the value under the 'QUERY_STRING' key of the self.META dictionary is true, call the function iri_to_uri, called with value under the 'QUERY_STRING' key of the self.META dictionary and append it to string '?', append the result th the self.path converted into a string and return it, if the value under the 'QUERY_STRING' key of the self.META dictionary is false, return self.path converted into a string. def the method get_signed_cookie with 5 arguments: self, key, default set to RAISE_ERROR, salt as an empty string, try, substitute value under the key key of the self.COOKIES dictionary, substitute it for cookie_value. if KeyError exception is caught, if default is true and RAISE_ERROR is false, return default. if not, raise an exception. try, call the method signing.get_cookie_signer with an argument salt set to sum of key and salt, call the method unsign on the result, with arguments cookie_value and max_age set to max_age. if signing.BadSignature exception is caught, if default is true and RAISE_ERROR is false, return default. if not, raise an exception. return value. define the method build_absolute_uri with an arguments self and location set to None. if location is None, call the method self.get_full_path, append the result to string '//', substitute it for location. call the function urlsplit with an argument location, substitute the result for bits. do not perform the following only if bits.scheme and bits.netloc are both true, format the string '{scheme}://{host}{path}' by replacing scheme with self.scheme, host with return value of the self.get_host method, and path with self.path, substitute the result for current_uri. call the function urljoin with arguments current_uri and location, substitute the result for location. call the function iri_to_uri with an argument location, return the result. define the method _get_scheme with an argument self. return string 'https' if value under the "HTTPS" key of the os.environ dictionary equals string 'on', if not return 'http'. property decorator. define the method scheme with an argument self. if settings.SECURE_PROXY_SSL_HEADER is true, try, assign the settings.SECURE_PROXY_SSL_HEADER to header and value, respectively. if ValueError exception is caught, raise an ImproperlyConfigured exception with an argument string 'The SECURE_PROXY_SSL_HEADER setting must be a tuple containing two values.'. if value under the header key of the self.META dictionary is equal to value, return string 'https'. call the method self._get_scheme, return the result. define the method is_secure with an argument self. if self.scheme equals to string 'https', return boolean True, otherwise return boolean False. define the method is_ajax with an argument self. get the value under the 'HTTP_X_REQUESTED_WITH' key of the self.META dictionary, if it equals string 'XMLHttpRequest', return boolean True, otherwise return boolean False. property decorator. define the method encoding with an argument self. return self._encoding. encoding.setter decorator, define the method encoding with arguments self and val. substitute val for self._encoding. if self has an '_get' attribute, delete self._get. if self has an '_post' attribute, del self._post define the method _initialize_handlers with an argument self. for every handler in settings.FILE_UPLOAD_HANDLERS, add to a list result of the method uploadhandler.load_handler called with arguments handler and self, substitute resulting list for self._upload_handlers. property decorator, define the method upload_handlers with an argument self. if self._upload_handlers is false, call the method self._initialize_handlers, return self._upload_handlers. upload_handlers.setter decorator. define the method upload_handlers with arguments: self and upload_handlers. if self has an '_files' attribute. raise an AttributeError exception with an argument string "You cannot set the upload handlers after the upload has been processed.". substitute upload_handlers for self._upload_handlers. define the method parse_file_upload with 3 arguments: self, META and post_data. self.upload_handlers is an instance of ImmutableList, created with 2 arguments: self.upload_handlers, and warning as a string "You cannot alter upload handlers after the upload has been processed.". parser is an instance of MultiPartParser class, created with 4 arguments: META, post_data, self.upload_handlers and self.encoding. call the method parser.parse, return the result. property decorator, define the method body with an argument self. if self doesnt have an '_body' attribute, if self._read_started is true, raise an RawPostDataException exception with an argument string "You cannot access body after reading from request's data stream". try, call the method self.read, substitute the result or self._body. if IOError, renamed to e, exception is caught, call the function six.reraise with 3 arguments: UnreadablePostError, UnreadablePostError instantiated with unpacked list e.args, third element of the result of the function sys.exc_info. self._stream is an instance of BytesIO class created with an argument self._body. return self._body. define the method_mark_post_parse_error with an argument self. self._post is an instance of QueryDict class created with an empty string as argument. self._files is an instance of MultiValueDict class. self._post_parse_error is boolean True. define the method _load_post_and_files with an argument self. if self.method is not equal to string 'POST', self._post is an instance of QueryDict created with arguments: an empty string and encoding set to self._encoding, self._files is an instance of class MultiValueDict. return nothing. if self._read_started is true and self doesnt have an '_body' attribute. call the method self._mark_post_parse_error. return nothing. get the value under the 'CONTENT_TYPE' key of the self.META dictionary, if it starts with a string 'multipart/form-data', if self has an attribute '_body', data is an instance of BytesIO class, created with an argument: self._body. if not, substitute self for data. try, call the method self.parse_file_upload with arguments self.META and data, assign the result to self._post and self._files. if MultiPartParserError exception is caught, call the method self._mark_post_parse_error. raise an exception. otherwise if value under the 'CONTENT_TYPE' key of hte self.META dictionary starts with 'application/x-www-form-urlencoded', self._post is an instance of QueryDict created with arguments: self.body and encoding set to self._encoding, self._files is an instance of class MultiValueDict. if not, self._post is an instance of QueryDict created with arguments: an empty string and encoding set to self._encoding, self._files is an instance of class MultiValueDict. define the method close with an argument self. if self has an attribute '_files', for every f in return value of the return value of the method chain.from_iterable called with argument: second element of l for every l in return value of the self._files.lists call the method f.close. define the method read with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. self._read_started is True. try, call the method self._stream.read with 2 arguments: unpacked list args and unpacked dictionary kwargs. if IOError, renamed to e, exception is caught, call the function six.reraise with 3 arguments: UnreadablePostError, UnreadablePostError instantiated with unpacked list e.args, third element of the result of the function sys.exc_info. define the method readline with 3 arguments: self, unpacked list args and unpacked list kwargs. self._read_started is boolean True. try, call the method self._stream.readline with 2 arguments: unpacked list args, unpacked dictionary kwargs. if IOError, substituted to e, exception is caught, call the function six.reraise with 3 arguments: UnreadablePostError, UnreadablePostError instantiated with unpacked list e.args, third element of the result of the function sys.exc_info. define the method __init__ with an argument self. endless loop, read one line from self file stream, substitute the result for buf. if buf is false, break the loop execution. yield buf as return value of the generator. substitute xreadlines for __iter__. define the method __init__ with an argument self. append to a list elements of the iterator self, return the resulting list. derive the class QueryDict from the base class MultiValueDict. _mutable is boolean True. _encoding is None. define the method __init__ with 4 arguments: self, query_string is None, mutable is boolean False and encoding set to None. call the __init__ method of the base class of the QueryDict class. if encoding is false. substitute settings.DEFAULT_CHARSET for encoding. substitute encoding for self.encoding. if six.PY3 is true, if query_string is an instance of bytes, call the method query_string.decode, substitute the result for query_string. for every key and value in return value of the parse_qsl with 3 arguments: query_string is it exists or an empty string if not, keep_blank_values set to boolean True, encoding set to encoding. call the method appendlist with 2 arguments: key and value. if not, for every key and value in parse_gsl with query_string is it exists or an empty string if not and keep_blank_values set to boolean True. call the method self.appendlist with 2 arguments: return value of the function force_text with 3 arguments: key, encoding and errors set to string 'replace', and return value of the function force_text with 3 arguments: value, encoding and errors set to string 'replace'. call the method mutable substitute for self._mutable. property decorator, define the method encoding with an argument self. if self._encoding is None, substitute settings.DEFAULT_CHARSET for self._encoding. return self._encoding. encoding.setter decorator, define the method encoding with arguments self and value. substitute value for self._encoding. define the method _assert_mutable with an argument self. if not self._mutable, raise an AttributeError with an argument string "This QueryDict instance is immutable". define the method __setitem__ with 3 arguments: self, key and value. call the method self._assert_mutable. call the method bytes_to_text with 2 arguments: key and self.encoding, substitute the result for key. call the method bytes_to_text with 2 arguments: key and self.encoding, substitute the result for value. call the method __setitem__ from the base class of the QueryDict class, with arguments key and value. define the method __delitem__ with 3 arguments: self and key. call the method self._assert_mutable. call the method __delitem__ from the base class of the QueryDict class, with an argument key. define the method __copy__ with an argument self. call the method self.__class__ with 3 arguments: an empty string, mutable is boolean True, encoding is self.encoding, substitute the result for result. for key and value in return value of the six.iterlists function called with an argument self, call the method result.setlist with the arguments: key and value. return result. define the method __deepcopy__ with 3 arguments: self and memo. call the method self.__class__ with 3 arguments: an empty string, mutable is boolean True, encoding is self.encoding, substitute the result for result. get the identity of the self object, use it as a key to get the value of the memo dictionary, substitute result for it. for key and value in result of the function six.iterlists called with an argument, call the method result.setlist with 2 arguments: return value of the function copy.deepcopy called with 2 arguments: key and memo, and return value of the function copy.deepcopy called with 2 arguments: value and memo. return result. define the method setlist with 3 arguments: self, key and list_. call the method self._assert_mutable. call the method bytes_to_text with an arguments key and self.encoding, substitute the result for key. for every elt in list_ call the method bytes_to_text with 2 argument: elt and self.encoding, append the result into a list, substitute the resulting list for list_. call the method setlist from the base class of the QueryDict class, with arguments key and list_. define the method setlistdefault with 3 arguments: self, key and default_list set to None. call the method self._assert_mutable. call the method setlistdefault from the base class of the class QueryDict, with arguments key and default_list, return the result. define the method appendlist with 3 arguments: self, key and value. call the method self._assert_mutable. call the method bytes_to_text with 2 arguments: key and self.encoding, substitute the result for key. call the method bytes_to_text with 2 arguments: value and self.encoding, substitute the result for value. call the method appendlist from the base class of the QueryDict class, with arguments key and value. define the method pop with 3 arguments: self, key and unpacked list args. call the method self._assert_mutable. call the method pop from the base class of the class QueryDict, with arguments key and unpacked list args, return the result. define the method popitem with an argument self. call the method self._assert_mutable. call the method popitem from the base class of the class QueryDict, return the result. define the method clear with an argument self. call the method self._assert_mutable. call the method clear from the base class of the class QueryDict, return the result. define the method setdefault with 3 arguments: self, key and default set to None. call the method self._assert_mutable. call the method bytes_to_text with 2 arguments: key and self.encoding, substitute the result for key. call the method bytes_to_text with 2 arguments: default and self.encoding, substitute the result for default. call the method setlistdefault from the base class of the class QueryDict, with arguments key and default_list, return the result. define the method copy with an argument self. call the method self.__deepcopy__ with an empty dictionary as an argument. define the method urlencode with 3 arguments: self and safe set to None. output is an empty list. if safe is true, call the function force_bytes with 2 arguments: safe and self.encoding, substitute it for safe. encode is an lambda function with arguments k and v, return value is string '%s=%s', where '%s' is replaced with: return value of the function quote called with arguments k and safe, and with return value of the function quote called with arguments v and safe. if not, encode is an lambda function with 2 arguments k and v, return value is the result of the function urlencode, called with an argument: dictionary containing element v for k. for every k and list_ in return value of the method self.lists, call the function force_bytes with arguments k and self.encoding, substitute the result for k. for every v in list_ append to a list result of the function encode, called with arguments: k and result of the function force_bytes, called with arguments v and self.encoding, extend the output with the result. join elements of the output into a string, separated with '&', return the result. define the function build_request_repr with arguments: request, path_override set to None, GET_override set to None, try, get is a tuple containing elements generated by the call to the function pformat with an argument GET_override, if GET_override is not None, or otherwise generated with the call to the function pformat with an argument request.GET. if Exception exception is caught, get is a string ''. if request._post_parse_error is true, post is a string ''. if not, try, get is a tuple containing elements generated by the call to the function pformat with an argument POST_override, if POST_override is not None, or otherwise generated with the call to the function pformat with an argument request.POST. if Exception exception is caught, post is a string ''. try, get is a tuple containing elements generated by the call to the function pformat with an argument COOKIES_override, if COOKIES_override is not None, or otherwise generated with the call to the function pformat with an argument request.COOKIES. if Exception exception is caught, cookies is a string ''. try, get is a tuple containing elements generated by the call to the function pformat with an argument META_override, if META_override is not None, or otherwise generated with the call to the function pformat with an argument request.META. if Exception exception is caught, meta is a string ''. substitute path_override for path if path_override is not None, otherwise substitute request.path for path call the function force_str with an argument string '<%s\npath:%s,\nGET:%s,\nPOST:%s,\nCOOKIES:%s,\nMETA:%s>', where '%s' is replaced with request.__class__.__name__, path, return value of the function six.text_type called with an argument get, return value of the function six.text_type called with an argument post, return value of the function six.text_type, called with an argument cookies and return value of the function six.text_type called with an argument meta. define the function bytes_to_text with 2 arguments s and encoding. if s is an instance of bytes class, call the method six.text_type with 3 arguments: s, encoding and string 'replace'. if not, return s. define the function split_domain_port with an argument host. convert host to lowercase. call the method host_validation_re.match with an argument host. return an empty string and an empty string. if last element of host equals character ']', return host and an empty string. split host from the right side into 2 parts at the ':', substitute the result for bits. if length of bits equals integer 2, add bits to a tuple, return it. return the first element of bits and an empty string. define the method validate_host with 2 arguments: host and allowed_hosts. if host ends with '.', remove the last element from host. for every pattern in allowed_hosts: convert pattern to lowercase, substitute it for pattern. if pattern equals '*' or pattern starts with '.' or pattern equals host, and only if: host ends with '.' and host ends with pattern or host is equal to all but first elements of pattern, substitute boolean true for match, otherwise substitute boolean False for match. if match is true, return boolean True. return boolean False. from __future__ import unicode_literals into default name space. import module datetime. import module json. import module sys. import module time. from email.header import Header into default name space. from django.conf import settings into default name space. from django.core import signals into default name space. from django.core import signing into default name space. from django.core.exceptions import DisallowedRedirect into default name space. from django.core.serializers.json import DjangoJSONEncode into default name space. from django.http.cookie import SimpleCookie into default name space. from django.utils import six and timezone into default name space. from django.utils.encoding import force_bytes, force_text and iri_to_uri into default name space. from django.utils.http import cookie_date into default name space. from django.utils.six.moves import map into default name space. from django.utils.six.moves.urllib.parse import urlparse into default name space. REASON_PHRASES is a dictionary containing 59 initial entries: 'CONTINUE' for 100, 'SWITCHING PROTOCOLS' for 101, 'PROCESSING' for 102, 'OK' for 200, 'CREATED' for 201, 'ACCEPTED' for 202, 'NON-AUTHORITATIVE INFORMATION' for 203, 'NO CONTENT' for 204, 'RESET CONTENT' for 205, 'PARTIAL CONTENT' for 206, 'MULTI-STATUS' for 207, 'ALREADY REPORTED' for 208, 'IM USED' for 226, 'MULTIPLE CHOICES' for 300, 'MOVED PERMANENTLY' for 301, 'FOUND' for 302, 'SEE OTHER' for 303, 'NOT MODIFIED' for 304, 'USE PROXY' for 305, 'RESERVED' for 306, 'TEMPORARY REDIRECT' for 307, 'PERMANENT REDIRECT' for 308, 'BAD REQUEST' for 400, 'UNAUTHORIZED' for 401, 'PAYMENT REQUIRED' for 402, 'FORBIDDEN' for 403, 'NOT FOUND' for 404, 'METHOD NOT ALLOWED' for 405, 'NOT ACCEPTABLE' for 406, 'PROXY AUTHENTICATION REQUIRED' for 407, 'REQUEST TIMEOUT' for 408, 'CONFLICT' for 409, 'GONE' for 410, 'LENGTH REQUIRED' for 411, 'PRECONDITION FAILED' for 412, 'REQUEST ENTITY TOO LARGE' for 413, 'REQUEST-URI TOO LONG' for 414, 'UNSUPPORTED MEDIA TYPE' for 415, 'REQUESTED RANGE NOT SATISFIABLE' for 416, 'EXPECTATION FAILED' for 417, 'I'M A TEAPOT' for 418, 'UNPROCESSABLE ENTITY' for 422, 'LOCKED' for 423, 'FAILED DEPENDENCY' for 424, 'UPGRADE REQUIRED' for 426, 'PRECONDITION REQUIRED' for 428, 'TOO MANY REQUESTS' for 429, 'REQUEST HEADER FIELDS TOO LARGE' for 431, 'INTERNAL SERVER ERROR' for 500, 'NOT IMPLEMENTED' for 501, 'BAD GATEWAY' for 502, 'SERVICE UNAVAILABLE' for 503, 'GATEWAY TIMEOUT' for 504, 'HTTP VERSION NOT SUPPORTED' for 505, 'VARIANT ALSO NEGOTIATES' for 506, 'INSUFFICIENT STORAGE' for 507, 'LOOP DETECTED' for 508, 'NOT EXTENDED' for 510 and 'NETWORK AUTHENTICATION REQUIRED' for 511. derive the class BadHeaderError from the ValueError base class. do nothing. derive the class HttpResponseBase from the six.Iterator base class. status_code is an integer 200. reason_phrase is None. define the method __init__ with 4 arguments: self, content_type set to None, status set to None, reason set to None. self._headers is an empty dictionary. substitute settings.DEFAULT_CHARSET for self._charset. self._closable_objects is an empty list. self._handler_class is None. if content_type is false, replace '%s' in string "%s; charset=%s" with settings.DEFAULT_CONTENT_TYPE and self._charset, substitute it for content_type. self.cookies is an instance of a class SimpleCookie. if status is not None. substitute status for self.status_code. if reason is not None, substitute reason for self.reason_phrase. otherwise if self.reason_phrase is None, get the value under the self.status_code key of the REASON_PHRASES dictionary, if it exists substitute it for the self.reason_phrase, if not, self.reason_phrase is a string 'UNKNOWN STATUS CODE'. substitute content_type for value under the 'Content-Type' key of the self dictionary. define the method serialize_headers with an argument self. define the function to_bytes with arguments val and encoding. if val is an instance of bytes, return val, otherwise return result of the method val.encode called with an argument encoding. for every key and value in return value of the self._headers.values method, call the function to_bytes with 2 arguments: key, and string 'ascii' and call the function to_bytes with 2 arguments: value and string 'latin-1', join the previous 2 results into a string, separated by ': ', append it to a list, substitute the resulting list for headers. join headers into a string, separated by string '\r\n'. if six.PY3 is true, substitute serialize_headers for __bytes__. if not, substitute serialize_headers for __str__. define the method _convert_to_charset with 4 arguments: self, value, charset and mime_encode set to boolean False. if value is not an instance of bytes or six.text_type classes, convert value to an string and substitute it for value. try, if six.PY3 is true, if value is an instance of str type, call the method value.encode with an argument charset. if not, call the method value.decode with an argument charset, substitute the result for value. if not, if value is an instance of str type, call the method value.decode with an argument charset. if not, call the method value.encode with an argument charset, substitute the result for value. if UnicodeError, renamed to e, exception is caught, if mime_encode is true, instantiate class Header with 3 arguments: value, string 'utf-8', maxlinelen set to sys.maxsize, call the encode method on it, convert the result into a string and substitute it for value. if not, replace '%s' in string ', HTTP response headers must be in %s format' for charset, append it to e.reason. raise an exception. convert '\n' to a string, if it is contained in value or '\r' converted to an string is contained in value, raise an BadHeaderError exception with an argument string "Header values can't contain newlines (got %r)", where '%r' is replaced with value. return value. define the method __setitem__ with 3 arguments: self, header and value. call the method self._convert_to_charset with arguments: header and string 'ascii', substitute the result for header. call the method self._convert_to_charset with arguments: header, string 'latin-1' and mime_encode set to boolean True, substitute the result for value. substitute tuple containing 2 elements: header and value for the value under the header converted to lowercase key of the self._headers dictionary. define the method __delitem__ with 2 arguments: self and header. try, delete the value under the header converted to lowercase key of the self._headers dictionary. if KeyError exception is caught, do nothing. define the method __getitem__ with 2 arguments: self and header. convert header to lowercase, use it as the key to get the value from the self._headers dictionary, return the second element of the result. define the method __getstate__ with an argument self. call the method self.__dict__.copy, substitute the result for state. get the value under the 'cookies' key of the state dictionary, convert it to a string and substitute it for value under the 'cookies' key of the state dictionary. return state. define the method __setstate__ with 2 arguments: self and state. add state element to self.__dict__ dictionary. self.cookies is an instance of SimpleCookie class created with self.cookies as an argument. define the method has_header with 2 arguments: self and header. convert deader to lowercase, if it is contained in self._headers return boolean True, if not, return boolean False. substitute has_header for __contains__. define the method items with an argument self. call the method self._headers.values, return the result, define the method get with 3 arguments: self, header and alternate set to None. convert header to lowercase, use it to as a key to get the value of the self._headers dictionary, if it exists return the second element of the result, if not, return alternate. define the method set_cookie with 9 arguments: self, key, value set to an empty string, max_age set to None, expires set to None, substitute value for self.cookies dictionary value under the key key. if expires is not None, if expires is an instance of datetime.datetime class, call the method timezone.is_aware with an argument expires, if it evaluates to true, call the method timezone.make_naive with arguments: expires, timezone.utc, substitute the result for expires. call the method expires.utcnow, subtract the result from expires, substitute the result for delta. call the method datetime.timedelta with an argument seconds set to integer 1, increment delta by it. expires is None. multiply delta.days with an integer 86400 add to the result delta.seconds, if the result is greater than integer 0, substitute it for max_age, if not, max_age is integer 0. if not, get the value under the key key of the self.cookies dictionary, substitute expires for 'expires' key of the returned dictionary. if max_age is not None, get the value under the key key of the self.cookies dictionary, substitute max-age for 'max-age' key of the returned dictionary. if expires is false, get the value under the key key of the self.cookies dictionary, call the cookie_date function with an argument: sum of the result of the function time.time and max_age, substitute it for 'expires' key of the previously returned dictionary. if path is not None, get the value under the key key of the self.cookies dictionary, substitute path for 'path' key of the returned dictionary. if domain is not None, get the value under the key key of the self.cookies dictionary, domain expires for 'domain' key of the returned dictionary. if secure is true, get the value under the key key of the self.cookies dictionary, substitute boolean True for 'secure' key of the returned dictionary. if httponly is true, get the value under the key key of the self.cookies dictionary, substitute boolean True for 'httponly' key of the returned dictionary. define the method set_signed_cookie with 5 arguments: self, key, value, salt as an empty string and unpacked dictionary kwarg. call the method signing.get_cookie_signer with an argument salt set to sum of key and salt, call the method sign on the result with an argument value, substitute the result for value. call the method self.set_cookie with 3 arguments: key, value and unpacked dictionary kwargs, return the result. define the method delete_cookie with 4 arguments: self, key, path set to character '/' and domain set to None. call the method self.set_cookie with 5 arguments: key, max_age as integer 0, path as path, domain as domain, expires as a string 'Thu, 01-Jan-1970 00:00:00 GMT', return the result. define the method make_bytes with 2 arguments: self and value. call the method self.has_header with string 'Content-Encoding' as an argument, if it evaluates to true, call the function bytes with an argument value, return the result. if value is an instance of bytes class, call the function bytes with an argument value, return the result. if value is an instance of six.text_type class, call the method value.encode with an argument self._charset, use the result as an argument for the call to the bytes function, return the result. call the function force_bytes with arguments value and self._charset, return the result. define the method close with an argument self. for every closable in self._closable_objects, try, call the method closable.close. if Exception exception is caught, do nothing. call the method signals.request_finished.send with an argument sender set to self._handler_class. define the method write with 2 arguments: self and value. raise an Exception exception with an argument string "This %s instance is not writable", where '%s' is replaced with self.__class__.__name__. define the method flush with an argument self. do nothing. define the method tell with an argument self. raise an Exception exception with an argument string "This %s instance cannot tell its position", where '%s' is replaced with self.__class__.__name__. derive the class HttpResponse from the HttpResponseBase base class. streaming is boolean False. define the method __init__ with 4 arguments: self, content set to an empty list, unpacked list args and unpacked dictionary kwargs. call the __init__ method from the base class of the HttpResponse class, with the arguments: unpacked list args and unpacked dictionary kwargs. substitute content for self.content. define the serialize content with an argument self. call method self.serialize_headers, append bytes string '\r\n\r\n' to the result, append self.content to the result, return it. if six.PY3 is true, substitute serialize for __bytes__. if not, substitute serialize for __str__. property decorator, define the method content with an argument self. join self._container elements into a string, return it. content.setter decorator, define the method content with 2 arguments: self and value. if value has an '__iter__' attribute and value is not an instance of bytes or six.string_types class. if value has an 'close' attribute, append value to the self._closable_objects list. call the self.make_bytes method with an argument chunk, for every chunk in value join the result to a bytes string, substitute the result for value. if not, call the method self.make_bytes with an argument value, substitute the result for value. self._container is a list containing element value. define the method __iter__ with an argument self. return self._container converted into a iterable. define the method write with 2 arguments: self and content. call the method self.make_bytes with an argument content, append it to self._container. define the method tell with an argument self. return the length of self.content. derive the class StreamingHttpResponse from the HttpResponseBase base class. streaming is boolean True. define the method __init__ with 4 arguments: self, result of the function streaming_content=(), unpacked list args, and unpacked dictionary kwargs. call the __init__ method from the base class of the StreamingHttpResponse class, called with arguments: unpacked list args, and unpacked dictionary kwargs. substitute streaming_content for self.streaming_content. property decorator, define the method content with an argument self. raise an AttributeError with an argument string "This %s instance has no `content` attribute. "Use `streaming_content` instead.", where '%s' is replaced with self.__class__.__name__. property decorator, define the method serialize_headers with an argument self. map elements of self._iterator through self.make_bytes function, return the result. streaming_content.setter decorator, define the method streaming_content with 2 arguments: self and value. convert value into a iterator, substitute the result for self._iterator. if value has an attribute 'close', append value to self._closable_objects list. define the method __iter__ with an argument self. return self.streaming_content derive the class HttpResponseRedirectBase from the HttpResponse base class. allowed_schemes is an list containing 3 elements: strings 'http', 'https' and 'ftp'. define the method __init__ with 4 arguments: self, redirect_to, unpacked list args and unpacked dictionary kwargs. call the function force_text with an argument redirect_to, use the result as an argument for the call to the function urlparse, substitute the result for parsed. if parsed.scheme is true and parsed.scheme is not contained in self.allowed_schemes, raise an DisallowedRedirect exception with an argument string "Unsafe redirect to URL with protocol '%s'", where '%s' is replaced with parsed.scheme. call the __init__ method from the base class of the HttpResponseRedirectBase class, called with arguments: unpacked list args, and unpacked dictionary kwargs. call the function iri_to_uri with an argument redirect_to, substitute the result for the value under the 'Location' key of the self dictionary. url is a property of the class, lambda function is getter attribute with an argument self and return value is the value under the 'Location' key of the self dictionary. derive the class HttpResponseRedirect from the HttpResponseRedirectBase base class. status_code is an integer 302. derive the class HttpResponsePermanentRedirect from the HttpResponseRedirectBase base class. status_code is an integer 301. derive the class HttpResponseNotModified from the HttpResponse base class. status_code is an integer 304. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. call the __init__ method from the base class of the HttpResponseNotModified class, called with arguments: unpacked list args, and unpacked dictionary kwargs. delete the value under the 'content-type' key of the self dictionary. HttpResponse.content.setter property, define the method content with self and value. if value, raise an AttributeError exception with an argument string "You cannot set content to a 304 (Not Modified) response". self._container is an list. derive the class HttpResponseBadRequest from the HttpResponse base class. status_code is an integer 400. derive the class HttpResponseNotFound from the HttpResponse base class. status_code is an integer 404. derive the class HttpResponseForbidden from the HttpResponse base class. status_code is an integer 403. derive the class HttpResponseNotAllowed from the HttpResponse base class. status_code is an integer 405. define the method __init__ with 4 arguments: self, permitted_methods, unpacked list args and unpacked dictionary kwargs. call the __init__ method from the base class of the HttpResponseNotAllowed class, called with arguments: unpacked list args, and unpacked dictionary kwargs. join into a string permitted_methods, separated by string ', ', substitute it for value under the 'Allow' key of the self dictionary. derive the class HttpResponseGone from the HttpResponse base class. status_code is an integer 410. derive the class HttpResponseServerError from the HttpResponse base class. status_code is an integer 500. derive the class Http404 from the Exception base class. do nothing. derive the class JsonResponse from the HttpResponse base class. define the method __init__ with 5 arguments: self, data, encoder set to DjangoJSONEncoder, safe set to boolean True, and unpacked dictionary kwargs. if safe is true and data is not an instance of dict type. raise an TypeError exception with an argument string 'In order to allow non-dict objects to be serialized set the safe parameter to False'. if 'content_type' key doesnt exist in kwargs, set its value to 'application/json'. serialize data to JSON format with cls set to encoder, substitute it for data. call the __init__ method from the base class of the JsonResponse class, called with arguments: content set to data, define function fix_location_header with request and response as arguments. if 'Location' is contained in response and function request.get_host evaluates to True, modify value at the key 'Location' of the dictionary response by applying function request.build_absolute_uri on it. return response. define the function conditional_content_removal with request and response as the arguments. if response.status_code is lesser than integer 200 and grater or equal than 100, or response.status_code equals to integer 204 or 304, if response.streaming is True, response.streaming_content is an empty list. if not, response.content is bytes empty string. substitute char '0' for the value under the 'Content-Length' key of the response dictionary. if request.method equals to string 'HEAD', if response.streaming is true, response.streaming_content is an empty list. if not, response.content is bytes empty string. return response. from django.template.base import ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END, BLOCK_TAG_START, COMMENT_TAG_END, COMMENT_TAG_START, FILTER_ARGUMENT_SEPARATOR, FILTER_SEPARATOR, SINGLE_BRACE_END, SINGLE_BRACE_START, TOKEN_BLOCK, TOKEN_COMMENT, TOKEN_TEXT, TOKEN_VAR, TRANSLATOR_COMMENT_MARK, UNKNOWN_SOURCE, VARIABLE_ATTRIBUTE_SEPARATOR, VARIABLE_TAG_END, VARIABLE_TAG_START, filter_re and tag_re. from django.template.base import ContextPopException, InvalidTemplateLibrary, TemplateDoesNotExist, TemplateEncodingError, TemplateSyntaxError and VariableDoesNotExist. from django.template.base import Context, FilterExpression, Lexer, Node, NodeList, Parser, RequestContext, Origin, StringOrigin, Template, TextNode, Token, TokenParser, Variable, VariableNode, constant_string and filter_raw_string. from django.template.base import compile_string, resolve_variable, unescape_string_literal and generic_tag_compiler. from django.template.base import Library, add_to_builtins, builtins, get_library, get_templatetags_modules, get_text_list, import_library and libraries. __all__ is a tuple containing 4 strings: 'Template', 'Context', 'RequestContext' and 'compile_string'. from __future__ import unicode_literals into default name space. import module re. from functools import partial into default name space. from importlib import import_module into default name space. from inspect import getargspec and getcallargs into default name space. import module warnings. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.template.context import BaseContext, Context, RequestContext and ContextPopException into default namespace. from django.utils.deprecation import RemovedInDjango20Warning into default name space. from django.utils.itercompat import is_iterable into default name space. from django.utils.text import smart_split, unescape_string_literal and get_text_list into default namespace. from django.utils.encoding import force_str and force_text into default name space. from django.utils.translation import ugettext_lazy and pgettext_lazy into default name space. from django.utils.safestring import SafeData, EscapeData, mark_safe and mark_for_escaping into default namespace. from django.utils.formats import localize into default name space. from django.utils.html import escape into default name space. from django.utils.module_loading import module_has_submodule into default name space. from django.utils import six into default name space. from django.utils.timezone import template_localtime into default name space. from django.utils.encoding import python_2_unicode_compatible into default name space. TOKEN_TEXT is integer 0 TOKEN_VAR is integer 1 TOKEN_BLOCK is integer 2 TOKEN_COMMENT is integer 3. TOKEN_MAPPING is a dictionary with 4 initial entries: 'Text' for TOKEN_TEXT, 'Var' for TOKEN_VAR, 'Block' for TOKEN_BLOCK, and 'Comment' for TOKEN_COMMENT. FILTER_SEPARATOR is a string '|'. FILTER_ARGUMENT_SEPARATOR is a string ':'. VARIABLE_ATTRIBUTE_SEPARATOR is a string '.'. BLOCK_TAG_START is a string '{%'. BLOCK_TAG_END is a string '%}'. VARIABLE_TAG_START is a string '{{'. VARIABLE_TAG_END is a string '}}'. COMMENT_TAG_START is a string '{#'. COMMENT_TAG_END is a string '#}'. TRANSLATOR_COMMENT_MARK is a string 'Translators'. SINGLE_BRACE_START is a string '{'. SINGLE_BRACE_END is a string '}'. ALLOWED_VARIABLE_CHARS is a string 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.'. UNKNOWN_SOURCE is a string ''. call the function re.compile with an argument string '(%s.*?%s|%s.*?%s|%s.*?%s)', substitute all occurrences of '%s' with, return value of the function re.escape called with an argument BLOCK_TAG_START, return value of the function re.escape called with an argument BLOCK_TAG_END, return value of the function re.escape called with an argument VARIABLE_TAG_START, return value of the function re.escape called with an argument VARIABLE_TAG_END, return value of the function re.escape called with an argument COMMENT_TAG_START, and return value of the function re.escape called with an argument COMMENT_TAG_END, substitute the result for tag_re. libraries is an empty dictionary. builtins is an empty list. invalid_var_format_string is None. derive the class TemplateSyntaxError form the base class Exception. do nothing. derive the class TemplateDoesNotExist form the base class Exception. do nothing. derive the class TemplateEncodingError form the base class Exception. do nothing. python_2_unicode_compatible decorator, derive the class VariableDoesNotExist form the base class Exception. define the method __init__ with 3 arguments: self, msg and params set to an empty tuple. substitute msg for self.msg. substitute params for self.params. define the method __str__ with an argument self. return self.msg formatted with a tuple, with elements generated from return value of the function force_text with 2 arguments: p and errors set to string 'replace', for p in self.params. derive the class InvalidTemplateLibrary form the base class Exception. do nothing. derive the class Origin form the base class object. define the method __init__ with 2 arguments: self and name. substitute name for self.name. define the method reload with an argument self. raise an NotImplementedError exception with an argument string 'subclasses of Origin must provide a reload() method'. define the method with reload with an argument self. return self.name. derive the class StringOrigin form the base class Origin. define the method __init__ with 2 arguments: self and source. call the method __init__ with an argument UNKNOWN_SOURCE, from the base class of the class StringOrigin. substitute source for self.source. define the method with reload with an argument self. return self.source. derive the class Template form the base class object. define the method __init__ with 4 arguments: self, template_string, origin set to None and name set to None. try, call the function force_text with an argument template_string. if UnicodeDecodeError exception is caught, raise an TemplateEncodingError exception with an argument "Templates can only be constructed from unicode or UTF-8 strings.". if settings.TEMPLATE_DEBUG is true and origin is None, origin is an instance of StringOrigin class created with an argument template_string. call the function compile_string with 2 arguments: template_string and origin, substitute the result for self.nodelist. substitute name for self.name. substitute origin for self.origin. define the method __iter__ with an argument self. for every node in self.nodelist, for every subnode in node, yield subnode. define the method _render with 2 arguments self and context. call the method self.nodelist.render with an argument context, return the result. define the method render with 2 arguments self and context. call the method context.render_context.push. try, call the method self._render with an argument context, return the result, finally perform, remove the first element from context.render_context. define the method compile_string with 2 arguments: template_string and origin. if settings.TEMPLATE_DEBUG is true, from django.template.debug import DebugLexer and DebugParser. substitute DebugLexer and DebugParser for lexer_class and parser_class. if not, substitute Lexer and Parser for lexer_class and parser_class. call the method lexer_class with an arguments template_string and origin, substitute the result for lexer. call the method lexer.tokenize, use it as an argument for the call to the parser_class function, substitute the result for parser. call the method parser.parse, return the result. derive the class Token form the base class object. define the method __init__ with 3 arguments: self, token_type and contents. substitute token_type and contents for self.token_type and self.contents. self.lineno is None. define the method __str__ with an argument self. substitute value under the self.token_type key of the TOKEN_MAPPING dictionary for token_name. return a string '<%s token: "%s...">' with '%s', replace '%s' with token_name and 20 self.contents elements with every newline deleted. define the method split_contents with an argument self. split is an empty list. call the function smart_split with an argument self.contents, substitute the result converted to an iterable for bits. for every bit in bits, if bit starts with '_("' ot bit starts with "_('", append ')' to third element of bit, substitute it for sentinal. trans_bit is a list with an element bit. while bit doesnt end with sential, call the method next with an argument bits, substitute the result for bit. append bit to trans_bit. join trans_bit into a string separated with whitespaces, substitute the result for bit. append bit to split. return split. derive the class Lexer form the base class object. define the method __init__ with 3 arguments: self, template_string and origin. substitute template_string for self.template_string. substitute origin for self.origin. self.lineno is integer 1. self.verbatim is boolean False. define the method tokenize with an argument self. in_tag is boolean False. result is an empty list. split tag_re by self.template_string separator, for every bit in result, if bit is true, call the method self.create_token with 2 arguments bit and in_tag, append the result to result. in_tag is boolean True if in_tag is False, otherwise is boolean False. return result. define the method create_token with 3 arguments: self, token_string and in_tag. if in_tag is true and token_string starts with BLOCK_TAG_START. take elements of token_string from second to second last element and strip the whitespaces surrounding the result, substitute the result for block_content. if self.verbatim is true and block_content equals self.verbatim, self.verbatim is boolean False. if in_tag and is not contained in self.verbatim, if token_string starts with VARIABLE_TAG_START, token is an instance of Token class, created with 2 arguments: TOKEN_VAR, and elements of token_string from second to second last element wiht the whitespaces striped from the both sides. otherwise if token_string starts with BLOCK_TAG_START, if first nine elements of block_content is string 'verbatim' or 'verbatim ', append block_content to a string 'end', substitute the result for self.verbatim. token is an instance of Token class, created with 2 arguments: TOKEN_BLOCK and block_content. otherwise if token_string starts with COMMENT_TAG_START, content is an empty string. call the method token_string.find with an argument TRANSLATOR_COMMENT_MARK, if it evaluates to true, take elements of token_string from second to second last element and strip the whitespaces surrounding the result, substitute the result for content. token is an instance of Token class, created with 2 arguments: TOKEN_COMMENT and content. if not, token is an instance of Token class, created with 2 arguments: TOKEN_TEXT and token_string. substitute self.lineno for token.lineno. call the method token_string.count with an argument '\n', append the result to self.lineno. return token. derive the class Parser form the base class object. define the method __init__ with 2 arguments: self and token. substitute tokens for self.tokens. self.tags is an empty dictionary. self.filters is an empty dictionary. for every lib in builtins, call the method self.add_library with an argument lib. define the emethod parse with 2 arguments: self and parse_until set to None. if parse_until is None, parse_until is an empty list, call the method self.create_nodelist, substitute the result for nodelist. while self.tokens is true, call the method self.next_token, substitute the result for token. if token.token_type equals integer 0, call the method self.extend_nodelist with 3 arguments: nodelist, instance of TextNode class, created with an argument token.contents, and token. otherwise if token.token_type equals integer 1, if token.contents is false, call the method self.empty_variable with an argument token, try, call the method self.compile_filter with an argument token.contents, substitute the result for filter_expression. if TemplateSyntaxError, replaced with e, exception is caught, call the method self.compile_filter_error with 2 arguments: token and e, if it evaluates to false, raise an exception, call the method self.create_variable_node with an argument filter_expression, substitute the result for var_node. call the method self.extend_nodelist with 3 arguments: nodelist, var_node and token. otherwise if token.token_type equals integer 2, try, split token.contents into separate words, substitute the first element of the result for command. if IndexError exception is caught, call the method self.empty_block_tag with an argument token. if command is contained in parse_until, call the method self.prepend_token with an argument token, return nodelist. call the method self.enter_command with 2 arguments command and token. try, substitute the value under the command key of self.tags dictionary for compile_func. if KeyError exception is caught, call the method self.invalid_block_tag with 3 arguments: token, command and parse_until. try, call the method compile_func with 2 arguments self and token, substitute the result for compiled_result. if TemplateSyntaxError, renamed to e, exception is caught, call the method self.compile_function_error with 2 arguments token and e, if it evaluates to false, raise an exception, call the method self.extend_nodelist with 3 arguments: nodelist, compiled_result and token. call the method self.exit_command. if parse_until is true, call the method self.unclosed_block_tag with an argument parse_until. return nodelist. define the method skip_past with 2 arguments: self and endtag. while self.tokens is true, call the method self.next_token, substitute the result for token. if token.token_type equals TOKEN_BLOCK and token.contents equals endtag, return nothing. call the method self.unclosed_block_tag with an argument list with an element endtag. define the method create_variable_node with 2 arguments self and filter_expression. return an instance of VariableNode class with an argument filter_expression. define the method create_nodelist with an argument self. return an instance of NodeList class. define the method extend_nodelist with 4 arguments: self, nodelist, node and token. if node.must_be_first is true and nodelist is true, try, if nodelist.contains_nontext is true, raise AttributeError exception, if AttributeError exception is raised, raise TemplateSyntaxError("%r must be the first tag in the template.", where '%s' is replaced with node. if nodelist is an instance of NodeList and node is not an instance of TextNode class. nodelist.contains_nontext is boolean True. append node to nodelist. define the method enter_command with 3 arguments: self, command and token. do nothing. define the method exit_command with an argument self. do nothing. define the method enter_command with 3 arguments: self, token and msg. return an instance of TemplateSyntaxError class with an argument msg. define the method empty_variable with 2 arguments: self and token. call the method self.error with 2 arguments: token and string "Empty variable tag", return the result. define the method empty_block_tag with 2 arguments: self and token. call the method self.error with 2 arguments: token and string "Empty block tag", return the result. define the method invalid_block_tag with 4 arguments: self, token, command and parse_until as None. if parse_until is true, raise an self.error exception with 2 arguments: token and string "Invalid block tag: '%s', expected %s", where '%s' is replaced with command and result of the function get_text_list called with an argument list, with p converted into a string and surrounded with single quotes for every p in parse_until. call the method self.error with 2 arguments: token and string "Invalid block tag: '%s'", where '%s' is replaced with command, return the result. define the method unclosed_block_tag with 2 arguments: self and parse_until. raise an self.error with 2 arguments: None and string "Unclosed tags: %s ", where '%s' is replaced with parse_until elements joined into a string, separated with ', '. define the method compile_filter_error with 3 arguments: self, token and e. do nothing. define the method compile_function_error with 3 arguments: self, token and e. do nothing. define the method next_token with an argument self. remove first element from self.tokens, return removed element. define the function prepend_token with 2 arguments: self and token. insert token at the beginning of self.tokens. define the method delete_first_token with an argument self. delete the first element of self.tokens. define the function add_library with 2 arguments: self and lib. update self.tags dictionary with lib.tags. update self.filters dictionary with lib.filters. define the function compile_filter with 2 arguments: self and token. return an instance of FilterExpression class, created with 2 arguments: token and self. define the function find_filter with 2 arguments: self and filter_name. if filter_name is contained in self.filters, return the value under the filter_name key of the self.filters dictionary. if not, raise an TemplateSyntaxError with an argument string "Invalid filter: '%s'", substitute '%s' with filter_name. derive the class TokenParser form the base class object. define the function next_space_index with 2 arguments: self and subject. substitute subject for self.subject. self.pointer is integer 0. self.backout is an empty list. call the method self.tag, substitute the result for self.tagname. define the method top with an argument self. raise an NotImplementedError with an argument string 'subclasses of Tokenparser must provide a top() method'. define the method more with an argument self. if self.pointer is smaller than length of self.subject, return boolean True, otherwise return False. define the method back with an argument self. if length of self.backout is greater than zero, raise an TemplateSyntaxError exception with an argument string "back called without some previous parsing". remove the first element from self.backout, substitute the result for self.pointer. define the method tag with an argument self. substitute self.subject for subject. substitute self.pointer for i. if i is greater than or equal to length of subject. raise an TemplateSyntaxError exception with an argument string "expected another tag, found end of string: %s", where '%s' is replaced with subject. substitute i for p. while i is lesser than length of subject and i-th element of subject is not an empty space or tab character, increment i by integer 1. take subject elements from p-th to i-th index, substitute it for s. while i is lesser than length of subject and i-th element of subject is an empty space or tab character, increment i by integer 1. append self.pointer to self.backout. substitute i for self.pointer. return s. define the method value with an argument self. substitute self.subject for subject. substitute self.pointer for i. define the next_space_index with 2 arguments: subject and i. while i is lesser than length of subject and i-th element of subject is not an empty space or tab character, if i-th element of subject is '"' character or "'" character, substitute i-th element of subject for c. increment i by integer 1. while i is lesser than length of subject and i-th element of subject is not equal to c, increment i by one. if i is greater than, or equal to subject, raise an TemplateSyntaxError exception with an argument string "Searching for value. Unexpected end of string in column %d: %s", where '%d' is replaced with i and '%s' is replaced with subject. increment i by one. return i. if i is greater than or equal to length of subject, raise an TemplateSyntaxError exception with an argument "Searching for value. Expected another value but found end of string: %s", where '%s' is replaced with subject. if i-th element of subject is '"' character or "'" character, substitute i for p. increment i by integer 1, while i is lesser than length of subject and i-th element of subject is not equal to p-th element of subject, increment i by integer 1, if i is greater than length of subject, raise an TemplateSyntaxError exception with an argument string "Searching for value. Unexpected end of string in column %d: %s", where '%d' is replaced with i and '%s' is replaced with subject. increment i by integer 1, call the function next_space_index with 2 arguments: subject and i, substitute the result for i. substitute subject elements from p-th to i-th index for res. while i is lesser than length of subject and i-th element of subject is an empty space or tab character. increment i by integer 1, append self.pointer to self.backout. substitute i for self.pointer. return res. if not, substitute i for p. call the function next_space_index with 2 arguments subject and i, substitute the result for i. take subject elements from p-th to i-th index, substitute it for s. while i is lesser than length of subject and i-th element of subject is an empty space or tab character. increment i by integer 1,. append self.pointer to self.backout. substitute i for self.pointer. return s. constant_string is a raw string "(?:%(i18n_open)s%(strdq)s%(i18n_close)s|%(i18n_open)s%(strsq)s%(i18n_close)s|%(strdq)s|%(strsq)s)", where 'strdq' is replaced with '"[^"\\]*(?:\\.[^"\\]*)*"', 'strsq' is replaced with "'[^'\\]*(?:\\.[^'\\]*)*'", 'i18n_open' is replaced with return value of function re.escape called with an argument string '_(', 'i18n_close' is replaced with return value of function re.escape called with an argument string ')'. remove all occurrences of newline character from constant_string. filter_raw_string is a raw string "^(?P%(constant)s)|^(?P[%(var_chars)s]+|%(num)s)| (?:\s*%(filter_sep)s\s* (?P\w+)(?:%(arg_sep)s(?:(?P%(constant)s)|(?P[%(var_chars)s]+|%(num)s)))?)", where 'constant' is replaced with constant_string, 'num' with raw string '[-+\.]?\d[\d\.e]*', 'var_chars' with string "\w\.", 'filter_sep' with result of the function re.escape called with an argument FILTER_SEPARATOR, anbd 'arg_sep' with result of the function re.escape called with an argument FILTER_ARGUMENT_SEPARATOR. call the function re.compile with 2 arguments: filter_raw_string and result for bitwise OR on 2 operands re.UNICODE and re.VERBOSE, substitute the result for filter_re. derive the class FilterExpression form the base class object. define the function __init__ with 3 arguments: self, token and parser. substitute token for self.token. call the method filter_re.finditer with an argument token, substitute the result for matches. var_obj is None. filters is an empty list. upto is integer 0. for every match in matches, call the method match.start, substitute the result for start. if upto is not equal to start. raise an TemplateSyntaxError exception with an argument string "Could not parse some characters: %s|%s|%s", where '%s' is replaced with first upto elements of token string, token string elements from upto to start index, and token string elements from start index to the end. if var_obj is None, call the method match.group with 2 arguments: strings "var" and "constant", substitute the result for var and constant, respectively. if constant is true, try, instantiate Variable class, with an argument constant, call the resolve method with an empty dictionary as an argument, substitute the result for var_obj. if VariableDoesNotExist exception is not caught, var_obj is None. otherwise if var is None, raise an TemplateSyntaxError exception with an argument "Could not find variable at start of %s.", replace '%s' with token. if not, var_obj is an instance of Variable class, created with an argument var. if not, call the methof match.group with an argument "filter_name", substitute the result for filter_name. args is an empty list. call the method match.group with 2 arguments: strings "constant_arg" and "var_arg", substitute the result for constant_arg, and var_arg, respectively. if constant_arg is true, take a tuple with 2 elements: boolean False and method resolve called with an empty dictionary on the instance of Variable class, created with an argument constant_arg, append it to args. otherwise if var_arg is true, take a tuple with 2 elements: boolean False and instance of Variable class, created with an argument constant_arg, append it to args. call the method parser.find_filter with an argument filter_name, substitute the result for filter_func. call the method self.args_check with 3 arguments: filter_name, filter_func and args. append a tuple with 2 arguments: filter_func and args to filters. call the method match.end, substitute the result for upto. if upto is not equal to length of token, raise an TemplateSyntaxError exception with an argument string "Could not parse the remainder: '%s' from '%s'", where '%s' is replaced with elemnts of token from upto index till the end, and token. substitute filters for self.filters. substitute var_obj for self.var. define the method resolve with 3 arguments: self, context and ignore_failures set to boolean False. if self.var is an instance of Variable class, try, call the method self.var.resolve with an argument context, substitute it for obj. if VariableDoesNotExist exception is caught, if ignore_failures is true, obj is None, if not, if settings.TEMPLATE_STRING_IF_INVALID is true, use global variable invalid_var_format_string. if invalid_var_format_string is None, if '%s' is contained in settings.TEMPLATE_STRING_IF_INVALID, invalid_var_format_string is boolean True, otherwise it is False. if invalid_var_format_string is true, format settings.TEMPLATE_STRING_IF_INVALID with self.var, return the result. return settings.TEMPLATE_STRING_IF_INVALID. if not, substitute settings.TEMPLATE_STRING_IF_INVALID with obj. if not, substitute self.var for obj. for every func and args in self.filters, arg_vals is an empty list, for every lookup and arg in args, if lookup is false, call the function mark_safe with an argument arg, append it to arg_vals. if not, call the method arg.resolve with an argument context, append the result to arg_vals. if 'expects_localtime' attribute of func object exists and is true, call the function template_localtime with 2 arguments: obj and context.use_tz, substitute the result for obj. if 'needs_autoescape' attribute of func object exists and is true, call the function func with 3 arguments: obj, autoescape set to context.autoescape and unpacked list arg_vals, substitute the result for new_obj. if not, call the function func with 2 arguments: obj and unpacked list arg_vals, substitute the result for new_obj. if 'is_safe' attribute of func object exists and is true and obj is an instance of SafeData, call the function mark_safe with an argument new_obj, substitute the result for obj. otherwise if obj is an instance of EscapeData, call the function mark_for_escaping with an argument new_obj, substitute the result for obj. if not, substitute new_obj for obj. return obj. define the method args_check with 3 arguments: name, func and provided. convert provided into a list and substitute it for provided. calculate length of provided and increment it by one, substitute the result for plen. get the '_decorated_function' attribute from func object, if it exists substitute it for func. call the function getargspec with an argument func, substitute the result for args, varargs, varkw and defaults, respectively. calculate the length of args, substitute it for alen. substitute the length of defaults for dlen. if plen is lesser than difference of alen and dlen, or if plen is greater than alen, raise an TemplateSyntaxError exception with an argument string "%s requires %d arguments, %d provided", where '%d' is replaced with name, dlen subtracted from alen, and plen. return boolean True. args_check is a static method. define the method __str__ with an argument self. return self.token. define the method resolve_variable with 2 arguments: path and context. call the function warnings.warn with 3 arguments: string "resolve_variable() is deprecated. Use django.template. Variable(path).resolve(context) instead", RemovedInDjango20Warning, and stacklevel set to integer 2. call the method resolve with an argument context, from the instance of Variable class, created with an argument path. derive the class Variable form the base class object. define the method __init__ with 2 arguments self and var. substitute var for self.var. self.literal is None, self.lookups is None. self.translate is boolean False. self.message_context is None. if var is not an instance of six.string_types, raise an TypeError exception with an argument string "Variable must be a string or number, got %s", replace '%s' with type of var. try, convert var into an floating point number, substitute it for self.literal. if '.' is not contained in var and 'e' is not contained in var converted into lowercase, convert self.literal into an integer, substitute it for self.literal. if var ends with '.', raise an ValueError exception. if ValueError exception is caught, if var starts with '_(' and var ends with ')', self.translate is boolean True. remove first 2 and last 2 elements from var. try, call the function unescape_string_literal with an argument var, use it as an argument for the call to the function mark_safe, substitute the result for self.literal. if ValueError exception is caught, call the function var.find with an argument: '_' appended to VARIABLE_ATTRIBUTE_SEPARATOR, if the result is greater than integer -1, or first element of var equals '_', raise an TemplateSyntaxError exception with an argument string "Variables and attributes may not begin with underscores: '%s'", where '%s' is replaced with var. call the method var.split with an argument VARIABLE_ATTRIBUTE_SEPARATOR, convert the result to a tuple and substitute it for self.lookups. define the method resolve with 2 arguments: self and context. if self.lookups is not None, call the function self._resolve_lookup with an argument context, substitute the result for value. if else, substitute self.literal for value. if self.translate is true, if self.message_context is true, call the function pgettext_lazy with an argument self.message_context and value, return the result. if not, call the function ugettext_lazy with an argument value, return the result. return value. define the method __repr__ with an argument self. return an string "<%s: %r>", where '%s' is replaced with self.__class__.__name__ and self.var, respectively. define the method __str__ with an argument self. return self.var. define the method _resolve_lookup with 2 arguments: self and context. substitute context for current. try, for bit in self.lookups, try, substitute element at the bit index of current for current. if TypeError, AttributeError, KeyError or ValueError exceptions are caught, try, if current is an instance of BaseContext and bit attribute of type of current is true, raise an AttributeError exception. get the bit attribute of current object, substitute it for current. if TypeError and AttributeError exceptions are caught, try, convert bit to an integer and use it as index to obtain an element for list current, substitute it for current. if IndexError, ValueError, KeyError or TypeError exceptions are caught, raise an VariableDoesNotExist exception with an argument string "Failed lookup for key [%s] in %r", where '%s' is replaced with bit and '%r' is replaced with current. if current is callable object, get the 'do_not_call_in_templates' attribute of current object, if it exists and is true, do nothing. otherwise, get the 'alters_data' attribute of current object, if it exists and is true, substitute settings.TEMPLATE_STRING_IF_INVALID for current. if not, try, call the function current, substitute the result for current. if TypeError exception is caught, try, call the function getcallargs with an argument current, if TypeError exception is caught, substitute settings.TEMPLATE_STRING_IF_INVALID for current, if not, raise an exception, if Exception, renamed to e, exception is caught, get the 'silent_variable_failure' attribute of e object, if it exists and is true, substitute settings.TEMPLATE_STRING_IF_INVALID for current. if not, raise an exception. return current. derive the class Node form the base class object. must_be_first is boolean False. child_nodelists is an tuple with an element 'nodelist'. define the method render with 2 arguments: self and context. do nothing. define the method __iter__ with an argument self. yield self. define the method get_nodes_by_type with 2 arguments: self and nodetype. nodes is an empty list. if self is an instance of nodetype, append self to nodes. for every attr in self.child_nodelists, get attr attribute of self object, if it exists substitute it for nodelist, if not nodelist is None. if nodelist is true, call the method nodelist.get_nodes_by_type with an argument nodetype, extend nodes with the result. return nodes. derive the class NodeList form the base class list. contains_nontext is boolean False. define the method render with 2 arguments: self and context. bits is an empty list. for every node in self, if node is an instance of Node, call the method self.render_node with 2 arguments: node and context, substitute the result for bit. if not, substitute node for bit. call the function force_text with an argument bit, append the result to bits. call the function mark_safe with an argument, elements of bits joined into a string, return the result. define the method get_nodes_by_type with 2 arguments: self and nodetype. modes is an empty list. for every node in self, call the method node.get_nodes_by_type with an argument nodetype, extend nodes with it. return nodes. define the method render_node with 3 arguments: self, node and context. call the method node.render with an argument context, return the result. derive the class TextNode form the base class Node. define the method __init__ with 2 arguments: self and s. substitute s for self.s. define the method __repr__ with an argument self. call the function force_str with 3 arguments: string "", with '%s' replaced with first 25 elements of self.s string, string 'ascii' and errors set to a string 'replace', return the result. define the method render with 2 arguments: self and context. return self.s. define the function render_value_in_context with 2 arguments: value and context. call the method template_localtime with 2 arguments: value and use_tz=context.use_tz, substitute the result for value. call the function localize with 2 arguments: value and use_l10n=context.use_l10n, substitute the result for value. call the function force_text with an argument value, substitute the result for value. if context.autoescape is true and value is not an instance of SafeData, or value is an instance of EscapeData, call the function escape with an argument value, return the result. if not, return value. derive the class VariableNode form the base class Node. define the method __init__ with 2 arguments: self and filter_expression. substitute filter_expression for self.filter_expression. define the method __repr__ with an argument self. return a string "", substitute '%s' with self.filter_expression. define the method render with 2 arguments self and context. try, call the method self.filter_expression.resolve with an argument context, substitute the result for output. if UnicodeDecodeError exception is caught, return an empty string. call the function render_value_in_context with 2 arguments output and context, return the result. call the function re.compile with an argument raw string "(?:(\w+)=)?(.+)", substitute the result for kwarg_re. define the method token_kwargs: bits, parser and support_legacy set to boolean False. if bits is false, return an empty dictionary. call the method kwarg_re.match with an argument first element of bits, substitute the result for match. if match is true and call to the method match.group with an argument integer 1 evaluates to true, kwarg_format is boolean True, otherwise it is boolean False. if kwarg_format is false, if support_legacy is false, return an empty dictionary. if length of bits is lesser than integer 3 or second element of bits is not equal to string 'as', return an empty dictionary. kwargs is an empty dictionary, while bits is true, if kwarg_format is true, call the method kwarg_re.match with an argument first element of bits, substitute the result for match. if match is false or call to the method match.group with an argument integer 1 evaluates to boolean false, return kwargs. call the method match.groups with 2 arguments: key and value. delete first element of bits. if not, if length of bits is lesser than integer 3 or second element of bits is not equal to string 'as', return kwargs. substitute third and first element of bits for key and value, respectively. delete first 3 elements of bits. call the method parser.compile_filter with an argument value, substitute the result for value under the key key of kwargs dictionary. if bits is true and kwarg_format is false, if first element of bits is not equal to string 'and', return kwargs. delete first element of bits. return kwargs. define the function parse_bits with 8 arguments: parser, bits, params, varargs, varkw, defaults, takes_context and name. if takes_context is true, if first element of params equals a string 'context', substitute params without the first element for params. if not, raise an TemplateSyntaxError exception "'%s' is decorated with takes_context=True so it must have a first argument of 'context'", where '%s' is replaced with name. args is an empty list. kwargs is an empty dictionary. convert params into a list, substitute it for unhandled_params. for every bit in bits, call the function if kwarg is true, call the method six.iteritems with an argument kwarg, convert the result into a list, substitute first element of the result for param and value. if param is not in params and varkw is None, raise an TemplateSyntaxError exception with an argument "'%s' received unexpected keyword argument '%s'", where '%s' are replaced with name and param. otherwise if param is contained in kwargs, raise an TemplateSyntaxError exception with an argument string "'%s' received multiple values for keyword argument '%s'", where '%s' are replaced with name and param. if not, convert param to a string, use it as a key to get the value from kwargs dictionary, assign it value. if param is contained in unhandled_params, call the method unhandled_params.remove with an argument param. if not, if kwargs is true, raise an TemplateSyntaxError exception with an argument string "'%s' received some positional argument(s) after some keyword argument(s)", where '%s' is replaced with name. if not, call the method parser.compile_filter with an argument bit, append the result to args. try, remove first element of unhandled_params. if IndexError exception is caught, if varargs is None, raise an TemplateSyntaxError exception with an argument string "'%s' received too many positional arguments", where '%s' is replaced with name. if defaults is not None, slice list unhandled_params from the beginning to the length of defaults last element, if unhandled_params is true, raise TemplateSyntaxError( return args and kwargs. define the method generic_tag_compiler with 9 arguments: parser, token, params, varargs, varkw, defaults, name, takes_context, call the function token.split_contents, substitute the result without the first element for bits. call the method parse_bits with 8 arguments: parser, bits, params, varargs, varkw, defaults, takes_context and name, substitute the result for args and kwargs, respectively. call the function node_class with 3 arguments: takes_context, args and kwargs. derive the class TagHelperNode form the base class Node. define the method __init__ with 4 arguments: self, takes_context, args and kwargs. substitute takes_context for self.takes_context. substitute args for self.args. substitute kwargs for self.kwargs. define the method get_resolved_arguments with 2 arguments: self and context. resolved_args is an list with elements, return value of the method var.resolve with an argument context, for every var in self.args. if self.takes_context is true, append resolved_args to a list containing context element, substitute it for resolved_args. resolved_kwargs is dictionary with elements: return value of the method v.resolve called with an argument context, for k, for every k and v in return value of the method self.kwargs.items. return resolved_args and resolved_kwargs. derive the class Library form the base class object. define the method with reload with an argument self. self.filters is an empty dictionary. self.tags is an empty dictionary. define the method tag with 3 arguments: self, name set to None and compile_function set to None. if name is None and compile_function is None, return self.tag_function. otherwise if name is not None and compile_function is None, if name is callable object, call the method self.tag_function with an argument name, return the result. if not, define the function dec with an argument func, call the method self.tag with 2 arguments name and func, return the result. return dec. otherwise if name is not None and compile_function is not None, substitute compile_function for self.tags dictionary value under the name key. return compile_function. if not, raise an InvalidTemplateLibrary exception with an argument string "Unsupported arguments to Library.tag: (%r, %r)", substitute '%r' with name and compile_function. define the method tag_function with 2 argument: self and func. get "_decorated_function" attribute from func, return func if the attribute doesnt exists, use its __name__ field as a key to get the value from self.tags, assign func to it. return func. define the method filter with 4 arguments: self, name set to None, filter_func set to None and unpacked dictionary flags. if name is None and filter_func is None, define the function dec with an argument func, call the method self.filter_function with 2 arguments func and unpacked dictionary flags, return the result. return dec. otherwise if name is not None and filter_func is None, if name is callable object, call the method self.filter_function with arguments name and unpacked dictionary flags, return the result. if not, define the function dec with an argument func, call the method self.filter with 3 arguments: name, func and unpacked dictionary flags, return the result. return dec. otherwise if name is not None and filter_func is not None, substitute filter_func for value under the name key of self.filters dictionary. for every attr in tuple with 3 arguments: strings 'expects_localtime', 'is_safe' and 'needs_autoescape', if attr is contained in flags, substitute value under the attr key of flags dictionary for value. set filter_func objec attr attribute to value. if filter_func has an attribute "_decorated_function", set filter_func._decorated_function objects attr attribute to value. substitute name for filter_func._filter_name. return filter_func. if not, raise an InvalidTemplateLibrary exception with an argument string ("Unsupported arguments to Library.filter: (%r, %r)", where '%r' is replaced with name and filter_func, respectively. define the method filter_function with 3 arguments: self, func and unpacked dictionary flags. get "_decorated_function" attribute from func object, if it exists substitute __name__ field of the result for name, if not, substitute func.__name__ for name. call the method self.filter with 3 arguments: name, func and unpacked dictionary flags. define the method simple_tag with 4 arguments: self, func and None, takes_context and None and name set to None. define the function dec with an argument func. call the function getargspec with an argument func, substitute the result for params, varargs, varkw and defaults, respectively. derive the class SimpleNode form the base class TagHelperNode. define the method render with 2 arguments self and context. call the method self.get_resolved_arguments with an argument context, substitute the result for resolved_args and resolved_kwargs. call the function func with 2 arguments: unpacked list resolved_args and unpacked dictionary resolved_kwargs, return it. if name is true, substitute it for function_name, if not get attribute '_decorated_function' from func object, substitute its __name__ field for function name, if it doesnt exists substitute func.__name__ for function_name. call the function generic_tag_compiler, params set to params, varargs set to varargs, varkw set to varkw, defaults set to defaults, name set to function_name, and takes_context set to takes_context and node_class set to SimpleNode. substitute func.__doc__ for compile_func.__doc__. call the method self.tag with 2 arguments: function_name and compile_func. return func. if func is None, return dec. otherwise if func is callable object, call the function dec with an argument func, return the result. if not, raise an TemplateSyntaxError exception with an argument string "Invalid arguments provided to simple_tag". define the method assignment_tag with 4 arguments: self, func set to None, takes_context set to None and name set to None. define the function dec with an argument func. call the function getargspec with an argument func, substitute the result for params, varargs, varkw and defaults. derive the class AssignmentNode form the base class TagHelperNode. define the function __init__ with 5 arguments: self, takes_context, args, kwargs and target_var. call the method __init__ from the base class of the class AssignmentNode, with 3 arguments: takes_context, args and kwargs. substitute target_var for self.target_var. define the method render with 2 arguments self and context. call the method self.get_resolved_arguments with an argument context, substitute the result for resolved_args and resolved_kwargs. call the function func with 2 arguments: unpacked list resolved_args and unpacked dictionary resolved_kwargs, substitute the result for value under the self.target_var key of the context dictionary. return an empty string. if name is true, substitute it for function_name, if not get '_decorated_function' attribute from func object, if it exists, substitute __name__ field of the result for function_name, in not, substitute func.__name__ for function_name. define the function compile_func with 2 arguments: parser and token. call the function token.split_contents, substitute the result without the first element for bits. if length of bits is smaller than integer 2 or second last element of bits is not equal to 'as', raise an TemplateSyntaxError exception with an argument string, "'%s' tag takes at least 2 arguments and the second last argument must be 'as'", where '%s' is replaced with function_name. substitute last element of bits for target_var. substitute bits without last two elements for bits. call the function parse_bits with 8 arguments: parser, bits, params, varargs, varkw, defaults, takes_context and function_name, substitute the result for args and kwargs. return an instance of AssignmentNode class created with 4 arguments: takes_context, args, kwargs and target_var. substitute func.__doc__ for compile_func.__doc__. call the method self.tag with 2 arguments: function_name and compile_func. return func. if func is None, return dec. otherwise if func is callable, call the function dec with an argument func, return the result. if not, raise an TemplateSyntaxError exception with an argument string "Invalid arguments provided to assignment_tag". define the method inclusion_tag with 5 arguments: self, file_name, context_class set to Context, takes_context set to boolean False, and name set to None. define the function dec with an argument func. call the function getargspec with an argument func, substitute the result for params, varargs, varkw and defaults. derive the class InclusionNode form the base class TagHelperNode. define the method render with 2 arguments: self and context. call the method self.get_resolved_arguments with context as an argument, substitute the result for resolved_args and resolved_kwargs. call the function func with 2 arguments: unpacked list resolved_args and unpacked dictionary resolved_kwargs, substitute the result for _dict. get 'nodelist' attribute from self object. if it doesnt exists return boolean False, if the result evaluates to false, from django.template.loader import get_template, select_template. if file_name is an instance of Template class. substitute file_name for t. otherwise if file_name is not an instance of six.string_types and call to the function is_iterable with an argument file_name, evaluates to true, call the function select_template with an argument file_name, substitute the result for t. if not, call the function get_template with an argument file_name, substitute the result for t. substitute t.nodelist for self.nodelist. call the function context_class with 2 arguments: _dict and unpacked dictionary containing 4 entries: context.autoescape for 'autoescape', context.autoescape for 'current_app', context.use_l10n for 'use_l10n', and context.use_tz for 'use_tz', substitute the result for new_context. call the function context.get with 2 argument 'csrf_token' and None, substitute the result for csrf_token. if csrf_token is not None, substitute csrf_token for value under the 'csrf_token' key of new_context dictionary. call the method self.nodelist.render with an argument new_context, return the result. if name is true, substitute it for function_name, if not get '_decorated_function' attribute from func object, if it exists, substitute __name__ field of the result for function_name, in not, substitute func.__name__ for function_name. call the function partial with 8 arguments: generic_tag_compiler, params set to params, varargs set to varargs, varkw set to varkw, defaults set to defaults, name set to function_name, takes_context set to takes_context and node_class set to InclusionNode, substitute the result for compile_func. substitute func.__doc__ for compile_func.__doc__. call the function self.tag with 2 arguments: function_name and compile_func. return func. return dec. define the function is_library_missing with an argument name. split string name into two parts from the right side by the separator '.', substitute parts for path and module, respectively. try, call the function import_module with an argument path, substitute it for package. call the function module_has_submodule with 2 arguments: package and module, return inverted boolean result. if ImportError exception is caught, call the function is_library_missing with an argument path, return the result. define the function import_library with an argument taglib_module. try, call the function import_module with an argument taglib_module, substitute the result for mod. if ImportError, renamed to e, exception is caught, call the function is_library_missing with an argument taglib_module, if it evaluates to true, return None. if not, raise an InvalidTemplateLibrary exception with an argument string "ImportError raised loading %s: %s", where '%s' is replaced with taglib_module and e. try, return mod.register. if AttributeError exception is caught, raise an InvalidTemplateLibrary exception with an argument string "Template library %s does not have a variable named 'register'", where '%s' is replaced with taglib_module. templatetags_modules is an empty list. define the function get_templatetags_modules. use global variable templatetags_modules. if templatetags_modules is false, _templatetags_modules is an empty list. templatetags_modules_candidates is an list with an argument string 'django.templatetags'. add string '%s.templatetags' to a list, where '%s' is replaced with app_config.name, for every app_config in result of the method apps.get_app_configs, append the resulting list to templatetags_modules_candidates. for every templatetag_module in templatetags_modules_candidates, try, call the function import_module with an argument templatetag_module. append templatetag_module to _templatetags_modules. if ImportError exception is caught, skip this loop iteration. substitute _templatetags_modules for templatetags_modules. return templatetags_modules. define the function get_library with an argument library_name. get the value under the library_name key of the libraries dictionary, if it exists, substitute it for lib, if not, lib is None. if lib is false, call the function get_templatetags_modules, substitute the result for templatetags_modules. tried_modules is an empty list. for every module in templatetags_modules, taglib_module is an string '%s.%s', where '%s' is replaced to module and library_name. append taglib_module to tried_modules. call the function import_library with an argument taglib_module, substitute the result for lib. if lib is true, substitute lib for value under the library_name key of libraries dictionary. break loop execution. if lib is false, raise an InvalidTemplateLibrary exception with an argument string "Template library %s not found, tried %s", where '%s' is replaced with library_name and elements of tried_modules joined into a string, separated by ','. return lib. define the function add_to_builtins with an argument module. call the function import_library with an argument module, append the result to builtins. call the function add_to_builtins with an argument string 'django.template.defaulttags'. call the function add_to_builtins with an argument string 'django.template.defaultfilters'. call the function add_to_builtins with an argument string 'django.template.loader_tags'. from copy import copy into default name space. from django.utils.module_loading import import_string into default name space. _standard_context_processors is None. _builtin_context_processors is a tuple containing a string 'django.core.context_processors.csrf'. derive the class ContextPopException from the Exception base class. do nothing. derive the class ContextDict from the dict base class. define the method __init__ with 4 arguments: self, context, unpacked list args and unpacked dictionary kwargs. call the method __init__ from the base class of the class ContextDict, with 2 arguments: unpacked list args and unpacked dictionary kwargs. append self to context.dicts. substitute context for self.context. define the method __enter__ with an argument self. return self. define the method __exit__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. remove the first element from the self.context. derive the class BaseContext from the object base class. define the method __init__ with 2 arguments: self and dict_ set to None. call the method self._reset_dicts with an argument dict_. define the method _reset_dicts with 2 arguments: self and value set to None. builtins is an dictionary with 3 initial entries: boolean True for 'True', boolean False for 'False' and None for 'None'. self.dicts is an list with element builtins. if value is not None, append value to self.dicts list. define the method __copy__ with an argument self. call the function copy with an argument base class of the class BaseContext, substitute the result for duplicate. hard copy list self.dicts to duplicate.dicts. return duplicate. define the method __repr__ with an argument self. return printable representation of self.dicts. define the method __iter__ with an argument self. for every d in reversed list self.dicts, yield d. define the method push with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. instantiate class ContextDict with 3 arguments: self, unpacked list args and unpacked dictionary kwargs, return it. define the method pop with an argument self. if length of self.dicts is equal to an integer 1, raise an ContextPopException. call the method self.dicts.pop, return the result. define the method __setitem__ with 3 arguments: self, key and value. substitute value for value under the key key of dictionary at last element of self.dicts. define the method __getitem__ with 2 arguments: self and key. for every d in reversed list self.dicts, if key is contained in d, return value under the key key of d dictionary. raise KeyError exception with an argument key. define the method __delitem__ with 2 arguments: self and key. delete value under the key key of dictionary at last element of self.dicts. define the method has_key with 2 arguments: self and key. for every d in self.dicts, if key is contained in d, return boolean True. return boolean False. define the method __contains__ with 2 arguments: self and key. call the method self.has_key with an argument key, return the result. define the method got with 3 arguments: self, key and otherwise set to None. for every d in reversed list self.dicts, if key is contained in d, return value under the key key of d dictionary. return otherwise. define the method new with 2 arguments: self and values set to None. call the function copy with an argument self, substitute the result for new_context. call the method new_context._reset_dicts values. return new_context. define the method flatten with an argument self. flat is an empty dictionary, for every d in self.dicts, update flat dictionary with d. return flat. define the method __eq__ with 2 arguments: self and other. if other is an instance of BaseContext class, call the flatten method of the self and other objects, if they are equal, return boolean True, if not return boolean False. return boolean False. derive the class Context from the BaseContext base class. define the method __init__ with 6 arguments: self, dict_ set to None, autoescape set to True, current_app set to None, use_l10n set to None and use_tz set to None. substitute autoescape for self.autoescape. substitute current_app for self.current_app. substitute use_l10n for self.use_l10n. substitute use_tz for self.use_tz. self.render_context is a instance of RenderContext class. call the the method __init__ from the base class of the class Context. define the method __copy__ with an argument self. call the the method __copy__ from the base class of the class Context, substitute the result for duplicate. call the function copy with an argument self.render_context, substitute the result for duplicate.render_context. return duplicate define the method update with 2 arguments: self and other_dict. if other_dict doesnt have an '__getitem__' attribute, raise an TypeError exception with an argument string 'other_dict must be a mapping (dictionary-like) object.'. append other_dict to self.dicts. return other_dict. derive the class RenderContext from the BaseContext base class. define the method __iter__ with an argument self. for every d in last element of self.dicts, yield d. define the method has_key with 2 arguments: self and key. if key is contained in last element of self.dicts, return boolean True, otherwise return boolean False. define the method get with 3 arguments: self, key and otherwise set to None. return value under the key key of dictionary in last element of self.dicts, if it doesnt exists return otherwise. define the method __getitem__ with 2 arguments: self and key. return value under the key key of dictionary in last element of self.dicts. define the function get_standard_processors. from django.conf import settings into default namespace. use global variable _standard_context_processors. if _standard_context_processors is None, processors is an empty list. collect is an empty list. extend collect list with _builtin_context_processors. extend collect list with settings.TEMPLATE_CONTEXT_PROCESSORS. for every path in collect, call the function import_string with an argument path, substitute the result for func. append func to processors. convert processors elements into a tuple, substitute it for _standard_context_processors. return _standard_context_processors. derive the class RequestContext from the Context base class. define the method __init__ with 7 arguments: self, request, dict_ set to None, processors set to None, current_app set to None, use_l10n set to None and use_tz set to None. call the method Context.__init__ with 5 arguments: self, dict_, current_app as current_app, use_l10n as use_l10n, use_tz as use_tz. if processors is None, processors is an empty tuple. if not, convert processors into a tuple and substitute it for processors. updates is an empty dictionary. call the function get_standard_processors, append processors to the result, for every processor is the result, call the function processor with an argument request, update updates dictionary with the result. update self dictionary with updates. from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode and TemplateSyntaxError into default name space. from django.utils.encoding import force_text into default name space. from django.utils.html import escape into default name space. from django.utils.safestring import SafeData and EscapeData into default name space. from django.utils.formats import localize into default name space. from django.utils.timezone import template_localtime into default name space. derive the class DebugLexer from the Lexer base class. define the method __init__ with 3 arguments: self, template_string and origin. call the method __init__ from the base class of the class DebugLexer, with 2 arguments: template_string and origin. define the method tokenize with an argument self. result is an empty list, upto is integer 0. call the method tag_re.finditer with an argument self.template_string, for every match in result, call the method match.span, substitute the result for start an end, respectively. if start is greater than upto, call the method self.create_token with 3 arguments: self.template_string list elements from upto index to start index, tuple with 2 elements: upto and start and boolean False, append the result to result. substitute start for upto. call the method self.create_token with 3 arguments: self.template_string list elements from start index to end index, tuple with 2 elements: start and end and boolean False, append the result to result. substitute end for upto. substitute elements of self.template_string list from upto index to the end for last_lit. if last_bit is true, call the method self.create_token with 3 arguments: last_bit, tuple with 2 elements: upto and sum of upto and length of last_bit, and boolean False, append the result to result. return result. define the method create_token with 4 arguments: self, token_string, source and in_tag. call the method create_token from the base class of the class DebugLexer, with 2 arguments: template_string and in_tag, substitute the result for token. assign self.origin, source to token.source. return token. derive the class DebugParser from the Parser base class. define the method __init__ with 2 arguments: self and lexer. call the method __init__ with an argument lexer, from the base class of the class DebugParser. self.command_stack is an empty list. define the method enter_command with 3 arguments: self, command and token. append tuple with 2 elements: command and token.source, append the result to self.command_stack. define the method exit_command with an argument self. remove first element from self.command_stack. define the method error with 3 arguments: self, token and msg. call the method self.source_error with 2 arguments: token.source and msg, return the result. define the method source_error with 3 arguments: self, source and msg. e is an instance of TemplateSyntaxError class, created with an argument msg. substitute source for e.django_template_source. return e. define the method create_nodelist with an argument self. return an instance of DebugNodeList class. define the method create_variable_node with 2 arguments: self and contents. return an instance of DebugVariableNode, created with an argument contents. define the method extend_nodelist with 4 arguments: self, nodelist, node and token. substitute token.source for node.source. call the method extend_nodelist with 3 arguments: nodelist, node and token, from the base class of the class DebugParser. define the method unclosed_block_tag with 2 arguments: self and parse_until. remove the first element from self.command_stack, assign the result to command and source, respectively. msg is an string "Unclosed tag '%s'. Looking for one of: %s ", where '%s' is replaced with command, and elements of parse_until joined into a string, separated by string ', '. raise an self.source_error exception with 2 arguments: source and msg. define the method compile_filter_error with 3 arguments: self, token and e. if e doesnt have an 'django_template_source' attribute, substitute token.source for e.django_template_source. define the method compile_function_error with 3 arguments: self, token and e. if e doesnt have an 'django_template_source' attribute, substitute token.source for e.django_template_source. derive the class DebugNodeList from the NodeList base class. define the method render_node with 3 arguments: self, node and context. try, call the method node.render with an argument context, return the result. if Exception, renamed to e, exception is caught, if e doesnt have an 'django_template_source' attribute, substitute node.source for e.django_template_source. raise an exception. derive the class DebugVariableNode from the VariableNode base class. define the method render with 2 arguments: self and context. try, call the method self.filter_expression.resolve with an argument context, substitute the result for output. call the function template_localtime with 2 arguments: output and use_tz set to context.use_tz, substitute the result for output. call the function localize with 2 arguments: output and use_l10n set to context.use_l10n, substitute the result for output. call the function force_text with an argument output, substitute the result for output. if UnicodeDecodeError exception is caught, return an empty string. if Exception, renamed to e, exception is caught, if e doesnt have an 'django_template_source' attribute, substitute self.source for e.django_template_source. raise an exception. if context.autoescape is true and output is not an instance of SafeData class or output is an instance of EscapeData class, call the function escape with an argument output. if not, return output. from __future__ import unicode_literals into default name space. import module re. import module random as random_module. from decimal import Decimal, InvalidOperation, Context and ROUND_HALF_UP into default name space. from functools import wraps into default name space. from pprint import pformat into default name space. from django.template.base import Variable, Library and VariableDoesNotExist into default name space. from django.conf import settings into default name space. from django.utils import formats into default name space. from django.utils.dateformat import format and time_format into default name space. from django.utils.encoding import force_text and iri_to_uri into default name space. from django.utils.html import conditional_escape, escapejs, escape, urlize as _urlize, linebreaks, strip_tags, avoid_wrapping, and remove_tags. from django.utils.http import urlquote into default name space. from django.utils.text import Truncator, wrap and phone2numeric into default name space. from django.utils.safestring import mark_safe, SafeData and mark_for_escaping into default name space. from django.utils import six into default name space. from django.utils.timesince import timesince and timeuntil into default name space. from django.utils.translation import ugettext and ungettext into default name space. from django.utils.text import normalize_newlines and slugify as _slugify into default name space. register is an instance of Library class. define the method stringfilter with an argument func. define the method _dec with 2 arguments: unpacked list args and unpacked dictionary kwargs. if args in true, convert args into a list, substitute it for args. call the function force_text with an argument first element of args, substitute the result for first element of args. if first element of args is an instance of SafeData, and 'is_safe' attribute of dec._decorated_function object is true, call the function func with 2 arguments: unpacked list args and unpacked dictionary kwargs, use the result as an argument for the call to the mark_safe function, return the result. call the function func with 2 arguments: unpacked list args and unpacked dictionary kwargs, return the result. get '_decorated_function' attribute from the func object, substitute it for _dec._decorated_function, if it doesnt exist, substitute func for _dec._decorated_function. call the function wraps with an argument func, call the result with an argument _dec, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function addslashes with an argument value. replace all occurrences of '\\' with '\\\\' in value, replace all occurrences of '"' with '\\"' in the previous result, replace all occurrences of "'" with "\\'" in the previous result, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function capfirst with an argument value. if value is false, return it, if it is true convert first element of value to uppercase letter, return the value. decorator function register.filter with an argument string "escapejs". decorator stringfilter, define the function escapejs_filter with an argument value. call the function escapejs with an argument value, return the result. multiply 10 to the power of 200, with itself, substitute the result for pos_inf. multiply 10 to the power of 200, with 10 to the power of 200, negative, substitute the result for neg_inf. divide 10 to the power of 400 by 10 to the power of 400, substitute the result for nan. special_floats is an list with 3 elements, pos_inf, neg_inf and nan, all converted to strings. decorator function register.filter with an argument is_safe set to boolean True. define the function floatformat with 2 arguments text and arg set to integer -1. try, call the function force_text with an argument text, substitute the result for input_val. d is an instance of Decimal class created with an argument input_val. if UnicodeEncodeError exception is caught, return an empty string. if InvalidOperation exception is caught, if every input_val in special_floats, return input_val. try, d is an instance of class Decimal, created with result of the function force_text, called with an argument text converted into a floating point number. if ValueError, InvalidOperation, TypeError or UnicodeEncodeError exceptions are caught, return an empty string. try, convert arg to an integer, substitute it for p. if ValueError exception is caught, return input_val. try, convert d into a integer, subtract d from it, substitute the result for m. if ValueError, OverflowError or InvalidOperation exceptions are caught, return input_val. if m is false and p is lesser than integer 0, call the method formats.number_format with 2 arguments, d converted to a integer and then to string, and integer 0, use the result as an argument for the call to the function mark_safe, return the result. if p equals integer 0, exp is an instance of Decimal, created with an argument integer 1. if not, instantiate class Decimal with string '1.0' as argument, divide it by product of instance of Decimal class created with integer 10, and absolute value of p, substitute the result for exp. try, call the method d.as_tuple, substitute the result for tupl. subtract third element of tupl from length of second element of tupl, substitute the result for units. sum absolute p with units an integer 1, substitute the result for prec. call the method d.quantize with 3 arguments: exp, ROUND_HALF_UP and instance of Context class created with prec as prec, call the method as_tuple on the result, substitute the result for sign, digits and exponent, respectively. append result of method six.text_type called with an argument digit to an list, for every digit in reversed order of digits, substitute the resulting list for digits. while length of digits is smaller than or equal to absolute value of exponent, append '0' to digits. insert '.' to digits at negative exponent index. if sign is true, append '-' to digits. reverse element order of dicts, join them in a string, substitute the result for number. call the method formats.number_format with 2 arguments: number and absolute value of p, use the result as an argument for the call to the mark_safe function, return the result. if InvalidOperation exception is caught, return input_val. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function iriencode with an argument value. call the function iri_to_uri with an argument value, use the result as an argument for the call to the force_text function, return the result. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. decorator stringfilter, define the function linenumbers with 2 arguments value and autoescape set to None. split value by newline characters, substitute the result for lines. call the function six.text_type with length of lines as an argument, use length of result as an argument for the call to the function six.text_type, substitute the result for width. if autoescape is false, if value is an instance of SafeData, for every i and line in enumerated iterable lines, concatenate string '%0', width and string "d. %s", format the previous string with i incremented by 1 and line, substitute the result for i-th element of lines. if not, for every i and line in enumerated iterable lines, concatenate string '%0', width and string "d. %s", format the previous string with i incremented by 1, and result of the function escape called with an argument line, substitute the result for i-th element of lines. call the method mark_safe with lines joined into a string, separated by newlines as argument, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function lower with an argument value. convert value to lowercase and return the result. decorator function register.filter with an argument is_safe set to boolean False. decorator stringfilter, define the function make_list with an argument value. return value converted into a list. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function slugify with an argument value. call the function _slugify with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean True. define the function stringformat with 2 arguments value and arg. try, call the function six.text_type with an argument arg, append the result to '%', format the previous with value, return the result. if TypeError or ValueError exceptions are caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function title with an argument value. call the function re.sub with 3 arguments: string "([a-z])'([A-Z])", lambda function with an argument m and return value, result of the m.group method called with an argument integer 0 converted into lowercase and result of the method value.title, substitute the result for t. call the function re.sub with 3 arguments: string "\d([A-Z])", lambda function with an argument m and return value, result of the m.group method called with an argument integer 0 converted into lowercase and t, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function truncatechars with 2 arguments value and arg. try, substitute arg converted into a integer for length. if ValueError exception is caught, return value. instantiate class Truncator, with an argument value, call the method chars on the result with an argument length, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function truncatechars_html with 2 arguments value and arg. try, substitute arg converted into an integer for length. if ValueError exception is caught, return value. instantiate class Truncator, with an argument value, call the method chars on the result with 2 arguments length, and html set to boolean True, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function truncatewords with 2 arguments value and arg. try, substitute arg converted into an integer for length. if ValueError exception is caught, return value. instantiate class Truncator, with an argument value, call the method words on the result with 2 arguments length, and truncate set to string ' ...', return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function truncatewords_html with 2 arguments value and arg. try, substitute arg converted into an integer for length. if ValueError exception is caught, return value. instantiate class Truncator, with an argument value, call the method words on the result with 3 arguments length, html set to boolean True and truncate set to string ' ...', return the result. decorator function register.filter with an argument is_safe set to boolean False. decorator stringfilter, define the function upper with an argument value. convert value to uppercase, return the result. decorator function register.filter with an argument is_safe set to boolean False. decorator stringfilter, define the function urlencode with 2 arguments value and safe set to None. kwargs is an empty dictionary. if safe is not None, substitute safe for value under the 'safe' key of kwargs dictionary. call the function urlquote with 2 arguments value and unpacked dictionary kwargs, return the result. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. decorator stringfilter, define the function urlize with 2 arguments value and autoescape set to None. call the function _urlize with 3 arguments: value, nofollow set to boolean True, autoescape set to autoescape, use the result as an argument for the call to the function mark_safe, return the result. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. decorator stringfilter, define the function urlizetrunc with 3 arguments value, limit and autoescape set to None. call the function _urlize with 4 arguments: value, trim_url_limit as limit converted into an integer, nofollow as boolean True, and autoescape as autoescape, use the result as an argument for the call to the function mark_safe, return the result. decorator function register.filter with an argument is_safe set to boolean False. decorator stringfilter, define the function wordcount with an argument value. split value into words, return the length of the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function wordwrap with 2 arguments value and arg. call the method wrap with 2 arguments, value and arg converted into a integer, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function ljust with 2 arguments value and arg. call the method value.ljust with an argument, arg converted into a integer, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function rjust with 2 arguments value and arg. call the method value.rjust with an argument, arg converted into a integer, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function center with 2 arguments value and arg. call the method value.center with an argument, arg converted into a integer, return the result. decorator register.filter. decorator stringfilter, define the function cut with 2 arguments value and arg. if value is an instance of SafeData, safe is boolean True, otherwise it is boolean False. replace every occurrence of arg is value for an empty string, substitute the result for value. if safe is true and arg is not equal to string ';', call the function mark_safe with an argument value, return the result. return value. decorator function register.filter with 2 arguments string "escape" and is_safe set to boolean True. decorator stringfilter, define the function escape_filter with an argument value. call the function mark_for_escaping with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function force_escape with an argument value. call the function escape with an argument value, return the result. decorator function register.filter with 3 arguments string "slice", is_safe set to boolean True and needs_autoescape set to True. decorator stringfilter, define the function linebreaks_filter with 2 arguments value and autoescape set to None. if autoescape is true and value is not an instance of SafeData, autoescape is boolean True, otherwise it is boolean False. call the function linebreaks with 2 arguments value and autoescape, use the result as an argument for the call to the mark_safe, return the result. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. decorator stringfilter, define the function linebreaksbr with 2 arguments value and autoescape set to None. if autoescape is true and value is not an instance of SafeData, autoescape is boolean True, otherwise it is boolean False. call the function normalize_newlines with an argument value, substitute the result for value. if autoescape is true, call the function escape with an argument value, substitute it for value. replace every occurrence of newline character in value with string '
    ', use it as an argument for the call to the mark_safe, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function safe with an argument value. call the function mark_safe with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean True. define the function safeseq with an argument value. for every obj in value call the function mark_safe with an argument result of the function force_text called with an argument obj, return all the results in a list. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function removetags with 2 arguments value and arg. call the function remove_tags with 2 arguments value and tags, return the result. decorator function register.filter with an argument is_safe set to boolean True. decorator stringfilter, define the function striptags with an argument value. call the function strip_tags with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean False. define the function dictsort with 2 arguments value and arg. try, sort value with key set to filed resolve of instance of a class Variable, created with an argument arg, return the result. if TypeError or VariableDoesNotExist exceptions are caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean False. define the function dictsortreversed with 2 arguments value and arg. try, sort value with key set to filed resolve of instance of a class Variable, created with an argument arg, reverse the sort and return the result. if TypeError or VariableDoesNotExist exceptions are caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean False. define the function first with an argument value. try, return first element of value. if IndexError exception is caught, return an empty string. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. define the function join with 3 arguments: value, arg and autoescape set to None. map elements of value through mapping function force_text, substitute the result for value. if autoescape is true, for every v in value call the function conditional_escape with an argument v, append the result in a list, substitute the resulting list for value. try, call the function conditional_escape with an argument arg, call the method join on the result with an argument value, substitute the result for data. if AttributeError exception is caught, return value. call the function mark_safe with an argument data, return the result. decorator function register.filter with an argument is_safe set to boolean True. define the function last with an argument value. try, return last element of value. if IndexError exception is caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean False. define the function length with an argument value. try, return length of value, if TypeError or ValueError exceptions are caught, return integer 0. decorator function register.filter with an argument is_safe set to boolean False. define the function length_is with 2 arguments value and arg. try, if lengths of value and arg are equal, return boolean True, otherwise return boolean False. if TypeError or ValueError exceptions are caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean True. define the function random with an argument value. call the function random_module.choice with an argument value, return the result. decorator function register.filter with 2 arguments string "slice" and is_safe set to boolean True. define the function slice_filter with 2 arguments value and arg. try, bits is an empty list. split arg by ':', for every x in result, if length of x is equal to integer 0, append None to bits. if not, append x converted to an integer to bits. slice the list value with unpacked list bits as an argument, return the result. if TypeError or ValueError exceptions are caught, return value. decorator function register.filter with 2 arguments is_safe set to boolean True and needs_autoescape set to boolean True. define the function unordered_list with 2 arguments value and autoescape set to None. if autoescape is true, substitute conditional_escape for escaper. if not, escaper is an identity lambda function. define the function convert_old_style_list with an argument list_. if list_ is not an instance of tuple or list types and length of list_ is not equal to integer 2, return list_ and boolean False. substitute list_ for first_item and second_item, respectively. if second_item is an empty list, return list with an element first_item, and boolean True. try, convert second item to an iterable, if TypeError exception is caught, return list_ and boolean False. old_style_list is boolean True. new_second_item is an empty list. for every sublist in second_item, call the function convert_old_style_list with an argument sublist, substitute the result for item and old_style_list. if old_style_list is false, break from the loop execution, extend new_second_item with item. if old_style_list is true, substitute new_second_item with second_item. return list with 2 elements: first_item and second_item, and old_style_list. define the function _helper with 2 arguments list and tabs set to integer 1. indent contain tabs number of tab character. output is an empty list. substitute length of list_ for list_length. i is integer 0. while i is smaller than list_length, substitute i-th element of list for title. sublist is an empty string. sublist_item is None. if title is an instance of list or tuple, substitute title for sublist_item. title is an empty string. otherwise if i is smaller than list_length decremented by one, substitute (i+1)-th element of list_ for next_item. if next_item is true and next_item is an instance of list or tuple type, substitute next_item for sublist_item. increment i by integer 1. if sublist_item is true, call the function _helper with 2 arguments: sublist_item and tabs incremented by 1, substitute the result for sublist. sublist is an string '\n%s
      \n%s\n%s
    \n%s', where every '%s' is replaced with indent, sublist, indent and indent, respectively. substitute every '%s' in string '%s
  • %s%s
  • ' with indent, with result of the function escaper called with an argument: result of the function force_text called with an argument title, and with sublist, append the string to output. increment i by 1. join elements of output into a string, separated with newlines, return the result. call the function convert_old_style_list with an argument value, substitute the result for value and converted, respectively. call the function _helper with an argument value, use it as an argument for the call to the function mark_safe, return the result. decorator function register.filter with an argument is_safe set to boolean False. define the function add with 2 arguments value and arg. try, convert value and arg into a integers, return their sum. if TypeError or ValueError exceptions are caught, try, sum value and arg, return the result. if Exception exception is caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean False. define the function get_digit with 2 arguments value and arg. try, convert arg to an integer. convert value to an integer. if ValueError exception is caught, return value. if arg is smaller than integer 1, return value. try, convert value into a string, take character at the negative arg index, convert it into an integer, return it. if IndexError exception is caught, return integer 0. decorator function register.filter with 2 arguments expects_localtime set to boolean True and is_safe set to boolean False. define the function date with 2 arguments value and arg set to None. if vale is None or an empty string, return an empty string. if arg is None, substitute settings.DATE_FORMAT for arg. try, call the method formats.time_format with 2 arguments: value and arg, return the result. if AttributeError exception is caught, try, format value into printable data representation with formating rules arg, return the result. if AttributeError exception is caught, return an empty string. decorator function register.filter with 2 arguments expects_localtime set to boolean True and is_safe set to boolean False. define the function time with 2 arguments value and arg set to None. if vale is None or an empty string, return an empty string. if arg is None substitute settings.TIME_FORMAT for arg. try, call the method formats.time_format with 2 arguments: value and arg, return the result. if AttributeError exception is caught, try, call the function time_format with 2 arguments: value and arg, return the result. if AttributeError exception is caught, return an empty string. decorator function register.filter with 2 arguments string "timesince" and is_safe set to boolean False. define the function timesince_filter with 2 arguments value and arg set to None. if value is false, return an empty string. try, if arg is true, call the function timesince with 2 arguments: value and arg, return the result. call the function timesince with an argument value, return the result. if TypeError or ValueError exceptions are caught, return an empty string. decorator function register.filter with 2 arguments string "timeuntil" and is_safe set to boolean False. define the function timeuntil_filter with 2 arguments value and arg set to None. if value is false, return an empty string. try, call the function timeuntil with 2 arguments value and arg, return the result. if TypeError or ValueError exceptions are caught, return an empty string. decorator function register.filter with an argument is_safe set to boolean False. define the function default with 2 arguments value and arg. return value, if it is None return arg. decorator function register.filter with an argument is_safe set to boolean False. define the function default_if_none with 2 arguments value and arg. if value is None, return arg. return value. decorator function register.filter with an argument is_safe set to boolean False. define the function divisibleby with 2 arguments value and arg. convert value and arg to integers, if value is divisible by arg, return True, otherwise return boolean False. decorator function register.filter with an argument is_safe set to boolean False. define the function yesno with 2 arguments value and arg set to None. if arg is None call the function ugettext with string 'yes,no,maybe' as an argument, substitute the result for arg. split arg by ',', substitute the result for bits. if length of bits is lesser than integer 2, return value. try, assign bits elements to yes, no and maybe, respectively. if ValueError exception is caught, substitute first, second and second elements of bits for yes, no, maybe, respectively. if value is None, return maybe. if value is true, return yes. return no. decorator function register.filter with an argument is_safe set to boolean True. define the function filesizeformat with an argument bytes. try, convert bytes to floating point number, substitute it for bytes. if TypeError, ValueError or UnicodeDecodeError exceptions are caught, call the function ungettext with 3 arguments: string "%(size)d byte", string "%(size)d bytes" and 0, '%(size)d' is replaced with 0, substitute the result for value. call the function avoid_wrapping with an argument value, return the result. filesize_number_format is an lambda function with an argument value, return value is the result of the method formats.number_format, called with 2 arguments: value rounded to 1 decimal point and integer 1. move integer 1 left for 10 bits, substitute the result for KB. move integer 1 left for 20 bits, substitute the result for MB. move integer 1 left for 30 bits, substitute the result for GB. move integer 1 left for 40 bits, substitute the result for TB. move integer 1 left for 50 bits, substitute the result for PB. if bytes is smaller than KB, call the function ugettext with 3 arguments, string "%(size)d byte", string "%(size)d bytes" and bytes, replace '%(size)d with bytes, substitute the result for value. otherwise if bytes is smaller than MB, call the function ugettext with an argument string "%s KB", substitute '%s' with the result of the call to the function, filesize_number_format with result of division of bytes by KB as an argument, substitute the result for value. otherwise if bytes is smaller than GB, call the function ugettext with an argument string "%s MB", substitute '%s' with the result of the call to the function, filesize_number_format with result of division of bytes by MB as an argument, substitute the result for value. otherwise if bytes is smaller than TB, call the function ugettext with an argument string "%s GB", substitute '%s' with the result of the call to the function, filesize_number_format with result of division of bytes by GB as an argument, substitute the result for value. otherwise if bytes is smaller than PB, call the function ugettext with an argument string "%s TB", substitute '%s' with the result of the call to the function, filesize_number_format with result of division of bytes by TB as an argument, substitute the result for value. if not, call the function ugettext with an argument string "%s PB", substitute '%s' with the result of the call to the function, filesize_number_format with result of division of bytes by PB as an argument, substitute the result for value. call the function avoid_wrapping with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean False. define the function pluralize with 2 arguments value and arg set to character 's'. if ',' is not contained in arg, append arg to ',', substitute the result for arg. split arg by ',', substitute the result for bits.s if length of bits is greater than integer 2, return an empty string. substitute first 2 elements of bits for singular_suffix and plural_suffix, respectively. try, convert value to an floating point number if it is not equal to integer 1, return plural_suffix. if ValueError exception is caught, do nothing, if TypeError exception is caught, try, if length of value is not equal to integer 1, return plural_suffix. if TypeError exception is caught, do nothing, return singular_suffix. decorator function register.filter with 2 arguments string "phone2numeric" and is_safe set to boolean True. define the function phone2numeric_filter with an argument value. call the function phone2numeric with an argument value, return the result. decorator function register.filter with an argument is_safe set to boolean True. define the function pprint with an argument value. try, call the function pformat with an argument value, return the result. if Exception, renamed to e, exception is caught, return an string "Error in formatting: %s", replace '%s' with result of the function force_text, from __future__ import unicode_literals into default name space. import module os. import module sys. import module re. from datetime import datetime into default name space. from itertools import groupby and cycle as itertools_cycle into default name space. import module warnings. from django.conf import settings into default name space. from django.template.base import Node, NodeList, Template, Context, Library, TemplateSyntaxError, VariableDoesNotExist, validTemplateLibrary, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END, VARIABLE_ATTRIBUTE_SEPARATOR, get_library, token_kwargs, kwarg_re and render_value_in_context. from django.template.smartif import IfParser and Literal into default name space. from django.template.defaultfilters import date into default name space. from django.utils.deprecation import RemovedInDjango20Warning into default name space. from django.utils.encoding import force_text and smart_text into default name space. from django.utils.safestring import mark_safe into default name space. from django.utils.html import format_html into default name space. from django.utils import six into default name space. from django.utils import timezone into default name space. register is an instance of Library class. derive the class AutoEscapeControlNode from Node base class. define the method __init__ with 3 arguments: self, setting and nodelist. substitute setting and nodelist for self.setting and self.nodelist, respectively. define the method render with 2 arguments: self and context. substitute context.autoescape for old_setting. substitute self.setting for context.autoescape. call the method self.nodelist.render with an argument context, substitute the result for output. substitute old_setting for context.autoescape. if self.setting is true, call the function mark_safe with an argument output. if not, return output. derive the class CommentNode from Node base class. define the method render with 2 arguments: self and context. return an empty string, derive the class CsrfTokenNode from Node base class. define the method render with 2 arguments: self and context. get the value under the 'csrf_token' key of the context dictionary, if it exists substitute the result for csrf_token, if not csrf_token is None. if csrf_token is true, if csrf_token equals string 'NOTPROVIDED', call the function format_html with an argument empty string, return the result. if not, call the function format_html with 2 arguments: string "", and csrf_token, return the result. if not, if settings.DEBUG is true, call the function warnings.warn with an argument string "A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.". return an empty string, derive the class CycleNode from Node base class. define the method __init__ with 4 arguments: self, cyclevars, variable_name set to None and silent set to boolean False. substitute cyclevars for self.cyclevars. substitute variable_name for self.variable_name. substitute silent for self.silent. define the method render with 2 arguments: self and context. if self is not contained in context.render_context, call the function itertools_cycle with an argument self.cyclevars, substitute the result for value under the self dictionary context.render_context. get the value under the self key of the context.render_context dictionary, substitute it for cycle_iter. call the function next with an argument cycle_iter, call the method resolve on the result with an argument context, substitute the result for value. if self.variable_name is true. substitute value for value under the self.variable_name key of the context dictionary. if self.silent is true, return an empty string, call the function render_value_in_context with 2 arguments: value and context, return the result. derive the class DebugNode from Node base class. define the method render with 2 arguments: self and context. from pprint import pformat. output is an list with initial elements generated with call to the function pformat with an argument val, for every val in context. append 2 consecutive newlines to output. call the function pformat with an argument sys.modules, append the result for output. join elements of output into a string, return the result. derive the class FilterNode from Node base class. define the method __init__ with 3 arguments: self, filter_expr and nodelist). substitute filter_expr and nodelist for self.filter_expr and self.nodelist, respectively. define the method render with 2 arguments: self and context. call the method self.nodelist.render with an argument context, substitute the result output. call the method context.push with an argument var set to output, with the result perform, call the function self.filter_expr.resolve with an argument context, return the result. derive the class FirstOfNode from Node base class. define the method __init__ with 2 arguments: self and variables. substitute variables for self.vars. define the method render with 2 arguments: self and context. for every var in self.vars, call the method var.resolve with 2 arguments: context and True, substitute the result for value. if value is true, call the function render_value_in_context with 2 arguments: value and context, return the result. return an empty string, derive the class ForNode from Node base class. child_nodelists is an tuple with 2 elements: strings 'nodelist_loop' and 'nodelist_empty'. define the method __init__ with 6 arguments: self, loopvars, sequence, is_reversed, nodelist_loop and nodelist_empty set to None. substitute loopvars and sequence for self.loopvars and self.sequence, respectively. substitute is_reversed for self.is_reversed. substitute nodelist_loop for self.nodelist_loop. if nodelist_empty is None, self.nodelist_empty is an instance of NodeList class. if not, substitute nodelist_empty for self.nodelist_empty. define the method __repr__ with an argument self. if self.is_reversed is true, substitute reversed_text is an string ' reversed', if not, reversed_text is an empty string. return an string "", substitute '%s' with elements of self.loopvars joined into a string, separated with string ', ', substitute '%s' with self.sequence, substitute '%d' with length of self.nodelist_loop, substitute '%s' with reversed_text. define the method __iter__ with an argument self. for every node in self.nodelist_loop, yield node. for every node in self.nodelist_empty, yield node. define the method render with 2 arguments: self and context. if string 'forloop' is contained in context, substitute value under the the 'forloop' key of the context dictionary for parentloop. if not, parentloop is an empty dictionary. call the method context.push, with the result perform, try, call the method self.sequence.resolve with 2 arguments: context and boolean True, substitute the result for values. if VariableDoesNotExist exception is caught, values is an empty list. if values is None, if values is None, if values has an attribute '__len__', convert values into a list, substitute it for value. substitute length of values for len_values. if len_values is smaller than integer 1, call the method self.nodelist_empty.render with an argument context, return the result. nodelist is an empty list. if self.is_reversed is true, reverse elements order of values. substitute length of self.loopvars for num_loopvars. if num_loopvars is greater than integer 1, unpack is an boolean True, otherwise is an boolean False. loop_dict and value under the 'forloop' key of the context dictionary are dictionaries with an entry: parentloop for 'parentloop'. for every i and item in enumerated iterable values, substitute i for value under the 'counter0' key of the loop_dict dictionary. substitute i incremented by 1 for value under the 'counter' key of the loop_dict dictionary. subtract i from len_values, substitute the result for value under the 'revcounter' key of the loop_dict dictionary. subtract i from len_values, decrement the result by integer 1, substitute it for value under the 'revcounter' key of the loop_dict dictionary. if i is equal to integer 0, value under the 'first' key of the loop_dict dictionary is boolean True, otherwise it is False. if i is equal to len_values decremented by 1, value under the 'last' key of the loop_dict dictionary is boolean True, otherwise it is False. pop_context is boolean False. if unpack is true, if item is not an instance of list or tuple class, len_item is integer 1. if not, substitute length of item for len_item. if num_loopvars is not equal to len_item, call the function warnings.warn with 2 arguments: string "Need {0} values to unpack in for loop; got {1}. This will raise an exception in Django 2.0." formated with num_loopvars and len_item, respectively, and RemovedInDjango20Warning. try, zip self.loopvars and item is a list to tuples, convert the result to an dictionary, substitute it for unpacked_vars. if TypeError exception is caught, do nothing. if not, pop_context is boolean True. call the method context.update with an argument unpacked_vars. if not, substitute item for value under the first element of self.loopvars key of the context dictionary. if settings.TEMPLATE_DEBUG is true, for every node in self.nodelist_loop, try, call the method node.render with an argument context, append the result to the nodelist. if Exception, renamed to e, exception is caught, if e doesnt have an 'django_template_source' attribute, substitute node.source for e.django_template_source. raise an exception. if not, for every node in self.nodelist_loop, call the method node.render with an argument context, append the result to the nodelist. if pop_context is true, remove the first element of context. call the function mark_safe with an arguments: for every n in nodelist results of the function force_text called with an argument n, joined in a string, return the result. derive the class IfChangedNode from Node base class. child_nodelists is a tuple with 2 initial elements: strings 'nodelist_true' and 'nodelist_false'. define the method __init__ with 4 arguments: self, nodelist_true, nodelist_false and unpacked list varlist. substitute nodelist_true and nodelist_false for self.nodelist_true and self.nodelist_false, respectively. substitute varlist for self.varlist. define the method render with 2 arguments: self and context. call the method self._get_context_stack_frame with an argument context, substitute the result for state_frame. if self is not contained in state_frame, value under the self key of state_frame dictionary is None. nodelist_true_output is None. try, if self._varlist is true, compare_to is an list with elements generated by calling the var.resolve method with 2 arguments: context and boolean True, for every var in self._varlist. if not, call the method self.nodelist_true.render with an argument context, assign the result to compare_to and nodelist_true_output. if VariableDoesNotExist exception is caught, compare_to is None. if compare_to is not equal to value under the self key of state_frame. substitute compare_to for value under the state_frame dictionary under the self key. return nodelist_true_output, if true, if not call the method self.nodelist_true.render with an argument context and return the result. otherwise if self.nodelist_false is true, call the method self.nodelist_false.render with an argument context, return the result. return an empty string, define the method _get_context_stack_frame with 2 arguments: self and context. if string 'forloop' is contained in context, return value under the 'forloop' key of the context dictionary. if not, return context.render_context. derive the class IfEqualNode from Node base class. child_nodelists is a tuple with 2 elements strings 'nodelist_true' and 'nodelist_false'. define the method __init__ with 6 arguments: (self, var1, var2, nodelist_true, nodelist_false and negate. substitute var1 and var2 for self.var1 and self.var2, respectively. substitute nodelist_true and nodelist_false for self.nodelist_true and self.nodelist_false, respectively. substitute negate for self.negate. define the method __repr__ with an argument self. return an string "". define the method render with 2 arguments: self and context. call the method self.var1.resolve with 2 arguments: context and boolean True, substitute the result for val2. call the method self.var2.resolve with 2 arguments: context and boolean True, substitute the result for val2. if self.negate is true and val1 is not equal to val2, or if, self.negate is false and val1 equals val2, call the method self.nodelist_true.render with an argument context, return the result. call the method self.nodelist_false.render with an arguments context, return the result. derive the class IfNode from Node base class. define the method __init__ with 2 arguments: self and conditions_nodelists. substitute conditions_nodelists for self.conditions_nodelists. define the method __repr__ with an argument self. return an string "". define the method __iter__ with an argument self. for every _ and nodelist in self.conditions_nodelists, for every node in nodelist, yield node as an return value of a generator. property decorator, define the method nodelist with an argument self. return an instance of a NodeList class, created with arguments node, for every node in nodelist, and for every _, nodelist in self.conditions_nodelists. define the method render with 2 arguments: self and context. for every condition and nodelist in self.conditions_nodelists, if condition is not None, try, call the method condition.eval with an argument context, substitute the result for match. if VariableDoesNotExist exception is caught, match is None. if not, match is boolean True. if match is true, call the method nodelist.render with an argument context, return the result. return an empty string, derive the class RegroupNode from Node base class. define the method __init__ with 4 arguments: self, target, expression and var_name. substitute target and expression for self.target and self.expression, respectively. substitute var_name for self.var_name. define the method resolve_expression with 3 arguments: self, obj and context. substitute obj for value under the self.var_name key of the context dictionary. call the method self.expression.resolve with 2 arguments: context and boolean True, return the result. define the method render with 2 arguments: self and context. call the method self.target.resolve with 2 arguments: context and boolean True, substitute it for obj_list. if obj_list is None, value under the self.var_name key of the context dictionary is an empty list. return an empty string, value under the self.var_name key of the context dictionary is an list with dictionary elements with 2 entries: key for 'grouper' and val converted into a list for 'list', for every key and val in result of the function groupby, called with 2 arguments: obj_list and lambda function with an argument obj and return value as a result of the function, self.resolve_expression called with 2 arguments obj and context. return an empty string, define the function include_is_allowed with an argument filepath. return the absolute path of file path filepath, substitute it for filepath. for every root in settings.ALLOWED_INCLUDE_ROOTS, if filepath starts with root, return boolean True. return boolean False. derive the class SsiNode from Node base class. define the method __init__ with 3 arguments: self, filepath and parsed. substitute filepath for self.filepath. substitute parsed for self.parsed. define the method render with 2 arguments: self and context. call the function self.filepath.resolve with an argument context, substitute the result for filepath. call the function include_is_allowed with an argument filepath, if it evaluates to false, if settings.DEBUG is true, return string "[Didn't have permission to include file]". if not, return an empty string, try, open filepath file in read mode, with file descriptor as fp, perform, read file fp, substitute the read data for output. if IOError exception is caught, output is an empty string. if self.parsed is true, try, t is an instance of Template class, created with 2 arguments output and name set to filepath. call the function t.render with an argument context, return the result. if TemplateSyntaxError, renamed to e, exception is caught, if settings.DEBUG is true, return an string "[Included template had syntax error: %s]", where '%s' is replaced with e. if not, return an empty string, return output. derive the class LoadNode from Node base class. define the method render with 2 arguments: self and context. return an empty string, derive the class NowNode from Node base class. define the method __init__ with 2 arguments: self and format_string. substitute format_string for self.format_string. define the method render with 2 arguments: self and context. if settings.USE_TZ is true substitute result of the function timezone.get_current_timezone for tzinfo, if not tzinfo is None. call the function date with 2 arguments: result of the call to the function datetime.now with an argument tz set to tzinfo, and self.format_string, return the result. derive the class SpacelessNode from Node base class. define the method __init__ with 2 arguments: self and nodelist. substitute nodelist for self.nodelist. define the method render with 2 arguments: self and context. from django.utils.html import strip_spaces_between_tags. call the method self.nodelist.render with an argument context, strip the result of the surrounding whitespaces, use the result as an argument for the call to the function strip_spaces_between_tags, return the result. derive the class TemplateTagNode from Node base class. mapping is an dictionary with 8 initial entries: BLOCK_TAG_START for 'openblock', BLOCK_TAG_END for 'closeblock', VARIABLE_TAG_START for 'openvariable', VARIABLE_TAG_END for 'closevariable', SINGLE_BRACE_START for 'openbrace', SINGLE_BRACE_END 'closebrace', COMMENT_TAG_START 'opencomment' and COMMENT_TAG_END for 'closecomment'. define the method __init__ with 2 arguments: self and tagtype. substitute tagtype for self.tagtype. define the method render with 2 arguments: self and context. call the method self.mapping.get with 2 arguments: self.tagtype and an empty list, return the result. derive the class URLNode from Node base class. define the method __init__ with 5 arguments: self, view_name, args, kwargs and asvar. substitute view_name for self.view_name. substitute args for self.args. substitute kwargs for self.kwargs. substitute asvar for self.asvar. define the method render with 2 arguments: self and context. from django.core.urlresolvers import reverse, NoReverseMatch. for every arg in self.args call the method arg.resolve with an argument context, substitute the results in a list for args. kwargs is an dictionary, populated for every k and v in result of the method self.kwargs.items with: result of the call to the method v.resolve with an argument context, for result of the function smart_text called with 2 arguments k and string 'ascii'. call the method self.view_name.resolve with an argument context, substitute the result for view_name. url is an empty string. try, call the function reverse with 4 arguments: view_name, args as args, kwargs as kwargs and current_app as context.current_app, substitute the result for url. if NoReverseMatch exception is caught, call the function sys.exc_info with an argument exc_info. if settings.SETTINGS_MODULE is true, split settings.SETTINGS_MODULE by '.' character, substitute the first element of the result for project_name. try, call the function reverse with 4 arguments: concatenated project_name, character '.' and view_name, args as args, kwargs as kwargs, current_app as context.current_app, substitute the result for url. if NoReverseMatch exception is caught, if self.asvar is None, call the function six.reraise with unpacked list exc_info as an argument. if not, if self.asvar is None, raise an exception. if self.asvar is true, substitute url for value under the self.asvar key of context dictionary. return an empty string. if not, return url. derive the class VerbatimNode from Node base class. define the method __init__ with 2 arguments: self and content. substitute content for self.content. define the method render with 2 arguments: self and context. return self.content derive the class WidthRatioNode from Node base class. define the method __init__ with 5 arguments: self, val_expr, max_expr, max_width and asvar set to None. substitute val_expr for self.val_expr. substitute max_expr for self.max_expr. substitute max_width for self.max_width. substitute asvar for self.asvar. define the method render with 2 arguments: self and context. try, call the method self.val_expr.resolve with an argument context, substitute the result for value. call the method self.max_expr.resolve with an argument context, substitute the result for max_value. call the method self.max_width.resolve with an argument context, convert the result to an integer and substitute it for max_width. if VariableDoesNotExist exception is caught, return an empty string. if ValueError or TypeError exceptions are caught, raise an TemplateSyntaxError exception with an argument string "widthratio final argument must be a number". try, convert value into an floating point number, substitute it for value. convert max_value into an floating point number, substitute it for max_value. divide value by max_value, multiply the result with max_width, substitute it for ratio. round up radio, convert it to an integer and the convert it to a string and substitute the result for result. if ZeroDivisionError exception is caught, return an string '0'. if ValueError, TypeError or OverflowError exceptions are caught, return an empty string, if self.asvar is true, substitute result for value under the self.asvar key of context dictionary. return an empty string, if not, return result. derive the class WithNode from Node base class. define the method __init__ with 5 arguments: self, var, name, nodelist and extra_context set to None. substitute nodelist for self.nodelist. if extra_context is true, substitute it for self.extra_context, if not self.extra_context is an empty dictionary. if name is true, substitute var for value under the name key of the self.extra_context dictionary. define the method __repr__ with an argument self. return a string "" define the method render with 2 arguments: self and context. values is an dictionary created with result of the method val.resolve called with an argument context, for key, for every key and val in return value of the function six.iteritems called with an arguments self.extra_context. call the method context.push with an argument unpacked dictionary values, with the result as an argument, call the method self.nodelist.render with an argument context, return the result. register.tag decorator, define the function autoescape with 2 arguments: parser and token. call the method token.contents.split, substitute the result for args. if length of args is not equal to integer 2, raise an TemplateSyntaxError with an argument string "'autoescape' tag requires exactly one argument.". substitute first element of args for arg. if arg is not string 'on' or 'off', raise an TemplateSyntaxError exception with an argument string "'autoescape' argument should be 'on' or 'off'". call the method parser.parse with an argument tuple with an element string 'endautoescape', substitute the result for nodelist. call the method parser.delete_first_token. return an instance of AutoEscapeControlNode with 2 arguments: boolean exception arg equals to string 'on', and nodelist. register.tag decorator, define the function comment with 2 arguments: parser and token. call the method parser.skip_past with an argument string 'endcomment'. return an instance of CommentNode class. register.tag decorator, define the function cycle with 2 arguments: parser and token. call the method token.split_contents, substitute the result for args. if length of args is smaller than integer 2, raise an TemplateSyntaxError exception with an argument string "'cycle' tag requires at least two arguments". if ',' is contained in second element of args, split first element of args by ',', convert separated elements to strings, substitute the first 2 elements of the result, for second and third element of args, respectively. if length of args equals integer 2, substitute second element of args for name. if parser doesnt have an '_namedCycleNodes' attribute, raise an TemplateSyntaxError exception with an argument string "No named cycles in template. '%s' is not defined", where '%s' is replaced with name. if name is not contained in parser._namedCycleNodes, raise an TemplateSyntaxError exception with an argument string "Named cycle '%s' does not exist", where '%s' is replaced with name. get the index name, of the parser._namedCycleNodes, return the result. as_form is boolean False. if length of args is greater than 4. if third element from the end of the args equals string 'as', if last element of args is not equal to a string "silent", raise an TemplateSyntaxError exception with an argument string "Only 'silent' flag is allowed after cycle's name, not '%s'.", where '%s' is replaced with last element of args. as_form is boolean True silent is boolean True. substitute args, without the last element for args. if second from the end element of args equals a string 'as', as_form is boolean True. silent is boolean False. if as_form is true, substitute the last element of args for name. call the function parser.compile_filter with an argument arg for every arg in args from the index 1 to the index -2, append the results into a list, substitute it for value. node is an instance CycleNode class, created with values,name and silent set to silent. if parser doesnt have an '_namedCycleNodes' attribute, parser._namedCycleNodes is an empty dictionary. substituet node for value under the name key of the parser._namedCycleNodes dictionary. if not, call the function parser.compile_filter with an argument arg for every arg in args from first element to the end, append the results into a list, substitute it for value. node is an instance of CycleNode class, created wiht an argument values. return node. register.tag decorator, define the function csrf_token with 2 arguments: parser and token. return an instance of CsrfTokenNode class. register.tag decorator, define the function debug with 2 arguments: parser and token. return an instance of DebugNode class. register.tag decorator function with an argument 'filter', define the function do_filter with 2 arguments: parser and token. split into two parts token.contents by None, substitute the parts for _ and rest, respectively. call the method parser.compile_filter with an argument string "var|%s", where '%s' is replaced with rest, substitute the result for filter_expr. for every func and unused in filter_expr.filters, get '_filter_name' attribute of the func object, if it exists, substitute it for filter_name, if not, filter_name is None. if every filter_name in strings 'escape' or 'safe', raise an TemplateSyntaxError exception with an argument string '"filter %s" is not permitted. Use the "autoescape" tag instead.', where '%s' is replaced with filter_name. call the method parser.parse with an argument tuple with an element string 'endfilter', substitute the result for nodelist. call the method parser.delete_first_token. return a class instance FilterNode, called with an arguments filter_expr and nodelist. register.tag decorator, define the function firstof with 2 arguments: parser and token. call the method token.split_contents, substitute the result without the first element for bits. if length of bits is smaller than integer 1, raise an TemplateSyntaxError exception with an argument string "'firstof' statement requires at least one argument". return an instance of FirstOfNode class, created with an argument, result of the method parser.compile_filter called with bit, for every bit in bits. register.tag decorator function with an argument 'for', define the function do_for with 2 arguments: parser and token. call the method token.split_contents, substitute the result. if length bits is smaller than intger 4, raise an TemplateSyntaxError exception with an argument string "'for' statements should have at least four words: %s", where '%s' is replaced with token.contents. assign the string 'reversed' to is_reversed and bits last elements. if index is negative inter 3, if is_reversed, substitute it for in_index, if not, in_index is negative integer 2. if in_index-th element of bits equals to string 'in', raise an TemplateSyntaxError exception with an argument string "'for' statements should use the format 'for x in y': %s", where '%s' is replaced with token.contents. call the method re.split with 2 arguments: raw string ' *, *' and elements of bits from 1 index to in_index index, joined into a string, separated by whitespaces, substitute the result for loopvars. for every var in loopvars, if var is false or whitespaces are contained in var, raise an TemplateSyntaxError exception with an argument string "'for' tag received an invalid argument: %s", where '%s' is replaced with token.contents. call the method parser.compile_filter with an argument, in_index incremented by one, and used to index parser.compile_filter, substitute the result for sequence. call the method parser.parse with an argument tuple with 2 elements strings 'empty' and 'endfor', substitute the result for nodelist_loop. call the method parser.next_token, substitute the result for token. if token.contents equals string 'empty', call the method parser.parse with an argument tuple with an element string 'endfor', substitute the result for nodelist_empty. call the method parser.delete_first_token. if not, nodelist_empty is None. return an instance of ForNode class, created with 5 arguments: loopvars, sequence, is_reversed, nodelist_loop and nodelist_empty. define the function do_ifequal with 2 arguments: parser, token and negate. call the method token.split_contents, convert the result into a list and substitute it for bits. if length of bits is not equal to integer 3, raise an TemplateSyntaxError exception with an argument string "%r takes two arguments", where '%r' is replaced with first element of bits. append first element of bits to 'end'. substitute the result for end_tag. call the method parser.parse with an argument tuple with an element string 'else' and end_tag, substitute the result for nodelist_true. call the method parser.next_token, substitute the result for token. if token.contents equals a string 'else', call the method parser.parse with an argument tuple with an element end_tag, substitute the result for nodelist_false. call the method parser.delete_first_token. if not, nodelist_false is an instance of NodeList class. call the method parser.compile_filter with an argument, second element of bits, substitute the result for val1. call the method parser.compile_filter with an argument, third element of bits, substitute the result for val2. return an instance of IfEqualNode class, created with 5 arguments: val1, val2, nodelist_true, nodelist_false and negate. register.tag decorator, define the function ifequal with 2 arguments: parser and token. call the function do_ifequal with 3 arguments: parser, token and boolean False, return the result. register.tag decorator, define the function ifnotequal with 2 arguments: parser and token. call the function do_ifequal with 3 arguments: parser, token and boolean False, return the result. derive the class TemplateLiteral from Literal base class. define the method __init__ with 3 arguments: self, value and text. substitute value for self.value. substitute text for self.text. define the method display with an argument self. return self.text. define the method eval with 2 arguments: self and context. call the method self.value.resolve with 2 arguments context and ignore_failures set to boolean True, return the result. derive the class TemplateIfParser from IfParser base class. substitute TemplateSyntaxError for error_class. define the method __init__ with 4 arguments: self, parser, unpacked list args and unpacked dictionary kwargs. substitute parser for self.template_parser. call the method __init__ from the base class of the class TemplateIfParser, with 2 arguments: unpacked list args and unpacked dictionary. define the method create_var with 2 arguments: self and value. return an instance of TemplateLiteral with 2 arguments: result of the function self.template_parser.compile_filter, called with an argument value and value. register.tag decorator function with an argument 'if', define the function do_if with 2 arguments: parser and token. call the method token.split_contents, substitute results without the first element for bits. call the method parse from the instance of TemplateIfParser class, created with 2 arguments parser and bits, substitute the result for condition. call the method parser.parse with an argument tuple with 3 elements: strings 'elif', 'else' and 'endif', substitute the result for nodelist. conditions_nodelists is a list containing tuple with 2 elements condition and nodelist. call the method parser.next_token, substitute the result for token. while token.contents starts with a string 'elif', call the method token.split_contents, substitute results without the first element for bits. call the method parse from the instance of TemplateIfParser class, created with 2 arguments parser and bits, substitute the result for condition. call the method parser.parse with an argument tuple with 3 elements strings 'elif', 'else' and 'endif', substitute the result for nodelist. append a tuple with 2 elements: condition and nodelist to conditions_nodelists. call the method parser.next_token, substitute the result for token. if token.contents equals string 'else', call the method parser.parse with an argument tuple with an element string 'endif', substitute the result for nodelist. append a tuple with 2 elements: None and nodelist to conditions_nodelists. call the method parser.next_token, substitute the result for token. if token.contents doesn not equals a string 'endif', raise an AssertionError exception, return an instance of IfNode class, created with an argument conditions_nodelists. register.tag decorator, define the function ifchanged with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. call the method parser.parse with an argument tuple with 2 elements strings: 'else' and 'endfilter', substitute the result for nodelistelse. call the method parser.next_token, substitute the result for token. if token.contents equals string 'else', call the method parser.parse with an argument tuple with an element string 'endifchanged', substitute the result for nodelist_false. call the method parser.delete_first_token. if not, nodelist_false is an instance of NodeList. for every bit in elements of bits without the first element, call the method parser.compile_filter, with an argument bit, substitute the list of results for values. return an instance of a class IfChangedNode, created with 3 arguments: nodelist_true, nodelist_false and unpacked list values. register.tag decorator, define the function ssi with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. parsed is boolean False. if length of bits is not integer 2 or 3, raise an TemplateSyntaxError exception with an argument string "'ssi' tag takes one argument: the path to the file to be included". if length of bits equals integer 3, if third element of bits equals a string 'parsed', parsed is boolean True. if not, raise an TemplateSyntaxError exception with an argument string "Second (optional) argument to %s tag must be 'parsed'", where '%s' is replaced with first element of bits. call the method parser.compile_filter with second element of bits as an argument, substitute the result for filepath. return an instance of a SsiNode class, created with 2 arguments: filepath and parsed. register.tag decorator, define the function load with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is greater or equal to integer 4 and second last element of bits equals sting 'from', try, substitute last element of bits for taglib. call the function get_library with an argument taglib, substitute the result for lib. if InvalidTemplateLibrary, renamed to e, exception is caught, raise an TemplateSyntaxError exception with an argument string "'%s' is not a valid tag library: %s", where '%s' is replaced with taglib and e. if not, temp_lib is an instance of Library class. for every name in bits from the start index 1 to the end index negative 2, if name is contained in lib.tags, substitute value under the name key of the lib.tags dictionary for value under the name key of the temp_lib.tags dictionary. if name is contained in lib.filters. substitute value under the name key of the lib.filters dictionary for value under the name key of the temp_lib.filters dictionary. otherwise if name is contained in lib.filters, substitute value under the name key of the lib.filters dictionary for value under the name key of the temp_lib.filters dictionary. if not, raise an TemplateSyntaxError exception with an argument string "'%s' is not a valid tag or filter in tag library '%s'", where '%s' is replaced with name and taglib. call the method parser.add_library with an argument temp_lib. if not, for every taglib in bits without the first element, try, call the function get_library with an argument taglib, substitute the result for lib. call the method parser.add_library with an argument lib. if InvalidTemplateLibrary, renamed to e, exception is caught, raise an TemplateSyntaxError exception with an argument string "'%s' is not a valid tag library: %s", where '%s' is replaced with taglib and e. return an instance of a LoadNode class. register.tag decorator, define the function now with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is not equal to integer 2, raise an TemplateSyntaxError exception with an argument string "'now' statement takes one argument". substitute second element of bits without the first and last element for format_string. return an instance of a NowNode class, created with an argument format_string. register.tag decorator, define the function regroup with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is not equal to integer 6, raise an TemplateSyntaxError exception with an argument string "'regroup' tag takes five arguments". call the method parser.compile_filter with an argument first element of bits, substitute the result for target. if third element of bits is not equal to a string 'by', raise an TemplateSyntaxError exception with an argument string "second argument to 'regroup' tag must be 'by'". if fift element of bits is not equal to a string 'as', raise an TemplateSyntaxError exception with an argument string "next-to-last argument to 'regroup' tag must be 'as'". substitute sixth element of bits for var_name. concatenate var_name, VARIABLE_ATTRIBUTE_SEPARATOR and fourth element of bits, use the result as an argument for the call the method, parser.compile_filter, substitute the result for expression. return an instance of a RegroupNode class, created with 3 arguments target, expression and var_name. register.tag decorator, define the function spaceless with 2 arguments: parser and token. call the method parser.parse with an argument tuple with an element string 'endspaceless', substitute the result for nodelist. call the method parser.delete_first_token. return an instance of a SpacelessNode class, created with an argument nodelist. register.tag decorator, define the function templatetag with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is not equal to integer 2, raise an TemplateSyntaxError exception with an argument string "'templatetag' statement takes one argument". substitute second element of bits for tag. if tag is not contained in TemplateTagNode.mapping, raise an TemplateSyntaxError exception with an argument string "Invalid templatetag argument: '%s'. Must be one of: %s", where '%s' is replaced with tag and TemplateTagNode.mapping converted into a list. return an instance of a TemplateTagNode class, created with an argument tag. register.tag decorator, define the function url with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is lesser than integer 2, raise an TemplateSyntaxError exception with an argument string "'%s' takes at least one argument (path to a view)", where '%s' is replaced with first element of bits. call the method parser.compile_filter with second element of bits as an argument, substitute the result for viewname. args is an empty list. kwargs is an empty dictionary. asvar is None. remove first two elements from bits. if length of bits is greater or equal to intger 2 and second last element of bits is equal to string 'as', substitute last element of bits for asvar. remove last 2 elements from bits. if length of bits is not zero, for every bit in bits, call the method kwarg_re.match with an argument bit, substitute it for match. if match is true, raise an TemplateSyntaxError exception with an argument string "Malformed arguments to url tag". call the method match.groups, assign the result to name and value, respectively. if name is true, call the method parser.compile_filter with an argument value, substitute the result for value under the name key of kwargs dictionary. if not, call the method parser.compile_filter with an argument value, append the result to args. return an instance of a URLNode class, created with 4 arguments viewname, args, kwargs and asvar. register.tag decorator, define the function verbatim with 2 arguments: parser and token. call the method parser.parse with an argument tuple with an element string 'endverbatim', substitute the result for nodelist. call the method parser.delete_first_token. call the method nodelist.render with an argument, an instance of Context class, use the result as an argument for the creation of, an instance of VerbatimNode class, return it. register.tag decorator, define the function widthratio with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. if length of bits equals integer 4, assign the bits elements to tag, this_value_expr, max_value_expr and max_width, respectively. asvar is None. otherwise if length of bits equals integer 6, assign the bits elements to tag, this_value_expr, max_value_expr, max_width, as_ and asvar. if as_ is not equal to string 'as', raise an TemplateSyntaxError exception with an argument string "Invalid syntax in widthratio tag. Expecting 'as' keyword". if not, raise an TemplateSyntaxError exception with an argument string "widthratio takes at least three arguments". return an instance of a class WidthRatioNode, created with 4 arguments: result of the method parser.compile_filter, called with an argument this_value_expr, result of the method parser.compile_filter called with an argument max_value_expr, return value of the method parser.compile_filter called with an argument max_width and asvar as asvar. register.tag decorator function with an argument 'with', define the function do_with with 2 arguments: parser and token. call the method token.split_contents, substitute the result for bits. substitute bits without the first element for remaining_bits. call the function token_kwargs with 3 arguments: remaining_bits, parser and support_legacy set to boolean True, substitute the result for extra_context. if extra_context is false, raise an TemplateSyntaxError exception with an argument string "%r expected at least one variable assignment", where '%r' is replaced with first element of bits. if remaining_bits is true, raise an TemplateSyntaxError exception with an argument string "%r received an invalid token: %r", where '%r' is replaced with, first element of bits and first element of remaining_bits. call the method parser.parse with an argument tuple, with an element string 'endwith', substitute the result for nodelist. call the method parser.delete_first_token. return an instance of a class WithNode, created with 4 arguments: None, None, nodelist and extra_context as extra_context. from django.core.exceptions import ImproperlyConfigured into default name space. from django.template.base import Origin, Template, Context and TemplateDoesNotExist into default name space. from django.conf import settings into default name space. from django.utils.module_loading import import_string into default name space. from django.utils import six into default name space. template_source_loaders is None. derive the class BaseLoader from the object base class. is_usable is boolean False. define the method __init__ with 3 arguments: self, unpacked list args and unpacked dictionary kwargs. do nothing. define the method __call__ with 3 arguments: self, template_name and template_dirs set to None. call the method self.load_template with 2 arguments: template_name and template_dirs, return the result. define the method load_template with 3 arguments: self, template_name and template_dirs set to None. call the method self.load_template_source with arguments template_name and template_dirs, assign the result to source and display_name. call the function make_origin with 4 arguments: display_name, self.load_template_source, template_name and template_dirs, substitute the result for origin. try, call the function get_template_from_string with 3 arguments: source, origin and template_name, substitute the result for template. return template and None. if TemplateDoesNotExist exception is caught, return source and display_name. define the method load_template_source with 3 arguments: self, template_name and template_dirs set to None. raise an NotImplementedError with an argument string 'subclasses of BaseLoader must provide a load_template_source() method'. define the method reset with an argument self. do nothing. derive the class LoaderOrigin from the Origin base class. define the method __init__ with 5 arguments: self, display_name, loader, name and dirs. call the method __init__ with an argument display_name, from the base class of the LoaderOrigin class. substitute loader, name and dirs for self.loader, self.loadname and self.dirs, respectively. define the method reload with an argument self. call the method self.loader with 2 arguments: self.loadname and self.dirs, return the first element of the result. define the function make_origin with 4 arguments: display_name, loader, name and dirs. if settings.TEMPLATE_DEBUG and display_name are both true, return an instance of LoaderOrigin class, created with 4 arguments: display_name, loader, name and dirs. if not, return None. define the function find_template_loader with an argument loader. if loader is an instance of tuple or list, substitute first element of loader for loader and loader without the first element for args. if not, args is an empty list. if loader is an instance of six.string_types, call the function import_string with an argument loader, substitute the result for TemplateLoader. if TemplateLoader has an attribute 'load_template_source', func is an instance of TemplateLoader class, created with unpacked list args. if not, if args is true, raise an ImproperlyConfigured exception with an argument string "Error importing template source loader %s - can't pass arguments to function-based loader.", where '%s' is replaced with loader. substitute TemplateLoader for func. func.is_usable in false, import module warnings. call the function warnings.warn with an argument string "Your TEMPLATE_LOADERS setting includes %r, but your Python installation doesn't support that type of template loading. Consider removing that line from TEMPLATE_LOADERS.", where '%r' is replaced with loader. return None. if not, return func. if not, raise an ImproperlyConfigured with an argument string 'Loader does not define a "load_template" callable template source loader'. define the function find_template with 2: template_name and dirs set to None. use global variable template_source_loaders. if template_source_loaders is None, loaders is an empty list. for every loader_name in settings.TEMPLATE_LOADERS, call the function find_template_loader with an argument loader_name, substitute the result for loader. if loader is not None, append loader to loaders. put loaders elements in a tuple, substitute it for template_source_loaders. for every loader in template_source_loaders, try, call the function loader with 2 arguments name and dirs, substitute the result for source and display_name, respectively. call the function make_origin with 4 arguments: display_name, loader, name and dirs, return a tuple containing 2 elements: source and previous result. if TemplateDoesNotExist exception is caught, do nothing, raise an TemplateDoesNotExist exception with an argument name. define the function get_template with 2: template_name and dirs set to None. call the function find_template with 2 arguments: template_name and dirs, substitute the result for template and origin. if template has an attribute 'render', call the function get_template_from_string with 3 arguments: template, origin and template_name, substitute the result for template. return template. define the function get_template_from_string with 3: source, origin set to None and name set to None. return an instance of Template class, created with 2 arguments: source, origin and name, return the result. define the function render_to_string with 4 arguments: template_name, dictionary set to None, context_instance set to None and dirs set to None. if template_name is an instance of list or tuple types, call the function select_template with 2 arguments: template_name, dirs, substitute the result for t. if not, call the function get_template with 2 arguments: template_name and dirs, substitute the result for t. if context_instance is false, call the method t.render with an argument, instance of Context class, created with an argument dictionary, return the result. if dictionary is false, call the function t.render with an argument context_instance, return the result. call the method context_instance.push with an argument dictionary, with the result perform, call the function t.render with an argument context_instance, return the result. define the function select_template with 2 arguments: template_name_list and dirs set to None. if template_name_list is false, raise an TemplateDoesNotExist exception with an argument string "No template names provided". not_found is an empty list. for every template_name in template_name_list, try, call the function get_template with 2 arguments template_name and dirs, return the result. if TemplateDoesNotExist, renamed to e, exception is caught, if first element of e.args is not contained in not_found, append first element of e.args to not_found list. skip this loop iteration. raise an TemplateDoesNotExist exception with an argument, elements of not_found joined into a string, separated with ', ' from collections import defaultdict into default name space. from django.conf import settings into default name space. from django.template.base import TemplateSyntaxError, Library, Node, TextNode, token_kwargs and Variable into default namespace. from django.template.loader import get_template into default name space. from django.utils.safestring import mark_safe into default name space. from django.utils import six into default name space. register is an instance of Library class. BLOCK_CONTEXT_KEY is a strign 'block_context'. derive the class ExtendsError from the Exception base class. do nothing. derive the class BlockContext from the Exception base class. define the method __init__ with an argument self. convert elements of defaultdict to list, substitute it for self.blocks. define the method self and blocks. call the function six.iteritems with an argument blocks, for every name and block in result, get the value under the name key of self.blocks dictionary, insert to it block at the beginning. define the method self and name. try, remove the first element of value under the name key of self.blocks dictionary, return it. if IndexError exception is caught, return None. define the method push with 3 arguments: self, name and block. append block to the value under the name key of self.blocks dictionary. define the method get_block with 2 arguments self and name. try, get value under the self.blocks dictionary under the name key, return the last element. if IndexError exception is caught, return None. derive the class BlockNode from the Node base class. define the method __init__ with 4 arguments: self, name, nodelist, parent set to None. substitute name, nodelist and parent for self.name, self.nodelist and self.parent. define the method __repr__ with an argument self. return string "", where '%s' is replaced with self.name and '%r' with self.nodelist. define the method render with 2 arguments self and context. get value under the BLOCK_CONTEXT_KEY key of context.render_context dictionary, substitute it for block_context. call the context.push method, with the result, perform, if block_context is None, substitute self for value under the 'block' key of context dictionary. call the method self.nodelist.render with an argument context, substitute the result for result. if not, call the method block_context.pop with an argument self.name, assign the result to push and block. if block is None, substitute self for block. convert self to a tuple, call the result with 2 arguments: block.name and block.nodelist, substitute the result for block. substitute context for block.context. substitute block for value under the 'block' key of context dictionary. call the method block.nodelist.render with an argument context, substitute the result for result. if push is not None, call the method block_context.push with 2 arguments: self.name and push. return result. define the method super with an argument self. substitute self.context.render_context for render_context. if BLOCK_CONTEXT_KEY is contained in render_context and call to the method get_block with an argument self.name from the object, under the BLOCK_CONTEXT_KEY key of render_context dictionary dictionary evaluates to be not equal to None, call the method self.render with an argument self.context, use it as an argument for the call to the mark_safe function, return the result. return an empty string. derive the class ExtendsNode from the Node base class. must_be_first is boolean True. define the method __init__ with 4 arguments: self, nodelist, parent_name and template_dirs set to None. substitute nodelist for self.nodelist. substitute parent_name for self.parent_name. substitute template_dirs for self.template_dirs. self.blocks is a dictionary with elements: n for n.name, for every n in return value of the method nodelist.get_nodes_by_type, called with an argument BlockNode. define the method __repr__ with an argument self. return an string '', where '%s' is replaced with self.parent_name.token. define the method get_parent with 2 arguments self and context. call the method self.parent_name.resolve with an argument context. if parent is false, error_msg is a string "Invalid template name in 'extends' tag: %r.", where '%s' is replaced with parent. if self.parent_name.filters is true or self.parent_name.var is an instance of Variable. append string " Got this from the '%s' variable." to error_msg, where '%s is replaced with self.parent_name.token. raise an TemplateSyntaxError exception with an argument error_msg. if parent has an attribute 'render', return parent. call the function get_template with an argument parent, return the result. define the method render with 2 arguments self and context. call the method self.get_parent with an argument context, substitute the result for compiled_parent. if BLOCK_CONTEXT_KEY is not contained in context.render_context, value under the BLOCK_CONTEXT_KEY key of context.render_context dictionary is BlockContext class instance. get the value under the BLOCK_CONTEXT_KEY key of the context.render_context dictionary, substitute it for block_context. call the method block_context.add_blocks with an argument self.block. for every node in compiled_parent.nodelist, if node is not an instance of TextNode, if node is not an instance of ExtendsNode, blocks is a dictionary with elements: n for n.name, for every n in return value of the method, compiled_parent.nodelist.get_nodes_by_type, called with an argument BlockNode. call the method block_context.add_blocks with an argument blocks. break from the loop execution. call the method compiled_parent._render with an argument context, return the result. derive the class IncludeNode from the Node base class. define the method __init__ with 4 arguments: self, template, unpacked list args and unpacked dictionary kwargs. substitute template for self.template. remove kwargs dictionary entry under the 'extra_context' key, if it exists substitute it for self.extra_context, if not self.extra_context is an empty dictionary. remove kwargs dictionary entry under the 'isolated_context' key, if it exists substitute it for self.isolated_context, if not self.isolated_context is boolean False. call the method __init__ from the base class of the class IncludeNode, called with 2 arguments: unpacked dictionary args, and unpacked dictionary kwargs. define the method render with 2 arguments self and context. try, call the method self.template.resolve with an argument context, substitute the result for template. get 'render' attribute of template object, if it is callable, call the method get_template with an argument template, substitute the result for template. values is an dictionary with entries: return value of the method var.resolve with an argument context for name, for every name and var in return value of the function six.iteritems called with an argument self.extra_context. if self.isolated_context is true, call the method context.new with an argument values, use it as an argument for the call to the method template.render, return the result. call the method context.push with unpacked dictionary values as an argument, with the result perform, call the method template.render with an argument context, return the result. if Exception exception is caught, if settings.TEMPLATE_DEBUG is true, raise an exception, return an empty string. decorator method register.tag with an argument 'block', define the function do_block with 2 arguments parser and token. call the method token.contents.split, substitute the result for bits. if length of bits is not equal to integer 2, raise an TemplateSyntaxError exception with an argument string "'%s' tag takes only one argument", where '%s' is replaced with first element of bits. substitute second element for bits for block_name. try, if block_name is contained in parser.__loaded_blocks, raise an TemplateSyntaxError exception with an argument string "'%s' tag with name '%s' appears more than once", substitute '%s' with first element of bits and block_name, respectively. append block_name to parser.__loaded_blocks. if AttributeError exception is caught, substitute list with an element block_name for parser.__loaded_blocks. call the method parser.parse with an argument tuple with one element string 'endblock', substitute the result for nodelist. call the method parser.next_token, substitute the result for endblock. acceptable_endblocks is a tuple with 2 elements: string 'endblock' and 'endblock %s', where '%s' replaced with block_name. if endblock.contents is not contained in acceptable_endblocks, call the method parser.invalid_block_tag with 3 arguments: endblock, 'endblock' and acceptable_endblocks. return an instance of a BlockNode class, created with 2 arguments: block_name and nodelist. decorator method register.tag with an argument 'extends', define the function do_extends with 2 arguments parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is not equalt to integer 2, raise an TemplateSyntaxError exception with an argument string "'%s' takes one argument", where '%s' is replaced with first element of bits. call the method parser.compile_filter with an argument second element for bits, substitute the result for parent_name. call the method parser.parse, substitute the result for nodelist. call the method nodelist.get_nodes_by_type with an argument ExtendsNode, if it evaluates to true, raise an TemplateSyntaxError exception with an argument string "'%s' cannot appear more than once in the same template", where '%s' is replaced with first element of bits. return an instance of ExtendsNode with 2 arguments nodelist and parent_name. decorator method register.tag with an argument 'include', define the function do_include with 2 arguments parser and token. call the method token.split_contents, substitute the result for bits. if length of bits is lesser than integer 2, raise an TemplateSyntaxError with an argument string "%r tag takes at least one argument: the name of the template to be included.", where '%r' is replaced with first element of bits. options is an empty dictionary. substitute bits, without the first two elements, substitute the result for remaining_bits. while remaining_bits is true, remove first element from remaining_bits, substitute the result for option. if option is contained in options, raise an TemplateSyntaxError exception with an argument string 'The %r option was specified more than once.', where '%r' is replaced with options. if option equals a string 'with', call the function token_kwargs with 3 arguments: remaining_bits, parser, support_legacy set to boolean False, substitute the result for value. if value is true, raise an TemplateSyntaxError exception with an argument string '"with" in %r tag needs at least one keyword argument.', where '%s' is replaced with first element of bits. otherwise if options equals 'only', value is boolean True. if not, raise an TemplateSyntaxError with an argument string 'Unknown argument for %r tag: %r.', where '%r' is replaced with first element of bits and options. substitute value for value under the options key of options dictionary. get the value under the key 'only' of the options dictionary, if it exists substitute the result for isolated_context, if not, isolated_context is boolean False. get the value under the 'width' key of the options dictionary, if it exists, substitute it for namemap, if not namemap is an empty dictionary. return an instance of IncludeNode class, created with 3 arguments: return value of the method parser.compile_filter, import module os. import module sys. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.template.base import TemplateDoesNotExist into default name space. from django.template.loader import BaseLoader into default name space. from django.utils._os import safe_join into default name space. from django.utils import six into default name space. define the function calculate_app_template_dirs. if six.PY2 is true, call the function sys.getfilesystemencoding, if it evaluates to true, substitute the result for fs_encoding, if not, call the function sys.getdefaultencoding and substitute the result for fs_encoding. app_template_dirs is an empty list. call the function apps.get_app_configs, for every app_config in result, if app_config.path is true, skip this loop iteration. join app_config.path and string 'templates' into file path, substitute it for template_dir. if template_dir is directory, if six.PY2 is true, call the function template_dir.decode with an argument fs_encoding, substitute the result for template_dir. append template_dir to app_template_dirs. convert app_template_dirs to a tuple, return it. call the function calculate_app_template_dirs, substitute the result for app_template_dirs. derive the class Loader from the BaseLoader base class. is_usable is boolean True. define the method get_template_sources with 3 arguments: self, template_name, template_dirs set to None. if template_dirs is false, substitute app_template_dirs for template_dirs. for every template_dir in template_dirs, try, call the function safe_join with 2 arguments template_dir and template_name, yield the result. if UnicodeDecodeError exception is caught, raise an exception. if ValueError exception is caught, do nothing. define the method load_template_source with 3 arguments: self, template_name, template_dirs set to None. call the method self.get_template_sources with 2 arguments template_name and template_dirs, for every filepath in the result, try, open the file named filepath in read mode, with file descriptor renamed to fp perform, read file fp, call the method decode on the result with an argument settings.FILE_CHARSET, return tuple containing 2 elements, previous result and filepath. if IOError exception is caught, do nothing. raise an TemplateDoesNotExist exception with an argument template_name. import module hashlib. from django.template.base import TemplateDoesNotExist into default name space. from django.template.loader import BaseLoader, get_template_from_string, find_template_loader and make_origin into default name space. from django.utils.encoding import force_bytes into default name space. derive the class Loader from the BaseLoader base class. is_usable is boolean True. define the method __init__ with 2 arguments: self and loaders. self.template_cache is an empty dictionary. self.find_template_cache is an empty dictionary. substitute loaders for self._loaders. self._cached_loaders is an empty list. property decorator. define the method loaders with an argument self. if self._cached_loaders is false, cached_loaders is an empty list. for every loader in self._loaders, call the function find_template_loader with an argument loader, append the result to cached_loaders. substitute cached_loaders for self._cached_loaders. return self._cached_loaders. define the method cache_key with 3 arguments: self, template_name and template_dirs. if template_dirs is true, join template_dirs elements into a string, separated by '|', use it as an argument for the call to the function force_bytes, use the result as the argument for the call to the function hashlib.sha1, call the hexdigest method on the result, join template_name and previous final result into a string, separated with '-', return it. if not, return template_name. define the method find_template with 3 arguments: self, name, dirs set to None. call the method self.cache_key with 2 arguments name and dirs, substitute the result for key. try, get the value under the key key of the self.find_template_cache dictionary, substitute it for result. if KeyError exception is caught, result is None. for every loader in self.loaders, try, call the function loader with arguments name and dirs, assign the result to template and display_name, respectively. if TemplateDoesNotExist exception is caught, do nothing. if not, result is an tuple with 2 elements: template and return value of the function make_origin called with 4 arguments: display_name, loader, name and dirs. break from the loop execution. substitute result for self.find_template_cache dictionary value under the key key. if result is true, return result if not, substitute TemplateDoesNotExist for self.find_template_cache dictionary value under the key key. raise an TemplateDoesNotExist exception with an argument name. define the method load_template with 3 arguments: self, template_name, template_dirs set to None. get the value under the template_name key of the self.cache_key dictionary, if it exists, substitute it for key, if not, substitute template_dirs for key. get the value under the key key of the self.template_cache dictionary, substitute it for template_tuple. if template_tuple is contained in TemplateDoesNotExist, raise an TemplateDoesNotExist exception. otherwise if template_tuple is None, call the method self.find_template with 2 argumetns: template_name and template_dirs, assign the result to template, origin, respectively. if template doesnt have a 'render' attribute, try, call the function get_template_from_string with 3 arguments: template, origin and template_name, substitute the result for template. if TemplateDoesNotExist exception is caught, substitute a tuple with 2 elements: template and origin, for self.find_template_cache dictionary value under the key key. substitute a tuple with 2 elements: template and None, for self.find_template_cache dictionary value under the key key. return self.find_template_cache dictionary value under the key key. define the method reset with an argument self. call the method self.template_cache.clear. call the method self.find_template_cache.clear. from __future__ import unicode_literals into default name space. try, from pkg_resources import resource_string into default name space. if ImportError exception is caught, resource_string is None. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.template.base import TemplateDoesNotExist into default name space. from django.template.loader import BaseLoader into default name space. from django.utils import six into default name space. derive the class Loader from the BaseLoader base class. if resource_string is not None, is_usable is boolean True, otherwise is_usable is boolean False. define the method load_template_source with 3 arguments: self, template_name, template_dirs set to None. if resource_string is not None, concatenate string 'templates/' and template_name, substitute the result for pkg_name. call the method apps.get_app_configs, for app_config in the result, try, call the function resource_string with 2 arguments app_config.name and pkg_name, substitute the result for resource. if Exception exception is caught, skip this loop iteration. if six.PY2 is true, call the method resource.decode with an argument settings.FILE_CHARSET, substitute the result for resource. return a tuple with 2 elements: resource and string 'egg:%s:%s', where '%s' is replaced with app_config.name and pkg_name, respective. raise an TemplateDoesNotExist exception with an argument template_name. from django.conf import settings into default name space. from django.template.base import TemplateDoesNotExist into default name space. from django.template.loader import BaseLoader into default name space. from django.utils._os import safe_join into default name space. derive the class Loader from the BaseLoader base class. is_usable is boolean True. define the method get_template_source with 3 arguments: self, template_name, template_dirs set to None. if template_dirs is false, substitute settings.TEMPLATE_DIRS for template_dirs. for every template_dir in template_dirs, try, call the function safe_join with 2 arguments template_dir and template_name, yield the result. if UnicodeDecodeError exception is caught, raise an exception. if ValueError exception is caught, do nothing. define the method load_template_source with 3 arguments: self, template_name, template_dirs set to None. tried is an empty list. call the method self.get_template_sources with 2 arguments template_name and template_dirs, for every filepath in the result, try, open the file named filepath in read mode, with file descriptor renamed to fp perform, read file fp, call the method decode on the result with an argument settings.FILE_CHARSET, return tuple containing 2 elements, previous result and filepath. if IOError exception is caught, append filepath to tried. if tried is true, err_msg is a string "Tried %s", where '%s' is replaced with tried. if not, error_msg is a string "Your TEMPLATE_DIRS setting is empty. Change it to point to at least one template directory.". raise an TemplateDoesNotExist exception with an argument error_msg. load_template_source.is_usable is boolean True. from django.http import HttpResponse into default name space. from django.template import loader, Context and RequestContext into default name space. from django.utils import six into default name space. derive the class ContentNotRenderedError from the Exception base class. do nothing. derive the class SimpleTemplateResponse from the HttpResponse base class. rendering_attrs is a list containing 3 strings: 'template_name', 'context_data' and '_post_render_callbacks'. define the method __init__ with 5 arguments: self, template, context set to None, content_type set to None and status set to None. substitute template for self.template_name. substitute context for self.context_data. self._post_render_callbacks is an empty list. call the __init__ method from the base class of the class SimpleTemplateResponse, with 3 arguments: an empty string, content_type and status. self._is_rendered is boolean False. define the method __getstate__ with an argument self. call the __getstate__ method from the base class of the class SimpleTemplateResponse, substitute the result for obj_dict. if self._is_rendered is false, raise an ContentNotRenderedError exception with an argument string 'The response content must be rendered before it can be pickled.'. for every attr in self.rendering_attrs, if attr is contained in obj_dict, delete entry under the attr key of obj_dict dictionary. return obj_dict. define the method resolve_template with 2 arguments: self and template. if template is an instance of list or tuple types, call the method loader.select_template with an argument template, return the result. otherwise is template is six.string_types instance, call the method loader.get_template with an argument template, return the result. if not, return template. define the method resolve_context with 2 arguments: self and context. if context is an instance of Context, return context. if not, return an instance of Context class, created with an argument context. property decorator, define the method rendered_content with an argument self. call the method self.resolve_template with an argument self.template_name, substitute the result for template. call the method self.resolve_context with an argument self.context_data, substitute the result for context. call the method template.render with an argument context, substitute the result for content. return content. define the method add_post_render_callback with 2 arguments: self and callback. if self._is_rendered is true, call the functoin callback with an argument self. if not, append callback to self._post_render_callbacks list. define the method render with an argument self. substitute self for retval. if self._is_rendered is false, substitute self.rendered_content for self.content. for every post_callback in self._post_render_callbacks, call the function post_callback with an argument retval, substitute the result for newretval. if newretval is not None, substitute newretval for retval. return retval. property decorator, define the method is_rendered with an argument self. return self._is_rendered. define the method __iter__ with an argument self. if self._is_rendered is false, raise an ContentNotRenderedError exception with an string 'The response content must be rendered before it can be iterated over.'. call the method __init__ from the base class of the class SimpleTemplateResponse, return the result. property decorator, define the method content with an argument self. if self._is_rendered is false. raise an ContentNotRenderedError exception with an sring 'The response content must be rendered before it can be accessed.'. return the content field of the base class of the class SimpleTemplateResponse. content.setter decorator, define the method content with 2 arguments: self and value. call the method HttpResponse.content.fset with 2 arguments: self and value. self._is_rendered is boolean True. derive the class TemplateResponse from the SimpleTemplateResponse base class. append list with 2 strings: '_request' and '_current_app' to SimpleTemplateResponse.rendering_attrs, substitute the result for rendering_attrs. define the method __init__ with 7 arguments: self, request, template, context set to None, content_type set to None, status set to None and current_app set to None. substitute request for self._request. substitute current_app for self._current_app. call the __init__ method from the base class of the class TemplateResponse, with 4 arguments: template, context, content_type, status. define the method resolve_context with 2 arguments: self and context. if context is an instance of Context class. return context. return an instance of RequestContext class, created with 3 arguments: self._request, context and current_app set to self._current_app. derive the class TokenBase from the object base class. id is None. value is None. first and second are None. define the method nud with 2 arguments: self and parser. raise an exception parser.error_class with an argument string "Not expecting '%s' in this position in if tag.", where '%s' is replaced with self.id. define the method led with 3 arguments: self, left and parser. raise an exception parser.error_class with an argument string "Not expecting '%s' as infix operator in if tag.", where '%s' is replaced with self.id. define the method display with an argument self. return self.id. define the method __repr__ with an argument self. for x in a list containing 3 elements: self.id, self.first and self.second, if x is not None, convert x into a string and append it to a list, substitute the resulting list for out. join elements of out into a string, separated with whitespaces, append ')' to it, append the result to '(', return it. define the function infix with 2 arguments bp and func. derive the class Operator from the base class TokenBase. substitute bp for lbp. define the method led with 3 arguments self, left and parser. substitute left for self.first. call the method parser.expression with an argument bp, substitute it for self.seconds. return self. define the method eval with 2 arguments self and context. try, call the function func with 3 arguments: context, self.first and self.second, return the result. if Exception exception is caught, return boolean False. return Operator. define the function prefix with 2 arguments bp and func. derive the class Operator from the base class TokenBase. substitute bp for lbp. define the method nud with 2 arguments self and parser. call the method parser.expression with an argument bp, substitute the result for self.first. self.second is None. return self. define the method evalu with 2 arguments self and context. try, call the function func with 2 arguments: context and self.first, return the result. if Exception exception is caught, return boolean False. return Operator. OPERATORS is an dictionary with 12 initial entries: result of the function inflix called with 2 arguments, integer 6, and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) or y.eval(context) is True, for 'or', result of the function inflix called with 2 arguments, integer 7, and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) and y.eval(context) is True for 'and', result of the function prefix called with 2 arguments, integer 8, and lambda function with 2 arguments context and x, returns boolean True if x.eval(context) is True for 'not', result of the function inflix called with 2 arguments, integer 9, and lambda function with 2 arguments context and x, returns boolean True if x.eval(context) is contained in y.eval(context) for 'in', result of the function inflix called with 2 arguments, integer 9, and lambda function with 2 arguments context and x, returns boolean True if x.eval(context) is not contained in y.eval(context), for 'not in', result of the function inflix called with 2 arguments, integer 10, and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) equals y.eval(context) for '=', result of the function inflix called with 2 arguments, integer 10, and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) equals y.eval(context) for '==', result of the function inflix called with 2 arguments, integer 10, and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) doesnt equals y.eval(context) for '!=', result of the function inflix called with 2 arguments, integer 10 and, lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) is greater than y.eval(context) for '>', result of the function inflix called with 2 arguments, integer 10 and and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) is greater than or equal to y.eval(context) for '>=', result of the function inflix called with 2 arguments, integer 10 and and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) is smaller than y.eval(context) for '<', result of the function inflix called with 2 arguments, integer 10 and and lambda function with 3 arguments context, x and y, returns boolean True if x.eval(context) is smaller than or equal to y.eval(context) for '<=', call the function OPERATORS.items, for every key and op in result, substitute key for op.id. derive the class Literal from the TokenBase base class. id is a string "literal". lbp is integer 0. define the method __init__ with 2 arguments: self and value. substitute value for self.value. define the method display with an argument self. return printable representation of self.value. define the method nud with 2 arguments: self and parser. return self. define the method eval with 2 arguments: self and context. return self.value. define the method __repr__ with an argument self. return string "(%s %r)", replace '%s' with self.if and '%r' with self.value. derive the class EndToken from the TokenBase base class. lbp is an integer 0. define the method nud with 2 arguments: self and parser. raise an exception parser.error_class with an argument string "Unexpected end of expression in if tag.". EndToken is an instance of EndToken class. derive the class IfParser from the object base class. substitute ValueError for error_class. define the method __init__ with 2 arguments: self and tokens. substitute length of tokens for l. mapped_tokens is an empty list. i is integer 0. while i is smaller than l, substitute i-th element of tokens for token. if token equals a string "not" and i incremented by 1 is lesser than l, and element of tokens at i incremented by 1 index equals a string "in", token is a string "not in". increment i by integer 1. call the method self.translate_token with an argument token, append the result to mapped_tokens. increment i by integer 1. substitute mapped_tokens for self.tokens. self.pos is integer 0. call the method self.next_token, substitute the result for self.current_token. define the method translate_token with 2 arguments: self and token. try, substitute OPERATORS dictionary element under token key for op. if KeyError and TypeError exceptions are caught, call the function self.create_var with an argument token, return the result. if not, call the function op, return the result. define the method next_token with an argument self. if self.pos is greater than or equal to self.tokens, return EndToken. if not, substitute element at self.pos index of self.tokens for retval. increment self.pos by integer 1. return retval. define the method parse with an argument self. call the method self.expression, substitute the result for retval. if self.current_token is not EndToken, raise an exception self.error_class with an argument string ""Unused '%s' at end of if expression", where '%s' is replaced with result of the method self.current_token.display. return retval. define the method expression with 2 arguments: self and rbp set to integer 0. substitute self.current_token for t. call the method self.next_token, substitute the result for self.current_token. call the method t.nud with an argument self, substitute the result for left. while rbp is smaller than self.current_token.lbp, substitute self.current_token for t. call the method self.next_token, substitute the result for self.current_token. call the method t.led with 2 arguments left and self. return left. define the method create_var with 2 arguments: self and value. return an instance of Literal class, created with an argumen value. from __future__ import unicode_literals into default name space. from lib2to3 import fixer_base into default name space. from lib2to3.fixer_util import find_indentation, Name, syms and touch_import into default name space. from lib2to3.pgen2 import token into default name space. from lib2to3.pytree import Leaf and Node into default name space. derive the class FixUnicode from the base class fixer_base.BaseFix. BM_compatible is boolean True. PATTERN is a string "classdef< 'class' any+ ':'suite< any*funcdef< 'def' unifunc='__unicode__'parameters< '(' NAME ')' > any+ >any* > >". define the method transform with 3 arguments: self, node and results. substitute value under the "unifunc" key of the results dictionary for unifunc. strfunc is an instance of a class Name, created with 2 arguments: string "__str__" and prefix as unifunc.prefix. call the method unifunc.replace with an argument strfunc. call the method node.clone, substitute the result for klass. call the method find_indentation with an argument node, append the result to newline, substitute the result for klass.prefix. decorator is an instance of class Node, created with 2 arguments: instance of Leaf class created with 2 arguments: token.AT and "@', and instance of Name class created with an argument string 'python_2_unicode_compatible'. decorated is an instance of class Node, created with 3 arguments: syms.decorated, list with 2 arguments: decorator and klass, and prefix as node.prefix. call the method node.replace with an argument decorated. call the function touch_import with 3 arguments: string 'django.utils.encoding', string 'python_2_unicode_compatible' and decorated. import module os. import module sta. import module sys. import module tempfile. from os.path import join, normcase, normpath, abspath, isabs, sep and dirname into default name space. from django.utils.encoding import force_text into default name space. from django.utils import six into default name space. try, substitute WindowsError for WindowsError. if NameError exception is caught, derive class WindowsError from Exception base class. do nothing. if six.PY2 is true, call the function sys.getfilesystemencoding if it evaluates to true, substitute its result for fs_encoding, otherwise call the function sys.getdefaultencoding and substitute its result for fs_encoding. if six.PY3 is true or os.name equals a string 'nt', substitute abspath for abspathu. if not, define the function abspathu with an argument path. call the function isabs with an argument path, if it evaluates to false, get the unicode representation of current working directory, join it and path into a string, substitute the result for path. call the function normpath with an argument path, return the result. define the function upath with an argument path. if six.PY2 is true and path is not an instance of six.text_type type, call the method path.decode with an argument fs_encoding, return the result. return path. define the function npath with an argument path. if six.PY2 is true and path is not an instance of byes type, call the method path.encode with an argument fs_encoding, return the result. return path. define the function safe_join with 2 arguments base and unpacked dictionary paths. call the function force_text with an argument base, substitute the result for base. paths is a list containing results of the function force_text called with an argument p, for every p in paths. join base an unpacked list paths into a string, get the absolute path in unicode representation of the result, substitute the result for final_path. get the unicode representation of the absolute path of base, substitute it for base_path. if return value of the function normcase called with an argument final_path doesnt starts with result of the function normcase, called with sep appended to base_path as an argument and results of the function normcase called twice with final_path, and base_pah are not equal and directory name of the result of the function normcase called with an argument base_path, if not equal to the result of the function normcase called with an argument base_path. raise an ValueError with an argument string 'The joined path (%s) is located outside of the base path component (%s)', where '%s' is replaced with final_path and base_path. return final_path. define the function rmtree_errorhandler with 3 arguments func, path and exc_info. substitute fist and second element of exc_info for exctype and value, respectively. if exctype is not WindowsError or string 'Access is denied' is not contained in value converted into a string, raise an exception. call the function os.stat with an argument path, perform bitwise and on 2 operands st_mode field of the result and stat.S_IREAD, if it is not equal to stat.S_IREAD, raise an exception. change access mode of path to stat.S_IWRITE mode. call the function func with an argument path. define the method symlinks_supported. call the function tempfile.mkdtemp, substitute the result for tmpdir. join tmpdir and sting 'original' into a file path name, substitute it for original_path. join tmpdir and sting 'symlink' into a file path name, substitute it for symlink_path. make a directory named original_path. try, make a system symbolic link between original_path and symlink_path. supported is boolean True. if OSError, NotImplementedError or AttributeError exceptions are caught, supported is boolean False. if not, remove symlink_path file. finally perform, remove original_path directory. remove tmpdir directory. return supported. import module os. import module shutil. import module tarfile. import module zipfile. from django.utils import six into default name space. derive the class ArchiveException from the Exception base class. derive the class UnrecognizedArchiveFormat from the ArchiveException base class. define the function extract with 2 arguments path and to_path set to empty string. instantiate Archive class with an argument path, with it renamed to archive, perform, call the method archive.extract with an argument to_path. derive the class Archive from the object base class. define the method __init__ with 2 arguments self and file. call the method self._archive_cls with an argument file, call the result with an argument file, substitute the result for self._archive. static method, define the method _archive_cls with an argument file. cls is None. if file is an instance of six.string_types. substitute file for filename. if not, try, substitute file.name for filename. if AttributeError exception is caught. raise an UnrecognizedArchiveFormat exception with an argument string "File object not a recognized archive format.". convert filename to lowercase, use the result as an argument for the call to the function os.path.splitext, substitute the result for base and tail_ext. get the value under the tail_ext key of the extension_map dictionary, substitute it for cls. if cls is false, call the method os.path.splitext with an argument base, substitute the result for base and ext, respectively. get the value under the ext key of the extension_map dictionary, substitute it for cls. if cls is false, raise an UnrecognizedArchiveFormat exception with an argument string "Path not a recognized archive format: %s", where '%s' is replaced with filename. return cls. define the method __enter__ with an argument self. return self. define the method __exit__ with 4 arguments: self, exc_type, exc_value and traceback. call the method self.close. define the method extract with 2 arguments: self and to_path set to an empty string. call the method self._archive.extract with an argument to_path. define the method list with an argument self. call the method self._archive.list. define the method close with an argument self. call the method self._archive.close. derive the class BaseArchive from the object base class. define the method split_leading_dir with 2 arguments self and path. convert path to a string, substitute the result for path. strip path of all leading '/' and '\\' characters, substitute the result for path. if '/' is contained in path, and only if '\\' is contained in path and index of the first occurrence of '/' in path is lesser than, index of the first occurrence of '\\' in path, or alternatively if '\\' is not contained in path, split path in two parts by '/' character, return the result. otherwise if '\\' is contained in path, split path in two parts by '\\' string, return the result. if not, return path an an empty string. define the method has_leading_dir with 2 arguments self and paths. common_prefix is None. for every path in paths, call the method self.split_leading_dir with an argument path, assign the result to prefix and rest, respectively. if prefix is false, return boolean False. otherwise if common_prefix is None, substitute prefix for common_prefix. otherwise if prefix is not equal to common_prefix, return boolean False. return boolean True. define the method list with an argument self. raise an NotImplementedError exception with an argument string 'subclasses of BaseArchive must provide an extract() method'. define the method list with an argument self. raise an NotImplementedError exception with an argument string 'subclasses of BaseArchive must provide a list() method'. derive the class TarArchive from the BaseArchive base class. define the method __init__ with 2 arguments self and file. call the method tarfile.open with an argument file, substitute the result for self._archive. define the method __init__ with 3 arguments self and unpacked list args and unpacked dictionary kwargs. define the method list with 3 arguments: self and unpacked list args and unpacked dictionary kwargs. define the method extract with 2 arguments self and to_path. members is a list with elements member for every member in the result of the function self._archive.getmembers, only if member.name is not equal to string 'pax_global_header'. call the method self.has_leading_dir with an argument list, with elements x.name for every x in members, substitute the result for leading. for every member in members, substitute member.name for name. if leading is true, call the method self.split_leading_dir with an argument name, substitute the first element of result for name. join to_path and name into a valid system path, substitute the result for filename. if member is a directory, if filename is true and filename path doesnt exist, create directories from the elements in filename. if not, try, call the method self._archive.extractfile with an argument member, substitute the result for extracted. if KeyError or AttributeError, renamed to exc, exceptions are caught, print a string "In the tar file %s the member %s is invalid: %s", where '%s' is substituted with: name, member.name and exc, respectively. if not, get the directory name of filename, substitute it for dirname. if dirname is true and dirname directory doesnt exists, create directories from the elements in filename. open filename file in write mode, with the file descriptor renamed to outfile, perform, call the method shutil.copyfileobj with 2 arguments: extracted and outfile. finally, if extracted is true, call the method extracted.close. define the method close with an argument self. call the method self._archive.close. derive the class ZipArchive from the BaseArchive base class. define the method __init__ with 2 arguments self and file. call the method zipfile.ZipFile with an argument self, substitute the result for self._archive. define the method list with 3 arguments: self and unpacked list args and unpacked dictionary kwargs. call the method self._archive.printdir with 2 arguments: unpacked list args and unpacked dictionary kwargs. define the method extract with 2 arguments self and to_path. call the method self._archive.namelist, substitute the result for namelist. call the method self.has_leading_dir with an argument namelist, substitute the result for leading. for every name in namelist, call the method self._archive.read with an argument name, substitute the result for data. if leading is true, call the method self.split_leading_dir with an argument name, substitute the second element of the result for name. join to_path and name into a file path, substitute the result for filename. get the directory name of filename, substitute the result for dirname. if dirname is true and dirname path doesnt exists, create directories from the elements in filename. if filename ends with '/' or with '\\', if filename path doesnt exists, create directories from the elements in filename. if not, open filename file in write mode, with the file descriptor renamed to outfile, perform, write data bytes to outfile. define the method close with an argument self. call the method self._archive.close. extension_map is a dictioanry with 6 initial elntries: TarArchive for '.tar', TarArchive for '.tar.bz2', TarArchive for '.tar.gz', from __future__ import absolute_import into default name space. import module os. import module signal. import module sys. import module time. import module traceback. from django.apps import apps into default name space. from django.conf import settings into default name space. from django.core.signals import request_finished into default name space. try, from django.utils.six.moves import _thread as thread into default name space. if imoportError exception is caught, from django.utils.six.moves import _dummy_thread as thread into default name space. try, import threading module. if ImportError exception is caught, do nothing. try, import termios module. if ImportError exception is caught, termios is None. USE_INOTIFY is boolean False. try, import pyinotify module. call the method pyinotify.INotifyWrapper.create, on the return value call the inotify_init method, substitute the result for fd. if fd is greater or equal to integer 0. USE_INOTIFY is boolean True. close fd file descriptor. if ImportError exception is caught, do nothing. RUN_RELOADER is boolean True. FILE_MODIFIED is integer 1. I18N_MODIFIED is integer 2 _mtimes is an empty dictionary. _win is a tuple containing 1 initial boolean: True is sys.platform equals to string "win32", False otherwise. _error_files is an empty list. _cached_modules is an empty set. _cached_filenames is an empty list. define the function gen_filenames with an argument only_new defaulting to boolean False. declare that we use global variables cached_modules and _cached_filenames in this function. module_values is a set created from the elements of sys.modules.values method return value. if _cached_modules equals to module_values, if only_new is true, return an empty list. if not, return _cached_filenames. subtract _cached_modules from module_values, assign the result to new_modules. create the list of paths from which filename module was included for every filename in new_modules, only is filename has '__file__' attribute, substitute the resulting list for new_filenames. if _cached_filenames is empty and settings.USE_I18N is True, return the directory name two directories up from the __file__ path, join it with 'conf' and 'locale' into valid path, separated by '/', basedirs is a list containing 2 elements: previous result and string 'locale'. for app_config in reversed list of apps.get_app_configs() elements, join app_config.path and 'locale' into a valid directory path, separated by '/', append it to basedirs. extend basedirs list with settings.LOCALE_PATHS. replace all the elements of the basedir list by its corresponding absolute directory path, only is that directory exists. for every basedir in basedirs, for every dirpath, dirnames and locale_filenames in directory tree starting at the basedir directory. for every filenam in locale_filenames, if filename ends with string '.mo', join dirpath and filename into a path separated by '/', append it to new_filenames. if only_new is True, substitute new_filenames for filelist. if not, sum _cached_filenames, new_filenames and _error_files, store the result in filelist. filenames is an empty list. for every filename is filelist, if filename is empty, skip this loop iteration, if filename ends with string ".pyc" or it ends with ".pyo", truncate the last element of filename. if filename ends with string "$py.class", truncate last 9 elements of filename and append it string ".py". if file filename exists, append filename to filenames. add elements from new_modules set to _cached_modules set. append new_filenames to _cached_filenames. return filenames. define the function reset_translation. import gettext module. from django.utils.translation import trans_real into default namespace. gettext._translations is an empty dictionary. trans_real._translations is an empty dictionary. trans_real._default is None. call the threading.local method, assign the result to trans_real._active. define the function inotify_code_changed. derive the EventHandler class from the base class pyinotify.ProcessEvent. modified_code is None. define the method process_default with self class instance and event as arguments. if event.path ends with string '.mo', EventHandler.modified_code is I18N_MODIFIED. if not, EventHandler.modified_code is FILE_MODIFIED. call the pyinotify.WatchManager method, assign the result to wm. call the method pyinotify.Notifier with wm and EventHandler() as arguments, assign the result to notifier. define the method update_watch with sender defaulting to None and dictionary pair of elements kwargs. if sender is true and sender attribute 'handles_files' is also True, return nothing. perform the bitwise or operation on the next 6 operands pyinotify.IN_MODIFY pyinotify.IN_DELETE, pyinotify.IN_ATTRIB, pyinotify.IN_MOVED_FROM, pyinotify.IN_MOVED_TO and pyinotify.IN_CREATE, store the result in mask. for every path in return value of the call to the function gen_filenames with argument only_new set to boolean True, call the method wm.add_watch with path and mask as arguments. call the method request_finished.connect with argument update_watch. call the method update_watch. call the method notifier.check_events with argument timeout set to None. call the method notifier.read_events. call the method notifier.process_events. call the method notifier.stop. return EventHandler.modified_code. define the function code_changed. use the global variables _mtimes and _win in this function. for every filename in gen_filenames(), call the os.stat function with argument filename, store the return value in stat. substitute stat.st_mtime for mtime. if _win is true, decrement mtime by stat.st_ctime. if filename is not contained in _mtimes, substitute mtime for the value under the filename key of _mtimes dictionary. skip this loop iteration. if mtime is different than the value of dictionary _mtimes under the key filename, _mtimes is an empty dictionary. try, remove the first occurrence of the filename value in the _error_files list. if ValueError exception is caught, do nothing. if filename ends with string '.mo' return I18N_MODIFIED, otherwise return FILE_MODIFIED. return boolean False. define the function check_errors with argument fn. define the function wrapper with list args, and dictionary pair of values kwargs as arguments. try, call the function fn with list of arguments args and dictionary of argument values kwargs. if ImportError, IndentationError, NameError, SyntaxError, TypeError or AttributeErrorexception is caught, call the sys.exc_info function, assign the result to et, ev and tb, respectively. if 'filename' attribute of ev is None, call the traceback.extract_tb method with argument tb, substitute the first element of last row of the result to filename. if not, substitute ev.filename for filename. if filename is not contained in _error_files, append filename to _error_files. raise an exception. return wrapper. define ensure_echo_on function. if termios is true, substitute sys.stdin for fd. evaluate the fd.isatty method, if the result is true, call the method termios.tcgetattr with argument fd, substitute the result for attr_list. if fourth element of attr_list and termios.ECHO are both true, perform binary or for operands: fourth element of_attr_list and termios.ECHO, store the result in fourth element of attr_list. if signal has an attribute 'SIGTTOU', call the signal.signal method with signal.SIGTTOU and signal.SIG_IGN as arguments, store the result in old_handler. if not, old_handler is None. call the method termios.tcsetattr with fd, termios.TCSANOW and attr_list, as arguments. if old_handler is not None, call the method signal.signal with signal.SIGTTOU and old_handler, as arguments. define the function reloader_thread. call the function ensure_echo_on. if USE_INOTIFY is true, substitute inotify_code_changed for fn. if not, substitute code_changed for fn. while RUN_RELOADER is true. assign the return value of the function fn to change. if change equals to FILE_MODIFIED, call the function sys.exit with argument integer 3. otherwise id change equals to I18N_MODIFIED, call the function reset_translations. call the function time.sleep with an argument integer 1. define the function restart_with_reloader. endless loop, in string '-W%s' replace '%s' with o for every o in sys.warnoptions, put the result into a list, append the list to a list containing sys.executable, append sys.argv to the end of the resulting list, substitute the result for args. if sys.platform equals to string "win32", args is a list containing arg surrounded by double quotes for every arg in args. call the method os.environ.copy, substitute the result for new_environ. value under the "RUN_MAIN" key of new_environ dictionary is a string 'true'. call the function os.spawnve with os.P_WAIT, sys.executable, args and new_environ as arguments, substitute the result for exit_code. if exit_code is not equal to integer 3. return exit_code. define the function python_reloader with main_func and kwargs as arguments. if value under the "RUN_MAIN" key of the os.environ dictionary equals to string "true", call the function thread.start_new_thread with main_func, args and kwargs as arguments. try, call the function reloader_thread. if KeyboardInterrupt exception is caught, do nothing. if not, try, call the function restart_with_reloader, substitute the return value for exit_code. if exit_code is lesser than integer 0, call the function os.kill with os.getpid() and negative exit_code as arguments. if not, call the function sys.exit with argument exit_code. if KeyboardInterrupt exception is caught, do nothing, define the function jython_reloader with main_func, args and kwargs as arguments. from _systemrestart import SystemRestart into default name space. call the function thread.start_new_thread with main_func and args as arguments. endless loop, if return value of the code_changed function is true, raise an SystemRestart exception, call the function time.sleep with argument integer 1. define the function main, with main_func, args defaulting to None and kwargs defaulting to None as arguments. if args is None, args is a empty tuple. if kwargs is None, kwargs is a empty dictionary. if sys.platform starts with string 'java', substitute jython_reloader for reloader. if not, substitute python_reloader for reloader. call the function check_errors with argument main_func, substitute the result for wrapped_main_func. call the function reloader with wrapped_main_func, args and kwargs as arguments. BASE2_ALPHABET is a string '01'. BASE16_ALPHABET is a string '0123456789ABCDEF'. BASE56_ALPHABET is a string '23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz'. BASE36_ALPHABET is a string '0123456789abcdefghijklmnopqrstuvwxyz'. BASE62_ALPHABET is string '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'. append string '-_' to the BASE62_ALPHABET, substitute it for BASE64_ALPHABET. derive class BaseCOnverter from object base class. decimal_digits is a string '0123456789'. define the initialization function with self class instance, digits and sign defaulting to '-' as arguments. substitute sign for self.sign. substitute digits for self.digits. if sign is contained in self.digits, raise ValueError exception with string 'Sign character found in converter base digits.' as an argument. define private method __repr__ with argument self. replace '%s' in the string "" with length of self.digits and self.digits, respectively, return the string. define the method encode with self class instance and i as arguments. call the self.convert method with i, self.decimal_digits, self.digits and '-' as arguments, assign the result to the neg and value, respectively. if neg is true, append value to the self.sign, return the result. return value. define the decode method with self class instance and s as arguments. call the self.convert method with s, self.decimal, self.decimal_digits and self.sign as arguments, assign the result to the neg and value, respectively. if neg is true, append value to the '-', substitute it for value. convert value to an integer, return it. define convert method with self class instance, number, from_digits, to_digits and sign as arguments. convert number to string, if first element equals to sign, convert number to a string, truncate first element. neg is integer 1. if not, neg is integer 0. x is integer 0. for every digit in number coverted to a string, multiply x by length of from_digits add the return value of method from_digits.index with digit argument, substitute the result for x. if x equals to integer 0, substitute first element of to_digits for res. if not, res is an empty string. while x is greater than zero, calculate reminder of division of x by length to_digits, substitute it for digit. increment res by element of to_digit at the digit index. divide x by length of to_digits, convert floor value of the result to an integer, substitute it for x. return neg and res. call the BaseConverter function with BASE2_ALPHABET as argument, store the result in base2. call the BaseConverter function with BASE16_ALPHABET as argument, store the result in base16. call the BaseConverter function with BASE36_ALPHABET as argument, store the result in base36. call the BaseConverter function with BASE56_ALPHABET as argument, store the result in base56. call the BaseConverter function with BASE62_ALPHABET as argument, store the result in base62. call the BaseConverter function with BASE64_ALPHABET and sign set to '$' as arguments, store the result in base64. from module __future__ import unicode_literals to default name space. import hashlib module. import re module. import time module. from django.conf import settings object to the default name space. from django.core.cache import caches to the default name space. from django.utils import iri_to_uri, force_bytes, force_text to the default name space. from django.utils.http import http_date to the default name space. from django.utils.timezone import get_current_timezone_name to the default name space. from django.utils.translation import get_language to the default name space. compile regular expression based on the string '\s*,\s*' and assign the result to cc_delim_re. define function patch_cache_control, with response and dictionary set of arguments, kwargs, as arguments. define function dictitem with s as an argument. split string s once, with '=' sign as a delimiter, assign the resulting list to the t. if length of t is greater than integer 1, return first element of t converted to lowercase and second element of t, as a tuple. if not, return first element of t converted to lowercase and boolean True, as a tuple. define function dictvale, with an argument t. if second element of t is boolean True, return first element of t. if not, return string first element of t, '=', second element of t. if call to the method response.has_header with string 'Cache-Control' as an argument returns boolean True, find the value of response under the key 'Cache-Control', use it as a delimiter to split string ss_delim_re, assign the result to cc. cc is a dictionary populated with items by calling function dictitem with el as argument, for every el in cc. if not, cc is an empty dictionary. if cc contains item 'max-age' and kwargs contains item 'max_age', convert to integer value of dictionary cc under the key 'max-age', if it is smaller than the value of dictionary kwargs under the key 'max_age', substitute kwargs value under the key 'max-age' by it. if cc contains item 'private' and kwargs contains item 'public', delete dictionary item 'private' from cc. if cc contains item 'public' and kwargs contains item 'private', delete dictionary item 'public' from cc. for every k and v in items of dictionary kwargs, respectively, replace all occurrences of symbol '_' in string k with symbol '-', use new string as key to find a value in dictionary cc, replace this value with v. call the function dictvalue with el as argument for every el in values of dictionary cc, join the resulting sequence in a string with comma as separator, assign the string to cc. substitute response dictionary value under the key 'Cache-Control' for cc. define function get_max_age with response as an argument. if the result to the method call response.has_header, with string 'Cache-Control' as an argument is boolean False, return from the function cc is a dictionary populated with items by calling function _to_tuple with el as an argument, for every el in split string cc_delim_re, with delimiter being the value of dictionary response under the key 'Cache-Control'. if cc contains item 'max-age', try, convert to integer the value of dictionary cc under the key 'max-age', and return it if exception ValueError or TypeError is raised, do nothing. define the function _set_response_etag, with response as an argument. if response.streaming is boolean False, create md5 hash from string response.content in hexadecimal format, surround the hash with double quotes, and store it in the value of the dictionary response under the key 'ETag'. return response define the function patch_response_headers, with response and cache_timeout with None as default value, as arguments. if cache_timeout equals to None, substitute settings.CACHE_MIDDLEWARE_SECONDS for cache_timeout. if cache_timeout is lesser than integer 0, substitute integer 0 for cache_timeout. if settings.USE_ETAGS is True and function call response.has_header with string 'ETag' as argument returns boolean False, if object response has an attribute 'render' and if response.render is callable object, call the method response.add_post_render_callback with _set_response_etag as argument. if not, substitute return value of call to the function _set_response_etag with response as an argument, for response. if call to the function response.has_header with string 'Last-Modified' as an argument returns boolean False, call the function http_date with no arguments, and substitute its return value for value of dictionary response under the key 'Last-Modified'. if call to the function response.has_header with 'Expires' as argument returns boolean False, sum return value of the function call time.time() and cache_timeout, use it as an argument for function call of http_date, and substitute the return value for value under the key 'Expires' of dictionary response. call the function patch_cache_control, with response and max_age set to cache_timeout as arguments. define function add_never_cache_headers, with response as an argument. call the function patch_response with response and cache_timeout decremented by integer 1 as arguments. define function patch_vary_headers, with response and newheaders as arguments. doctring if call to the function response.has_header with argument 'Vary' returns boolean True, split the string cc_delim_re with value under the key 'Vary' of response dictionary as delimiter, substitute result for vary_headers. if not, vary_headers is an empty list. existing_headers is a set of lowercase headers for every header in vary_headers. put every header in newheaders in a list, only if newheader converted to lowercase does not exist in existing_headers, substitute this list for additional_headers. join all of the elements of vary_headers and additional_headers in a string delimited by a comma, substitute it for value of dictionary response under the key 'Vary'. define function has_vary_header, with response and header_query as arguments. if return value of function response.has_header with string 'Vary' as argument is boolean False, return boolean False. split string cc_delim_re by value of dictionary response under the key 'Vary' as a delimiter, substitute it for vary_headers. existing_headers is a set containing lowercase strings header for every header in vary_headers. check if lowercase header_query exists is existing_headers, return the boolean result. define function _i18n_cache_key_suffix, with request and cache_key as arguments. if eather one of settings.USE_I18N or settings.USE_L10N is True, call the function getattr with request, string 'LANGUAGE_CODE' and function get_language as arguments, append the result at the end of string '.', append it all at the end of string cache_key. if settings.USE_TZ is True, call the function force_text, with the function get_current_timezone_name and errors set to string 'ignore' as arguments, replace the result for tz_name. call the method tz_name.encode with the arguments 'ascii' and 'ignore', call the method decode on the result with 'ascii' as argument, in the resulting string replace all occurrences of ' ' with '_' and append it to the end of cache_key. return cache_key. define function _generate_cache_key, with request, method, headerlist and key_prefix as arguments. ctx is an hashlib object, for calculating hash function with md5 algorithm. for every header in headerlist, call method request.META.get with arguments header and None. if value is not None, call function force_bytes with value as argument, use the result to as the result for the call to the methgod ctx.update. call iri_to_uri with return value of the request.build_absolute_uri method, us the result as the argument for the call to the force_bytes function, use the result as the argument for the call to the hashlib.mdb function, store the result in url. substitute the '%s' in string 'views.decorators.cache.cache_page.%s.%s.%s.%s' with key_prefix, method, return value of method url.hexdigest(), return value of method ctx.hexdigest, respectively, substitute it for cache_key. call the function _i18n_cache_key_suffix with request and cache_key as arguments, return the result. define the funtion _generate_cache_header_key with key_prefix and request as arguments. call method request.build_absolute_uri, use the result as an argument for function call of iri_to_uri, use the result as an argument for function call of force_bytes, use the result as an argument for calling the method hashlib.md5, put the result in url. substitute the '%s' in string 'views.decorators.cache.cache_header.%s.%s' with key_prefix and result of the function call, to the function url.hexdigest(), respectively, substitute it for cache_key. call the function _i18n_cache_key_suffix with request and cache_key as arguments, return the result. define the function get_cache_key, with request key_prefix set to None, method set to 'GET' and cache set to None as arguments. if key_prefix is None, substitute settings.CACHE_MIDDLEWARE_KEY_PREFIX for key_prefix. call the function _generate_cache_header_key with key_prefix and request as arguments, substitute the result for cache_key. if cache is None, set cache to the value of the dictionary caches under the key settings.CACHE_MIDDLEWARE_ALIAS. get the value of dictionary cache under the key cache_key, if key is not available return None, substitute it for headerlist. if header list is not None, call the function _generate_cache_key with request, method, headerlist, key_prefix as arguments, return the result. if not, return None. define function learn_cache_key with request, response, cache_timeout set to None, key_prefix set to None, cache set to None as arguments. if key_prefix is None, substitute settings.CACHE_MIDDLEWARE_KEY_PREFIX for key_prefix. if cache_timeout is None, substitute settings.CACHE_MIDDLEWARE_SECONDS for cache_timeout. call function _generate_cache_header_key with arguments key_prefix and request, substitute the result for cache_key. if cache is None, get value under the key settings.CACHE_MIDDLEWARE_ALIAS of caches dictionary, substitute with it the cache. if call to the function response.has_header with string 'Vary' as an argument returns True, if eather of settings.USE_I18N or settings.USE_L10N is True, set is_accept_language_redundant to True. headerlist is an empty list. for every header in list of strings compiled by splitting string cc_delim_re with value under the key 'Vary' of response dictionary as a delimiter. convert string header to uppercase and replace all occurrences of '-' with '_', substitute it for header. if header equals a string 'ACCEPT_LANGUAGE' and is_accept_language_redundant is boolean True, continue with the next iteration of the for loop. append header to the string 'HTTP_', append the result to the list headerlist. call method sort on the headerlist. call the method cache.set, with cache_key, headerlist, cache_timeout as arguments. call the function _generate_cache_key with request, request.method, headerlist, key_prefix as arguments, return the result. if not, call the method cache.set with cache_key, an empty list and cache_timeout as arguments. call the function _generate_cache_key with request, request.method, an empty list and key_prefix as arguments, return the result. define function _to_tuple with s as an argument. split string s once, with '=' as delimiter, substitute the result for t. if length of t equals to integer 2, return tuple, consisting of first element of t converted to lowercase and second element of t. return tuple, consisting of first element of t converted to lowercase and True. __all__ is an list with an element 'luhn'. from django.utils import six into default name space. LUHN_ODD_LOOKUP is a tuple with 10 elements: integers 0, 2, 4, 6, 8, 1, 3, 5, 7 and 9. define the function luhn with an argument candidate. if candidate is not an instance of six.string_types, convert candidate to a string. try, for every c in reversed order of candidate, convert c into an integer, sum all the results and substitute the result for evens. for every c in candidate without the last element and in reversed order, convert c into an integer, use the result as an key to get the value from the LUHN_ODD_LOOKUP dictionary, sum all the results and substitute the result for odds. sum evens and odds, if the result is divisible by integer 10, return boolean True, if not return boolean False. if ValueError exception is caught, return boolean False. from __future__ import unicode_literals into default name space. import module hmac. import module struc. import module hashlib. import module binascii. import module time. import module random. try, random is an instance of random.SystemRandom class. using_sysrandom is boolean True. if NotImplementedError exception is caught, import warnings. call the function warnings.warn with an argument, string 'A secure pseudo-random number generator is not available on your system. Falling back to Mersenne Twister.'. using_sysrandom is boolean False. from django.conf import settings into default name space. from django.utils.encoding import force_bytes into default name space. from django.utils import six into default name space. from django.utils.six.moves import xrange into default name space. define the function salted_hmac with 3 arguments: key_salt, value and secret set to None. if secret is None, substitute settings.SECRET_KEY for secret. call the function force_bytes with an argument key_salt, substitute the result for key_salt. call the function force_bytes with an argument secret, substitute the result for secret. call the method hashlib.sha1 with an argument secret appended to key_salt, call the method digest on the result, return the result. call the method hmac.new with 3 arguments: key, msg set to result of the function force_bytes with an argument value, and digestmod set to hashlib.sha1, return the result. define the function constant_time_compare with 2 arguments: length set to integer 12, if using_sysrandom is false, format string "%s%s%s" with 3 elements: result of the function random.getstate, result of the call the the function time.time, and settings.SECRET_KEY, call on it method encode with an argument string 'utf-8', use the result as an argument for the call to the method hashlib.sha256, call the method digest on the result, use the result as an argument for the call to the function random.seed. call the function random.choice with an argument allowed_chars, for every i in range of integers from 0 to lengths, join the results into a string, return it. if hmac has an attribute "compare_digest", define the function constant_time_compare with 2 arguments: val1 and val2. call the function hmac.compare_digest with 2 arguments: result of the function force_bytes called with an argument val1, and result of the function force_bytes called with an argument val2, return the result. if not, call the function constant_time_compare with 2 arguments: val1 and val2. if lengths of val1 and val2 are not equal, return boolean False. result is an integer 0. if six.PY3 is true and val1 and val2 are an instances of bytes, zip val1 and va2 into list of tuples, for every x and y in the result, perform bitwise exclusive OR on 2 operands x and y, perform bitwise OR with 2 operands: previous result and result, substitute the result for result. if not, zip val1 and va2 into list of tuples, for every x and y in the result, perform bitwise exclusive OR on 2 operands integer representation of x and integer representation of y, perform bitwise OR with 2 operands: previous result and result, substitute the result for result. if result is equal to integer 0, return boolean True, otherwise return boolean False. define the function _bin_to_long with an argument x. call the function binascii.hexlify with an argument x, convert the result to base 16 integer, return the result. define the function _long_to_bin with 2 arguments: x and hex_format_string. format string hex_format_string with x, call the method encode on the result with an argument string 'ascii', use the result as an argument for the call to the function binascii.unhexlify, return the result. if hashlib had an instance "pbkdf2_hmac", define the function pbkdf2 with 5 arguments: password, salt, iterations, dklen set to integer 0 and digest set to None. if digest is None, substitute hashlib.sha256 for digest. if dklen is false, dklen is None. call the function force_bytes with an argument password, substitute the result for password. call the function force_bytes with an argument salt, substitute the result for salt. call the function hashlib.pbkdf2_hmac with 5 arguments: field name of the result of the function digest, password, salt, iterations and dklen, return the result. if not, define the function pbkdf2 with 5 arguments: password, salt, iterations, dklen set to integer 0 and digest set to None. if iterations is lesser than integer 0, raise an error. if digest is false, substitute hashlib.sha256 for digest. call the function force_bytes with an argument password, substitute the result for password. call the function force_bytes with an argument salt, substitute the result for salt. call the function digest, substitute the filed digest_size of the result for hlen. if dklen is false, substitute hlen for dklen. bring intger 2 to integer 32, decrement the result by 1, multiply it with hlen, if dklen is greater than the previous result, raise an OverflowError exception with an argument string 'dklen too big'. divide negative dklen with hlen, substitute floored result for l. decrement l by integer 1, multiply it with hlen, subtract the result from dklen, substitute the result for r. hex_format_string is a string "%%0%ix" formated with hlen multiplied with integer 2. call the function digest twice, substitute the results for inner, outer, respectively. if length of password is greater than inner.block_size, call the function digest with an argument password, call the method digest on the result, substitute the result or password. decrement by length of password, create bytes string with previous result number of characters '\x00', append the result to password. call the method password.translate with an argument hmac.trans_36, update inner dictionary with the result. call the method password.translate with an argument hmac.trans_5C, update outer dictionary with the result. define the function F with an argument i. call the method struct.pack with 2 arguments: bytes string '>I' and i, append the result to salt, substitute the result or u. result is an integer 0. for every j in range of integers from 0 to iterations converted to an integer, call the function inner.copy, substitute the result for dig1, call the function outer.copy, substitute the result for dig2. call the method dig1.update with an argument u. call the method dig1.digest, use the result as an argument for the call to the function dig2.update. call the method dig2.digest, substitute the result for u. call the function _bin_to_long with an argument u perform bitwise exclusive OR with 2 operands, previous result an result, substitute the result for result. call the function _long_to_bin with 2 arguments: result and hex_format_string, return the result. call the function F with an argument x, for every x in sequence of integers from 1 to l, not included, substitute the results in a list for T. join elements of T in a bytes string, append first r elements of result of the call to the function F with an argument l to it, import module os. import module sys. from . import six into default name space. convert six.PY3 to an integer, substitute it for buffering. if os.name equals string 'posix', define the function become_daemon with 4 arguments: our_home_dir set to '.', out_log set to a string '/dev/null', try, fork a child process, if the result equals integer 0, close the process with an argument 0. if OSError, renamed to e, exception is caught, call the method sys.stderr.write with an argument string "fork #1 failed: (%d) %s\n", formated with e.errno and e.strerror. close the process with an argument 1. call the method os.setsid. call the method os.chdir with an argument our_home_dir. call the function os.umask with an argument umask. try, fork a child process, if the result equals integer 0, close the process with an argument 0. if OSError, renamed to e, exception is caught, call the method sys.stderr.write with an argument string "fork #2 failed: (%d) %s\n", formated with e.errno and e.strerror. call the method os._exit with an argument integer 1. open '/dev/null' file in read mode, substitute the result for si. open out_log flie in append mode with buffering size of input buffer, substitute the result for so. open err_log flie in append mode with buffering size of input buffer, substitute the result for se. call the method os.dup2 with 2 arguments: result of the method si.fileno and result of the method sys.stdin.fileno. call the method os.dup2 with 2 arguments: result of the method so.fileno and result of the method sys.stdout.fileno. call the method os.dup2 with 2 arguments: result of the method se.fileno and result of the method sys.stderr.fileno. substitute so and se for sys.stdout and sys.stderr. if not, define the function become_daemon with 4 argument: our_home_dir set to '.', out_log set to None, err_log set to None, call the method os.chdir with an argument our_home_dir. call the method os.umask with an argument umask. call the method sys.stdin.close. call the method sys.stdout.close. call the method sys.stderr.close. if err_log is true, open err_log file in append mode with buffering size of the input buffer, substitute the result for sys.stderr. if not, sys.