id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
49,800 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/utils.py | get_serializer | def get_serializer(serializer):
""" Load a serializer. """
if isinstance(serializer, string_types):
try:
app_label, serializer_name = serializer.split('.')
app_package = get_application(app_label)
serializer_module = import_module('%s.serializers' % app_package)
... | python | def get_serializer(serializer):
""" Load a serializer. """
if isinstance(serializer, string_types):
try:
app_label, serializer_name = serializer.split('.')
app_package = get_application(app_label)
serializer_module = import_module('%s.serializers' % app_package)
... | [
"def",
"get_serializer",
"(",
"serializer",
")",
":",
"if",
"isinstance",
"(",
"serializer",
",",
"string_types",
")",
":",
"try",
":",
"app_label",
",",
"serializer_name",
"=",
"serializer",
".",
"split",
"(",
"'.'",
")",
"app_package",
"=",
"get_application"... | Load a serializer. | [
"Load",
"a",
"serializer",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/utils.py#L28-L39 |
49,801 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/serializers.py | ModelPermissionsSerializer._get_user_allowed_fields | def _get_user_allowed_fields(self):
""" Retrieve all allowed field names ofr authenticated user. """
model_name = self.Meta.model.__name__.lower()
app_label = self.Meta.model._meta.app_label
full_model_name = '%s.%s' % (app_label, model_name)
permissions = self.cached_allowed_fie... | python | def _get_user_allowed_fields(self):
""" Retrieve all allowed field names ofr authenticated user. """
model_name = self.Meta.model.__name__.lower()
app_label = self.Meta.model._meta.app_label
full_model_name = '%s.%s' % (app_label, model_name)
permissions = self.cached_allowed_fie... | [
"def",
"_get_user_allowed_fields",
"(",
"self",
")",
":",
"model_name",
"=",
"self",
".",
"Meta",
".",
"model",
".",
"__name__",
".",
"lower",
"(",
")",
"app_label",
"=",
"self",
".",
"Meta",
".",
"model",
".",
"_meta",
".",
"app_label",
"full_model_name",... | Retrieve all allowed field names ofr authenticated user. | [
"Retrieve",
"all",
"allowed",
"field",
"names",
"ofr",
"authenticated",
"user",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/serializers.py#L46-L60 |
49,802 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/serializers.py | ModelPermissionsSerializer.get_fields | def get_fields(self):
""" Calculate fields that can be accessed by authenticated user. """
ret = OrderedDict()
# no rights to see anything
if not self.user:
return ret
# all fields that can be accessed through serializer
fields = super(ModelPermissionsSerial... | python | def get_fields(self):
""" Calculate fields that can be accessed by authenticated user. """
ret = OrderedDict()
# no rights to see anything
if not self.user:
return ret
# all fields that can be accessed through serializer
fields = super(ModelPermissionsSerial... | [
"def",
"get_fields",
"(",
"self",
")",
":",
"ret",
"=",
"OrderedDict",
"(",
")",
"# no rights to see anything",
"if",
"not",
"self",
".",
"user",
":",
"return",
"ret",
"# all fields that can be accessed through serializer",
"fields",
"=",
"super",
"(",
"ModelPermiss... | Calculate fields that can be accessed by authenticated user. | [
"Calculate",
"fields",
"that",
"can",
"be",
"accessed",
"by",
"authenticated",
"user",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/serializers.py#L62-L96 |
49,803 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/serializers.py | ModelPermissionsSerializer._get_default_field_names | def _get_default_field_names(self, declared_fields, model_info):
""" Return default field names for serializer. """
return (
[model_info.pk.name] +
list(declared_fields.keys()) +
list(model_info.fields.keys()) +
list(model_info.relations.keys())
) | python | def _get_default_field_names(self, declared_fields, model_info):
""" Return default field names for serializer. """
return (
[model_info.pk.name] +
list(declared_fields.keys()) +
list(model_info.fields.keys()) +
list(model_info.relations.keys())
) | [
"def",
"_get_default_field_names",
"(",
"self",
",",
"declared_fields",
",",
"model_info",
")",
":",
"return",
"(",
"[",
"model_info",
".",
"pk",
".",
"name",
"]",
"+",
"list",
"(",
"declared_fields",
".",
"keys",
"(",
")",
")",
"+",
"list",
"(",
"model_... | Return default field names for serializer. | [
"Return",
"default",
"field",
"names",
"for",
"serializer",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/serializers.py#L98-L105 |
49,804 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/serializers.py | ModelPermissionsSerializer._get_nested_class | def _get_nested_class(self, nested_depth, relation_info):
""" Define the serializer class for a relational field. """
class NestedModelPermissionSerializer(ModelPermissionsSerializer):
""" Default nested class for relation. """
class Meta:
model = relation_info.... | python | def _get_nested_class(self, nested_depth, relation_info):
""" Define the serializer class for a relational field. """
class NestedModelPermissionSerializer(ModelPermissionsSerializer):
""" Default nested class for relation. """
class Meta:
model = relation_info.... | [
"def",
"_get_nested_class",
"(",
"self",
",",
"nested_depth",
",",
"relation_info",
")",
":",
"class",
"NestedModelPermissionSerializer",
"(",
"ModelPermissionsSerializer",
")",
":",
"\"\"\" Default nested class for relation. \"\"\"",
"class",
"Meta",
":",
"model",
"=",
"... | Define the serializer class for a relational field. | [
"Define",
"the",
"serializer",
"class",
"for",
"a",
"relational",
"field",
"."
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/serializers.py#L107-L119 |
49,805 | orb-framework/orb | orb/core/connection_types/sql/sqlite/sqliteconnection.py | dict_factory | def dict_factory(cursor, row):
"""
Converts the cursor information from a SQLite query to a dictionary.
:param cursor | <sqlite3.Cursor>
row | <sqlite3.Row>
:return {<str> column: <variant> value, ..}
"""
out = {}
for i, col in enumerate(cursor.description):
... | python | def dict_factory(cursor, row):
"""
Converts the cursor information from a SQLite query to a dictionary.
:param cursor | <sqlite3.Cursor>
row | <sqlite3.Row>
:return {<str> column: <variant> value, ..}
"""
out = {}
for i, col in enumerate(cursor.description):
... | [
"def",
"dict_factory",
"(",
"cursor",
",",
"row",
")",
":",
"out",
"=",
"{",
"}",
"for",
"i",
",",
"col",
"in",
"enumerate",
"(",
"cursor",
".",
"description",
")",
":",
"out",
"[",
"col",
"[",
"0",
"]",
"]",
"=",
"row",
"[",
"i",
"]",
"return"... | Converts the cursor information from a SQLite query to a dictionary.
:param cursor | <sqlite3.Cursor>
row | <sqlite3.Row>
:return {<str> column: <variant> value, ..} | [
"Converts",
"the",
"cursor",
"information",
"from",
"a",
"SQLite",
"query",
"to",
"a",
"dictionary",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/connection_types/sql/sqlite/sqliteconnection.py#L51-L63 |
49,806 | priestc/giotto | giotto/contrib/auth/models.py | basic_register | def basic_register(username, password, password2):
"""
Register a user and session, and then return the session_key and user.
"""
if password != password2:
raise InvalidInput(password={'message': "Passwords do not match"},
username={'value': username})
user = User.... | python | def basic_register(username, password, password2):
"""
Register a user and session, and then return the session_key and user.
"""
if password != password2:
raise InvalidInput(password={'message': "Passwords do not match"},
username={'value': username})
user = User.... | [
"def",
"basic_register",
"(",
"username",
",",
"password",
",",
"password2",
")",
":",
"if",
"password",
"!=",
"password2",
":",
"raise",
"InvalidInput",
"(",
"password",
"=",
"{",
"'message'",
":",
"\"Passwords do not match\"",
"}",
",",
"username",
"=",
"{",... | Register a user and session, and then return the session_key and user. | [
"Register",
"a",
"user",
"and",
"session",
"and",
"then",
"return",
"the",
"session_key",
"and",
"user",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/contrib/auth/models.py#L10-L18 |
49,807 | priestc/giotto | giotto/contrib/auth/models.py | create_session | def create_session(username, password):
"""
Create a session for the user, and then return the key.
"""
user = User.objects.get_user_by_password(username, password)
auth_session_engine = get_config('auth_session_engine')
if not user:
raise InvalidInput('Username or password incorrect')
... | python | def create_session(username, password):
"""
Create a session for the user, and then return the key.
"""
user = User.objects.get_user_by_password(username, password)
auth_session_engine = get_config('auth_session_engine')
if not user:
raise InvalidInput('Username or password incorrect')
... | [
"def",
"create_session",
"(",
"username",
",",
"password",
")",
":",
"user",
"=",
"User",
".",
"objects",
".",
"get_user_by_password",
"(",
"username",
",",
"password",
")",
"auth_session_engine",
"=",
"get_config",
"(",
"'auth_session_engine'",
")",
"if",
"not"... | Create a session for the user, and then return the key. | [
"Create",
"a",
"session",
"for",
"the",
"user",
"and",
"then",
"return",
"the",
"key",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/contrib/auth/models.py#L20-L32 |
49,808 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.dbRestore | def dbRestore(self, db_value, context=None):
"""
Extracts the db_value provided back from the database.
:param db_value: <variant>
:param context: <orb.Context>
:return: <variant>
"""
if isinstance(db_value, (str, unicode)) and db_value.startswith('{'):
... | python | def dbRestore(self, db_value, context=None):
"""
Extracts the db_value provided back from the database.
:param db_value: <variant>
:param context: <orb.Context>
:return: <variant>
"""
if isinstance(db_value, (str, unicode)) and db_value.startswith('{'):
... | [
"def",
"dbRestore",
"(",
"self",
",",
"db_value",
",",
"context",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"db_value",
",",
"(",
"str",
",",
"unicode",
")",
")",
"and",
"db_value",
".",
"startswith",
"(",
"'{'",
")",
":",
"try",
":",
"db_value... | Extracts the db_value provided back from the database.
:param db_value: <variant>
:param context: <orb.Context>
:return: <variant> | [
"Extracts",
"the",
"db_value",
"provided",
"back",
"from",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L89-L121 |
49,809 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.loadJSON | def loadJSON(self, jdata):
"""
Loads the given JSON information for this column.
:param jdata: <dict>
"""
super(ReferenceColumn, self).loadJSON(jdata)
# load additional information
self.__reference = jdata.get('reference') or self.__reference
self.__remo... | python | def loadJSON(self, jdata):
"""
Loads the given JSON information for this column.
:param jdata: <dict>
"""
super(ReferenceColumn, self).loadJSON(jdata)
# load additional information
self.__reference = jdata.get('reference') or self.__reference
self.__remo... | [
"def",
"loadJSON",
"(",
"self",
",",
"jdata",
")",
":",
"super",
"(",
"ReferenceColumn",
",",
"self",
")",
".",
"loadJSON",
"(",
"jdata",
")",
"# load additional information",
"self",
".",
"__reference",
"=",
"jdata",
".",
"get",
"(",
"'reference'",
")",
"... | Loads the given JSON information for this column.
:param jdata: <dict> | [
"Loads",
"the",
"given",
"JSON",
"information",
"for",
"this",
"column",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L123-L133 |
49,810 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.referenceModel | def referenceModel(self):
"""
Returns the model that this column references.
:return <Table> || None
"""
model = orb.system.model(self.__reference)
if not model:
raise orb.errors.ModelNotFound(schema=self.__reference)
return model | python | def referenceModel(self):
"""
Returns the model that this column references.
:return <Table> || None
"""
model = orb.system.model(self.__reference)
if not model:
raise orb.errors.ModelNotFound(schema=self.__reference)
return model | [
"def",
"referenceModel",
"(",
"self",
")",
":",
"model",
"=",
"orb",
".",
"system",
".",
"model",
"(",
"self",
".",
"__reference",
")",
"if",
"not",
"model",
":",
"raise",
"orb",
".",
"errors",
".",
"ModelNotFound",
"(",
"schema",
"=",
"self",
".",
"... | Returns the model that this column references.
:return <Table> || None | [
"Returns",
"the",
"model",
"that",
"this",
"column",
"references",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L146-L155 |
49,811 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.restore | def restore(self, value, context=None):
"""
Returns the inflated value state. This method will match the desired inflated state.
:param value: <variant>
:param inflated: <bool>
:return: <variant>
"""
context = context or orb.Context()
value = super(Refe... | python | def restore(self, value, context=None):
"""
Returns the inflated value state. This method will match the desired inflated state.
:param value: <variant>
:param inflated: <bool>
:return: <variant>
"""
context = context or orb.Context()
value = super(Refe... | [
"def",
"restore",
"(",
"self",
",",
"value",
",",
"context",
"=",
"None",
")",
":",
"context",
"=",
"context",
"or",
"orb",
".",
"Context",
"(",
")",
"value",
"=",
"super",
"(",
"ReferenceColumn",
",",
"self",
")",
".",
"restore",
"(",
"value",
",",
... | Returns the inflated value state. This method will match the desired inflated state.
:param value: <variant>
:param inflated: <bool>
:return: <variant> | [
"Returns",
"the",
"inflated",
"value",
"state",
".",
"This",
"method",
"will",
"match",
"the",
"desired",
"inflated",
"state",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L157-L173 |
49,812 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.validate | def validate(self, value):
"""
Re-implements the orb.Column.validate method to verify that the
reference model type that is used with this column instance is
the type of value being provided.
:param value: <variant>
:return: <bool>
"""
ref_model = self.r... | python | def validate(self, value):
"""
Re-implements the orb.Column.validate method to verify that the
reference model type that is used with this column instance is
the type of value being provided.
:param value: <variant>
:return: <bool>
"""
ref_model = self.r... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"ref_model",
"=",
"self",
".",
"referenceModel",
"(",
")",
"if",
"isinstance",
"(",
"value",
",",
"orb",
".",
"Model",
")",
":",
"expected_schema",
"=",
"ref_model",
".",
"schema",
"(",
")",
".",
... | Re-implements the orb.Column.validate method to verify that the
reference model type that is used with this column instance is
the type of value being provided.
:param value: <variant>
:return: <bool> | [
"Re",
"-",
"implements",
"the",
"orb",
".",
"Column",
".",
"validate",
"method",
"to",
"verify",
"that",
"the",
"reference",
"model",
"type",
"that",
"is",
"used",
"with",
"this",
"column",
"instance",
"is",
"the",
"type",
"of",
"value",
"being",
"provided... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L175-L195 |
49,813 | orb-framework/orb | orb/core/column_types/reference.py | ReferenceColumn.valueFromString | def valueFromString(self, value, context=None):
"""
Re-implements the orb.Column.valueFromString method to
lookup a reference object based on the given value.
:param value: <str>
:param context: <orb.Context> || None
:return: <orb.Model> || None
"""
mode... | python | def valueFromString(self, value, context=None):
"""
Re-implements the orb.Column.valueFromString method to
lookup a reference object based on the given value.
:param value: <str>
:param context: <orb.Context> || None
:return: <orb.Model> || None
"""
mode... | [
"def",
"valueFromString",
"(",
"self",
",",
"value",
",",
"context",
"=",
"None",
")",
":",
"model",
"=",
"self",
".",
"referenceModel",
"(",
")",
"return",
"model",
"(",
"value",
",",
"context",
"=",
"context",
")"
] | Re-implements the orb.Column.valueFromString method to
lookup a reference object based on the given value.
:param value: <str>
:param context: <orb.Context> || None
:return: <orb.Model> || None | [
"Re",
"-",
"implements",
"the",
"orb",
".",
"Column",
".",
"valueFromString",
"method",
"to",
"lookup",
"a",
"reference",
"object",
"based",
"on",
"the",
"given",
"value",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/reference.py#L197-L208 |
49,814 | orb-framework/orb | orb/core/database.py | Database.addNamespace | def addNamespace(self, namespace, **context):
"""
Creates a new namespace within this database.
:param namespace: <str>
"""
self.connection().addNamespace(namespace, orb.Context(**context)) | python | def addNamespace(self, namespace, **context):
"""
Creates a new namespace within this database.
:param namespace: <str>
"""
self.connection().addNamespace(namespace, orb.Context(**context)) | [
"def",
"addNamespace",
"(",
"self",
",",
"namespace",
",",
"*",
"*",
"context",
")",
":",
"self",
".",
"connection",
"(",
")",
".",
"addNamespace",
"(",
"namespace",
",",
"orb",
".",
"Context",
"(",
"*",
"*",
"context",
")",
")"
] | Creates a new namespace within this database.
:param namespace: <str> | [
"Creates",
"a",
"new",
"namespace",
"within",
"this",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/database.py#L77-L83 |
49,815 | orb-framework/orb | orb/core/database.py | Database.setConnection | def setConnection(self, connection):
"""
Assigns the backend connection for this database instance.
:param connection: <str> || <orb.Connection>
"""
# define custom properties
if not isinstance(connection, orb.Connection):
conn = orb.Connection.byName(connect... | python | def setConnection(self, connection):
"""
Assigns the backend connection for this database instance.
:param connection: <str> || <orb.Connection>
"""
# define custom properties
if not isinstance(connection, orb.Connection):
conn = orb.Connection.byName(connect... | [
"def",
"setConnection",
"(",
"self",
",",
"connection",
")",
":",
"# define custom properties",
"if",
"not",
"isinstance",
"(",
"connection",
",",
"orb",
".",
"Connection",
")",
":",
"conn",
"=",
"orb",
".",
"Connection",
".",
"byName",
"(",
"connection",
")... | Assigns the backend connection for this database instance.
:param connection: <str> || <orb.Connection> | [
"Assigns",
"the",
"backend",
"connection",
"for",
"this",
"database",
"instance",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/database.py#L206-L221 |
49,816 | twisted/twistedchecker | twistedchecker/core/exceptionfinder.py | findPatternsInFile | def findPatternsInFile(codes, patternFinder):
"""
Find patterns of exceptions in a file.
@param codes: code of the file to check
@param patternFinder: a visitor for pattern checking and save results
"""
tree = ast.parse(codes)
patternFinder.visit(tree) | python | def findPatternsInFile(codes, patternFinder):
"""
Find patterns of exceptions in a file.
@param codes: code of the file to check
@param patternFinder: a visitor for pattern checking and save results
"""
tree = ast.parse(codes)
patternFinder.visit(tree) | [
"def",
"findPatternsInFile",
"(",
"codes",
",",
"patternFinder",
")",
":",
"tree",
"=",
"ast",
".",
"parse",
"(",
"codes",
")",
"patternFinder",
".",
"visit",
"(",
"tree",
")"
] | Find patterns of exceptions in a file.
@param codes: code of the file to check
@param patternFinder: a visitor for pattern checking and save results | [
"Find",
"patterns",
"of",
"exceptions",
"in",
"a",
"file",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/exceptionfinder.py#L55-L63 |
49,817 | twisted/twistedchecker | twistedchecker/core/exceptionfinder.py | findAllExceptions | def findAllExceptions(pathToCheck):
"""
Find patterns of exceptions in a file or folder.
@param patternFinder: a visitor for pattern checking and save results
@return: patterns of special functions and classes
"""
finder = PatternFinder()
if os.path.isfile(pathToCheck):
with open(pa... | python | def findAllExceptions(pathToCheck):
"""
Find patterns of exceptions in a file or folder.
@param patternFinder: a visitor for pattern checking and save results
@return: patterns of special functions and classes
"""
finder = PatternFinder()
if os.path.isfile(pathToCheck):
with open(pa... | [
"def",
"findAllExceptions",
"(",
"pathToCheck",
")",
":",
"finder",
"=",
"PatternFinder",
"(",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"pathToCheck",
")",
":",
"with",
"open",
"(",
"pathToCheck",
")",
"as",
"f",
":",
"findPatternsInFile",
"(",
... | Find patterns of exceptions in a file or folder.
@param patternFinder: a visitor for pattern checking and save results
@return: patterns of special functions and classes | [
"Find",
"patterns",
"of",
"exceptions",
"in",
"a",
"file",
"or",
"folder",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/exceptionfinder.py#L67-L86 |
49,818 | twisted/twistedchecker | twistedchecker/core/exceptionfinder.py | PatternFinder.visit_Call | def visit_Call(self, nodeCall):
"""
Be invoked when visiting a node of function call.
@param node: currently visiting node
"""
super(PatternFinder, self).generic_visit(nodeCall)
# Capture assignment like 'f = getattr(...)'.
if hasattr(nodeCall.func, "func"):
... | python | def visit_Call(self, nodeCall):
"""
Be invoked when visiting a node of function call.
@param node: currently visiting node
"""
super(PatternFinder, self).generic_visit(nodeCall)
# Capture assignment like 'f = getattr(...)'.
if hasattr(nodeCall.func, "func"):
... | [
"def",
"visit_Call",
"(",
"self",
",",
"nodeCall",
")",
":",
"super",
"(",
"PatternFinder",
",",
"self",
")",
".",
"generic_visit",
"(",
"nodeCall",
")",
"# Capture assignment like 'f = getattr(...)'.",
"if",
"hasattr",
"(",
"nodeCall",
".",
"func",
",",
"\"func... | Be invoked when visiting a node of function call.
@param node: currently visiting node | [
"Be",
"invoked",
"when",
"visiting",
"a",
"node",
"of",
"function",
"call",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/exceptionfinder.py#L14-L51 |
49,819 | orb-framework/orb | orb/core/query.py | Query.copy | def copy(self):
"""
Returns a duplicate of this instance.
:return <Query>
"""
options = {
'op': self.__op,
'caseSensitive': self.__caseSensitive,
'value': copy.copy(self.__value),
'inverted': self.__inverted,
'funct... | python | def copy(self):
"""
Returns a duplicate of this instance.
:return <Query>
"""
options = {
'op': self.__op,
'caseSensitive': self.__caseSensitive,
'value': copy.copy(self.__value),
'inverted': self.__inverted,
'funct... | [
"def",
"copy",
"(",
"self",
")",
":",
"options",
"=",
"{",
"'op'",
":",
"self",
".",
"__op",
",",
"'caseSensitive'",
":",
"self",
".",
"__caseSensitive",
",",
"'value'",
":",
"copy",
".",
"copy",
"(",
"self",
".",
"__value",
")",
",",
"'inverted'",
"... | Returns a duplicate of this instance.
:return <Query> | [
"Returns",
"a",
"duplicate",
"of",
"this",
"instance",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L664-L678 |
49,820 | orb-framework/orb | orb/core/query.py | Query.inverted | def inverted(self):
"""
Returns an inverted copy of this query.
:return <orb.Query>
"""
out = self.copy()
out.setInverted(not self.isInverted())
return out | python | def inverted(self):
"""
Returns an inverted copy of this query.
:return <orb.Query>
"""
out = self.copy()
out.setInverted(not self.isInverted())
return out | [
"def",
"inverted",
"(",
"self",
")",
":",
"out",
"=",
"self",
".",
"copy",
"(",
")",
"out",
".",
"setInverted",
"(",
"not",
"self",
".",
"isInverted",
"(",
")",
")",
"return",
"out"
] | Returns an inverted copy of this query.
:return <orb.Query> | [
"Returns",
"an",
"inverted",
"copy",
"of",
"this",
"query",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L894-L902 |
49,821 | orb-framework/orb | orb/core/query.py | Query.fromJSON | def fromJSON(jdata):
"""
Creates a new Query object from the given JSON data.
:param jdata | <dict>
:return <orb.Query> || <orb.QueryCompound>
"""
if jdata['type'] == 'compound':
queries = [orb.Query.fromJSON(jquery) for jquery in jdata['queries']]
... | python | def fromJSON(jdata):
"""
Creates a new Query object from the given JSON data.
:param jdata | <dict>
:return <orb.Query> || <orb.QueryCompound>
"""
if jdata['type'] == 'compound':
queries = [orb.Query.fromJSON(jquery) for jquery in jdata['queries']]
... | [
"def",
"fromJSON",
"(",
"jdata",
")",
":",
"if",
"jdata",
"[",
"'type'",
"]",
"==",
"'compound'",
":",
"queries",
"=",
"[",
"orb",
".",
"Query",
".",
"fromJSON",
"(",
"jquery",
")",
"for",
"jquery",
"in",
"jdata",
"[",
"'queries'",
"]",
"]",
"out",
... | Creates a new Query object from the given JSON data.
:param jdata | <dict>
:return <orb.Query> || <orb.QueryCompound> | [
"Creates",
"a",
"new",
"Query",
"object",
"from",
"the",
"given",
"JSON",
"data",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1205-L1241 |
49,822 | orb-framework/orb | orb/core/query.py | QueryCompound.columns | def columns(self, model=None):
"""
Returns any columns used within this query.
:return [<orb.Column>, ..]
"""
for query in self.__queries:
for column in query.columns(model=model):
yield column | python | def columns(self, model=None):
"""
Returns any columns used within this query.
:return [<orb.Column>, ..]
"""
for query in self.__queries:
for column in query.columns(model=model):
yield column | [
"def",
"columns",
"(",
"self",
",",
"model",
"=",
"None",
")",
":",
"for",
"query",
"in",
"self",
".",
"__queries",
":",
"for",
"column",
"in",
"query",
".",
"columns",
"(",
"model",
"=",
"model",
")",
":",
"yield",
"column"
] | Returns any columns used within this query.
:return [<orb.Column>, ..] | [
"Returns",
"any",
"columns",
"used",
"within",
"this",
"query",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1384-L1392 |
49,823 | orb-framework/orb | orb/core/query.py | QueryCompound.expand | def expand(self, model=None, ignoreFilter=False):
"""
Expands any shortcuts that were created for this query. Shortcuts
provide the user access to joined methods using the '.' accessor to
access individual columns for referenced tables.
:param model | <orb.Model>
... | python | def expand(self, model=None, ignoreFilter=False):
"""
Expands any shortcuts that were created for this query. Shortcuts
provide the user access to joined methods using the '.' accessor to
access individual columns for referenced tables.
:param model | <orb.Model>
... | [
"def",
"expand",
"(",
"self",
",",
"model",
"=",
"None",
",",
"ignoreFilter",
"=",
"False",
")",
":",
"queries",
"=",
"[",
"]",
"current_records",
"=",
"None",
"for",
"query",
"in",
"self",
".",
"__queries",
":",
"sub_q",
"=",
"query",
".",
"expand",
... | Expands any shortcuts that were created for this query. Shortcuts
provide the user access to joined methods using the '.' accessor to
access individual columns for referenced tables.
:param model | <orb.Model>
:usage |>>> from orb import Query as Q
|>>> #... | [
"Expands",
"any",
"shortcuts",
"that",
"were",
"created",
"for",
"this",
"query",
".",
"Shortcuts",
"provide",
"the",
"user",
"access",
"to",
"joined",
"methods",
"using",
"the",
".",
"accessor",
"to",
"access",
"individual",
"columns",
"for",
"referenced",
"t... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1394-L1447 |
49,824 | orb-framework/orb | orb/core/query.py | QueryCompound.negated | def negated(self):
"""
Negates this instance and returns it.
:return self
"""
op = QueryCompound.Op.And if self.__op == QueryCompound.Op.Or else QueryCompound.Op.Or
return QueryCompound(*self.__queries, op=op) | python | def negated(self):
"""
Negates this instance and returns it.
:return self
"""
op = QueryCompound.Op.And if self.__op == QueryCompound.Op.Or else QueryCompound.Op.Or
return QueryCompound(*self.__queries, op=op) | [
"def",
"negated",
"(",
"self",
")",
":",
"op",
"=",
"QueryCompound",
".",
"Op",
".",
"And",
"if",
"self",
".",
"__op",
"==",
"QueryCompound",
".",
"Op",
".",
"Or",
"else",
"QueryCompound",
".",
"Op",
".",
"Or",
"return",
"QueryCompound",
"(",
"*",
"s... | Negates this instance and returns it.
:return self | [
"Negates",
"this",
"instance",
"and",
"returns",
"it",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1468-L1475 |
49,825 | orb-framework/orb | orb/core/query.py | QueryCompound.or_ | def or_(self, other):
"""
Creates a new compound query using the
QueryCompound.Op.Or type.
:param other <Query> || <QueryCompound>
:return <QueryCompound>
:sa or_
:usage |>>> from orb import Query as Q
|>>> query = (... | python | def or_(self, other):
"""
Creates a new compound query using the
QueryCompound.Op.Or type.
:param other <Query> || <QueryCompound>
:return <QueryCompound>
:sa or_
:usage |>>> from orb import Query as Q
|>>> query = (... | [
"def",
"or_",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"(",
"Query",
",",
"QueryCompound",
")",
")",
"or",
"other",
".",
"isNull",
"(",
")",
":",
"return",
"self",
".",
"copy",
"(",
")",
"elif",
"self",
"... | Creates a new compound query using the
QueryCompound.Op.Or type.
:param other <Query> || <QueryCompound>
:return <QueryCompound>
:sa or_
:usage |>>> from orb import Query as Q
|>>> query = (Q('test') != 1).or_(Q('name') == 'Eric')
... | [
"Creates",
"a",
"new",
"compound",
"query",
"using",
"the",
"QueryCompound",
".",
"Op",
".",
"Or",
"type",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1485-L1511 |
49,826 | orb-framework/orb | orb/core/query.py | QueryCompound.models | def models(self, model=None):
"""
Returns the tables that this query is referencing.
:return [ <subclass of Table>, .. ]
"""
for query in self.__queries:
if isinstance(query, orb.Query):
yield query.model(model)
else:
f... | python | def models(self, model=None):
"""
Returns the tables that this query is referencing.
:return [ <subclass of Table>, .. ]
"""
for query in self.__queries:
if isinstance(query, orb.Query):
yield query.model(model)
else:
f... | [
"def",
"models",
"(",
"self",
",",
"model",
"=",
"None",
")",
":",
"for",
"query",
"in",
"self",
".",
"__queries",
":",
"if",
"isinstance",
"(",
"query",
",",
"orb",
".",
"Query",
")",
":",
"yield",
"query",
".",
"model",
"(",
"model",
")",
"else",... | Returns the tables that this query is referencing.
:return [ <subclass of Table>, .. ] | [
"Returns",
"the",
"tables",
"that",
"this",
"query",
"is",
"referencing",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/query.py#L1531-L1542 |
49,827 | candango/firenado | firenado/components/static_maps/component.py | StaticMapsComponent.get_handlers | def get_handlers(self):
""" Returns the handlers defined on the static_maps.yml file located
at the app config directory.
Returns: An array of static handlers to be added to the app.
"""
handlers = []
self.static_root = self.application.get_app_component(
).get_c... | python | def get_handlers(self):
""" Returns the handlers defined on the static_maps.yml file located
at the app config directory.
Returns: An array of static handlers to be added to the app.
"""
handlers = []
self.static_root = self.application.get_app_component(
).get_c... | [
"def",
"get_handlers",
"(",
"self",
")",
":",
"handlers",
"=",
"[",
"]",
"self",
".",
"static_root",
"=",
"self",
".",
"application",
".",
"get_app_component",
"(",
")",
".",
"get_component_path",
"(",
")",
"if",
"self",
".",
"conf",
":",
"if",
"'maps'",... | Returns the handlers defined on the static_maps.yml file located
at the app config directory.
Returns: An array of static handlers to be added to the app. | [
"Returns",
"the",
"handlers",
"defined",
"on",
"the",
"static_maps",
".",
"yml",
"file",
"located",
"at",
"the",
"app",
"config",
"directory",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/components/static_maps/component.py#L35-L73 |
49,828 | twisted/twistedchecker | twistedchecker/checkers/formattingoperation.py | FormattingOperationChecker.visit_binop | def visit_binop(self, node):
"""
Called when if a binary operation is found.
Only check for string formatting operations.
@param node: currently checking node
"""
if node.op != "%":
return
pattern = node.left.as_string()
# If the pattern's not... | python | def visit_binop(self, node):
"""
Called when if a binary operation is found.
Only check for string formatting operations.
@param node: currently checking node
"""
if node.op != "%":
return
pattern = node.left.as_string()
# If the pattern's not... | [
"def",
"visit_binop",
"(",
"self",
",",
"node",
")",
":",
"if",
"node",
".",
"op",
"!=",
"\"%\"",
":",
"return",
"pattern",
"=",
"node",
".",
"left",
".",
"as_string",
"(",
")",
"# If the pattern's not a constant string, we don't know whether a",
"# dictionary or ... | Called when if a binary operation is found.
Only check for string formatting operations.
@param node: currently checking node | [
"Called",
"when",
"if",
"a",
"binary",
"operation",
"is",
"found",
".",
"Only",
"check",
"for",
"string",
"formatting",
"operations",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/formattingoperation.py#L20-L42 |
49,829 | twisted/twistedchecker | twistedchecker/checkers/names.py | TwistedNamesChecker.visit_functiondef | def visit_functiondef(self, node):
"""
A interface will be called when visiting a function or a method.
@param node: the current node
"""
if not node.is_method():
# We only check methods.
return
name = node.name
if isTestModule(node.root... | python | def visit_functiondef(self, node):
"""
A interface will be called when visiting a function or a method.
@param node: the current node
"""
if not node.is_method():
# We only check methods.
return
name = node.name
if isTestModule(node.root... | [
"def",
"visit_functiondef",
"(",
"self",
",",
"node",
")",
":",
"if",
"not",
"node",
".",
"is_method",
"(",
")",
":",
"# We only check methods.",
"return",
"name",
"=",
"node",
".",
"name",
"if",
"isTestModule",
"(",
"node",
".",
"root",
"(",
")",
".",
... | A interface will be called when visiting a function or a method.
@param node: the current node | [
"A",
"interface",
"will",
"be",
"called",
"when",
"visiting",
"a",
"function",
"or",
"a",
"method",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/names.py#L53-L121 |
49,830 | twisted/twistedchecker | twistedchecker/checkers/names.py | TwistedNamesChecker._getMethodNamePrefix | def _getMethodNamePrefix(self, node):
"""
Return the prefix of this method based on sibling methods.
@param node: the current node
"""
targetName = node.name
for sibling in node.parent.nodes_of_class(type(node)):
if sibling is node:
# We are o... | python | def _getMethodNamePrefix(self, node):
"""
Return the prefix of this method based on sibling methods.
@param node: the current node
"""
targetName = node.name
for sibling in node.parent.nodes_of_class(type(node)):
if sibling is node:
# We are o... | [
"def",
"_getMethodNamePrefix",
"(",
"self",
",",
"node",
")",
":",
"targetName",
"=",
"node",
".",
"name",
"for",
"sibling",
"in",
"node",
".",
"parent",
".",
"nodes_of_class",
"(",
"type",
"(",
"node",
")",
")",
":",
"if",
"sibling",
"is",
"node",
":"... | Return the prefix of this method based on sibling methods.
@param node: the current node | [
"Return",
"the",
"prefix",
"of",
"this",
"method",
"based",
"on",
"sibling",
"methods",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/names.py#L123-L140 |
49,831 | twisted/twistedchecker | twistedchecker/checkers/names.py | TwistedNamesChecker._getCommonStart | def _getCommonStart(self, left, right):
"""
Return the common prefix of the 2 strings.
@param left: one string
@param right: another string
"""
prefix = []
for a, b in zip(left, right):
if a == b:
prefix.append(a)
else:
... | python | def _getCommonStart(self, left, right):
"""
Return the common prefix of the 2 strings.
@param left: one string
@param right: another string
"""
prefix = []
for a, b in zip(left, right):
if a == b:
prefix.append(a)
else:
... | [
"def",
"_getCommonStart",
"(",
"self",
",",
"left",
",",
"right",
")",
":",
"prefix",
"=",
"[",
"]",
"for",
"a",
",",
"b",
"in",
"zip",
"(",
"left",
",",
"right",
")",
":",
"if",
"a",
"==",
"b",
":",
"prefix",
".",
"append",
"(",
"a",
")",
"e... | Return the common prefix of the 2 strings.
@param left: one string
@param right: another string | [
"Return",
"the",
"common",
"prefix",
"of",
"the",
"2",
"strings",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/checkers/names.py#L143-L157 |
49,832 | priestc/giotto | giotto/controllers/irc_.py | listen | def listen(manifest, config, model_mock=False):
"""
IRC listening process.
"""
config['manifest'] = manifest
config['model_mock'] = model_mock
IRC = IrcBot(config)
try:
IRC.start()
except KeyboardInterrupt:
pass | python | def listen(manifest, config, model_mock=False):
"""
IRC listening process.
"""
config['manifest'] = manifest
config['model_mock'] = model_mock
IRC = IrcBot(config)
try:
IRC.start()
except KeyboardInterrupt:
pass | [
"def",
"listen",
"(",
"manifest",
",",
"config",
",",
"model_mock",
"=",
"False",
")",
":",
"config",
"[",
"'manifest'",
"]",
"=",
"manifest",
"config",
"[",
"'model_mock'",
"]",
"=",
"model_mock",
"IRC",
"=",
"IrcBot",
"(",
"config",
")",
"try",
":",
... | IRC listening process. | [
"IRC",
"listening",
"process",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/controllers/irc_.py#L182-L192 |
49,833 | priestc/giotto | giotto/models/__init__.py | UserManager.get_user_by_password | def get_user_by_password(self, username, password):
"""
Given a username and a raw, unhashed password, get the corresponding
user, retuns None if no match is found.
"""
try:
user = self.get(username=username)
except User.DoesNotExist:
return None
... | python | def get_user_by_password(self, username, password):
"""
Given a username and a raw, unhashed password, get the corresponding
user, retuns None if no match is found.
"""
try:
user = self.get(username=username)
except User.DoesNotExist:
return None
... | [
"def",
"get_user_by_password",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"try",
":",
"user",
"=",
"self",
".",
"get",
"(",
"username",
"=",
"username",
")",
"except",
"User",
".",
"DoesNotExist",
":",
"return",
"None",
"if",
"bcrypt",
".",... | Given a username and a raw, unhashed password, get the corresponding
user, retuns None if no match is found. | [
"Given",
"a",
"username",
"and",
"a",
"raw",
"unhashed",
"password",
"get",
"the",
"corresponding",
"user",
"retuns",
"None",
"if",
"no",
"match",
"is",
"found",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/models/__init__.py#L36-L49 |
49,834 | priestc/giotto | giotto/contrib/auth/middleware.py | AuthenticatedOrRedirect | def AuthenticatedOrRedirect(invocation):
"""
Middleware class factory that redirects if the user is not logged in.
Otherwise, nothing is effected.
"""
class AuthenticatedOrRedirect(GiottoInputMiddleware):
def http(self, request):
if request.user:
return request
... | python | def AuthenticatedOrRedirect(invocation):
"""
Middleware class factory that redirects if the user is not logged in.
Otherwise, nothing is effected.
"""
class AuthenticatedOrRedirect(GiottoInputMiddleware):
def http(self, request):
if request.user:
return request
... | [
"def",
"AuthenticatedOrRedirect",
"(",
"invocation",
")",
":",
"class",
"AuthenticatedOrRedirect",
"(",
"GiottoInputMiddleware",
")",
":",
"def",
"http",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"user",
":",
"return",
"request",
"return",
"... | Middleware class factory that redirects if the user is not logged in.
Otherwise, nothing is effected. | [
"Middleware",
"class",
"factory",
"that",
"redirects",
"if",
"the",
"user",
"is",
"not",
"logged",
"in",
".",
"Otherwise",
"nothing",
"is",
"effected",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/contrib/auth/middleware.py#L79-L95 |
49,835 | orb-framework/orb | orb/core/collector.py | Collector.queryFilter | def queryFilter(self, function=None):
"""
Defines a decorator that can be used to filter
queries. It will assume the function being associated
with the decorator will take a query as an input and
return a modified query to use.
:usage
class MyModel(orb.Mode... | python | def queryFilter(self, function=None):
"""
Defines a decorator that can be used to filter
queries. It will assume the function being associated
with the decorator will take a query as an input and
return a modified query to use.
:usage
class MyModel(orb.Mode... | [
"def",
"queryFilter",
"(",
"self",
",",
"function",
"=",
"None",
")",
":",
"if",
"function",
"is",
"not",
"None",
":",
"self",
".",
"__query_filter",
"=",
"function",
"return",
"function",
"def",
"wrapper",
"(",
"func",
")",
":",
"self",
".",
"__query_fi... | Defines a decorator that can be used to filter
queries. It will assume the function being associated
with the decorator will take a query as an input and
return a modified query to use.
:usage
class MyModel(orb.Model):
objects = orb.ReverseLookup('Object')
... | [
"Defines",
"a",
"decorator",
"that",
"can",
"be",
"used",
"to",
"filter",
"queries",
".",
"It",
"will",
"assume",
"the",
"function",
"being",
"associated",
"with",
"the",
"decorator",
"will",
"take",
"a",
"query",
"as",
"an",
"input",
"and",
"return",
"a",... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/collector.py#L84-L112 |
49,836 | zyga/libpci | libpci/_native.py | Function | def Function(
library: CDLL,
name_or_ordinal: 'Union[str, int, None]'=None,
proto_factory: ('Union[ctypes.CFUNCTYPE, ctypes.WINFUNCTYPE,'
' ctypes.PYFUNCTYPE]')=CFUNCTYPE,
use_errno: bool=False,
use_last_error: bool=False,
) -> 'Callable':
"""
Decorator factory for creati... | python | def Function(
library: CDLL,
name_or_ordinal: 'Union[str, int, None]'=None,
proto_factory: ('Union[ctypes.CFUNCTYPE, ctypes.WINFUNCTYPE,'
' ctypes.PYFUNCTYPE]')=CFUNCTYPE,
use_errno: bool=False,
use_last_error: bool=False,
) -> 'Callable':
"""
Decorator factory for creati... | [
"def",
"Function",
"(",
"library",
":",
"CDLL",
",",
"name_or_ordinal",
":",
"'Union[str, int, None]'",
"=",
"None",
",",
"proto_factory",
":",
"(",
"'Union[ctypes.CFUNCTYPE, ctypes.WINFUNCTYPE,'",
"' ctypes.PYFUNCTYPE]'",
")",
"=",
"CFUNCTYPE",
",",
"use_errno",
":",
... | Decorator factory for creating callables for native functions.
Decorator factory for constructing relatively-nicely-looking callables that
call into existing native functions exposed from a dynamically-linkable
library.
:param library:
The library to look at
:param name_or_ordinal:
... | [
"Decorator",
"factory",
"for",
"creating",
"callables",
"for",
"native",
"functions",
"."
] | 5da0cf464192afff2fae8687c9133329897ec631 | https://github.com/zyga/libpci/blob/5da0cf464192afff2fae8687c9133329897ec631/libpci/_native.py#L90-L131 |
49,837 | zyga/libpci | libpci/wrapper.py | LibPCI.close | def close(self):
"""Release libpci resources."""
if self._access is not None:
_logger.debug("Cleaning up")
pci_cleanup(self._access)
self._access = None | python | def close(self):
"""Release libpci resources."""
if self._access is not None:
_logger.debug("Cleaning up")
pci_cleanup(self._access)
self._access = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_access",
"is",
"not",
"None",
":",
"_logger",
".",
"debug",
"(",
"\"Cleaning up\"",
")",
"pci_cleanup",
"(",
"self",
".",
"_access",
")",
"self",
".",
"_access",
"=",
"None"
] | Release libpci resources. | [
"Release",
"libpci",
"resources",
"."
] | 5da0cf464192afff2fae8687c9133329897ec631 | https://github.com/zyga/libpci/blob/5da0cf464192afff2fae8687c9133329897ec631/libpci/wrapper.py#L98-L103 |
49,838 | zyga/libpci | libpci/wrapper.py | LibPCI.lookup_vendor_name | def lookup_vendor_name(self, vendor_id):
"""
Lookup the name of a given vendor.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:returns:
Name of the PCI vendor.
.. note::
Lookup respects various flag propert... | python | def lookup_vendor_name(self, vendor_id):
"""
Lookup the name of a given vendor.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:returns:
Name of the PCI vendor.
.. note::
Lookup respects various flag propert... | [
"def",
"lookup_vendor_name",
"(",
"self",
",",
"vendor_id",
")",
":",
"buf",
"=",
"ctypes",
".",
"create_string_buffer",
"(",
"1024",
")",
"_logger",
".",
"debug",
"(",
"\"Performing the lookup on vendor %#06x\"",
",",
"vendor_id",
")",
"flags",
"=",
"self",
"."... | Lookup the name of a given vendor.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:returns:
Name of the PCI vendor.
.. note::
Lookup respects various flag properties that impact the behavior
in case the name can... | [
"Lookup",
"the",
"name",
"of",
"a",
"given",
"vendor",
"."
] | 5da0cf464192afff2fae8687c9133329897ec631 | https://github.com/zyga/libpci/blob/5da0cf464192afff2fae8687c9133329897ec631/libpci/wrapper.py#L158-L179 |
49,839 | zyga/libpci | libpci/wrapper.py | LibPCI.lookup_device_name | def lookup_device_name(self, vendor_id, device_id):
"""
Lookup the name of a given device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device identifier
:ptype device_id:
int
... | python | def lookup_device_name(self, vendor_id, device_id):
"""
Lookup the name of a given device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device identifier
:ptype device_id:
int
... | [
"def",
"lookup_device_name",
"(",
"self",
",",
"vendor_id",
",",
"device_id",
")",
":",
"buf",
"=",
"ctypes",
".",
"create_string_buffer",
"(",
"1024",
")",
"_logger",
".",
"debug",
"(",
"\"Performing the lookup on vendor:device %#06x:%#06x\"",
",",
"vendor_id",
","... | Lookup the name of a given device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device identifier
:ptype device_id:
int
:returns:
Name of the PCI device.
.. note::
... | [
"Lookup",
"the",
"name",
"of",
"a",
"given",
"device",
"."
] | 5da0cf464192afff2fae8687c9133329897ec631 | https://github.com/zyga/libpci/blob/5da0cf464192afff2fae8687c9133329897ec631/libpci/wrapper.py#L181-L207 |
49,840 | zyga/libpci | libpci/wrapper.py | LibPCI.lookup_subsystem_device_name | def lookup_subsystem_device_name(
self, vendor_id, device_id, subvendor_id, subdevice_id):
"""
Lookup the name of a given subsystem device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device ... | python | def lookup_subsystem_device_name(
self, vendor_id, device_id, subvendor_id, subdevice_id):
"""
Lookup the name of a given subsystem device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device ... | [
"def",
"lookup_subsystem_device_name",
"(",
"self",
",",
"vendor_id",
",",
"device_id",
",",
"subvendor_id",
",",
"subdevice_id",
")",
":",
"buf",
"=",
"ctypes",
".",
"create_string_buffer",
"(",
"1024",
")",
"_logger",
".",
"debug",
"(",
"\"Performing the lookup ... | Lookup the name of a given subsystem device.
:param vendor_id:
PCI vendor identifier
:ptype vendor_id:
int
:param device_id:
PCI device identifier
:ptype device_id:
int
:param subvendor_id:
PCI subvendor identifier
... | [
"Lookup",
"the",
"name",
"of",
"a",
"given",
"subsystem",
"device",
"."
] | 5da0cf464192afff2fae8687c9133329897ec631 | https://github.com/zyga/libpci/blob/5da0cf464192afff2fae8687c9133329897ec631/libpci/wrapper.py#L209-L246 |
49,841 | priestc/giotto | giotto/controllers/http.py | make_duplicate_request | def make_duplicate_request(request):
"""
Since werkzeug request objects are immutable, this is needed to create an
identical reuet object with immutable values so it can be retried after a
POST failure.
"""
class FakeRequest(object):
method = 'GET'
path = request.path
hea... | python | def make_duplicate_request(request):
"""
Since werkzeug request objects are immutable, this is needed to create an
identical reuet object with immutable values so it can be retried after a
POST failure.
"""
class FakeRequest(object):
method = 'GET'
path = request.path
hea... | [
"def",
"make_duplicate_request",
"(",
"request",
")",
":",
"class",
"FakeRequest",
"(",
"object",
")",
":",
"method",
"=",
"'GET'",
"path",
"=",
"request",
".",
"path",
"headers",
"=",
"request",
".",
"headers",
"GET",
"=",
"request",
".",
"GET",
"POST",
... | Since werkzeug request objects are immutable, this is needed to create an
identical reuet object with immutable values so it can be retried after a
POST failure. | [
"Since",
"werkzeug",
"request",
"objects",
"are",
"immutable",
"this",
"is",
"needed",
"to",
"create",
"an",
"identical",
"reuet",
"object",
"with",
"immutable",
"values",
"so",
"it",
"can",
"be",
"retried",
"after",
"a",
"POST",
"failure",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/controllers/http.py#L191-L206 |
49,842 | priestc/giotto | giotto/controllers/http.py | fancy_error_template_middleware | def fancy_error_template_middleware(app):
"""
WGSI middleware for catching errors and rendering the error page.
"""
def application(environ, start_response):
try:
return app(environ, start_response)
except Exception as exc:
sio = StringIO()
traceback.p... | python | def fancy_error_template_middleware(app):
"""
WGSI middleware for catching errors and rendering the error page.
"""
def application(environ, start_response):
try:
return app(environ, start_response)
except Exception as exc:
sio = StringIO()
traceback.p... | [
"def",
"fancy_error_template_middleware",
"(",
"app",
")",
":",
"def",
"application",
"(",
"environ",
",",
"start_response",
")",
":",
"try",
":",
"return",
"app",
"(",
"environ",
",",
"start_response",
")",
"except",
"Exception",
"as",
"exc",
":",
"sio",
"=... | WGSI middleware for catching errors and rendering the error page. | [
"WGSI",
"middleware",
"for",
"catching",
"errors",
"and",
"rendering",
"the",
"error",
"page",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/controllers/http.py#L229-L247 |
49,843 | candango/firenado | firenado/util/browser.py | is_mobile | def is_mobile(user_agent):
""" Checks if the user browser from the given user agent is mobile.
Args:
user_agent: A given user agent.
Returns: True if the browser from the user agent is mobile.
"""
if user_agent:
b = reg_b.search(user_agent)
v = reg_v.search(user_agent[0:4]... | python | def is_mobile(user_agent):
""" Checks if the user browser from the given user agent is mobile.
Args:
user_agent: A given user agent.
Returns: True if the browser from the user agent is mobile.
"""
if user_agent:
b = reg_b.search(user_agent)
v = reg_v.search(user_agent[0:4]... | [
"def",
"is_mobile",
"(",
"user_agent",
")",
":",
"if",
"user_agent",
":",
"b",
"=",
"reg_b",
".",
"search",
"(",
"user_agent",
")",
"v",
"=",
"reg_v",
".",
"search",
"(",
"user_agent",
"[",
"0",
":",
"4",
"]",
")",
"return",
"b",
"or",
"v",
"return... | Checks if the user browser from the given user agent is mobile.
Args:
user_agent: A given user agent.
Returns: True if the browser from the user agent is mobile. | [
"Checks",
"if",
"the",
"user",
"browser",
"from",
"the",
"given",
"user",
"agent",
"is",
"mobile",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/browser.py#L54-L67 |
49,844 | orb-framework/orb | orb/core/context.py | Context.copy | def copy(self):
"""
Returns a copy of this database option set.
:return <orb.Context>
"""
properties = {}
for key, value in self.raw_values.items():
if key in self.UnhashableOptions:
properties[key] = value
else:
... | python | def copy(self):
"""
Returns a copy of this database option set.
:return <orb.Context>
"""
properties = {}
for key, value in self.raw_values.items():
if key in self.UnhashableOptions:
properties[key] = value
else:
... | [
"def",
"copy",
"(",
"self",
")",
":",
"properties",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"self",
".",
"raw_values",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"self",
".",
"UnhashableOptions",
":",
"properties",
"[",
"key",
"]",
"=... | Returns a copy of this database option set.
:return <orb.Context> | [
"Returns",
"a",
"copy",
"of",
"this",
"database",
"option",
"set",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/context.py#L136-L149 |
49,845 | orb-framework/orb | orb/core/context.py | Context.expandtree | def expandtree(self, model=None):
"""
Goes through the expand options associated with this context and
returns a trie of data.
:param model: subclass of <orb.Model> || None
:return: <dict>
"""
if model and not self.columns:
schema = model.schema()
... | python | def expandtree(self, model=None):
"""
Goes through the expand options associated with this context and
returns a trie of data.
:param model: subclass of <orb.Model> || None
:return: <dict>
"""
if model and not self.columns:
schema = model.schema()
... | [
"def",
"expandtree",
"(",
"self",
",",
"model",
"=",
"None",
")",
":",
"if",
"model",
"and",
"not",
"self",
".",
"columns",
":",
"schema",
"=",
"model",
".",
"schema",
"(",
")",
"defaults",
"=",
"schema",
".",
"columns",
"(",
"flags",
"=",
"orb",
"... | Goes through the expand options associated with this context and
returns a trie of data.
:param model: subclass of <orb.Model> || None
:return: <dict> | [
"Goes",
"through",
"the",
"expand",
"options",
"associated",
"with",
"this",
"context",
"and",
"returns",
"a",
"trie",
"of",
"data",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/context.py#L177-L206 |
49,846 | orb-framework/orb | orb/core/context.py | Context.isNull | def isNull(self):
"""
Returns whether or not this option set has been modified.
:return <bool>
"""
check = self.raw_values.copy()
scope = check.pop('scope', {})
return len(check) == 0 and len(scope) == 0 | python | def isNull(self):
"""
Returns whether or not this option set has been modified.
:return <bool>
"""
check = self.raw_values.copy()
scope = check.pop('scope', {})
return len(check) == 0 and len(scope) == 0 | [
"def",
"isNull",
"(",
"self",
")",
":",
"check",
"=",
"self",
".",
"raw_values",
".",
"copy",
"(",
")",
"scope",
"=",
"check",
".",
"pop",
"(",
"'scope'",
",",
"{",
"}",
")",
"return",
"len",
"(",
"check",
")",
"==",
"0",
"and",
"len",
"(",
"sc... | Returns whether or not this option set has been modified.
:return <bool> | [
"Returns",
"whether",
"or",
"not",
"this",
"option",
"set",
"has",
"been",
"modified",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/context.py#L208-L216 |
49,847 | candango/firenado | firenado/util/file.py | create_module | def create_module(module, target):
""" Create a module directory structure into the target directory. """
module_x = module.split('.')
cur_path = ''
for path in module_x:
cur_path = os.path.join(cur_path, path)
if not os.path.isdir(os.path.join(target, cur_path)):
os.mkdir(os... | python | def create_module(module, target):
""" Create a module directory structure into the target directory. """
module_x = module.split('.')
cur_path = ''
for path in module_x:
cur_path = os.path.join(cur_path, path)
if not os.path.isdir(os.path.join(target, cur_path)):
os.mkdir(os... | [
"def",
"create_module",
"(",
"module",
",",
"target",
")",
":",
"module_x",
"=",
"module",
".",
"split",
"(",
"'.'",
")",
"cur_path",
"=",
"''",
"for",
"path",
"in",
"module_x",
":",
"cur_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cur_path",
"... | Create a module directory structure into the target directory. | [
"Create",
"a",
"module",
"directory",
"structure",
"into",
"the",
"target",
"directory",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/file.py#L20-L30 |
49,848 | candango/firenado | firenado/util/file.py | get_file_extension | def get_file_extension(filename):
""" Return the extension if the filename has it. None if not.
:param filename: The filename.
:return: Extension or None.
"""
filename_x = filename.split('.')
if len(filename_x) > 1:
if filename_x[-1].strip() is not '':
return filename_x[-1]
... | python | def get_file_extension(filename):
""" Return the extension if the filename has it. None if not.
:param filename: The filename.
:return: Extension or None.
"""
filename_x = filename.split('.')
if len(filename_x) > 1:
if filename_x[-1].strip() is not '':
return filename_x[-1]
... | [
"def",
"get_file_extension",
"(",
"filename",
")",
":",
"filename_x",
"=",
"filename",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"filename_x",
")",
">",
"1",
":",
"if",
"filename_x",
"[",
"-",
"1",
"]",
".",
"strip",
"(",
")",
"is",
"not",
"... | Return the extension if the filename has it. None if not.
:param filename: The filename.
:return: Extension or None. | [
"Return",
"the",
"extension",
"if",
"the",
"filename",
"has",
"it",
".",
"None",
"if",
"not",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/file.py#L44-L54 |
49,849 | candango/firenado | firenado/util/file.py | write | def write(path, data, binary=False):
""" Writes a given data to a file located at the given path. """
mode = "w"
if binary:
mode = "wb"
with open(path, mode) as f:
f.write(data)
f.close() | python | def write(path, data, binary=False):
""" Writes a given data to a file located at the given path. """
mode = "w"
if binary:
mode = "wb"
with open(path, mode) as f:
f.write(data)
f.close() | [
"def",
"write",
"(",
"path",
",",
"data",
",",
"binary",
"=",
"False",
")",
":",
"mode",
"=",
"\"w\"",
"if",
"binary",
":",
"mode",
"=",
"\"wb\"",
"with",
"open",
"(",
"path",
",",
"mode",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"data",
")... | Writes a given data to a file located at the given path. | [
"Writes",
"a",
"given",
"data",
"to",
"a",
"file",
"located",
"at",
"the",
"given",
"path",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/file.py#L57-L64 |
49,850 | candango/firenado | firenado/util/file.py | read | def read(path):
""" Reads a file located at the given path. """
data = None
with open(path, 'r') as f:
data = f.read()
f.close()
return data | python | def read(path):
""" Reads a file located at the given path. """
data = None
with open(path, 'r') as f:
data = f.read()
f.close()
return data | [
"def",
"read",
"(",
"path",
")",
":",
"data",
"=",
"None",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"f",
".",
"close",
"(",
")",
"return",
"data"
] | Reads a file located at the given path. | [
"Reads",
"a",
"file",
"located",
"at",
"the",
"given",
"path",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/file.py#L67-L73 |
49,851 | candango/firenado | firenado/util/file.py | touch | def touch(path):
""" Creates a file located at the given path. """
with open(path, 'a') as f:
os.utime(path, None)
f.close() | python | def touch(path):
""" Creates a file located at the given path. """
with open(path, 'a') as f:
os.utime(path, None)
f.close() | [
"def",
"touch",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'a'",
")",
"as",
"f",
":",
"os",
".",
"utime",
"(",
"path",
",",
"None",
")",
"f",
".",
"close",
"(",
")"
] | Creates a file located at the given path. | [
"Creates",
"a",
"file",
"located",
"at",
"the",
"given",
"path",
"."
] | 4b1f628e485b521e161d64169c46a9818f26949f | https://github.com/candango/firenado/blob/4b1f628e485b521e161d64169c46a9818f26949f/firenado/util/file.py#L76-L80 |
49,852 | orb-framework/orb | orb/core/column_types/string.py | StringColumn.loadJSON | def loadJSON(self, jdata):
"""
Loads JSON data for this column type.
:param jdata: <dict>
"""
super(StringColumn, self).loadJSON(jdata)
# load additional info
self.__maxLength = jdata.get('maxLength') or self.__maxLength | python | def loadJSON(self, jdata):
"""
Loads JSON data for this column type.
:param jdata: <dict>
"""
super(StringColumn, self).loadJSON(jdata)
# load additional info
self.__maxLength = jdata.get('maxLength') or self.__maxLength | [
"def",
"loadJSON",
"(",
"self",
",",
"jdata",
")",
":",
"super",
"(",
"StringColumn",
",",
"self",
")",
".",
"loadJSON",
"(",
"jdata",
")",
"# load additional info",
"self",
".",
"__maxLength",
"=",
"jdata",
".",
"get",
"(",
"'maxLength'",
")",
"or",
"se... | Loads JSON data for this column type.
:param jdata: <dict> | [
"Loads",
"JSON",
"data",
"for",
"this",
"column",
"type",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/string.py#L149-L158 |
49,853 | orb-framework/orb | orb/core/column_types/string.py | EmailColumn.validate | def validate(self, value):
"""
Validates the value provided is a valid email address,
at least, on paper.
:param value: <str>
:return: <bool>
"""
if isinstance(value, (str, unicode)) and not re.match(self.__pattern, value):
raise orb.errors.ColumnVal... | python | def validate(self, value):
"""
Validates the value provided is a valid email address,
at least, on paper.
:param value: <str>
:return: <bool>
"""
if isinstance(value, (str, unicode)) and not re.match(self.__pattern, value):
raise orb.errors.ColumnVal... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"unicode",
")",
")",
"and",
"not",
"re",
".",
"match",
"(",
"self",
".",
"__pattern",
",",
"value",
")",
":",
"raise",
"orb",
".",
"er... | Validates the value provided is a valid email address,
at least, on paper.
:param value: <str>
:return: <bool> | [
"Validates",
"the",
"value",
"provided",
"is",
"a",
"valid",
"email",
"address",
"at",
"least",
"on",
"paper",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/string.py#L223-L235 |
49,854 | orb-framework/orb | orb/core/column_types/string.py | PasswordColumn.rules | def rules(self):
"""
Returns the rules for this password based on the configured
options.
:return: <str>
"""
rules = ['Passwords need to be at least {0} characters long'.format(self.__minlength)]
if self.__requireUppercase:
rules.append('have at leas... | python | def rules(self):
"""
Returns the rules for this password based on the configured
options.
:return: <str>
"""
rules = ['Passwords need to be at least {0} characters long'.format(self.__minlength)]
if self.__requireUppercase:
rules.append('have at leas... | [
"def",
"rules",
"(",
"self",
")",
":",
"rules",
"=",
"[",
"'Passwords need to be at least {0} characters long'",
".",
"format",
"(",
"self",
".",
"__minlength",
")",
"]",
"if",
"self",
".",
"__requireUppercase",
":",
"rules",
".",
"append",
"(",
"'have at least ... | Returns the rules for this password based on the configured
options.
:return: <str> | [
"Returns",
"the",
"rules",
"for",
"this",
"password",
"based",
"on",
"the",
"configured",
"options",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/string.py#L310-L331 |
49,855 | orb-framework/orb | orb/core/column_types/string.py | TokenColumn.generate | def generate(self):
"""
Generates a new token for this column based on its bit length. This method
will not ensure uniqueness in the model itself, that should be checked against
the model records in the database first.
:return: <str>
"""
try:
mode... | python | def generate(self):
"""
Generates a new token for this column based on its bit length. This method
will not ensure uniqueness in the model itself, that should be checked against
the model records in the database first.
:return: <str>
"""
try:
mode... | [
"def",
"generate",
"(",
"self",
")",
":",
"try",
":",
"model",
"=",
"self",
".",
"schema",
"(",
")",
".",
"model",
"(",
")",
"except",
"AttributeError",
":",
"return",
"os",
".",
"urandom",
"(",
"self",
".",
"__bits",
")",
".",
"encode",
"(",
"'hex... | Generates a new token for this column based on its bit length. This method
will not ensure uniqueness in the model itself, that should be checked against
the model records in the database first.
:return: <str> | [
"Generates",
"a",
"new",
"token",
"for",
"this",
"column",
"based",
"on",
"its",
"bit",
"length",
".",
"This",
"method",
"will",
"not",
"ensure",
"uniqueness",
"in",
"the",
"model",
"itself",
"that",
"should",
"be",
"checked",
"against",
"the",
"model",
"r... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column_types/string.py#L392-L408 |
49,856 | niccokunzmann/hanging_threads | hanging_threads.py | start_monitoring | def start_monitoring(seconds_frozen=SECONDS_FROZEN,
test_interval=TEST_INTERVAL):
"""Start monitoring for hanging threads.
seconds_frozen - How much time should thread hang to activate
printing stack trace - default(10)
tests_interval - Sleep time of monitoring thread (in millisec... | python | def start_monitoring(seconds_frozen=SECONDS_FROZEN,
test_interval=TEST_INTERVAL):
"""Start monitoring for hanging threads.
seconds_frozen - How much time should thread hang to activate
printing stack trace - default(10)
tests_interval - Sleep time of monitoring thread (in millisec... | [
"def",
"start_monitoring",
"(",
"seconds_frozen",
"=",
"SECONDS_FROZEN",
",",
"test_interval",
"=",
"TEST_INTERVAL",
")",
":",
"thread",
"=",
"StoppableThread",
"(",
"target",
"=",
"monitor",
",",
"args",
"=",
"(",
"seconds_frozen",
",",
"test_interval",
")",
")... | Start monitoring for hanging threads.
seconds_frozen - How much time should thread hang to activate
printing stack trace - default(10)
tests_interval - Sleep time of monitoring thread (in milliseconds)
- default(100) | [
"Start",
"monitoring",
"for",
"hanging",
"threads",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L51-L66 |
49,857 | niccokunzmann/hanging_threads | hanging_threads.py | monitor | def monitor(seconds_frozen, test_interval):
"""Monitoring thread function.
Checks if thread is hanging for time defined by
``seconds_frozen`` parameter every ``test_interval`` milliseconds.
"""
current_thread = threading.current_thread()
hanging_threads = set()
old_threads = {} # Threads f... | python | def monitor(seconds_frozen, test_interval):
"""Monitoring thread function.
Checks if thread is hanging for time defined by
``seconds_frozen`` parameter every ``test_interval`` milliseconds.
"""
current_thread = threading.current_thread()
hanging_threads = set()
old_threads = {} # Threads f... | [
"def",
"monitor",
"(",
"seconds_frozen",
",",
"test_interval",
")",
":",
"current_thread",
"=",
"threading",
".",
"current_thread",
"(",
")",
"hanging_threads",
"=",
"set",
"(",
")",
"old_threads",
"=",
"{",
"}",
"# Threads found on previous iteration.",
"while",
... | Monitoring thread function.
Checks if thread is hanging for time defined by
``seconds_frozen`` parameter every ``test_interval`` milliseconds. | [
"Monitoring",
"thread",
"function",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L86-L132 |
49,858 | niccokunzmann/hanging_threads | hanging_threads.py | get_current_frames | def get_current_frames():
"""Return current threads prepared for
further processing.
"""
return dict(
(thread_id, {'frame': thread2list(frame), 'time': None})
for thread_id, frame in sys._current_frames().items()
) | python | def get_current_frames():
"""Return current threads prepared for
further processing.
"""
return dict(
(thread_id, {'frame': thread2list(frame), 'time': None})
for thread_id, frame in sys._current_frames().items()
) | [
"def",
"get_current_frames",
"(",
")",
":",
"return",
"dict",
"(",
"(",
"thread_id",
",",
"{",
"'frame'",
":",
"thread2list",
"(",
"frame",
")",
",",
"'time'",
":",
"None",
"}",
")",
"for",
"thread_id",
",",
"frame",
"in",
"sys",
".",
"_current_frames",
... | Return current threads prepared for
further processing. | [
"Return",
"current",
"threads",
"prepared",
"for",
"further",
"processing",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L135-L142 |
49,859 | niccokunzmann/hanging_threads | hanging_threads.py | frame2string | def frame2string(frame):
"""Return info about frame.
Keyword arg:
frame
Return string in format:
File {file name}, line {line number}, in
{name of parent of code object} {newline}
Line from file at line number
"""
lineno = frame.f_lineno # or f_lasti
co = frame.f_code
... | python | def frame2string(frame):
"""Return info about frame.
Keyword arg:
frame
Return string in format:
File {file name}, line {line number}, in
{name of parent of code object} {newline}
Line from file at line number
"""
lineno = frame.f_lineno # or f_lasti
co = frame.f_code
... | [
"def",
"frame2string",
"(",
"frame",
")",
":",
"lineno",
"=",
"frame",
".",
"f_lineno",
"# or f_lasti",
"co",
"=",
"frame",
".",
"f_code",
"filename",
"=",
"co",
".",
"co_filename",
"name",
"=",
"co",
".",
"co_name",
"s",
"=",
"'\\tFile \"{0}\", line {1}, in... | Return info about frame.
Keyword arg:
frame
Return string in format:
File {file name}, line {line number}, in
{name of parent of code object} {newline}
Line from file at line number | [
"Return",
"info",
"about",
"frame",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L145-L164 |
49,860 | niccokunzmann/hanging_threads | hanging_threads.py | thread2list | def thread2list(frame):
"""Return list with string frame representation of each frame of
thread.
"""
l = []
while frame:
l.insert(0, frame2string(frame))
frame = frame.f_back
return l | python | def thread2list(frame):
"""Return list with string frame representation of each frame of
thread.
"""
l = []
while frame:
l.insert(0, frame2string(frame))
frame = frame.f_back
return l | [
"def",
"thread2list",
"(",
"frame",
")",
":",
"l",
"=",
"[",
"]",
"while",
"frame",
":",
"l",
".",
"insert",
"(",
"0",
",",
"frame2string",
"(",
"frame",
")",
")",
"frame",
"=",
"frame",
".",
"f_back",
"return",
"l"
] | Return list with string frame representation of each frame of
thread. | [
"Return",
"list",
"with",
"string",
"frame",
"representation",
"of",
"each",
"frame",
"of",
"thread",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L167-L175 |
49,861 | niccokunzmann/hanging_threads | hanging_threads.py | write_log | def write_log(title, message=''):
"""Write formatted log message to stderr."""
sys.stderr.write(''.join([
title.center(40).center(60, '-'), '\n', message
])) | python | def write_log(title, message=''):
"""Write formatted log message to stderr."""
sys.stderr.write(''.join([
title.center(40).center(60, '-'), '\n', message
])) | [
"def",
"write_log",
"(",
"title",
",",
"message",
"=",
"''",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"''",
".",
"join",
"(",
"[",
"title",
".",
"center",
"(",
"40",
")",
".",
"center",
"(",
"60",
",",
"'-'",
")",
",",
"'\\n'",
",",
... | Write formatted log message to stderr. | [
"Write",
"formatted",
"log",
"message",
"to",
"stderr",
"."
] | 167f4faa9ef7bf44866d9cda75d30606acb3c416 | https://github.com/niccokunzmann/hanging_threads/blob/167f4faa9ef7bf44866d9cda75d30606acb3c416/hanging_threads.py#L199-L204 |
49,862 | priestc/giotto | giotto/programs/__init__.py | Program.execute_input_middleware_stream | def execute_input_middleware_stream(self, request, controller):
"""
Request comes from the controller. Returned is a request.
controller arg is the name of the controller.
"""
start_request = request
# either 'http' or 'cmd' or 'irc'
controller_name = "".join(cont... | python | def execute_input_middleware_stream(self, request, controller):
"""
Request comes from the controller. Returned is a request.
controller arg is the name of the controller.
"""
start_request = request
# either 'http' or 'cmd' or 'irc'
controller_name = "".join(cont... | [
"def",
"execute_input_middleware_stream",
"(",
"self",
",",
"request",
",",
"controller",
")",
":",
"start_request",
"=",
"request",
"# either 'http' or 'cmd' or 'irc'",
"controller_name",
"=",
"\"\"",
".",
"join",
"(",
"controller",
".",
"get_controller_name",
"(",
"... | Request comes from the controller. Returned is a request.
controller arg is the name of the controller. | [
"Request",
"comes",
"from",
"the",
"controller",
".",
"Returned",
"is",
"a",
"request",
".",
"controller",
"arg",
"is",
"the",
"name",
"of",
"the",
"controller",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/programs/__init__.py#L90-L108 |
49,863 | priestc/giotto | giotto/programs/__init__.py | Manifest._get_suggestions | def _get_suggestions(self, filter_word=None):
"""
This only gets caled internally from the get_suggestion method.
"""
keys = self.manifest.keys()
words = []
for key in keys:
if isinstance(self.manifest[key], Manifest):
# if this key... | python | def _get_suggestions(self, filter_word=None):
"""
This only gets caled internally from the get_suggestion method.
"""
keys = self.manifest.keys()
words = []
for key in keys:
if isinstance(self.manifest[key], Manifest):
# if this key... | [
"def",
"_get_suggestions",
"(",
"self",
",",
"filter_word",
"=",
"None",
")",
":",
"keys",
"=",
"self",
".",
"manifest",
".",
"keys",
"(",
")",
"words",
"=",
"[",
"]",
"for",
"key",
"in",
"keys",
":",
"if",
"isinstance",
"(",
"self",
".",
"manifest",... | This only gets caled internally from the get_suggestion method. | [
"This",
"only",
"gets",
"caled",
"internally",
"from",
"the",
"get_suggestion",
"method",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/programs/__init__.py#L209-L226 |
49,864 | priestc/giotto | giotto/programs/__init__.py | Manifest.get_suggestion | def get_suggestion(self, front_path):
"""
Returns suggestions for a path. Used in tab completion from the command
line.
"""
if '/' in front_path:
# transverse the manifest, return the new manifest, then
# get those suggestions with the remaining word
... | python | def get_suggestion(self, front_path):
"""
Returns suggestions for a path. Used in tab completion from the command
line.
"""
if '/' in front_path:
# transverse the manifest, return the new manifest, then
# get those suggestions with the remaining word
... | [
"def",
"get_suggestion",
"(",
"self",
",",
"front_path",
")",
":",
"if",
"'/'",
"in",
"front_path",
":",
"# transverse the manifest, return the new manifest, then",
"# get those suggestions with the remaining word",
"splitted",
"=",
"front_path",
".",
"split",
"(",
"'/'",
... | Returns suggestions for a path. Used in tab completion from the command
line. | [
"Returns",
"suggestions",
"for",
"a",
"path",
".",
"Used",
"in",
"tab",
"completion",
"from",
"the",
"command",
"line",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/programs/__init__.py#L228-L253 |
49,865 | priestc/giotto | giotto/programs/__init__.py | Manifest.parse_invocation | def parse_invocation(self, invocation, controller_tag):
"""
Given an invocation string, determine which part is the path, the program,
and the args.
"""
if invocation.endswith('/'):
invocation = invocation[:-1]
if not invocation.startswith('/'):
in... | python | def parse_invocation(self, invocation, controller_tag):
"""
Given an invocation string, determine which part is the path, the program,
and the args.
"""
if invocation.endswith('/'):
invocation = invocation[:-1]
if not invocation.startswith('/'):
in... | [
"def",
"parse_invocation",
"(",
"self",
",",
"invocation",
",",
"controller_tag",
")",
":",
"if",
"invocation",
".",
"endswith",
"(",
"'/'",
")",
":",
"invocation",
"=",
"invocation",
"[",
":",
"-",
"1",
"]",
"if",
"not",
"invocation",
".",
"startswith",
... | Given an invocation string, determine which part is the path, the program,
and the args. | [
"Given",
"an",
"invocation",
"string",
"determine",
"which",
"part",
"is",
"the",
"path",
"the",
"program",
"and",
"the",
"args",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/programs/__init__.py#L293-L346 |
49,866 | orb-framework/orb | orb/core/column.py | Column.copy | def copy(self):
"""
Returns a new instance copy of this column.
:return: <orb.Column>
"""
out = type(self)(
name=self.__name,
field=self.__field,
display=self.__display,
flags=self.__flags,
default=self.__default,
... | python | def copy(self):
"""
Returns a new instance copy of this column.
:return: <orb.Column>
"""
out = type(self)(
name=self.__name,
field=self.__field,
display=self.__display,
flags=self.__flags,
default=self.__default,
... | [
"def",
"copy",
"(",
"self",
")",
":",
"out",
"=",
"type",
"(",
"self",
")",
"(",
"name",
"=",
"self",
".",
"__name",
",",
"field",
"=",
"self",
".",
"__field",
",",
"display",
"=",
"self",
".",
"__display",
",",
"flags",
"=",
"self",
".",
"__flag... | Returns a new instance copy of this column.
:return: <orb.Column> | [
"Returns",
"a",
"new",
"instance",
"copy",
"of",
"this",
"column",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L106-L128 |
49,867 | orb-framework/orb | orb/core/column.py | Column.dbMath | def dbMath(self, typ, field, op, value):
"""
Performs some database math on the given field. This will be database specific
implementations and should return the resulting database operation.
:param field: <str>
:param op: <orb.Query.Math>
:param target: <variant>
... | python | def dbMath(self, typ, field, op, value):
"""
Performs some database math on the given field. This will be database specific
implementations and should return the resulting database operation.
:param field: <str>
:param op: <orb.Query.Math>
:param target: <variant>
... | [
"def",
"dbMath",
"(",
"self",
",",
"typ",
",",
"field",
",",
"op",
",",
"value",
")",
":",
"ops",
"=",
"orb",
".",
"Query",
".",
"Math",
"(",
"op",
")",
"format",
"=",
"self",
".",
"MathMap",
".",
"get",
"(",
"typ",
",",
"{",
"}",
")",
".",
... | Performs some database math on the given field. This will be database specific
implementations and should return the resulting database operation.
:param field: <str>
:param op: <orb.Query.Math>
:param target: <variant>
:param context: <orb.Context> || None
:return: <s... | [
"Performs",
"some",
"database",
"math",
"on",
"the",
"given",
"field",
".",
"This",
"will",
"be",
"database",
"specific",
"implementations",
"and",
"should",
"return",
"the",
"resulting",
"database",
"operation",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L157-L171 |
49,868 | orb-framework/orb | orb/core/column.py | Column.dbType | def dbType(self, typ):
"""
Returns the database object type based on the given connection type.
:param typ: <str>
:return: <str>
"""
return self.TypeMap.get(typ, self.TypeMap.get('Default')) | python | def dbType(self, typ):
"""
Returns the database object type based on the given connection type.
:param typ: <str>
:return: <str>
"""
return self.TypeMap.get(typ, self.TypeMap.get('Default')) | [
"def",
"dbType",
"(",
"self",
",",
"typ",
")",
":",
"return",
"self",
".",
"TypeMap",
".",
"get",
"(",
"typ",
",",
"self",
".",
"TypeMap",
".",
"get",
"(",
"'Default'",
")",
")"
] | Returns the database object type based on the given connection type.
:param typ: <str>
:return: <str> | [
"Returns",
"the",
"database",
"object",
"type",
"based",
"on",
"the",
"given",
"connection",
"type",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L193-L201 |
49,869 | orb-framework/orb | orb/core/column.py | Column.default | def default(self):
"""
Returns the default value for this column to return
when generating new instances.
:return <variant>
"""
if isinstance(self.__default, (str, unicode)):
return self.valueFromString(self.__default)
else:
return sel... | python | def default(self):
"""
Returns the default value for this column to return
when generating new instances.
:return <variant>
"""
if isinstance(self.__default, (str, unicode)):
return self.valueFromString(self.__default)
else:
return sel... | [
"def",
"default",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"__default",
",",
"(",
"str",
",",
"unicode",
")",
")",
":",
"return",
"self",
".",
"valueFromString",
"(",
"self",
".",
"__default",
")",
"else",
":",
"return",
"self",
"... | Returns the default value for this column to return
when generating new instances.
:return <variant> | [
"Returns",
"the",
"default",
"value",
"for",
"this",
"column",
"to",
"return",
"when",
"generating",
"new",
"instances",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L203-L213 |
49,870 | orb-framework/orb | orb/core/column.py | Column.field | def field(self):
"""
Returns the field name that this column will have inside the database.
:return <str>
"""
if not self.__field:
default_field = inflection.underscore(self.__name)
if isinstance(self, orb.ReferenceColumn):
default_fie... | python | def field(self):
"""
Returns the field name that this column will have inside the database.
:return <str>
"""
if not self.__field:
default_field = inflection.underscore(self.__name)
if isinstance(self, orb.ReferenceColumn):
default_fie... | [
"def",
"field",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__field",
":",
"default_field",
"=",
"inflection",
".",
"underscore",
"(",
"self",
".",
"__name",
")",
"if",
"isinstance",
"(",
"self",
",",
"orb",
".",
"ReferenceColumn",
")",
":",
"def... | Returns the field name that this column will have inside the database.
:return <str> | [
"Returns",
"the",
"field",
"name",
"that",
"this",
"column",
"will",
"have",
"inside",
"the",
"database",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L231-L243 |
49,871 | orb-framework/orb | orb/core/column.py | Column.firstMemberSchema | def firstMemberSchema(self, schemas):
"""
Returns the first schema within the list that this column is a member
of.
:param schemas | [<orb.TableSchema>, ..]
:return <orb.TableSchema> || None
"""
for schema in schemas:
if schema.hasColumn(sel... | python | def firstMemberSchema(self, schemas):
"""
Returns the first schema within the list that this column is a member
of.
:param schemas | [<orb.TableSchema>, ..]
:return <orb.TableSchema> || None
"""
for schema in schemas:
if schema.hasColumn(sel... | [
"def",
"firstMemberSchema",
"(",
"self",
",",
"schemas",
")",
":",
"for",
"schema",
"in",
"schemas",
":",
"if",
"schema",
".",
"hasColumn",
"(",
"self",
")",
":",
"return",
"schema",
"return",
"self",
".",
"schema",
"(",
")"
] | Returns the first schema within the list that this column is a member
of.
:param schemas | [<orb.TableSchema>, ..]
:return <orb.TableSchema> || None | [
"Returns",
"the",
"first",
"schema",
"within",
"the",
"list",
"that",
"this",
"column",
"is",
"a",
"member",
"of",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L245-L257 |
49,872 | orb-framework/orb | orb/core/column.py | Column.isMemberOf | def isMemberOf(self, schemas):
"""
Returns whether or not this column is a member of any of the given
schemas.
:param schemas | [<orb.TableSchema>, ..] || <orb.TableSchema>
:return <bool>
"""
if type(schemas) not in (tuple, list, set):
schem... | python | def isMemberOf(self, schemas):
"""
Returns whether or not this column is a member of any of the given
schemas.
:param schemas | [<orb.TableSchema>, ..] || <orb.TableSchema>
:return <bool>
"""
if type(schemas) not in (tuple, list, set):
schem... | [
"def",
"isMemberOf",
"(",
"self",
",",
"schemas",
")",
":",
"if",
"type",
"(",
"schemas",
")",
"not",
"in",
"(",
"tuple",
",",
"list",
",",
"set",
")",
":",
"schemas",
"=",
"(",
"schemas",
",",
")",
"for",
"schema",
"in",
"schemas",
":",
"if",
"s... | Returns whether or not this column is a member of any of the given
schemas.
:param schemas | [<orb.TableSchema>, ..] || <orb.TableSchema>
:return <bool> | [
"Returns",
"whether",
"or",
"not",
"this",
"column",
"is",
"a",
"member",
"of",
"any",
"of",
"the",
"given",
"schemas",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L276-L291 |
49,873 | orb-framework/orb | orb/core/column.py | Column.loadJSON | def loadJSON(self, jdata):
"""
Initializes the information for this class from the given JSON data blob.
:param jdata: <dict>
"""
# required params
self.__name = jdata['name']
self.__field = jdata['field']
# optional fields
self.__display = jdata... | python | def loadJSON(self, jdata):
"""
Initializes the information for this class from the given JSON data blob.
:param jdata: <dict>
"""
# required params
self.__name = jdata['name']
self.__field = jdata['field']
# optional fields
self.__display = jdata... | [
"def",
"loadJSON",
"(",
"self",
",",
"jdata",
")",
":",
"# required params",
"self",
".",
"__name",
"=",
"jdata",
"[",
"'name'",
"]",
"self",
".",
"__field",
"=",
"jdata",
"[",
"'field'",
"]",
"# optional fields",
"self",
".",
"__display",
"=",
"jdata",
... | Initializes the information for this class from the given JSON data blob.
:param jdata: <dict> | [
"Initializes",
"the",
"information",
"for",
"this",
"class",
"from",
"the",
"given",
"JSON",
"data",
"blob",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L303-L317 |
49,874 | orb-framework/orb | orb/core/column.py | Column.setFlag | def setFlag(self, flag, state=True):
"""
Sets whether or not this flag should be on.
:param flag | <Column.Flags>
state | <bool>
"""
if state:
self.__flags |= flag
else:
self.__flags &= ~flag | python | def setFlag(self, flag, state=True):
"""
Sets whether or not this flag should be on.
:param flag | <Column.Flags>
state | <bool>
"""
if state:
self.__flags |= flag
else:
self.__flags &= ~flag | [
"def",
"setFlag",
"(",
"self",
",",
"flag",
",",
"state",
"=",
"True",
")",
":",
"if",
"state",
":",
"self",
".",
"__flags",
"|=",
"flag",
"else",
":",
"self",
".",
"__flags",
"&=",
"~",
"flag"
] | Sets whether or not this flag should be on.
:param flag | <Column.Flags>
state | <bool> | [
"Sets",
"whether",
"or",
"not",
"this",
"flag",
"should",
"be",
"on",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L515-L525 |
49,875 | orb-framework/orb | orb/core/column.py | Column.validate | def validate(self, value):
"""
Validates the inputted value against this columns rules. If the inputted value does not pass, then
a validation error will be raised. Override this method in column sub-classes for more
specialized validation.
:param value | <variant>
... | python | def validate(self, value):
"""
Validates the inputted value against this columns rules. If the inputted value does not pass, then
a validation error will be raised. Override this method in column sub-classes for more
specialized validation.
:param value | <variant>
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"# check for the required flag",
"if",
"self",
".",
"testFlag",
"(",
"self",
".",
"Flags",
".",
"Required",
")",
"and",
"not",
"self",
".",
"testFlag",
"(",
"self",
".",
"Flags",
".",
"AutoAssign",
... | Validates the inputted value against this columns rules. If the inputted value does not pass, then
a validation error will be raised. Override this method in column sub-classes for more
specialized validation.
:param value | <variant>
:return <bool> success | [
"Validates",
"the",
"inputted",
"value",
"against",
"this",
"columns",
"rules",
".",
"If",
"the",
"inputted",
"value",
"does",
"not",
"pass",
"then",
"a",
"validation",
"error",
"will",
"be",
"raised",
".",
"Override",
"this",
"method",
"in",
"column",
"sub"... | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L583-L600 |
49,876 | orb-framework/orb | orb/core/column.py | Column.fromJSON | def fromJSON(cls, jdata):
"""
Generates a new column from the given json data. This should
be already loaded into a Python dictionary, not a JSON string.
:param jdata | <dict>
:return <orb.Column> || None
"""
cls_type = jdata.get('type')
col_cl... | python | def fromJSON(cls, jdata):
"""
Generates a new column from the given json data. This should
be already loaded into a Python dictionary, not a JSON string.
:param jdata | <dict>
:return <orb.Column> || None
"""
cls_type = jdata.get('type')
col_cl... | [
"def",
"fromJSON",
"(",
"cls",
",",
"jdata",
")",
":",
"cls_type",
"=",
"jdata",
".",
"get",
"(",
"'type'",
")",
"col_cls",
"=",
"cls",
".",
"byName",
"(",
"cls_type",
")",
"if",
"not",
"col_cls",
":",
"raise",
"orb",
".",
"errors",
".",
"ColumnTypeN... | Generates a new column from the given json data. This should
be already loaded into a Python dictionary, not a JSON string.
:param jdata | <dict>
:return <orb.Column> || None | [
"Generates",
"a",
"new",
"column",
"from",
"the",
"given",
"json",
"data",
".",
"This",
"should",
"be",
"already",
"loaded",
"into",
"a",
"Python",
"dictionary",
"not",
"a",
"JSON",
"string",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/column.py#L632-L649 |
49,877 | orb-framework/orb | orb/core/schema.py | Schema.ancestry | def ancestry(self):
"""
Returns the different inherited schemas for this instance.
:return [<TableSchema>, ..]
"""
if not self.inherits():
return []
schema = orb.system.schema(self.inherits())
if not schema:
return []
return ... | python | def ancestry(self):
"""
Returns the different inherited schemas for this instance.
:return [<TableSchema>, ..]
"""
if not self.inherits():
return []
schema = orb.system.schema(self.inherits())
if not schema:
return []
return ... | [
"def",
"ancestry",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"inherits",
"(",
")",
":",
"return",
"[",
"]",
"schema",
"=",
"orb",
".",
"system",
".",
"schema",
"(",
"self",
".",
"inherits",
"(",
")",
")",
"if",
"not",
"schema",
":",
"retur... | Returns the different inherited schemas for this instance.
:return [<TableSchema>, ..] | [
"Returns",
"the",
"different",
"inherited",
"schemas",
"for",
"this",
"instance",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L107-L120 |
49,878 | orb-framework/orb | orb/core/schema.py | Schema.addColumn | def addColumn(self, column):
"""
Adds the inputted column to this table schema.
:param column | <orb.Column>
"""
column.setSchema(self)
self.__columns[column.name()] = column | python | def addColumn(self, column):
"""
Adds the inputted column to this table schema.
:param column | <orb.Column>
"""
column.setSchema(self)
self.__columns[column.name()] = column | [
"def",
"addColumn",
"(",
"self",
",",
"column",
")",
":",
"column",
".",
"setSchema",
"(",
"self",
")",
"self",
".",
"__columns",
"[",
"column",
".",
"name",
"(",
")",
"]",
"=",
"column"
] | Adds the inputted column to this table schema.
:param column | <orb.Column> | [
"Adds",
"the",
"inputted",
"column",
"to",
"this",
"table",
"schema",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L122-L129 |
49,879 | orb-framework/orb | orb/core/schema.py | Schema.addIndex | def addIndex(self, index):
"""
Adds the inputted index to this table schema.
:param index | <orb.Index>
"""
index.setSchema(self)
self.__indexes[index.name()] = index | python | def addIndex(self, index):
"""
Adds the inputted index to this table schema.
:param index | <orb.Index>
"""
index.setSchema(self)
self.__indexes[index.name()] = index | [
"def",
"addIndex",
"(",
"self",
",",
"index",
")",
":",
"index",
".",
"setSchema",
"(",
"self",
")",
"self",
".",
"__indexes",
"[",
"index",
".",
"name",
"(",
")",
"]",
"=",
"index"
] | Adds the inputted index to this table schema.
:param index | <orb.Index> | [
"Adds",
"the",
"inputted",
"index",
"to",
"this",
"table",
"schema",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L131-L138 |
49,880 | orb-framework/orb | orb/core/schema.py | Schema.addCollector | def addCollector(self, collector):
"""
Adds the inputted collector reference to this table schema.
:param collector | <orb.Collector>
"""
collector.setSchema(self)
self.__collectors[collector.name()] = collector | python | def addCollector(self, collector):
"""
Adds the inputted collector reference to this table schema.
:param collector | <orb.Collector>
"""
collector.setSchema(self)
self.__collectors[collector.name()] = collector | [
"def",
"addCollector",
"(",
"self",
",",
"collector",
")",
":",
"collector",
".",
"setSchema",
"(",
"self",
")",
"self",
".",
"__collectors",
"[",
"collector",
".",
"name",
"(",
")",
"]",
"=",
"collector"
] | Adds the inputted collector reference to this table schema.
:param collector | <orb.Collector> | [
"Adds",
"the",
"inputted",
"collector",
"reference",
"to",
"this",
"table",
"schema",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L140-L147 |
49,881 | orb-framework/orb | orb/core/schema.py | Schema.collector | def collector(self, name, recurse=True):
"""
Returns the collector that matches the inputted name.
:return <orb.Collector> || None
"""
return self.collectors(recurse=recurse).get(name) | python | def collector(self, name, recurse=True):
"""
Returns the collector that matches the inputted name.
:return <orb.Collector> || None
"""
return self.collectors(recurse=recurse).get(name) | [
"def",
"collector",
"(",
"self",
",",
"name",
",",
"recurse",
"=",
"True",
")",
":",
"return",
"self",
".",
"collectors",
"(",
"recurse",
"=",
"recurse",
")",
".",
"get",
"(",
"name",
")"
] | Returns the collector that matches the inputted name.
:return <orb.Collector> || None | [
"Returns",
"the",
"collector",
"that",
"matches",
"the",
"inputted",
"name",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L149-L155 |
49,882 | orb-framework/orb | orb/core/schema.py | Schema.collectors | def collectors(self, recurse=True, flags=0):
"""
Returns a list of the collectors for this instance.
:return {<str> name: <orb.Collector>, ..}
"""
output = {}
if recurse and self.inherits():
schema = orb.system.schema(self.inherits())
if not s... | python | def collectors(self, recurse=True, flags=0):
"""
Returns a list of the collectors for this instance.
:return {<str> name: <orb.Collector>, ..}
"""
output = {}
if recurse and self.inherits():
schema = orb.system.schema(self.inherits())
if not s... | [
"def",
"collectors",
"(",
"self",
",",
"recurse",
"=",
"True",
",",
"flags",
"=",
"0",
")",
":",
"output",
"=",
"{",
"}",
"if",
"recurse",
"and",
"self",
".",
"inherits",
"(",
")",
":",
"schema",
"=",
"orb",
".",
"system",
".",
"schema",
"(",
"se... | Returns a list of the collectors for this instance.
:return {<str> name: <orb.Collector>, ..} | [
"Returns",
"a",
"list",
"of",
"the",
"collectors",
"for",
"this",
"instance",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L157-L172 |
49,883 | orb-framework/orb | orb/core/schema.py | Schema.inheritanceTree | def inheritanceTree(self):
"""
Returns the inheritance tree for this schema, traversing up the hierarchy for the inherited schema instances.
:return: <generator>
"""
inherits = self.inherits()
while inherits:
ischema = orb.system.schema(inherits)
... | python | def inheritanceTree(self):
"""
Returns the inheritance tree for this schema, traversing up the hierarchy for the inherited schema instances.
:return: <generator>
"""
inherits = self.inherits()
while inherits:
ischema = orb.system.schema(inherits)
... | [
"def",
"inheritanceTree",
"(",
"self",
")",
":",
"inherits",
"=",
"self",
".",
"inherits",
"(",
")",
"while",
"inherits",
":",
"ischema",
"=",
"orb",
".",
"system",
".",
"schema",
"(",
"inherits",
")",
"if",
"not",
"ischema",
":",
"raise",
"orb",
".",
... | Returns the inheritance tree for this schema, traversing up the hierarchy for the inherited schema instances.
:return: <generator> | [
"Returns",
"the",
"inheritance",
"tree",
"for",
"this",
"schema",
"traversing",
"up",
"the",
"hierarchy",
"for",
"the",
"inherited",
"schema",
"instances",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L332-L345 |
49,884 | orb-framework/orb | orb/core/schema.py | Schema.namespace | def namespace(self, **context):
"""
Returns the namespace that should be used for this schema, when specified.
:return: <str>
"""
context = orb.Context(**context)
if context.forceNamespace:
return context.namespace or self.__namespace
else:
... | python | def namespace(self, **context):
"""
Returns the namespace that should be used for this schema, when specified.
:return: <str>
"""
context = orb.Context(**context)
if context.forceNamespace:
return context.namespace or self.__namespace
else:
... | [
"def",
"namespace",
"(",
"self",
",",
"*",
"*",
"context",
")",
":",
"context",
"=",
"orb",
".",
"Context",
"(",
"*",
"*",
"context",
")",
"if",
"context",
".",
"forceNamespace",
":",
"return",
"context",
".",
"namespace",
"or",
"self",
".",
"__namespa... | Returns the namespace that should be used for this schema, when specified.
:return: <str> | [
"Returns",
"the",
"namespace",
"that",
"should",
"be",
"used",
"for",
"this",
"schema",
"when",
"specified",
"."
] | 575be2689cb269e65a0a2678232ff940acc19e5a | https://github.com/orb-framework/orb/blob/575be2689cb269e65a0a2678232ff940acc19e5a/orb/core/schema.py#L369-L379 |
49,885 | priestc/giotto | giotto/utils.py | parse_kwargs | def parse_kwargs(kwargs):
"""
Convert a list of kwargs into a dictionary. Duplicates of the same keyword
get added to an list within the dictionary.
>>> parse_kwargs(['--var1=1', '--var2=2', '--var1=3']
{'var1': [1, 3], 'var2': 2}
"""
d = defaultdict(list)
for k, v in ((k.lstrip('-... | python | def parse_kwargs(kwargs):
"""
Convert a list of kwargs into a dictionary. Duplicates of the same keyword
get added to an list within the dictionary.
>>> parse_kwargs(['--var1=1', '--var2=2', '--var1=3']
{'var1': [1, 3], 'var2': 2}
"""
d = defaultdict(list)
for k, v in ((k.lstrip('-... | [
"def",
"parse_kwargs",
"(",
"kwargs",
")",
":",
"d",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"k",
",",
"v",
"in",
"(",
"(",
"k",
".",
"lstrip",
"(",
"'-'",
")",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"(",
"a",
".",
"split",
"(",
"'... | Convert a list of kwargs into a dictionary. Duplicates of the same keyword
get added to an list within the dictionary.
>>> parse_kwargs(['--var1=1', '--var2=2', '--var1=3']
{'var1': [1, 3], 'var2': 2} | [
"Convert",
"a",
"list",
"of",
"kwargs",
"into",
"a",
"dictionary",
".",
"Duplicates",
"of",
"the",
"same",
"keyword",
"get",
"added",
"to",
"an",
"list",
"within",
"the",
"dictionary",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/utils.py#L51-L71 |
49,886 | priestc/giotto | giotto/utils.py | htmlize_list | def htmlize_list(items):
"""
Turn a python list into an html list.
"""
out = ["<ul>"]
for item in items:
out.append("<li>" + htmlize(item) + "</li>")
out.append("</ul>")
return "\n".join(out) | python | def htmlize_list(items):
"""
Turn a python list into an html list.
"""
out = ["<ul>"]
for item in items:
out.append("<li>" + htmlize(item) + "</li>")
out.append("</ul>")
return "\n".join(out) | [
"def",
"htmlize_list",
"(",
"items",
")",
":",
"out",
"=",
"[",
"\"<ul>\"",
"]",
"for",
"item",
"in",
"items",
":",
"out",
".",
"append",
"(",
"\"<li>\"",
"+",
"htmlize",
"(",
"item",
")",
"+",
"\"</li>\"",
")",
"out",
".",
"append",
"(",
"\"</ul>\""... | Turn a python list into an html list. | [
"Turn",
"a",
"python",
"list",
"into",
"an",
"html",
"list",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/utils.py#L104-L112 |
49,887 | priestc/giotto | giotto/utils.py | pre_process_json | def pre_process_json(obj):
"""
Preprocess items in a dictionary or list and prepare them to be json serialized.
"""
if type(obj) is dict:
new_dict = {}
for key, value in obj.items():
new_dict[key] = pre_process_json(value)
return new_dict
elif type(obj) is list:
... | python | def pre_process_json(obj):
"""
Preprocess items in a dictionary or list and prepare them to be json serialized.
"""
if type(obj) is dict:
new_dict = {}
for key, value in obj.items():
new_dict[key] = pre_process_json(value)
return new_dict
elif type(obj) is list:
... | [
"def",
"pre_process_json",
"(",
"obj",
")",
":",
"if",
"type",
"(",
"obj",
")",
"is",
"dict",
":",
"new_dict",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"obj",
".",
"items",
"(",
")",
":",
"new_dict",
"[",
"key",
"]",
"=",
"pre_process_json"... | Preprocess items in a dictionary or list and prepare them to be json serialized. | [
"Preprocess",
"items",
"in",
"a",
"dictionary",
"or",
"list",
"and",
"prepare",
"them",
"to",
"be",
"json",
"serialized",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/utils.py#L114-L144 |
49,888 | priestc/giotto | giotto/utils.py | render_error_page | def render_error_page(code, exc, mimetype='text/html', traceback=''):
"""
Render the error page
"""
from giotto.views import get_jinja_template
if 'json' in mimetype:
return json.dumps({
'code': code,
'exception': exc.__class__.__name__,
'message': str(ex... | python | def render_error_page(code, exc, mimetype='text/html', traceback=''):
"""
Render the error page
"""
from giotto.views import get_jinja_template
if 'json' in mimetype:
return json.dumps({
'code': code,
'exception': exc.__class__.__name__,
'message': str(ex... | [
"def",
"render_error_page",
"(",
"code",
",",
"exc",
",",
"mimetype",
"=",
"'text/html'",
",",
"traceback",
"=",
"''",
")",
":",
"from",
"giotto",
".",
"views",
"import",
"get_jinja_template",
"if",
"'json'",
"in",
"mimetype",
":",
"return",
"json",
".",
"... | Render the error page | [
"Render",
"the",
"error",
"page"
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/utils.py#L147-L169 |
49,889 | priestc/giotto | giotto/__init__.py | initialize | def initialize(module_name=None):
"""
Build the giotto settings object. This function gets called
at the very begining of every request cycle.
"""
import giotto
from giotto.utils import random_string, switchout_keyvalue
from django.conf import settings
setattr(giotto, '_config', GiottoS... | python | def initialize(module_name=None):
"""
Build the giotto settings object. This function gets called
at the very begining of every request cycle.
"""
import giotto
from giotto.utils import random_string, switchout_keyvalue
from django.conf import settings
setattr(giotto, '_config', GiottoS... | [
"def",
"initialize",
"(",
"module_name",
"=",
"None",
")",
":",
"import",
"giotto",
"from",
"giotto",
".",
"utils",
"import",
"random_string",
",",
"switchout_keyvalue",
"from",
"django",
".",
"conf",
"import",
"settings",
"setattr",
"(",
"giotto",
",",
"'_con... | Build the giotto settings object. This function gets called
at the very begining of every request cycle. | [
"Build",
"the",
"giotto",
"settings",
"object",
".",
"This",
"function",
"gets",
"called",
"at",
"the",
"very",
"begining",
"of",
"every",
"request",
"cycle",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/__init__.py#L11-L77 |
49,890 | priestc/giotto | giotto/__init__.py | get_config | def get_config(item, default=None):
"""
Use this function to get values from the config object.
"""
import giotto
return getattr(giotto._config, item, default) or default | python | def get_config(item, default=None):
"""
Use this function to get values from the config object.
"""
import giotto
return getattr(giotto._config, item, default) or default | [
"def",
"get_config",
"(",
"item",
",",
"default",
"=",
"None",
")",
":",
"import",
"giotto",
"return",
"getattr",
"(",
"giotto",
".",
"_config",
",",
"item",
",",
"default",
")",
"or",
"default"
] | Use this function to get values from the config object. | [
"Use",
"this",
"function",
"to",
"get",
"values",
"from",
"the",
"config",
"object",
"."
] | d4c26380caefa7745bb27135e315de830f7254d3 | https://github.com/priestc/giotto/blob/d4c26380caefa7745bb27135e315de830f7254d3/giotto/__init__.py#L79-L84 |
49,891 | unistra/django-rest-framework-fine-permissions | rest_framework_fine_permissions/permissions.py | FilterPermission.has_object_permission | def has_object_permission(self, request, view, obj):
"""
check filter permissions
"""
user = request.user
if not user.is_superuser and not user.is_anonymous():
valid = False
try:
ct = ContentType.objects.get_for_model(obj)
... | python | def has_object_permission(self, request, view, obj):
"""
check filter permissions
"""
user = request.user
if not user.is_superuser and not user.is_anonymous():
valid = False
try:
ct = ContentType.objects.get_for_model(obj)
... | [
"def",
"has_object_permission",
"(",
"self",
",",
"request",
",",
"view",
",",
"obj",
")",
":",
"user",
"=",
"request",
".",
"user",
"if",
"not",
"user",
".",
"is_superuser",
"and",
"not",
"user",
".",
"is_anonymous",
"(",
")",
":",
"valid",
"=",
"Fals... | check filter permissions | [
"check",
"filter",
"permissions"
] | 71af5953648ef9f9bdfb64a4c0ed0ea62661fa61 | https://github.com/unistra/django-rest-framework-fine-permissions/blob/71af5953648ef9f9bdfb64a4c0ed0ea62661fa61/rest_framework_fine_permissions/permissions.py#L41-L66 |
49,892 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.displayHelp | def displayHelp(self):
"""
Output help message of twistedchecker.
"""
self.outputStream.write(self.linter.help())
sys.exit(32) | python | def displayHelp(self):
"""
Output help message of twistedchecker.
"""
self.outputStream.write(self.linter.help())
sys.exit(32) | [
"def",
"displayHelp",
"(",
"self",
")",
":",
"self",
".",
"outputStream",
".",
"write",
"(",
"self",
".",
"linter",
".",
"help",
"(",
")",
")",
"sys",
".",
"exit",
"(",
"32",
")"
] | Output help message of twistedchecker. | [
"Output",
"help",
"message",
"of",
"twistedchecker",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L119-L124 |
49,893 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.unregisterChecker | def unregisterChecker(self, checker):
"""
Remove a checker from the list of registered checkers.
@param checker: the checker to remove
"""
self.linter._checkers[checker.name].remove(checker)
if checker in self.linter._reports:
del self.linter._reports[checker... | python | def unregisterChecker(self, checker):
"""
Remove a checker from the list of registered checkers.
@param checker: the checker to remove
"""
self.linter._checkers[checker.name].remove(checker)
if checker in self.linter._reports:
del self.linter._reports[checker... | [
"def",
"unregisterChecker",
"(",
"self",
",",
"checker",
")",
":",
"self",
".",
"linter",
".",
"_checkers",
"[",
"checker",
".",
"name",
"]",
".",
"remove",
"(",
"checker",
")",
"if",
"checker",
"in",
"self",
".",
"linter",
".",
"_reports",
":",
"del",... | Remove a checker from the list of registered checkers.
@param checker: the checker to remove | [
"Remove",
"a",
"checker",
"from",
"the",
"list",
"of",
"registered",
"checkers",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L152-L162 |
49,894 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.findUselessCheckers | def findUselessCheckers(self, allowedMessages):
"""
Find checkers which generate no allowed messages.
@param allowedMessages: allowed messages
@return: useless checkers, remove them from pylint
"""
uselessCheckers = []
for checkerName in self.linter._checkers:
... | python | def findUselessCheckers(self, allowedMessages):
"""
Find checkers which generate no allowed messages.
@param allowedMessages: allowed messages
@return: useless checkers, remove them from pylint
"""
uselessCheckers = []
for checkerName in self.linter._checkers:
... | [
"def",
"findUselessCheckers",
"(",
"self",
",",
"allowedMessages",
")",
":",
"uselessCheckers",
"=",
"[",
"]",
"for",
"checkerName",
"in",
"self",
".",
"linter",
".",
"_checkers",
":",
"for",
"checker",
"in",
"list",
"(",
"self",
".",
"linter",
".",
"_chec... | Find checkers which generate no allowed messages.
@param allowedMessages: allowed messages
@return: useless checkers, remove them from pylint | [
"Find",
"checkers",
"which",
"generate",
"no",
"allowed",
"messages",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L165-L178 |
49,895 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.restrictCheckers | def restrictCheckers(self, allowedMessages):
"""
Unregister useless checkers to speed up twistedchecker.
@param allowedMessages: output messages allowed in twistedchecker
"""
uselessCheckers = self.findUselessCheckers(allowedMessages)
# Unregister these checkers
... | python | def restrictCheckers(self, allowedMessages):
"""
Unregister useless checkers to speed up twistedchecker.
@param allowedMessages: output messages allowed in twistedchecker
"""
uselessCheckers = self.findUselessCheckers(allowedMessages)
# Unregister these checkers
... | [
"def",
"restrictCheckers",
"(",
"self",
",",
"allowedMessages",
")",
":",
"uselessCheckers",
"=",
"self",
".",
"findUselessCheckers",
"(",
"allowedMessages",
")",
"# Unregister these checkers",
"for",
"checker",
"in",
"uselessCheckers",
":",
"self",
".",
"unregisterCh... | Unregister useless checkers to speed up twistedchecker.
@param allowedMessages: output messages allowed in twistedchecker | [
"Unregister",
"useless",
"checkers",
"to",
"speed",
"up",
"twistedchecker",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L181-L190 |
49,896 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.getCheckerByName | def getCheckerByName(self, checkerType):
"""
Get checker by given name.
@checkerType: type of the checker
"""
for checker in sum(list(self.linter._checkers.values()), []):
if isinstance(checker, checkerType):
return checker
return None | python | def getCheckerByName(self, checkerType):
"""
Get checker by given name.
@checkerType: type of the checker
"""
for checker in sum(list(self.linter._checkers.values()), []):
if isinstance(checker, checkerType):
return checker
return None | [
"def",
"getCheckerByName",
"(",
"self",
",",
"checkerType",
")",
":",
"for",
"checker",
"in",
"sum",
"(",
"list",
"(",
"self",
".",
"linter",
".",
"_checkers",
".",
"values",
"(",
")",
")",
",",
"[",
"]",
")",
":",
"if",
"isinstance",
"(",
"checker",... | Get checker by given name.
@checkerType: type of the checker | [
"Get",
"checker",
"by",
"given",
"name",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L193-L202 |
49,897 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.allowPatternsForNameChecking | def allowPatternsForNameChecking(self, patternsFunc, patternsClass):
"""
Allow name exceptions by given patterns.
@param patternsFunc: patterns of special function names
@param patternsClass: patterns of special class names
"""
cfgParser = self.linter.cfgfile_parser
... | python | def allowPatternsForNameChecking(self, patternsFunc, patternsClass):
"""
Allow name exceptions by given patterns.
@param patternsFunc: patterns of special function names
@param patternsClass: patterns of special class names
"""
cfgParser = self.linter.cfgfile_parser
... | [
"def",
"allowPatternsForNameChecking",
"(",
"self",
",",
"patternsFunc",
",",
"patternsClass",
")",
":",
"cfgParser",
"=",
"self",
".",
"linter",
".",
"cfgfile_parser",
"nameChecker",
"=",
"self",
".",
"getCheckerByName",
"(",
"NameChecker",
")",
"if",
"not",
"n... | Allow name exceptions by given patterns.
@param patternsFunc: patterns of special function names
@param patternsClass: patterns of special class names | [
"Allow",
"name",
"exceptions",
"by",
"given",
"patterns",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L205-L235 |
49,898 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.getPathList | def getPathList(self, filesOrModules):
"""
Transform a list of modules to path.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar)
"""
pathList = []
for fileOrMod in filesOrModules:
if not os.path.exists(fileOrMod):
... | python | def getPathList(self, filesOrModules):
"""
Transform a list of modules to path.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar)
"""
pathList = []
for fileOrMod in filesOrModules:
if not os.path.exists(fileOrMod):
... | [
"def",
"getPathList",
"(",
"self",
",",
"filesOrModules",
")",
":",
"pathList",
"=",
"[",
"]",
"for",
"fileOrMod",
"in",
"filesOrModules",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"fileOrMod",
")",
":",
"# May be given module is not not a path,... | Transform a list of modules to path.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar) | [
"Transform",
"a",
"list",
"of",
"modules",
"to",
"path",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L238-L263 |
49,899 | twisted/twistedchecker | twistedchecker/core/runner.py | Runner.setNameExceptions | def setNameExceptions(self, filesOrModules):
"""
Find name exceptions in codes and allow them to be ignored
in checking.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar)
"""
pathList = self.getPathList(filesOrModules)
for path in pa... | python | def setNameExceptions(self, filesOrModules):
"""
Find name exceptions in codes and allow them to be ignored
in checking.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar)
"""
pathList = self.getPathList(filesOrModules)
for path in pa... | [
"def",
"setNameExceptions",
"(",
"self",
",",
"filesOrModules",
")",
":",
"pathList",
"=",
"self",
".",
"getPathList",
"(",
"filesOrModules",
")",
"for",
"path",
"in",
"pathList",
":",
"patternsFunc",
",",
"patternsClass",
"=",
"findAllExceptions",
"(",
"path",
... | Find name exceptions in codes and allow them to be ignored
in checking.
@param filesOrModules: a list of modules (may be foo/bar.py or
foo.bar) | [
"Find",
"name",
"exceptions",
"in",
"codes",
"and",
"allow",
"them",
"to",
"be",
"ignored",
"in",
"checking",
"."
] | 80060e1c07cf5d67d747dbec8ec0e5ee913e8929 | https://github.com/twisted/twistedchecker/blob/80060e1c07cf5d67d747dbec8ec0e5ee913e8929/twistedchecker/core/runner.py#L266-L277 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.