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
TestAllWorkflowNodes.workflow_all_converge_dnr
(self, wf_node_generator)
r''' 0 1 2 S \ F | / F \ | / \ | / \|/ | 3
r''' 0 1 2 S \ F | / F \ | / \ | / \|/ | 3
def workflow_all_converge_dnr(self, wf_node_generator): g = WorkflowDAG() nodes = [wf_node_generator() for i in range(4)] for n in nodes: g.add_node(n) r''' 0 1 2 S \ F | / F \ | / \ | / ...
[ "def", "workflow_all_converge_dnr", "(", "self", ",", "wf_node_generator", ")", ":", "g", "=", "WorkflowDAG", "(", ")", "nodes", "=", "[", "wf_node_generator", "(", ")", "for", "i", "in", "range", "(", "4", ")", "]", "for", "n", "in", "nodes", ":", "g"...
[ 283, 4 ]
[ 305, 25 ]
python
cy
['en', 'cy', 'hi']
False
TestAllWorkflowNodes.workflow_all_converge_deep_dnr_tree
(self, wf_node_generator)
r''' 0 1 2 \ | / S \ S| / F \ | / \|/ | 3 /\ S / \ S / \ 4| | 5 \ / S \ /...
r''' 0 1 2 \ | / S \ S| / F \ | / \|/ | 3 /\ S / \ S / \ 4| | 5 \ / S \ /...
def workflow_all_converge_deep_dnr_tree(self, wf_node_generator): g = WorkflowDAG() nodes = [wf_node_generator() for i in range(7)] for n in nodes: g.add_node(n) r''' 0 1 2 \ | / S \ S| / F \ | / ...
[ "def", "workflow_all_converge_deep_dnr_tree", "(", "self", ",", "wf_node_generator", ")", ":", "g", "=", "WorkflowDAG", "(", ")", "nodes", "=", "[", "wf_node_generator", "(", ")", "for", "i", "in", "range", "(", "7", ")", "]", "for", "n", "in", "nodes", ...
[ 337, 4 ]
[ 374, 25 ]
python
cy
['en', 'cy', 'hi']
False
TestIsWorkflowDone.workflow_dag_2
(self, workflow_dag_1)
r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | \/ W2
r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | \/ W2
def workflow_dag_2(self, workflow_dag_1): (g, nodes) = workflow_dag_1 r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | ...
[ "def", "workflow_dag_2", "(", "self", ",", "workflow_dag_1", ")", ":", "(", "g", ",", "nodes", ")", "=", "workflow_dag_1", "nodes", "[", "0", "]", ".", "job", "=", "Job", "(", "status", "=", "'successful'", ")", "g", ".", "mark_dnr_nodes", "(", ")", ...
[ 392, 4 ]
[ 414, 25 ]
python
cy
['en', 'cy', 'hi']
False
TestIsWorkflowDone.workflow_dag_failed
(self, workflow_dag_1)
r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | \/ F2
r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | \/ F2
def workflow_dag_failed(self, workflow_dag_1): (g, nodes) = workflow_dag_1 r''' S0 /\ S / \ / \ S1 | | | F | | S | | DNR 3 | \ | F \ | ...
[ "def", "workflow_dag_failed", "(", "self", ",", "workflow_dag_1", ")", ":", "(", "g", ",", "nodes", ")", "=", "workflow_dag_1", "nodes", "[", "0", "]", ".", "job", "=", "Job", "(", "status", "=", "'successful'", ")", "g", ".", "mark_dnr_nodes", "(", ")...
[ 417, 4 ]
[ 439, 25 ]
python
cy
['en', 'cy', 'hi']
False
TestIsWorkflowDone.workflow_dag_canceled
(self, wf_node_generator)
r''' F0
r''' F0
def workflow_dag_canceled(self, wf_node_generator): g = WorkflowDAG() nodes = [wf_node_generator() for i in range(1)] for n in nodes: g.add_node(n) r''' F0 ''' nodes[0].job = Job(status='canceled') return (g, nodes)
[ "def", "workflow_dag_canceled", "(", "self", ",", "wf_node_generator", ")", ":", "g", "=", "WorkflowDAG", "(", ")", "nodes", "=", "[", "wf_node_generator", "(", ")", "for", "i", "in", "range", "(", "1", ")", "]", "for", "n", "in", "nodes", ":", "g", ...
[ 442, 4 ]
[ 451, 25 ]
python
cy
['en', 'cy', 'hi']
False
TestBFSNodesToRun.workflow_dag_canceled
(self, wf_node_generator)
r''' C0 / | \ F / A| \ S / | \ 1 2 3
r''' C0 / | \ F / A| \ S / | \ 1 2 3
def workflow_dag_canceled(self, wf_node_generator): g = WorkflowDAG() nodes = [wf_node_generator() for i in range(4)] for n in nodes: g.add_node(n) r''' C0 / | \ F / A| \ S / | \ 1 2 3 ''' ...
[ "def", "workflow_dag_canceled", "(", "self", ",", "wf_node_generator", ")", ":", "g", "=", "WorkflowDAG", "(", ")", "nodes", "=", "[", "wf_node_generator", "(", ")", "for", "i", "in", "range", "(", "4", ")", "]", "for", "n", "in", "nodes", ":", "g", ...
[ 538, 4 ]
[ 554, 25 ]
python
cy
['en', 'cy', 'hi']
False
get_callable
(lookup_view)
Return a callable corresponding to lookup_view. * If lookup_view is already a callable, return it. * If lookup_view is a string import path that can be resolved to a callable, import that callable and return it, otherwise raise an exception (ImportError or ViewDoesNotExist).
Return a callable corresponding to lookup_view. * If lookup_view is already a callable, return it. * If lookup_view is a string import path that can be resolved to a callable, import that callable and return it, otherwise raise an exception (ImportError or ViewDoesNotExist).
def get_callable(lookup_view): """ Return a callable corresponding to lookup_view. * If lookup_view is already a callable, return it. * If lookup_view is a string import path that can be resolved to a callable, import that callable and return it, otherwise raise an exception (ImportError or ...
[ "def", "get_callable", "(", "lookup_view", ")", ":", "if", "callable", "(", "lookup_view", ")", ":", "return", "lookup_view", "if", "not", "isinstance", "(", "lookup_view", ",", "six", ".", "string_types", ")", ":", "raise", "ViewDoesNotExist", "(", "\"'%s' is...
[ 10, 0 ]
[ 53, 28 ]
python
en
['en', 'error', 'th']
False
register_adapter
(typ, callable)
Register 'callable' as an ISQLQuote adapter for type 'typ'.
Register 'callable' as an ISQLQuote adapter for type 'typ'.
def register_adapter(typ, callable): """Register 'callable' as an ISQLQuote adapter for type 'typ'.""" adapters[(typ, ISQLQuote)] = callable
[ "def", "register_adapter", "(", "typ", ",", "callable", ")", ":", "adapters", "[", "(", "typ", ",", "ISQLQuote", ")", "]", "=", "callable" ]
[ 104, 0 ]
[ 106, 41 ]
python
en
['en', 'en', 'en']
True
make_dsn
(dsn=None, **kwargs)
Convert a set of keywords into a connection strings.
Convert a set of keywords into a connection strings.
def make_dsn(dsn=None, **kwargs): """Convert a set of keywords into a connection strings.""" if dsn is None and not kwargs: return '' # If no kwarg is specified don't mung the dsn, but verify it if not kwargs: parse_dsn(dsn) return dsn # Override the dsn with the parameters...
[ "def", "make_dsn", "(", "dsn", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "dsn", "is", "None", "and", "not", "kwargs", ":", "return", "''", "# If no kwarg is specified don't mung the dsn, but verify it", "if", "not", "kwargs", ":", "parse_dsn", "(",...
[ 147, 0 ]
[ 178, 14 ]
python
en
['en', 'en', 'en']
True
_param_escape
(s, re_escape=_re.compile(r"([\\'])"), re_space=_re.compile(r'\s'))
Apply the escaping rule required by PQconnectdb
Apply the escaping rule required by PQconnectdb
def _param_escape(s, re_escape=_re.compile(r"([\\'])"), re_space=_re.compile(r'\s')): """ Apply the escaping rule required by PQconnectdb """ if not s: return "''" s = re_escape.sub(r'\\\1', s) if re_space.search(s): s = "'" + s + "'" return s
[ "def", "_param_escape", "(", "s", ",", "re_escape", "=", "_re", ".", "compile", "(", "r\"([\\\\'])\"", ")", ",", "re_space", "=", "_re", ".", "compile", "(", "r'\\s'", ")", ")", ":", "if", "not", "s", ":", "return", "\"''\"", "s", "=", "re_escape", "...
[ 181, 0 ]
[ 194, 12 ]
python
en
['en', 'error', 'th']
False
YoHookTests.test_yo_message
(self)
Yo App sends notification whenever user receives a new Yo from another user.
Yo App sends notification whenever user receives a new Yo from another user.
def test_yo_message(self) -> None: """ Yo App sends notification whenever user receives a new Yo from another user. """ cordelia = self.example_user("cordelia") self.url = self.build_webhook_url( email=cordelia.email, username="IAGO", user_ip="...
[ "def", "test_yo_message", "(", "self", ")", "->", "None", ":", "cordelia", "=", "self", ".", "example_user", "(", "\"cordelia\"", ")", "self", ".", "url", "=", "self", ".", "build_webhook_url", "(", "email", "=", "cordelia", ".", "email", ",", "username", ...
[ 10, 4 ]
[ 23, 9 ]
python
en
['en', 'error', 'th']
False
canonicalize_version
(_version)
This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment.
This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment.
def canonicalize_version(_version): # type: (str) -> Union[Version, str] """ This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment. """ try: version = Version(_version) except InvalidVersion: # Legacy versions cann...
[ "def", "canonicalize_version", "(", "_version", ")", ":", "# type: (str) -> Union[Version, str]", "try", ":", "version", "=", "Version", "(", "_version", ")", "except", "InvalidVersion", ":", "# Legacy versions cannot be normalized", "return", "_version", "parts", "=", ...
[ 25, 0 ]
[ 64, 25 ]
python
en
['en', 'error', 'th']
False
MongoStorage.__init__
(self, mongo_object)
Uses specified pymongo object for storage.
Uses specified pymongo object for storage.
def __init__(self, mongo_object): """ Uses specified pymongo object for storage. """ self.mongo_object = mongo_object
[ "def", "__init__", "(", "self", ",", "mongo_object", ")", ":", "self", ".", "mongo_object", "=", "mongo_object" ]
[ 43, 4 ]
[ 45, 40 ]
python
en
['en', 'en', 'en']
True
MongoStorage.store_vector
(self, hash_name, bucket_key, v, data)
Stores vector and JSON-serializable data in MongoDB with specified key.
Stores vector and JSON-serializable data in MongoDB with specified key.
def store_vector(self, hash_name, bucket_key, v, data): """ Stores vector and JSON-serializable data in MongoDB with specified key. """ mongo_key = self._format_mongo_key(hash_name, bucket_key) val_dict = {} val_dict['lsh'] = mongo_key # Depending on type (spars...
[ "def", "store_vector", "(", "self", ",", "hash_name", ",", "bucket_key", ",", "v", ",", "data", ")", ":", "mongo_key", "=", "self", ".", "_format_mongo_key", "(", "hash_name", ",", "bucket_key", ")", "val_dict", "=", "{", "}", "val_dict", "[", "'lsh'", "...
[ 47, 4 ]
[ 86, 46 ]
python
en
['en', 'error', 'th']
False
MongoStorage.delete_vector
(self, hash_name, bucket_keys, data)
Deletes vector and JSON-serializable data in buckets with specified keys.
Deletes vector and JSON-serializable data in buckets with specified keys.
def delete_vector(self, hash_name, bucket_keys, data): """ Deletes vector and JSON-serializable data in buckets with specified keys. """ lsh_keys = [self._format_mongo_key(hash_name, key) for key in bucket_keys] self.mongo_object.remove({'lsh': {'$in': lsh_key...
[ "def", "delete_vector", "(", "self", ",", "hash_name", ",", "bucket_keys", ",", "data", ")", ":", "lsh_keys", "=", "[", "self", ".", "_format_mongo_key", "(", "hash_name", ",", "key", ")", "for", "key", "in", "bucket_keys", "]", "self", ".", "mongo_object"...
[ 109, 4 ]
[ 116, 48 ]
python
en
['en', 'error', 'th']
False
MongoStorage.get_bucket
(self, hash_name, bucket_key)
Returns bucket content as list of tuples (vector, data).
Returns bucket content as list of tuples (vector, data).
def get_bucket(self, hash_name, bucket_key): """ Returns bucket content as list of tuples (vector, data). """ results = [] for row in self._get_bucket_rows(hash_name, bucket_key): val_dict = row # Depending on type (sparse or not) reconstruct vector ...
[ "def", "get_bucket", "(", "self", ",", "hash_name", ",", "bucket_key", ")", ":", "results", "=", "[", "]", "for", "row", "in", "self", ".", "_get_bucket_rows", "(", "hash_name", ",", "bucket_key", ")", ":", "val_dict", "=", "row", "# Depending on type (spars...
[ 118, 4 ]
[ 155, 22 ]
python
en
['en', 'error', 'th']
False
MongoStorage.clean_buckets
(self, hash_name)
Removes all buckets and their content for specified hash.
Removes all buckets and their content for specified hash.
def clean_buckets(self, hash_name): """ Removes all buckets and their content for specified hash. """ self.mongo_object.remove( {'lsh': {'$regex': self._format_hash_prefix(hash_name)}})
[ "def", "clean_buckets", "(", "self", ",", "hash_name", ")", ":", "self", ".", "mongo_object", ".", "remove", "(", "{", "'lsh'", ":", "{", "'$regex'", ":", "self", ".", "_format_hash_prefix", "(", "hash_name", ")", "}", "}", ")" ]
[ 157, 4 ]
[ 162, 69 ]
python
en
['en', 'error', 'th']
False
MongoStorage.clean_all_buckets
(self)
Removes all buckets from all hashes and their content.
Removes all buckets from all hashes and their content.
def clean_all_buckets(self): """ Removes all buckets from all hashes and their content. """ self.mongo_object.remove( {'lsh': {'$regex': 'nearpy_'}})
[ "def", "clean_all_buckets", "(", "self", ")", ":", "self", ".", "mongo_object", ".", "remove", "(", "{", "'lsh'", ":", "{", "'$regex'", ":", "'nearpy_'", "}", "}", ")" ]
[ 164, 4 ]
[ 169, 43 ]
python
en
['en', 'error', 'th']
False
MongoStorage.store_hash_configuration
(self, lshash)
Stores hash configuration
Stores hash configuration
def store_hash_configuration(self, lshash): """ Stores hash configuration """ self.mongo_object.insert_one( {'hash_conf_name': lshash.hash_name+'_conf', 'hash_configuration': pickle.dumps(lshash.get_config()) } )
[ "def", "store_hash_configuration", "(", "self", ",", "lshash", ")", ":", "self", ".", "mongo_object", ".", "insert_one", "(", "{", "'hash_conf_name'", ":", "lshash", ".", "hash_name", "+", "'_conf'", ",", "'hash_configuration'", ":", "pickle", ".", "dumps", "(...
[ 171, 4 ]
[ 179, 9 ]
python
en
['en', 'error', 'th']
False
MongoStorage.load_hash_configuration
(self, hash_name)
Loads and returns hash configuration
Loads and returns hash configuration
def load_hash_configuration(self, hash_name): """ Loads and returns hash configuration """ conf = self.mongo_object.find_one( {'hash_conf_name': hash_name + '_conf'} ) return pickle.loads(conf['hash_configuration']) if conf is not None\ else None
[ "def", "load_hash_configuration", "(", "self", ",", "hash_name", ")", ":", "conf", "=", "self", ".", "mongo_object", ".", "find_one", "(", "{", "'hash_conf_name'", ":", "hash_name", "+", "'_conf'", "}", ")", "return", "pickle", ".", "loads", "(", "conf", "...
[ 181, 4 ]
[ 189, 21 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.migration_plan
(self, targets, clean_start=False)
Given a set of targets, returns a list of (Migration instance, backwards?).
Given a set of targets, returns a list of (Migration instance, backwards?).
def migration_plan(self, targets, clean_start=False): """ Given a set of targets, returns a list of (Migration instance, backwards?). """ plan = [] if clean_start: applied = set() else: applied = set(self.loader.applied_migrations) for targ...
[ "def", "migration_plan", "(", "self", ",", "targets", ",", "clean_start", "=", "False", ")", ":", "plan", "=", "[", "]", "if", "clean_start", ":", "applied", "=", "set", "(", ")", "else", ":", "applied", "=", "set", "(", "self", ".", "loader", ".", ...
[ 23, 4 ]
[ 63, 19 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor._create_project_state
(self, with_applied_migrations=False)
Create a project state including all the applications without migrations and applied migrations if with_applied_migrations=True.
Create a project state including all the applications without migrations and applied migrations if with_applied_migrations=True.
def _create_project_state(self, with_applied_migrations=False): """ Create a project state including all the applications without migrations and applied migrations if with_applied_migrations=True. """ state = ProjectState(real_apps=list(self.loader.unmigrated_apps)) if wi...
[ "def", "_create_project_state", "(", "self", ",", "with_applied_migrations", "=", "False", ")", ":", "state", "=", "ProjectState", "(", "real_apps", "=", "list", "(", "self", ".", "loader", ".", "unmigrated_apps", ")", ")", "if", "with_applied_migrations", ":", ...
[ 65, 4 ]
[ 81, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.migrate
(self, targets, plan=None, state=None, fake=False, fake_initial=False)
Migrates the database up to the given targets. Django first needs to create all project states before a migration is (un)applied and in a second step run all the database operations.
Migrates the database up to the given targets.
def migrate(self, targets, plan=None, state=None, fake=False, fake_initial=False): """ Migrates the database up to the given targets. Django first needs to create all project states before a migration is (un)applied and in a second step run all the database operations. """ ...
[ "def", "migrate", "(", "self", ",", "targets", ",", "plan", "=", "None", ",", "state", "=", "None", ",", "fake", "=", "False", ",", "fake_initial", "=", "False", ")", ":", "if", "plan", "is", "None", ":", "plan", "=", "self", ".", "migration_plan", ...
[ 83, 4 ]
[ 122, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor._migrate_all_forwards
(self, state, plan, full_plan, fake, fake_initial)
Take a list of 2-tuples of the form (migration instance, False) and apply them in the order they occur in the full_plan.
Take a list of 2-tuples of the form (migration instance, False) and apply them in the order they occur in the full_plan.
def _migrate_all_forwards(self, state, plan, full_plan, fake, fake_initial): """ Take a list of 2-tuples of the form (migration instance, False) and apply them in the order they occur in the full_plan. """ migrations_to_run = {m[0] for m in plan} for migration, _ in full_...
[ "def", "_migrate_all_forwards", "(", "self", ",", "state", ",", "plan", ",", "full_plan", ",", "fake", ",", "fake_initial", ")", ":", "migrations_to_run", "=", "{", "m", "[", "0", "]", "for", "m", "in", "plan", "}", "for", "migration", ",", "_", "in", ...
[ 124, 4 ]
[ 147, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor._migrate_all_backwards
(self, plan, full_plan, fake)
Take a list of 2-tuples of the form (migration instance, True) and unapply them in reverse order they occur in the full_plan. Since unapplying a migration requires the project state prior to that migration, Django will compute the migration states before each of them in a first...
Take a list of 2-tuples of the form (migration instance, True) and unapply them in reverse order they occur in the full_plan.
def _migrate_all_backwards(self, plan, full_plan, fake): """ Take a list of 2-tuples of the form (migration instance, True) and unapply them in reverse order they occur in the full_plan. Since unapplying a migration requires the project state prior to that migration, Django will...
[ "def", "_migrate_all_backwards", "(", "self", ",", "plan", ",", "full_plan", ",", "fake", ")", ":", "migrations_to_run", "=", "{", "m", "[", "0", "]", "for", "m", "in", "plan", "}", "# Holds all migration states prior to the migrations being unapplied", "states", ...
[ 149, 4 ]
[ 208, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.collect_sql
(self, plan)
Takes a migration plan and returns a list of collected SQL statements that represent the best-efforts version of that plan.
Takes a migration plan and returns a list of collected SQL statements that represent the best-efforts version of that plan.
def collect_sql(self, plan): """ Takes a migration plan and returns a list of collected SQL statements that represent the best-efforts version of that plan. """ statements = [] state = None for migration, backwards in plan: with self.connection.schema_...
[ "def", "collect_sql", "(", "self", ",", "plan", ")", ":", "statements", "=", "[", "]", "state", "=", "None", "for", "migration", ",", "backwards", "in", "plan", ":", "with", "self", ".", "connection", ".", "schema_editor", "(", "collect_sql", "=", "True"...
[ 210, 4 ]
[ 226, 25 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.apply_migration
(self, state, migration, fake=False, fake_initial=False)
Runs a migration forwards.
Runs a migration forwards.
def apply_migration(self, state, migration, fake=False, fake_initial=False): """ Runs a migration forwards. """ if self.progress_callback: self.progress_callback("apply_start", migration, fake) if not fake: if fake_initial: # Test to see if...
[ "def", "apply_migration", "(", "self", ",", "state", ",", "migration", ",", "fake", "=", "False", ",", "fake_initial", "=", "False", ")", ":", "if", "self", ".", "progress_callback", ":", "self", ".", "progress_callback", "(", "\"apply_start\"", ",", "migrat...
[ 228, 4 ]
[ 253, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.unapply_migration
(self, state, migration, fake=False)
Runs a migration backwards.
Runs a migration backwards.
def unapply_migration(self, state, migration, fake=False): """ Runs a migration backwards. """ if self.progress_callback: self.progress_callback("unapply_start", migration, fake) if not fake: with self.connection.schema_editor(atomic=migration.atomic) as s...
[ "def", "unapply_migration", "(", "self", ",", "state", ",", "migration", ",", "fake", "=", "False", ")", ":", "if", "self", ".", "progress_callback", ":", "self", ".", "progress_callback", "(", "\"unapply_start\"", ",", "migration", ",", "fake", ")", "if", ...
[ 255, 4 ]
[ 273, 20 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.check_replacements
(self)
Mark replacement migrations applied if their replaced set all are. We do this unconditionally on every migrate, rather than just when migrations are applied or unapplied, so as to correctly handle the case when a new squash migration is pushed to a deployment that already had a...
Mark replacement migrations applied if their replaced set all are.
def check_replacements(self): """ Mark replacement migrations applied if their replaced set all are. We do this unconditionally on every migrate, rather than just when migrations are applied or unapplied, so as to correctly handle the case when a new squash migration is pushed t...
[ "def", "check_replacements", "(", "self", ")", ":", "applied", "=", "self", ".", "recorder", ".", "applied_migrations", "(", ")", "for", "key", ",", "migration", "in", "self", ".", "loader", ".", "replacements", ".", "items", "(", ")", ":", "all_applied", ...
[ 275, 4 ]
[ 290, 50 ]
python
en
['en', 'error', 'th']
False
MigrationExecutor.detect_soft_applied
(self, project_state, migration)
Tests whether a migration has been implicitly applied - that the tables or columns it would create exist. This is intended only for use on initial migrations (as it only looks for CreateModel and AddField).
Tests whether a migration has been implicitly applied - that the tables or columns it would create exist. This is intended only for use on initial migrations (as it only looks for CreateModel and AddField).
def detect_soft_applied(self, project_state, migration): """ Tests whether a migration has been implicitly applied - that the tables or columns it would create exist. This is intended only for use on initial migrations (as it only looks for CreateModel and AddField). """ ...
[ "def", "detect_soft_applied", "(", "self", ",", "project_state", ",", "migration", ")", ":", "def", "should_skip_detecting_model", "(", "migration", ",", "model", ")", ":", "\"\"\"\n No need to detect tables for proxy models, unmanaged models, or\n models th...
[ 292, 4 ]
[ 369, 87 ]
python
en
['en', 'error', 'th']
False
random_result
(*kwargs)
Random objective.
Random objective.
def random_result(*kwargs): """Random objective.""" return round(random.random(),3) * 100
[ "def", "random_result", "(", "*", "kwargs", ")", ":", "return", "round", "(", "random", ".", "random", "(", ")", ",", "3", ")", "*", "100" ]
[ 22, 0 ]
[ 25, 41 ]
python
en
['en', 'mg', 'en']
False
assets_mixin.bump_client_version
(self)
Writes the current Wagtail version number into package.json
Writes the current Wagtail version number into package.json
def bump_client_version(self): """ Writes the current Wagtail version number into package.json """ path = os.path.join('.', 'client', 'package.json') input_file = io.open(path, "r") try: package = json.loads(input_file.read().decode("utf-8")) except (...
[ "def", "bump_client_version", "(", "self", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "'.'", ",", "'client'", ",", "'package.json'", ")", "input_file", "=", "io", ".", "open", "(", "path", ",", "\"r\"", ")", "try", ":", "package", "=...
[ 28, 4 ]
[ 48, 31 ]
python
en
['en', 'error', 'th']
False
TestSourceAssociation.test_null_case_sequential
(self)
test_null_case_sequential -Check extractedsource insertion routines can deal with empty input! -Check source association can too
test_null_case_sequential
def test_null_case_sequential(self): """test_null_case_sequential -Check extractedsource insertion routines can deal with empty input! -Check source association can too """ for im in self.im_params: self.db_imgs.append(Image(data=im, dataset=self.dataset)) ...
[ "def", "test_null_case_sequential", "(", "self", ")", ":", "for", "im", "in", "self", ".", "im_params", ":", "self", ".", "db_imgs", ".", "append", "(", "Image", "(", "data", "=", "im", ",", "dataset", "=", "self", ".", "dataset", ")", ")", "insert_ext...
[ 29, 4 ]
[ 44, 49 ]
python
en
['en', 'en', 'en']
False
TestSourceAssociation.test_only_first_epoch_source
(self)
test_only_first_epoch_source - Pretend to extract a source only from the first image. - Run source association for each image, as we would in TraP. - Check the image source listing works - Check runcat and assocxtrsource are correct.
test_only_first_epoch_source
def test_only_first_epoch_source(self): """test_only_first_epoch_source - Pretend to extract a source only from the first image. - Run source association for each image, as we would in TraP. - Check the image source listing works - Check runcat and assocxtrsource are correct. ...
[ "def", "test_only_first_epoch_source", "(", "self", ")", ":", "first_epoch", "=", "True", "extracted_source_ids", "=", "[", "]", "for", "im", "in", "self", ".", "im_params", ":", "self", ".", "db_imgs", ".", "append", "(", "Image", "(", "data", "=", "im", ...
[ 46, 4 ]
[ 101, 84 ]
python
en
['en', 'en', 'en']
False
TestSourceAssociation.test_single_fixed_source
(self)
test_single_fixed_source - Pretend to extract the same source in each of a series of images. - Perform source association - Check the image source listing works - Check runcat, assocxtrsource.
test_single_fixed_source
def test_single_fixed_source(self): """test_single_fixed_source - Pretend to extract the same source in each of a series of images. - Perform source association - Check the image source listing works - Check runcat, assocxtrsource. """ fixed_src_runcat_id = None...
[ "def", "test_single_fixed_source", "(", "self", ")", ":", "fixed_src_runcat_id", "=", "None", "for", "img_idx", ",", "im", "in", "enumerate", "(", "self", ".", "im_params", ")", ":", "self", ".", "db_imgs", ".", "append", "(", "Image", "(", "data", "=", ...
[ 103, 4 ]
[ 159, 73 ]
python
en
['en', 'en', 'en']
False
DummyNode.promote
(self)
Transition dummy to a normal node and clean off excess attribs. Creating a Node object from scratch would be too much of a hassle as many dependendies would need to be remapped.
Transition dummy to a normal node and clean off excess attribs. Creating a Node object from scratch would be too much of a hassle as many dependendies would need to be remapped.
def promote(self): """ Transition dummy to a normal node and clean off excess attribs. Creating a Node object from scratch would be too much of a hassle as many dependendies would need to be remapped. """ del self.origin del self.error_message self.__class...
[ "def", "promote", "(", "self", ")", ":", "del", "self", ".", "origin", "del", "self", ".", "error_message", "self", ".", "__class__", "=", "Node" ]
[ 92, 4 ]
[ 100, 29 ]
python
en
['en', 'error', 'th']
False
convert_markdown_syntax
(text: str, regex: str, zulip_keyword: str)
Returns: 1. For strikethrough formatting: This maps Slack's '~strike~' to Zulip's '~~strike~~' 2. For bold formatting: This maps Slack's '*bold*' to Zulip's '**bold**' 3. For italic formatting: This maps Slack's '_italic_' to Zulip's '*italic*'
Returns: 1. For strikethrough formatting: This maps Slack's '~strike~' to Zulip's '~~strike~~' 2. For bold formatting: This maps Slack's '*bold*' to Zulip's '**bold**' 3. For italic formatting: This maps Slack's '_italic_' to Zulip's '*italic*'
def convert_markdown_syntax(text: str, regex: str, zulip_keyword: str) -> str: """ Returns: 1. For strikethrough formatting: This maps Slack's '~strike~' to Zulip's '~~strike~~' 2. For bold formatting: This maps Slack's '*bold*' to Zulip's '**bold**' 3. For italic formatting: This maps Slack's '_ita...
[ "def", "convert_markdown_syntax", "(", "text", ":", "str", ",", "regex", ":", "str", ",", "zulip_keyword", ":", "str", ")", "->", "str", ":", "for", "match", "in", "re", ".", "finditer", "(", "regex", ",", "text", ",", "re", ".", "VERBOSE", ")", ":",...
[ 140, 0 ]
[ 157, 15 ]
python
en
['en', 'error', 'th']
False
convert_link_format
(text: str)
1. Converts '<https://foo.com>' to 'https://foo.com' 2. Converts '<https://foo.com|foo>' to 'https://foo.com|foo'
1. Converts '<https://foo.com>' to 'https://foo.com' 2. Converts '<https://foo.com|foo>' to 'https://foo.com|foo'
def convert_link_format(text: str) -> Tuple[str, bool]: """ 1. Converts '<https://foo.com>' to 'https://foo.com' 2. Converts '<https://foo.com|foo>' to 'https://foo.com|foo' """ has_link = False for match in re.finditer(LINK_REGEX, text, re.VERBOSE): converted_text = match.group(0).repla...
[ "def", "convert_link_format", "(", "text", ":", "str", ")", "->", "Tuple", "[", "str", ",", "bool", "]", ":", "has_link", "=", "False", "for", "match", "in", "re", ".", "finditer", "(", "LINK_REGEX", ",", "text", ",", "re", ".", "VERBOSE", ")", ":", ...
[ 160, 0 ]
[ 170, 25 ]
python
en
['en', 'error', 'th']
False
convert_mailto_format
(text: str)
1. Converts '<mailto:foo@foo.com>' to 'mailto:foo@foo.com' 2. Converts '<mailto:foo@foo.com|foo@foo.com>' to 'mailto:foo@foo.com'
1. Converts '<mailto:foo
def convert_mailto_format(text: str) -> Tuple[str, bool]: """ 1. Converts '<mailto:foo@foo.com>' to 'mailto:foo@foo.com' 2. Converts '<mailto:foo@foo.com|foo@foo.com>' to 'mailto:foo@foo.com' """ has_link = False for match in re.finditer(SLACK_MAILTO_REGEX, text, re.VERBOSE): has_link = ...
[ "def", "convert_mailto_format", "(", "text", ":", "str", ")", "->", "Tuple", "[", "str", ",", "bool", "]", ":", "has_link", "=", "False", "for", "match", "in", "re", ".", "finditer", "(", "SLACK_MAILTO_REGEX", ",", "text", ",", "re", ".", "VERBOSE", ")...
[ 173, 0 ]
[ 182, 25 ]
python
en
['en', 'error', 'th']
False
check_spend_bundle_validity
( constants: ConsensusConstants, blocks: List[FullBlock], spend_bundle: SpendBundle, expected_err: Optional[Err] = None, )
This test helper create an extra block after the given blocks that contains the given `SpendBundle`, and then invokes `receive_block` to ensure that it's accepted (if `expected_err=None`) or fails with the correct error code.
This test helper create an extra block after the given blocks that contains the given `SpendBundle`, and then invokes `receive_block` to ensure that it's accepted (if `expected_err=None`) or fails with the correct error code.
async def check_spend_bundle_validity( constants: ConsensusConstants, blocks: List[FullBlock], spend_bundle: SpendBundle, expected_err: Optional[Err] = None, ): """ This test helper create an extra block after the given blocks that contains the given `SpendBundle`, and then invokes `receive_...
[ "async", "def", "check_spend_bundle_validity", "(", "constants", ":", "ConsensusConstants", ",", "blocks", ":", "List", "[", "FullBlock", "]", ",", "spend_bundle", ":", "SpendBundle", ",", "expected_err", ":", "Optional", "[", "Err", "]", "=", "None", ",", ")"...
[ 53, 0 ]
[ 93, 30 ]
python
en
['en', 'error', 'th']
False
QHAdam.step
(self, closure: OptLossClosure = None)
Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss.
Performs a single optimization step.
def step(self, closure: OptLossClosure = None) -> OptFloat: """Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss. """ loss = None if closure is not None: loss = closure() for group ...
[ "def", "step", "(", "self", ",", "closure", ":", "OptLossClosure", "=", "None", ")", "->", "OptFloat", ":", "loss", "=", "None", "if", "closure", "is", "not", "None", ":", "loss", "=", "closure", "(", ")", "for", "group", "in", "self", ".", "param_gr...
[ 77, 4 ]
[ 148, 19 ]
python
en
['en', 'en', 'en']
True
get_bootstrap_setting
(name, default=None)
Read a setting.
Read a setting.
def get_bootstrap_setting(name, default=None): """Read a setting.""" # Start with a copy of default settings bootstrap3 = BOOTSTRAP3_DEFAULTS.copy() # Override with user settings from settings.py bootstrap3.update(getattr(settings, "BOOTSTRAP3", {})) # Update use_i18n bootstrap3["use_i18n"...
[ "def", "get_bootstrap_setting", "(", "name", ",", "default", "=", "None", ")", ":", "# Start with a copy of default settings", "bootstrap3", "=", "BOOTSTRAP3_DEFAULTS", ".", "copy", "(", ")", "# Override with user settings from settings.py", "bootstrap3", ".", "update", "...
[ 35, 0 ]
[ 46, 40 ]
python
en
['en', 'en', 'en']
True
jquery_url
()
Return the full url to jQuery file to use.
Return the full url to jQuery file to use.
def jquery_url(): """Return the full url to jQuery file to use.""" return get_bootstrap_setting("jquery_url")
[ "def", "jquery_url", "(", ")", ":", "return", "get_bootstrap_setting", "(", "\"jquery_url\"", ")" ]
[ 49, 0 ]
[ 51, 46 ]
python
en
['en', 'en', 'en']
True
javascript_url
()
Return the full url to the Bootstrap JavaScript file.
Return the full url to the Bootstrap JavaScript file.
def javascript_url(): """Return the full url to the Bootstrap JavaScript file.""" return get_bootstrap_setting("javascript_url")
[ "def", "javascript_url", "(", ")", ":", "return", "get_bootstrap_setting", "(", "\"javascript_url\"", ")" ]
[ 54, 0 ]
[ 56, 50 ]
python
en
['en', 'en', 'en']
True
css_url
()
Return the full url to the Bootstrap CSS file.
Return the full url to the Bootstrap CSS file.
def css_url(): """Return the full url to the Bootstrap CSS file.""" return get_bootstrap_setting("css_url")
[ "def", "css_url", "(", ")", ":", "return", "get_bootstrap_setting", "(", "\"css_url\"", ")" ]
[ 59, 0 ]
[ 61, 43 ]
python
en
['en', 'en', 'en']
True
theme_url
()
Return the full url to the theme CSS file.
Return the full url to the theme CSS file.
def theme_url(): """Return the full url to the theme CSS file.""" return get_bootstrap_setting("theme_url")
[ "def", "theme_url", "(", ")", ":", "return", "get_bootstrap_setting", "(", "\"theme_url\"", ")" ]
[ 64, 0 ]
[ 66, 45 ]
python
en
['en', 'en', 'en']
True
i18n_enabled
()
Return the projects i18n setting.
Return the projects i18n setting.
def i18n_enabled(): """Return the projects i18n setting.""" return getattr(settings, "USE_I18N", False)
[ "def", "i18n_enabled", "(", ")", ":", "return", "getattr", "(", "settings", ",", "\"USE_I18N\"", ",", "False", ")" ]
[ 69, 0 ]
[ 71, 47 ]
python
en
['en', 'ig', 'en']
True
DatabaseOperations.bulk_batch_size
(self, fields, objs)
SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query. If there's only a single field to insert, the limit is 500 (SQLITE_MAX_COMPOUND_SELECT).
SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query.
def bulk_batch_size(self, fields, objs): """ SQLite has a compile-time default (SQLITE_LIMIT_VARIABLE_NUMBER) of 999 variables per query. If there's only a single field to insert, the limit is 500 (SQLITE_MAX_COMPOUND_SELECT). """ limit = 999 if len(fields) > 1 e...
[ "def", "bulk_batch_size", "(", "self", ",", "fields", ",", "objs", ")", ":", "limit", "=", "999", "if", "len", "(", "fields", ")", ">", "1", "else", "500", "return", "(", "limit", "//", "len", "(", "fields", ")", ")", "if", "len", "(", "fields", ...
[ 17, 4 ]
[ 26, 71 ]
python
en
['en', 'error', 'th']
False
DatabaseOperations.format_for_duration_arithmetic
(self, sql)
Do nothing here, we will handle it in the custom function.
Do nothing here, we will handle it in the custom function.
def format_for_duration_arithmetic(self, sql): """Do nothing here, we will handle it in the custom function.""" return sql
[ "def", "format_for_duration_arithmetic", "(", "self", ",", "sql", ")", ":", "return", "sql" ]
[ 56, 4 ]
[ 58, 18 ]
python
en
['en', 'en', 'en']
True
DatabaseOperations._quote_params_for_last_executed_query
(self, params)
Only for last_executed_query! Don't use this to execute SQL queries!
Only for last_executed_query! Don't use this to execute SQL queries!
def _quote_params_for_last_executed_query(self, params): """ Only for last_executed_query! Don't use this to execute SQL queries! """ # This function is limited both by SQLITE_LIMIT_VARIABLE_NUMBER (the # number of parameters, default = 999) and SQLITE_MAX_COLUMN (the # n...
[ "def", "_quote_params_for_last_executed_query", "(", "self", ",", "params", ")", ":", "# This function is limited both by SQLITE_LIMIT_VARIABLE_NUMBER (the", "# number of parameters, default = 999) and SQLITE_MAX_COLUMN (the", "# number of return values, default = 2000). Since Python's sqlite3",...
[ 100, 4 ]
[ 125, 26 ]
python
en
['en', 'error', 'th']
False
ConfigurationCommand.list_config_values
(self, options, args)
List config key-value pairs across different config files
List config key-value pairs across different config files
def list_config_values(self, options, args): # type: (Values, List[str]) -> None """List config key-value pairs across different config files""" self._get_n_args(args, "debug", n=0) self.print_env_var_values() # Iterate over config files and print if they exist, and the ...
[ "def", "list_config_values", "(", "self", ",", "options", ",", "args", ")", ":", "# type: (Values, List[str]) -> None", "self", ".", "_get_n_args", "(", "args", ",", "\"debug\"", ",", "n", "=", "0", ")", "self", ".", "print_env_var_values", "(", ")", "# Iterat...
[ 191, 4 ]
[ 207, 62 ]
python
en
['fr', 'en', 'en']
True
ConfigurationCommand.print_config_file_values
(self, variant)
Get key-value pairs from the file of a variant
Get key-value pairs from the file of a variant
def print_config_file_values(self, variant): # type: (Kind) -> None """Get key-value pairs from the file of a variant""" for name, value in self.configuration.\ get_values_in_config(variant).items(): with indent_log(): write_output("%s: %s", name, valu...
[ "def", "print_config_file_values", "(", "self", ",", "variant", ")", ":", "# type: (Kind) -> None", "for", "name", ",", "value", "in", "self", ".", "configuration", ".", "get_values_in_config", "(", "variant", ")", ".", "items", "(", ")", ":", "with", "indent_...
[ 209, 4 ]
[ 215, 51 ]
python
en
['en', 'en', 'en']
True
ConfigurationCommand.print_env_var_values
(self)
Get key-values pairs present as environment variables
Get key-values pairs present as environment variables
def print_env_var_values(self): # type: () -> None """Get key-values pairs present as environment variables""" write_output("%s:", 'env_var') with indent_log(): for key, value in sorted(self.configuration.get_environ_vars()): env_var = 'PIP_{}'.format(key.uppe...
[ "def", "print_env_var_values", "(", "self", ")", ":", "# type: () -> None", "write_output", "(", "\"%s:\"", ",", "'env_var'", ")", "with", "indent_log", "(", ")", ":", "for", "key", ",", "value", "in", "sorted", "(", "self", ".", "configuration", ".", "get_e...
[ 217, 4 ]
[ 224, 53 ]
python
en
['fr', 'en', 'en']
True
ConfigurationCommand._get_n_args
(self, args, example, n)
Helper to make sure the command got the right number of arguments
Helper to make sure the command got the right number of arguments
def _get_n_args(self, args, example, n): # type: (List[str], str, int) -> Any """Helper to make sure the command got the right number of arguments """ if len(args) != n: msg = ( 'Got unexpected number of arguments, expected {}. ' '(example: "{}...
[ "def", "_get_n_args", "(", "self", ",", "args", ",", "example", ",", "n", ")", ":", "# type: (List[str], str, int) -> Any", "if", "len", "(", "args", ")", "!=", "n", ":", "msg", "=", "(", "'Got unexpected number of arguments, expected {}. '", "'(example: \"{} config...
[ 242, 4 ]
[ 256, 23 ]
python
en
['en', 'en', 'en']
True
register
(viewer, order=1)
The :py:func:`register` function is used to register additional viewers. :param viewer: The viewer to be registered. :param order: Zero or a negative integer to prepend this viewer to the list, a positive integer to append it.
The :py:func:`register` function is used to register additional viewers.
def register(viewer, order=1): """ The :py:func:`register` function is used to register additional viewers. :param viewer: The viewer to be registered. :param order: Zero or a negative integer to prepend this viewer to the list, a positive integer to append it. """ try: ...
[ "def", "register", "(", "viewer", ",", "order", "=", "1", ")", ":", "try", ":", "if", "issubclass", "(", "viewer", ",", "Viewer", ")", ":", "viewer", "=", "viewer", "(", ")", "except", "TypeError", ":", "pass", "# raised if viewer wasn't a class", "if", ...
[ 25, 0 ]
[ 42, 34 ]
python
en
['en', 'error', 'th']
False
show
(image, title=None, **options)
r""" Display a given image. :param image: An image object. :param title: Optional title. Not all viewers can display the title. :param \**options: Additional viewer options. :returns: ``True`` if a suitable viewer was found, ``False`` otherwise.
r""" Display a given image.
def show(image, title=None, **options): r""" Display a given image. :param image: An image object. :param title: Optional title. Not all viewers can display the title. :param \**options: Additional viewer options. :returns: ``True`` if a suitable viewer was found, ``False`` otherwise. """ ...
[ "def", "show", "(", "image", ",", "title", "=", "None", ",", "*", "*", "options", ")", ":", "for", "viewer", "in", "_viewers", ":", "if", "viewer", ".", "show", "(", "image", ",", "title", "=", "title", ",", "*", "*", "options", ")", ":", "return...
[ 45, 0 ]
[ 57, 12 ]
python
cy
['en', 'cy', 'hi']
False
Viewer.show
(self, image, **options)
The main function for displaying an image. Converts the given image to the target format and displays it.
The main function for displaying an image. Converts the given image to the target format and displays it.
def show(self, image, **options): """ The main function for displaying an image. Converts the given image to the target format and displays it. """ # save temporary image to disk if not ( image.mode in ("1", "RGBA") or (self.format == "PNG" and im...
[ "def", "show", "(", "self", ",", "image", ",", "*", "*", "options", ")", ":", "# save temporary image to disk", "if", "not", "(", "image", ".", "mode", "in", "(", "\"1\"", ",", "\"RGBA\"", ")", "or", "(", "self", ".", "format", "==", "\"PNG\"", "and", ...
[ 65, 4 ]
[ 80, 48 ]
python
en
['en', 'error', 'th']
False
Viewer.get_format
(self, image)
Return format name, or ``None`` to save as PGM/PPM.
Return format name, or ``None`` to save as PGM/PPM.
def get_format(self, image): """Return format name, or ``None`` to save as PGM/PPM.""" return self.format
[ "def", "get_format", "(", "self", ",", "image", ")", ":", "return", "self", ".", "format" ]
[ 89, 4 ]
[ 91, 26 ]
python
en
['en', 'en', 'en']
True
Viewer.get_command
(self, file, **options)
Returns the command used to display the file. Not implemented in the base class.
Returns the command used to display the file. Not implemented in the base class.
def get_command(self, file, **options): """ Returns the command used to display the file. Not implemented in the base class. """ raise NotImplementedError
[ "def", "get_command", "(", "self", ",", "file", ",", "*", "*", "options", ")", ":", "raise", "NotImplementedError" ]
[ 93, 4 ]
[ 98, 33 ]
python
en
['en', 'error', 'th']
False
Viewer.save_image
(self, image)
Save to temporary file and return filename.
Save to temporary file and return filename.
def save_image(self, image): """Save to temporary file and return filename.""" return image._dump(format=self.get_format(image), **self.options)
[ "def", "save_image", "(", "self", ",", "image", ")", ":", "return", "image", ".", "_dump", "(", "format", "=", "self", ".", "get_format", "(", "image", ")", ",", "*", "*", "self", ".", "options", ")" ]
[ 100, 4 ]
[ 102, 73 ]
python
en
['en', 'en', 'en']
True
Viewer.show_image
(self, image, **options)
Display the given image.
Display the given image.
def show_image(self, image, **options): """Display the given image.""" return self.show_file(self.save_image(image), **options)
[ "def", "show_image", "(", "self", ",", "image", ",", "*", "*", "options", ")", ":", "return", "self", ".", "show_file", "(", "self", ".", "save_image", "(", "image", ")", ",", "*", "*", "options", ")" ]
[ 104, 4 ]
[ 106, 64 ]
python
en
['en', 'en', 'en']
True
Viewer.show_file
(self, file, **options)
Display the given file.
Display the given file.
def show_file(self, file, **options): """Display the given file.""" os.system(self.get_command(file, **options)) return 1
[ "def", "show_file", "(", "self", ",", "file", ",", "*", "*", "options", ")", ":", "os", ".", "system", "(", "self", ".", "get_command", "(", "file", ",", "*", "*", "options", ")", ")", "return", "1" ]
[ 108, 4 ]
[ 111, 16 ]
python
en
['en', 'en', 'en']
True
MacViewer.show_file
(self, file, **options)
Display given file
Display given file
def show_file(self, file, **options): """Display given file""" fd, path = tempfile.mkstemp() with os.fdopen(fd, "w") as f: f.write(file) with open(path) as f: subprocess.Popen( ["im=$(cat); open -a Preview.app $im; sleep 20; rm -f $im"], ...
[ "def", "show_file", "(", "self", ",", "file", ",", "*", "*", "options", ")", ":", "fd", ",", "path", "=", "tempfile", ".", "mkstemp", "(", ")", "with", "os", ".", "fdopen", "(", "fd", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", ...
[ 148, 4 ]
[ 160, 16 ]
python
en
['en', 'en', 'en']
True
UnixViewer.show_file
(self, file, **options)
Display given file
Display given file
def show_file(self, file, **options): """Display given file""" fd, path = tempfile.mkstemp() with os.fdopen(fd, "w") as f: f.write(file) with open(path) as f: command = self.get_command_ex(file, **options)[0] subprocess.Popen( ["im=$(ca...
[ "def", "show_file", "(", "self", ",", "file", ",", "*", "*", "options", ")", ":", "fd", ",", "path", "=", "tempfile", ".", "mkstemp", "(", ")", "with", "os", ".", "fdopen", "(", "fd", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", ...
[ 175, 4 ]
[ 186, 16 ]
python
en
['en', 'en', 'en']
True
QuoteForRspFile
(arg)
Quote a command line argument so that it appears as one argument when processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for Windows programs).
Quote a command line argument so that it appears as one argument when processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for Windows programs).
def QuoteForRspFile(arg): """Quote a command line argument so that it appears as one argument when processed via cmd.exe and parsed by CommandLineToArgvW (as is typical for Windows programs).""" # See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment # threads. This is actually the quoti...
[ "def", "QuoteForRspFile", "(", "arg", ")", ":", "# See http://goo.gl/cuFbX and http://goo.gl/dhPnp including the comment", "# threads. This is actually the quoting rules for CommandLineToArgvW, not", "# for the shell, because the shell doesn't do anything in Windows. This", "# works more or less b...
[ 23, 0 ]
[ 54, 26 ]
python
en
['en', 'en', 'en']
True
EncodeRspFileList
(args)
Process a list of arguments using QuoteCmdExeArgument.
Process a list of arguments using QuoteCmdExeArgument.
def EncodeRspFileList(args): """Process a list of arguments using QuoteCmdExeArgument.""" # Note that the first argument is assumed to be the command. Don't add # quotes around it because then built-ins like 'echo', etc. won't work. # Take care to normpath only the path in the case of 'call ../x.bat' be...
[ "def", "EncodeRspFileList", "(", "args", ")", ":", "# Note that the first argument is assumed to be the command. Don't add", "# quotes around it because then built-ins like 'echo', etc. won't work.", "# Take care to normpath only the path in the case of 'call ../x.bat' because", "# otherwise the w...
[ 57, 0 ]
[ 71, 77 ]
python
en
['en', 'en', 'en']
True
_GenericRetrieve
(root, default, path)
Given a list of dictionary keys |path| and a tree of dicts |root|, find value at path, or return |default| if any of the path doesn't exist.
Given a list of dictionary keys |path| and a tree of dicts |root|, find value at path, or return |default| if any of the path doesn't exist.
def _GenericRetrieve(root, default, path): """Given a list of dictionary keys |path| and a tree of dicts |root|, find value at path, or return |default| if any of the path doesn't exist.""" if not root: return default if not path: return root return _GenericRetrieve(root.get(path[0]), ...
[ "def", "_GenericRetrieve", "(", "root", ",", "default", ",", "path", ")", ":", "if", "not", "root", ":", "return", "default", "if", "not", "path", ":", "return", "root", "return", "_GenericRetrieve", "(", "root", ".", "get", "(", "path", "[", "0", "]",...
[ 74, 0 ]
[ 81, 65 ]
python
en
['en', 'en', 'en']
True
_AddPrefix
(element, prefix)
Add |prefix| to |element| or each subelement if element is iterable.
Add |prefix| to |element| or each subelement if element is iterable.
def _AddPrefix(element, prefix): """Add |prefix| to |element| or each subelement if element is iterable.""" if element is None: return element # Note, not Iterable because we don't want to handle strings like that. if isinstance(element, list) or isinstance(element, tuple): return [prefi...
[ "def", "_AddPrefix", "(", "element", ",", "prefix", ")", ":", "if", "element", "is", "None", ":", "return", "element", "# Note, not Iterable because we don't want to handle strings like that.", "if", "isinstance", "(", "element", ",", "list", ")", "or", "isinstance", ...
[ 84, 0 ]
[ 92, 31 ]
python
en
['en', 'en', 'en']
True
_DoRemapping
(element, map)
If |element| then remap it through |map|. If |element| is iterable then each item will be remapped. Any elements not found will be removed.
If |element| then remap it through |map|. If |element| is iterable then each item will be remapped. Any elements not found will be removed.
def _DoRemapping(element, map): """If |element| then remap it through |map|. If |element| is iterable then each item will be remapped. Any elements not found will be removed.""" if map is not None and element is not None: if not callable(map): map = map.get # Assume it's a dict, otherwise...
[ "def", "_DoRemapping", "(", "element", ",", "map", ")", ":", "if", "map", "is", "not", "None", "and", "element", "is", "not", "None", ":", "if", "not", "callable", "(", "map", ")", ":", "map", "=", "map", ".", "get", "# Assume it's a dict, otherwise a ca...
[ 95, 0 ]
[ 105, 18 ]
python
en
['en', 'en', 'en']
True
_AppendOrReturn
(append, element)
If |append| is None, simply return |element|. If |append| is not None, then add |element| to it, adding each item in |element| if it's a list or tuple.
If |append| is None, simply return |element|. If |append| is not None, then add |element| to it, adding each item in |element| if it's a list or tuple.
def _AppendOrReturn(append, element): """If |append| is None, simply return |element|. If |append| is not None, then add |element| to it, adding each item in |element| if it's a list or tuple.""" if append is not None and element is not None: if isinstance(element, list) or isinstance(element, tuple...
[ "def", "_AppendOrReturn", "(", "append", ",", "element", ")", ":", "if", "append", "is", "not", "None", "and", "element", "is", "not", "None", ":", "if", "isinstance", "(", "element", ",", "list", ")", "or", "isinstance", "(", "element", ",", "tuple", ...
[ 108, 0 ]
[ 118, 22 ]
python
en
['en', 'en', 'en']
True
_FindDirectXInstallation
()
Try to find an installation location for the DirectX SDK. Check for the standard environment variable, and if that doesn't exist, try to find via the registry. May return None if not found in either location.
Try to find an installation location for the DirectX SDK. Check for the standard environment variable, and if that doesn't exist, try to find via the registry. May return None if not found in either location.
def _FindDirectXInstallation(): """Try to find an installation location for the DirectX SDK. Check for the standard environment variable, and if that doesn't exist, try to find via the registry. May return None if not found in either location.""" # Return previously calculated value, if there is one if ...
[ "def", "_FindDirectXInstallation", "(", ")", ":", "# Return previously calculated value, if there is one", "if", "hasattr", "(", "_FindDirectXInstallation", ",", "\"dxsdk_dir\"", ")", ":", "return", "_FindDirectXInstallation", ".", "dxsdk_dir", "dxsdk_dir", "=", "os", ".", ...
[ 121, 0 ]
[ 143, 20 ]
python
en
['en', 'en', 'en']
True
GetGlobalVSMacroEnv
(vs_version)
Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.
Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.
def GetGlobalVSMacroEnv(vs_version): """Get a dict of variables mapping internal VS macro names to their gyp equivalents. Returns all variables that are independent of the target.""" env = {} # '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when # Visual Studio is actually install...
[ "def", "GetGlobalVSMacroEnv", "(", "vs_version", ")", ":", "env", "=", "{", "}", "# '$(VSInstallDir)' and '$(VCInstallDir)' are available when and only when", "# Visual Studio is actually installed.", "if", "vs_version", ".", "Path", "(", ")", ":", "env", "[", "\"$(VSInstal...
[ 146, 0 ]
[ 164, 14 ]
python
en
['en', 'en', 'en']
True
ExtractSharedMSVSSystemIncludes
(configs, generator_flags)
Finds msvs_system_include_dirs that are common to all targets, removes them from all targets, and returns an OrderedSet containing them.
Finds msvs_system_include_dirs that are common to all targets, removes them from all targets, and returns an OrderedSet containing them.
def ExtractSharedMSVSSystemIncludes(configs, generator_flags): """Finds msvs_system_include_dirs that are common to all targets, removes them from all targets, and returns an OrderedSet containing them.""" all_system_includes = OrderedSet(configs[0].get("msvs_system_include_dirs", [])) for config in confi...
[ "def", "ExtractSharedMSVSSystemIncludes", "(", "configs", ",", "generator_flags", ")", ":", "all_system_includes", "=", "OrderedSet", "(", "configs", "[", "0", "]", ".", "get", "(", "\"msvs_system_include_dirs\"", ",", "[", "]", ")", ")", "for", "config", "in", ...
[ 167, 0 ]
[ 192, 35 ]
python
en
['en', 'en', 'en']
True
ExpandMacros
(string, expansions)
Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv for the canonical way to retrieve a suitable dict.
Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv for the canonical way to retrieve a suitable dict.
def ExpandMacros(string, expansions): """Expand $(Variable) per expansions dict. See MsvsSettings.GetVSMacroEnv for the canonical way to retrieve a suitable dict.""" if "$" in string: for old, new in expansions.items(): assert "$(" not in new, new string = string.replace(old, n...
[ "def", "ExpandMacros", "(", "string", ",", "expansions", ")", ":", "if", "\"$\"", "in", "string", ":", "for", "old", ",", "new", "in", "expansions", ".", "items", "(", ")", ":", "assert", "\"$(\"", "not", "in", "new", ",", "new", "string", "=", "stri...
[ 1090, 0 ]
[ 1097, 17 ]
python
en
['en', 'en', 'it']
True
_ExtractImportantEnvironment
(output_of_set)
Extracts environment variables required for the toolchain to run from a textual dump output by the cmd.exe 'set' command.
Extracts environment variables required for the toolchain to run from a textual dump output by the cmd.exe 'set' command.
def _ExtractImportantEnvironment(output_of_set): """Extracts environment variables required for the toolchain to run from a textual dump output by the cmd.exe 'set' command.""" envvars_to_save = ( "goma_.*", # TODO(scottmg): This is ugly, but needed for goma. "include", "lib", ...
[ "def", "_ExtractImportantEnvironment", "(", "output_of_set", ")", ":", "envvars_to_save", "=", "(", "\"goma_.*\"", ",", "# TODO(scottmg): This is ugly, but needed for goma.", "\"include\"", ",", "\"lib\"", ",", "\"libpath\"", ",", "\"path\"", ",", "\"pathext\"", ",", "\"s...
[ 1100, 0 ]
[ 1137, 14 ]
python
en
['en', 'en', 'en']
True
_FormatAsEnvironmentBlock
(envvar_dict)
Format as an 'environment block' directly suitable for CreateProcess. Briefly this is a list of key=value\0, terminated by an additional \0. See CreateProcess documentation for more details.
Format as an 'environment block' directly suitable for CreateProcess. Briefly this is a list of key=value\0, terminated by an additional \0. See CreateProcess documentation for more details.
def _FormatAsEnvironmentBlock(envvar_dict): """Format as an 'environment block' directly suitable for CreateProcess. Briefly this is a list of key=value\0, terminated by an additional \0. See CreateProcess documentation for more details.""" block = "" nul = "\0" for key, value in envvar_dict.items()...
[ "def", "_FormatAsEnvironmentBlock", "(", "envvar_dict", ")", ":", "block", "=", "\"\"", "nul", "=", "\"\\0\"", "for", "key", ",", "value", "in", "envvar_dict", ".", "items", "(", ")", ":", "block", "+=", "key", "+", "\"=\"", "+", "value", "+", "nul", "...
[ 1140, 0 ]
[ 1149, 16 ]
python
en
['en', 'en', 'en']
True
_ExtractCLPath
(output_of_where)
Gets the path to cl.exe based on the output of calling the environment setup batch file, followed by the equivalent of `where`.
Gets the path to cl.exe based on the output of calling the environment setup batch file, followed by the equivalent of `where`.
def _ExtractCLPath(output_of_where): """Gets the path to cl.exe based on the output of calling the environment setup batch file, followed by the equivalent of `where`.""" # Take the first line, as that's the first found in the PATH. for line in output_of_where.strip().splitlines(): if line.startsw...
[ "def", "_ExtractCLPath", "(", "output_of_where", ")", ":", "# Take the first line, as that's the first found in the PATH.", "for", "line", "in", "output_of_where", ".", "strip", "(", ")", ".", "splitlines", "(", ")", ":", "if", "line", ".", "startswith", "(", "\"LOC...
[ 1152, 0 ]
[ 1158, 46 ]
python
en
['en', 'en', 'en']
True
GenerateEnvironmentFiles
( toplevel_build_dir, generator_flags, system_includes, open_out )
It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support msvs_target_platform hackery). Different architectures require a different compiler binary,...
It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support msvs_target_platform hackery). Different architectures require a different compiler binary,...
def GenerateEnvironmentFiles( toplevel_build_dir, generator_flags, system_includes, open_out ): """It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build ...
[ "def", "GenerateEnvironmentFiles", "(", "toplevel_build_dir", ",", "generator_flags", ",", "system_includes", ",", "open_out", ")", ":", "archs", "=", "(", "\"x86\"", ",", "\"x64\"", ")", "if", "generator_flags", ".", "get", "(", "\"ninja_use_custom_environment_files\...
[ 1161, 0 ]
[ 1222, 19 ]
python
en
['en', 'en', 'en']
True
VerifyMissingSources
(sources, build_dir, generator_flags, gyp_to_ninja)
Emulate behavior of msvs_error_on_missing_sources present in the msvs generator: Check that all regular source files, i.e. not created at run time, exist on disk. Missing files cause needless recompilation when building via VS, and we want this check to match for people/bots that build using ninja, so they're n...
Emulate behavior of msvs_error_on_missing_sources present in the msvs generator: Check that all regular source files, i.e. not created at run time, exist on disk. Missing files cause needless recompilation when building via VS, and we want this check to match for people/bots that build using ninja, so they're n...
def VerifyMissingSources(sources, build_dir, generator_flags, gyp_to_ninja): """Emulate behavior of msvs_error_on_missing_sources present in the msvs generator: Check that all regular source files, i.e. not created at run time, exist on disk. Missing files cause needless recompilation when building via VS, an...
[ "def", "VerifyMissingSources", "(", "sources", ",", "build_dir", ",", "generator_flags", ",", "gyp_to_ninja", ")", ":", "if", "int", "(", "generator_flags", ".", "get", "(", "\"msvs_error_on_missing_sources\"", ",", "0", ")", ")", ":", "no_specials", "=", "filte...
[ 1225, 0 ]
[ 1239, 79 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetExtension
(self)
Returns the extension for the target, with no leading dot. Uses 'product_extension' if specified, otherwise uses MSVS defaults based on the target type.
Returns the extension for the target, with no leading dot.
def GetExtension(self): """Returns the extension for the target, with no leading dot. Uses 'product_extension' if specified, otherwise uses MSVS defaults based on the target type. """ ext = self.spec.get("product_extension", None) if ext: return ext return gyp.MS...
[ "def", "GetExtension", "(", "self", ")", ":", "ext", "=", "self", ".", "spec", ".", "get", "(", "\"product_extension\"", ",", "None", ")", "if", "ext", ":", "return", "ext", "return", "gyp", ".", "MSVSUtil", ".", "TARGET_TYPE_EXT", ".", "get", "(", "se...
[ 236, 4 ]
[ 245, 70 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetVSMacroEnv
(self, base_to_build=None, config=None)
Get a dict of variables mapping internal VS macro names to their gyp equivalents.
Get a dict of variables mapping internal VS macro names to their gyp equivalents.
def GetVSMacroEnv(self, base_to_build=None, config=None): """Get a dict of variables mapping internal VS macro names to their gyp equivalents.""" target_arch = self.GetArch(config) if target_arch == "x86": target_platform = "Win32" else: target_platform = targ...
[ "def", "GetVSMacroEnv", "(", "self", ",", "base_to_build", "=", "None", ",", "config", "=", "None", ")", ":", "target_arch", "=", "self", ".", "GetArch", "(", "config", ")", "if", "target_arch", "==", "\"x86\"", ":", "target_platform", "=", "\"Win32\"", "e...
[ 247, 4 ]
[ 277, 27 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.ConvertVSMacros
(self, s, base_to_build=None, config=None)
Convert from VS macro names to something equivalent.
Convert from VS macro names to something equivalent.
def ConvertVSMacros(self, s, base_to_build=None, config=None): """Convert from VS macro names to something equivalent.""" env = self.GetVSMacroEnv(base_to_build, config=config) return ExpandMacros(s, env)
[ "def", "ConvertVSMacros", "(", "self", ",", "s", ",", "base_to_build", "=", "None", ",", "config", "=", "None", ")", ":", "env", "=", "self", ".", "GetVSMacroEnv", "(", "base_to_build", ",", "config", "=", "config", ")", "return", "ExpandMacros", "(", "s...
[ 279, 4 ]
[ 282, 35 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.AdjustLibraries
(self, libraries)
Strip -l from library if it's specified with that.
Strip -l from library if it's specified with that.
def AdjustLibraries(self, libraries): """Strip -l from library if it's specified with that.""" libs = [lib[2:] if lib.startswith("-l") else lib for lib in libraries] return [ lib + ".lib" if not lib.lower().endswith(".lib") and not lib.lower().endswith(".obj") ...
[ "def", "AdjustLibraries", "(", "self", ",", "libraries", ")", ":", "libs", "=", "[", "lib", "[", "2", ":", "]", "if", "lib", ".", "startswith", "(", "\"-l\"", ")", "else", "lib", "for", "lib", "in", "libraries", "]", "return", "[", "lib", "+", "\"....
[ 284, 4 ]
[ 292, 9 ]
python
en
['en', 'en', 'en']
True
MsvsSettings._GetAndMunge
(self, field, path, default, prefix, append, map)
Retrieve a value from |field| at |path| or return |default|. If |append| is specified, and the item is found, it will be appended to that object instead of returned. If |map| is specified, results will be remapped through |map| before being returned or appended.
Retrieve a value from |field| at |path| or return |default|. If |append| is specified, and the item is found, it will be appended to that object instead of returned. If |map| is specified, results will be remapped through |map| before being returned or appended.
def _GetAndMunge(self, field, path, default, prefix, append, map): """Retrieve a value from |field| at |path| or return |default|. If |append| is specified, and the item is found, it will be appended to that object instead of returned. If |map| is specified, results will be remapped through |map| be...
[ "def", "_GetAndMunge", "(", "self", ",", "field", ",", "path", ",", "default", ",", "prefix", ",", "append", ",", "map", ")", ":", "result", "=", "_GenericRetrieve", "(", "field", ",", "default", ",", "path", ")", "result", "=", "_DoRemapping", "(", "r...
[ 294, 4 ]
[ 302, 46 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetArch
(self, config)
Get architecture based on msvs_configuration_platform and msvs_target_platform. Returns either 'x86' or 'x64'.
Get architecture based on msvs_configuration_platform and msvs_target_platform. Returns either 'x86' or 'x64'.
def GetArch(self, config): """Get architecture based on msvs_configuration_platform and msvs_target_platform. Returns either 'x86' or 'x64'.""" configuration_platform = self.msvs_configuration_platform.get(config, "") platform = self.msvs_target_platform.get(config, "") if not platfo...
[ "def", "GetArch", "(", "self", ",", "config", ")", ":", "configuration_platform", "=", "self", ".", "msvs_configuration_platform", ".", "get", "(", "config", ",", "\"\"", ")", "platform", "=", "self", ".", "msvs_target_platform", ".", "get", "(", "config", "...
[ 321, 4 ]
[ 329, 84 ]
python
en
['en', 'en', 'en']
True
MsvsSettings._TargetConfig
(self, config)
Returns the target-specific configuration.
Returns the target-specific configuration.
def _TargetConfig(self, config): """Returns the target-specific configuration.""" # There's two levels of architecture/platform specification in VS. The # first level is globally for the configuration (this is what we consider # "the" config at the gyp level, which will be something like...
[ "def", "_TargetConfig", "(", "self", ",", "config", ")", ":", "# There's two levels of architecture/platform specification in VS. The", "# first level is globally for the configuration (this is what we consider", "# \"the\" config at the gyp level, which will be something like 'Debug' or", "# ...
[ 331, 4 ]
[ 347, 21 ]
python
en
['en', 'en', 'en']
True
MsvsSettings._Setting
(self, path, config, default=None, prefix="", append=None, map=None)
_GetAndMunge for msvs_settings.
_GetAndMunge for msvs_settings.
def _Setting(self, path, config, default=None, prefix="", append=None, map=None): """_GetAndMunge for msvs_settings.""" return self._GetAndMunge( self.msvs_settings[config], path, default, prefix, append, map )
[ "def", "_Setting", "(", "self", ",", "path", ",", "config", ",", "default", "=", "None", ",", "prefix", "=", "\"\"", ",", "append", "=", "None", ",", "map", "=", "None", ")", ":", "return", "self", ".", "_GetAndMunge", "(", "self", ".", "msvs_setting...
[ 349, 4 ]
[ 353, 9 ]
python
de
['de', 'no', 'en']
False
MsvsSettings._ConfigAttrib
( self, path, config, default=None, prefix="", append=None, map=None )
_GetAndMunge for msvs_configuration_attributes.
_GetAndMunge for msvs_configuration_attributes.
def _ConfigAttrib( self, path, config, default=None, prefix="", append=None, map=None ): """_GetAndMunge for msvs_configuration_attributes.""" return self._GetAndMunge( self.msvs_configuration_attributes[config], path, default, prefix, ...
[ "def", "_ConfigAttrib", "(", "self", ",", "path", ",", "config", ",", "default", "=", "None", ",", "prefix", "=", "\"\"", ",", "append", "=", "None", ",", "map", "=", "None", ")", ":", "return", "self", ".", "_GetAndMunge", "(", "self", ".", "msvs_co...
[ 355, 4 ]
[ 366, 9 ]
python
da
['de', 'da', 'en']
False
MsvsSettings.AdjustIncludeDirs
(self, include_dirs, config)
Updates include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.
Updates include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.
def AdjustIncludeDirs(self, include_dirs, config): """Updates include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.""" config = self._TargetConfig(config) includes = include_dirs + self.msvs_system_include_dirs[config] includes....
[ "def", "AdjustIncludeDirs", "(", "self", ",", "include_dirs", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "includes", "=", "include_dirs", "+", "self", ".", "msvs_system_include_dirs", "[", "config", "]", "includes...
[ 368, 4 ]
[ 378, 73 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.AdjustMidlIncludeDirs
(self, midl_include_dirs, config)
Updates midl_include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.
Updates midl_include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.
def AdjustMidlIncludeDirs(self, midl_include_dirs, config): """Updates midl_include_dirs to expand VS specific paths, and adds the system include dirs used for platform SDK and similar.""" config = self._TargetConfig(config) includes = midl_include_dirs + self.msvs_system_include_dirs[config...
[ "def", "AdjustMidlIncludeDirs", "(", "self", ",", "midl_include_dirs", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "includes", "=", "midl_include_dirs", "+", "self", ".", "msvs_system_include_dirs", "[", "config", "]...
[ 380, 4 ]
[ 390, 73 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetComputedDefines
(self, config)
Returns the set of defines that are injected to the defines list based on other VS settings.
Returns the set of defines that are injected to the defines list based on other VS settings.
def GetComputedDefines(self, config): """Returns the set of defines that are injected to the defines list based on other VS settings.""" config = self._TargetConfig(config) defines = [] if self._ConfigAttrib(["CharacterSet"], config) == "1": defines.extend(("_UNICODE", "U...
[ "def", "GetComputedDefines", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "defines", "=", "[", "]", "if", "self", ".", "_ConfigAttrib", "(", "[", "\"CharacterSet\"", "]", ",", "config", ")", "==",...
[ 392, 4 ]
[ 406, 22 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetCompilerPdbName
(self, config, expand_special)
Get the pdb file name that should be used for compiler invocations, or None if there's no explicit name specified.
Get the pdb file name that should be used for compiler invocations, or None if there's no explicit name specified.
def GetCompilerPdbName(self, config, expand_special): """Get the pdb file name that should be used for compiler invocations, or None if there's no explicit name specified.""" config = self._TargetConfig(config) pdbname = self._Setting(("VCCLCompilerTool", "ProgramDataBaseFileName"), config) ...
[ "def", "GetCompilerPdbName", "(", "self", ",", "config", ",", "expand_special", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "pdbname", "=", "self", ".", "_Setting", "(", "(", "\"VCCLCompilerTool\"", ",", "\"ProgramDataBaseFileName\...
[ 408, 4 ]
[ 415, 22 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetMapFileName
(self, config, expand_special)
Gets the explicitly overridden map file name for a target or returns None if it's not set.
Gets the explicitly overridden map file name for a target or returns None if it's not set.
def GetMapFileName(self, config, expand_special): """Gets the explicitly overridden map file name for a target or returns None if it's not set.""" config = self._TargetConfig(config) map_file = self._Setting(("VCLinkerTool", "MapFileName"), config) if map_file: map_file =...
[ "def", "GetMapFileName", "(", "self", ",", "config", ",", "expand_special", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "map_file", "=", "self", ".", "_Setting", "(", "(", "\"VCLinkerTool\"", ",", "\"MapFileName\"", ")", ",", ...
[ 417, 4 ]
[ 424, 23 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetOutputName
(self, config, expand_special)
Gets the explicitly overridden output name for a target or returns None if it's not overridden.
Gets the explicitly overridden output name for a target or returns None if it's not overridden.
def GetOutputName(self, config, expand_special): """Gets the explicitly overridden output name for a target or returns None if it's not overridden.""" config = self._TargetConfig(config) type = self.spec["type"] root = "VCLibrarianTool" if type == "static_library" else "VCLinkerTool"...
[ "def", "GetOutputName", "(", "self", ",", "config", ",", "expand_special", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "type", "=", "self", ".", "spec", "[", "\"type\"", "]", "root", "=", "\"VCLibrarianTool\"", "if", "type", ...
[ 426, 4 ]
[ 438, 26 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetPDBName
(self, config, expand_special, default)
Gets the explicitly overridden pdb name for a target or returns default if it's not overridden, or if no pdb will be generated.
Gets the explicitly overridden pdb name for a target or returns default if it's not overridden, or if no pdb will be generated.
def GetPDBName(self, config, expand_special, default): """Gets the explicitly overridden pdb name for a target or returns default if it's not overridden, or if no pdb will be generated.""" config = self._TargetConfig(config) output_file = self._Setting(("VCLinkerTool", "ProgramDatabaseFile")...
[ "def", "GetPDBName", "(", "self", ",", "config", ",", "expand_special", ",", "default", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "output_file", "=", "self", ".", "_Setting", "(", "(", "\"VCLinkerTool\"", ",", "\"ProgramDatab...
[ 440, 4 ]
[ 454, 23 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetNoImportLibrary
(self, config)
If NoImportLibrary: true, ninja will not expect the output to include an import library.
If NoImportLibrary: true, ninja will not expect the output to include an import library.
def GetNoImportLibrary(self, config): """If NoImportLibrary: true, ninja will not expect the output to include an import library.""" config = self._TargetConfig(config) noimplib = self._Setting(("NoImportLibrary",), config) return noimplib == "true"
[ "def", "GetNoImportLibrary", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "noimplib", "=", "self", ".", "_Setting", "(", "(", "\"NoImportLibrary\"", ",", ")", ",", "config", ")", "return", "noimplib...
[ 456, 4 ]
[ 461, 33 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetAsmflags
(self, config)
Returns the flags that need to be added to ml invocations.
Returns the flags that need to be added to ml invocations.
def GetAsmflags(self, config): """Returns the flags that need to be added to ml invocations.""" config = self._TargetConfig(config) asmflags = [] safeseh = self._Setting(("MASM", "UseSafeExceptionHandlers"), config) if safeseh == "true": asmflags.append("/safeseh") ...
[ "def", "GetAsmflags", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "asmflags", "=", "[", "]", "safeseh", "=", "self", ".", "_Setting", "(", "(", "\"MASM\"", ",", "\"UseSafeExceptionHandlers\"", ")",...
[ 463, 4 ]
[ 470, 23 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetCflags
(self, config)
Returns the flags that need to be added to .c and .cc compilations.
Returns the flags that need to be added to .c and .cc compilations.
def GetCflags(self, config): """Returns the flags that need to be added to .c and .cc compilations.""" config = self._TargetConfig(config) cflags = [] cflags.extend(["/wd" + w for w in self.msvs_disabled_warnings[config]]) cl = self._GetWrapper( self, self.msvs_settin...
[ "def", "GetCflags", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "cflags", "=", "[", "]", "cflags", ".", "extend", "(", "[", "\"/wd\"", "+", "w", "for", "w", "in", "self", ".", "msvs_disabled_...
[ 472, 4 ]
[ 548, 21 ]
python
en
['en', 'en', 'en']
True
MsvsSettings._GetPchFlags
(self, config, extension)
Get the flags to be added to the cflags for precompiled header support.
Get the flags to be added to the cflags for precompiled header support.
def _GetPchFlags(self, config, extension): """Get the flags to be added to the cflags for precompiled header support. """ config = self._TargetConfig(config) # The PCH is only built once by a particular source file. Usage of PCH must # only be for the same language (i.e. C vs. C++), ...
[ "def", "_GetPchFlags", "(", "self", ",", "config", ",", "extension", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "# The PCH is only built once by a particular source file. Usage of PCH must", "# only be for the same language (i.e. C vs. C++), so o...
[ 550, 4 ]
[ 563, 17 ]
python
en
['en', 'en', 'en']
True
MsvsSettings.GetCflagsC
(self, config)
Returns the flags that need to be added to .c compilations.
Returns the flags that need to be added to .c compilations.
def GetCflagsC(self, config): """Returns the flags that need to be added to .c compilations.""" config = self._TargetConfig(config) return self._GetPchFlags(config, ".c")
[ "def", "GetCflagsC", "(", "self", ",", "config", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "return", "self", ".", "_GetPchFlags", "(", "config", ",", "\".c\"", ")" ]
[ 565, 4 ]
[ 568, 46 ]
python
en
['en', 'en', 'en']
True