Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
Machine.validate_uuid_field
(self, key, uuid)
The uuid field is the same from /etc/machine-id but with '-' separators :param key: :param uuid: :return:
The uuid field is the same from /etc/machine-id but with '-' separators :param key: :param uuid: :return:
def validate_uuid_field(self, key, uuid): """ The uuid field is the same from /etc/machine-id but with '-' separators :param key: :param uuid: :return: """ if len(uuid) != 36: raise LookupError("len(uuid) != 36 -> %s" % uuid) return UUID_REGEX(...
[ "def", "validate_uuid_field", "(", "self", ",", "key", ",", "uuid", ")", ":", "if", "len", "(", "uuid", ")", "!=", "36", ":", "raise", "LookupError", "(", "\"len(uuid) != 36 -> %s\"", "%", "uuid", ")", "return", "UUID_REGEX", "(", "uuid", ")" ]
[ 201, 4 ]
[ 210, 31 ]
python
en
['en', 'error', 'th']
False
MachineInterface.validate_mac
(self, key, mac)
:param key: :param mac: :return:
:param key: :param mac: :return:
def validate_mac(self, key, mac): """ :param key: :param mac: :return: """ return MAC_REGEX(mac)
[ "def", "validate_mac", "(", "self", ",", "key", ",", "mac", ")", ":", "return", "MAC_REGEX", "(", "mac", ")" ]
[ 278, 4 ]
[ 284, 29 ]
python
en
['en', 'error', 'th']
False
MachineInterface.validate_ipv4
(self, key, ipv4)
Gateway and IPv4 validation :param key: :param ipv4: :return:
Gateway and IPv4 validation :param key: :param ipv4: :return:
def validate_ipv4(self, key, ipv4): """ Gateway and IPv4 validation :param key: :param ipv4: :return: """ return IPV4_REGEX(ipv4)
[ "def", "validate_ipv4", "(", "self", ",", "key", ",", "ipv4", ")", ":", "return", "IPV4_REGEX", "(", "ipv4", ")" ]
[ 288, 4 ]
[ 295, 31 ]
python
en
['en', 'error', 'th']
False
format_permissions
(permission_bound_field)
Given a bound field with a queryset of Permission objects - which must be using the CheckboxSelectMultiple widget - construct a list of dictionaries for 'objects': 'objects': [ { 'object': name_of_some_content_object, 'add': checkbox ...
Given a bound field with a queryset of Permission objects - which must be using the CheckboxSelectMultiple widget - construct a list of dictionaries for 'objects':
def format_permissions(permission_bound_field): """ Given a bound field with a queryset of Permission objects - which must be using the CheckboxSelectMultiple widget - construct a list of dictionaries for 'objects': 'objects': [ { 'object': name_of_some_content_o...
[ "def", "format_permissions", "(", "permission_bound_field", ")", ":", "permissions", "=", "permission_bound_field", ".", "field", ".", "_queryset", "# get a distinct list of the content types that these permissions relate to", "content_type_ids", "=", "set", "(", "permissions", ...
[ 12, 0 ]
[ 80, 5 ]
python
en
['en', 'error', 'th']
False
CookieStorage._get
(self, *args, **kwargs)
Retrieves a list of messages from the messages cookie. If the not_finished sentinel value is found at the end of the message list, remove it and return a result indicating that not all messages were retrieved by this storage.
Retrieves a list of messages from the messages cookie. If the not_finished sentinel value is found at the end of the message list, remove it and return a result indicating that not all messages were retrieved by this storage.
def _get(self, *args, **kwargs): """ Retrieves a list of messages from the messages cookie. If the not_finished sentinel value is found at the end of the message list, remove it and return a result indicating that not all messages were retrieved by this storage. """ ...
[ "def", "_get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "request", ".", "COOKIES", ".", "get", "(", "self", ".", "cookie_name", ")", "messages", "=", "self", ".", "_decode", "(", "data", ")", "al...
[ 63, 4 ]
[ 76, 38 ]
python
en
['en', 'error', 'th']
False
CookieStorage._update_cookie
(self, encoded_data, response)
Either sets the cookie with the encoded data if there is any data to store, or deletes the cookie.
Either sets the cookie with the encoded data if there is any data to store, or deletes the cookie.
def _update_cookie(self, encoded_data, response): """ Either sets the cookie with the encoded data if there is any data to store, or deletes the cookie. """ if encoded_data: response.set_cookie( self.cookie_name, encoded_data, domain=se...
[ "def", "_update_cookie", "(", "self", ",", "encoded_data", ",", "response", ")", ":", "if", "encoded_data", ":", "response", ".", "set_cookie", "(", "self", ".", "cookie_name", ",", "encoded_data", ",", "domain", "=", "settings", ".", "SESSION_COOKIE_DOMAIN", ...
[ 78, 4 ]
[ 91, 91 ]
python
en
['en', 'error', 'th']
False
CookieStorage._store
(self, messages, response, remove_oldest=True, *args, **kwargs)
Stores the messages to a cookie, returning a list of any messages which could not be stored. If the encoded data is larger than ``max_cookie_size``, removes messages until the data fits (these are the messages which are returned), and add the not_finished sentinel value to indi...
Stores the messages to a cookie, returning a list of any messages which could not be stored.
def _store(self, messages, response, remove_oldest=True, *args, **kwargs): """ Stores the messages to a cookie, returning a list of any messages which could not be stored. If the encoded data is larger than ``max_cookie_size``, removes messages until the data fits (these are the...
[ "def", "_store", "(", "self", ",", "messages", ",", "response", ",", "remove_oldest", "=", "True", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "unstored_messages", "=", "[", "]", "encoded_data", "=", "self", ".", "_encode", "(", "messages", ")...
[ 93, 4 ]
[ 120, 32 ]
python
en
['en', 'error', 'th']
False
CookieStorage._hash
(self, value)
Creates an HMAC/SHA1 hash based on the value and the project setting's SECRET_KEY, modified to make it unique for the present purpose.
Creates an HMAC/SHA1 hash based on the value and the project setting's SECRET_KEY, modified to make it unique for the present purpose.
def _hash(self, value): """ Creates an HMAC/SHA1 hash based on the value and the project setting's SECRET_KEY, modified to make it unique for the present purpose. """ key_salt = 'django.contrib.messages' return salted_hmac(key_salt, value).hexdigest()
[ "def", "_hash", "(", "self", ",", "value", ")", ":", "key_salt", "=", "'django.contrib.messages'", "return", "salted_hmac", "(", "key_salt", ",", "value", ")", ".", "hexdigest", "(", ")" ]
[ 122, 4 ]
[ 128, 55 ]
python
en
['en', 'error', 'th']
False
CookieStorage._encode
(self, messages, encode_empty=False)
Returns an encoded version of the messages list which can be stored as plain text. Since the data will be retrieved from the client-side, the encoded data also contains a hash to ensure that the data was not tampered with.
Returns an encoded version of the messages list which can be stored as plain text.
def _encode(self, messages, encode_empty=False): """ Returns an encoded version of the messages list which can be stored as plain text. Since the data will be retrieved from the client-side, the encoded data also contains a hash to ensure that the data was not tampered with. ...
[ "def", "_encode", "(", "self", ",", "messages", ",", "encode_empty", "=", "False", ")", ":", "if", "messages", "or", "encode_empty", ":", "encoder", "=", "MessageEncoder", "(", "separators", "=", "(", "','", ",", "':'", ")", ")", "value", "=", "encoder",...
[ 130, 4 ]
[ 141, 55 ]
python
en
['en', 'error', 'th']
False
CookieStorage._decode
(self, data)
Safely decodes an encoded text stream back into a list of messages. If the encoded text stream contained an invalid hash or was in an invalid format, ``None`` is returned.
Safely decodes an encoded text stream back into a list of messages.
def _decode(self, data): """ Safely decodes an encoded text stream back into a list of messages. If the encoded text stream contained an invalid hash or was in an invalid format, ``None`` is returned. """ if not data: return None bits = data.split('$'...
[ "def", "_decode", "(", "self", ",", "data", ")", ":", "if", "not", "data", ":", "return", "None", "bits", "=", "data", ".", "split", "(", "'$'", ",", "1", ")", "if", "len", "(", "bits", ")", "==", "2", ":", "hash", ",", "value", "=", "bits", ...
[ 143, 4 ]
[ 165, 19 ]
python
en
['en', 'error', 'th']
False
find_class_in_modules
(class_name)
Used to find ldap subclasses by string
Used to find ldap subclasses by string
def find_class_in_modules(class_name): """ Used to find ldap subclasses by string """ module_search_space = [django_auth_ldap.config, awx.sso.ldap_group_types] for m in module_search_space: cls = getattr(m, class_name, None) if cls: return cls return None
[ "def", "find_class_in_modules", "(", "class_name", ")", ":", "module_search_space", "=", "[", "django_auth_ldap", ".", "config", ",", "awx", ".", "sso", ".", "ldap_group_types", "]", "for", "m", "in", "module_search_space", ":", "cls", "=", "getattr", "(", "m"...
[ 44, 0 ]
[ 53, 15 ]
python
en
['en', 'error', 'th']
False
DependsOnMixin.get_depends_on
(self)
Get the value of the dependent field. First try to find the value in the request. Then fall back to the raw value from the setting in the DB.
Get the value of the dependent field. First try to find the value in the request. Then fall back to the raw value from the setting in the DB.
def get_depends_on(self): """ Get the value of the dependent field. First try to find the value in the request. Then fall back to the raw value from the setting in the DB. """ from django.conf import settings dependent_key = next(iter(self.depends_on)) i...
[ "def", "get_depends_on", "(", "self", ")", ":", "from", "django", ".", "conf", "import", "settings", "dependent_key", "=", "next", "(", "iter", "(", "self", ".", "depends_on", ")", ")", "if", "self", ".", "context", ":", "request", "=", "self", ".", "c...
[ 57, 4 ]
[ 72, 18 ]
python
en
['en', 'error', 'th']
False
_hash_dict
(d)
Return a stable sha224 of a dictionary.
Return a stable sha224 of a dictionary.
def _hash_dict(d): # type: (Dict[str, str]) -> str """Return a stable sha224 of a dictionary.""" s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True) return hashlib.sha224(s.encode("ascii")).hexdigest()
[ "def", "_hash_dict", "(", "d", ")", ":", "# type: (Dict[str, str]) -> str", "s", "=", "json", ".", "dumps", "(", "d", ",", "sort_keys", "=", "True", ",", "separators", "=", "(", "\",\"", ",", "\":\"", ")", ",", "ensure_ascii", "=", "True", ")", "return",...
[ 28, 0 ]
[ 32, 56 ]
python
en
['en', 'en', 'en']
True
Cache._get_cache_path_parts_legacy
(self, link)
Get parts of part that must be os.path.joined with cache_dir Legacy cache key (pip < 20) for compatibility with older caches.
Get parts of part that must be os.path.joined with cache_dir
def _get_cache_path_parts_legacy(self, link): # type: (Link) -> List[str] """Get parts of part that must be os.path.joined with cache_dir Legacy cache key (pip < 20) for compatibility with older caches. """ # We want to generate an url to use as our cache key, we don't want to ...
[ "def", "_get_cache_path_parts_legacy", "(", "self", ",", "link", ")", ":", "# type: (Link) -> List[str]", "# We want to generate an url to use as our cache key, we don't want to", "# just re-use the URL because it might have other items in the fragment", "# and we don't care about those.", "...
[ 57, 4 ]
[ 83, 20 ]
python
en
['en', 'en', 'en']
True
Cache._get_cache_path_parts
(self, link)
Get parts of part that must be os.path.joined with cache_dir
Get parts of part that must be os.path.joined with cache_dir
def _get_cache_path_parts(self, link): # type: (Link) -> List[str] """Get parts of part that must be os.path.joined with cache_dir """ # We want to generate an url to use as our cache key, we don't want to # just re-use the URL because it might have other items in the fragment ...
[ "def", "_get_cache_path_parts", "(", "self", ",", "link", ")", ":", "# type: (Link) -> List[str]", "# We want to generate an url to use as our cache key, we don't want to", "# just re-use the URL because it might have other items in the fragment", "# and we don't care about those.", "key_par...
[ 85, 4 ]
[ 118, 20 ]
python
en
['en', 'en', 'en']
True
Cache.get_path_for_link
(self, link)
Return a directory to store cached items in for link.
Return a directory to store cached items in for link.
def get_path_for_link(self, link): # type: (Link) -> str """Return a directory to store cached items in for link. """ raise NotImplementedError()
[ "def", "get_path_for_link", "(", "self", ",", "link", ")", ":", "# type: (Link) -> str", "raise", "NotImplementedError", "(", ")" ]
[ 152, 4 ]
[ 156, 35 ]
python
en
['en', 'en', 'en']
True
Cache.get
( self, link, # type: Link package_name, # type: Optional[str] supported_tags, # type: List[Tag] )
Returns a link to a cached item if it exists, otherwise returns the passed link.
Returns a link to a cached item if it exists, otherwise returns the passed link.
def get( self, link, # type: Link package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Link """Returns a link to a cached item if it exists, otherwise returns the passed link. """ raise NotImp...
[ "def", "get", "(", "self", ",", "link", ",", "# type: Link", "package_name", ",", "# type: Optional[str]", "supported_tags", ",", "# type: List[Tag]", ")", ":", "# type: (...) -> Link", "raise", "NotImplementedError", "(", ")" ]
[ 158, 4 ]
[ 168, 35 ]
python
en
['en', 'en', 'en']
True
SimpleWheelCache.get_path_for_link
(self, link)
Return a directory to store cached wheels for link Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only insert things into the cache if they have plausible version numbers, so ...
Return a directory to store cached wheels for link
def get_path_for_link(self, link): # type: (Link) -> str """Return a directory to store cached wheels for link Because there are M wheels for any one sdist, we provide a directory to cache them in, and then consult that directory when looking up cache hits. We only inse...
[ "def", "get_path_for_link", "(", "self", ",", "link", ")", ":", "# type: (Link) -> str", "parts", "=", "self", ".", "_get_cache_path_parts", "(", "link", ")", "assert", "self", ".", "cache_dir", "# Store wheels within the root cache_dir", "return", "os", ".", "path"...
[ 187, 4 ]
[ 206, 61 ]
python
en
['en', 'en', 'en']
True
WheelCache.get_cache_entry
( self, link, # type: Link package_name, # type: Optional[str] supported_tags, # type: List[Tag] )
Returns a CacheEntry with a link to a cached item if it exists or None. The cache entry indicates if the item was found in the persistent or ephemeral cache.
Returns a CacheEntry with a link to a cached item if it exists or None. The cache entry indicates if the item was found in the persistent or ephemeral cache.
def get_cache_entry( self, link, # type: Link package_name, # type: Optional[str] supported_tags, # type: List[Tag] ): # type: (...) -> Optional[CacheEntry] """Returns a CacheEntry with a link to a cached item if it exists or None. The cache ent...
[ "def", "get_cache_entry", "(", "self", ",", "link", ",", "# type: Link", "package_name", ",", "# type: Optional[str]", "supported_tags", ",", "# type: List[Tag]", ")", ":", "# type: (...) -> Optional[CacheEntry]", "retval", "=", "self", ".", "_wheel_cache", ".", "get", ...
[ 318, 4 ]
[ 345, 19 ]
python
en
['en', 'en', 'en']
True
TableBlock.__init__
(self, required=True, help_text=None, table_options=None, **kwargs)
CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality natively (via 'label' and 'default') CharField's 'max_length' and 'min_length' parameters are not exposed as table data needs to have arbitrary length
CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality natively (via 'label' and 'default')
def __init__(self, required=True, help_text=None, table_options=None, **kwargs): """ CharField's 'label' and 'initial' parameters are not exposed, as Block handles that functionality natively (via 'label' and 'default') CharField's 'max_length' and 'min_length' parameters are not expose...
[ "def", "__init__", "(", "self", ",", "required", "=", "True", ",", "help_text", "=", "None", ",", "table_options", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "table_options", "=", "self", ".", "get_table_options", "(", "table_options", ...
[ 84, 4 ]
[ 95, 34 ]
python
en
['en', 'error', 'th']
False
TableBlock.get_table_options
(self, table_options=None)
Return a dict of table options using the defaults unless custom options provided table_options can contain any valid handsontable options: https://handsontable.com/docs/6.2.2/Options.html contextMenu: if value from table_options is True, still use default language: if value is ...
Return a dict of table options using the defaults unless custom options provided
def get_table_options(self, table_options=None): """ Return a dict of table options using the defaults unless custom options provided table_options can contain any valid handsontable options: https://handsontable.com/docs/6.2.2/Options.html contextMenu: if value from table_optio...
[ "def", "get_table_options", "(", "self", ",", "table_options", "=", "None", ")", ":", "collected_table_options", "=", "DEFAULT_TABLE_OPTIONS", ".", "copy", "(", ")", "if", "table_options", "is", "not", "None", ":", "if", "table_options", ".", "get", "(", "'con...
[ 152, 4 ]
[ 176, 38 ]
python
en
['en', 'error', 'th']
False
MigrationQuestioner.ask_initial
(self, app_label)
Should we create an initial migration for the app?
Should we create an initial migration for the app?
def ask_initial(self, app_label): "Should we create an initial migration for the app?" # If it was specified on the command line, definitely true if app_label in self.specified_apps: return True # Otherwise, we look to see if it has a migrations module # without any P...
[ "def", "ask_initial", "(", "self", ",", "app_label", ")", ":", "# If it was specified on the command line, definitely true", "if", "app_label", "in", "self", ".", "specified_apps", ":", "return", "True", "# Otherwise, we look to see if it has a migrations module", "# without an...
[ 26, 4 ]
[ 54, 86 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_not_null_addition
(self, field_name, model_name)
Adding a NOT NULL field to a model
Adding a NOT NULL field to a model
def ask_not_null_addition(self, field_name, model_name): "Adding a NOT NULL field to a model" # None means quit return None
[ "def", "ask_not_null_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 56, 4 ]
[ 59, 19 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_not_null_alteration
(self, field_name, model_name)
Changing a NULL field to NOT NULL
Changing a NULL field to NOT NULL
def ask_not_null_alteration(self, field_name, model_name): "Changing a NULL field to NOT NULL" # None means quit return None
[ "def", "ask_not_null_alteration", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 61, 4 ]
[ 64, 19 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_rename
(self, model_name, old_name, new_name, field_instance)
Was this field really renamed?
Was this field really renamed?
def ask_rename(self, model_name, old_name, new_name, field_instance): "Was this field really renamed?" return self.defaults.get("ask_rename", False)
[ "def", "ask_rename", "(", "self", ",", "model_name", ",", "old_name", ",", "new_name", ",", "field_instance", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_rename\"", ",", "False", ")" ]
[ 66, 4 ]
[ 68, 53 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_rename_model
(self, old_model_state, new_model_state)
Was this model really renamed?
Was this model really renamed?
def ask_rename_model(self, old_model_state, new_model_state): "Was this model really renamed?" return self.defaults.get("ask_rename_model", False)
[ "def", "ask_rename_model", "(", "self", ",", "old_model_state", ",", "new_model_state", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_rename_model\"", ",", "False", ")" ]
[ 70, 4 ]
[ 72, 59 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_merge
(self, app_label)
Do you really want to merge these migrations?
Do you really want to merge these migrations?
def ask_merge(self, app_label): "Do you really want to merge these migrations?" return self.defaults.get("ask_merge", False)
[ "def", "ask_merge", "(", "self", ",", "app_label", ")", ":", "return", "self", ".", "defaults", ".", "get", "(", "\"ask_merge\"", ",", "False", ")" ]
[ 74, 4 ]
[ 76, 52 ]
python
en
['en', 'en', 'en']
True
MigrationQuestioner.ask_auto_now_add_addition
(self, field_name, model_name)
Adding an auto_now_add field to a model
Adding an auto_now_add field to a model
def ask_auto_now_add_addition(self, field_name, model_name): "Adding an auto_now_add field to a model" # None means quit return None
[ "def", "ask_auto_now_add_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "# None means quit", "return", "None" ]
[ 78, 4 ]
[ 81, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner._ask_default
(self, default='')
Prompt for a default value. The ``default`` argument allows providing a custom default value (as a string) which will be shown to the user and used as the return value if the user doesn't provide any other input.
Prompt for a default value.
def _ask_default(self, default=''): """ Prompt for a default value. The ``default`` argument allows providing a custom default value (as a string) which will be shown to the user and used as the return value if the user doesn't provide any other input. """ print(...
[ "def", "_ask_default", "(", "self", ",", "default", "=", "''", ")", ":", "print", "(", "\"Please enter the default value now, as valid Python\"", ")", "if", "default", ":", "print", "(", "\"You can accept the default '{}' by pressing 'Enter' or you \"", "\"can provide another...
[ 108, 4 ]
[ 146, 50 ]
python
en
['en', 'error', 'th']
False
InteractiveMigrationQuestioner.ask_not_null_addition
(self, field_name, model_name)
Adding a NOT NULL field to a model
Adding a NOT NULL field to a model
def ask_not_null_addition(self, field_name, model_name): "Adding a NOT NULL field to a model" if not self.dry_run: choice = self._choice_input( "You are trying to add a non-nullable field '%s' to %s without a default; " "we can't do that (the database needs so...
[ "def", "ask_not_null_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to add a non-nullable field '%s' to %s without a default; \"", "\"w...
[ 148, 4 ]
[ 165, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_not_null_alteration
(self, field_name, model_name)
Changing a NULL field to NOT NULL
Changing a NULL field to NOT NULL
def ask_not_null_alteration(self, field_name, model_name): "Changing a NULL field to NOT NULL" if not self.dry_run: choice = self._choice_input( "You are trying to change the nullable field '%s' on %s to non-nullable " "without a default; we can't do that (the...
[ "def", "ask_not_null_alteration", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to change the nullable field '%s' on %s to non-nullable \"", "\"w...
[ 167, 4 ]
[ 190, 19 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_rename
(self, model_name, old_name, new_name, field_instance)
Was this field really renamed?
Was this field really renamed?
def ask_rename(self, model_name, old_name, new_name, field_instance): "Was this field really renamed?" msg = "Did you rename %s.%s to %s.%s (a %s)? [y/N]" return self._boolean_input(msg % (model_name, old_name, model_name, new_name, field_instance.__clas...
[ "def", "ask_rename", "(", "self", ",", "model_name", ",", "old_name", ",", "new_name", ",", "field_instance", ")", ":", "msg", "=", "\"Did you rename %s.%s to %s.%s (a %s)? [y/N]\"", "return", "self", ".", "_boolean_input", "(", "msg", "%", "(", "model_name", ",",...
[ 192, 4 ]
[ 196, 84 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_rename_model
(self, old_model_state, new_model_state)
Was this model really renamed?
Was this model really renamed?
def ask_rename_model(self, old_model_state, new_model_state): "Was this model really renamed?" msg = "Did you rename the %s.%s model to %s? [y/N]" return self._boolean_input(msg % (old_model_state.app_label, old_model_state.name, new_model_state.name), F...
[ "def", "ask_rename_model", "(", "self", ",", "old_model_state", ",", "new_model_state", ")", ":", "msg", "=", "\"Did you rename the %s.%s model to %s? [y/N]\"", "return", "self", ".", "_boolean_input", "(", "msg", "%", "(", "old_model_state", ".", "app_label", ",", ...
[ 198, 4 ]
[ 202, 71 ]
python
en
['en', 'en', 'en']
True
InteractiveMigrationQuestioner.ask_auto_now_add_addition
(self, field_name, model_name)
Adding an auto_now_add field to a model
Adding an auto_now_add field to a model
def ask_auto_now_add_addition(self, field_name, model_name): "Adding an auto_now_add field to a model" if not self.dry_run: choice = self._choice_input( "You are trying to add the field '{}' with 'auto_now_add=True' " "to {} without a default; the database nee...
[ "def", "ask_auto_now_add_addition", "(", "self", ",", "field_name", ",", "model_name", ")", ":", "if", "not", "self", ".", "dry_run", ":", "choice", "=", "self", ".", "_choice_input", "(", "\"You are trying to add the field '{}' with 'auto_now_add=True' \"", "\"to {} wi...
[ 212, 4 ]
[ 229, 19 ]
python
en
['en', 'en', 'en']
True
calculate_norm_factor
(bam)
Get the sequencing depth normalisation factor to apply to read counts to make them more comparable between libraries
Get the sequencing depth normalisation factor to apply to read counts to make them more comparable between libraries
def calculate_norm_factor(bam): ''' Get the sequencing depth normalisation factor to apply to read counts to make them more comparable between libraries ''' return bam.mapped / 1_000_000
[ "def", "calculate_norm_factor", "(", "bam", ")", ":", "return", "bam", ".", "mapped", "/", "1_000_000" ]
[ 8, 0 ]
[ 14, 33 ]
python
en
['en', 'error', 'th']
False
get_norm_factors
(bam_list, normalise=True)
Open all the bam files in a list and calculate a normalisation factor for the file - this is generally just the number of mapped reads divided by a million
Open all the bam files in a list and calculate a normalisation factor for the file - this is generally just the number of mapped reads divided by a million
def get_norm_factors(bam_list, normalise=True): ''' Open all the bam files in a list and calculate a normalisation factor for the file - this is generally just the number of mapped reads divided by a million ''' norm_factors = {} if normalise: for bam_fn in bam_list: with...
[ "def", "get_norm_factors", "(", "bam_list", ",", "normalise", "=", "True", ")", ":", "norm_factors", "=", "{", "}", "if", "normalise", ":", "for", "bam_fn", "in", "bam_list", ":", "with", "pysam", ".", "AlignmentFile", "(", "bam_fn", ")", "as", "bam", ":...
[ 17, 0 ]
[ 30, 23 ]
python
en
['en', 'error', 'th']
False
get_references_and_lengths
(bam_fn)
Open a bam file and get the length of all the references from the header
Open a bam file and get the length of all the references from the header
def get_references_and_lengths(bam_fn): '''Open a bam file and get the length of all the references from the header''' with pysam.AlignmentFile(bam_fn) as bam: reference_lengths = {ref: bam.get_reference_length(ref) for ref in bam.references} return reference_lengths
[ "def", "get_references_and_lengths", "(", "bam_fn", ")", ":", "with", "pysam", ".", "AlignmentFile", "(", "bam_fn", ")", "as", "bam", ":", "reference_lengths", "=", "{", "ref", ":", "bam", ".", "get_reference_length", "(", "ref", ")", "for", "ref", "in", "...
[ 33, 0 ]
[ 37, 28 ]
python
en
['en', 'en', 'en']
True
get_reference_pos
(pileupcol)
Get relationship to reference, i.e. chrom and pos, from bam (we don't know what the reference base actually is though)
Get relationship to reference, i.e. chrom and pos, from bam (we don't know what the reference base actually is though)
def get_reference_pos(pileupcol): ''' Get relationship to reference, i.e. chrom and pos, from bam (we don't know what the reference base actually is though) ''' ref_name = pileupcol.reference_name ref_pos = pileupcol.reference_pos return ref_name, ref_pos
[ "def", "get_reference_pos", "(", "pileupcol", ")", ":", "ref_name", "=", "pileupcol", ".", "reference_name", "ref_pos", "=", "pileupcol", ".", "reference_pos", "return", "ref_name", ",", "ref_pos" ]
[ 40, 0 ]
[ 47, 28 ]
python
en
['en', 'error', 'th']
False
get_single_query_seq
(pileupread)
Get the query sequence for a pysam PileUpRead
Get the query sequence for a pysam PileUpRead
def get_single_query_seq(pileupread): ''' Get the query sequence for a pysam PileUpRead ''' pos = pileupread.query_position if pos is None: return '' else: seq = pileupread.alignment.query_sequence[pos] if len(seq) > 1: return '' else: retu...
[ "def", "get_single_query_seq", "(", "pileupread", ")", ":", "pos", "=", "pileupread", ".", "query_position", "if", "pos", "is", "None", ":", "return", "''", "else", ":", "seq", "=", "pileupread", ".", "alignment", ".", "query_sequence", "[", "pos", "]", "i...
[ 50, 0 ]
[ 62, 22 ]
python
en
['en', 'error', 'th']
False
iter_pileupreads
(pileupcol)
Generator yielding strand and query sequence for reads in pileupcol Reads which are refskip (i.e. intronic) are skipped
Generator yielding strand and query sequence for reads in pileupcol Reads which are refskip (i.e. intronic) are skipped
def iter_pileupreads(pileupcol): ''' Generator yielding strand and query sequence for reads in pileupcol Reads which are refskip (i.e. intronic) are skipped ''' query_seqs = get_query_seqs(pileupcol) for read, seq in zip(pileupcol.pileups, query_seqs): if not read.is_refskip: ...
[ "def", "iter_pileupreads", "(", "pileupcol", ")", ":", "query_seqs", "=", "get_query_seqs", "(", "pileupcol", ")", "for", "read", ",", "seq", "in", "zip", "(", "pileupcol", ".", "pileups", ",", "query_seqs", ")", ":", "if", "not", "read", ".", "is_refskip"...
[ 76, 0 ]
[ 85, 33 ]
python
en
['en', 'error', 'th']
False
count_mismatches
(col)
For a pysam PileupColumn, computes the number of reads which contain each base or indels and returns a df
For a pysam PileupColumn, computes the number of reads which contain each base or indels and returns a df
def count_mismatches(col): ''' For a pysam PileupColumn, computes the number of reads which contain each base or indels and returns a df ''' ref_name, ref_pos = get_reference_pos(col) refs = [(ref_name, ref_pos, '+'), (ref_name, ref_pos, '-')] counts = {r: Counter() for r in refs...
[ "def", "count_mismatches", "(", "col", ")", ":", "ref_name", ",", "ref_pos", "=", "get_reference_pos", "(", "col", ")", "refs", "=", "[", "(", "ref_name", ",", "ref_pos", ",", "'+'", ")", ",", "(", "ref_name", ",", "ref_pos", ",", "'-'", ")", "]", "c...
[ 88, 0 ]
[ 100, 17 ]
python
en
['en', 'error', 'th']
False
process_bam_chunk
(bam_fn, query, norm_factor=1, max_depth=10_000_000)
Open a bam file and get the base counts for a query. Designed to be called in parallel on a number of bams at once (hence why we have to reopen the bam for every query chunk we process).
Open a bam file and get the base counts for a query. Designed to be called in parallel on a number of bams at once (hence why we have to reopen the bam for every query chunk we process).
def process_bam_chunk(bam_fn, query, norm_factor=1, max_depth=10_000_000): ''' Open a bam file and get the base counts for a query. Designed to be called in parallel on a number of bams at once (hence why we have to reopen the bam for every query chunk we process). ''' with pysam.AlignmentFi...
[ "def", "process_bam_chunk", "(", "bam_fn", ",", "query", ",", "norm_factor", "=", "1", ",", "max_depth", "=", "10_000_000", ")", ":", "with", "pysam", ".", "AlignmentFile", "(", "bam_fn", ")", "as", "bam", ":", "chunk_res", "=", "{", "}", "for", "col", ...
[ 103, 0 ]
[ 120, 44 ]
python
en
['en', 'error', 'th']
False
DatabaseWrapper.check_constraints
(self, table_names=None)
To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred.
To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred.
def check_constraints(self, table_names=None): """ To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they are returned to deferred. """ self.cursor().execute('SET CONSTRAINTS ALL IMMEDIATE') self.cursor().execute('SET CONSTRAINTS...
[ "def", "check_constraints", "(", "self", ",", "table_names", "=", "None", ")", ":", "self", ".", "cursor", "(", ")", ".", "execute", "(", "'SET CONSTRAINTS ALL IMMEDIATE'", ")", "self", ".", "cursor", "(", ")", ".", "execute", "(", "'SET CONSTRAINTS ALL DEFERR...
[ 237, 4 ]
[ 243, 61 ]
python
en
['en', 'error', 'th']
False
MigrationWriter.as_string
(self)
Returns a string of the file contents.
Returns a string of the file contents.
def as_string(self): """ Returns a string of the file contents. """ items = { "replaces_str": "", "initial_str": "", } imports = set() # Deconstruct operations operations = [] for operation in self.migration.operations: ...
[ "def", "as_string", "(", "self", ")", ":", "items", "=", "{", "\"replaces_str\"", ":", "\"\"", ",", "\"initial_str\"", ":", "\"\"", ",", "}", "imports", "=", "set", "(", ")", "# Deconstruct operations", "operations", "=", "[", "]", "for", "operation", "in"...
[ 148, 4 ]
[ 219, 41 ]
python
en
['en', 'error', 'th']
False
init_worker
(counter: "multiprocessing.sharedctypes._Value")
This function runs only under parallel mode. It initializes the individual processes which are also called workers.
This function runs only under parallel mode. It initializes the individual processes which are also called workers.
def init_worker(counter: "multiprocessing.sharedctypes._Value") -> None: """ This function runs only under parallel mode. It initializes the individual processes which are also called workers. """ global _worker_id with counter.get_lock(): counter.value += 1 _worker_id = counter...
[ "def", "init_worker", "(", "counter", ":", "\"multiprocessing.sharedctypes._Value\"", ")", "->", "None", ":", "global", "_worker_id", "with", "counter", ".", "get_lock", "(", ")", ":", "counter", ".", "value", "+=", "1", "_worker_id", "=", "counter", ".", "val...
[ 207, 0 ]
[ 239, 56 ]
python
en
['en', 'error', 'th']
False
vary_on_headers
(*headers)
A view decorator that adds the specified headers to the Vary header of the response. Usage: @vary_on_headers('Cookie', 'Accept-language') def index(request): ... Note that the header names are not case-sensitive.
A view decorator that adds the specified headers to the Vary header of the response. Usage:
def vary_on_headers(*headers): """ A view decorator that adds the specified headers to the Vary header of the response. Usage: @vary_on_headers('Cookie', 'Accept-language') def index(request): ... Note that the header names are not case-sensitive. """ def decorator(fun...
[ "def", "vary_on_headers", "(", "*", "headers", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ",", "assigned", "=", "available_attrs", "(", "func", ")", ")", "def", "inner_func", "(", "*", "args", ",", "*", "*", "kwar...
[ 6, 0 ]
[ 24, 20 ]
python
en
['en', 'error', 'th']
False
vary_on_cookie
(func)
A view decorator that adds "Cookie" to the Vary header of a response. This indicates that a page's contents depends on cookies. Usage: @vary_on_cookie def index(request): ...
A view decorator that adds "Cookie" to the Vary header of a response. This indicates that a page's contents depends on cookies. Usage:
def vary_on_cookie(func): """ A view decorator that adds "Cookie" to the Vary header of a response. This indicates that a page's contents depends on cookies. Usage: @vary_on_cookie def index(request): ... """ @wraps(func, assigned=available_attrs(func)) def inner_fun...
[ "def", "vary_on_cookie", "(", "func", ")", ":", "@", "wraps", "(", "func", ",", "assigned", "=", "available_attrs", "(", "func", ")", ")", "def", "inner_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "func", "(", "*", ...
[ 27, 0 ]
[ 41, 21 ]
python
en
['en', 'error', 'th']
False
import_bo
()
Test if edbo is installed and the main method can be instantiated
Test if edbo is installed and the main method can be instantiated
def import_bo(): """ Test if edbo is installed and the main method can be instantiated """ from edbo.bro import BO bo = BO() return len(bo.obj.domain) == 0
[ "def", "import_bo", "(", ")", ":", "from", "edbo", ".", "bro", "import", "BO", "bo", "=", "BO", "(", ")", "return", "len", "(", "bo", ".", "obj", ".", "domain", ")", "==", "0" ]
[ 3, 0 ]
[ 12, 34 ]
python
en
['en', 'error', 'th']
False
BaseDatabaseFeatures.supports_transactions
(self)
Confirm support for transactions.
Confirm support for transactions.
def supports_transactions(self): """Confirm support for transactions.""" with self.connection.cursor() as cursor: cursor.execute('CREATE TABLE ROLLBACK_TEST (X INT)') self.connection.set_autocommit(False) cursor.execute('INSERT INTO ROLLBACK_TEST (X) VALUES (8)') ...
[ "def", "supports_transactions", "(", "self", ")", ":", "with", "self", ".", "connection", ".", "cursor", "(", ")", "as", "cursor", ":", "cursor", ".", "execute", "(", "'CREATE TABLE ROLLBACK_TEST (X INT)'", ")", "self", ".", "connection", ".", "set_autocommit", ...
[ 233, 4 ]
[ 244, 25 ]
python
en
['en', 'en', 'en']
True
BaseDatabaseFeatures.supports_stddev
(self)
Confirm support for STDDEV and related stats functions.
Confirm support for STDDEV and related stats functions.
def supports_stddev(self): """Confirm support for STDDEV and related stats functions.""" try: self.connection.ops.check_expression_support(StdDev(1)) return True except NotImplementedError: return False
[ "def", "supports_stddev", "(", "self", ")", ":", "try", ":", "self", ".", "connection", ".", "ops", ".", "check_expression_support", "(", "StdDev", "(", "1", ")", ")", "return", "True", "except", "NotImplementedError", ":", "return", "False" ]
[ 247, 4 ]
[ 253, 24 ]
python
en
['en', 'en', 'en']
True
BaseDatabaseFeatures.introspected_boolean_field_type
(self, field=None, created_separately=False)
What is the type returned when the backend introspects a BooleanField? The optional arguments may be used to give further details of the field to be introspected; in particular, they are provided by Django's test suite: field -- the field definition created_separately -- True if...
What is the type returned when the backend introspects a BooleanField? The optional arguments may be used to give further details of the field to be introspected; in particular, they are provided by Django's test suite: field -- the field definition created_separately -- True if...
def introspected_boolean_field_type(self, field=None, created_separately=False): """ What is the type returned when the backend introspects a BooleanField? The optional arguments may be used to give further details of the field to be introspected; in particular, they are provided by Djan...
[ "def", "introspected_boolean_field_type", "(", "self", ",", "field", "=", "None", ",", "created_separately", "=", "False", ")", ":", "if", "self", ".", "can_introspect_null", "and", "field", "and", "field", ".", "null", ":", "return", "'NullBooleanField'", "retu...
[ 255, 4 ]
[ 270, 29 ]
python
en
['en', 'error', 'th']
False
test_activity_stream_related
()
If this test failed with content in `missing_models`, that means that a model has been connected to the activity stream, but the model has not been added to the activity stream serializer. How to fix this: Ideally, all models should be in awx.api.serializers.SUMMARIZABLE_FK_FIELDS If, for wha...
If this test failed with content in `missing_models`, that means that a model has been connected to the activity stream, but the model has not been added to the activity stream serializer.
def test_activity_stream_related(): """ If this test failed with content in `missing_models`, that means that a model has been connected to the activity stream, but the model has not been added to the activity stream serializer. How to fix this: Ideally, all models should be in awx.api.serializ...
[ "def", "test_activity_stream_related", "(", ")", ":", "serializer_related", "=", "set", "(", "ActivityStream", ".", "_meta", ".", "get_field", "(", "field_name", ")", ".", "related_model", "for", "field_name", ",", "stuff", "in", "ActivityStreamSerializer", "(", "...
[ 7, 0 ]
[ 30, 29 ]
python
en
['en', 'error', 'th']
False
parse_html
(html)
Takes a string that contains *valid* HTML and turns it into a Python object structure that can be easily compared against other HTML on semantic equivalence. Syntactical differences like which quotation is used on arguments will be ignored.
Takes a string that contains *valid* HTML and turns it into a Python object structure that can be easily compared against other HTML on semantic equivalence. Syntactical differences like which quotation is used on arguments will be ignored.
def parse_html(html): """ Takes a string that contains *valid* HTML and turns it into a Python object structure that can be easily compared against other HTML on semantic equivalence. Syntactical differences like which quotation is used on arguments will be ignored. """ parser = Parser() ...
[ "def", "parse_html", "(", "html", ")", ":", "parser", "=", "Parser", "(", ")", "parser", ".", "feed", "(", "html", ")", "parser", ".", "close", "(", ")", "document", "=", "parser", ".", "root", "document", ".", "finalize", "(", ")", "# Removing ROOT el...
[ 224, 0 ]
[ 240, 19 ]
python
en
['en', 'error', 'th']
False
deepcopy
(x)
Deep copy operation on gyp objects such as strings, ints, dicts and lists. More than twice as fast as copy.deepcopy but much less generic.
Deep copy operation on gyp objects such as strings, ints, dicts and lists. More than twice as fast as copy.deepcopy but much less generic.
def deepcopy(x): """Deep copy operation on gyp objects such as strings, ints, dicts and lists. More than twice as fast as copy.deepcopy but much less generic.""" try: return _deepcopy_dispatch[type(x)](x) except KeyError: raise Error( "Unsupported type %s for deepcopy. Use c...
[ "def", "deepcopy", "(", "x", ")", ":", "try", ":", "return", "_deepcopy_dispatch", "[", "type", "(", "x", ")", "]", "(", "x", ")", "except", "KeyError", ":", "raise", "Error", "(", "\"Unsupported type %s for deepcopy. Use copy.deepcopy \"", "+", "\"or expand sim...
[ 17, 0 ]
[ 28, 9 ]
python
en
['en', 'en', 'en']
True
RegisterPythonwin
(register=True)
Add (or remove) Pythonwin to context menu for python scripts. ??? Should probably also add Edit command for pys files also. Also need to remove these keys on uninstall, but there's no function like file_created to add registry entries to uninstall log ???
Add (or remove) Pythonwin to context menu for python scripts. ??? Should probably also add Edit command for pys files also. Also need to remove these keys on uninstall, but there's no function like file_created to add registry entries to uninstall log ???
def RegisterPythonwin(register=True): """ Add (or remove) Pythonwin to context menu for python scripts. ??? Should probably also add Edit command for pys files also. Also need to remove these keys on uninstall, but there's no function like file_created to add registry entries to uninstal...
[ "def", "RegisterPythonwin", "(", "register", "=", "True", ")", ":", "import", "os", "lib_dir", "=", "distutils", ".", "sysconfig", ".", "get_python_lib", "(", "plat_specific", "=", "1", ")", "classes_root", "=", "get_root_hkey", "(", ")", "## Installer executabl...
[ 204, 0 ]
[ 245, 92 ]
python
en
['en', 'en', 'en']
True
AbstractSeleniumExecutor.get_virtual_display
(self)
Return virtual display instance, if any. :return:
Return virtual display instance, if any. :return:
def get_virtual_display(self): """ Return virtual display instance, if any. :return: """ pass
[ "def", "get_virtual_display", "(", "self", ")", ":", "pass" ]
[ 32, 4 ]
[ 37, 12 ]
python
en
['en', 'error', 'th']
False
AbstractSeleniumExecutor.add_env
(self, env)
Add environment variables into selenium process env :type env: dict[str,str]
Add environment variables into selenium process env :type env: dict[str,str]
def add_env(self, env): # compatibility with taurus-server """ Add environment variables into selenium process env :type env: dict[str,str] """ pass
[ "def", "add_env", "(", "self", ",", "env", ")", ":", "# compatibility with taurus-server", "pass" ]
[ 40, 4 ]
[ 45, 12 ]
python
en
['en', 'error', 'th']
False
AbstractSeleniumExecutor.subscribe_to_transactions
(self, listener)
Subscribe to iteration events :type listener: bzt.modules.TransactionListener
Subscribe to iteration events :type listener: bzt.modules.TransactionListener
def subscribe_to_transactions(self, listener): """ Subscribe to iteration events :type listener: bzt.modules.TransactionListener """ pass
[ "def", "subscribe_to_transactions", "(", "self", ",", "listener", ")", ":", "pass" ]
[ 48, 4 ]
[ 53, 12 ]
python
en
['en', 'error', 'th']
False
SeleniumExecutor.startup
(self)
Start runner :return:
Start runner :return:
def startup(self): """ Start runner :return: """ self.start_time = time.time() self.runner.startup()
[ "def", "startup", "(", "self", ")", ":", "self", ".", "start_time", "=", "time", ".", "time", "(", ")", "self", ".", "runner", ".", "startup", "(", ")" ]
[ 186, 4 ]
[ 192, 29 ]
python
en
['en', 'error', 'th']
False
SeleniumExecutor.check
(self)
check if test completed :return:
check if test completed :return:
def check(self): """ check if test completed :return: """ if self.widget: self.widget.update() return self.runner.check()
[ "def", "check", "(", "self", ")", ":", "if", "self", ".", "widget", ":", "self", ".", "widget", ".", "update", "(", ")", "return", "self", ".", "runner", ".", "check", "(", ")" ]
[ 194, 4 ]
[ 202, 34 ]
python
en
['en', 'error', 'th']
False
SeleniumExecutor.shutdown
(self)
shutdown test_runner :return:
shutdown test_runner :return:
def shutdown(self): """ shutdown test_runner :return: """ self.runner.shutdown() self.report_test_duration()
[ "def", "shutdown", "(", "self", ")", ":", "self", ".", "runner", ".", "shutdown", "(", ")", "self", ".", "report_test_duration", "(", ")" ]
[ 209, 4 ]
[ 215, 35 ]
python
en
['en', 'error', 'th']
False
XmlToString
(content, encoding="utf-8", pretty=False)
Writes the XML content to disk, touching the file only if it has changed. Visual Studio files have a lot of pre-defined structures. This function makes it easy to represent these structures as Python data structures, instead of having to create a lot of function calls. Each XML element of the content is rep...
Writes the XML content to disk, touching the file only if it has changed.
def XmlToString(content, encoding="utf-8", pretty=False): """ Writes the XML content to disk, touching the file only if it has changed. Visual Studio files have a lot of pre-defined structures. This function makes it easy to represent these structures as Python data structures, instead of having to create a...
[ "def", "XmlToString", "(", "content", ",", "encoding", "=", "\"utf-8\"", ",", "pretty", "=", "False", ")", ":", "# We create a huge list of all the elements of the file.", "xml_parts", "=", "[", "'<?xml version=\"1.0\" encoding=\"%s\"?>'", "%", "encoding", "]", "if", "p...
[ 10, 0 ]
[ 55, 29 ]
python
en
['en', 'en', 'en']
True
_ConstructContentList
(xml_parts, specification, pretty, level=0)
Appends the XML parts corresponding to the specification. Args: xml_parts: A list of XML parts to be appended to. specification: The specification of the element. See EasyXml docs. pretty: True if we want pretty printing with indents and new lines. level: Indentation level.
Appends the XML parts corresponding to the specification.
def _ConstructContentList(xml_parts, specification, pretty, level=0): """ Appends the XML parts corresponding to the specification. Args: xml_parts: A list of XML parts to be appended to. specification: The specification of the element. See EasyXml docs. pretty: True if we want pretty printing with...
[ "def", "_ConstructContentList", "(", "xml_parts", ",", "specification", ",", "pretty", ",", "level", "=", "0", ")", ":", "# The first item in a specification is the name of the element.", "if", "pretty", ":", "indentation", "=", "\" \"", "*", "level", "new_line", "="...
[ 58, 0 ]
[ 105, 43 ]
python
en
['en', 'en', 'en']
True
WriteXmlIfChanged
(content, path, encoding="utf-8", pretty=False, win32=False)
Writes the XML content to disk, touching the file only if it has changed. Args: content: The structured content to be written. path: Location of the file. encoding: The encoding to report on the first line of the XML file. pretty: True if we want pretty printing with indents and new lines.
Writes the XML content to disk, touching the file only if it has changed.
def WriteXmlIfChanged(content, path, encoding="utf-8", pretty=False, win32=False): """ Writes the XML content to disk, touching the file only if it has changed. Args: content: The structured content to be written. path: Location of the file. encoding: The encoding to report on the first line of the ...
[ "def", "WriteXmlIfChanged", "(", "content", ",", "path", ",", "encoding", "=", "\"utf-8\"", ",", "pretty", "=", "False", ",", "win32", "=", "False", ")", ":", "xml_string", "=", "XmlToString", "(", "content", ",", "encoding", ",", "pretty", ")", "if", "w...
[ 108, 0 ]
[ 135, 34 ]
python
en
['en', 'en', 'en']
True
_XmlEscape
(value, attr=False)
Escape a string for inclusion in XML.
Escape a string for inclusion in XML.
def _XmlEscape(value, attr=False): """ Escape a string for inclusion in XML.""" def replace(match): m = match.string[match.start() : match.end()] # don't replace single quotes in attrs if attr and m == "'": return m return _xml_escape_map[m] return _xml_escape_r...
[ "def", "_XmlEscape", "(", "value", ",", "attr", "=", "False", ")", ":", "def", "replace", "(", "match", ")", ":", "m", "=", "match", ".", "string", "[", "match", ".", "start", "(", ")", ":", "match", ".", "end", "(", ")", "]", "# don't replace sing...
[ 152, 0 ]
[ 162, 45 ]
python
en
['en', 'it', 'en']
True
QuoteShellArgument
(arg, flavor)
Quote a string such that it will be interpreted as a single argument by the shell.
Quote a string such that it will be interpreted as a single argument by the shell.
def QuoteShellArgument(arg, flavor): """Quote a string such that it will be interpreted as a single argument by the shell.""" # Rather than attempting to enumerate the bad shell characters, just # allow common OK ones and quote anything else. if re.match(r"^[a-zA-Z0-9_=.\\/-]+$", arg): return ...
[ "def", "QuoteShellArgument", "(", "arg", ",", "flavor", ")", ":", "# Rather than attempting to enumerate the bad shell characters, just", "# allow common OK ones and quote anything else.", "if", "re", ".", "match", "(", "r\"^[a-zA-Z0-9_=.\\\\/-]+$\"", ",", "arg", ")", ":", "r...
[ 76, 0 ]
[ 85, 59 ]
python
en
['en', 'en', 'en']
True
Define
(d, flavor)
Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.
Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.
def Define(d, flavor): """Takes a preprocessor define and returns a -D parameter that's ninja- and shell-escaped.""" if flavor == "win": # cl.exe replaces literal # characters with = in preprocessor definitions for # some reason. Octal-encode to work around that. d = d.replace("#", "\\...
[ "def", "Define", "(", "d", ",", "flavor", ")", ":", "if", "flavor", "==", "\"win\"", ":", "# cl.exe replaces literal # characters with = in preprocessor definitions for", "# some reason. Octal-encode to work around that.", "d", "=", "d", ".", "replace", "(", "\"#\"", ",",...
[ 88, 0 ]
[ 95, 68 ]
python
en
['en', 'en', 'en']
True
AddArch
(output, arch)
Adds an arch string to an output path.
Adds an arch string to an output path.
def AddArch(output, arch): """Adds an arch string to an output path.""" output, extension = os.path.splitext(output) return "%s.%s%s" % (output, arch, extension)
[ "def", "AddArch", "(", "output", ",", "arch", ")", ":", "output", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "output", ")", "return", "\"%s.%s%s\"", "%", "(", "output", ",", "arch", ",", "extension", ")" ]
[ 98, 0 ]
[ 101, 48 ]
python
en
['en', 'en', 'en']
True
CalculateVariables
(default_variables, params)
Calculate additional variables for use in the build (called by gyp).
Calculate additional variables for use in the build (called by gyp).
def CalculateVariables(default_variables, params): """Calculate additional variables for use in the build (called by gyp).""" global generator_additional_non_configuration_keys global generator_additional_path_sections flavor = gyp.common.GetFlavor(params) if flavor == "mac": default_variabl...
[ "def", "CalculateVariables", "(", "default_variables", ",", "params", ")", ":", "global", "generator_additional_non_configuration_keys", "global", "generator_additional_path_sections", "flavor", "=", "gyp", ".", "common", ".", "GetFlavor", "(", "params", ")", "if", "fla...
[ 1989, 0 ]
[ 2048, 85 ]
python
en
['en', 'en', 'en']
True
ComputeOutputDir
(params)
Returns the path from the toplevel_dir to the build output directory.
Returns the path from the toplevel_dir to the build output directory.
def ComputeOutputDir(params): """Returns the path from the toplevel_dir to the build output directory.""" # generator_dir: relative path from pwd to where make puts build files. # Makes migrating from make to ninja easier, ninja doesn't put anything here. generator_dir = os.path.relpath(params["options"...
[ "def", "ComputeOutputDir", "(", "params", ")", ":", "# generator_dir: relative path from pwd to where make puts build files.", "# Makes migrating from make to ninja easier, ninja doesn't put anything here.", "generator_dir", "=", "os", ".", "path", ".", "relpath", "(", "params", "[...
[ 2051, 0 ]
[ 2061, 68 ]
python
en
['en', 'en', 'en']
True
CalculateGeneratorInputInfo
(params)
Called by __init__ to initialize generator values based on params.
Called by __init__ to initialize generator values based on params.
def CalculateGeneratorInputInfo(params): """Called by __init__ to initialize generator values based on params.""" # E.g. "out/gypfiles" toplevel = params["options"].toplevel_dir qualified_out_dir = os.path.normpath( os.path.join(toplevel, ComputeOutputDir(params), "gypfiles") ) global g...
[ "def", "CalculateGeneratorInputInfo", "(", "params", ")", ":", "# E.g. \"out/gypfiles\"", "toplevel", "=", "params", "[", "\"options\"", "]", ".", "toplevel_dir", "qualified_out_dir", "=", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "join", ...
[ 2064, 0 ]
[ 2076, 5 ]
python
en
['en', 'en', 'en']
True
OpenOutput
(path, mode="w")
Open |path| for writing, creating directories if necessary.
Open |path| for writing, creating directories if necessary.
def OpenOutput(path, mode="w"): """Open |path| for writing, creating directories if necessary.""" gyp.common.EnsureDirExists(path) return open(path, mode)
[ "def", "OpenOutput", "(", "path", ",", "mode", "=", "\"w\"", ")", ":", "gyp", ".", "common", ".", "EnsureDirExists", "(", "path", ")", "return", "open", "(", "path", ",", "mode", ")" ]
[ 2079, 0 ]
[ 2082, 27 ]
python
en
['id', 'en', 'en']
True
GetDefaultConcurrentLinks
()
Returns a best-guess for a number of concurrent links.
Returns a best-guess for a number of concurrent links.
def GetDefaultConcurrentLinks(): """Returns a best-guess for a number of concurrent links.""" pool_size = int(os.environ.get("GYP_LINK_CONCURRENCY", 0)) if pool_size: return pool_size if sys.platform in ("win32", "cygwin"): import ctypes class MEMORYSTATUSEX(ctypes.Structure): ...
[ "def", "GetDefaultConcurrentLinks", "(", ")", ":", "pool_size", "=", "int", "(", "os", ".", "environ", ".", "get", "(", "\"GYP_LINK_CONCURRENCY\"", ",", "0", ")", ")", "if", "pool_size", ":", "return", "pool_size", "if", "sys", ".", "platform", "in", "(", ...
[ 2092, 0 ]
[ 2144, 16 ]
python
en
['en', 'en', 'en']
True
_GetWinLinkRuleNameSuffix
(embed_manifest)
Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.
Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.
def _GetWinLinkRuleNameSuffix(embed_manifest): """Returns the suffix used to select an appropriate linking rule depending on whether the manifest embedding is enabled.""" return "_embed" if embed_manifest else ""
[ "def", "_GetWinLinkRuleNameSuffix", "(", "embed_manifest", ")", ":", "return", "\"_embed\"", "if", "embed_manifest", "else", "\"\"" ]
[ 2147, 0 ]
[ 2150, 45 ]
python
en
['en', 'en', 'en']
True
_AddWinLinkRules
(master_ninja, embed_manifest)
Adds link rules for Windows platform to |master_ninja|.
Adds link rules for Windows platform to |master_ninja|.
def _AddWinLinkRules(master_ninja, embed_manifest): """Adds link rules for Windows platform to |master_ninja|.""" def FullLinkCommand(ldcmd, out, binary_type): resource_name = {"exe": "1", "dll": "2"}[binary_type] return ( "%(python)s gyp-win-tool link-with-manifests $arch %(embed)s...
[ "def", "_AddWinLinkRules", "(", "master_ninja", ",", "embed_manifest", ")", ":", "def", "FullLinkCommand", "(", "ldcmd", ",", "out", ",", "binary_type", ")", ":", "resource_name", "=", "{", "\"exe\"", ":", "\"1\"", ",", "\"dll\"", ":", "\"2\"", "}", "[", "...
[ 2153, 0 ]
[ 2213, 5 ]
python
en
['en', 'da', 'en']
True
Target.Linkable
(self)
Return true if this is a target that can be linked against.
Return true if this is a target that can be linked against.
def Linkable(self): """Return true if this is a target that can be linked against.""" return self.type in ("static_library", "shared_library")
[ "def", "Linkable", "(", "self", ")", ":", "return", "self", ".", "type", "in", "(", "\"static_library\"", ",", "\"shared_library\"", ")" ]
[ 159, 4 ]
[ 161, 64 ]
python
en
['en', 'en', 'en']
True
Target.UsesToc
(self, flavor)
Return true if the target should produce a restat rule based on a TOC file.
Return true if the target should produce a restat rule based on a TOC file.
def UsesToc(self, flavor): """Return true if the target should produce a restat rule based on a TOC file.""" # For bundles, the .TOC should be produced for the binary, not for # FinalOutput(). But the naive approach would put the TOC file into the # bundle, so don't do this for bundl...
[ "def", "UsesToc", "(", "self", ",", "flavor", ")", ":", "# For bundles, the .TOC should be produced for the binary, not for", "# FinalOutput(). But the naive approach would put the TOC file into the", "# bundle, so don't do this for bundles for now.", "if", "flavor", "==", "\"win\"", "...
[ 163, 4 ]
[ 171, 65 ]
python
en
['en', 'en', 'en']
True
Target.PreActionInput
(self, flavor)
Return the path, if any, that should be used as a dependency of any dependent action step.
Return the path, if any, that should be used as a dependency of any dependent action step.
def PreActionInput(self, flavor): """Return the path, if any, that should be used as a dependency of any dependent action step.""" if self.UsesToc(flavor): return self.FinalOutput() + ".TOC" return self.FinalOutput() or self.preaction_stamp
[ "def", "PreActionInput", "(", "self", ",", "flavor", ")", ":", "if", "self", ".", "UsesToc", "(", "flavor", ")", ":", "return", "self", ".", "FinalOutput", "(", ")", "+", "\".TOC\"", "return", "self", ".", "FinalOutput", "(", ")", "or", "self", ".", ...
[ 173, 4 ]
[ 178, 57 ]
python
en
['en', 'en', 'en']
True
Target.PreCompileInput
(self)
Return the path, if any, that should be used as a dependency of any dependent compile step.
Return the path, if any, that should be used as a dependency of any dependent compile step.
def PreCompileInput(self): """Return the path, if any, that should be used as a dependency of any dependent compile step.""" return self.actions_stamp or self.precompile_stamp
[ "def", "PreCompileInput", "(", "self", ")", ":", "return", "self", ".", "actions_stamp", "or", "self", ".", "precompile_stamp" ]
[ 180, 4 ]
[ 183, 58 ]
python
en
['en', 'en', 'en']
True
Target.FinalOutput
(self)
Return the last output of the target, which depends on all prior steps.
Return the last output of the target, which depends on all prior steps.
def FinalOutput(self): """Return the last output of the target, which depends on all prior steps.""" return self.bundle or self.binary or self.actions_stamp
[ "def", "FinalOutput", "(", "self", ")", ":", "return", "self", ".", "bundle", "or", "self", ".", "binary", "or", "self", ".", "actions_stamp" ]
[ 185, 4 ]
[ 188, 63 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.__init__
( self, hash_for_rules, target_outputs, base_dir, build_dir, output_file, toplevel_build, output_file_name, flavor, toplevel_dir=None, )
base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative to this build_dir: path from source root to build output toplevel_dir: path to the toplevel directory
base_dir: path from source root to directory containing this gyp file, by gyp semantics, all input paths are relative to this build_dir: path from source root to build output toplevel_dir: path to the toplevel directory
def __init__( self, hash_for_rules, target_outputs, base_dir, build_dir, output_file, toplevel_build, output_file_name, flavor, toplevel_dir=None, ): """ base_dir: path from source root to directory containing this gyp file,...
[ "def", "__init__", "(", "self", ",", "hash_for_rules", ",", "target_outputs", ",", "base_dir", ",", "build_dir", ",", "output_file", ",", "toplevel_build", ",", "output_file_name", ",", "flavor", ",", "toplevel_dir", "=", "None", ",", ")", ":", "self", ".", ...
[ 217, 4 ]
[ 260, 65 ]
python
en
['en', 'error', 'th']
False
NinjaWriter.ExpandSpecial
(self, path, product_dir=None)
Expand specials like $!PRODUCT_DIR in |path|. If |product_dir| is None, assumes the cwd is already the product dir. Otherwise, |product_dir| is the relative path to the product dir.
Expand specials like $!PRODUCT_DIR in |path|.
def ExpandSpecial(self, path, product_dir=None): """Expand specials like $!PRODUCT_DIR in |path|. If |product_dir| is None, assumes the cwd is already the product dir. Otherwise, |product_dir| is the relative path to the product dir. """ PRODUCT_DIR = "$!PRODUCT_DIR" if PRODUC...
[ "def", "ExpandSpecial", "(", "self", ",", "path", ",", "product_dir", "=", "None", ")", ":", "PRODUCT_DIR", "=", "\"$!PRODUCT_DIR\"", "if", "PRODUCT_DIR", "in", "path", ":", "if", "product_dir", ":", "path", "=", "path", ".", "replace", "(", "PRODUCT_DIR", ...
[ 262, 4 ]
[ 291, 19 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GypPathToNinja
(self, path, env=None)
Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|. See the above discourse on path conversions.
Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|.
def GypPathToNinja(self, path, env=None): """Translate a gyp path to a ninja path, optionally expanding environment variable references in |path| with |env|. See the above discourse on path conversions.""" if env: if self.flavor == "mac": path = gyp.xcode_emulation.E...
[ "def", "GypPathToNinja", "(", "self", ",", "path", ",", "env", "=", "None", ")", ":", "if", "env", ":", "if", "self", ".", "flavor", "==", "\"mac\"", ":", "path", "=", "gyp", ".", "xcode_emulation", ".", "ExpandEnvVars", "(", "path", ",", "env", ")",...
[ 303, 4 ]
[ 321, 71 ]
python
en
['en', 'haw', 'en']
True
NinjaWriter.GypPathToUniqueOutput
(self, path, qualified=True)
Translate a gyp path to a ninja path for writing output. If qualified is True, qualify the resulting filename with the name of the target. This is necessary when e.g. compiling the same path twice for two separate output targets. See the above discourse on path conversions.
Translate a gyp path to a ninja path for writing output.
def GypPathToUniqueOutput(self, path, qualified=True): """Translate a gyp path to a ninja path for writing output. If qualified is True, qualify the resulting filename with the name of the target. This is necessary when e.g. compiling the same path twice for two separate output targets. See t...
[ "def", "GypPathToUniqueOutput", "(", "self", ",", "path", ",", "qualified", "=", "True", ")", ":", "path", "=", "self", ".", "ExpandSpecial", "(", "path", ")", "assert", "not", "path", ".", "startswith", "(", "\"$\"", ")", ",", "path", "# Translate the pat...
[ 323, 4 ]
[ 359, 9 ]
python
en
['en', 'haw', 'en']
True
NinjaWriter.WriteCollapsedDependencies
(self, name, targets, order_only=None)
Given a list of targets, return a path for a single file representing the result of building all the targets or None. Uses a stamp file if necessary.
Given a list of targets, return a path for a single file representing the result of building all the targets or None.
def WriteCollapsedDependencies(self, name, targets, order_only=None): """Given a list of targets, return a path for a single file representing the result of building all the targets or None. Uses a stamp file if necessary.""" assert targets == [item for item in targets if item], targets ...
[ "def", "WriteCollapsedDependencies", "(", "self", ",", "name", ",", "targets", ",", "order_only", "=", "None", ")", ":", "assert", "targets", "==", "[", "item", "for", "item", "in", "targets", "if", "item", "]", ",", "targets", "if", "len", "(", "targets...
[ 361, 4 ]
[ 375, 25 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteSpec
(self, spec, config_name, generator_flags)
The main entry point for NinjaWriter: write the build rules for a spec. Returns a Target object, which represents the output paths for this spec. Returns None if there are no outputs (e.g. a settings-only 'none' type target).
The main entry point for NinjaWriter: write the build rules for a spec.
def WriteSpec(self, spec, config_name, generator_flags): """The main entry point for NinjaWriter: write the build rules for a spec. Returns a Target object, which represents the output paths for this spec. Returns None if there are no outputs (e.g. a settings-only 'none' type target).""" s...
[ "def", "WriteSpec", "(", "self", ",", "spec", ",", "config_name", ",", "generator_flags", ")", ":", "self", ".", "config_name", "=", "config_name", "self", ".", "name", "=", "spec", "[", "\"target_name\"", "]", "self", ".", "toolset", "=", "spec", "[", "...
[ 381, 4 ]
[ 556, 26 ]
python
en
['en', 'en', 'en']
True
NinjaWriter._WinIdlRule
(self, source, prebuild, outputs)
Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.
Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.
def _WinIdlRule(self, source, prebuild, outputs): """Handle the implicit VS .idl rule for one source file. Fills |outputs| with files that are generated.""" outdir, output, vars, flags = self.msvs_settings.GetIdlBuildData( source, self.config_name ) outdir = self.GypPathT...
[ "def", "_WinIdlRule", "(", "self", ",", "source", ",", "prebuild", ",", "outputs", ")", ":", "outdir", ",", "output", ",", "vars", ",", "flags", "=", "self", ".", "msvs_settings", ".", "GetIdlBuildData", "(", "source", ",", "self", ".", "config_name", ")...
[ 558, 4 ]
[ 581, 30 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteWinIdlFiles
(self, spec, prebuild)
Writes rules to match MSVS's implicit idl handling.
Writes rules to match MSVS's implicit idl handling.
def WriteWinIdlFiles(self, spec, prebuild): """Writes rules to match MSVS's implicit idl handling.""" assert self.flavor == "win" if self.msvs_settings.HasExplicitIdlRulesOrActions(spec): return [] outputs = [] for source in filter(lambda x: x.endswith(".idl"), spec["...
[ "def", "WriteWinIdlFiles", "(", "self", ",", "spec", ",", "prebuild", ")", ":", "assert", "self", ".", "flavor", "==", "\"win\"", "if", "self", ".", "msvs_settings", ".", "HasExplicitIdlRulesOrActions", "(", "spec", ")", ":", "return", "[", "]", "outputs", ...
[ 583, 4 ]
[ 591, 22 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteActionsRulesCopies
( self, spec, extra_sources, prebuild, mac_bundle_depends )
Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.
Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.
def WriteActionsRulesCopies( self, spec, extra_sources, prebuild, mac_bundle_depends ): """Write out the Actions, Rules, and Copies steps. Return a path representing the outputs of these steps.""" outputs = [] if self.is_mac_bundle: mac_bundle_resources = spec.get("m...
[ "def", "WriteActionsRulesCopies", "(", "self", ",", "spec", ",", "extra_sources", ",", "prebuild", ",", "mac_bundle_depends", ")", ":", "outputs", "=", "[", "]", "if", "self", ".", "is_mac_bundle", ":", "mac_bundle_resources", "=", "spec", ".", "get", "(", "...
[ 593, 4 ]
[ 635, 20 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GenerateDescription
(self, verb, message, fallback)
Generate and return a description of a build step. |verb| is the short summary, e.g. ACTION or RULE. |message| is a hand-written description, or None if not available. |fallback| is the gyp-level name of the step, usable as a fallback.
Generate and return a description of a build step.
def GenerateDescription(self, verb, message, fallback): """Generate and return a description of a build step. |verb| is the short summary, e.g. ACTION or RULE. |message| is a hand-written description, or None if not available. |fallback| is the gyp-level name of the step, usable as a fallback. ...
[ "def", "GenerateDescription", "(", "self", ",", "verb", ",", "message", ",", "fallback", ")", ":", "if", "self", ".", "toolset", "!=", "\"target\"", ":", "verb", "+=", "\"(%s)\"", "%", "self", ".", "toolset", "if", "message", ":", "return", "\"%s %s\"", ...
[ 637, 4 ]
[ 649, 60 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteiOSFrameworkHeaders
(self, spec, outputs, prebuild)
Prebuild steps to generate hmap files and copy headers to destination.
Prebuild steps to generate hmap files and copy headers to destination.
def WriteiOSFrameworkHeaders(self, spec, outputs, prebuild): """Prebuild steps to generate hmap files and copy headers to destination.""" framework = self.ComputeMacBundleOutput() all_sources = spec["sources"] copy_headers = spec["mac_framework_headers"] output = self.GypPathToUn...
[ "def", "WriteiOSFrameworkHeaders", "(", "self", ",", "spec", ",", "outputs", ",", "prebuild", ")", ":", "framework", "=", "self", ".", "ComputeMacBundleOutput", "(", ")", "all_sources", "=", "spec", "[", "\"sources\"", "]", "copy_headers", "=", "spec", "[", ...
[ 869, 4 ]
[ 891, 9 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteMacBundleResources
(self, resources, bundle_depends)
Writes ninja edges for 'mac_bundle_resources'.
Writes ninja edges for 'mac_bundle_resources'.
def WriteMacBundleResources(self, resources, bundle_depends): """Writes ninja edges for 'mac_bundle_resources'.""" xcassets = [] extra_env = self.xcode_settings.GetPerTargetSettings() env = self.GetSortedXcodeEnv(additional_settings=extra_env) env = self.ComputeExportEnvString(e...
[ "def", "WriteMacBundleResources", "(", "self", ",", "resources", ",", "bundle_depends", ")", ":", "xcassets", "=", "[", "]", "extra_env", "=", "self", ".", "xcode_settings", ".", "GetPerTargetSettings", "(", ")", "env", "=", "self", ".", "GetSortedXcodeEnv", "...
[ 893, 4 ]
[ 922, 23 ]
python
en
['nn', 'jv', 'en']
False
NinjaWriter.WriteMacXCassets
(self, xcassets, bundle_depends)
Writes ninja edges for 'mac_bundle_resources' .xcassets files. This add an invocation of 'actool' via the 'mac_tool.py' helper script. It assumes that the assets catalogs define at least one imageset and thus an Assets.car file will be generated in the application resources directory. If this is not th...
Writes ninja edges for 'mac_bundle_resources' .xcassets files.
def WriteMacXCassets(self, xcassets, bundle_depends): """Writes ninja edges for 'mac_bundle_resources' .xcassets files. This add an invocation of 'actool' via the 'mac_tool.py' helper script. It assumes that the assets catalogs define at least one imageset and thus an Assets.car file will be genera...
[ "def", "WriteMacXCassets", "(", "self", ",", "xcassets", ",", "bundle_depends", ")", ":", "if", "not", "xcassets", ":", "return", "extra_arguments", "=", "{", "}", "settings_to_arg", "=", "{", "\"XCASSETS_APP_ICON\"", ":", "\"app-icon\"", ",", "\"XCASSETS_LAUNCH_I...
[ 924, 4 ]
[ 973, 33 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteMacInfoPlist
(self, partial_info_plist, bundle_depends)
Write build rules for bundle Info.plist files.
Write build rules for bundle Info.plist files.
def WriteMacInfoPlist(self, partial_info_plist, bundle_depends): """Write build rules for bundle Info.plist files.""" info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist( generator_default_variables["PRODUCT_DIR"], self.xcode_settings, self.GypPa...
[ "def", "WriteMacInfoPlist", "(", "self", ",", "partial_info_plist", ",", "bundle_depends", ")", ":", "info_plist", ",", "out", ",", "defines", ",", "extra_env", "=", "gyp", ".", "xcode_emulation", ".", "GetMacInfoPlist", "(", "generator_default_variables", "[", "\...
[ 975, 4 ]
[ 1016, 34 ]
python
en
['en', 'fr', 'en']
True
NinjaWriter.WriteSources
( self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, )
Write build rules to compile all of |sources|.
Write build rules to compile all of |sources|.
def WriteSources( self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, ): """Write build rules to compile all of |sources|.""" if self.toolset == "host": self.ninja.variable("ar", "$ar_host")...
[ "def", "WriteSources", "(", "self", ",", "ninja_file", ",", "config_name", ",", "config", ",", "sources", ",", "predepends", ",", "precompiled_header", ",", "spec", ",", ")", ":", "if", "self", ".", "toolset", "==", "\"host\"", ":", "self", ".", "ninja", ...
[ 1018, 4 ]
[ 1064, 13 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteSourcesForArch
( self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, arch=None, )
Write build rules to compile all of |sources|.
Write build rules to compile all of |sources|.
def WriteSourcesForArch( self, ninja_file, config_name, config, sources, predepends, precompiled_header, spec, arch=None, ): """Write build rules to compile all of |sources|.""" extra_defines = [] if self.flavor == "mac...
[ "def", "WriteSourcesForArch", "(", "self", ",", "ninja_file", ",", "config_name", ",", "config", ",", "sources", ",", "predepends", ",", "precompiled_header", ",", "spec", ",", "arch", "=", "None", ",", ")", ":", "extra_defines", "=", "[", "]", "if", "self...
[ 1066, 4 ]
[ 1292, 22 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WritePchTargets
(self, ninja_file, pch_commands)
Writes ninja rules to compile prefix headers.
Writes ninja rules to compile prefix headers.
def WritePchTargets(self, ninja_file, pch_commands): """Writes ninja rules to compile prefix headers.""" if not pch_commands: return for gch, lang_flag, lang, input in pch_commands: var_name = { "c": "cflags_pch_c", "cc": "cflags_pch_cc", ...
[ "def", "WritePchTargets", "(", "self", ",", "ninja_file", ",", "pch_commands", ")", ":", "if", "not", "pch_commands", ":", "return", "for", "gch", ",", "lang_flag", ",", "lang", ",", "input", "in", "pch_commands", ":", "var_name", "=", "{", "\"c\"", ":", ...
[ 1294, 4 ]
[ 1314, 80 ]
python
en
['en', 'et', 'en']
True
NinjaWriter.WriteLink
(self, spec, config_name, config, link_deps, compile_deps)
Write out a link step. Fills out target.binary.
Write out a link step. Fills out target.binary.
def WriteLink(self, spec, config_name, config, link_deps, compile_deps): """Write out a link step. Fills out target.binary. """ if self.flavor != "mac" or len(self.archs) == 1: return self.WriteLinkForArch( self.ninja, spec, config_name, config, link_deps, compile_deps ...
[ "def", "WriteLink", "(", "self", ",", "spec", ",", "config_name", ",", "config", ",", "link_deps", ",", "compile_deps", ")", ":", "if", "self", ".", "flavor", "!=", "\"mac\"", "or", "len", "(", "self", ".", "archs", ")", "==", "1", ":", "return", "se...
[ 1316, 4 ]
[ 1356, 25 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.WriteLinkForArch
( self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None )
Write out a link step. Fills out target.binary.
Write out a link step. Fills out target.binary.
def WriteLinkForArch( self, ninja_file, spec, config_name, config, link_deps, compile_deps, arch=None ): """Write out a link step. Fills out target.binary. """ command = { "executable": "link", "loadable_module": "solink_module", "shared_library": "solink"...
[ "def", "WriteLinkForArch", "(", "self", ",", "ninja_file", ",", "spec", ",", "config_name", ",", "config", ",", "link_deps", ",", "compile_deps", ",", "arch", "=", "None", ")", ":", "command", "=", "{", "\"executable\"", ":", "\"link\"", ",", "\"loadable_mod...
[ 1358, 4 ]
[ 1575, 28 ]
python
en
['en', 'en', 'en']
True
NinjaWriter.GetToolchainEnv
(self, additional_settings=None)
Returns the variables toolchain would set for build steps.
Returns the variables toolchain would set for build steps.
def GetToolchainEnv(self, additional_settings=None): """Returns the variables toolchain would set for build steps.""" env = self.GetSortedXcodeEnv(additional_settings=additional_settings) if self.flavor == "win": env = self.GetMsvsToolchainEnv(additional_settings=additional_settings)...
[ "def", "GetToolchainEnv", "(", "self", ",", "additional_settings", "=", "None", ")", ":", "env", "=", "self", ".", "GetSortedXcodeEnv", "(", "additional_settings", "=", "additional_settings", ")", "if", "self", ".", "flavor", "==", "\"win\"", ":", "env", "=", ...
[ 1684, 4 ]
[ 1689, 18 ]
python
en
['en', 'en', 'en']
True