prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
<|fim_middle|>
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_template('405.html'), 405
@m... | return render_template('404.html'), 404 |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
<|fim_middle|>
@m... | return render_template('405.html'), 405 |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_templa... | return render_template('500.html'), 500 |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def <|fim_middle|>(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_templa... | page_not_found |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def <|fim_middle|>(e):
return render_template('... | method_not_allowed |
<|file_name|>errors.py<|end_file_name|><|fim▁begin|>__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_templa... | internal_server_error |
<|file_name|>stage_2.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File written by pyctools-editor. Do not edit.
import argparse
import logging
from pyctools.core.compound import Compound
import pyctools.components.arithmetic
import pyctools.components.qt.qtdisplay
import pyctools.components.zone.zoneplatege... | |
<|file_name|>stage_2.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File written by pyctools-editor. Do not edit.
import argparse
import logging
from pyctools.core.compound import Compound
import pyctools.components.arithmetic
import pyctools.components.qt.qtdisplay
import pyctools.components.zone.zoneplatege... | components = \
{ 'clipper': { 'class': 'pyctools.components.arithmetic.Arithmetic',
'config': "{'func': '16+((data > 180)*219)'}",
'pos': (200.0, 200.0)},
'clipper2': { 'class': 'pyctools.components.arithmetic.Arithmetic',
'config': "{'func': '16+(... |
<|file_name|>stage_2.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File written by pyctools-editor. Do not edit.
import argparse
import logging
from pyctools.core.compound import Compound
import pyctools.components.arithmetic
import pyctools.components.qt.qtdisplay
import pyctools.components.zone.zoneplatege... | comps = {}
for name, component in self.components.items():
comps[name] = eval(component['class'])(config=eval(component['config']))
return Compound(linkages=self.linkages, **comps) |
<|file_name|>stage_2.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File written by pyctools-editor. Do not edit.
import argparse
import logging
from pyctools.core.compound import Compound
import pyctools.components.arithmetic
import pyctools.components.qt.qtdisplay
import pyctools.components.zone.zoneplatege... | from PyQt5 import QtCore, QtWidgets
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
app = QtWidgets.QApplication([])
comp = Network().make()
cnf = comp.get_config()
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
cnf.parser_... |
<|file_name|>stage_2.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# File written by pyctools-editor. Do not edit.
import argparse
import logging
from pyctools.core.compound import Compound
import pyctools.components.arithmetic
import pyctools.components.qt.qtdisplay
import pyctools.components.zone.zoneplatege... | make |
<|file_name|>generate-chains.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
<|fim▁hole|>"""Valid certificate chain where the target certificate con... | |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | for i in xrange(N): |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
<|fim_middle|>
if __name__ =... | def setUp(self):
self.nn = FLANN(log_level="warning")
################################################################################
# The typical
def test_nn_2d_10pt(self):
self.__nd_random_test_autotune(2, 2)
def test_nn_autotune_2d_1000pt(self):
self.__nd_... |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
<|fim_middle|... | self.nn = FLANN(log_level="warning") |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | self.__nd_random_test_autotune(2, 2) |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | self.__nd_random_test_autotune(2, 1000) |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | self.__nd_random_test_autotune(100, 1000) |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | self.__nd_random_test_autotune(500, 100) |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | self.__nd_random_test_autotune(1, 1) |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | if type(arg)!=list:
return [arg]
else:
return arg |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | """
Make a set of random points, then pass the same ones to the
query points. Each point should be closest to itself.
"""
seed(0)
x = rand(N, dim)
xq = rand(N, dim)
perm = permutation(N)
# compute ground truth nearest neighbors
gt_idx, gt... |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | return [arg] |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | return arg |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | unittest.main() |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def <|fim_middle|>(self):
self... | setUp |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | test_nn_2d_10pt |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | test_nn_autotune_2d_1000pt |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | test_nn_autotune_100d_1000pt |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | test_nn_autotune_500d_100pt |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | test_nn_stress_1d_1pt_kmeans_autotune |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | __ensure_list |
<|file_name|>test_nn_autotune.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
from os.path import *
import os
from pyflann import *
from copy import copy
from numpy import *
from numpy.random import *
import unittest
class Test_PyFLANN_nn(unittest.TestCase):
def setUp(self):
self.nn = FLA... | __nd_random_test_autotune |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>from django.conf.urls.defaults import *
urlpatterns = patterns('member.views',
url(r'^$', 'login', name='passport_index'),<|fim▁hole|> url(r'^forget/$', 'forget', name='passport_forget'),
url(r'^profile/$', 'profile', name='passport_profile'),
)<|fim▁end|> | url(r'^register/$', 'register', name='passport_register'),
url(r'^login/$', 'login', name='passport_login'),
url(r'^logout/$', 'logout', name='passport_logout'),
url(r'^active/$', 'active', name='passport_active'), |
<|file_name|>brian2_benchmark_CUBA_nosyn_250.py<|end_file_name|><|fim▁begin|>"""
# Notes:
- This simulation seeks to emulate the CUBA benchmark simulations of (Brette
et al. 2007) using the Brian2 simulator for speed benchmark comparison to
DynaSim. However, this simulation does NOT include synapses, for better
... | eqs = Equations('''
dv/dt = ((v-El))/taum : volt |
<|file_name|>density_calc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import math
fin = open('figs/single-rod-in-water.dat', 'r')
fout = open('figs/single-rods-calculated-density.dat', 'w')
kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin
first = 1
nm = 18.8972613
for line in fin... | |
<|file_name|>density_calc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import math
fin = open('figs/single-rod-in-water.dat', 'r')
fout = open('figs/single-rods-calculated-density.dat', 'w')
kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin
first = 1
nm = 18.8972613
for line in fin... | r2 = float(pieces[0])/2*nm
E2 = float(pieces[1])
first = 0 |
<|file_name|>density_calc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import math
fin = open('figs/single-rod-in-water.dat', 'r')
fout = open('figs/single-rods-calculated-density.dat', 'w')
kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin
first = 1
nm = 18.8972613
for line in fin... | if ((float(pieces[0])/2*nm - r2) > 0.25):
r1 = r2
r2 = float(pieces[0])/2*nm
E1 = E2
E2 = float(pieces[1]) # actually it's energy per unit length!
length = 1 # arbitrary
r = (r1 + r2)/2
dEdR = (E2-E1)/(r2-r1)*length
... |
<|file_name|>density_calc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import math
fin = open('figs/single-rod-in-water.dat', 'r')
fout = open('figs/single-rods-calculated-density.dat', 'w')
kB = 3.16681539628059e-6 # This is Boltzmann's constant in Hartree/Kelvin
first = 1
nm = 18.8972613
for line in fin... | r1 = r2
r2 = float(pieces[0])/2*nm
E1 = E2
E2 = float(pieces[1]) # actually it's energy per unit length!
length = 1 # arbitrary
r = (r1 + r2)/2
dEdR = (E2-E1)/(r2-r1)*length
area = 2*math.pi*r*length
force = dEdR... |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | image = cv_bridge.imgmsg_to_cv(imagemsg, 'mono8')
#
# Blur the image.
#
cv.Smooth(image, image, cv.CV_GAUSSIAN)
#
# Allocate some storage for the haar detect operation.
#
storage = cv.CreateMemStorage(0)
#
# Call the face detector function.
#
faces = cv.HaarDete... |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | rospy.init_node('face_detector', anonymous=True)
#
# Load the haar cascade. Note we get the
# filename from the "classifier" parameter
# that is configured in the launch script.
#
cascadeFileName = rospy.get_param("~classifier")
cascade = cv.Load(cascadeFileName)
rospy.Subscribe... |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | for (i, n) in faces:
x = int(i[0])
y = int(i[1])
width = int(i[2])
height = int(i[3])
cv.Rectangle(image,
(x, y),
(x + width, y + height),
cv.CV_RGB(0,255,0), 3, 8, 0)
... |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | publisher = rospy.Publisher('face_view', Image)
coord_publisher = rospy.Publisher('face_coords', PointStamped)
listener(publisher, coord_publisher) |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | callback |
<|file_name|>detector.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#*********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2011 andrewtron3000
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or wit... | listener |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
<|fi... | class TestUserBlueprint(BaseTestCase): |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | def test_correct_login(self):
# Ensure login behaves correctly with correct credentials.
with self.client:
response = self.client.post(
"/login",
data=dict(email="ad@min.com", password="admin_user"),
follow_redirects=True,
)
... |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
response = self.client.post(
"/login",
data=dict(email="ad@min.com", password="admin_user"),
follow_redirects=True,
)
self.assertIn(b"Welcome", response.data)
self.assertIn(b"Logout", response.data)... |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
self.client.post(
"/login",
data=dict(email="ad@min.com", password="admin_user"),
follow_redirects=True,
)
response = self.client.get("/logout", follow_redirects=True)
self.assertIn(b"You were logge... |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | response = self.client.get("/logout", follow_redirects=True)
self.assertIn(b"Please log in to access this page", response.data) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | response = self.client.get("/members", follow_redirects=True)
self.assertIn(b"Please log in to access this page", response.data) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | form = LoginForm(email="ad@min.com", password="admin_user")
self.assertTrue(form.validate()) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | form = LoginForm(email="unknown", password="example")
self.assertFalse(form.validate()) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
self.client.post(
"/login",
data=dict(email="ad@min.com", password="admin_user"),
follow_redirects=True,
)
self.assertTrue(current_user.id == 1) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
self.client.post(
"/login",
data=dict(email="ad@min.com", password="admin_user"),
follow_redirects=True,
)
user = User.query.filter_by(email="ad@min.com").first()
self.assertIsInstance(user.register... |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | user = User.query.filter_by(email="ad@min.com").first()
self.assertTrue(
bcrypt.check_password_hash(user.password, "admin_user")
)
self.assertFalse(bcrypt.check_password_hash(user.password, "foobar")) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
response = self.client.post(
"/login",
data=dict(email="ad@min.com", password="foo_bar"),
follow_redirects=True,
)
self.assertIn(b"Invalid email and/or password.", response.data) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | response = self.client.get("/register", follow_redirects=True)
self.assertIn(b"<h1>Register</h1>\n", response.data) |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | with self.client:
response = self.client.post(
"/register",
data=dict(
email="test@tester.com",
password="testing",
confirm="testing",
),
follow_redirects=True,
)
... |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | unittest.main() |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_correct_login |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_logout_behaves_correctly |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_logout_route_requires_login |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_member_route_requires_login |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_validate_success_login_form |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_validate_invalid_email_format |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_get_by_id |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_registered_on_defaults_to_datetime |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_check_password |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_validate_invalid_password |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_register_route |
<|file_name|>test_user.py<|end_file_name|><|fim▁begin|># project/server/tests/test_user.py
import datetime
import unittest
from flask_login import current_user
from base import BaseTestCase
from project.server import bcrypt
from project.server.models import User
from project.server.user.forms import LoginForm
cla... | test_user_registration |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | except:
if settings.TEMPLATE_DEBUG:
raise |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
<|fim_middle|>
register.tag('view', ViewNode... | def __init__(self, parser, token):
self.args = []
self.kwargs = {}
tokens = token.split_contents()
if len(tokens) < 2:
raise TemplateSyntaxError("%r tag requires one or more arguments" % token.contents.split()[0])
tag_name = tokens.pop(0)
self.url_or_view... |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
<|f... | self.args = []
self.kwargs = {}
tokens = token.split_contents()
if len(tokens) < 2:
raise TemplateSyntaxError("%r tag requires one or more arguments" % token.contents.split()[0])
tag_name = tokens.pop(0)
self.url_or_view = tokens.pop(0)
for token in t... |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | print('render view tag...')
if 'request' not in context:
return ""
request = context['request']
# get the url for the view
url = Variable(self.url_or_view).resolve(context)
if not settings.USE_AJAX_REQUESTS:
# do not load the whole template, just ... |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | raise TemplateSyntaxError("%r tag requires one or more arguments" % token.contents.split()[0]) |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | self.args.append(token) |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | self.kwargs[str(token[:equals])] = token[equals + 1:] |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | return "" |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | urlconf = getattr(request, "urlconf", settings.ROOT_URLCONF)
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
# get the view function
view, args, kwargs = resolver.resolve(url)
try:
if callable(view):
ret = view(con... |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | ret = view(context['request'], *args, **kwargs).render()
return ret.rendered_content |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | raise |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | print('return js code for jquery')
return """<div id="%(div_id)s">loading ...</div>
<script>
$.get( "%(url)s", function( data ) {
$( "#%(div_id)s" ).html( data );
});
</script>""" % {'div_id': url.replace("/", ""), 'url': url} |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def <|fim_middle|>(self, parser, token):
... | __init__ |
<|file_name|>view_tag.py<|end_file_name|><|fim▁begin|>from django.template import Library, Node, TemplateSyntaxError, Variable
from django.conf import settings
from django.core import urlresolvers
import hashlib
import re
register = Library()
class ViewNode(Node):
def __init__(self, parser, token):
sel... | render |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... |
# Automatically add untrusted hosts (make sure okay for security policy in your environment) |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | module = AnsibleModule(
argument_spec=dict(
outputfile=dict(required=True),
host=dict(required=True),
username=dict(required=True),
password=dict(required=True, no_log=True),
enablePassword=dict(required=False, no_log=True),
deviceType=... |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | module.fail_json(msg='paramiko is required for this module') |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | module.exit_json(changed=True, msg="Switch Startup Config is Reset to factory settings ") |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | module.fail_json(msg=errorMsg) |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | main() |
<|file_name|>cnos_factory.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
#
# Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or mo... | main |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaugh... | self.is_compiled = True |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
<|fim_middle|>
<|fim▁end|> | def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaughter2Woman_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HUnitDaughter2Woman_ConnectedLHS, self).__init__(name='HUnitDaughter2Woman_ConnectedLHS', num_nodes=0, edges=[])
# Add t... |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
<|fim_middle|>
# define evaluation methods for each match class.
... | """
Creates the himesis graph representing the AToM3 model HUnitDaughter2Woman_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HUnitDaughter2Woman_ConnectedLHS, self).__init__(name='HUnitDaughter2Woman_ConnectedLHS', num_nodes=0, edges=[])
# Add the edges
self.add_e... |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaugh... | return True |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaugh... | return True |
<|file_name|>HUnitDaughter2Woman_ConnectedLHS.py<|end_file_name|><|fim▁begin|>from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitDaughter2Woman_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitDaugh... | return attr_value == "daughters" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.