id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
141,948 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/docs/ext/djangodocs.py
|
djangodocs.KaraageStandaloneHTMLBuilder
|
class KaraageStandaloneHTMLBuilder(StandaloneHTMLBuilder):
"""
Subclass to add some extra things we need.
"""
name = 'djangohtml'
def finish(self):
super().finish()
logger.info(bold("writing templatebuiltins.js..."))
xrefs = self.env.domaindata["std"]["objects"]
templatebuiltins = {
"ttags": [
n for ((t, n), (k, a)) in xrefs.items()
if t == "templatetag" and k == "ref/templates/builtins"
],
"tfilters": [
n for ((t, n), (k, a)) in xrefs.items()
if t == "templatefilter" and k == "ref/templates/builtins"
],
}
outfilename = os.path.join(self.outdir, "templatebuiltins.js")
with open(outfilename, 'w') as fp:
fp.write('var django_template_builtins = ')
json.dump(templatebuiltins, fp)
fp.write(';\n')
|
class KaraageStandaloneHTMLBuilder(StandaloneHTMLBuilder):
'''
Subclass to add some extra things we need.
'''
def finish(self):
pass
| 2 | 1 | 19 | 0 | 19 | 0 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 26 | 2 | 21 | 8 | 19 | 3 | 12 | 6 | 10 | 1 | 1 | 1 | 1 |
141,949 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/docs/ext/djangodocs.py
|
djangodocs.VersionDirective
|
class VersionDirective(Directive):
has_content = True
required_arguments = 1
optional_arguments = 1
final_argument_whitespace = True
option_spec = {}
def run(self):
if len(self.arguments) > 1:
msg = """Only one argument accepted for directive '{directive_name}::'.
Comments should be provided as content,
not as an extra argument.""".format(directive_name=self.name)
raise self.error(msg)
env = self.state.document.settings.env
ret = []
node = addnodes.versionmodified()
ret.append(node)
if self.arguments[0] == env.config.karaage_next_version:
node['version'] = "Development version"
else:
node['version'] = self.arguments[0]
node['type'] = self.name
if self.content:
self.state.nested_parse(self.content, self.content_offset, node)
try:
env.get_domain('changeset').note_changeset(node)
except ExtensionError:
# Sphinx < 1.8: Domain 'changeset' is not registered
env.note_versionchange(node['type'], node['version'], node, self.lineno)
return ret
|
class VersionDirective(Directive):
def run(self):
pass
| 2 | 0 | 26 | 3 | 22 | 1 | 5 | 0.04 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 33 | 4 | 28 | 11 | 26 | 1 | 25 | 11 | 23 | 5 | 1 | 1 | 5 |
141,950 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/apps.py
|
karaage.apps.Karaage
|
class Karaage(AppConfig):
name = "karaage"
|
class Karaage(AppConfig):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
141,951 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/backends.py
|
karaage.backends.LDAPBackend
|
class LDAPBackend(ModelBackend):
def authenticate(self, username=None, password=None, **kwargs):
try:
person = Person.objects.get(username__exact=username)
except Person.DoesNotExist:
return None
if person.legacy_ldap_password is None:
return None
if not tldap.ldap_passwd.check_password(password, person.legacy_ldap_password):
return None
# Success.
person.set_password(password)
person.save()
return person
|
class LDAPBackend(ModelBackend):
def authenticate(self, username=None, password=None, **kwargs):
pass
| 2 | 0 | 17 | 4 | 12 | 1 | 4 | 0.08 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 18 | 4 | 13 | 3 | 11 | 1 | 13 | 3 | 11 | 4 | 1 | 1 | 4 |
141,952 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/aaf_rapid_connect.py
|
karaage.common.aaf_rapid_connect.AafInstituteForm
|
class AafInstituteForm(forms.Form):
institute = forms.ModelChoiceField(queryset=None, required=True)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
queryset = Institute.active.filter(saml_entityid__isnull=False)
queryset = queryset.exclude(saml_entityid="")
self.fields["institute"].queryset = queryset
|
class AafInstituteForm(forms.Form):
def __init__(self, *args, **kwargs):
pass
| 2 | 0 | 7 | 2 | 5 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 0 | 1 | 1 | 10 | 3 | 7 | 4 | 5 | 0 | 7 | 4 | 5 | 1 | 1 | 0 | 1 |
141,953 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/forms.py
|
karaage.common.forms.CommentForm
|
class CommentForm(forms.ModelForm):
"""Comment form."""
class Meta:
model = LogEntry
fields = ["change_message"]
def __init__(self, obj, request, instance=None, **kwargs):
self.obj = obj
self.request = request
if instance is not None:
assert instance.action_flag == COMMENT
assert obj == instance.content_object
super(CommentForm, self).__init__(instance=instance, **kwargs)
def save(self, commit=True):
log = super(CommentForm, self).save(commit=False)
log.content_object = self.obj
log.object_repr = six.text_type(self.obj)
log.action_flag = COMMENT
log.user = self.request.user
if commit:
log.save()
return log
|
class CommentForm(forms.ModelForm):
'''Comment form.'''
class Meta:
def __init__(self, obj, request, instance=None, **kwargs):
pass
def save(self, commit=True):
pass
| 4 | 1 | 9 | 1 | 8 | 0 | 2 | 0.05 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 2 | 26 | 5 | 20 | 9 | 16 | 1 | 20 | 9 | 16 | 2 | 1 | 1 | 4 |
141,954 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/forms.py
|
karaage.common.forms.LoginForm
|
class LoginForm(forms.Form):
username = forms.CharField(label="Username", max_length=30)
password = forms.CharField(label="Password", widget=forms.PasswordInput)
|
class LoginForm(forms.Form):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,955 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/__init__.py
|
karaage.common.log
|
class log:
def __init__(self, user, obj, flag, message):
warnings.warn(
"Calling karaage.common.log directly has been"
" deprecated. You should use the API "
"log.(add|change|field_change|delete|comment)",
DeprecationWarning,
)
LogEntry.objects.log_object(obj, flag, message, user)
@classmethod
def add(cls, obj, message, user=None):
return LogEntry.objects.log_object(obj, ADDITION, message, user)
@classmethod
def change(cls, obj, message, user=None):
return LogEntry.objects.log_object(obj, CHANGE, message, user)
@classmethod
def field_change(cls, obj, user=None, field=None, new_value=None):
return LogEntry.objects.log_object(obj, CHANGE, "Changed %s to %s" % (field, new_value), user)
@classmethod
def delete(cls, obj, message, user=None):
return LogEntry.objects.log_object(obj, DELETION, message, user)
@classmethod
def comment(cls, obj, message, user=None):
return LogEntry.objects.log_object(obj, COMMENT, message, user)
|
class log:
def __init__(self, user, obj, flag, message):
pass
@classmethod
def add(cls, obj, message, user=None):
pass
@classmethod
def change(cls, obj, message, user=None):
pass
@classmethod
def field_change(cls, obj, user=None, field=None, new_value=None):
pass
@classmethod
def delete(cls, obj, message, user=None):
pass
@classmethod
def comment(cls, obj, message, user=None):
pass
| 12 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 0 | 6 | 6 | 29 | 5 | 24 | 12 | 12 | 0 | 14 | 7 | 7 | 1 | 0 | 0 | 6 |
141,956 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/models.py
|
karaage.common.models.LogEntry
|
class LogEntry(models.Model):
action_time = models.DateTimeField(_("action time"), auto_now_add=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, on_delete=models.SET_NULL)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.TextField(_("object id"), blank=True, null=True)
content_object = GenericForeignKey("content_type", "object_id")
object_repr = models.CharField(_("object repr"), max_length=200)
action_flag = models.PositiveSmallIntegerField(_("action flag"))
change_message = models.TextField(_("change message"), blank=True)
objects = LogEntryManager()
class Meta:
verbose_name = _("log entry")
verbose_name_plural = _("log entries")
db_table = "admin_log"
app_label = "karaage"
ordering = ("-action_time", "-pk")
def __repr__(self):
return smart_str(self.action_time)
def __str__(self):
if self.action_flag == ADDITION:
return gettext('Added "%(object)s".') % {"object": self.object_repr}
elif self.action_flag == CHANGE:
return gettext('Changed "%(object)s" - %(changes)s') % {
"object": self.object_repr,
"changes": self.change_message,
}
elif self.action_flag == DELETION:
return gettext('Deleted "%(object)s."') % {"object": self.object_repr}
elif self.action_flag == COMMENT:
return gettext('Comment "%(object)s" - %(changes)s') % {
"object": self.object_repr,
"changes": self.change_message,
}
return gettext("LogEntry Object")
def is_addition(self):
return self.action_flag == ADDITION
def is_change(self):
return self.action_flag == CHANGE
def is_deletion(self):
return self.action_flag == DELETION
def is_comment(self):
return self.action_flag == COMMENT
|
class LogEntry(models.Model):
class Meta:
def __repr__(self):
pass
def __str__(self):
pass
def is_addition(self):
pass
def is_change(self):
pass
def is_deletion(self):
pass
def is_comment(self):
pass
| 8 | 0 | 5 | 0 | 4 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 6 | 0 | 6 | 6 | 51 | 9 | 42 | 22 | 34 | 0 | 33 | 22 | 25 | 5 | 1 | 1 | 10 |
141,957 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/ldap_schemas.py
|
karaage.datastores.ldap_schemas.OpenldapAccount
|
class OpenldapAccount(BaseAccount):
"""An OpenLDAP specific account with the pwdpolicy schema."""
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
fields = {
**BaseAccount.get_fields(),
**helpers.get_fields_pwdpolicy(),
}
return fields
@classmethod
def on_load(cls, python_data: LdapObject, database: Database) -> LdapObject:
python_data = BaseAccount.on_load(python_data, database)
python_data = helpers.load_pwdpolicy(python_data)
return python_data
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
changes = BaseAccount.on_save(changes, database)
changes = dhelpers.save_account(changes, OpenldapAccount, database)
changes = helpers.save_pwdpolicy(changes)
changes = helpers.set_object_class(
changes,
["top", "person", "inetOrgPerson", "organizationalPerson", "shadowAccount", "posixAccount", "pwdPolicy"],
)
return changes
|
class OpenldapAccount(BaseAccount):
'''An OpenLDAP specific account with the pwdpolicy schema.'''
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
pass
@classmethod
def on_load(cls, python_data: LdapObject, database: Database) -> LdapObject:
pass
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
pass
| 7 | 1 | 6 | 0 | 6 | 0 | 1 | 0.04 | 1 | 1 | 0 | 0 | 0 | 0 | 3 | 8 | 27 | 3 | 23 | 8 | 16 | 1 | 14 | 5 | 10 | 1 | 2 | 0 | 3 |
141,958 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/models.py
|
karaage.common.models.LogEntryManager
|
class LogEntryManager(models.Manager):
def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=""):
msg = self.model(
None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message
)
msg.save()
return msg
def log_object(self, obj, flag, message, user=None):
assert obj is not None
assert obj.pk is not None
if user is None:
user = get_current_user()
if user is None:
user_id = None
else:
user_id = user.pk
return self.log_action(
user_id=user_id,
content_type_id=ContentType.objects.get_for_model(obj).pk,
object_id=obj.pk,
object_repr=six.text_type(obj),
action_flag=flag,
change_message=message,
)
|
class LogEntryManager(models.Manager):
def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=""):
pass
def log_object(self, obj, flag, message, user=None):
pass
| 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 25 | 1 | 24 | 5 | 21 | 0 | 14 | 5 | 11 | 3 | 1 | 1 | 4 |
141,959 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/trace.py
|
karaage.common.trace.PrependLoggerFactory
|
class PrependLoggerFactory(object):
"""This is a convenience class for creating new loggers for the
"trace" decorator. All loggers created via this class will have a
user specified prefix prepended to the name of the logger to
instantiate.
"""
def __init__(self, prefix="trace"):
"""Construct a new "PrependLoggerFactory" instance that
prepends the value \var{prefix} to the name of each
logger to be created by this class.
"""
self.__prefix = prefix.strip(".")
@property
def prefix(self):
"""The value to prefix to each logger created by this factory."""
return self.__prefix
@prefix.setter
def prefix(self, value):
self.__prefix = value.strip(".")
def get_logger(self, name):
return logging.getLogger(".".join((self.__prefix, name)))
|
class PrependLoggerFactory(object):
'''This is a convenience class for creating new loggers for the
"trace" decorator. All loggers created via this class will have a
user specified prefix prepended to the name of the logger to
instantiate.
'''
def __init__(self, prefix="trace"):
'''Construct a new "PrependLoggerFactory" instance that
prepends the value ar{prefix} to the name of each
logger to be created by this class.
'''
pass
@property
def prefix(self):
'''The value to prefix to each logger created by this factory.'''
pass
@prefix.setter
def prefix(self):
pass
def get_logger(self, name):
pass
| 7 | 3 | 3 | 0 | 2 | 1 | 1 | 0.91 | 1 | 0 | 0 | 0 | 4 | 1 | 4 | 4 | 25 | 4 | 11 | 8 | 4 | 10 | 9 | 6 | 4 | 1 | 1 | 0 | 4 |
141,960 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/trace.py
|
karaage.common.trace.ThreadLocal
|
class ThreadLocal(object):
"""Instances of this class provide a thread-local variable."""
def __init__(self):
self.__lock = thread.allocate_lock()
self.__vars = dict()
self.__init = None
@property
def value(self):
with self.__lock:
try:
return self.__vars[thread.get_ident()]
except KeyError:
return self.__init
@value.setter
def value(self, value):
with self.__lock:
self.__vars[thread.get_ident()] = value
@property
def initial_value(self):
with self.__lock:
return self.__init
@initial_value.setter
def initial_value(self, value):
with self.__lock:
self.__init = value
|
class ThreadLocal(object):
'''Instances of this class provide a thread-local variable.'''
def __init__(self):
pass
@property
def value(self):
pass
@value.setter
def value(self):
pass
@property
def initial_value(self):
pass
@initial_value.setter
def initial_value(self):
pass
| 10 | 1 | 4 | 0 | 4 | 0 | 1 | 0.04 | 1 | 2 | 0 | 0 | 5 | 3 | 5 | 5 | 30 | 5 | 24 | 13 | 14 | 1 | 20 | 9 | 14 | 2 | 1 | 2 | 6 |
141,961 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/trace.py
|
karaage.common.trace.TraceMetaClass
|
class TraceMetaClass(type):
"""Metaclass to automatically attach the 'trace' decorator to all
methods, static method and class methods of the class.
"""
def __new__(mcs, class_name, bases, class_dict):
klass = super(TraceMetaClass, mcs).__new__(mcs, class_name, bases, class_dict)
if "__logger__" in class_dict:
hook = trace(class_dict["__logger__"])
else:
hook = trace
attach_to_class(hook, klass, False)
return klass
|
class TraceMetaClass(type):
'''Metaclass to automatically attach the 'trace' decorator to all
methods, static method and class methods of the class.
'''
def __new__(mcs, class_name, bases, class_dict):
pass
| 2 | 1 | 8 | 0 | 8 | 0 | 2 | 0.33 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 14 | 13 | 1 | 9 | 4 | 7 | 3 | 8 | 4 | 6 | 2 | 2 | 1 | 2 |
141,962 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/trace.py
|
karaage.common.trace._C
|
class _C(object):
@classmethod
def class_method(cls):
pass
classMethodType = type(class_method)
@staticmethod
def static_method():
pass
staticMethodType = type(static_method)
@property
def property_method(self):
return None
|
class _C(object):
@classmethod
def class_method(cls):
pass
@staticmethod
def static_method():
pass
@property
def property_method(self):
pass
| 7 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 3 | 3 | 16 | 4 | 12 | 9 | 5 | 0 | 9 | 6 | 5 | 1 | 1 | 0 | 3 |
141,963 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/base.py
|
karaage.datastores.base.DataStore
|
class DataStore(object):
"""Base class used for all MC datastores."""
def __init__(self, config):
self.config = config
###########
# ACCOUNT #
###########
def save_account(self, account):
"""Account was saved."""
return
def delete_account(self, account):
"""Account was deleted."""
return
def set_account_password(self, account, raw_password):
"""Account's password was changed."""
return
def set_account_username(self, account, old_username, new_username):
"""Account's username was changed."""
return
def add_account_to_group(self, account, group):
"""Add account to group."""
return
def remove_account_from_group(self, account, group):
"""Remove account from group."""
return
def add_account_to_project(self, account, project):
"""Add account to project."""
return
def remove_account_from_project(self, account, project):
"""Remove account from project."""
return
def add_account_to_institute(self, account, institute):
"""Add account to institute."""
return
def remove_account_from_institute(self, account, institute):
"""Remove account from institute."""
return
def account_exists(self, username):
"""Does the account exist?"""
return False
def get_account_details(self, account):
"""Get the account details"""
return {}
#########
# GROUP #
#########
def save_group(self, group):
"""Group was saved."""
return
def delete_group(self, group):
"""Group was deleted."""
return
def set_group_name(self, group, old_name, new_name):
"""Group was renamed."""
return
def get_group_details(self, group):
"""Get the group details."""
return {}
###########
# PROJECT #
###########
def save_project(self, project):
"""Project was saved."""
return
def delete_project(self, project):
"""Project was deleted."""
return
def get_project_details(self, project):
"""Get project's details."""
return {}
def set_project_pid(self, project, old_pid, new_pid):
"""Project's pid was changed."""
return
#############
# INSTITUTE #
#############
def save_institute(self, institute):
"""Institute was saved."""
return
def delete_institute(self, institute):
"""Institute was deleted."""
return
def get_institute_details(self, institute):
"""Get institute's details."""
return {}
|
class DataStore(object):
'''Base class used for all MC datastores.'''
def __init__(self, config):
pass
def save_account(self, account):
'''Account was saved.'''
pass
def delete_account(self, account):
'''Account was deleted.'''
pass
def set_account_password(self, account, raw_password):
'''Account's password was changed.'''
pass
def set_account_username(self, account, old_username, new_username):
'''Account's username was changed.'''
pass
def add_account_to_group(self, account, group):
'''Add account to group.'''
pass
def remove_account_from_group(self, account, group):
'''Remove account from group.'''
pass
def add_account_to_project(self, account, project):
'''Add account to project.'''
pass
def remove_account_from_project(self, account, project):
'''Remove account from project.'''
pass
def add_account_to_institute(self, account, institute):
'''Add account to institute.'''
pass
def remove_account_from_institute(self, account, institute):
'''Remove account from institute.'''
pass
def account_exists(self, username):
'''Does the account exist?'''
pass
def get_account_details(self, account):
'''Get the account details'''
pass
def save_group(self, group):
'''Group was saved.'''
pass
def delete_group(self, group):
'''Group was deleted.'''
pass
def set_group_name(self, group, old_name, new_name):
'''Group was renamed.'''
pass
def get_group_details(self, group):
'''Get the group details.'''
pass
def save_project(self, project):
'''Project was saved.'''
pass
def delete_project(self, project):
'''Project was deleted.'''
pass
def get_project_details(self, project):
'''Get project's details.'''
pass
def set_project_pid(self, project, old_pid, new_pid):
'''Project's pid was changed.'''
pass
def save_institute(self, institute):
'''Institute was saved.'''
pass
def delete_institute(self, institute):
'''Institute was deleted.'''
pass
def get_institute_details(self, institute):
'''Get institute's details.'''
pass
| 25 | 24 | 3 | 0 | 2 | 1 | 1 | 0.73 | 1 | 0 | 0 | 4 | 24 | 1 | 24 | 24 | 113 | 28 | 49 | 26 | 24 | 36 | 49 | 26 | 24 | 1 | 1 | 0 | 24 |
141,964 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/dummy.py
|
karaage.datastores.dummy.DataStore
|
class DataStore(base.DataStore):
"""LDAP Account and group datastore."""
def __init__(self, config):
super(DataStore, self).__init__(config)
self.value = config.get("value", "Metrotrains forgot")
def get_account_details(self, account):
"""Get the account details."""
return {
"type": "account",
"answer": "42",
"value": self.value,
}
def account_exists(self, username):
"""Does the account exist?"""
return False
def get_group_details(self, group):
"""Get the group details."""
return {
"type": "group",
"answer": "42",
"value": self.value,
}
def get_project_details(self, project):
"""Get project's details."""
return {
"type": "project",
"answer": "42",
"value": self.value,
}
def get_institute_details(self, institute):
"""Get institute's details."""
return {
"type": "institute",
"answer": "42",
"value": self.value,
}
|
class DataStore(base.DataStore):
'''LDAP Account and group datastore.'''
def __init__(self, config):
pass
def get_account_details(self, account):
'''Get the account details.'''
pass
def account_exists(self, username):
'''Does the account exist?'''
pass
def get_group_details(self, group):
'''Get the group details.'''
pass
def get_project_details(self, project):
'''Get project's details.'''
pass
def get_institute_details(self, institute):
'''Get institute's details.'''
pass
| 7 | 6 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 1 | 0 | 0 | 6 | 1 | 6 | 30 | 42 | 6 | 30 | 8 | 23 | 6 | 14 | 8 | 7 | 1 | 2 | 0 | 6 |
141,965 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/ldap.py
|
karaage.datastores.ldap.DataStore
|
class DataStore(base.DataStore):
"""LDAP Account and group datastore."""
def __init__(self, config: dict) -> None:
super(DataStore, self).__init__(config)
using = config["LDAP"]
connection = tldap.backend.connections[using]
self._database = Database(connection, config)
self._account_class = _lookup(config["ACCOUNT"])
self._group_class = _lookup(config["GROUP"])
self._primary_group = config.get("PRIMARY_GROUP", "institute")
self._default_primary_group = config.get("DEFAULT_PRIMARY_GROUP", "dummy")
self._settings = config
def _get_account(self, uid: str) -> LdapObject:
return get_one(
table=self._account_class,
query=Q(uid=uid),
database=self._database,
)
def _get_group(self, cn: str) -> LdapObject:
return get_one(
table=self._group_class,
query=Q(cn=cn),
database=self._database,
)
def save_account(self, account: Account) -> None:
"""Account was saved."""
person = account.person
if self._primary_group == "institute":
lgroup = self._get_group(person.institute.group.name)
elif self._primary_group == "default_project":
if account.default_project is None:
lgroup = self._get_group(self._default_primary_group)
else:
lgroup = self._get_group(account.default_project.group.name)
else:
raise RuntimeError("Unknown value of PRIMARY_GROUP.")
if account.default_project is None:
default_project = "none"
else:
default_project = account.default_project.pid
try:
luser = self._get_account(account.username)
changes = changeset(luser, {})
new_user = False
except ObjectDoesNotExist:
new_user = True
luser = self._account_class()
changes = changeset(luser, {"uid": account.username})
changes = changes.merge(
{
"gidNumber": lgroup["gidNumber"],
"givenName": person.first_name,
"sn": person.last_name,
"telephoneNumber": _str_or_none(person.telephone),
"mail": _str_or_none(person.email),
"title": _str_or_none(person.title),
"o": person.institute.name,
"cn": person.full_name,
"default_project": default_project,
"loginShell": account.shell,
"locked": account.is_locked(),
}
)
save(changes, database=self._database)
if new_user:
# add all groups
for group in account.person.groups.all():
self.add_account_to_group(account, group)
def delete_account(self, account):
"""Account was deleted."""
try:
luser = self._get_account(account.username)
groups = luser["groups"].load(database=self._database)
for group in groups:
changes = changeset(group, {})
changes = group.remove_member(changes, luser)
save(changes, database=self._database)
delete(luser, database=self._database)
except ObjectDoesNotExist:
# it doesn't matter if it doesn't exist
pass
def set_account_password(self, account, raw_password):
"""Account's password was changed."""
luser = self._get_account(account.username)
changes = changeset(
luser,
{
"password": raw_password,
},
)
save(changes, database=self._database)
def set_account_username(self, account, old_username, new_username):
"""Account's username was changed."""
luser = self._get_account(old_username)
rename(luser, database=self._database, uid=new_username)
def add_account_to_group(self, account, group):
"""Add account to group."""
lgroup: OpenldapGroup = self._get_group(group.name)
person: OpenldapAccount = self._get_account(account.username)
changes = changeset(lgroup, {})
changes = lgroup.add_member(changes, person)
save(changes, database=self._database)
def remove_account_from_group(self, account, group):
"""Remove account from group."""
lgroup: OpenldapGroup = self._get_group(group.name)
person: OpenldapAccount = self._get_account(account.username)
changes = changeset(lgroup, {})
changes = lgroup.remove_member(changes, person)
save(changes, database=self._database)
def get_account_details(self, account):
"""Get the account details."""
result = {}
try:
luser = self._get_account(account.username)
luser = preload(luser, database=self._database)
except ObjectDoesNotExist:
return result
for i, j in luser.items():
if i != "userPassword" and j is not None:
result[i] = j
return result
def account_exists(self, username):
"""Does the account exist?"""
try:
self._get_account(username)
return True
except ObjectDoesNotExist:
return False
def save_group(self, group):
"""Group was saved."""
# If group already exists, take over existing group rather then error.
try:
lgroup = self._get_group(group.name)
changes = changeset(lgroup, {})
except ObjectDoesNotExist:
lgroup = self._group_class()
changes = changeset(
lgroup,
{
"cn": group.name,
},
)
changes = changes.merge({"description": group.description})
save(changes, database=self._database)
def delete_group(self, group):
"""Group was deleted."""
try:
lgroup = self._get_group(group.name)
delete(lgroup, database=self._database)
except ObjectDoesNotExist:
# it doesn't matter if it doesn't exist
pass
def set_group_name(self, group, old_name, new_name):
"""Group was renamed."""
lgroup = self._get_group(old_name)
rename(lgroup, database=self._database, cn=new_name)
def get_group_details(self, group):
"""Get the group details."""
result = {}
try:
lgroup = self._get_group(group.name)
lgroup = preload(lgroup, database=self._database)
except ObjectDoesNotExist:
return result
for i, j in lgroup.items():
if j is not None:
result[i] = j
return result
|
class DataStore(base.DataStore):
'''LDAP Account and group datastore.'''
def __init__(self, config: dict) -> None:
pass
def _get_account(self, uid: str) -> LdapObject:
pass
def _get_group(self, cn: str) -> LdapObject:
pass
def save_account(self, account: Account) -> None:
'''Account was saved.'''
pass
def delete_account(self, account):
'''Account was deleted.'''
pass
def set_account_password(self, account, raw_password):
'''Account's password was changed.'''
pass
def set_account_username(self, account, old_username, new_username):
'''Account's username was changed.'''
pass
def add_account_to_group(self, account, group):
'''Add account to group.'''
pass
def remove_account_from_group(self, account, group):
'''Remove account from group.'''
pass
def get_account_details(self, account):
'''Get the account details.'''
pass
def account_exists(self, username):
'''Does the account exist?'''
pass
def save_group(self, group):
'''Group was saved.'''
pass
def delete_group(self, group):
'''Group was deleted.'''
pass
def set_group_name(self, group, old_name, new_name):
'''Group was renamed.'''
pass
def get_group_details(self, group):
'''Get the group details.'''
pass
| 16 | 13 | 12 | 1 | 10 | 1 | 2 | 0.11 | 1 | 7 | 3 | 0 | 15 | 6 | 15 | 39 | 197 | 29 | 151 | 54 | 135 | 17 | 115 | 54 | 99 | 8 | 2 | 2 | 33 |
141,966 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/ldap_schemas.py
|
karaage.datastores.ldap_schemas.BaseAccount
|
class BaseAccount(LdapObject):
"""An abstract Generic LDAP account."""
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
fields = {
**helpers.get_fields_common(),
**helpers.get_fields_person(),
**helpers.get_fields_account(),
**helpers.get_fields_shadow(),
"default_project": tldap.fields.FakeField(required=True),
}
return fields
@classmethod
def get_search_options(cls, database: Database) -> SearchOptions:
settings = database.settings
return SearchOptions(
base_dn=settings["LDAP_ACCOUNT_BASE"],
object_class={"inetOrgPerson", "organizationalPerson", "person"},
pk_field="uid",
)
@classmethod
def on_load(cls, python_data: LdapObject, _database: Database) -> LdapObject:
python_data = helpers.load_person(python_data, OpenldapGroup)
python_data = helpers.load_account(python_data, OpenldapGroup)
python_data = helpers.load_shadow(python_data)
return python_data
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
settings = database.settings
changes = helpers.save_person(changes, database)
changes = helpers.save_account(changes, database, {"uid", "cn", "givenName", "sn", "o", "default_project"})
changes = helpers.save_shadow(changes)
changes = helpers.rdn_to_dn(changes, "uid", settings["LDAP_ACCOUNT_BASE"])
return changes
def __repr__(self):
return f"user:{self['uid'][0]}"
|
class BaseAccount(LdapObject):
'''An abstract Generic LDAP account.'''
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
pass
@classmethod
def get_search_options(cls, database: Database) -> SearchOptions:
pass
@classmethod
def on_load(cls, python_data: LdapObject, _database: Database) -> LdapObject:
pass
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
pass
def __repr__(self):
pass
| 10 | 1 | 6 | 0 | 6 | 0 | 1 | 0.03 | 1 | 2 | 1 | 2 | 1 | 0 | 5 | 5 | 41 | 5 | 35 | 13 | 25 | 1 | 21 | 9 | 15 | 1 | 1 | 0 | 5 |
141,967 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/ldap_schemas.py
|
karaage.datastores.ldap_schemas.BaseGroup
|
class BaseGroup(LdapObject):
"""An abstract generic LDAP Group."""
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
fields = {
**helpers.get_fields_common(),
**helpers.get_fields_group(),
}
return fields
@classmethod
def get_search_options(cls, database: Database) -> SearchOptions:
settings = database.settings
return SearchOptions(
base_dn=settings["LDAP_GROUP_BASE"],
object_class={"posixGroup"},
pk_field="cn",
)
@classmethod
def on_load(cls, python_data: LdapObject, _database: Database) -> LdapObject:
return python_data
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
settings = database.settings
changes = helpers.save_group(changes)
changes = helpers.set_object_class(changes, ["top", "posixGroup"])
changes = helpers.rdn_to_dn(changes, "cn", settings["LDAP_GROUP_BASE"])
return changes
@classmethod
def add_member(cls, changes: Changeset, member: BaseAccount) -> Changeset:
return helpers.add_group_member(changes, member)
@classmethod
def remove_member(cls, changes: Changeset, member: BaseAccount) -> Changeset:
return helpers.remove_group_member(changes, member)
def __repr__(self):
return f"group:{self['cn'][0]}"
|
class BaseGroup(LdapObject):
'''An abstract generic LDAP Group.'''
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
pass
@classmethod
def get_search_options(cls, database: Database) -> SearchOptions:
pass
@classmethod
def on_load(cls, python_data: LdapObject, _database: Database) -> LdapObject:
pass
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
pass
@classmethod
def add_member(cls, changes: Changeset, member: BaseAccount) -> Changeset:
pass
@classmethod
def remove_member(cls, changes: Changeset, member: BaseAccount) -> Changeset:
pass
def __repr__(self):
pass
| 14 | 1 | 4 | 0 | 4 | 0 | 1 | 0.03 | 1 | 2 | 1 | 2 | 1 | 0 | 7 | 7 | 42 | 7 | 34 | 17 | 20 | 1 | 21 | 11 | 13 | 1 | 1 | 0 | 7 |
141,968 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/datastores/ldap_schemas.py
|
karaage.datastores.ldap_schemas.Ds389Account
|
class Ds389Account(BaseAccount):
"""A DS389 specific account with the password object schema."""
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
fields = {
**BaseAccount.get_fields(),
**helpers.get_fields_password_object(),
}
return fields
@classmethod
def on_load(cls, python_data: LdapObject, database: Database) -> LdapObject:
python_data = BaseAccount.on_load(python_data, database)
python_data = helpers.load_password_object(python_data)
return python_data
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
changes = BaseAccount.on_save(changes, database)
changes = dhelpers.save_account(changes, Ds389Account, database)
changes = helpers.save_password_object(changes)
changes = helpers.set_object_class(
changes,
[
"top",
"person",
"inetOrgPerson",
"organizationalPerson",
"shadowAccount",
"posixAccount",
"passwordObject",
],
)
return changes
|
class Ds389Account(BaseAccount):
'''A DS389 specific account with the password object schema.'''
@classmethod
def get_fields(cls) -> Dict[str, tldap.fields.Field]:
pass
@classmethod
def on_load(cls, python_data: LdapObject, database: Database) -> LdapObject:
pass
@classmethod
def on_save(cls, changes: Changeset, database: Database) -> Changeset:
pass
| 7 | 1 | 9 | 0 | 9 | 0 | 1 | 0.03 | 1 | 1 | 0 | 0 | 0 | 0 | 3 | 8 | 35 | 3 | 31 | 8 | 24 | 1 | 14 | 5 | 10 | 1 | 2 | 0 | 3 |
141,969 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/common/tables.py
|
karaage.common.tables.LogEntryTable
|
class LogEntryTable(tables.Table):
user = tables.LinkColumn("kg_person_detail", args=[A("user__username")])
content_object = tables.Column(linkify=True, verbose_name="Object", order_by=["content_type", "object_id"])
def render_action_flag(self, record):
if record.is_addition():
html = '<span class="addlink">Add</span>'
elif record.is_change():
html = '<span class="changelink">Change</span>'
elif record.is_deletion():
html = '<span class="deletelink">Delete</span>'
elif record.is_comment():
html = '<span class="commentlink">Comment</span>'
else:
html = "-"
return mark_safe(html)
class Meta:
model = LogEntry
fields = ("action_time", "user", "obj", "action_flag", "change_message")
empty_text = "No items"
|
class LogEntryTable(tables.Table):
def render_action_flag(self, record):
pass
class Meta:
| 3 | 0 | 12 | 0 | 12 | 0 | 5 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 21 | 2 | 19 | 9 | 16 | 0 | 15 | 9 | 12 | 5 | 1 | 1 | 5 |
141,970 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0002_auto_20140924_1111.py
|
karaage.migrations.0002_auto_20140924_1111.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="logentry",
name="content_type",
field=models.ForeignKey(to="contenttypes.ContentType", on_delete=models.CASCADE),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,971 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0003_auto_20150410_1032.py
|
karaage.migrations.0003_auto_20150410_1032.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0002_auto_20140924_1111"),
]
operations = [
migrations.AlterField(
model_name="machine",
name="last_login",
field=models.DateTimeField(null=True, verbose_name="last login", blank=True),
),
migrations.AlterField(
model_name="person",
name="email",
field=models.EmailField(max_length=254, null=True, db_index=True),
),
migrations.AlterField(
model_name="person",
name="last_login",
field=models.DateTimeField(null=True, verbose_name="last login", blank=True),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 1 | 21 | 3 | 20 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,972 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0004_auto_20160429_0927.py
|
karaage.migrations.0004_auto_20160429_0927.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0003_auto_20150410_1032"),
]
operations = [
migrations.AlterField(
model_name="institute",
name="delegates",
field=models.ManyToManyField(
blank=True,
related_name="delegate_for",
through="karaage.InstituteDelegate",
to=settings.AUTH_USER_MODEL,
),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 16 | 3 | 15 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,973 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/tables.py
|
karaage.people.tables.PersonTable
|
class PersonTable(tables.Table):
active = tables.Column(empty_values=(), order_by=("date_deleted", "-login_enabled"))
username = tables.LinkColumn("kg_person_detail", args=[A("username")])
institute = tables.LinkColumn("kg_institute_detail", args=[A("institute__pk")])
def render_active(self, record):
if record.date_deleted is not None:
html = '<span class="no">Deleted</span>'
elif not record.login_enabled:
html = '<span class="locked">Locked</span>'
else:
html = '<span class="yes">Yes</span>'
return mark_safe(html)
class Meta:
model = Person
fields = ("active", "username", "full_name", "institute", "is_admin", "last_usage", "date_approved")
empty_text = "No items"
|
class PersonTable(tables.Table):
def render_active(self, record):
pass
class Meta:
| 3 | 0 | 8 | 0 | 8 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 18 | 2 | 16 | 10 | 13 | 0 | 14 | 10 | 11 | 3 | 1 | 1 | 3 |
141,974 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/utils.py
|
karaage.people.utils.UsernameException
|
class UsernameException(Exception):
pass
|
class UsernameException(Exception):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 10 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
141,975 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/utils.py
|
karaage.people.utils.UsernameInvalid
|
class UsernameInvalid(UsernameException):
pass
|
class UsernameInvalid(UsernameException):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
141,976 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/utils.py
|
karaage.people.utils.UsernameTaken
|
class UsernameTaken(UsernameException):
pass
|
class UsernameTaken(UsernameException):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
141,977 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/views/persons.py
|
karaage.people.views.persons.PasswordResetCompleteView
|
class PasswordResetCompleteView(views.PasswordResetCompleteView):
template_name = "karaage/people/person_reset_complete.html"
|
class PasswordResetCompleteView(views.PasswordResetCompleteView):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
141,978 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/views/persons.py
|
karaage.people.views.persons.PasswordResetConfirmView
|
class PasswordResetConfirmView(views.PasswordResetConfirmView):
form_class = SetPasswordForm
template_name = "karaage/people/person_reset_confirm.html"
|
class PasswordResetConfirmView(views.PasswordResetConfirmView):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,979 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/__init__.py
|
karaage.plugins.BasePlugin
|
class BasePlugin(parent):
name = None
django_apps = ()
depends = ()
settings = {}
template_context_processors = ()
|
class BasePlugin(parent):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 6 | 5 | 0 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
141,980 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.AafApplicantForm
|
class AafApplicantForm(UserApplicantForm):
def __init__(self, *args, **kwargs):
super(AafApplicantForm, self).__init__(*args, **kwargs)
del self.fields["institute"]
class Meta:
model = Applicant
exclude = ["email", "institute"]
|
class AafApplicantForm(UserApplicantForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 7 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 3 | 0 | 1 |
141,981 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.ApplicantForm
|
class ApplicantForm(forms.ModelForm):
username = forms.RegexField(
"^%s$" % settings.USERNAME_VALIDATION_RE,
label=six.u("Requested username"),
max_length=settings.USERNAME_MAX_LENGTH,
help_text=(
settings.USERNAME_VALIDATION_ERROR_MSG + " and has a max length of %s." % settings.USERNAME_MAX_LENGTH
),
)
telephone = forms.CharField(
required=True,
label=six.u("Office Telephone"),
help_text=six.u("Used for emergency contact and password reset service."),
validators=[validate_phone_number],
)
mobile = forms.CharField(
required=False,
validators=[validate_phone_number],
)
fax = forms.CharField(
required=False,
validators=[validate_phone_number],
)
class Meta:
model = Applicant
fields = [
"email",
"username",
"title",
"short_name",
"full_name",
"institute",
"department",
"position",
"telephone",
"mobile",
"supervisor",
"address",
"city",
"postcode",
"country",
"fax",
]
def clean(self):
data = super(ApplicantForm, self).clean()
for key in [
"short_name",
"full_name",
"email",
"position",
"supervisor",
"department",
"telephone",
"mobile",
"fax",
"address",
"city",
"postcode",
]:
if key in data and data[key]:
data[key] = data[key].strip()
return data
def __init__(self, *args, **kwargs):
super(ApplicantForm, self).__init__(*args, **kwargs)
self.fields["title"].required = True
self.fields["short_name"].required = True
self.fields["short_name"].help_text = "This is typically your given name. For example enter 'Fred' here."
self.fields["full_name"].required = True
self.fields["full_name"].help_text = "This is typically your full name. For example enter 'Fred Smith' here."
self.fields["username"].label = "Requested username"
self.fields["username"].required = True
self.fields["institute"].required = True
self.fields["institute"].help_text = (
"If your institute is not listed please contact %s" % settings.ACCOUNTS_EMAIL
)
self.fields["department"].required = True
def clean_username(self):
username = self.cleaned_data["username"]
if username:
try:
validate_username_for_new_person(username)
except UsernameException as e:
raise forms.ValidationError(e.args[0])
return username
def clean_email(self):
email = self.cleaned_data["email"]
users = Person.objects.filter(email__exact=email)
if users.count() > 0:
raise forms.ValidationError(
six.u("An account with this email already exists. Please email %s") % settings.ACCOUNTS_EMAIL
)
clean_email(email)
return email
|
class ApplicantForm(forms.ModelForm):
class Meta:
def clean(self):
pass
def __init__(self, *args, **kwargs):
pass
def clean_username(self):
pass
def clean_email(self):
pass
| 6 | 0 | 13 | 1 | 13 | 0 | 2 | 0 | 1 | 3 | 2 | 1 | 4 | 0 | 4 | 4 | 101 | 8 | 93 | 18 | 87 | 0 | 41 | 17 | 35 | 3 | 1 | 2 | 9 |
141,982 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.ApplicantReplace
|
class ApplicantReplace(forms.Form):
replace_applicant = ajax_select.fields.AutoCompleteSelectField(
"person", required=True, help_text="Do not set unless absolutely positive sure."
)
def __init__(self, application, *args, **kwargs):
self.application = application
super(ApplicantReplace, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
replace_applicant = self.cleaned_data["replace_applicant"]
if replace_applicant is not None:
self.application.new_applicant = None
self.application.existing_person = replace_applicant
self.application.save()
|
class ApplicantReplace(forms.Form):
def __init__(self, application, *args, **kwargs):
pass
def save(self, *args, **kwargs):
pass
| 3 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 15 | 2 | 13 | 6 | 10 | 0 | 11 | 6 | 8 | 2 | 1 | 1 | 3 |
141,983 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/tables.py
|
karaage.people.tables.PeopleColumn
|
class PeopleColumn(tables.Column):
def render_link(self, uri, value, attrs=None):
attrs = AttributeDict(attrs if attrs is not None else self.attrs.get("a", {}))
attrs["href"] = uri
return format_html(
"<a {attrs}>{text}</a>",
attrs=attrs.as_html(),
text=value,
)
def render(self, value):
people = []
for person in value.all():
url = reverse("kg_person_detail", args=[person.username])
link = self.render_link(url, value=six.text_type(person))
people.append(link)
return mark_safe(", ".join(people))
|
class PeopleColumn(tables.Column):
def render_link(self, uri, value, attrs=None):
pass
def render_link(self, uri, value, attrs=None):
pass
| 3 | 0 | 8 | 1 | 8 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 18 | 2 | 16 | 7 | 13 | 0 | 12 | 7 | 9 | 2 | 1 | 1 | 4 |
141,984 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.CommonApplicationForm
|
class CommonApplicationForm(forms.ModelForm):
aup = forms.BooleanField(error_messages={"required": "You must accept to proceed."})
application_type = forms.ChoiceField(choices=APP_CHOICES, widget=forms.RadioSelect())
def __init__(self, *args, **kwargs):
super(CommonApplicationForm, self).__init__(*args, **kwargs)
aup_url = getattr(settings, "AUP_URL", None)
if aup_url is None:
aup_url = reverse("kg_aup")
self.fields["aup"].label = mark_safe(
six.u("I have read and agree to the " '<a href="%s" target="_blank">Acceptable Use Policy</a>') % aup_url
)
class Meta:
model = ProjectApplication
fields = ["needs_account"]
|
class CommonApplicationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
| 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 16 | 2 | 14 | 8 | 11 | 0 | 12 | 8 | 9 | 2 | 1 | 1 | 2 |
141,985 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.InviteUserApplicationForm
|
class InviteUserApplicationForm(forms.ModelForm):
email = forms.EmailField()
def __init__(self, *args, **kwargs):
self.cleaned_data = None
self.fields = None
super(InviteUserApplicationForm, self).__init__(*args, **kwargs)
self.fields["email"].required = True
self.fields["header_message"].required = True
class Meta:
model = ProjectApplication
fields = ["email", "make_leader", "header_message"]
def clean_email(self):
email = self.cleaned_data["email"]
clean_email(email)
return email
|
class InviteUserApplicationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
def clean_email(self):
pass
| 4 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 2 | 18 | 3 | 15 | 10 | 11 | 0 | 15 | 10 | 11 | 1 | 1 | 0 | 2 |
141,986 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.NewProjectApplicationForm
|
class NewProjectApplicationForm(forms.ModelForm):
name = forms.CharField(label="Project Title", widget=forms.TextInput(attrs={"size": 60}))
description = forms.CharField(
max_length=1000, widget=forms.Textarea(attrs={"class": "vLargeTextField", "rows": 10, "cols": 40})
)
additional_req = forms.CharField(
label="Additional requirements",
widget=forms.Textarea(attrs={"class": "vLargeTextField", "rows": 10, "cols": 40}),
help_text=six.u("Do you have any special requirements?"),
required=False,
)
rcao = forms.EmailField(required=True)
def __init__(self, *args, **kwargs):
super(NewProjectApplicationForm, self).__init__(*args, **kwargs)
class Meta:
model = ProjectApplication
fields = [
"name",
"description",
"additional_req",
"rcao",
]
|
class NewProjectApplicationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
| 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 24 | 2 | 22 | 9 | 19 | 0 | 10 | 9 | 7 | 1 | 1 | 0 | 1 |
141,987 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.PersonSetPassword
|
class PersonSetPassword(forms.Form):
"""
A form that lets a user change set his/her password without entering the
old password
"""
new_password1 = forms.CharField(label=six.u("New password"), widget=forms.PasswordInput)
new_password2 = forms.CharField(label=six.u("New password confirmation"), widget=forms.PasswordInput)
def __init__(self, person, *args, **kwargs):
self.person = person
super(PersonSetPassword, self).__init__(*args, **kwargs)
def clean_new_password2(self):
password1 = self.cleaned_data.get("new_password1")
password2 = self.cleaned_data.get("new_password2")
return validate_password(self.person.username, password1, password2)
def save(self, commit=True):
self.person.set_password(self.cleaned_data["new_password1"])
if commit:
self.person.save()
return self.person
|
class PersonSetPassword(forms.Form):
'''
A form that lets a user change set his/her password without entering the
old password
'''
def __init__(self, person, *args, **kwargs):
pass
def clean_new_password2(self):
pass
def save(self, commit=True):
pass
| 4 | 1 | 4 | 0 | 4 | 0 | 1 | 0.27 | 1 | 1 | 0 | 0 | 3 | 1 | 3 | 3 | 23 | 4 | 15 | 9 | 11 | 4 | 15 | 9 | 11 | 2 | 1 | 1 | 4 |
141,988 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.PersonVerifyPassword
|
class PersonVerifyPassword(forms.Form):
"""
A form that lets a user verify his old password and updates it on all
datastores.
"""
password = forms.CharField(label="Existing password", widget=forms.PasswordInput)
def __init__(self, person, *args, **kwargs):
self.person = person
super(PersonVerifyPassword, self).__init__(*args, **kwargs)
def clean_password(self):
password = self.cleaned_data["password"]
person = Person.objects.authenticate(username=self.person.username, password=password)
if person is None:
raise forms.ValidationError(six.u("Password is incorrect."))
assert person == self.person
if not person.is_active or person.is_locked():
raise forms.ValidationError(six.u("Person is locked."))
return password
def save(self, commit=True):
password = self.cleaned_data["password"]
self.person.set_password(password)
if commit:
self.person.save()
return self.person
|
class PersonVerifyPassword(forms.Form):
'''
A form that lets a user verify his old password and updates it on all
datastores.
'''
def __init__(self, person, *args, **kwargs):
pass
def clean_password(self):
pass
def save(self, commit=True):
pass
| 4 | 1 | 7 | 1 | 6 | 0 | 2 | 0.2 | 1 | 2 | 1 | 0 | 3 | 1 | 3 | 3 | 32 | 8 | 20 | 9 | 16 | 4 | 20 | 9 | 16 | 3 | 1 | 1 | 6 |
141,989 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.StartApplicationForm
|
class StartApplicationForm(forms.Form):
application_type = forms.ChoiceField(choices=APP_CHOICES, widget=forms.RadioSelect())
|
class StartApplicationForm(forms.Form):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
141,990 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/tests/client.py
|
karaage.tests.client.LocaleRegexURLResolver
|
class LocaleRegexURLResolver: # type: ignore
pass
|
class LocaleRegexURLResolver:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
141,991 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.UnauthenticatedInviteUserApplicationForm
|
class UnauthenticatedInviteUserApplicationForm(forms.Form):
email = forms.EmailField()
captcha = CaptchaField(
label=six.u("CAPTCHA"), help_text=six.u("Please enter the text displayed in the image above.")
)
def clean_email(self):
email = self.cleaned_data["email"]
query = Person.active.filter(email=email)
if query.count() > 0:
raise forms.ValidationError(
six.u("E-Mail address is already in use. If you already have an account, please login.")
)
clean_email(email)
return email
|
class UnauthenticatedInviteUserApplicationForm(forms.Form):
def clean_email(self):
pass
| 2 | 0 | 11 | 2 | 9 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 17 | 3 | 14 | 6 | 12 | 0 | 10 | 6 | 8 | 2 | 1 | 1 | 2 |
141,992 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.UserApplicantForm
|
class UserApplicantForm(ApplicantForm):
institute = forms.ModelChoiceField(queryset=None, required=True)
def __init__(self, *args, **kwargs):
super(UserApplicantForm, self).__init__(*args, **kwargs)
self.fields["institute"].queryset = Institute.active.filter(Q(saml_entityid="") | Q(saml_entityid__isnull=True))
def save(self, commit=True):
applicant = super(UserApplicantForm, self).save(commit=commit)
if commit:
applicant.save()
return applicant
class Meta:
model = Applicant
exclude = ["email"]
|
class UserApplicantForm(ApplicantForm):
def __init__(self, *args, **kwargs):
pass
def save(self, commit=True):
pass
class Meta:
| 4 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 2 | 1 | 1 | 2 | 0 | 2 | 6 | 16 | 3 | 13 | 8 | 9 | 0 | 13 | 8 | 9 | 2 | 2 | 1 | 3 |
141,993 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/migrations/0001_initial.py
|
karaage.plugins.kgapplications.migrations.0001_initial.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0001_initial"),
("contenttypes", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Applicant",
fields=[
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
("email", models.EmailField(unique=True, max_length=75)),
("email_verified", models.BooleanField(default=False, editable=False)),
("username", models.CharField(max_length=255, unique=True, null=True, blank=True)),
(
"title",
models.CharField(
blank=True,
max_length=10,
null=True,
choices=[
("", ""),
("Mr", "Mr"),
("Mrs", "Mrs"),
("Miss", "Miss"),
("Ms", "Ms"),
("Dr", "Dr"),
("Prof", "Prof"),
("A/Prof", "A/Prof"),
],
),
),
("short_name", models.CharField(max_length=30)),
("full_name", models.CharField(max_length=60)),
("department", models.CharField(max_length=200, null=True, blank=True)),
("position", models.CharField(max_length=200, null=True, blank=True)),
("telephone", models.CharField(max_length=200, null=True, verbose_name="Office Telephone", blank=True)),
("mobile", models.CharField(max_length=200, null=True, blank=True)),
("supervisor", models.CharField(max_length=100, null=True, blank=True)),
("address", models.CharField(max_length=200, null=True, blank=True)),
("city", models.CharField(max_length=100, null=True, blank=True)),
("postcode", models.CharField(max_length=8, null=True, blank=True)),
(
"country",
models.CharField(
blank=True,
max_length=2,
null=True,
choices=[
("AU", "Australia"),
("NZ", "New Zealand"),
("GB", "United Kingdom"),
("DE", "Germany"),
("US", "United States"),
("", "--------------------------------------"),
("AD", "Andorra"),
("AE", "United Arab Emirates"),
("AF", "Afghanistan"),
("AG", "Antigua and Barbuda"),
("AI", "Anguilla"),
("AL", "Albania"),
("AM", "Armenia"),
("AN", "Netherlands Antilles"),
("AO", "Angola"),
("AQ", "Antarctica"),
("AR", "Argentina"),
("AS", "American Samoa"),
("AT", "Austria"),
("AW", "Aruba"),
("AX", "Aland Islands"),
("AZ", "Azerbaijan"),
("BA", "Bosnia and Herzegovina"),
("BB", "Barbados"),
("BD", "Bangladesh"),
("BE", "Belgium"),
("BF", "Burkina Faso"),
("BG", "Bulgaria"),
("BH", "Bahrain"),
("BI", "Burundi"),
("BJ", "Benin"),
("BM", "Bermuda"),
("BN", "Brunei Darussalam"),
("BO", "Bolivia"),
("BR", "Brazil"),
("BS", "Bahamas"),
("BT", "Bhutan"),
("BV", "Bouvet Island"),
("BW", "Botswana"),
("BY", "Belarus"),
("BZ", "Belize"),
("CA", "Canada"),
("CC", "Cocos (Keeling) Islands"),
("CD", "Congo"),
("CF", "Central African Republic"),
("CG", "Congo"),
("CH", "Switzerland"),
("CI", "Cote d'Ivoire"),
("CK", "Cook Islands"),
("CL", "Chile"),
("CM", "Cameroon"),
("CN", "China"),
("CO", "Colombia"),
("CR", "Costa Rica"),
("CU", "Cuba"),
("CV", "Cape Verde"),
("CX", "Christmas Island"),
("CY", "Cyprus"),
("CZ", "Czech Republic"),
("DJ", "Djibouti"),
("DK", "Denmark"),
("DM", "Dominica"),
("DO", "Dominican Republic"),
("DZ", "Algeria"),
("EC", "Ecuador"),
("EE", "Estonia"),
("EG", "Egypt"),
("EH", "Western Sahara"),
("ER", "Eritrea"),
("ES", "Spain"),
("ET", "Ethiopia"),
("FI", "Finland"),
("FJ", "Fiji"),
("FK", "Falkland Islands"),
("FM", "Micronesia"),
("FO", "Faroe Islands"),
("FR", "France"),
("GA", "Gabon"),
("GD", "Grenada"),
("GE", "Georgia"),
("GF", "French Guiana"),
("GG", "Guernsey"),
("GH", "Ghana"),
("GI", "Gibraltar"),
("GL", "Greenland"),
("GM", "Gambia"),
("GN", "Guinea"),
("GP", "Guadeloupe"),
("GQ", "Equatorial Guinea"),
("GR", "Greece"),
("GS", "South Georgia and the South Sandwich Islands"),
("GT", "Guatemala"),
("GU", "Guam"),
("GW", "Guinea-Bissau"),
("GY", "Guyana"),
("HK", "Hong Kong"),
("HM", "Heard Island and McDonald Islands"),
("HN", "Honduras"),
("HR", "Croatia"),
("HT", "Haiti"),
("HU", "Hungary"),
("ID", "Indonesia"),
("IE", "Ireland"),
("IL", "Israel"),
("IM", "Isle of Man"),
("IN", "India"),
("IO", "British Indian Ocean Territory"),
("IQ", "Iraq"),
("IR", "Iran"),
("IS", "Iceland"),
("IT", "Italy"),
("JE", "Jersey"),
("JM", "Jamaica"),
("JO", "Jordan"),
("JP", "Japan"),
("KE", "Kenya"),
("KG", "Kyrgyzstan"),
("KH", "Cambodia"),
("KI", "Kiribati"),
("KM", "Comoros"),
("KN", "Saint Kitts and Nevis"),
("KP", "Korea"),
("KR", "Korea"),
("KW", "Kuwait"),
("KY", "Cayman Islands"),
("KZ", "Kazakhstan"),
("LA", "Lao People's Democratic Republic"),
("LB", "Lebanon"),
("LC", "Saint Lucia"),
("LI", "Liechtenstein"),
("LK", "Sri Lanka"),
("LR", "Liberia"),
("LS", "Lesotho"),
("LT", "Lithuania"),
("LU", "Luxembourg"),
("LV", "Latvia"),
("LY", "Libyan Arab Jamahiriya"),
("MA", "Morocco"),
("MC", "Monaco"),
("MD", "Moldova"),
("ME", "Montenegro"),
("MG", "Madagascar"),
("MH", "Marshall Islands"),
("MK", "Macedonia"),
("ML", "Mali"),
("MM", "Myanmar"),
("MN", "Mongolia"),
("MO", "Macao"),
("MP", "Northern Mariana Islands"),
("MQ", "Martinique"),
("MR", "Mauritania"),
("MS", "Montserrat"),
("MT", "Malta"),
("MU", "Mauritius"),
("MV", "Maldives"),
("MW", "Malawi"),
("MX", "Mexico"),
("MY", "Malaysia"),
("MZ", "Mozambique"),
("NA", "Namibia"),
("NC", "New Caledonia"),
("NE", "Niger"),
("NF", "Norfolk Island"),
("NG", "Nigeria"),
("NI", "Nicaragua"),
("NL", "Netherlands"),
("NO", "Norway"),
("NP", "Nepal"),
("NR", "Nauru"),
("NU", "Niue"),
("OM", "Oman"),
("PA", "Panama"),
("PE", "Peru"),
("PF", "French Polynesia"),
("PG", "Papua New Guinea"),
("PH", "Philippines"),
("PK", "Pakistan"),
("PL", "Poland"),
("PM", "Saint Pierre and Miquelon"),
("PN", "Pitcairn"),
("PR", "Puerto Rico"),
("PS", "Palestinian Territory"),
("PT", "Portugal"),
("PW", "Palau"),
("PY", "Paraguay"),
("QA", "Qatar"),
("RE", "Reunion"),
("RO", "Romania"),
("RS", "Serbia"),
("RU", "Russian Federation"),
("RW", "Rwanda"),
("SA", "Saudi Arabia"),
("SB", "Solomon Islands"),
("SC", "Seychelles"),
("SD", "Sudan"),
("SE", "Sweden"),
("SG", "Singapore"),
("SH", "Saint Helena"),
("SI", "Slovenia"),
("SJ", "Svalbard and Jan Mayen"),
("SK", "Slovakia"),
("SL", "Sierra Leone"),
("SM", "San Marino"),
("SN", "Senegal"),
("SO", "Somalia"),
("SR", "Suriname"),
("ST", "Sao Tome and Principe"),
("SV", "El Salvador"),
("SY", "Syrian Arab Republic"),
("SZ", "Swaziland"),
("TC", "Turks and Caicos Islands"),
("TD", "Chad"),
("TF", "French Southern Territories"),
("TG", "Togo"),
("TH", "Thailand"),
("TJ", "Tajikistan"),
("TK", "Tokelau"),
("TL", "Timor-Leste"),
("TM", "Turkmenistan"),
("TN", "Tunisia"),
("TO", "Tonga"),
("TR", "Turkey"),
("TT", "Trinidad and Tobago"),
("TV", "Tuvalu"),
("TW", "Taiwan"),
("TZ", "Tanzania"),
("UA", "Ukraine"),
("UG", "Uganda"),
("UM", "United States Minor Outlying Islands"),
("UY", "Uruguay"),
("UZ", "Uzbekistan"),
("VA", "Vatican City"),
("VC", "Saint Vincent and the Grenadines"),
("VE", "Venezuela"),
("VG", "Virgin Islands (British)"),
("VI", "Virgin Islands (US)"),
("VN", "Viet Nam"),
("VU", "Vanuatu"),
("WF", "Wallis and Futuna"),
("WS", "Samoa"),
("YE", "Yemen"),
("YT", "Mayotte"),
("ZA", "South Africa"),
("ZM", "Zambia"),
("ZW", "Zimbabwe"),
],
),
),
("fax", models.CharField(max_length=50, null=True, blank=True)),
("saml_id", models.CharField(max_length=200, unique=True, null=True, editable=False, blank=True)),
(
"institute",
models.ForeignKey(
blank=True,
to="karaage.Institute",
help_text="If your institute is not listed please contact accounts@example.com",
null=True,
on_delete=models.CASCADE,
),
),
],
options={
"db_table": "applications_applicant",
},
bases=(models.Model,),
),
migrations.CreateModel(
name="Application",
fields=[
("id", models.AutoField(verbose_name="ID", serialize=False, auto_created=True, primary_key=True)),
(
"secret_token",
models.CharField(
default=karaage.common.new_random_token, unique=True, max_length=64, editable=False
),
),
("expires", models.DateTimeField(editable=False)),
("created_date", models.DateTimeField(auto_now_add=True)),
("submitted_date", models.DateTimeField(null=True, blank=True)),
("state", models.CharField(max_length=5)),
("complete_date", models.DateTimeField(null=True, editable=False, blank=True)),
("object_id", models.PositiveIntegerField(null=True, blank=True)),
(
"header_message",
models.TextField(
help_text="Message displayed at top of application "
"form for the invitee and also in invitation email",
null=True,
verbose_name="Message",
blank=True,
),
),
("_class", models.CharField(max_length=100, editable=False)),
],
options={
"db_table": "applications_application",
},
bases=(models.Model,),
),
migrations.CreateModel(
name="ProjectApplication",
fields=[
(
"application_ptr",
models.OneToOneField(
parent_link=True,
auto_created=True,
primary_key=True,
serialize=False,
to="kgapplications.Application",
on_delete=models.CASCADE,
),
),
(
"needs_account",
models.BooleanField(
default=True,
help_text="Required if you will be working on the project yourself.",
verbose_name="Do you need a personal cluster account?",
),
),
("make_leader", models.BooleanField(default=False, help_text="Make this person a project leader")),
("name", models.CharField(max_length=200, verbose_name="Title")),
("description", models.TextField(null=True, blank=True)),
("additional_req", models.TextField(null=True, blank=True)),
("pid", models.CharField(max_length=50, null=True, blank=True)),
(
"institute",
models.ForeignKey(blank=True, to="karaage.Institute", null=True, on_delete=models.CASCADE),
),
("machine_categories", models.ManyToManyField(to="karaage.MachineCategory", null=True, blank=True)),
("project", models.ForeignKey(blank=True, to="karaage.Project", null=True, on_delete=models.CASCADE)),
],
options={
"db_table": "applications_projectapplication",
},
bases=("kgapplications.application",),
),
migrations.AddField(
model_name="application",
name="content_type",
field=models.ForeignKey(blank=True, to="contenttypes.ContentType", null=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name="application",
name="created_by",
field=models.ForeignKey(
blank=True, editable=False, to="karaage.Person", null=True, on_delete=models.CASCADE
),
preserve_default=True,
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 402 | 1 | 401 | 3 | 400 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,994 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/migrations/0002_auto_20161007_1821.py
|
karaage.plugins.kgapplications.migrations.0002_auto_20161007_1821.Migration
|
class Migration(migrations.Migration):
dependencies = [
("kgapplications", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="applicant",
name="email",
field=models.EmailField(max_length=254),
),
migrations.AlterField(
model_name="applicant",
name="username",
field=models.CharField(blank=True, max_length=255, null=True),
),
migrations.AlterField(
model_name="projectapplication",
name="machine_categories",
field=models.ManyToManyField(blank=True, to="karaage.MachineCategory"),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 1 | 21 | 3 | 20 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
141,995 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.ExistingProjectApplicationForm
|
class ExistingProjectApplicationForm(forms.ModelForm):
project = forms.ModelChoiceField(queryset=None)
def __init__(self, *args, **kwargs):
super(ExistingProjectApplicationForm, self).__init__(*args, **kwargs)
self.fields["project"].queryset = Project.active.all()
class Meta:
model = ProjectApplication
fields = ["project"]
|
class ExistingProjectApplicationForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 0 | 1 | 1 | 10 | 2 | 8 | 6 | 5 | 0 | 8 | 6 | 5 | 1 | 1 | 0 | 1 |
141,996 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/tables.py
|
karaage.people.tables.ActiveFilter
|
class ActiveFilter(django_filters.ChoiceFilter):
def __init__(self, *args, **kwargs):
choices = [
("", "Unknown"),
("deleted", "Deleted"),
("locked", "Locked"),
("yes", "Yes"),
]
super(ActiveFilter, self).__init__(*args, choices=choices, **kwargs)
def filter(self, qs, value):
if value == "deleted":
qs = qs.filter(date_deleted__isnull=False)
elif value == "locked":
qs = qs.filter(date_deleted__isnull=True, login_enabled=False)
elif value == "yes":
qs = qs.filter(date_deleted__isnull=True, login_enabled=True)
return qs
|
class ActiveFilter(django_filters.ChoiceFilter):
def __init__(self, *args, **kwargs):
pass
def filter(self, qs, value):
pass
| 3 | 0 | 9 | 1 | 8 | 0 | 3 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 20 | 3 | 17 | 4 | 14 | 0 | 10 | 4 | 7 | 4 | 1 | 1 | 5 |
141,997 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/models.py
|
karaage.people.models.Person
|
class Person(TrackingModelMixin, AbstractBaseUser):
username = models.CharField(max_length=255, unique=True)
email = models.EmailField(null=True, db_index=True)
short_name = models.CharField(max_length=100)
full_name = models.CharField(max_length=100)
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
saml_id = models.CharField(max_length=200, null=True, blank=True, unique=True, editable=False)
position = models.CharField(max_length=200, null=True, blank=True)
telephone = models.CharField(max_length=200, null=True, blank=True)
mobile = models.CharField(max_length=200, null=True, blank=True)
department = models.CharField(max_length=200, null=True, blank=True)
supervisor = models.CharField(max_length=100, null=True, blank=True)
institute = models.ForeignKey("karaage.Institute", on_delete=models.CASCADE)
title = models.CharField(choices=TITLES, max_length=10, null=True, blank=True)
address = models.CharField(max_length=200, null=True, blank=True)
city = models.CharField(max_length=100, null=True, blank=True)
postcode = models.CharField(max_length=8, null=True, blank=True)
state = models.CharField(choices=STATES, max_length=4, null=True, blank=True)
country = models.CharField(max_length=2, choices=COUNTRIES, null=True, blank=True)
website = models.URLField(null=True, blank=True)
fax = models.CharField(max_length=50, null=True, blank=True)
comment = models.TextField(null=True, blank=True)
approved_by = models.ForeignKey(
"self", related_name="user_approver", null=True, blank=True, on_delete=models.SET_NULL
)
deleted_by = models.ForeignKey(
"self", related_name="user_deletor", null=True, blank=True, on_delete=models.SET_NULL
)
date_approved = models.DateField(null=True, blank=True)
date_deleted = models.DateField(null=True, blank=True)
last_usage = models.DateField(null=True, blank=True)
expires = models.DateField(null=True, blank=True)
is_systemuser = models.BooleanField(default=False)
login_enabled = models.BooleanField(default=True)
legacy_ldap_password = models.CharField(max_length=128, null=True, blank=True)
objects = PersonManager()
active = ActivePersonManager()
deleted = DeletedPersonManager()
projectleaders = LeaderManager()
USERNAME_FIELD = "username"
REQUIRED_FIELDS = ["email", "short_name", "full_name", "institute"]
def __init__(self, *args, **kwargs):
super(Person, self).__init__(*args, **kwargs)
self._raw_password = None
class Meta:
verbose_name_plural = "people"
ordering = ["full_name", "short_name"]
db_table = "person"
app_label = "karaage"
def __str__(self):
name = self.get_full_name()
if not name:
name = "No Name"
return name
def get_absolute_url(self):
return reverse("kg_person_detail", kwargs={"username": self.username})
def save(self, *args, **kwargs):
created = self.pk is None
if created:
changed = {field: None for field in self.tracker.tracked_fields}
else:
changed = copy.deepcopy(self.tracker.changed)
# save the object
super(Person, self).save(*args, **kwargs)
if created:
log.add(self, "Created")
for field in changed.keys():
if field != "password":
log.change(self, "Changed %s to %s" % (field, getattr(self, field)))
# update datastores
from karaage.datastores import save_account
for ua in self.account_set.filter(date_deleted__isnull=True):
save_account(ua)
# has locked status changed?
if "login_enabled" in changed:
if self.login_enabled:
for ua in self.account_set.filter(date_deleted__isnull=True):
ua.unlock()
else:
for ua in self.account_set.filter(date_deleted__isnull=True):
ua.lock()
# has the institute changed?
if "institute_id" in changed:
from karaage.institutes.models import Institute
old_institute_pk = changed["institute_id"]
new_institute = self.institute
if old_institute_pk is not None:
old_institute = Institute.objects.get(pk=old_institute_pk)
from karaage.datastores import remove_accounts_from_institute
query = self.account_set
remove_accounts_from_institute(query, old_institute)
if new_institute is not None:
from karaage.datastores import add_accounts_to_institute
query = self.account_set
add_accounts_to_institute(query, new_institute)
if self._raw_password is not None:
for ua in self.account_set.filter(date_deleted__isnull=True):
ua.set_password(self._raw_password)
ua.save()
log.change(self, "Changed Password")
self._raw_password = None
save.alters_data = True
def delete(self, *args, **kwargs):
# delete the object
log.delete(self, "Deleted")
super(Person, self).delete(*args, **kwargs)
delete.alters_data = True
@property
def last_name(self):
if not self.full_name:
return None
elif self.full_name.find(" ") != -1:
_, _, last_name = self.full_name.rpartition(" ")
return last_name.strip()
else:
return self.full_name
@property
def first_name(self):
if not self.full_name:
return None
elif self.full_name.find(" ") != -1:
first_name, _, _ = self.full_name.rpartition(" ")
return first_name.strip()
else:
return self.full_name
def has_perm(self, perm, obj=None):
"""Does the user have a specific permission? (depreciated)"""
warnings.warn("Person.has_perm obsolete (get)", DeprecationWarning)
raise RuntimeError("Do not use")
def has_module_perms(self, app_label):
"""(depreciated)"""
warnings.warn("Person.has_module_perms obsolete (get)", DeprecationWarning)
raise RuntimeError("Do not use")
@property
def user(self):
"""(depreciated)"""
warnings.warn("Person.user obsolete (get)", DeprecationWarning)
raise RuntimeError("Do not use")
def get_profile(self):
"""(depreciated)"""
warnings.warn("Person.get_profile() obsolete (get)", DeprecationWarning)
raise RuntimeError("Do not use")
@property
def is_staff(self):
"""Is the user a member of staff? (depreciated)"""
warnings.warn("Person.has_module_perms obsolete (get)", DeprecationWarning)
raise RuntimeError("Do not use")
# Can person view this self record?
def can_view(self, request):
from karaage.projects.models import Project
person = request.user
if not person.is_authenticated:
return False
# ensure person making request isn't deleted.
if not person.is_active:
return False
# ensure person making request isn't locked.
if person.is_locked():
return False
# staff members can view everything
if is_admin(request):
return True
# we don't allow people to see inactive accounts.
if not self.is_active:
return False
# person can view own self
if self.id == person.id:
return True
# Institute delegate==person can view any member of institute
if self.institute.is_active:
if person in self.institute.delegates.all():
return True
# Institute delegate==person can view people in projects that are a
# member of institute
if Project.objects.filter(group__members=self.id).filter(institute__delegates=person):
return True
# person can view people in projects they belong to
tmp = Project.objects.filter(group__members=self.id).filter(group__members=person.id).filter(is_active=True)
if tmp.count() > 0:
return True
# Leader==person can view people in projects they lead
tmp = Project.objects.filter(group__members=self.id).filter(leaders=person.id).filter(is_active=True)
if tmp.count() > 0:
return True
return False
def get_full_name(self):
"""Get the full name of the person."""
return self.full_name
def get_short_name(self):
"""Get the abbreviated name of the person."""
return self.short_name
def has_account(self):
ua = self.account_set.all()
ua = ua.filter(date_deleted__isnull=True)
if ua.count() != 0:
return True
return False
def get_account(self):
try:
return self.account_set.get(date_deleted__isnull=True)
except self.account_set.DoesNotExist:
return None
except self.account_set.MultipleObjectsReturned:
return None
def is_leader(self):
if self.leads.count() > 0:
return True
return False
def activate(self, approved_by):
if not self.is_active:
self.date_approved = datetime.datetime.today()
self.approved_by = approved_by
self.deleted_by = None
self.date_deleted = None
self.is_active = True
self.save()
log.change(self, "Activated by %s" % approved_by)
activate.alters_data = True
def deactivate(self, deleted_by):
"""Sets Person not active and deletes all Accounts"""
# deactivate accounts first, so we don't need to repeatedly update
# their datastores uselessly when clearing the groups.
for ua in self.account_set.filter(date_deleted__isnull=True):
ua.deactivate()
# now we can clear the groups
self.groups.clear()
# finally, mark the person as deleted.
self.is_active = False
self.expires = None
self.date_deleted = datetime.datetime.today()
self.deleted_by = deleted_by
self.save()
# log a message
log.change(self, "Deactivated by %s" % deleted_by)
deactivate.alters_data = True
def set_password(self, password):
super(Person, self).set_password(password)
if self.legacy_ldap_password is not None:
self.legacy_ldap_password = None
self._raw_password = password
set_password.alters_data = True
def lock(self):
if self.is_locked():
return
self.login_enabled = False
self.save()
lock.alters_data = True
def unlock(self):
if not self.is_locked():
return
self.login_enabled = True
self.save()
unlock.alters_data = True
def is_locked(self):
return not self.login_enabled
def add_group(self, group):
group.members.add(self)
add_group.alters_data = True
def remove_group(self, group):
group.members.remove(self)
remove_group.alters_data = True
@property
def projects(self):
from karaage.projects.models import Project
return Project.objects.filter(group__members=self)
@property
def institutes(self):
from karaage.institutes.models import Institute
return Institute.objects.filter(group__members=self)
|
class Person(TrackingModelMixin, AbstractBaseUser):
def __init__(self, *args, **kwargs):
pass
class Meta:
def __str__(self):
pass
def get_absolute_url(self):
pass
def save(self, *args, **kwargs):
pass
def delete(self, *args, **kwargs):
pass
@property
def last_name(self):
pass
@property
def first_name(self):
pass
def has_perm(self, perm, obj=None):
'''Does the user have a specific permission? (depreciated)'''
pass
def has_module_perms(self, app_label):
'''(depreciated)'''
pass
@property
def user(self):
'''(depreciated)'''
pass
def get_profile(self):
'''(depreciated)'''
pass
@property
def is_staff(self):
'''Is the user a member of staff? (depreciated)'''
pass
def can_view(self, request):
pass
def get_full_name(self):
'''Get the full name of the person.'''
pass
def get_short_name(self):
'''Get the abbreviated name of the person.'''
pass
def has_account(self):
pass
def get_account(self):
pass
def is_leader(self):
pass
def activate(self, approved_by):
pass
def deactivate(self, deleted_by):
'''Sets Person not active and deletes all Accounts'''
pass
def set_password(self, password):
pass
def lock(self):
pass
def unlock(self):
pass
def is_locked(self):
pass
def add_group(self, group):
pass
def remove_group(self, group):
pass
@property
def projects(self):
pass
@property
def institutes(self):
pass
| 36 | 8 | 8 | 1 | 6 | 1 | 2 | 0.12 | 2 | 7 | 3 | 0 | 28 | 2 | 28 | 28 | 338 | 68 | 241 | 100 | 198 | 29 | 225 | 93 | 188 | 15 | 1 | 3 | 67 |
141,998 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/models.py
|
karaage.people.models.Group
|
class Group(TrackingModelMixin, models.Model):
"""Groups represent collections of people, these objects can be
expressed externally in a datastore."""
name = models.CharField(max_length=255, unique=True)
foreign_id = models.CharField(
max_length=255, null=True, unique=True, help_text="The foreign identifier from the datastore."
)
members = models.ManyToManyField(Person, related_name="groups")
description = models.TextField(null=True, blank=True)
extra_data = models.JSONField(
default=dict, blank=True, help_text="Datastore specific values should be stored in this field."
)
class Meta:
ordering = ["name"]
db_table = "people_group"
app_label = "karaage"
def __str__(self):
return six.u("%s") % self.name
def get_absolute_url(self):
return reverse("kg_group_detail", kwargs={"group_name": self.name})
def save(self, *args, **kwargs):
created = self.pk is None
if created:
changed = {field: None for field in self.tracker.tracked_fields}
else:
changed = copy.deepcopy(self.tracker.changed)
# save the object
super(Group, self).save(*args, **kwargs)
if created:
log.add(self, "Created")
for field in changed.keys():
log.field_change(self, field=field, new_value=getattr(self, field))
old_name = changed.get("name")
new_name = self.name
if old_name is not None and old_name != new_name:
from karaage.datastores import set_group_name
set_group_name(self, old_name, new_name)
log.change(self, "Renamed group")
# update the datastore
from karaage.datastores import save_group
save_group(self)
save.alters_data = True
def delete(self, *args, **kwargs):
for person in self.members.all():
_remove_person_from_group(person, self)
# delete the object
log.delete(self, "Deleted")
super(Group, self).delete(*args, **kwargs)
# update the datastore
from karaage.datastores import delete_group
delete_group(self)
delete.alters_data = True
def add_person(self, person):
self.members.add(person)
add_person.alters_data = True
def remove_person(self, person):
self.members.remove(person)
remove_person.alters_data = True
|
class Group(TrackingModelMixin, models.Model):
'''Groups represent collections of people, these objects can be
expressed externally in a datastore.'''
class Meta:
def __str__(self):
pass
def get_absolute_url(self):
pass
def save(self, *args, **kwargs):
pass
def delete(self, *args, **kwargs):
pass
def add_person(self, person):
pass
def remove_person(self, person):
pass
| 8 | 1 | 8 | 2 | 6 | 1 | 2 | 0.12 | 2 | 2 | 1 | 0 | 6 | 0 | 6 | 6 | 79 | 21 | 52 | 24 | 41 | 6 | 47 | 24 | 36 | 5 | 1 | 1 | 11 |
141,999 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0005_auto_20171215_1831.py
|
karaage.migrations.0005_auto_20171215_1831.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0004_auto_20160429_0927"),
]
operations = [
migrations.AlterUniqueTogether(
name="institutequota",
unique_together=set([]),
),
migrations.RemoveField(
model_name="institutequota",
name="institute",
),
migrations.RemoveField(
model_name="institutequota",
name="machine_category",
),
migrations.AlterUniqueTogether(
name="projectquota",
unique_together=set([]),
),
migrations.RemoveField(
model_name="projectquota",
name="machine_category",
),
migrations.RemoveField(
model_name="projectquota",
name="project",
),
migrations.RemoveField(
model_name="account",
name="machine_category",
),
migrations.RemoveField(
model_name="machine",
name="category",
),
migrations.DeleteModel(
name="MachineCategory",
),
migrations.DeleteModel(
name="ProjectQuota",
),
migrations.DeleteModel(
name="InstituteQuota",
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 48 | 1 | 47 | 3 | 46 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,000 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0006_auto_20180302_1735.py
|
karaage.migrations.0006_auto_20180302_1735.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0005_auto_20171215_1831"),
]
operations = [
migrations.AlterField(
model_name="account",
name="default_project",
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to="karaage.Project"
),
),
migrations.AlterField(
model_name="institute",
name="group",
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="karaage.Group"),
),
migrations.AlterField(
model_name="logentry",
name="user",
field=models.ForeignKey(
null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL
),
),
migrations.AlterField(
model_name="person",
name="approved_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="user_approver",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="person",
name="deleted_by",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="user_deletor",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="project",
name="approved_by",
field=models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="project_approver",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="project",
name="deleted_by",
field=models.ForeignKey(
blank=True,
editable=False,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="project_deletor",
to=settings.AUTH_USER_MODEL,
),
),
migrations.AlterField(
model_name="project",
name="group",
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="karaage.Group"),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 77 | 1 | 76 | 3 | 75 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,001 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0007_auto_20190315_1515.py
|
karaage.migrations.0007_auto_20190315_1515.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0006_auto_20180302_1735"),
]
operations = [
migrations.AlterField(
model_name="person",
name="full_name",
field=models.CharField(max_length=100),
),
migrations.AlterField(
model_name="person",
name="short_name",
field=models.CharField(max_length=100),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 16 | 3 | 15 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,002 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0008_institute_saml_scoped_affiliation.py
|
karaage.migrations.0008_institute_saml_scoped_affiliation.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0007_auto_20190315_1515"),
]
operations = [
migrations.AddField(
model_name="institute",
name="saml_scoped_affiliation",
field=models.CharField(blank=True, max_length=200, null=True, unique=True),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,003 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0009_project_has_notified_pending_expiration.py
|
karaage.migrations.0009_project_has_notified_pending_expiration.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0008_institute_saml_scoped_affiliation"),
]
operations = [
migrations.AddField(
model_name="project",
name="has_notified_pending_expiration",
field=models.BooleanField(default=False),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,004 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0010_project_rcao.py
|
karaage.migrations.0010_project_rcao.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0009_project_has_notified_pending_expiration"),
]
operations = [
migrations.AddField(
model_name="project",
name="rcao",
field=models.EmailField(blank=True, max_length=254, null=True, verbose_name="RCAO Email"),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,005 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0011_institute_project_prefix.py
|
karaage.migrations.0011_institute_project_prefix.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0010_project_rcao"),
]
operations = [
migrations.AddField(
model_name="institute",
name="project_prefix",
field=models.CharField(blank=True, max_length=4, null=True),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,006 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0012_project_prefix.py
|
karaage.migrations.0012_project_prefix.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0011_institute_project_prefix"),
]
operations = [
migrations.RunPython(set_project_prefix),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 7 | 3 | 6 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,007 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/migrations/0013_alter_institute_project_prefix.py
|
karaage.migrations.0013_alter_institute_project_prefix.Migration
|
class Migration(migrations.Migration):
dependencies = [
("karaage", "0012_project_prefix"),
]
operations = [
migrations.AlterField(
model_name="institute",
name="project_prefix",
field=models.CharField(max_length=4, validators=[django.core.validators.RegexValidator("^[a-zA-Z]{4}$")]),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 1 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,008 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.AddGroupMemberForm
|
class AddGroupMemberForm(forms.Form):
"""Add a user to a group form"""
person = ajax_select.fields.AutoCompleteSelectField("person", required=True, label="Add person")
def __init__(self, *args, **kwargs):
self.instance = kwargs.pop("instance", None)
super(AddGroupMemberForm, self).__init__(*args, **kwargs)
def save(self, commit=True):
person = self.cleaned_data["person"]
self.instance.add_person(person)
return self.instance
|
class AddGroupMemberForm(forms.Form):
'''Add a user to a group form'''
def __init__(self, *args, **kwargs):
pass
def save(self, commit=True):
pass
| 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.11 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 13 | 3 | 9 | 6 | 6 | 1 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
142,009 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.AddPersonForm
|
class AddPersonForm(AdminPersonForm):
project = forms.ModelChoiceField(queryset=None, label=six.u("Default Project"), required=False)
needs_account = forms.BooleanField(
required=False,
label=six.u("Do you require a cluster account"),
help_text=six.u("eg. Will you be working on the project yourself"),
)
username = forms.CharField(
label=six.u("Requested username"),
max_length=settings.USERNAME_MAX_LENGTH,
help_text=(
settings.USERNAME_VALIDATION_ERROR_MSG + " and has a max length of %s." % settings.USERNAME_MAX_LENGTH
),
)
password1 = forms.CharField(widget=forms.PasswordInput(render_value=False), label=six.u("Password"))
password2 = forms.CharField(widget=forms.PasswordInput(render_value=False), label=six.u("Password (again)"))
def __init__(self, *args, **kwargs):
super(AddPersonForm, self).__init__(*args, **kwargs)
self.fields["project"].queryset = Project.objects.all()
def clean_username(self):
username = self.cleaned_data["username"]
try:
validate_username_for_new_person(username)
except UsernameException as e:
raise forms.ValidationError(e.args[0])
return username
def clean_password2(self):
username = self.cleaned_data.get("username")
password1 = self.cleaned_data.get("password1")
password2 = self.cleaned_data.get("password2")
return validate_password(username, password1, password2)
def save(self, commit=True):
assert commit is True
data = self.cleaned_data
person = super(AddPersonForm, self).save(commit=False)
person.username = data["username"]
person.is_admin = data["is_admin"]
person.is_active = True
person.approved_by = get_current_person()
person.set_password(data["password2"])
person.save()
if data["needs_account"] and data["project"]:
add_user_to_project(person, data["project"])
return person
|
class AddPersonForm(AdminPersonForm):
def __init__(self, *args, **kwargs):
pass
def clean_username(self):
pass
def clean_password2(self):
pass
def save(self, commit=True):
pass
| 5 | 0 | 8 | 1 | 7 | 0 | 2 | 0 | 1 | 3 | 2 | 0 | 4 | 0 | 4 | 8 | 52 | 8 | 44 | 17 | 39 | 0 | 34 | 16 | 29 | 2 | 3 | 1 | 6 |
142,010 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.AdminGroupForm
|
class AdminGroupForm(forms.Form):
name = forms.RegexField(
"^%s$" % settings.GROUP_VALIDATION_RE,
required=True,
error_messages={"invalid": settings.GROUP_VALIDATION_ERROR_MSG},
)
description = forms.CharField()
def __init__(self, *args, **kwargs):
self.instance = kwargs.pop("instance", None)
super(AdminGroupForm, self).__init__(*args, **kwargs)
if self.instance is not None:
self.initial = self.instance.__dict__
def clean_name(self):
name = self.cleaned_data["name"]
groups = Group.objects.filter(name=name)
if self.instance is not None:
groups = groups.exclude(pk=self.instance.pk)
if groups.count() > 0:
raise forms.ValidationError("That group name already exists.")
return name
def save(self, group=None):
data = self.cleaned_data
if self.instance is None:
group = Group()
else:
group = self.instance
group.name = data["name"]
group.description = data["description"]
group.save()
return group
|
class AdminGroupForm(forms.Form):
def __init__(self, *args, **kwargs):
pass
def clean_name(self):
pass
def save(self, group=None):
pass
| 4 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 3 | 2 | 3 | 3 | 36 | 6 | 30 | 11 | 26 | 0 | 25 | 11 | 21 | 3 | 1 | 1 | 7 |
142,011 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.AdminPasswordChangeForm
|
class AdminPasswordChangeForm(forms.Form):
new1 = forms.CharField(widget=forms.PasswordInput(), label=six.u("New Password"))
new2 = forms.CharField(widget=forms.PasswordInput(), label=six.u("New Password (again)"))
def __init__(self, person, *args, **kwargs):
self.person = person
super(AdminPasswordChangeForm, self).__init__(*args, **kwargs)
def clean_new2(self):
username = self.person.username
password1 = self.cleaned_data.get("new1")
password2 = self.cleaned_data.get("new2")
return validate_password(username, password1, password2)
def save(self):
data = self.cleaned_data
person = self.person
person.set_password(data["new1"])
person.save()
|
class AdminPasswordChangeForm(forms.Form):
def __init__(self, person, *args, **kwargs):
pass
def clean_new2(self):
pass
def save(self):
pass
| 4 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 3 | 1 | 3 | 3 | 19 | 3 | 16 | 12 | 12 | 0 | 16 | 12 | 12 | 1 | 1 | 0 | 3 |
142,012 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.AdminPersonForm
|
class AdminPersonForm(PersonForm):
institute = forms.ModelChoiceField(queryset=None)
comment = forms.CharField(widget=forms.Textarea(), required=False)
expires = forms.DateField(required=False)
is_admin = forms.BooleanField(help_text="Designates whether the user can log into this admin site.", required=False)
is_systemuser = forms.BooleanField(
help_text="Designates that this user is a system process, not a person.", required=False
)
def __init__(self, *args, **kwargs):
super(AdminPersonForm, self).__init__(*args, **kwargs)
self.fields["institute"].queryset = Institute.active.all()
class Meta:
model = Person
fields = [
"short_name",
"full_name",
"email",
"title",
"position",
"supervisor",
"department",
"institute",
"telephone",
"mobile",
"fax",
"address",
"country",
"expires",
"comment",
"is_systemuser",
"is_admin",
]
|
class AdminPersonForm(PersonForm):
def __init__(self, *args, **kwargs):
pass
class Meta:
| 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 1 | 1 | 0 | 1 | 4 | 34 | 2 | 32 | 10 | 29 | 0 | 12 | 10 | 9 | 1 | 2 | 0 | 1 |
142,013 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.PasswordChangeForm
|
class PasswordChangeForm(AdminPasswordChangeForm):
old = forms.CharField(widget=forms.PasswordInput(), label="Old password")
def clean_new2(self):
username = self.person.username
password1 = self.cleaned_data.get("new1")
password2 = self.cleaned_data.get("new2")
old_password = self.cleaned_data.get("old", None)
return validate_password(username, password1, password2, old_password)
def clean_old(self):
person = Person.objects.authenticate(username=self.person.username, password=self.cleaned_data["old"])
if person is None:
raise forms.ValidationError(six.u("Your old password was incorrect"))
return self.cleaned_data["old"]
|
class PasswordChangeForm(AdminPasswordChangeForm):
def clean_new2(self):
pass
def clean_old(self):
pass
| 3 | 0 | 6 | 1 | 6 | 0 | 2 | 0 | 1 | 1 | 1 | 0 | 2 | 0 | 2 | 5 | 16 | 3 | 13 | 9 | 10 | 0 | 13 | 9 | 10 | 2 | 2 | 1 | 3 |
142,014 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.PersonForm
|
class PersonForm(forms.ModelForm):
# title = forms.ChoiceField(choices=TITLES, required=False)
# position = forms.CharField(required=False)
# email = forms.EmailField()
# department = forms.CharField(required=False)
# supervisor = forms.CharField(required=False)
telephone = forms.CharField(
required=True,
label=six.u("Office Telephone"),
help_text=six.u("Used for emergency contact and password reset service."),
validators=[validate_phone_number],
)
mobile = forms.CharField(
required=False,
validators=[validate_phone_number],
)
fax = forms.CharField(required=False, validators=[validate_phone_number])
address = forms.CharField(label=six.u("Mailing Address"), required=False, widget=forms.Textarea())
country = forms.ChoiceField(choices=COUNTRIES, initial="AU", required=False)
def __init__(self, *args, **kwargs):
super(PersonForm, self).__init__(*args, **kwargs)
self.fields["short_name"].help_text = (
"This is typically the person's given name. For example enter 'Fred' here."
)
self.fields["full_name"].help_text = (
"This is typically the person's full name. For example enter 'Fred Smith' here."
)
def clean(self):
data = super(PersonForm, self).clean()
for key in [
"short_name",
"full_name",
"email",
"position",
"supervisor",
"department",
"telephone",
"mobile",
"fax",
"address",
]:
if key in data and data[key]:
data[key] = data[key].strip()
return data
class Meta:
model = Person
fields = [
"short_name",
"full_name",
"email",
"title",
"position",
"supervisor",
"department",
"telephone",
"mobile",
"fax",
"address",
"country",
]
def clean_email(self):
email = self.cleaned_data["email"]
users = Person.objects.filter(email__exact=email)
if self.instance:
users = users.exclude(pk=self.instance.pk)
if users.count() > 0:
raise forms.ValidationError(
six.u("An account with this email already exists. Please email %s") % settings.ACCOUNTS_EMAIL
)
clean_email(email)
return email
|
class PersonForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
pass
def clean(self):
pass
class Meta:
def clean_email(self):
pass
| 5 | 0 | 13 | 1 | 12 | 0 | 2 | 0.08 | 1 | 2 | 1 | 1 | 3 | 0 | 3 | 3 | 77 | 6 | 66 | 16 | 61 | 5 | 28 | 16 | 23 | 3 | 1 | 2 | 7 |
142,015 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/forms.py
|
karaage.people.forms.SetPasswordForm
|
class SetPasswordForm(BaseSetPasswordForm):
def clean_new_password1(self):
password1 = self.cleaned_data.get("new_password1")
return validate_password(self.user.username, password1)
|
class SetPasswordForm(BaseSetPasswordForm):
def clean_new_password1(self):
pass
| 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 1 | 0 | 1 |
142,016 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/lookups.py
|
karaage.people.lookups.GroupLookup
|
class GroupLookup(LookupChannel):
model = Group
def get_query(self, q, request):
"""return a query set searching for the query string q
either implement this method yourself or set the search_field
in the LookupChannel class definition
"""
return Group.objects.filter(Q(name__icontains=q) | Q(description__icontains=q))
def get_result(self, obj):
"""
result is the simple text that is the completion of what the person
typed
"""
return obj.name
def format_match(self, obj):
"""
(HTML) formatted item for display in the dropdown
"""
result = [escape(obj.name)]
if obj.description:
result.append(escape(obj.description))
return " ".join(result)
def format_item_display(self, obj):
"""
(HTML) formatted item for displaying item in the selected deck area
"""
return "%s" % (escape(obj.name))
|
class GroupLookup(LookupChannel):
def get_query(self, q, request):
'''return a query set searching for the query string q
either implement this method yourself or set the search_field
in the LookupChannel class definition
'''
pass
def get_result(self, obj):
'''
result is the simple text that is the completion of what the person
typed
'''
pass
def format_match(self, obj):
'''
(HTML) formatted item for display in the dropdown
'''
pass
def format_item_display(self, obj):
'''
(HTML) formatted item for displaying item in the selected deck area
'''
pass
| 5 | 4 | 7 | 1 | 3 | 4 | 1 | 1.08 | 1 | 1 | 1 | 0 | 4 | 0 | 4 | 5 | 33 | 6 | 13 | 7 | 8 | 14 | 13 | 7 | 8 | 2 | 2 | 1 | 5 |
142,017 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/lookups.py
|
karaage.people.lookups.PersonLookup
|
class PersonLookup(LookupChannel):
model = Person
def get_query(self, q, request):
"""return a query set searching for the query string q
either implement this method yourself or set the search_field
in the LookupChannel class definition
"""
return Person.objects.filter(Q(username__icontains=q) | Q(short_name__icontains=q) | Q(full_name__icontains=q))
def get_result(self, obj):
"""
result is the simple text that is the completion of what the person
typed
"""
return obj.username
def format_match(self, obj):
"""
(HTML) formatted item for display in the dropdown
"""
return "%s (%s)" % (escape(obj.full_name), escape(obj.username))
def format_item_display(self, obj):
"""
(HTML) formatted item for displaying item in the selected deck area
"""
return "%s" % (escape(obj.full_name))
|
class PersonLookup(LookupChannel):
def get_query(self, q, request):
'''return a query set searching for the query string q
either implement this method yourself or set the search_field
in the LookupChannel class definition
'''
pass
def get_result(self, obj):
'''
result is the simple text that is the completion of what the person
typed
'''
pass
def format_match(self, obj):
'''
(HTML) formatted item for display in the dropdown
'''
pass
def format_item_display(self, obj):
'''
(HTML) formatted item for displaying item in the selected deck area
'''
pass
| 5 | 4 | 6 | 0 | 2 | 4 | 1 | 1.4 | 1 | 1 | 1 | 0 | 4 | 0 | 4 | 5 | 28 | 4 | 10 | 6 | 5 | 14 | 10 | 6 | 5 | 1 | 2 | 0 | 4 |
142,018 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/managers.py
|
karaage.people.managers.ActivePersonManager
|
class ActivePersonManager(PersonManager):
def get_queryset(self):
return (
super(ActivePersonManager, self).get_queryset().select_related().filter(is_active=True, is_systemuser=False)
)
|
class ActivePersonManager(PersonManager):
def get_queryset(self):
pass
| 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 6 | 5 | 0 | 5 | 2 | 3 | 0 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
142,019 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/managers.py
|
karaage.people.managers.DeletedPersonManager
|
class DeletedPersonManager(PersonManager):
def get_queryset(self):
return super(DeletedPersonManager, self).get_queryset().filter(is_active=False)
|
class DeletedPersonManager(PersonManager):
def get_queryset(self):
pass
| 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 6 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
142,020 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/managers.py
|
karaage.people.managers.LeaderManager
|
class LeaderManager(PersonManager):
def get_queryset(self):
leader_ids = []
query = super(LeaderManager, self).get_queryset()
query = query.filter(is_active=True)
for l in query:
if l.is_leader():
leader_ids.append(l.id)
return self.filter(id__in=leader_ids)
|
class LeaderManager(PersonManager):
def get_queryset(self):
pass
| 2 | 0 | 9 | 1 | 8 | 0 | 3 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 6 | 10 | 1 | 9 | 5 | 7 | 0 | 9 | 5 | 7 | 3 | 2 | 2 | 3 |
142,021 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/people/managers.py
|
karaage.people.managers.PersonManager
|
class PersonManager(BaseUserManager):
def authenticate(self, username, password):
return authenticate(username=username, password=password)
def get_queryset(self):
return super(PersonManager, self).get_queryset().select_related()
def _create_user(self, username, email, short_name, full_name, institute, password, is_admin, **extra_fields):
"""Creates a new active person."""
# Create Person
person = self.model(
username=username,
email=email,
short_name=short_name,
full_name=full_name,
is_admin=is_admin,
institute=institute,
**extra_fields
)
person.set_password(password)
person.save()
return person
def create_user(self, username, email, short_name, full_name, institute, password=None, **extra_fields):
"""Creates a new ordinary person."""
return self._create_user(
username=username,
email=email,
short_name=short_name,
full_name=full_name,
institute=institute,
password=password,
is_admin=False,
**extra_fields
)
def create_superuser(self, username, email, short_name, full_name, institute, password, **extra_fields):
"""Creates a new person with super powers."""
return self._create_user(
username=username,
email=email,
institute=institute,
password=password,
short_name=short_name,
full_name=full_name,
is_admin=True,
**extra_fields
)
|
class PersonManager(BaseUserManager):
def authenticate(self, username, password):
pass
def get_queryset(self):
pass
def _create_user(self, username, email, short_name, full_name, institute, password, is_admin, **extra_fields):
'''Creates a new active person.'''
pass
def create_user(self, username, email, short_name, full_name, institute, password=None, **extra_fields):
'''Creates a new ordinary person.'''
pass
def create_superuser(self, username, email, short_name, full_name, institute, password, **extra_fields):
'''Creates a new person with super powers.'''
pass
| 6 | 3 | 9 | 0 | 8 | 1 | 1 | 0.1 | 1 | 1 | 0 | 3 | 5 | 0 | 5 | 5 | 49 | 5 | 40 | 7 | 34 | 4 | 14 | 7 | 8 | 1 | 1 | 0 | 5 |
142,022 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/plugins/kgapplications/migrations/0004_auto_20180301_1721.py
|
karaage.plugins.kgapplications.migrations.0004_auto_20180301_1721.Migration
|
class Migration(migrations.Migration):
dependencies = [
("kgapplications", "0003_remove_projectapplication_machine_categories"),
]
operations = [
migrations.AlterField(
model_name="applicant",
name="institute",
field=models.ForeignKey(
blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to="karaage.Institute"
),
),
]
|
class Migration(migrations.Migration):
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 1 | 13 | 3 | 12 | 0 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
142,023 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/tests/client.py
|
karaage.tests.client.RegexURLPattern
|
class RegexURLPattern: # type: ignore
pass
|
class RegexURLPattern:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
142,024 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/projects/tables.py
|
karaage.projects.tables.ProjectTable
|
class ProjectTable(tables.Table):
is_active = tables.Column(order_by="-is_active", verbose_name="active")
pid = tables.LinkColumn("kg_project_detail", args=[A("id")], verbose_name="PID")
institute = tables.LinkColumn("kg_institute_detail", args=[A("institute__pk")])
leaders = PeopleColumn(orderable=False)
def render_is_active(self, record):
if not record.is_active:
html = '<span class="no">Deleted</span>'
elif not record.is_approved:
html = '<span class="no">Not approved</span>'
else:
html = '<span class="yes">Yes</span>'
return mark_safe(html)
class Meta:
model = Project
fields = ("is_active", "pid", "name", "institute", "leaders", "last_usage")
empty_text = "No items"
|
class ProjectTable(tables.Table):
def render_is_active(self, record):
pass
class Meta:
| 3 | 0 | 8 | 0 | 8 | 0 | 3 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 19 | 2 | 17 | 11 | 14 | 0 | 15 | 11 | 12 | 3 | 1 | 1 | 3 |
142,025 |
Karaage-Cluster/karaage
|
Karaage-Cluster_karaage/karaage/tests/client.py
|
karaage.tests.client.TestAllPagesCase
|
class TestAllPagesCase(TestCase):
def setUp(self):
super(TestAllPagesCase, self).setUp()
def cleanup():
reset()
self.addCleanup(cleanup)
|
class TestAllPagesCase(TestCase):
def setUp(self):
pass
def cleanup():
pass
| 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 3 | 1 | 0 | 1 | 1 | 8 | 2 | 6 | 3 | 3 | 0 | 6 | 3 | 3 | 1 | 1 | 0 | 2 |
142,026 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/forms.py
|
karaage.plugins.kgsoftware.forms.SoftwareVersionForm.Meta
|
class Meta:
model = SoftwareVersion
fields = ["software", "version", "machines", "module", "last_used"]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,027 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/forms.py
|
karaage.plugins.kgsoftware.forms.SoftwareForm.Meta
|
class Meta:
model = Software
fields = [
"category",
"name",
"description",
"homepage",
"tutorial_url",
"academic_only",
"restricted",
]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 0 | 11 | 3 | 10 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,028 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/forms.py
|
karaage.plugins.kgsoftware.forms.SoftwareCategoryForm.Meta
|
class Meta:
model = SoftwareCategory
fields = [
"name",
]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 5 | 3 | 4 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,029 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/forms.py
|
karaage.plugins.kgsoftware.forms.LicenseForm.Meta
|
class Meta:
model = SoftwareLicense
fields = ["software", "version", "date", "text"]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,030 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/applications/tables.py
|
karaage.plugins.kgsoftware.applications.tables.SoftwareApplicationTable.Meta
|
class Meta:
model = SoftwareApplication
fields = ("id", "action", "applicant", "state", "expires")
empty_text = "No items"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
142,031 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/applications/models.py
|
karaage.plugins.kgsoftware.applications.models.SoftwareApplication.Meta
|
class Meta:
db_table = "applications_softwareapplication"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,032 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/applications/forms.py
|
karaage.plugins.kgsoftware.applications.forms.ApproveSoftwareForm.Meta
|
class Meta:
model = SoftwareApplication
fields = []
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,033 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/tests/fixtures.py
|
karaage.plugins.kgapplications.tests.fixtures.ProjectApplicationFactory.Meta
|
class Meta:
model = ProjectApplication
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,034 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/models.py
|
karaage.plugins.kgsoftware.models.Software.Meta
|
class Meta:
ordering = ["name"]
db_table = "software"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,035 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/tests/fixtures.py
|
karaage.plugins.kgapplications.tests.fixtures.ApplicationFactory.Meta
|
class Meta:
model = Application
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,036 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/tables.py
|
karaage.plugins.kgapplications.tables.ApplicationFilter.Meta
|
class Meta:
model = Application
fields = ("secret_token",)
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,037 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/models.py
|
karaage.plugins.kgapplications.models.ProjectApplication.Meta
|
class Meta:
db_table = "applications_projectapplication"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,038 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/models.py
|
karaage.plugins.kgapplications.models.Application.Meta
|
class Meta:
db_table = "applications_application"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,039 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/models.py
|
karaage.plugins.kgapplications.models.Applicant.Meta
|
class Meta:
db_table = "applications_applicant"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,040 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/management/commands/application_cleanup.py
|
karaage.plugins.kgapplications.management.commands.application_cleanup.Command
|
class Command(BaseCommand):
help = "Regular cleanup of application db models."
@django.db.transaction.atomic
@tldap.transaction.commit_on_success
def handle(self, **options):
import datetime
from django.db.models import Count
from ...models import Applicant, Application
now = timezone.now()
verbose = int(options.get("verbosity"))
# Delete all expired unsubmitted applications
for application in Application.objects.filter(expires__lte=now, submitted_date__isnull=True):
if verbose >= 1:
print("Deleted expired unsubmitted application #%s" %
application.id)
application.delete()
month_ago = now - datetime.timedelta(days=30)
# Delete all unsubmitted applications that have been around for 1 month
for application in Application.objects.filter(created_date__lte=month_ago, submitted_date__isnull=True):
if verbose >= 1:
print("Deleted unsubmitted application #%s" % application.id)
application.delete()
# Delete all applications that have been complete/declined for 1 month
for application in Application.objects.filter(complete_date__isnull=False, complete_date__lte=month_ago):
if verbose >= 1:
print("Deleted completed application #%s" % application.id)
application.delete()
# Delete all orphaned applicants
for applicant in Applicant.objects.annotate(cc=Count("application")).filter(cc=0):
if verbose >= 1:
print("Deleted orphaned applicant #%s" % applicant.id)
applicant.delete()
|
class Command(BaseCommand):
@django.db.transaction.atomic
@tldap.transaction.commit_on_success
def handle(self, **options):
pass
| 4 | 0 | 36 | 9 | 23 | 8 | 9 | 0.3 | 1 | 4 | 2 | 0 | 1 | 0 | 1 | 1 | 41 | 10 | 27 | 12 | 20 | 8 | 25 | 11 | 20 | 9 | 1 | 2 | 9 |
142,041 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.approve_project_form_generator.ApproveProjectForm.Meta
|
class Meta:
model = ProjectApplication
fields = include_fields
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,042 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/common/create_update.py
|
karaage.common.create_update.get_model_and_form_class.Meta
|
class Meta:
model = tmp_model
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 |
142,043 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/forms.py
|
karaage.plugins.kgapplications.forms.approve_project_form_generator.ApproveProjectForm
|
class ApproveProjectForm(forms.ModelForm):
if application.project is None:
# new project
additional_req = forms.CharField(
label="Additional requirements",
widget=forms.Textarea(
attrs={"class": "vLargeTextField", "rows": 10, "cols": 40}),
help_text=six.u("Do you have any special requirements?"),
required=False,
)
class Meta:
model = ProjectApplication
fields = include_fields
def __init__(self, *args, **kwargs):
super(ApproveProjectForm, self).__init__(*args, **kwargs)
self.fields["needs_account"].label = six.u(
"Does this person require a cluster account?")
self.fields["needs_account"].help_text = six.u(
"Will this person be working on the project?")
|
class ApproveProjectForm(forms.ModelForm):
class Meta:
def __init__(self, *args, **kwargs):
pass
| 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0.07 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 18 | 2 | 15 | 6 | 12 | 1 | 10 | 6 | 7 | 1 | 1 | 1 | 1 |
142,044 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgapplications/tables.py
|
karaage.plugins.kgapplications.tables.ApplicationTable.Meta
|
class Meta:
model = Application
fields = ("id", "action", "applicant", "state", "expires")
empty_text = "No items"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
142,045 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/models.py
|
karaage.plugins.kgsoftware.models.SoftwareCategory.Meta
|
class Meta:
db_table = "software_category"
ordering = ["name"]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
142,046 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/models.py
|
karaage.plugins.kgsoftware.models.SoftwareLicense.Meta
|
class Meta:
db_table = "software_license"
get_latest_by = "date"
ordering = ["-version"]
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 4 | 3 | 0 | 4 | 4 | 3 | 0 | 0 | 0 | 0 |
142,047 |
Karaage-Cluster/karaage
|
/Users/umroot/Documents/PhD_works/PhD-Core-Contents/Class-level-dataset-curation/data/git_repos_for_analysis/Karaage-Cluster_karaage/karaage/plugins/kgsoftware/models.py
|
karaage.plugins.kgsoftware.models.SoftwareLicenseAgreement.Meta
|
class Meta:
db_table = "software_license_agreement"
get_latest_by = "date"
|
class Meta:
pass
| 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.