prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | import sys, re
args = sys.argv[1:]
iptfile = args and args[0] or "Python/graminit.c"
if len(args) > 1: optfile = args[1]
else: optfile = "Lib/keyword.py"
# scan the source file for keywords
fp = open(iptfile)
strprog = re.compile('"([^"]+)"')
lines = []
while 1:
... |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | optfile = args[1] |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | optfile = "Lib/keyword.py" |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | break |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | match = strprog.search(line)
if match:
lines.append(" '" + match.group(1) + "',\n") |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | lines.append(" '" + match.group(1) + "',\n") |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | main() |
<|file_name|>keyword.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
pyth... | main |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|><|fim▁hole|>#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public Licens... | #!/usr/bin/env python
# -*- coding: utf-8 -*- |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | string = '-' + string + '-'
for rexp, confidence, span_adjust in video_rexps:
match = re.search(sep + rexp + sep, string, re.IGNORECASE)
if match:
metadata = match.groupdict()
# is this the better place to put it? (maybe, as it is at least
# the soonest that w... |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | SingleNodeGuesser(guess_video_rexps, None, log).process(mtree) |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | metadata = match.groupdict()
# is this the better place to put it? (maybe, as it is at least
# the soonest that we can catch it)
if metadata.get('cdNumberTotal', -1) is None:
del metadata['cdNumberTotal']
span = (match.start() + span_adjust[0],... |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | del metadata['cdNumberTotal'] |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | guess_video_rexps |
<|file_name|>guess_video_rexps.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2012 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of th... | process |
<|file_name|>cpower1200_rss.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
RSS Reader for C-Power 1200
Copyright 2010-2012 Michael Farrell <http://micolous.id.au/>
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published b... | # send to sign
#s.send_text(0, header, effect=EFFECT_NONE) |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]<|fim▁hole|> obj = obj[key]
obj[last] = value
return g
de... |
def g(obj,value):
for key in head : |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
<|fim_middle|>
def keygetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
return lambda obj : resolve_key(obj, key)
def resolve_key(obj, key):
for name in key.split('.'):
obj ... | if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
obj[last] = value
return g |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
<|fim_middle|>
return g
def keygetter(key)... | for key in head :
obj = obj[key]
obj[last] = value |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
... | if not isinstance(key, str):
raise TypeError('key name must be a string')
return lambda obj : resolve_key(obj, key) |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
... | for name in key.split('.'):
obj = obj[name]
return obj |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
<|fim_middle|>
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
obj[last] = value... | raise TypeError('key name must be a string') |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
... | raise TypeError('key name must be a string') |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def <|fim_middle|>(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]... | keysetter |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def <|fim_middle|>(obj,value):
for key in head :
obj = ... | g |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
... | keygetter |
<|file_name|>operator.py<|end_file_name|><|fim▁begin|>
def keysetter(key):
if not isinstance(key, str):
raise TypeError('key name must be a string')
resolve = key.split('.')
head, last = tuple(resolve[:-1]), resolve[-1]
def g(obj,value):
for key in head :
obj = obj[key]
... | resolve_key |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if ... | return head
p1 = head; p2 = head
for _ in xrange(k): |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
<|fim_middle|>
from utils import *
printlist(Solution().rotateRight(makelist(1,2 ,3 ,4 ,5), 2))<|fim▁... | def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if not head: return None
p = head
listLen = 0 # calculate list length
while p:
p = p.next
listLen += 1
k = k % listLen # now k < listLen
if k == 0:
return head
p1 = head; p2 = head
for ... |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def rotateRight(self, head, k):
<|fim_middle|>
from utils import *
printlist(Solution().rotateRight... | """
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if not head: return None
p = head
listLen = 0 # calculate list length
while p:
p = p.next
listLen += 1
k = k % listLen # now k < listLen
if k == 0:
return head
p1 = head; p2 = head
for _ in xrange(k):
p2 = p2.next ... |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if ... | return None |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def rotateRight(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
if ... | return head |
<|file_name|>61. Rotate List.py<|end_file_name|><|fim▁begin|># Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def <|fim_middle|>(self, head, k):
"""
:type head: ListNode
:type k: int
:rtype: ListNode
"""
... | rotateRight |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:<|fim... | |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
<|fim_middle|>
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
linesplit = line.strip().split()
if len(linesplit) == 3:
assert(linesplit[0] == 'p')
print('p ... | if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
<|fim_middle|>
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdi... | return s[1:] |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
<|fim_middle|>
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
l... | return '-' + s[1:] |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
<|fim_middle|>
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:... | return '-' + s |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
<|fim_middle|>
for line in sys.stdin:
linesplit = line.strip().s... | print 'Usage:', sys.argv[0]
sys.exit(1) |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
li... | assert(linesplit[0] == 'p')
print('p ' + inv(linesplit[2]) + ' ' + linesplit[1]) |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
li... | assert(linesplit[0] == 's')
print('s ' + \
inv(linesplit[2]) + ' ' + linesplit[1] + ' ' + \
inv(linesplit[4]) + ' ' + linesplit[3] ) |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def inv(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.stdin:
li... | print |
<|file_name|>lsprotate90.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys
def <|fim_middle|>(s):
if s[0] == '-':
return s[1:]
elif s[0] == '+':
return '-' + s[1:]
else: # plain number
return '-' + s
if len(sys.argv) != 1:
print 'Usage:', sys.argv[0]
sys.exit(1)
for line in sys.... | inv |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | other_names = random.sample(WORDS, snippet.count("***"))
results = []
param_names = [] |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | class_names = [w.capitalize() for w in
random.sample(WORDS, snippet.count("%%%"))]
other_names = random.sample(WORDS, snippet.count("***"))
results = []
param_names = []
for i in range(0, snippet.count("@@@")):
param_count = random.randint(1,3)
param_names.append(', '.join(random.sample(WORDS, param_count))... |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | PHRASE_FIRST = True |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | PHRASE_FIRST = False |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | question, answer = answer, question |
<|file_name|>oop_test.py<|end_file_name|><|fim▁begin|>import random
from urllib import urlopen
import sys
WORD_URL = "http://learncodethehardway.org/words.txt"
WORDS = []
PHRASES = {
"class %%%(%%%):":
"Make a class named %%% that is-a %%%.",
"class %%%(object):\n\tdef __init__(self, ***)" :
"class %%% has-a __... | convert |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
def setUp(self):
super().s... | self.task1 = self.env["project.task"].create(
{"name": "name1", "project_id": self.project1.id} |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
<|fim_middle|>
<|fim▁end|> | def setUp(self):
super().setUp()
self.project1 = self.env["project.project"].create({"name": "Project 1"})
self.task1 = self.env["project.task"].create(
{"name": "name1", "project_id": self.project1.id}
)
self.subtask1 = self.env["project.task"].create(
... |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
def setUp(self):
<|fim_mid... | super().setUp()
self.project1 = self.env["project.project"].create({"name": "Project 1"})
self.task1 = self.env["project.task"].create(
{"name": "name1", "project_id": self.project1.id}
)
self.subtask1 = self.env["project.task"].create(
{"name": "2", "pro... |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
def setUp(self):
super().s... | self.task1.action_duplicate_subtasks()
new_task = self.env["project.task"].search(
[("name", "ilike", self.task1.name), ("name", "ilike", "copy")]
)
self.assertEqual(
len(new_task.child_ids), 2, "Two subtasks should have been created"
) |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
def <|fim_middle|>(self):
... | setUp |
<|file_name|>test_project_duplicate_subtask.py<|end_file_name|><|fim▁begin|># Copyright (C) 2021 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
from odoo.tests.common import TransactionCase
class TestProjectDuplicateSubtask(TransactionCase):
def setUp(self):
super().s... | test_check_subtasks |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | if os.environ.get("FOOBAR_ENV") == 'prod': |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | """Return context dict for a shell session so you can access
app, db, and the User model by default.
"""
return {'app': app, 'db': db, 'User': User} |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | """Run the tests."""
import pytest
exit_code = pytest.main([TEST_PATH, '--verbose'])
return exit_code |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | app = create_app(ProdConfig) |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | app = create_app(DevConfig) |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | manager.run() |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | _make_context |
<|file_name|>manage.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from foobar.app import create_app
from foobar.user.models import User
from foobar.set... | test |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | return
for entrypoint in pkg_resources.iter_entry_points(STYLE_ENTRY_POINT): |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | if pkg_resources is None:
return
for entrypoint in pkg_resources.iter_entry_points(LEXER_ENTRY_POINT):
yield entrypoint.load() |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | if pkg_resources is None:
return
for entrypoint in pkg_resources.iter_entry_points(FORMATTER_ENTRY_POINT):
yield entrypoint.name, entrypoint.load() |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | if pkg_resources is None:
return
for entrypoint in pkg_resources.iter_entry_points(STYLE_ENTRY_POINT):
yield entrypoint.name, entrypoint.load() |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | if pkg_resources is None:
return
for entrypoint in pkg_resources.iter_entry_points(FILTER_ENTRY_POINT):
yield entrypoint.name, entrypoint.load() |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | return |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | return |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | return |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | return |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | find_plugin_lexers |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | find_plugin_formatters |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | find_plugin_styles |
<|file_name|>plugin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
... | find_plugin_filters |
<|file_name|>fbcode_builder_config.py<|end_file_name|><|fim▁begin|><|fim▁hole|>from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build Facebook Thrift'
import specs.fbthrift as fbthrift
def fbc... | #!/usr/bin/env python |
<|file_name|>fbcode_builder_config.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build Facebook Thrift'
import specs.fbthrift as fbthrift... | return {
'depends_on': [fbthrift],
} |
<|file_name|>fbcode_builder_config.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build Facebook Thrift'
import specs.fbthrift as fbthrift... | fbcode_builder_spec |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | class CourseEnrollmentModeCSVViewTests(SwitchMixin, CourseCSVTestMixin, TestCase):
viewname = 'courses:csv:enrollment'
column_headings = ['count', 'course_id', 'date', 'audit', 'honor', 'professional', 'verified']
base_file_name = 'enrollment' |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | client = None
column_headings = None
base_file_name = None
def assertIsValidCSV(self, course_id, csv_data):
response = self.client.get(self.path(course_id=course_id))
# Check content type
self.assertResponseContentType(response, 'text/csv')
# Check filename
csv... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | response = self.client.get(self.path(course_id=course_id))
# Check content type
self.assertResponseContentType(response, 'text/csv')
# Check filename
csv_prefix = u'edX-DemoX-Demo_2014' if course_id == DEMO_COURSE_ID else u'edX-DemoX-Demo_Course'
filename = '{0}--{1}.cs... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | self.assertEqual(response['Content-Type'], content_type) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | self.assertEqual(response['Content-Disposition'], 'attachment; filename="{0}"'.format(filename)) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | with mock.patch(self.api_method, return_value=csv_data):
self.assertIsValidCSV(course_id, csv_data) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | csv_data = convert_list_of_dicts_to_csv([], self.column_headings)
self._test_csv(course_id, csv_data) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | csv_data = self.get_mock_data(course_id)
csv_data = convert_list_of_dicts_to_csv(csv_data)
self._test_csv(course_id, csv_data) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | course_id = 'fakeOrg/soFake/Fake_Course'
self.grant_permission(self.user, course_id)
path = reverse(self.viewname, kwargs={'course_id': course_id})
with mock.patch(self.api_method, side_effect=NotFoundError):
response = self.client.get(path, follow=True)
self.ass... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment_geography'
column_headings = ['count', 'country', 'course_id', 'date']
base_file_name = 'enrollment-location'
api_method = 'analyticsclient.course.Course.enrollment'
def get_mock_data(self, course_id):
return get_mock_api_enrollment_geography_data(course_i... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | return get_mock_api_enrollment_geography_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment'
column_headings = ['count', 'course_id', 'date']
base_file_name = 'enrollment'
api_method = 'analyticsclient.course.Course.enrollment'
def get_mock_data(self, course_id):
return get_mock_api_enrollment_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | return get_mock_api_enrollment_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment'
column_headings = ['count', 'course_id', 'date', 'audit', 'honor', 'professional', 'verified']
base_file_name = 'enrollment'
api_method = 'analyticsclient.course.Course.enrollment'
@classmethod
def setUpClass(cls):
cls.toggle_switch('display_verified_... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | cls.toggle_switch('display_verified_enrollment', True) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | return get_mock_api_enrollment_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment_demographics_age'
column_headings = ['birth_year', 'count', 'course_id', 'created', 'date']
base_file_name = 'enrollment-by-birth-year'
api_method = 'analyticsclient.course.Course.enrollment'
def get_mock_data(self, course_id):
return get_mock_api_enrollme... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | return get_mock_api_enrollment_age_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment_demographics_education'
column_headings = ['count', 'course_id', 'created', 'date', 'education_level.name', 'education_level.short_name']
base_file_name = 'enrollment-by-education'
api_method = 'analyticsclient.course.Course.enrollment'
def get_mock_data(self, cou... |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | return get_mock_api_enrollment_education_data(course_id) |
<|file_name|>test_csv.py<|end_file_name|><|fim▁begin|>from ddt import ddt, data
from django.core.urlresolvers import reverse
from django.test import TestCase
import mock
from analyticsclient.exceptions import NotFoundError
from courses.tests import SwitchMixin
from courses.tests.test_views import ViewTestMixin, DEMO_C... | viewname = 'courses:csv:enrollment_demographics_gender'
column_headings = ['count', 'course_id', 'created', 'date', 'gender']
base_file_name = 'enrollment-by-gender'
api_method = 'analyticsclient.course.Course.enrollment'
def get_mock_data(self, course_id):
return get_mock_api_enrollment_ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.