prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def <|fim_middle|>(a,b):
result=a/b
print result
def areatriangulo(base,altura):
result2=(base*altura)/2
print result2
def cast():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":"Die... | division |
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def <|fim_middle|>(base,altura):
result2=(base*altura)/2
print result2
def cast():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":"Diego","... | areatriangulo |
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def areatriangulo(base,altura):
result2=(base*altura)/2
print result2
def <|fim_middle|>():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":... | cast |
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def areatriangulo(base,altura):
result2=(base*altura)/2
print result2
def cast():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":"Diego","k... | __init__ |
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def areatriangulo(base,altura):
result2=(base*altura)/2
print result2
def cast():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":"Diego","k... | hola |
<|file_name|>archivo.py<|end_file_name|><|fim▁begin|>import urllib2
def sumaDos():
print 10*20
def division(a,b):
result=a/b
print result
def areatriangulo(base,altura):
result2=(base*altura)/2
print result2
def cast():
lista=[1,2,3,"hola"]
tupla=(1,2,3)
diccinario={"key1":"Diego","k... | esMayor |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
<|fim▁hole|> def parse_record(self, metadata, line):
factors = line.split('|')
... | |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
<|fim_middle|>
<|fim▁end|> | def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(factors) < 7:
return
registry, cc, type_, start, value, dete, status = factors[:7]
if type_ not in ('ipv4', 'ipv6'):
return
... |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
<|fim_middle|>
def parse_record(self, metadata, line):
factors = line.split('|')
if len(facto... | self.store = store |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
<|fim_middle|>
def do(self, fp):
... | factors = line.split('|')
if len(factors) < 7:
return
registry, cc, type_, start, value, dete, status = factors[:7]
if type_ not in ('ipv4', 'ipv6'):
return
return Record(metadata, start, type_, value, cc) |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | metadata = None
for line in fp:
line = line[:-1]
if line.startswith('#') or line.endswith('summary'):
continue
if metadata is None:
version, registry, serial, records,\
startdate, enddate, utcoffset = line.split('|... |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | return |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | return |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | continue |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | version, registry, serial, records,\
startdate, enddate, utcoffset = line.split('|')[:7]
metadata = Metadata(registry, version, serial)
continue |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | continue |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def <|fim_middle|>(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if ... | __init__ |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def <|fim_middle|>(self, metadata, line):
factors = line.split('|')
if len(... | parse_record |
<|file_name|>parser.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
from .record import (
Metadata,
Record,
)
__all__ = ['Parser']
class Parser:
def __init__(self, store):
self.store = store
def parse_record(self, metadata, line):
factors = line.split('|')
if len(fa... | do |
<|file_name|>forms.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from django import forms
# future use<|fim▁end|> | |
<|file_name|>demo3.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def termcheck(child, timeout=0):
time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)<|fim▁hole|> e... | |
<|file_name|>demo3.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def termcheck(child, timeout=0):
<|fim_middle|>
def termkey(child, stream, screen, key, timeout=0):
logging.debug("Sending '%s' to child"%key)
child.send(key)
s = ter... | time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)
except pexpect.exceptions.TIMEOUT:
logging.debug("Hit timeout and have %d characters in child.before"%len(child.before))
return child.before |
<|file_name|>demo3.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def termcheck(child, timeout=0):
time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)
except pexpe... | logging.debug("Sending '%s' to child"%key)
child.send(key)
s = termcheck(child)
logging.debug("Sending child.before text to vt102 stream")
stream.process(child.before)
logging.debug("vt102 screen dump")
logging.debug(screen) |
<|file_name|>demo3.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def <|fim_middle|>(child, timeout=0):
time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)
except ... | termcheck |
<|file_name|>demo3.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import pexpect
import sys
import logging
import vt102
import os
import time
def termcheck(child, timeout=0):
time.sleep(0.05)
try:
logging.debug("Waiting for EOF or timeout=%d"%timeout)
child.expect(pexpect.EOF, timeout=timeout)
except pexpe... | termkey |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... |
@task
def launch_instance_from_app_a_image(): |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''run ls command on local machine.'''
local('ls -la') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''run ls command on local machine.'''
local('ps ax') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | import sys
print(sys.path) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''sleep 5 second.'''
print('stop 5 sec...')
time.sleep(5)
print('5 sec... passed') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''print setting from staging.vars and common.vars'''
print(_settings) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | _deploy_template_sample_a(_settings.sample_template_vars.sample_a) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''eg. launch instance from app a image.'''
print('launch_instance_from_app_a_image') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''eg. search latest app type a instance and set fabric env.'''
print('set_env_latest_app_a') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''eg. search latest app type b instance and set fabric env.'''
print('set_env_latest_app_b') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''eg. launch instance from app b image.'''
print('launch_instance_from_app_b_image') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | u'''eg. production specific setting'''
print('production_specific_setting') |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | ls |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | ps |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | sys_path |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | sleep |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | printsetting |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | deploy_template_sample_a |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | launch_instance_from_app_a_image |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | set_env_latest_app_a |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | set_env_latest_app_b |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | launch_instance_from_app_b_image |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding:utf8 -*-
from fabric.api import task, run, local, cd, hosts, env
import time
from oozappa.config import get_config, procure_common_functions
_settings = get_config()
procure_common_functions()
import sys
from common_multiple_fabric_environment impor... | production_specific_setting |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | Create a user for use in a test.
As usernames are optional in newer versions of Django, it only sets it
if exists. |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | """
Grant permissions to the passed user
:param permissions: e.g. ['partner.dashboard_access']
"""
for permission in permissions:
app_label, __, codename = permission.partition('.')
perm = Permission.objects.get(content_type__app_label=app_label,
... |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | is_staff = False
is_anonymous = False
is_superuser = False
username = 'testuser'
email = 'testuser@buymore.com'
password = 'somefancypassword'
permissions = []
def setUp(self):
self.user = None
if not self.is_anonymous:
self.user = self.create_user(
... |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.user = None
if not self.is_anonymous:
self.user = self.create_user(
self.username, self.email, self.password)
self.user.is_staff = self.is_staff
add_permissions(self.user, self.permissions)
self.user.save() |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | """
Create a user for use in a test.
As usernames are optional in newer versions of Django, it only sets it
if exists.
"""
kwargs = {'email': email, 'password': password}
if 'username' in User._meta.get_all_field_names():
kwargs['username'] = username... |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | kwargs.setdefault('user', self.user)
return self.app.get(url, **kwargs) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | kwargs.setdefault('user', self.user)
return self.app.post(url, **kwargs) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertTrue(response.status_code in (
http_client.FOUND, http_client.MOVED_PERMANENTLY))
if expected_url:
location = URL.from_string(response['Location'])
self.assertEqual(expected_url, location.path()) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertTrue(str(response.status_code).startswith('3'))
location = response.headers['Location']
redirect_path = location.replace('http://localhost:80', '')
self.assertEqual(reverse(url_name), redirect_path) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertContext(response)
self.assertTrue(response.status_code in (http_client.NOT_FOUND,
http_client.FORBIDDEN)) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertIsRedirect(response)
location = response['Location'].replace('http://testserver', '')
self.assertEqual(location, reverse(name, kwargs=kwargs)) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertEqual(http_client.OK, response.status_code) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertTrue(response.context is not None,
'No context was returned') |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.assertContext(response)
self.assertTrue(key in response.context,
"Context should contain a variable '%s'" % key) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | self.user = self.create_user(
self.username, self.email, self.password)
self.user.is_staff = self.is_staff
add_permissions(self.user, self.permissions)
self.user.save() |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | kwargs['username'] = username |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | location = URL.from_string(response['Location'])
self.assertEqual(expected_url, location.path()) |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | add_permissions |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | setUp |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | create_user |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | get |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | post |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertIsRedirect |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertRedirectsTo |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertNoAccess |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertRedirectUrlName |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertIsOk |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertContext |
<|file_name|>testcases.py<|end_file_name|><|fim▁begin|>from django.utils.six.moves import http_client
from django.core.urlresolvers import reverse
from django.contrib.auth.models import Permission
from django_webtest import WebTest
from purl import URL
from oscar.core.compat import get_user_model
User = get_user_mo... | assertInContext |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|><|fim▁hole|>"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed... | """
Contains CheesePreprocessor |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|>"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... | """
Adds a cheese tag to the resources object
"""
def __init__(self, **kw):
"""
Public constructor
"""
super(CheesePreprocessor, self).__init__(**kw)
def preprocess(self, nb, resources):
"""
Sphinx preprocessing to apply on each notebook.
... |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|>"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... | """
Public constructor
"""
super(CheesePreprocessor, self).__init__(**kw) |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|>"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... | """
Sphinx preprocessing to apply on each notebook.
Parameters
----------
nb : NotebookNode
Notebook being converted
resources : dictionary
Additional resources used in the conversion process. Allows
preprocessors to pass vari... |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|>"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... | __init__ |
<|file_name|>cheese.py<|end_file_name|><|fim▁begin|>"""
Contains CheesePreprocessor
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPY... | preprocess |
<|file_name|>getting_started_test.py<|end_file_name|><|fim▁begin|># Copyright 2015, Google, Inc.
# 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.... | |
<|file_name|>getting_started_test.py<|end_file_name|><|fim▁begin|># Copyright 2015, Google, Inc.
# 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.... | main(cloud_config.project)
out, _ = capsys.readouterr()
assert re.search(re.compile(
r'Query Results:.hamlet', re.DOTALL), out) |
<|file_name|>getting_started_test.py<|end_file_name|><|fim▁begin|># Copyright 2015, Google, Inc.
# 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.... | test_main |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | """Return a JSON formatted representation of value, a Python object.
:param unpicklable: If set to False then the output will not contain the
information necessary to turn the JSON data back into Python objects,
but a simpler JSON stream is produced.
:param max_depth: If set to a non-negati... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | """Convert a JSON string into a Python object.
The keyword argument 'keys' defaults to False.
If set to True then jsonpickle will decode non-string dictionary keys
into python objects via the jsonpickle protocol.
>>> str(decode('"my string"'))
'my string'
>>> decode('36')
36
"""
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | backend = json |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | backend = json |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | encode |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- paulett.org)
# Copyright (C) 2009, 2011, 2013 David Aguilar (davvid -at- gmail.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have ... | decode |
<|file_name|>test_wikidata.py<|end_file_name|><|fim▁begin|>def test_signal_wikidata_url(ranker):
rank = lambda url: ranker.client.get_signal_value_from_url("wikidata_url", url)
<|fim▁hole|><|fim▁end|> | assert rank("http://www.douglasadams.com") > 0.5
assert rank("http://www.douglasadams.com/?a=b") > 0.5
assert rank("http://www.douglasadams.com/page2") == 0. # TODO, check domain?
assert rank("http://www.paulherbert.com/") == 0. |
<|file_name|>test_wikidata.py<|end_file_name|><|fim▁begin|>
def test_signal_wikidata_url(ranker):
<|fim_middle|>
<|fim▁end|> | rank = lambda url: ranker.client.get_signal_value_from_url("wikidata_url", url)
assert rank("http://www.douglasadams.com") > 0.5
assert rank("http://www.douglasadams.com/?a=b") > 0.5
assert rank("http://www.douglasadams.com/page2") == 0. # TODO, check domain?
assert rank("http://www.paulherbert.co... |
<|file_name|>test_wikidata.py<|end_file_name|><|fim▁begin|>
def <|fim_middle|>(ranker):
rank = lambda url: ranker.client.get_signal_value_from_url("wikidata_url", url)
assert rank("http://www.douglasadams.com") > 0.5
assert rank("http://www.douglasadams.com/?a=b") > 0.5
assert rank("http://www.douglasa... | test_signal_wikidata_url |
<|file_name|>admin.py<|end_file_name|><|fim▁begin|>from django.contrib import admin
#from .models import Tag
#import sys
#import importlib
#importlib.reload(sys)<|fim▁hole|><|fim▁end|> | #admin.site.register(Tag)
# Register your models here. |
<|file_name|>run.py<|end_file_name|><|fim▁begin|>from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from game import app
<|fim▁hole|>http_server.listen(5000)
IOLoop.instance().start()<|fim▁end|> | http_server = HTTPServer(WSGIContainer(app)) |
<|file_name|>ext.py<|end_file_name|><|fim▁begin|>import json
import logging
from foxglove import glove
from httpx import Response
from .settings import Settings
logger = logging.getLogger('ext')
def lenient_json(v):
if isinstance(v, (str, bytes)):
try:
return json.loads(v)
except (Va... | r = await glove.http.request(method, url, json=data or None, **kwargs)
if isinstance(allowed_statuses, int): |
<|file_name|>ext.py<|end_file_name|><|fim▁begin|>import json
import logging
from foxglove import glove
from httpx import Response
from .settings import Settings
logger = logging.getLogger('ext')
def lenient_json(v):
<|fim_middle|>
class ApiError(RuntimeError):
def __init__(self, method, url, status, resp... | if isinstance(v, (str, bytes)):
try:
return json.loads(v)
except (ValueError, TypeError):
pass
return v |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.