prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>controllers.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
from flask import... | _process_args |
<|file_name|>controllers.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
from flask import... | _process |
<|file_name|>controllers.py<|end_file_name|><|fim▁begin|># This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
from flask import... | _process |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | self.count = 0 |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
<|fim_middle|>
class Shitzu(Dog):
def __init__(self):
self.count = 0
super(Dog... | @actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self)
@process_method # Process - triggered each time it's run
def process(self):
#print(" ", end="")
pass
@late_bind # Output
def produce(self):
pass |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
<|fim_middle|>
... | print("Woof", self) |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | pass |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | pass |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | def __init__(self):
self.count = 0
super(Dog, self).__init__()
@process_method
def process(self):
self.count += 1
print("I don't go meow", self.count)
if self.count >= 20:
self.stop()
return False |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | self.count = 0
super(Dog, self).__init__() |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | self.count += 1
print("I don't go meow", self.count)
if self.count >= 20:
self.stop()
return False |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | self.stop()
return False |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | import time
dog = Dog()
shitzu = Shitzu()
dog.start()
shitzu.start()
dog.woof()
shitzu.woof()
time.sleep(0.1)
shitzu.join()
time.sleep(0.1)
dog.stop()
dog.join() |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def <|fim_middle|>(self):
print("W... | woof |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | process |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | produce |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | __init__ |
<|file_name|>dogs_go_woof_actors.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
from __future__ import print_function
from guild.actor import Actor, actor_method, process_method, late_bind
class Dog(Actor):
@actor_method # Input - triggered by data coming in
def woof(self):
print("Woof", self... | process |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | })
else:
selected_choice.votes += 1
selected_choice.save() |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | template_name = "polls/index.html"
context_object_name = 'latest_question_list'
def get_queryset(self):
"""Return the last five published questions."""
return Question.objects.order_by('-pub_date')[:5] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | """Return the last five published questions."""
return Question.objects.order_by('-pub_date')[:5] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | model = Question
template_name = 'polls/detail.html' |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | model = Question
template_name = 'polls/results.html' |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | question = get_object_or_404(Question, pk=question_id)
try:
selected_choice = question.choice_set.get(pk=request.POST['choice'])
except:
return render(request, 'polls/detail.html', {
'question': question,
'error_message': "You didn't select a choice.",
})
... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | selected_choice.votes += 1
selected_choice.save()
return HttpResponseRedirect(reverse('polls:results', args=(question.id,))) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | get_queryset |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>"""
Copyright 2016 Andrea McIntosh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
... | vote |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
def make(self, updatePkgDir):
keys_name = self.getValue("k... |
if signingKeys: |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
<|fim_middle|>
<|fim▁end|> | def make(self, updatePkgDir):
keys_name = self.getValue("keys")
signingKeys = self.getMaker().getConfig().getKeyConfig(keys_name) if keys_name else None
updateBinaryKey, updateBinary = self.getTargetBinary("update-binary")
assert updateBinary, "%s is not set" % updateBinaryKey
... |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
def make(self, updatePkgDir):
<|fim_middle|>
<|fim▁end|... | keys_name = self.getValue("keys")
signingKeys = self.getMaker().getConfig().getKeyConfig(keys_name) if keys_name else None
updateBinaryKey, updateBinary = self.getTargetBinary("update-binary")
assert updateBinary, "%s is not set" % updateBinaryKey
if keys_name:
asser... |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
def make(self, updatePkgDir):
keys_name = self.getValue("k... | assert signingKeys, "update.keys is '%s' but __config__.host.keys.%s is not set" % (keys_name, keys_name)
signingKeys = signingKeys["private"], signingKeys["public"] |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
def make(self, updatePkgDir):
keys_name = self.getValue("k... | javaKey, javaPath = self.getHostBinary("java")
signApkKey, signApkPath = self.getHostBinary("signapk")
assert signApkPath, "%s is not set" % signApkKey
assert os.path.exists(signApkPath), "'%s' from %s does not exist" % (signApkPath, signApkKey)
assert os.pa... |
<|file_name|>submaker_updatezip.py<|end_file_name|><|fim▁begin|>from .submaker import Submaker
from inception.tools.signapk import SignApk
import shutil
import os
from inception.constants import InceptionConstants
class UpdatezipSubmaker(Submaker):
def <|fim_middle|>(self, updatePkgDir):
keys_name = self.g... | make |
<|file_name|>_textfont.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="textfont", parent_name="scattersmith", **kwargs):
super(TextfontValidator, self).__init__(
plotly_... | |
<|file_name|>_textfont.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
<|fim_middle|>
<|fim▁end|> | def __init__(self, plotly_name="textfont", parent_name="scattersmith", **kwargs):
super(TextfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_class_str=kwargs.pop("data_class_str", "Textfont"),
data_docs=kwargs.pop(
... |
<|file_name|>_textfont.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="textfont", parent_name="scattersmith", **kwargs):
<|fim_middle|>
<|fim▁end|> | super(TextfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
data_class_str=kwargs.pop("data_class_str", "Textfont"),
data_docs=kwargs.pop(
"data_docs",
"""
color
colorsrc
... |
<|file_name|>_textfont.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def <|fim_middle|>(self, plotly_name="textfont", parent_name="scattersmith", **kwargs):
super(TextfontValidator, self).__init__(
p... | __init__ |
<|file_name|>message.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
class Message(object):
"""
Base type of a message sent through the pipeline.
Define some attributes and methods to form your message.
<|fim▁hole|> pass<|fim▁end|> | I suggest you don't alter this class. You're are free to do so, of course. It's your own decision.
Though, I suggest you create your own message type and let it inherit from this class.
""" |
<|file_name|>message.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
class Message(object):
<|fim_middle|>
<|fim▁end|> | """
Base type of a message sent through the pipeline.
Define some attributes and methods to form your message.
I suggest you don't alter this class. You're are free to do so, of course. It's your own decision.
Though, I suggest you create your own message type and let it inherit fro... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | subject=subject,
sender=sender,
recipient=recipient,
) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | help = 'Report instructors activity.'
def add_arguments(self, parser):
parser.add_argument(
'--send-out-for-real', action='store_true', default=False,
help='Send information to the instructors.',
)
parser.add_argument(
'--no-may-contact-only', action=... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | parser.add_argument(
'--send-out-for-real', action='store_true', default=False,
help='Send information to the instructors.',
)
parser.add_argument(
'--no-may-contact-only', action='store_true', default=False,
help='Include instructors not willing t... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | """List of other instructors' tasks, per event."""
return [
task.event.task_set.filter(role__in=roles)
.exclude(person=person)
.select_related('person')
for task in tasks
] |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | roles = Role.objects.filter(name__in=['instructor', 'helper'])
instructor_badges = Badge.objects.instructor_badges()
instructors = Person.objects.filter(badges__in=instructor_badges)
instructors = instructors.exclude(email__isnull=True)
if may_contact_only:
instructo... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | tmplt = get_template('mailing/instructor_activity.txt')
return tmplt.render(context=record) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | return 'Updating your Software Carpentry information' |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | return record['person'].email |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | if for_real:
if django_mailing:
send_mail(subject, message, sender, [recipient])
else:
command = 'mail -s "{subject}" -r {sender} {recipient}'.format(
subject=subject,
sender=sender,
recipient=re... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | send_for_real = options['send_out_for_real']
# by default include only instructors who have `may_contact==True`
no_may_contact_only = options['no_may_contact_only']
# use mailing options from settings.py or the `mail` system command?
django_mailing = options['django_mailing']
... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | instructors = instructors.exclude(may_contact=False) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | if django_mailing:
send_mail(subject, message, sender, [recipient])
else:
command = 'mail -s "{subject}" -r {sender} {recipient}'.format(
subject=subject,
sender=sender,
recipient=recipient,
... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | send_mail(subject, message, sender, [recipient]) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | command = 'mail -s "{subject}" -r {sender} {recipient}'.format(
subject=subject,
sender=sender,
recipient=recipient,
)
writer = os.popen(command, 'w')
writer.write(message)
writer... |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | self.stdout.write('-' * 40 + '\n')
self.stdout.write('To: {}\n'.format(recipient))
self.stdout.write('Subject: {}\n'.format(subject))
self.stdout.write('From: {}\n'.format(sender)) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | self.stdout.write(message + '\n') |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | self.stdout.write('Sent {} emails.\n'.format(len(results))) |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | add_arguments |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | foreign_tasks |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | fetch_activity |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | make_message |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | subject |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | recipient |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | send_message |
<|file_name|>instructors_activity.py<|end_file_name|><|fim▁begin|>import os
import logging
from django.core.management.base import BaseCommand
from django.core.mail import send_mail
from django.template.loader import get_template
from workshops.models import Badge, Person, Role
logger = logging.getLogger()
class C... | handle |
<|file_name|>TwissTrain9.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 20 13:37:16 2017
Author: Peiyong Jiang : jiangpeiyong@impcas.ac.cn
Function:
旋转使得变换。
"""
import matplotlib.pyplot as plt<|fim▁hole|>
plt.close('all')
emitX=12
alphaX=-10.
betaX=13... | import tensorflow as tf
import numpy as np
|
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | volume_ops.delete_backup(volume_name, 'volume', backup_name)
volume_ops.check_browser_console_log() |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | global volume_ops
volume_ops = volume.VOLUME()
vm = test_lib.lib_get_specific_stub(suite_name='e2e_mini/vm', specific_name='vm')
vm_ops = vm.VM(uri=volume_ops.uri, initialized=True)
vm_ops.create_vm()
volume_ops.create_volume(volume_name)
volume_ops.volume_attach_to_vm(vm_ops.vm_name)
vo... |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | global volume_ops
vm_ops.expunge_vm()
volume_ops.expunge_volume(volume_name)
volume_ops.close() |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | global volume_ops
try:
vm_ops.expunge_vm()
volume_ops.expunge_volume(volume_name)
volume_ops.close()
except:
pass |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | test |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | env_recover |
<|file_name|>test_volume_backup.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*-
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
volume = test_lib.lib_get_specific_stub('e2e_mini/volume', 'volume')
volume_ops = None
vm_ops = None
volume_name = 'volume-' + volume.get_... | error_cleanup |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | STACK_MODE_NONE = 1 |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | def __init__(self, js=""):
self.plot = {}
self.id = facette_to_json(PLOT_ID, js, self.plot)
self.name = facette_to_json(PLOT_NAME, js, self.plot)
self.description = facette_to_json(PLOT_DESCRIPTION, js, self.plot)
self.type = facette_to_... |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | self.plot = {}
self.id = facette_to_json(PLOT_ID, js, self.plot)
self.name = facette_to_json(PLOT_NAME, js, self.plot)
self.description = facette_to_json(PLOT_DESCRIPTION, js, self.plot)
self.type = facette_to_json(PLOT_TYPE, js, self... |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | js = self.plot
series = []
for s in self.series:
series.append(json.loads(str(s)))
js[PLOT_SERIES] = series
return json.dumps(js) |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | return str(self) |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | for x in js[PLOT_SERIES]:
e = PlotSerie(x)
self.series.append(e) |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | __init__ |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | __str__ |
<|file_name|>plot.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014 Alcatel-Lucent Enterprise
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | __repr__ |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
<|fim▁hole|> if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
... | version = '%s.%s' % (version, VERSION[2])
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
<|fim_middle|>
<|fim▁end|> | version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final':
version = '%s %s %s' % (version, VERSION[3], VERSION[4])
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
<|fim_middle|>
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSI... | version = '%s.%s' % (version, VERSION[2]) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
<|fim_middle|>
else:
i... | version = '%s pre-alpha' % version |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:... | if VERSION[3] != 'final':
version = '%s %s %s' % (version, VERSION[3], VERSION[4]) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:... | version = '%s %s %s' % (version, VERSION[3], VERSION[4]) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:... | version = "%s %s" % (version, svn_rev) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>VERSION = (1, 3, 0, 'alpha', 1)
def <|fim_middle|>():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
el... | get_version |
<|file_name|>advanced_excel.py<|end_file_name|><|fim▁begin|>"""
See http://pbpython.com/advanced-excel-workbooks.html for details on this script
"""
from __future__ import print_function<|fim▁hole|>def format_excel(writer, df_size):
""" Add Excel specific formatting to the workbook
df_size is a tuple represent... | import pandas as pd
from xlsxwriter.utility import xl_rowcol_to_cell
|
<|file_name|>advanced_excel.py<|end_file_name|><|fim▁begin|>"""
See http://pbpython.com/advanced-excel-workbooks.html for details on this script
"""
from __future__ import print_function
import pandas as pd
from xlsxwriter.utility import xl_rowcol_to_cell
def format_excel(writer, df_size):
<|fim_middle|>
if _... | """ Add Excel specific formatting to the workbook
df_size is a tuple representing the size of the dataframe - typically called
by df.shape -> (20,3)
"""
# Get the workbook and the summary sheet so we can add the formatting
workbook = writer.book
worksheet = writer.sheets['summary']
# Add... |
<|file_name|>advanced_excel.py<|end_file_name|><|fim▁begin|>"""
See http://pbpython.com/advanced-excel-workbooks.html for details on this script
"""
from __future__ import print_function
import pandas as pd
from xlsxwriter.utility import xl_rowcol_to_cell
def format_excel(writer, df_size):
""" Add Excel specific... | sales_df = pd.read_excel('https://github.com/chris1610/pbpython/blob/master/data/sample-salesv3.xlsx?raw=true')
sales_summary = sales_df.groupby(['name'])['ext price'].agg(['sum', 'mean'])
# Reset the index for consistency when saving in Excel
sales_summary.reset_index(inplace=True)
writer = pd.Exce... |
<|file_name|>advanced_excel.py<|end_file_name|><|fim▁begin|>"""
See http://pbpython.com/advanced-excel-workbooks.html for details on this script
"""
from __future__ import print_function
import pandas as pd
from xlsxwriter.utility import xl_rowcol_to_cell
def <|fim_middle|>(writer, df_size):
""" Add Excel specif... | format_excel |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... |
def _cast_type(self, value):
return self.cast_cls(value) |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
<|fim_middle|>
class CharField(Field):
pass
class StringField(Field):
cast_cls = str
... | required = True
"""Field is required and an exception will be raised if missing"""
missing_value = None
"""Value to use when field is missing and not required"""
strict = False
"""Field value must pass validation or an exception will be raised"""
cast_cls = None
data = None
def ... |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... | self.required = required
self.missing_value = missing_value
self.strict = strict |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... | return True |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... | return self.cast_cls(value) |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... | if self.strict:
if not self._validate(value):
raise FieldValidationException('%s does not '
'except this value'
% self.__class__.__name__)
elif self.cast_cls is not None:
... |
<|file_name|>vector.py<|end_file_name|><|fim▁begin|>from victor.exceptions import (
FieldValidationException,
FieldTypeConversionError,
FieldRequiredError,
VectorInputTypeError
)
class Field(object):
required = True
"""Field is required and an exception will be raised if missing"""
missin... | pass |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.