Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return pdbs
class BlastType(graphene.ObjectType):
id = graphene.String()
title = graphene.String()
qseq = graphene.String()
midline = graphene.String()
hseq = graphene.String()
bit_score = graphene.Float()
evalue = graphene.Float()
hit_from = graphene.Int()
hit_to = graphene.Int()
query_from = graphene.Int()
query_to = graphene.Int()
identity = graphene.Int()
score = graphene.Int()
chain = graphene.Field(ChainType)
def resolve_chain(self, info, **kwargs):
return Chain.objects.get(id=self.title.split("|")[1])
class BlastConnection(Connection):
class Meta:
node = BlastType
count = graphene.Int()
if not exact_office:
raise GraphQLError("Office not found")
admin_roles.create_rooms_update_delete_office(office_id)
update_entity_fields(exact_office, state="archived", **kwargs)
exact_office.save()
return DeleteOffice(office=exact_office)
class UpdateOffice(graphene.Mutation):
"""
Returns office payload on updating an office
"""
class Arguments:
name = graphene.String()
office_id = graphene.Int()
office = graphene.Field(Office)
@Auth.user_roles('Admin', 'Super Admin')
def mutate(self, info, office_id, **kwargs):
validate_empty_fields(**kwargs)
get_office = Office.get_query(info)
result = get_office.filter(OfficeModel.state == "active")
exact_office = result.filter(OfficeModel.id == office_id).first()
if not exact_office:
raise GraphQLError("Office not found")
admin_roles.create_rooms_update_delete_office(office_id)
try:
update_entity_fields(exact_office, **kwargs)
exact_office.save()
except exc.SQLAlchemyError:
def resolve_type(cls, instance, context, info):
if isinstance(instance, graphene.ObjectType):
return type(instance)
elif isinstance(instance, models.TokenVoteSpecification):
return TokenVoteSpecification
elif isinstance(instance, models.GaugeVoteSpecification):
return GaugeVoteSpecification
elif isinstance(instance, models.NumberGaugeVoteSpecification):
return NumberGaugeVoteSpecification
class TokenCategorySpecificationInput(graphene.InputObjectType):
__doc__ = docs.TokenCategorySpecificationInput.__doc__
id = graphene.ID()
title_entries = graphene.List(LangStringEntryInput, required=True, description=docs.TokenCategorySpecificationInput.title_entries)
total_number = graphene.Int(required=True, description=docs.TokenCategorySpecificationInput.total_number)
typename = graphene.String(description=docs.TokenCategorySpecificationInput.typename)
color = graphene.String(required=True, description=docs.TokenCategorySpecificationInput.color)
class GaugeChoiceSpecificationInput(graphene.InputObjectType):
__doc__ = docs.GaugeChoiceSpecificationInput.__doc__
id = graphene.ID()
label_entries = graphene.List(LangStringEntryInput, required=True)
value = graphene.Float(required=True)
class CreateTokenVoteSpecification(graphene.Mutation):
__doc__ = docs.CreateTokenVoteSpecification.__doc__
class Input:
vote_session_id = graphene.ID(required=True, description=docs.CreateTokenVoteSpecification.vote_session_id)
oldest_cycle_point = String()
reloading = Boolean()
run_mode = String()
state_totals = Field(StateTotals)
workflow_log_dir = String()
time_zone_info = Field(TimeZone)
tree_depth = Int()
ns_defn_order = List(String)
job_log_names = List(String)
states = List(String)
class Job(ObjectType):
"""Jobs."""
id = ID(required=True)
submit_num = Int()
state = String()
task_proxy = Field(
lambda: TaskProxy,
description="""Associated Task Proxy""",
required=True,
resolver=get_node_by_id)
submitted_time = String()
started_time = String()
finished_time = String()
batch_sys_job_id = ID()
batch_sys_name = String()
env_script = String()
err_script = String()
exit_script = String()
execution_time_limit = Float()
host = String()
class TaskObj(DjangoObjectType):
class Meta:
model = Task
class TaskLogObj(DjangoObjectType):
class Meta:
model = TaskLog
exclude_fields = ('id',)
class streamProgressObj(graphene.ObjectType):
progress = graphene.Float()
tasksCompleted = graphene.Int()
tasksInProgress = graphene.Int()
tasksPending = graphene.Int()
class taskProgressObj(graphene.ObjectType):
status = graphene.String()
isComplete = graphene.Boolean()
start = graphene.String()
submission = graphene.String()
assignTime = graphene.String()
assigner = graphene.String()
class Query(object):
stream = graphene.Field(StreamObj, slug=graphene.String(required=True))
streams = graphene.List(StreamObj,
class FormatValidator(ObjectType):
slug = graphene.String(required=True)
name = graphene.String(required=True)
regex = graphene.String(required=True)
error_msg = graphene.String(required=True)
class FormatValidatorConnection(CountableConnectionBase):
class Meta:
node = FormatValidator
class TextQuestion(QuestionQuerysetMixin, FormDjangoObjectType):
min_length = graphene.Int()
max_length = graphene.Int()
placeholder = graphene.String()
format_validators = ConnectionField(FormatValidatorConnection)
def resolve_format_validators(self, info):
return get_format_validators(include=self.format_validators)
class Meta:
model = models.Question
exclude = (
"type",
"configuration",
"data_source",
"options",
"answers",
"row_form",
def convert_form_field_to_int(field):
return Int(description=field.help_text)
from problem.limitation.models import Limitation
from problem.models import Problem, ProblemSample
from utils.function import assign
class UpdateProblem(graphene.Mutation):
class Arguments:
title = graphene.String(required=True)
standard_input = graphene.String(required=True)
standard_output = graphene.String(required=True)
content = graphene.String(required=True)
resources = graphene.String(required=True)
constraints = graphene.String(required=True)
note = graphene.String(required=True)
time_limit = graphene.Int(required=True)
memory_limit = graphene.Int(required=True)
output_limit = graphene.Int(required=True)
cpu_limit = graphene.Int(required=True)
samples = graphene.String(required=True)
disable = graphene.Boolean(required=True)
slug = graphene.String(required=True)
slug = graphene.String()
@permission_required('problem.change')
def mutate(self, info: ResolveInfo, **kwargs):
form = UpdateProblemForm(kwargs)
if form.is_valid():
else:
Note.objects.unpin(note)
curPinnedStatus = [note.pinned for note in notes]
curOrder = [note.order for note in notes]
return SwitchPinNotes(input['action'], notes, prevPinnedStatus, curPinnedStatus, prevOrder, curOrder)
else:
return GraphQLError("You are not authenticated. Please login first")
class ReorderNote(relay.ClientIDMutation):
""" Reorder note with move model's manager """
class Input:
id = graphene.ID(required=True)
new_order = graphene.Int(required=True)
new_note = graphene.Field(NoteNode)
new_order = graphene.Int()
old_order = graphene.Int()
pinned = graphene.Boolean()
@classmethod
def mutate_and_get_payload(cls, root, info, **input):
if info.context.user.is_authenticated:
local_id = from_global_id(input['id'])[1]
try:
note = Note.objects.get(id=local_id, owner=info.context.user)
except Note.DoesNotExist:
return None
old_order = note.order