Instruction stringlengths 362 7.83k | output_code stringlengths 1 945 |
|---|---|
Based on the snippet: <|code_start|> def __init__(self, expr):
self.expr = expr
class SeqOp(ASTNode):
_slots = ('value',)
def __init__(self, value):
self.value = value
class Stmt(ASTNode):
_slots = ('value',)
def __init__(self, value):
self.value = value
class Term(ASTNode):
_slots = ('left', 'op', 'right')
def __init__(self, left, op, right):
self.left = left
self.op = op
self.right = right
class UnaryOp(ASTNode):
_slots = ('op', 'right')
<|code_end|>
, predict the immediate next line with the help of imports:
from luna.ast.base import ASTNode
and context (classes, functions, sometimes code) from other files:
# Path: luna/ast/base.py
# class ASTNode(object):
# _slots = tuple()
#
# # Equality
#
# def __lenient_eq(self, a, b):
# '''Compare a and b. If either is Lazy it will succeed.'''
#
# if type(b) == Lazy:
# return b == a
#
# return a == b
#
# def __eq__(self, other):
# # succeed early if we found Lazy, no need to recurse
# if type(self) == Lazy or type(other) == Lazy:
# return True
#
# # is the type equal?
# if not self.__class__ == other.__class__:
# return False
#
# my_children = [i for i in self]
# other_children = [i for i in other]
#
# # is child arity equal?
# if not len(my_children) == len(other_children):
# return False
#
# # are the children equal?
# pairs = zip(my_children, other_children)
# tests = [self.__lenient_eq(a, b) for (a, b) in pairs]
# if not all(tests):
# return False
#
# return True
#
# def __ne__(self, other):
# return not self.__eq__(other)
#
# # Iterator
#
# def __iter__(self):
# for slot in self._slots:
# yield getattr(self, slot, None)
#
# # Representation
#
# def __repr__(self):
# children = [repr(i) for i in self]
# children = ', '.join(children)
# return '%s(%s)' % (
# self.__class__.__name__,
# children,
# )
#
# def pp(self, tabsize=2):
# def dotab(s, indent):
# tab = ' ' * indent * tabsize
# ss = s.split('\n')
# ss = ['%s%s' % (tab, s) for s in ss]
# return '\n'.join(ss)
#
# def rec(node, indent):
# if (node is None
# or type(node) in [int]
# or isinstance(node, six.string_types)):
# return repr(node)
#
# children = [rec(ch, indent) for ch in node]
#
# s_children = ''
# if children:
# children = [dotab(ch, indent+1) for ch in children]
# children = ',\n'.join(children)
# s_children = '\n' + children + '\n'
#
# fmt = '%(prefix)s(%(children)s%(suffix)s' % {
# 'children': s_children,
# 'prefix': node.__class__.__name__,
# 'suffix': ')',
# }
#
# return fmt
#
# return rec(self, 0)
. Output only the next line. | def __init__(self, op, right): |
Predict the next line for this snippet: <|code_start|>
class Boolean(ASTNode):
_slots = ('value',)
def __init__(self, value):
if not value in ['true', 'false']:
raise ValueError
self.value = value
class Identifier(ASTNode):
<|code_end|>
with the help of current file imports:
from luna.ast.base import ASTNode
and context from other files:
# Path: luna/ast/base.py
# class ASTNode(object):
# _slots = tuple()
#
# # Equality
#
# def __lenient_eq(self, a, b):
# '''Compare a and b. If either is Lazy it will succeed.'''
#
# if type(b) == Lazy:
# return b == a
#
# return a == b
#
# def __eq__(self, other):
# # succeed early if we found Lazy, no need to recurse
# if type(self) == Lazy or type(other) == Lazy:
# return True
#
# # is the type equal?
# if not self.__class__ == other.__class__:
# return False
#
# my_children = [i for i in self]
# other_children = [i for i in other]
#
# # is child arity equal?
# if not len(my_children) == len(other_children):
# return False
#
# # are the children equal?
# pairs = zip(my_children, other_children)
# tests = [self.__lenient_eq(a, b) for (a, b) in pairs]
# if not all(tests):
# return False
#
# return True
#
# def __ne__(self, other):
# return not self.__eq__(other)
#
# # Iterator
#
# def __iter__(self):
# for slot in self._slots:
# yield getattr(self, slot, None)
#
# # Representation
#
# def __repr__(self):
# children = [repr(i) for i in self]
# children = ', '.join(children)
# return '%s(%s)' % (
# self.__class__.__name__,
# children,
# )
#
# def pp(self, tabsize=2):
# def dotab(s, indent):
# tab = ' ' * indent * tabsize
# ss = s.split('\n')
# ss = ['%s%s' % (tab, s) for s in ss]
# return '\n'.join(ss)
#
# def rec(node, indent):
# if (node is None
# or type(node) in [int]
# or isinstance(node, six.string_types)):
# return repr(node)
#
# children = [rec(ch, indent) for ch in node]
#
# s_children = ''
# if children:
# children = [dotab(ch, indent+1) for ch in children]
# children = ',\n'.join(children)
# s_children = '\n' + children + '\n'
#
# fmt = '%(prefix)s(%(children)s%(suffix)s' % {
# 'children': s_children,
# 'prefix': node.__class__.__name__,
# 'suffix': ')',
# }
#
# return fmt
#
# return rec(self, 0)
, which may contain function names, class names, or code. Output only the next line. | _slots = ('value',) |
Given snippet: <|code_start|> try:
return self.vars.index(luavalue)
except ValueError:
self.vars.append(luavalue)
return len(self.vars) - 1
def emit(self, opcode):
self.code.append(opcode)
def add_operand(self, val):
if type(val) == obj.LVar:
i = self.add_var(val)
self.emit(ops.LoadName(i))
else:
i = self.add_const(val)
self.emit(ops.LoadConst(i))
return i
def visit_assignment(self, node, vc):
left, [right] = vc
if right:
j = self.add_operand(right)
i = self.add_var(left)
self.emit(ops.StoreName(i))
def visit_arith(self, node, vc):
left, _, right = vc
op = node.op
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from luna import objects as obj
from luna.ast.visitors import GenericVisitor
from luna.vm import opcodes as ops
from luna.vm.frame import Frame
and context:
# Path: luna/objects.py
# class LuaValue(object):
# class LBoolean(LuaValue):
# class LNil(LuaValue):
# class LNumber(LuaValue):
# class LString(LuaValue):
# class LVar(LuaValue):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
#
# Path: luna/ast/visitors.py
# class GenericVisitor(object):
# def visit(self, node):
# if isinstance(node, six.string_types):
# return node
#
# clsname = node.__class__.__name__.lower()
# method = getattr(self, 'visit_%s' % clsname, self.generic_visit)
#
# vc = [self.visit(c) for c in node]
# return method(node, vc)
#
# def generic_visit(self, node, vc):
# raise NotImplementedError
#
# Path: luna/vm/opcodes.py
# class OpCode(object):
# class BinaryAdd(OpCode):
# class BinarySubtract(OpCode):
# class Call(OpCode):
# class LoadConst(OpCode):
# class LoadName(OpCode):
# class PopBlock(OpCode):
# class SetupDo(OpCode):
# class StoreName(OpCode):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, index):
# def __init__(self, index):
# def __init__(self, index):
#
# Path: luna/vm/frame.py
# class Frame(object):
# def __init__(self, code, consts, vars):
# self.code = code
# self.consts = consts
# self.vars = vars
#
# self.pc = 0
# self.env = {}
# self.stack = []
#
# def run(self):
# while self.pc < len(self.code):
# op = self.code[self.pc]
#
# if type(op) == ops.BinaryAdd:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value + x.value)
# self.stack.append(v)
#
# elif type(op) == ops.BinarySubtract:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value - x.value)
# self.stack.append(v)
#
# elif type(op) == ops.Call:
# func = self.stack.pop()
# arg = self.stack.pop()
# if type(arg) == obj.LVar:
# arg = self.env[arg]
# func(arg)
#
# elif type(op) == ops.LoadConst:
# self.stack.append(self.consts[op.index])
#
# elif type(op) == ops.LoadName:
# lvar = self.vars[op.index]
# value = self.env.get(lvar)
# if value is None:
# value = getattr(builtin, 'lua_' + lvar.value)
# self.stack.append(value)
#
# elif type(op) == ops.StoreName:
# var = self.vars[op.index]
# val = self.stack.pop()
# if type(val) == obj.LVar:
# val = self.env[val]
# self.env[var] = val
#
# self.pc += 1
#
# return self
which might include code, classes, or functions. Output only the next line. | if left: |
Based on the snippet: <|code_start|> def add_const(self, luavalue):
try:
return self.consts.index(luavalue)
except ValueError:
self.consts.append(luavalue)
return len(self.consts) - 1
def add_var(self, luavalue):
try:
return self.vars.index(luavalue)
except ValueError:
self.vars.append(luavalue)
return len(self.vars) - 1
def emit(self, opcode):
self.code.append(opcode)
def add_operand(self, val):
if type(val) == obj.LVar:
i = self.add_var(val)
self.emit(ops.LoadName(i))
else:
i = self.add_const(val)
self.emit(ops.LoadConst(i))
return i
def visit_assignment(self, node, vc):
left, [right] = vc
<|code_end|>
, predict the immediate next line with the help of imports:
from luna import objects as obj
from luna.ast.visitors import GenericVisitor
from luna.vm import opcodes as ops
from luna.vm.frame import Frame
and context (classes, functions, sometimes code) from other files:
# Path: luna/objects.py
# class LuaValue(object):
# class LBoolean(LuaValue):
# class LNil(LuaValue):
# class LNumber(LuaValue):
# class LString(LuaValue):
# class LVar(LuaValue):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
#
# Path: luna/ast/visitors.py
# class GenericVisitor(object):
# def visit(self, node):
# if isinstance(node, six.string_types):
# return node
#
# clsname = node.__class__.__name__.lower()
# method = getattr(self, 'visit_%s' % clsname, self.generic_visit)
#
# vc = [self.visit(c) for c in node]
# return method(node, vc)
#
# def generic_visit(self, node, vc):
# raise NotImplementedError
#
# Path: luna/vm/opcodes.py
# class OpCode(object):
# class BinaryAdd(OpCode):
# class BinarySubtract(OpCode):
# class Call(OpCode):
# class LoadConst(OpCode):
# class LoadName(OpCode):
# class PopBlock(OpCode):
# class SetupDo(OpCode):
# class StoreName(OpCode):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, index):
# def __init__(self, index):
# def __init__(self, index):
#
# Path: luna/vm/frame.py
# class Frame(object):
# def __init__(self, code, consts, vars):
# self.code = code
# self.consts = consts
# self.vars = vars
#
# self.pc = 0
# self.env = {}
# self.stack = []
#
# def run(self):
# while self.pc < len(self.code):
# op = self.code[self.pc]
#
# if type(op) == ops.BinaryAdd:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value + x.value)
# self.stack.append(v)
#
# elif type(op) == ops.BinarySubtract:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value - x.value)
# self.stack.append(v)
#
# elif type(op) == ops.Call:
# func = self.stack.pop()
# arg = self.stack.pop()
# if type(arg) == obj.LVar:
# arg = self.env[arg]
# func(arg)
#
# elif type(op) == ops.LoadConst:
# self.stack.append(self.consts[op.index])
#
# elif type(op) == ops.LoadName:
# lvar = self.vars[op.index]
# value = self.env.get(lvar)
# if value is None:
# value = getattr(builtin, 'lua_' + lvar.value)
# self.stack.append(value)
#
# elif type(op) == ops.StoreName:
# var = self.vars[op.index]
# val = self.stack.pop()
# if type(val) == obj.LVar:
# val = self.env[val]
# self.env[var] = val
#
# self.pc += 1
#
# return self
. Output only the next line. | if right: |
Given snippet: <|code_start|> self.consts = []
self.vars = []
self.binops = {
'+': ops.BinaryAdd,
'-': ops.BinarySubtract,
}
def compile(self, node):
self.visit(node)
return Frame(self.code, self.consts, self.vars)
def generic_visit(self, node, vc):
return vc
def add_const(self, luavalue):
try:
return self.consts.index(luavalue)
except ValueError:
self.consts.append(luavalue)
return len(self.consts) - 1
def add_var(self, luavalue):
try:
return self.vars.index(luavalue)
except ValueError:
self.vars.append(luavalue)
return len(self.vars) - 1
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from luna import objects as obj
from luna.ast.visitors import GenericVisitor
from luna.vm import opcodes as ops
from luna.vm.frame import Frame
and context:
# Path: luna/objects.py
# class LuaValue(object):
# class LBoolean(LuaValue):
# class LNil(LuaValue):
# class LNumber(LuaValue):
# class LString(LuaValue):
# class LVar(LuaValue):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
#
# Path: luna/ast/visitors.py
# class GenericVisitor(object):
# def visit(self, node):
# if isinstance(node, six.string_types):
# return node
#
# clsname = node.__class__.__name__.lower()
# method = getattr(self, 'visit_%s' % clsname, self.generic_visit)
#
# vc = [self.visit(c) for c in node]
# return method(node, vc)
#
# def generic_visit(self, node, vc):
# raise NotImplementedError
#
# Path: luna/vm/opcodes.py
# class OpCode(object):
# class BinaryAdd(OpCode):
# class BinarySubtract(OpCode):
# class Call(OpCode):
# class LoadConst(OpCode):
# class LoadName(OpCode):
# class PopBlock(OpCode):
# class SetupDo(OpCode):
# class StoreName(OpCode):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, index):
# def __init__(self, index):
# def __init__(self, index):
#
# Path: luna/vm/frame.py
# class Frame(object):
# def __init__(self, code, consts, vars):
# self.code = code
# self.consts = consts
# self.vars = vars
#
# self.pc = 0
# self.env = {}
# self.stack = []
#
# def run(self):
# while self.pc < len(self.code):
# op = self.code[self.pc]
#
# if type(op) == ops.BinaryAdd:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value + x.value)
# self.stack.append(v)
#
# elif type(op) == ops.BinarySubtract:
# x = self.stack.pop()
# y = self.stack.pop()
# v = obj.LNumber(y.value - x.value)
# self.stack.append(v)
#
# elif type(op) == ops.Call:
# func = self.stack.pop()
# arg = self.stack.pop()
# if type(arg) == obj.LVar:
# arg = self.env[arg]
# func(arg)
#
# elif type(op) == ops.LoadConst:
# self.stack.append(self.consts[op.index])
#
# elif type(op) == ops.LoadName:
# lvar = self.vars[op.index]
# value = self.env.get(lvar)
# if value is None:
# value = getattr(builtin, 'lua_' + lvar.value)
# self.stack.append(value)
#
# elif type(op) == ops.StoreName:
# var = self.vars[op.index]
# val = self.stack.pop()
# if type(val) == obj.LVar:
# val = self.env[val]
# self.env[var] = val
#
# self.pc += 1
#
# return self
which might include code, classes, or functions. Output only the next line. | def emit(self, opcode): |
Here is a snippet: <|code_start|>
def test_ass1(interp_stmt):
frame = interp_stmt('a = 1')
assert frame.env == {
obj.LVar('a'): obj.LNumber(1.0),
<|code_end|>
. Write the next line using the current file imports:
from luna import objects as obj
and context from other files:
# Path: luna/objects.py
# class LuaValue(object):
# class LBoolean(LuaValue):
# class LNil(LuaValue):
# class LNumber(LuaValue):
# class LString(LuaValue):
# class LVar(LuaValue):
# def __eq__(self, other):
# def __ne__(self, other):
# def __iter__(self):
# def __repr__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
# def __init__(self, value):
# def __hash__(self):
, which may include functions, classes, or code. Output only the next line. | } |
Next line prediction: <|code_start|>
self.commentStartExpression = QtCore.QRegExp("/\\*")
self.commentEndExpression = QtCore.QRegExp("\\*/")
#----------------------------------------------------------------------
def highlightBlock(self, text):
for pattern, format_ in self.highlightingRules:
expression = QtCore.QRegExp(pattern)
index = expression.indexIn(text)
while index >= 0:
length = expression.matchedLength()
self.setFormat(index, length, format_)
index = expression.indexIn(text, index + length)
#for pattern, format in self.highlightingRulesMatch:
#expression = QtCore.QRegExp(pattern)
##index = expression.indexIn(text)
#print expression.capturedTexts()
#while index >= 0:
#length = expression.matchedLength()
#self.setFormat(index, length, format)
#index = expression.indexIn(text, index + length)
self.buildComment(self.commentStartExpression,
self.commentEndExpression,
self.multiComment,
text)
#----------------------------------------------------------------------
<|code_end|>
. Use current file imports:
(from PySide2 import QtGui, QtCore, QtWidgets
from .syntax import Autocompleter)
and context including class names, function names, or small code snippets from other files:
# Path: pinguino/qtgui/ide/custom_widgets/code_editor/syntax.py
. Output only the next line. | def buildComment(self, start, end, format_, text): |
Predict the next line after this snippet: <|code_start|>
HEAD = os.getenv("PINGUINO_NAME") + " " + os.getenv("PINGUINO_VERSION") + "\n" + "Python " + sys.version + " on " + sys.platform
HELP = QtWidgets.QApplication.translate("PythonShell", "Commands available:") + ' "clear", "restart"'
START = ">>> "
NEW_LINE = "... "
########################################################################
class PinguinoTextEdit(QtWidgets.QPlainTextEdit):
#----------------------------------------------------------------------
def __init__(self, widget=None, shell=True):
super(PinguinoTextEdit, self).__init__(widget)
self.shell = PythonShell()
self.setLineWrapMode(self.NoWrap)
if shell:
self.appendPlainText(HEAD)
self.appendPlainText(HELP)
self.appendPlainText(START)
self.extra_args = {}
self.load_historial()
self.index_historial = 0
<|code_end|>
using the current file's imports:
import os
import sys
import pickle
from PySide2 import QtCore, QtGui, QtWidgets
from .python_highlighter import Highlighter
from .python_shell import PythonShell
and any relevant context from other files:
# Path: pinguino/qtgui/ide/custom_widgets/plain_outputs/python_highlighter.py
# class Highlighter(QtGui.QSyntaxHighlighter):
#
# #----------------------------------------------------------------------
# def __init__(self, parent, extra=[], python=True):
# super(Highlighter, self).__init__(parent)
# color = QtGui.QColor
#
# self.highlightingRules = []
#
# if python:
# operators = QtGui.QTextCharFormat()
# operators.setFontWeight(QtGui.QFont.Bold)
# self.highlightingRules.append(("[()\[\]{}<>=\-\+\*\\%#!~&^,/]", operators))
#
# reserved = QtGui.QTextCharFormat()
# reserved.setForeground(color("#8ae234"))
# #self.highlightingRules.append(("\\b(None|False|True|def|class|for|while|pass|try|except|print|if)\\b", reserved))
# self.highlightingRules.append(("\\b({})\\b".format(RESERVED_PYTHON), reserved))
#
# if extra:
# start_command = QtGui.QTextCharFormat()
# start_command.setForeground(color("#729fcf"))
# self.highlightingRules.append((extra[0].replace(".", "\."), start_command))
#
# sdcc_error_01 = QtGui.QTextCharFormat()
# sdcc_error_01.setForeground(color("#ef292a"))
# self.highlightingRules.append(("ERROR: .*", sdcc_error_01))
#
# for msg, color_ in MESSAGES:
# debugger = QtGui.QTextCharFormat()
# debugger.setForeground(color(color_))
# self.highlightingRules.append(("\[{}\] .*".format(msg), debugger))
#
# for msg, color_ in EXCEPTIONS:
# debugger = QtGui.QTextCharFormat()
# debugger.setForeground(color(color_))
# self.highlightingRules.append(("\\b({})\\b".format(msg), debugger))
#
#
# #----------------------------------------------------------------------
# def highlightBlock(self, text):
# for pattern, format_ in self.highlightingRules:
# expression = QtCore.QRegExp(pattern)
# index = expression.indexIn(text)
# while index >= 0:
# length = expression.matchedLength()
# self.setFormat(index, length, format_)
# index = expression.indexIn(text, index + length)
#
# Path: pinguino/qtgui/ide/custom_widgets/plain_outputs/python_shell.py
# class PythonShell(object):
#
# #----------------------------------------------------------------------
# def __init__(self):
#
# self.statement_module = types.ModuleType("__main__")
# # self.statement_module.__builtins__ = builtins.__builtins__
#
# sys.modules['__main__'] = self.statement_module
# self.statement_module.__name__ = '__main__'
#
# #----------------------------------------------------------------------
# def run(self, command, log=None):
#
# if log is None: log = StringIO()
# sys.stdout = log
# sys.stderr = log
#
# try:
# compiled = compile(command, '<string>', 'single')
# exec(compiled, self.statement_module.__dict__)
#
# except: log.write(traceback.format_exc())
# # return log.getvalue()
#
# #----------------------------------------------------------------------
# def restart(self):
#
# self.__init__()
. Output only the next line. | self.multiline_commands = [] |
Based on the snippet: <|code_start|> menu.setStyleSheet("""
QMenu {
font-family: inherit;
font-weight: normal;
}
""")
menu.exec_(event.globalPos())
#----------------------------------------------------------------------
def step_font_size(self, delta):
cursor = self.textCursor()
font = self.font()
size = font.pointSize()
if delta > 0: size = size + 1
else: size = size - 1
if size < 0:
size = 0
self.selectAll()
font.setPointSize(size)
self.setFont(font)
self.setStyleSheet("""
QPlainTextEdit {{
<|code_end|>
, predict the immediate next line with the help of imports:
import os
import sys
import pickle
from PySide2 import QtCore, QtGui, QtWidgets
from .python_highlighter import Highlighter
from .python_shell import PythonShell
and context (classes, functions, sometimes code) from other files:
# Path: pinguino/qtgui/ide/custom_widgets/plain_outputs/python_highlighter.py
# class Highlighter(QtGui.QSyntaxHighlighter):
#
# #----------------------------------------------------------------------
# def __init__(self, parent, extra=[], python=True):
# super(Highlighter, self).__init__(parent)
# color = QtGui.QColor
#
# self.highlightingRules = []
#
# if python:
# operators = QtGui.QTextCharFormat()
# operators.setFontWeight(QtGui.QFont.Bold)
# self.highlightingRules.append(("[()\[\]{}<>=\-\+\*\\%#!~&^,/]", operators))
#
# reserved = QtGui.QTextCharFormat()
# reserved.setForeground(color("#8ae234"))
# #self.highlightingRules.append(("\\b(None|False|True|def|class|for|while|pass|try|except|print|if)\\b", reserved))
# self.highlightingRules.append(("\\b({})\\b".format(RESERVED_PYTHON), reserved))
#
# if extra:
# start_command = QtGui.QTextCharFormat()
# start_command.setForeground(color("#729fcf"))
# self.highlightingRules.append((extra[0].replace(".", "\."), start_command))
#
# sdcc_error_01 = QtGui.QTextCharFormat()
# sdcc_error_01.setForeground(color("#ef292a"))
# self.highlightingRules.append(("ERROR: .*", sdcc_error_01))
#
# for msg, color_ in MESSAGES:
# debugger = QtGui.QTextCharFormat()
# debugger.setForeground(color(color_))
# self.highlightingRules.append(("\[{}\] .*".format(msg), debugger))
#
# for msg, color_ in EXCEPTIONS:
# debugger = QtGui.QTextCharFormat()
# debugger.setForeground(color(color_))
# self.highlightingRules.append(("\\b({})\\b".format(msg), debugger))
#
#
# #----------------------------------------------------------------------
# def highlightBlock(self, text):
# for pattern, format_ in self.highlightingRules:
# expression = QtCore.QRegExp(pattern)
# index = expression.indexIn(text)
# while index >= 0:
# length = expression.matchedLength()
# self.setFormat(index, length, format_)
# index = expression.indexIn(text, index + length)
#
# Path: pinguino/qtgui/ide/custom_widgets/plain_outputs/python_shell.py
# class PythonShell(object):
#
# #----------------------------------------------------------------------
# def __init__(self):
#
# self.statement_module = types.ModuleType("__main__")
# # self.statement_module.__builtins__ = builtins.__builtins__
#
# sys.modules['__main__'] = self.statement_module
# self.statement_module.__name__ = '__main__'
#
# #----------------------------------------------------------------------
# def run(self, command, log=None):
#
# if log is None: log = StringIO()
# sys.stdout = log
# sys.stderr = log
#
# try:
# compiled = compile(command, '<string>', 'single')
# exec(compiled, self.statement_module.__dict__)
#
# except: log.write(traceback.format_exc())
# # return log.getvalue()
#
# #----------------------------------------------------------------------
# def restart(self):
#
# self.__init__()
. Output only the next line. | background-color: #000; |
Using the snippet: <|code_start|> done = False
while not done:
try:
ret = self.devhandle.interruptRead(PK2_INT_READ, INT_PKT_SZ)
### We ignore failures here because we're just polling for
### the return from the device
except:
pass
else:
done = True
return (ret[1] << 8) | ret[0]
#######################################################################
### I/O Probe Components
#######################################################################
### Generate the byte used to set the ICSP Pins
def gen_icsp_byte(self):
icsp_pins = 0
### Channel 1
if self.chan_io[1] == "Input":
icsp_pins = icsp_pins | PK2_IO_ICSP_1_IN
elif self.chan_val[1] == 1:
icsp_pins = icsp_pins | PK2_IO_ICSP_1_SET
### Channel 2
if self.chan_io[2] == "Input":
icsp_pins = icsp_pins | PK2_IO_ICSP_2_IN
elif self.chan_val[2] == 1:
<|code_end|>
, determine the next line of code. You have imports:
import sys
import os
from .uploader import baseUploader
and context (class names, function names, or code) available:
# Path: pinguino/qtgui/pinguino_core/uploader/uploader.py
# class baseUploader(object):
#
# # PyUSB Core module switch
# # ------------------------------------------------------------------
#
# PYUSB_USE_CORE = 0 # (0=legacy, 1=core)
#
# # Hex format record types
# # ------------------------------------------------------------------
# # Data_Record = 00
# # End_Of_File_Record = 01
# # Extended_Segment_Address_Record = 02
# # Start_Segment_Address_Record = 03
# # Extended_Linear_Address_Record = 04
# # Start_Linear_Address_Record = 05
#
# # Python3 compatibility (octals)
# Data_Record = 0o0
# End_Of_File_Record = 0o1
# Extended_Segment_Address_Record = 0o2
# Start_Segment_Address_Record = 0o3
# Extended_Linear_Address_Record = 0o4
# Start_Linear_Address_Record = 0o5
#
#
# # Error codes returned by various functions
# # ------------------------------------------------------------------
# ERR_NONE = 100
# ERR_CMD_ARG = 101
# ERR_CMD_UNKNOWN = 102
# ERR_DEVICE_NOT_FOUND = 103
# ERR_USB_INIT1 = 104
# ERR_USB_INIT2 = 105
# ERR_USB_OPEN = 106
# ERR_USB_WRITE = 107
# ERR_USB_READ = 108
# ERR_HEX_OPEN = 109
# ERR_HEX_STAT = 110
# ERR_HEX_MMAP = 111
# ERR_HEX_SYNTAX = 112
# ERR_HEX_CHECKSUM = 113
# ERR_HEX_RECORD = 114
# ERR_VERIFY = 115
# ERR_EOL = 116
# ERR_USB_ERASE = 117
#
# # Configuration
# # ------------------------------------------------------------------
#
# INTERFACE_ID = 0x00
# ACTIVE_CONFIG = 0x01
# VSC_ACTIVE_CONFIG = 0x02
#
# # ------------------------------------------------------------------
# def add_report(self, message):
# """ display message in the log window """
# self.report.append(message)
# logging.info(message)
#
# # ------------------------------------------------------------------
# def getDevice(self, board):
# """ Scans connected USB devices until it finds a Pinguino board """
#
# logging.info("Looking for a Pinguino device ...")
#
# if self.PYUSB_USE_CORE:
#
# device = usb.core.find(idVendor=board.vendor, idProduct=board.product)
# if device is None :
# return self.ERR_DEVICE_NOT_FOUND
# else :
# return device
#
# else:
#
# busses = usb.busses()
# for bus in busses:
# for device in bus.devices:
# if (device.idVendor, device.idProduct) == (board.vendor, board.product):
# return device
# return self.ERR_DEVICE_NOT_FOUND
#
# # ------------------------------------------------------------------
# def initDevice(self, device):
# """ Init a Pinguino device """
#
# #logging.info("OS is %s" % os.getenv("PINGUINO_OS_NAME"))
#
# if os.getenv("PINGUINO_OS_NAME") == "linux":
# if device.idProduct == 0x003C: #self.P32_ID:
# # make sure the hid kernel driver is not active
# # functionality not available on Darwin or Windows
# if self.PYUSB_USE_CORE:
# if device.is_kernel_driver_active(self.INTERFACE_ID):
# try:
# device.detach_kernel_driver(self.INTERFACE_ID)
# except usb.core.USBError as e:
# sys.exit("Could not detach kernel driver: %s" % str(e))
# else:
# try:
# handle.detachKernelDriver(self.INTERFACE_ID)
# except:
# #sys.exit("Could not detach kernel driver")
# pass
#
# #logging.info("Kernel driver detached")
#
#
# if self.PYUSB_USE_CORE:
# try:
# device.set_configuration(self.ACTIVE_CONFIG)
# except usb.core.USBError as e:
# sys.exit("Could not set configuration: %s" % str(e))
# #logging.info("Configuration set")
#
# try:
# usb.util.claim_interface(device, self.INTERFACE_ID)
# #print("Claimed device")
# except:
# sys.exit("Could not claim the device: %s" % str(e))
# #logging.info("Interface claimed")
#
# return device
#
# else:
# handle = device.open()
# if handle:
# handle.setConfiguration(self.ACTIVE_CONFIG)
# handle.claimInterface(self.INTERFACE_ID)
# return handle
# return ERR_USB_INIT1
#
# #logging.info("Everything OK so far")
#
# # ------------------------------------------------------------------
# def closeDevice(self, handle):
# """ Close currently-open USB device """
#
# if self.PYUSB_USE_CORE:
# usb.util.release_interface(handle, self.INTERFACE_ID)
# else:
# handle.releaseInterface()
. Output only the next line. | icsp_pins = icsp_pins | PK2_IO_ICSP_2_SET |
Next line prediction: <|code_start|>#!/usr/bin/env python
#-*- coding: utf-8 -*-
########################################################################
class InsertBlock(QtWidgets.QDialog):
def __init__(self, KIT):
super(InsertBlock, self).__init__()
self.insert = Ui_InsertBlock()
self.insert.setupUi(self)
self.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+self.windowTitle())
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/logo/art/windowIcon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.setWindowIcon(icon)
<|code_end|>
. Use current file imports:
(import os
from PySide2 import QtGui, QtCore, QtWidgets
from ...frames.insert_block import Ui_InsertBlock)
and context including class names, function names, or small code snippets from other files:
# Path: pinguino/qtgui/frames/insert_block.py
# class Ui_InsertBlock(object):
# def setupUi(self, InsertBlock):
# InsertBlock.setObjectName("InsertBlock")
# InsertBlock.resize(400, 107)
# self.gridLayout = QtWidgets.QGridLayout(InsertBlock)
# self.gridLayout.setContentsMargins(5, 5, 5, 5)
# self.gridLayout.setHorizontalSpacing(0)
# self.gridLayout.setVerticalSpacing(2)
# self.gridLayout.setObjectName("gridLayout")
# self.listWidget = QtGui.QListWidget(InsertBlock)
# self.listWidget.setObjectName("listWidget")
# self.gridLayout.addWidget(self.listWidget, 1, 0, 1, 2)
# self.lineEdit = QtWidgets.QLineEdit(InsertBlock)
# self.lineEdit.setObjectName("lineEdit")
# self.gridLayout.addWidget(self.lineEdit, 0, 0, 1, 2)
#
# self.retranslateUi(InsertBlock)
# QtCore.QMetaObject.connectSlotsByName(InsertBlock)
# InsertBlock.setTabOrder(self.lineEdit, self.listWidget)
#
# def retranslateUi(self, InsertBlock):
# InsertBlock.setWindowTitle(QtWidgets.QApplication.translate("InsertBlock", "Insert Block", None, QtWidgets.QApplication.UnicodeUTF8))
. Output only the next line. | self.graphical = KIT |
Continue the code snippet: <|code_start|>
class VideoDisplay(object):
"""Displays a Voctomix-Video-Stream into a GtkWidget"""
def __init__(self, video_drawing_area, audio_display, port, name, width=None, height=None,
play_audio=False):
self.log = logging.getLogger('VideoDisplay:%s' % name)
self.name = name
self.video_drawing_area = video_drawing_area
self.level_callback = audio_display.callback
video_decoder = None
# Setup Server-Connection, Demuxing and Decoding
pipe = """
tcpclientsrc
<|code_end|>
. Use current file imports:
import logging
import sys
from gi.repository import Gst, Gdk
from lib.args import Args
from lib.config import Config
from lib.clock import Clock
from vocto.port import Port
from vocto.debug import gst_generate_dot
from vocto.pretty import pretty
and context (classes, functions, or code) from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
#
# Path: vocto/debug.py
# def gst_generate_dot(pipeline, name):
# from lib.args import Args
# dotfile = os.path.join(os.environ['GST_DEBUG_DUMP_DOT_DIR'], "%s.dot" % name)
# log.debug("Generating DOT image of pipeline '{name}' into '{file}'".format(name=name, file=dotfile))
# Gst.debug_bin_to_dot_file(pipeline, Gst.DebugGraphDetails(Args.gst_debug_details), name)
#
# Path: vocto/pretty.py
# def pretty(pipe):
# result = ""
# for line in pipe.splitlines():
# line = line.strip()
# r = re.match(r'^(!\s.*)$', line)
# if r:
# result += " " + r.group(1)
# else:
# r = re.match(r'^([\w\-_]*\s*\=\s*.*)$', line)
# if r:
# result += " " + r.group(1)
# else:
# r = re.match(r'^(\))$', line)
# if r:
# result += r.group(1)
# else:
# r = re.match(r'^bin.\($', line)
# if r:
# result += line
# else:
# result += " " + line
# result += "\n"
# return result
. Output only the next line. | name=tcpsrc-{name} |
Given the code snippet: <|code_start|> ! glimagesinkelement
name=imagesink-{name}
""".format(name=name)
elif videosystem == 'xv':
pipe += """ ! xvimagesink
name=imagesink-{name}
""".format(name=name)
elif videosystem == 'x':
pipe += """ ! ximagesink
name=imagesink-{name}
""".format(name=name)
elif videosystem == 'vaapi':
pipe += """ ! vaapisink
name=imagesink-{name}
""".format(name=name)
else:
raise Exception(
'Invalid Videodisplay-System configured: %s' % videosystem
)
# add an Audio-Path through a level-Element
pipe += """
demux-{name}.
! queue
name=queue-audio-{name}
! level
<|code_end|>
, generate the next line using the imports in this file:
import logging
import sys
from gi.repository import Gst, Gdk
from lib.args import Args
from lib.config import Config
from lib.clock import Clock
from vocto.port import Port
from vocto.debug import gst_generate_dot
from vocto.pretty import pretty
and context (functions, classes, or occasionally code) from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
#
# Path: vocto/debug.py
# def gst_generate_dot(pipeline, name):
# from lib.args import Args
# dotfile = os.path.join(os.environ['GST_DEBUG_DUMP_DOT_DIR'], "%s.dot" % name)
# log.debug("Generating DOT image of pipeline '{name}' into '{file}'".format(name=name, file=dotfile))
# Gst.debug_bin_to_dot_file(pipeline, Gst.DebugGraphDetails(Args.gst_debug_details), name)
#
# Path: vocto/pretty.py
# def pretty(pipe):
# result = ""
# for line in pipe.splitlines():
# line = line.strip()
# r = re.match(r'^(!\s.*)$', line)
# if r:
# result += " " + r.group(1)
# else:
# r = re.match(r'^([\w\-_]*\s*\=\s*.*)$', line)
# if r:
# result += " " + r.group(1)
# else:
# r = re.match(r'^(\))$', line)
# if r:
# result += r.group(1)
# else:
# r = re.match(r'^bin.\($', line)
# if r:
# result += line
# else:
# result += " " + line
# result += "\n"
# return result
. Output only the next line. | name=lvl |
Given snippet: <|code_start|>#!/usr/bin/env python3
gi.require_version('GstController', '1.0')
class VideoMix(object):
log = logging.getLogger('VideoMix')
def __init__(self):
# read sources from confg file
self.bgSources = Config.getBackgroundSources()
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import logging
import gi
from configparser import NoOptionError
from enum import Enum, unique
from gi.repository import Gst
from lib.config import Config
from vocto.transitions import Composites, Transitions, Frame, fade_alpha
from lib.scene import Scene
from lib.overlay import Overlay
from lib.args import Args
from vocto.composite_commands import CompositeCommand
and context:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
#
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
which might include code, classes, or functions. Output only the next line. | self.sources = Config.getSources() |
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python3
gi.require_version('GstController', '1.0')
class VideoMix(object):
log = logging.getLogger('VideoMix')
def __init__(self):
# read sources from confg file
self.bgSources = Config.getBackgroundSources()
self.sources = Config.getSources()
self.log.info('Configuring mixer for %u source(s) and %u background source(s)', len(self.sources), len(self.bgSources))
# load composites from config
self.log.info("Reading transitions configuration...")
self.composites = Config.getComposites()
# load transitions from configuration
<|code_end|>
with the help of current file imports:
import logging
import gi
from configparser import NoOptionError
from enum import Enum, unique
from gi.repository import Gst
from lib.config import Config
from vocto.transitions import Composites, Transitions, Frame, fade_alpha
from lib.scene import Scene
from lib.overlay import Overlay
from lib.args import Args
from vocto.composite_commands import CompositeCommand
and context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
#
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
, which may contain function names, class names, or code. Output only the next line. | self.transitions = Config.getTransitions(self.composites) |
Given the following code snippet before the placeholder: <|code_start|> self.bin += """\
! identity
name=sig
! {vcaps}
! queue
max-size-time=3000000000
! tee
name=video-mix
""".format(
vcaps=Config.getVideoCaps()
)
for idx, background in enumerate(self.bgSources):
self.bin += """
video-{name}.
! queue
max-size-time=3000000000
name=queue-video-{name}
! videomixer.
""".format(name=background)
for idx, name in enumerate(self.sources):
self.bin += """
video-{name}.
! queue
max-size-time=3000000000
name=queue-cropper-{name}
! videobox
name=cropper-{name}
! queue
<|code_end|>
, predict the next line using imports from the current file:
import logging
import gi
from configparser import NoOptionError
from enum import Enum, unique
from gi.repository import Gst
from lib.config import Config
from vocto.transitions import Composites, Transitions, Frame, fade_alpha
from lib.scene import Scene
from lib.overlay import Overlay
from lib.args import Args
from vocto.composite_commands import CompositeCommand
and context including class names, function names, and sometimes code from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
#
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
. Output only the next line. | max-size-time=3000000000 |
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python3
gi.require_version('GstController', '1.0')
class VideoMix(object):
log = logging.getLogger('VideoMix')
def __init__(self):
# read sources from confg file
self.bgSources = Config.getBackgroundSources()
self.sources = Config.getSources()
self.log.info('Configuring mixer for %u source(s) and %u background source(s)', len(self.sources), len(self.bgSources))
# load composites from config
self.log.info("Reading transitions configuration...")
self.composites = Config.getComposites()
# load transitions from configuration
self.transitions = Config.getTransitions(self.composites)
self.scene = None
<|code_end|>
using the current file's imports:
import logging
import gi
from configparser import NoOptionError
from enum import Enum, unique
from gi.repository import Gst
from lib.config import Config
from vocto.transitions import Composites, Transitions, Frame, fade_alpha
from lib.scene import Scene
from lib.overlay import Overlay
from lib.args import Args
from vocto.composite_commands import CompositeCommand
and any relevant context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
#
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
. Output only the next line. | self.bgScene = None |
Given the following code snippet before the placeholder: <|code_start|> def get_video(self):
"""gets the current video-status, consisting of the name of
video-source A and video-source B"""
status = self.pipeline.vmix.getVideoSources()
return OkResponse('video_status', *status)
def set_video_a(self, src_name):
"""sets the video-source A to the supplied source-name or source-id,
swapping A and B if the supplied source is currently used as
video-source B"""
self.pipeline.vmix.setVideoSourceA(src_name)
status = self.pipeline.vmix.getVideoSources()
return NotifyResponse('video_status', *status)
def set_video_b(self, src_name):
"""sets the video-source B to the supplied source-name or source-id,
swapping A and B if the supplied source is currently used as
video-source A"""
self.pipeline.vmix.setVideoSourceB(src_name)
status = self.pipeline.vmix.getVideoSources()
return NotifyResponse('video_status', *status)
def _get_audio_status(self):
volumes = self.pipeline.amix.getAudioVolumes()
return json.dumps({
self.streams[idx]: round(volume, 4)
for idx, volume in enumerate(volumes)
<|code_end|>
, predict the next line using imports from the current file:
import logging
import json
import inspect
import os
from lib.config import Config
from lib.response import NotifyResponse, OkResponse
from lib.sources import restart_source
from vocto.composite_commands import CompositeCommand
from vocto.command_helpers import quote, dequote, str2bool
and context including class names, function names, and sometimes code from other files:
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
#
# Path: vocto/command_helpers.py
# def quote(str):
# ''' encode spaces and comma '''
# return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
#
# def dequote(str):
# ''' decode spaces and comma '''
# return None if not str else str.replace('\\n','\n').replace('\\c', ',').replace('\\v', '|').replace('\\s', ' ').replace('\\\\', '\\')
#
# def str2bool(str):
# return str.lower() in [ 'true', 'yes', 'visible', 'show', '1' ]
. Output only the next line. | }) |
Continue the code snippet: <|code_start|>#!/usr/bin/env python3
class ControlServerCommands(object):
def __init__(self, pipeline):
self.log = logging.getLogger('ControlServerCommands')
self.pipeline = pipeline
self.stored_values = {}
<|code_end|>
. Use current file imports:
import logging
import json
import inspect
import os
from lib.config import Config
from lib.response import NotifyResponse, OkResponse
from lib.sources import restart_source
from vocto.composite_commands import CompositeCommand
from vocto.command_helpers import quote, dequote, str2bool
and context (classes, functions, or code) from other files:
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
#
# Path: vocto/command_helpers.py
# def quote(str):
# ''' encode spaces and comma '''
# return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
#
# def dequote(str):
# ''' decode spaces and comma '''
# return None if not str else str.replace('\\n','\n').replace('\\c', ',').replace('\\v', '|').replace('\\s', ' ').replace('\\\\', '\\')
#
# def str2bool(str):
# return str.lower() in [ 'true', 'yes', 'visible', 'show', '1' ]
. Output only the next line. | self.sources = Config.getSources() |
Given snippet: <|code_start|>
composite_status = self.pipeline.vmix.getCompositeMode()
video_status = self.pipeline.vmix.getVideoSources()
return [
NotifyResponse('composite_mode', composite_status),
NotifyResponse('video_status', *video_status),
NotifyResponse('composite_mode_and_video_status',
composite_status, *video_status),
]
if Config.getBlinderEnabled():
def _get_stream_status(self):
blind_source = self.pipeline.blinder.blind_source
if blind_source is None:
return ('live',)
return 'blinded', self.blinder_sources[blind_source]
def get_stream_status(self):
"""gets the current blinder-status"""
status = self._get_stream_status()
return OkResponse('stream_status', *status)
def set_stream_blind(self, source_name):
"""sets the blinder-status to blinder with the specified
blinder-source-name or -id"""
src_id = self.blinder_sources.index(source_name)
self.pipeline.blinder.setBlindSource(src_id)
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import logging
import json
import inspect
import os
from lib.config import Config
from lib.response import NotifyResponse, OkResponse
from lib.sources import restart_source
from vocto.composite_commands import CompositeCommand
from vocto.command_helpers import quote, dequote, str2bool
and context:
# Path: vocto/composite_commands.py
# class CompositeCommand:
#
# def __init__(self, composite, A, B):
# self.composite = composite
# self.A = A
# self.B = B
#
# def from_str(command):
# A = None
# B = None
# # match case: c(A,B)
# r = re.match(
# r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*,\s*([-_\w*]+)\)\s*$', command)
# if r:
# A = r.group(2)
# B = r.group(3)
# else:
# # match case: c(A)
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*\(\s*([-_\w*]+)\s*\)\s*$', command)
# if r:
# A = r.group(2)
# else:
# # match case: c
# r = re.match(r'^\s*([|+-]?\w[-_\w]*)\s*$', command)
# assert r
# composite = r.group(1)
# if composite == '*':
# composite = None
# if A == '*':
# A = None
# if B == '*':
# B = None
# return CompositeCommand(composite,A,B)
#
# def modify(self, mod, reverse=False):
# # get command as string and process all replactions
# command = original = str(self)
# for r in mod.split(','):
# what, _with = r.split('->')
# if reverse:
# what, _with = _with, what
# command = command.replace(what.strip(), _with.strip())
# modified = original != command
# # re-convert string to command and take the elements
# command = CompositeCommand.from_str(command)
# self.composite = command.composite
# self.A = command.A
# self.B = command.B
# return modified
#
# def unmodify(self, mod):
# return self.modify(mod, True)
#
# def __str__(self):
# return "%s(%s,%s)" % (self.composite if self.composite else "*",
# self.A if self.A else "*",
# self.B if self.B else "*")
#
# def __eq__(self, other):
# return ((self.composite == other.composite or not(self.composite and other.composite))
# and (self.A == other.A or not(self.A and other.A))
# and (self.B == other.B or not(self.B and other.B)))
#
# Path: vocto/command_helpers.py
# def quote(str):
# ''' encode spaces and comma '''
# return None if not str else str.replace('\\', '\\\\').replace(' ','\\s').replace('|','\\v').replace(',','\\c').replace('\n','\\n')
#
# def dequote(str):
# ''' decode spaces and comma '''
# return None if not str else str.replace('\\n','\n').replace('\\c', ',').replace('\\v', '|').replace('\\s', ' ').replace('\\\\', '\\')
#
# def str2bool(str):
# return str.lower() in [ 'true', 'yes', 'visible', 'show', '1' ]
which might include code, classes, or functions. Output only the next line. | status = self._get_stream_status() |
Continue the code snippet: <|code_start|> except BlockingIOError:
pass
data = "".join(leftovers)
del leftovers[:]
lines = data.split('\n')
for line in lines[:-1]:
self.log.debug("got line: %r", line)
line = line.strip()
# 'quit' = remote wants us to close the connection
if line == 'quit' or line == 'exit':
self.log.info("Client asked us to close the Connection")
self.close_connection(conn)
return False
self.log.debug('re-starting on_loop scheduling')
GObject.idle_add(self.on_loop)
self.command_queue.put((line, conn))
if close_after:
self.close_connection(conn)
return False
if lines[-1] != '':
self.log.debug("remaining %r", lines[-1])
leftovers.append(lines[-1])
<|code_end|>
. Use current file imports:
import logging
from queue import Queue
from gi.repository import GObject
from lib.commands import ControlServerCommands
from lib.tcpmulticonnection import TCPMultiConnection
from lib.response import NotifyResponse
from vocto.port import Port
and context (classes, functions, or code) from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
. Output only the next line. | return True |
Based on the snippet: <|code_start|> self.mainloop.run()
except KeyboardInterrupt:
self.log.info('Terminated via Ctrl-C')
def quit(self):
self.log.info('Quitting.')
self.mainloop.quit()
# run mainclass
def main():
# parse command-line args
args.parse()
docolor = (Args.color == 'always') \
or (Args.color == 'auto' and sys.stderr.isatty())
handler = LogHandler(docolor, Args.timestamp)
logging.root.addHandler(handler)
levels = { 3 : logging.DEBUG, 2 : logging.INFO, 1 : logging.WARNING, 0 : logging.ERROR }
logging.root.setLevel(levels[Args.verbose])
gst_levels = { 3 : Gst.DebugLevel.DEBUG, 2 : Gst.DebugLevel.INFO, 1 : Gst.DebugLevel.WARNING, 0 : Gst.DebugLevel.ERROR }
gst_log_messages(gst_levels[Args.gstreamer_log])
# make killable by ctrl-c
logging.debug('setting SIGINT handler')
signal.signal(signal.SIGINT, signal.SIG_DFL)
<|code_end|>
, predict the immediate next line with the help of imports:
import gi
import sdnotify
import signal
import logging
import sys
from vocto.debug import gst_log_messages
from gi.repository import Gst, GLib
from lib.loghandler import LogHandler
from lib.pipeline import Pipeline
from lib.controlserver import ControlServer
from lib import args
from lib.args import Args
from lib import config
and context (classes, functions, sometimes code) from other files:
# Path: vocto/debug.py
# def gst_log_messages(level):
#
# gstLog = logging.getLogger('Gst')
#
# def log( level, msg ):
# if level == Gst.DebugLevel.WARNING:
# gstLog.warning(msg)
# if level == Gst.DebugLevel.FIXME:
# gstLog.warning(msg)
# elif level == Gst.DebugLevel.ERROR:
# gstLog.error(msg)
# elif level == Gst.DebugLevel.INFO:
# gstLog.info(msg)
# elif level == Gst.DebugLevel.DEBUG:
# gstLog.debug(msg)
#
# def logFunction(category, level, file, function, line, object, message, *user_data):
# global gst_log_messages_lastmessage, gst_log_messages_lastlevel, gst_log_messages_repeat
#
# msg = message.get()
# if gst_log_messages_lastmessage != msg:
# if gst_log_messages_repeat > 2:
# log(gst_log_messages_lastlevel,"%s [REPEATING %d TIMES]" % (gst_log_messages_lastmessage, gst_log_messages_repeat))
#
# gst_log_messages_lastmessage = msg
# gst_log_messages_repeat = 0
# gst_log_messages_lastlevel = level
# log(level,"%s: %s (in function %s() in file %s:%d)" % (object.name if object else "", msg, function, file, line))
# else:
# gst_log_messages_repeat += 1
#
#
# Gst.debug_remove_log_function(None)
# Gst.debug_add_log_function(logFunction,None)
# Gst.debug_set_default_threshold(level)
# Gst.debug_set_active(True)
. Output only the next line. | logging.info('Python Version: %s', sys.version_info) |
Predict the next line after this snippet: <|code_start|>
def __init__(self):
self.log = logging.getLogger('Voctogui')
# Load UI file
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui/voctogui.ui')
self.log.info('Loading ui-file from file %s', path)
if os.path.isfile(path):
self.ui = Ui(path)
else:
raise Exception("Can't find any .ui-Files to use in {}".format(path))
#
# search for a .css style sheet file and load it
#
css_provider = Gtk.CssProvider()
context = Gtk.StyleContext()
path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui/voctogui.css')
self.log.info('Loading css-file from file %s', path)
if os.path.isfile(path):
css_provider.load_from_path(path)
else:
raise Exception("Can't find .css file '{}'".format(path))
context.add_provider_for_screen(
Gdk.Screen.get_default(),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_USER
<|code_end|>
using the current file's imports:
import gi
import signal
import logging
import sys
import os
import lib.connection as Connection
import lib.connection as Connection
import lib.clock as ClockManager
from gi.repository import Gtk, Gdk, Gst, GstVideo
from vocto.debug import gst_log_messages
from lib.args import Args
from lib.ui import Ui
from lib import args
from lib.args import Args
from lib.loghandler import LogHandler
from lib import config
from lib.config import Config
and any relevant context from other files:
# Path: vocto/debug.py
# def gst_log_messages(level):
#
# gstLog = logging.getLogger('Gst')
#
# def log( level, msg ):
# if level == Gst.DebugLevel.WARNING:
# gstLog.warning(msg)
# if level == Gst.DebugLevel.FIXME:
# gstLog.warning(msg)
# elif level == Gst.DebugLevel.ERROR:
# gstLog.error(msg)
# elif level == Gst.DebugLevel.INFO:
# gstLog.info(msg)
# elif level == Gst.DebugLevel.DEBUG:
# gstLog.debug(msg)
#
# def logFunction(category, level, file, function, line, object, message, *user_data):
# global gst_log_messages_lastmessage, gst_log_messages_lastlevel, gst_log_messages_repeat
#
# msg = message.get()
# if gst_log_messages_lastmessage != msg:
# if gst_log_messages_repeat > 2:
# log(gst_log_messages_lastlevel,"%s [REPEATING %d TIMES]" % (gst_log_messages_lastmessage, gst_log_messages_repeat))
#
# gst_log_messages_lastmessage = msg
# gst_log_messages_repeat = 0
# gst_log_messages_lastlevel = level
# log(level,"%s: %s (in function %s() in file %s:%d)" % (object.name if object else "", msg, function, file, line))
# else:
# gst_log_messages_repeat += 1
#
#
# Gst.debug_remove_log_function(None)
# Gst.debug_add_log_function(logFunction,None)
# Gst.debug_set_default_threshold(level)
# Gst.debug_set_active(True)
. Output only the next line. | ) |
Here is a snippet: <|code_start|>
# time interval to re-fetch queue timings
TIMER_RESOLUTION = 5.0
COLOR_OK = ("white", "darkgreen")
COLOR_WARN = ("darkred", "darkorange")
COLOR_ERROR = ("white", "red")
class PortsWindowController():
def __init__(self, uibuilder):
self.log = logging.getLogger('QueuesWindowController')
# get related widgets
self.win = uibuilder.get_check_widget('ports_win')
self.store = uibuilder.get_check_widget('ports_store')
self.scroll = uibuilder.get_check_widget('ports_scroll')
self.title = uibuilder.get_check_widget('ports_title')
self.title.set_title("VOC2CORE {}".format(Config.getHost()))
# remember row iterators
self.iterators = None
# listen for queue_report from voctocore
Connection.on('port_report', self.on_port_report)
def on_port_report(self, *report):
def color(port):
<|code_end|>
. Write the next line using the current file imports:
import logging
import os
import json
import lib.connection as Connection
from gi.repository import Gtk, Gst, GLib
from lib.config import Config
from lib.uibuilder import UiBuilder
from vocto.port import Port
and context from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
, which may include functions, classes, or code. Output only the next line. | if port.connections > 0: |
Continue the code snippet: <|code_start|> if Args.cross:
# mark center lines
drawFg.line((size[X] / 2, 0, size[X] / 2, size[Y]),
fill=(0, 0, 0, 128))
drawFg.line((0, size[Y] / 2, size[X], size[Y] / 2),
fill=(0, 0, 0, 128))
# simulate swapping sources
a, b = composite.A(), composite.B()
if swap:
a, b = b, a
if Args.title:
draw_text(drawFg, size, 2, "(swapped sources)")
if Args.crop:
# draw source frame
drawA.rectangle(a.rect, outline=(128, 0, 0, a.alpha))
drawB.rectangle(b.rect, outline=(0, 0, 128, b.alpha))
# draw cropped source frame
drawA.rectangle(a.cropped(), fill=(128, 0, 0, a.alpha))
drawB.rectangle(b.cropped(), fill=(0, 0, 128, b.alpha))
# silly way to draw on RGBA frame buffer, hey - it's python
return Image.alpha_composite(
Image.alpha_composite(
Image.alpha_composite(imageBg, imageA), imageB), imageFg)
def draw_transition(size, transition, info=None):
# animation as a list of images
<|code_end|>
. Use current file imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and context (classes, functions, or code) from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | images = [] |
Predict the next line after this snippet: <|code_start|> r = re.match(
r'^\s*(\d+)\s*x\s*(\d+)\s*$', Args.size)
else:
r = re.match(
r'^.*width\s*=\s*(\d+).*height\s*=\s*(\d+).*$', config.get('mix', 'videocaps'))
if r:
size = [int(r.group(1)), int(r.group(2))]
# read frames per second
if Args.fps:
fps = int(Args.fps)
else:
r = re.match(
r'^\s*framerate\s*=\s*(\d+)/(\d+).*$', config.get('mix', 'videocaps'))
if r:
fps = float(r.group(1)) / float(r.group(2))
print (size, fps)
# read composites from configuration
log.info("reading composites from configuration...")
composites = Composites.configure(config.items('composites'), size)
log.debug("read %d composites:\n\t%s\t" %
(len(composites), '\n\t'.join(sorted(composites))))
# maybe overwirte targets by arguments
if Args.composite:
# check for composites in arguments
targets = [composites[c] for c in set(Args.composite)]
else:
# list of all relevant composites we like to target
targets = Composites.targets(composites)
intermediates = Composites.intermediates(composites)
# list targets and itermediates
<|code_end|>
using the current file's imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and any relevant context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | if Args.list: |
Predict the next line after this snippet: <|code_start|> parser.add_argument('-G', '--nogif', action='count',
help="when using -g: do not generate animated GIFS")
parser.add_argument('-v', '--verbose', action='count', default=0,
help="also print WARNING (-v), INFO (-vv) and DEBUG (-vvv) messages")
parser.add_argument('-s', '--size', action='store',
help="set frame size 'WxH' W and H must be pixels")
parser.add_argument('-S', '--fps', '--speed', action='store', default=25,
help="animation resolution (frames per second)")
Args = parser.parse_args()
# implicit options
if Args.nopng:
Args.nogif = 1
def init_log():
global Args, log
# set up logging
FORMAT = '%(message)s'
logging.basicConfig(format=FORMAT)
logging.root.setLevel([logging.ERROR, logging.WARNING,
logging.INFO, logging.DEBUG][Args.verbose])
log = logging.getLogger('Transitions Test')
def read_config(filename=None):
global log, Args
if not filename:
filename = Args.config
# load INI files
config = SafeConfigParser()
<|code_end|>
using the current file's imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and any relevant context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | config.read(filename) |
Next line prediction: <|code_start|>
def render_sequence(size, fps, sequence, transitions, composites):
global log
log.debug("rendering generated sequence (%d items):\n\t%s\t" %
(len(sequence), '\n\t'.join(sequence)))
# begin at first transition
prev_name = sequence[0]
prev = composites[prev_name]
# cound findings
not_found = []
found = []
# process sequence through all possible transitions
for c_name in sequence[1:]:
# fetch prev composite
c = composites[c_name]
# get the right transtion between prev and c
log.debug("request transition (%d/%d): %s → %s" %
(len(found) + 1, len(sequence) - 1, prev_name, c_name))
# actually search for a transitions that does a fade between prev and c
transition, swap = transitions.solve(prev, c, prev == c)
# count findings
if not transition:
# report fetched transition
log.warning("no transition found for: %s → %s" %
(prev_name, c_name))
not_found.append("%s -> %s" % (prev_name, c_name))
else:
# report fetched transition
<|code_end|>
. Use current file imports:
(from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse)
and context including class names, function names, or small code snippets from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | log.debug("transition found: %s\n%s" % |
Here is a snippet: <|code_start|> help="list of composites to generate transitions between (use all available if not given)")
parser.add_argument('-f', '--config', action='store', default="voctocore/default-config.ini",
help="name of the configuration file to load")
parser.add_argument('-m', '--map', action='count',
help="print transition table")
parser.add_argument('-l', '--list', action='count',
help="list available composites")
parser.add_argument('-g', '--generate', action='count',
help="generate animation")
parser.add_argument('-t', '--title', action='count', default=0,
help="draw composite names and frame count")
parser.add_argument('-k', '--keys', action='count', default=0,
help="draw key frames")
parser.add_argument('-c', '--corners', action='count', default=0,
help="draw calculated interpolation corners")
parser.add_argument('-C', '--cross', action='count', default=0,
help="draw image cross through center")
parser.add_argument('-r', '--crop', action='count', default=0,
help="draw image cropping border")
parser.add_argument('-n', '--number', action='count',
help="when using -g: use consecutively numbers as file names")
parser.add_argument('-P', '--nopng', action='count',
help="when using -g: do not write PNG files (forces -G)")
parser.add_argument('-L', '--leave', action='count',
help="when using -g: do not delete temporary PNG files")
parser.add_argument('-G', '--nogif', action='count',
help="when using -g: do not generate animated GIFS")
parser.add_argument('-v', '--verbose', action='count', default=0,
help="also print WARNING (-v), INFO (-vv) and DEBUG (-vvv) messages")
parser.add_argument('-s', '--size', action='store',
<|code_end|>
. Write the next line using the current file imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
, which may include functions, classes, or code. Output only the next line. | help="set frame size 'WxH' W and H must be pixels") |
Here is a snippet: <|code_start|> draw.text([x, y], text, font=font, fill=fill)
def draw_composite(size, composite, swap=False):
# indices in size and tsize
X, Y = 0, 1
# create an image to draw into
imageBg = Image.new('RGBA', size, (40, 40, 40, 255))
imageA = Image.new('RGBA', size, (0, 0, 0, 0))
imageB = Image.new('RGBA', size, (0, 0, 0, 0))
imageFg = Image.new('RGBA', size, (0, 0, 0, 0))
# create a drawing context
drawBg = ImageDraw.Draw(imageBg)
drawA = ImageDraw.Draw(imageA)
drawB = ImageDraw.Draw(imageB)
drawFg = ImageDraw.Draw(imageFg)
if Args.cross:
# mark center lines
drawFg.line((size[X] / 2, 0, size[X] / 2, size[Y]),
fill=(0, 0, 0, 128))
drawFg.line((0, size[Y] / 2, size[X], size[Y] / 2),
fill=(0, 0, 0, 128))
# simulate swapping sources
a, b = composite.A(), composite.B()
if swap:
a, b = b, a
if Args.title:
draw_text(drawFg, size, 2, "(swapped sources)")
<|code_end|>
. Write the next line using the current file imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and context from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
, which may include functions, classes, or code. Output only the next line. | if Args.crop: |
Based on the snippet: <|code_start|> help="draw calculated interpolation corners")
parser.add_argument('-C', '--cross', action='count', default=0,
help="draw image cross through center")
parser.add_argument('-r', '--crop', action='count', default=0,
help="draw image cropping border")
parser.add_argument('-n', '--number', action='count',
help="when using -g: use consecutively numbers as file names")
parser.add_argument('-P', '--nopng', action='count',
help="when using -g: do not write PNG files (forces -G)")
parser.add_argument('-L', '--leave', action='count',
help="when using -g: do not delete temporary PNG files")
parser.add_argument('-G', '--nogif', action='count',
help="when using -g: do not generate animated GIFS")
parser.add_argument('-v', '--verbose', action='count', default=0,
help="also print WARNING (-v), INFO (-vv) and DEBUG (-vvv) messages")
parser.add_argument('-s', '--size', action='store',
help="set frame size 'WxH' W and H must be pixels")
parser.add_argument('-S', '--fps', '--speed', action='store', default=25,
help="animation resolution (frames per second)")
Args = parser.parse_args()
# implicit options
if Args.nopng:
Args.nogif = 1
def init_log():
global Args, log
# set up logging
FORMAT = '%(message)s'
logging.basicConfig(format=FORMAT)
<|code_end|>
, predict the immediate next line with the help of imports:
from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse
and context (classes, functions, sometimes code) from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | logging.root.setLevel([logging.ERROR, logging.WARNING, |
Next line prediction: <|code_start|>def render_sequence(size, fps, sequence, transitions, composites):
global log
log.debug("rendering generated sequence (%d items):\n\t%s\t" %
(len(sequence), '\n\t'.join(sequence)))
# begin at first transition
prev_name = sequence[0]
prev = composites[prev_name]
# cound findings
not_found = []
found = []
# process sequence through all possible transitions
for c_name in sequence[1:]:
# fetch prev composite
c = composites[c_name]
# get the right transtion between prev and c
log.debug("request transition (%d/%d): %s → %s" %
(len(found) + 1, len(sequence) - 1, prev_name, c_name))
# actually search for a transitions that does a fade between prev and c
transition, swap = transitions.solve(prev, c, prev == c)
# count findings
if not transition:
# report fetched transition
log.warning("no transition found for: %s → %s" %
(prev_name, c_name))
not_found.append("%s -> %s" % (prev_name, c_name))
else:
# report fetched transition
log.debug("transition found: %s\n%s" %
(transition.name(), transition))
<|code_end|>
. Use current file imports:
(from configparser import SafeConfigParser
from vocto.transitions import Composites, Transitions, L, T, R, B, X, Y
from PIL import Image, ImageDraw, ImageFont
from subprocess import call
import sys
import copy
import re
import logging
import argparse)
and context including class names, function names, or small code snippets from other files:
# Path: vocto/transitions.py
# V = 2 # distance (velocity) index
# class Transitions:
# class Transition:
# def __init__(self, targets=[], fps=25):
# def __str__(self):
# def __len__(self):
# def count(self):
# def add(self,transition,frames):
# def configure(cfg, composites, targets=None, fps=25):
# def index(composite):
# def solve(self, begin, end, flip):
# def travel(composites, previous=None):
# def __init__(self, name, a=None, b=None):
# def __str__(self):
# def hidden( x, hidden ):
# def phi(self):
# def name(self):
# def append(self, composite):
# def frames(self): return len(self.composites)
# def A(self, n=None):
# def B(self, n=None):
# def Az(self, z0, z1):
# def Bz(self, z0, z1):
# def begin(self): return self.composites[0]
# def end(self): return self.composites[-1]
# def reversed(self):
# def swapped(self):
# def calculate_flip(self):
# def overlap(a, b):
# def calculate(self, frames, a_corner=(R, T), b_corner=(L, T)):
# def keys(self):
# def parse_asterisk(sequence, composites):
# def frange(x, y, jump):
# def bspline(points):
# def find_nearest(spline, points):
# def measure(points):
# def smooth(x):
# def distribute(points, positions, begin, end, x0, x1, n):
# def fade(begin, end, factor):
# def morph(begin, end, pt, corner, factor):
# def interpolate(key_frames, num_frames, corner):
# def is_in(sequence, part):
# def fade_alpha(frame,alpha,frames):
. Output only the next line. | found.append(transition.name()) |
Predict the next line for this snippet: <|code_start|> nothing else is happening (registered as GObject idle callback)'''
global command_queue
log.debug('on_loop called')
if command_queue.empty():
log.debug('command_queue is empty again, stopping on_loop scheduling')
return False
line, requestor = command_queue.get()
words = line.split()
if len(words) < 1:
log.debug('command_queue is empty again, stopping on_loop scheduling')
return True
signal = words[0]
args = words[1:]
if signal == "error":
log.error('received error: %s', line )
if signal not in signal_handlers:
return True
for handler in signal_handlers[signal]:
handler(*args)
return True
<|code_end|>
with the help of current file imports:
import logging
import socket
import json
import sys
from queue import Queue
from gi.repository import Gtk, GObject
from vocto.port import Port
and context from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
, which may contain function names, class names, or code. Output only the next line. | def send(command, *args): |
Continue the code snippet: <|code_start|> # Setup Preview Controller
self.video_previews = VideoPreviewsController(
self.find_widget_recursive(self.win, 'preview_box'),
audio_box,
win=self.win,
uibuilder=self
)
if Config.getPreviewsEnabled():
for idx, source in enumerate(Config.getSources()):
self.video_previews.addPreview(self, source,
Port.SOURCES_PREVIEW + idx)
elif Config.getMirrorsEnabled():
for idx, source in enumerate(Config.getMirrorsSources()):
self.video_previews.addPreview(
self, source, Port.SOURCES_OUT + idx)
else:
self.log.warning(
'Can not show source previews because neither previews nor mirrors are enabled (see previews/enabled and mirrors/enabled in core configuration)')
self.mix_audio_display = AudioDisplay(audio_box, "mix", uibuilder=self)
# Create Main-Video Display
self.mix_video_display = VideoDisplay(
self.find_widget_recursive(self.win, 'video_main'),
self.mix_audio_display,
port=Port.MIX_PREVIEW if Config.getPreviewsEnabled() else Port.MIX_OUT,
name="MIX"
)
for idx, livepreview in enumerate(Config.getLivePreviews()):
<|code_end|>
. Use current file imports:
import logging
from gi.repository import Gtk, Gdk
from lib.config import Config
from lib.uibuilder import UiBuilder
from lib.videodisplay import VideoDisplay
from lib.audioleveldisplay import AudioLevelDisplay
from lib.audiodisplay import AudioDisplay
from lib.videopreviews import VideoPreviewsController
from lib.queues import QueuesWindowController
from lib.ports import PortsWindowController
from lib.toolbar.mix import MixToolbarController
from lib.toolbar.preview import PreviewToolbarController
from lib.toolbar.overlay import OverlayToolbarController
from lib.toolbar.blinder import BlinderToolbarController
from lib.toolbar.misc import MiscToolbarController
from lib.studioclock import StudioClock
from vocto.port import Port
and context (classes, functions, or code) from other files:
# Path: vocto/port.py
# class Port(object):
#
# NONE = 0
#
# IN = 1
# OUT = 2
#
# OFFSET_PREVIEW = 100
# # core listening port
# CORE_LISTENING = 9999
# # input ports
# SOURCES_IN = 10000
# SOURCES_BACKGROUND = 16000
# SOURCE_OVERLAY= 14000
# SOURCES_BLANK = 17000
# AUDIO_SOURCE_BLANK = 18000
# # output ports
# MIX_OUT = 11000
# MIX_PREVIEW = MIX_OUT+OFFSET_PREVIEW
# SOURCES_OUT = 13000
# SOURCES_PREVIEW = SOURCES_OUT+OFFSET_PREVIEW
# LIVE_OUT = 15000
# LIVE_PREVIEW = LIVE_OUT+OFFSET_PREVIEW
#
# def __init__(self, name, source=None, audio=None, video=None):
# self.name = name
# self.source = source
# self.audio = audio
# self.video = video
# self.update()
#
# def todict(self):
# return {
# 'name': self.name,
# 'port': self.port,
# 'audio': self.audio,
# 'video': self.video,
# 'io': self.io,
# 'connections': self.connections
# }
#
# def update(self):
# if self.source:
# self.port = self.source.port()
# self.audio = self.source.audio_channels()
# self.video = self.source.video_channels()
# self.io = self.IN if self.source.is_input() else self.OUT
# self.connections = self.source.num_connections()
#
# def from_str(_str):
# p = Port(_str['name'])
# p.port = _str['port']
# p.audio = _str['audio']
# p.video = _str['video']
# p.io = _str['io']
# p.connections = _str['connections']
# return p
#
# def is_input(self):
# return self.io == Port.IN
#
# def is_output(self):
# return self.io == Port.OUT
. Output only the next line. | if Config.getPreviewsEnabled(): |
Next line prediction: <|code_start|># -*- coding: utf-8 -*-
"""
templatetricks.use_markdown
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using the markdown language
http://flask.pocoo.org/snippets/19/
"""
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
html_content = """
<html>
<|code_end|>
. Use current file imports:
(import os
import sys
import markdown
from flask import render_template_string, Markup
from app import app)
and context including class names, function names, or small code snippets from other files:
# Path: app.py
. Output only the next line. | <head> |
Given snippet: <|code_start|>
def get_redirect_target():
for target in request.values.get('next'), request.referrer:
if not target:
continue
if is_safe_url(target):
return target
def redirect_back(endpoint, **values):
target = request.form['next']
if not target or not is_safe_url(target):
target = url_for(endpoint, **values)
return redirect(target)
@app.route('/')
def index():
return 'index'
@app.route('/fsp')
def fsp():
return 'fsp'
@app.route('/login', methods=['GET', 'POST'])
def login():
next = get_redirect_target()
html_content = """
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import os
import sys
from urlparse import urlparse, urljoin
from flask import request, url_for, redirect
from flask import render_template_string
from app import app
and context:
# Path: app.py
which might include code, classes, or functions. Output only the next line. | <form action="" method=post> |
Here is a snippet: <|code_start|># -*- coding: utf-8 -*-
"""
templatetricks.generate_pdf
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Generating PDF from Flask template (using xhtml2pdf)
http://flask.pocoo.org/snippets/68/
"""
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
html_content = """
<html>
<head>
</head>
<body>
{% block body %}
<h2>Some page title.</h2>
<table width="100%" cellpadding="4" cellspacing="0">
<tbody>
<tr>
<td width="100%">Some text.</td>
</tr>
<|code_end|>
. Write the next line using the current file imports:
import os
import sys
from flask import request, Response, render_template, redirect, url_for
from flaskext.mail import Mail, Message
from xhtml2pdf import pisa
from StringIO import StringIO
from app import app
and context from other files:
# Path: app.py
, which may include functions, classes, or code. Output only the next line. | </tbody> |
Given the following code snippet before the placeholder: <|code_start|> utilities.cms_pages
~~~~~~~~~~~~~~~~~~~
CMS Pages
http://flask.pocoo.org/snippets/114/
"""
sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
class Page(Base):
__tablename__='pages'
id Column(Integer, primary_key=True)
name = Column(String())
page_snippets = relationship('PageSnippets', backref='pages', lazy='dynamic')
class PageSnippets('base')
__tablename__='page_snippets'
id Column(Integer, primary_key=True)
snippet = Column(String())
language = Column(String())
html_content = """
<p>{{page_snippets.intro}}</b>
<div class="footer">
<p>{{page_snippets.footer}}
<|code_end|>
, predict the next line using imports from the current file:
import os
import sys
from flask import render_template_string
from app import app
and context including class names, function names, and sometimes code from other files:
# Path: app.py
. Output only the next line. | </div> |
Given the following code snippet before the placeholder: <|code_start|> self.id = None
self.desc_map = {
self.data: "data",
self.event: "event",
self.id: "id"
}
def encode(self):
if not self.data:
return ""
lines = ["%s: %s" % (v, k) for k, v in self.desc_map.iteritems() if k]
return "%s\n\n" % "\n".join(lines)
subscriptions = []
# Client code consumes like this.
@app.route('/')
def index():
debug_template = """
<html>
<head>
</head>
<body>
<h1>Server sent events</h1>
<div id="event"></div>
<script type="text/javascript">
var eventOutputContainer = document.getElementById("event");
<|code_end|>
, predict the next line using imports from the current file:
import os
import sys
import time
import gevent
from flask import request, Response
from gevent.wsgi import WSGIServer
from gevent.queue import Queue
from app import app
and context including class names, function names, and sometimes code from other files:
# Path: app.py
. Output only the next line. | var evtSrc = new EventSource("/subscribe"); |
Here is a snippet: <|code_start|> def token_span(self, start_address=0):
'''returns the words (im)mediately depending on the given address in a
dependency graph in correct linear order, except for the root node
'''
addresses = self.address_span(start_address)
return [self.nodes[address][WORD]
for address in sorted(addresses) if address != 0]
def is_valid_parse_tree(self):
'''check structural integrity of the parse;
for the moment just check for a unique root'''
root = self.get_dependencies_simple(0)
if len(root) < 1:
print("Warning: No root address", file=sys.stderr)
return False
if len(root) > 1:
print("Warning: More than one root address", file=sys.stderr)
return False
return True
def length(self):
'''returns the length in tokens, i.e. the number of nodes excluding
the artifical root'''
return len(self.nodes) - 1
def annotate(self, iterable, field_name):
'''annotate the nodes (excluding the artifical root) with an additional
non-standard field, the values being provided in an iterable in
linear order corresponding to the node order'''
assert len(iterable) == self.length()
<|code_end|>
. Write the next line using the current file imports:
from dsegmenter.common import DEPS, REL, TAG, WORD
from nltk.parse.dependencygraph import DependencyGraph as NLTKDependencyGraph
import sys
and context from other files:
# Path: dsegmenter/common.py
# DEPS = "deps"
#
# REL = "rel"
#
# TAG = "tag"
#
# WORD = "word"
, which may include functions, classes, or code. Output only the next line. | assert field_name not in STANDARD_FIELDS |
Predict the next line for this snippet: <|code_start|> '''returns a sorted list of the addresses of all dependencies of the
node at the specified address'''
deps_dict = self.nodes[address].get(DEPS, {})
return sorted([e for l in deps_dict.values() for e in l])
def address_span(self, start_address):
'''returns the addresses of nodes (im)mediately depending on the given
starting address in a dependency graph, except for the root node'''
worklist = [start_address]
addresses = []
while len(worklist) != 0:
address = worklist.pop(0)
addresses.append(address)
for _rel, deps in self.nodes[address][DEPS].items():
worklist.extend(deps)
return sorted(addresses)
def token_span(self, start_address=0):
'''returns the words (im)mediately depending on the given address in a
dependency graph in correct linear order, except for the root node
'''
addresses = self.address_span(start_address)
return [self.nodes[address][WORD]
for address in sorted(addresses) if address != 0]
def is_valid_parse_tree(self):
'''check structural integrity of the parse;
for the moment just check for a unique root'''
root = self.get_dependencies_simple(0)
if len(root) < 1:
<|code_end|>
with the help of current file imports:
from dsegmenter.common import DEPS, REL, TAG, WORD
from nltk.parse.dependencygraph import DependencyGraph as NLTKDependencyGraph
import sys
and context from other files:
# Path: dsegmenter/common.py
# DEPS = "deps"
#
# REL = "rel"
#
# TAG = "tag"
#
# WORD = "word"
, which may contain function names, class names, or code. Output only the next line. | print("Warning: No root address", file=sys.stderr) |
Predict the next line for this snippet: <|code_start|> '''returns a sorted list of the addresses of all dependencies of the
node at the specified address'''
deps_dict = self.nodes[address].get(DEPS, {})
return sorted([e for l in deps_dict.values() for e in l])
def address_span(self, start_address):
'''returns the addresses of nodes (im)mediately depending on the given
starting address in a dependency graph, except for the root node'''
worklist = [start_address]
addresses = []
while len(worklist) != 0:
address = worklist.pop(0)
addresses.append(address)
for _rel, deps in self.nodes[address][DEPS].items():
worklist.extend(deps)
return sorted(addresses)
def token_span(self, start_address=0):
'''returns the words (im)mediately depending on the given address in a
dependency graph in correct linear order, except for the root node
'''
addresses = self.address_span(start_address)
return [self.nodes[address][WORD]
for address in sorted(addresses) if address != 0]
def is_valid_parse_tree(self):
'''check structural integrity of the parse;
for the moment just check for a unique root'''
root = self.get_dependencies_simple(0)
if len(root) < 1:
<|code_end|>
with the help of current file imports:
from dsegmenter.common import DEPS, REL, TAG, WORD
from nltk.parse.dependencygraph import DependencyGraph as NLTKDependencyGraph
import sys
and context from other files:
# Path: dsegmenter/common.py
# DEPS = "deps"
#
# REL = "rel"
#
# TAG = "tag"
#
# WORD = "word"
, which may contain function names, class names, or code. Output only the next line. | print("Warning: No root address", file=sys.stderr) |
Continue the code snippet: <|code_start|> while len(worklist) != 0:
address = worklist.pop(0)
addresses.append(address)
for _rel, deps in self.nodes[address][DEPS].items():
worklist.extend(deps)
return sorted(addresses)
def token_span(self, start_address=0):
'''returns the words (im)mediately depending on the given address in a
dependency graph in correct linear order, except for the root node
'''
addresses = self.address_span(start_address)
return [self.nodes[address][WORD]
for address in sorted(addresses) if address != 0]
def is_valid_parse_tree(self):
'''check structural integrity of the parse;
for the moment just check for a unique root'''
root = self.get_dependencies_simple(0)
if len(root) < 1:
print("Warning: No root address", file=sys.stderr)
return False
if len(root) > 1:
print("Warning: More than one root address", file=sys.stderr)
return False
return True
def length(self):
'''returns the length in tokens, i.e. the number of nodes excluding
the artifical root'''
<|code_end|>
. Use current file imports:
from dsegmenter.common import DEPS, REL, TAG, WORD
from nltk.parse.dependencygraph import DependencyGraph as NLTKDependencyGraph
import sys
and context (classes, functions, or code) from other files:
# Path: dsegmenter/common.py
# DEPS = "deps"
#
# REL = "rel"
#
# TAG = "tag"
#
# WORD = "word"
. Output only the next line. | return len(self.nodes) - 1 |
Using the snippet: <|code_start|>try:
except ImportError:
class TestPluginManager(ut.TestCase):
def setUp(self):
self.manager = PluginManager()
if hasattr(sys, 'frozen'):
module_path = os.path.dirname(sys.executable)
else:
file_path = os.path.abspath(os.path.dirname(__file__))
module_path = os.path.dirname(file_path)
self.manager.add_path(os.path.join(module_path, 'plugins'))
def test_not_empty(self):
<|code_end|>
, determine the next line of code. You have imports:
import unittest2 as ut
import unittest as ut
import sys
import os
from spykeviewer.plugin_framework.plugin_manager import PluginManager
and context (class names, function names, or code) available:
# Path: spykeviewer/plugin_framework/plugin_manager.py
# class PluginManager:
# """ Manages plugins loaded from a directory.
# """
# class Node:
# def __init__(self, parent, data, path, name):
# self.parent = parent
# self.data = data
# self.name = name
# self.path = path
#
# def childCount(self):
# return 0
#
# def row(self):
# if self.parent:
# return self.parent.children.index(self)
# return 0
#
# class DirNode(Node):
# def __init__(self, parent, data, path=''):
# """ Recursively walk down the tree, loading all legal
# plugin classes along the way.
# """
# PluginManager.Node.__init__(self, parent, data, path, '')
# self.children = []
#
# if path:
# self.addPath(path)
#
# def child(self, row):
# """ Return child at given position.
# """
# return self.children[row]
#
# def childCount(self):
# """ Return number of children.
# """
# return len(self.children)
#
# def get_dir_child(self, path):
# """ Return child node with given directory name.
# """
# for n in self.children:
# if os.path.split(n.path)[1] == os.path.split(path)[1] and \
# isinstance(n, PluginManager.DirNode):
# return n
# return None
#
# def addPath(self, path):
# """ Add a new path.
# """
# if not path:
# return
#
# self.name = os.path.split(path)[1]
#
# for f in os.listdir(path):
# # Don't include hidden directories
# if f.startswith('.'):
# continue
#
# p = os.path.join(path.decode('utf-8'), f).encode('utf-8')
# if os.path.isdir(p):
# new_node = self.get_dir_child(p)
# if new_node:
# new_node.addPath(p)
# else:
# new_node = PluginManager.DirNode(self, None, p)
# if new_node.childCount():
# self.children.append(new_node)
# else:
# if not f.endswith('.py'):
# continue
#
# # Found a Python file, execute it and look for plugins
# exc_globals = {}
# try:
# # We turn all encodings to UTF-8, so remove encoding
# # comments manually
# f = open(p, 'r')
# lines = f.readlines()
# if not lines:
# continue
# if re.findall('coding[:=]\s*([-\w.]+)', lines[0]):
# lines.pop(0)
# elif re.findall('coding[:=]\s*([-\w.]+)', lines[1]):
# lines.pop(1)
# source = ''.join(lines).decode('utf-8')
# code = compile(source, p, 'exec')
#
# sys.path.insert(0, path)
# exec(code, exc_globals)
# except Exception:
# logger.warning('Error during execution of ' +
# 'potential plugin file ' + p + ':\n' +
# traceback.format_exc() + '\n')
# finally:
# if sys.path[0] == path:
# sys.path.pop(0)
#
# for cl in exc_globals.values():
# if not inspect.isclass(cl):
# continue
#
# # Should be a subclass of AnalysisPlugin...
# if not issubclass(cl, AnalysisPlugin):
# continue
# # ...but should not be AnalysisPlugin (can happen
# # when directly imported)
# if cl == AnalysisPlugin:
# continue
#
# # Plugin class found, add it to tree
# try:
# instance = cl()
# instance.source_file = p
# except Exception:
# etype, evalue, etb = sys.exc_info()
# evalue = etype('Exception while creating %s: %s' %
# (cl.__name__, evalue))
# raise etype, evalue, etb
# self.children.append(PluginManager.Node(
# self, instance, p, instance.get_name()))
#
# self.children.sort(cmp=_compare_nodes)
#
# def __init__(self):
# self.root = self.DirNode(None, None)
#
# def add_path(self, path):
# """ Add a new path to the manager.
# """
# self.root.addPath(path)
. Output only the next line. | self.assertGreater(self.manager.root.childCount(), 0, |
Predict the next line for this snippet: <|code_start|>#
# Eff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
def suite():
suite = unittest.TestSuite()
suite.addTest(doctest.DocTestSuite(jira))
suite.addTest(testUtils.suite())
suite.addTest(testModels.suite())
suite.addTest(testAdmin.suite())
suite.addTest(testReports.suite())
suite.addTest(testUserPassChange.suite())
suite.addTest(testUserReportsPerms.suite())
suite.addTest(testUserProfileViews.suite())
suite.addTest(testClientProjects.suite())
<|code_end|>
with the help of current file imports:
import unittest
import doctest
from eff_site.scripts import jira
from testing import testUtils
from testing import testModels
from testing import (testAdmin, testReports, testUserPassChange,
testUserReportsPerms, testUserProfileViews,
testClientProjects, testClientSummary)
and context from other files:
# Path: eff_site/scripts/jira.py
# class Jira(object):
# def __init__(self, url, username, password,
# from_date=None, to_date=None, projects=None):
# def _calculate_date_range(self, from_date, to_date):
# def fetch_data(self):
# def set_dates(self, from_date, to_date):
# def _process_data(self):
# def write_csv(self, writer=None):
# def fetch_all(source, client, author, from_date, to_date, _file):
, which may contain function names, class names, or code. Output only the next line. | suite.addTest(testClientSummary.suite()) |
Based on the snippet: <|code_start|>os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
if __name__ == '__main__':
date_format = "%Y%m%d%H%M"
args = sys.argv[1:]
if len(args) != 4:
print ("Usage: $ dp2eff.py <client-name> <source-name>"
" <from-date> <to-date>")
print "date format: %s" % date_format
print "example: 201008190000"
sys.exit(0)
client_name, source_name = args[0:2]
from_date = datetime.strptime(args[2], date_format)
to_date = datetime.strptime(args[3], date_format)
try:
source = ExternalSource.objects.get(name=source_name)
except ExternalSource.DoesNotExist:
print 'Source with name: %s does not exist' % source_name
sys.exit(1)
try:
client = Client.objects.get(name=client_name)
except ExternalSource.DoesNotExist:
print 'Client with name: %s does not exist'
<|code_end|>
, predict the immediate next line with the help of imports:
import sys
import os
from datetime import datetime
from eff_site.eff.models import ExternalSource, Client
from dotproject import fetch_all
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | sys.exit(1) |
Given the code snippet: <|code_start|>#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
if __name__ == '__main__':
date_format = "%Y%m%d%H%M"
args = sys.argv[1:]
if len(args) != 4:
print ("Usage: $ dp2eff.py <client-name> <source-name>"
" <from-date> <to-date>")
print "date format: %s" % date_format
print "example: 201008190000"
sys.exit(0)
client_name, source_name = args[0:2]
from_date = datetime.strptime(args[2], date_format)
to_date = datetime.strptime(args[3], date_format)
try:
source = ExternalSource.objects.get(name=source_name)
except ExternalSource.DoesNotExist:
<|code_end|>
, generate the next line using the imports in this file:
import sys
import os
from datetime import datetime
from eff_site.eff.models import ExternalSource, Client
from dotproject import fetch_all
and context (functions, classes, or occasionally code) from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | print 'Source with name: %s does not exist' % source_name |
Based on the snippet: <|code_start|>
self.assert_(self.client.login(username='test1', password='test1'))
response = self.client.get('/efi/semanaactual/', {})
self.assertEqual(response.status_code, 302)
# Esta es la unica forma que encontre de conocer a donde redirecciona.
url = dict(response.items())['Location']
i = url.index("/efi")
url = url[i:]
today = date.today()
# last sunday
from_date = today - timedelta(days=today.isoweekday() % 7)
# next saturday
to_date = from_date + timedelta(days=6)
correct_url = "/efi/?from_date=%s&to_date=%s" % (from_date, to_date)
self.assertEqual(url, correct_url)
def test_successful_password_change(self):
self.assert_(self.client.login(username='test1', password='test1'))
context = {'user': self.usr.id,
'password': 'secret',
'password2': 'secret'}
response = self.client.post('/efi/administration/users_password/',
context)
self.assertEqual(response.status_code, 200)
self.client.logout()
self.assert_(self.client.login(username='test1', password='secret'))
<|code_end|>
, predict the immediate next line with the help of imports:
from django.test import TestCase
from django.test.client import Client
from pyquery import PyQuery
from django.contrib.auth.models import User, Permission, Group
from django.core.exceptions import ValidationError
from django.core import mail
from eff.models import UserProfile, AvgHours, Project, TimeLog, ExternalSource
from eff.models import Wage, ClientHandles, Handle
from eff.models import Client as EffClient, Dump
from eff.views import Data
from factories import (ClientFactory, BillingFactory, CreditNoteFactory,
PaymentFactory, ExternalSourceFactory)
from eff_site.eff.forms import UserAdminForm
from unittest import TestSuite, makeSuite
from datetime import date, timedelta, datetime
from django.template.defaultfilters import slugify
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/eff/forms.py
# class UserAdminForm(UserCreationForm):
# email = forms.EmailField(required=True, label='E-mail address',
# max_length=254)
# is_client = forms.BooleanField(required=False, label="Client",
# help_text=("Designates whether this user"
# "should be treated as a Client."))
# company = forms.ModelChoiceField(required=False,
# queryset=Client.objects.all())
#
# class Meta:
# model = User
# # Needed to define an order (hashed password not shown)
# fields = ('username', 'password1', 'password2', 'is_client', 'company',
# 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
# 'is_superuser', 'last_login', 'date_joined', 'groups',
# 'user_permissions',)
#
# def __init__(self, *args, **kwargs):
# super(UserCreationForm, self).__init__(*args, **kwargs)
# try:
# profile = self.instance.get_profile()
# self.fields['is_client'].initial = profile.is_client()
# self.fields['company'].initial = profile.company
# except User.DoesNotExist:
# pass
# except UserProfile.DoesNotExist:
# pass
#
# def clean_email(self):
# email = self.cleaned_data.get('email')
# username = self.cleaned_data.get('username')
# users = User.objects.filter(email=email).exclude(username=username)
# if email and users.count():
# raise forms.ValidationError(u'Email address must be unique.')
# return email
#
# def clean(self):
# cleaned_data = super(UserAdminForm, self).clean()
# is_client = cleaned_data.get("is_client")
# company = cleaned_data.get("company")
#
# first_name = cleaned_data.get("first_name")
# last_name = cleaned_data.get("last_name")
# errors = False
#
# if is_client and not company:
# self._errors['company'] = self._errors.get('company', ErrorList())
# self._errors['company'].append("A client user must have Company")
# errors = True
# if is_client and not first_name:
# self._errors['first_name'] = self._errors.get('first_name',
# ErrorList())
# self._errors['first_name'].append("A client user must have First " \
# "name")
# errors = True
# if is_client and not last_name:
# self._errors['last_name'] = self._errors.get('last_name',
# ErrorList())
# self._errors['last_name'].append("A client user must have Last " \
# "name")
# errors = True
#
# if company and not is_client:
# self._errors['company'] = self._errors.get('company',
# ErrorList())
# self._errors['company'].append("A default user not must have "\
# "Company")
# errors = True
#
# if errors:
# raise forms.ValidationError('Some field are invalid')
#
# return cleaned_data
#
# def save(self, *args, **kwargs):
# if self.instance.pk is None:
# # Add new user to Attachment's group
# try:
# group_attachment = Group.objects.get(name='attachments')
# if group_attachment not in self.cleaned_data['groups']:
# self.cleaned_data['groups'].append(group_attachment)
# except Group.DoesNotExist:
# pass
#
# kwargs.pop('commit', None)
# user = super(UserCreationForm, self).save(*args, commit=False,
# **kwargs)
# password = self.cleaned_data["password1"]
# if password:
# user.set_password(password)
#
# user.is_client = self.cleaned_data['is_client']
# if user.is_client:
# user.company = self.cleaned_data['company']
# user.is_client = self.cleaned_data['is_client']
# user.save()
# self.save_m2m(*args, **kwargs)
# return user
. Output only the next line. | def test_unsuccessful_password_change_do_not_match(self): |
Based on the snippet: <|code_start|># -*- coding: utf-8 *-*
# This script call a view of eff, this view send an email each user with
# receive report email in True, and not is a user client
path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
DAY_OF_WEEK = {
0: 'Monday',
1: 'Tuesday',
2: 'Wednesday',
3: 'Thursday',
4: 'Friday',
5: 'Saturday',
<|code_end|>
, predict the immediate next line with the help of imports:
import sys
import os
from datetime import datetime, date
from eff_site.eff.models import UserProfile
from django.template.loader import render_to_string
from dateutil.relativedelta import relativedelta, MO
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | 6: 'Sunday'} |
Continue the code snippet: <|code_start|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/
#
# This file is part of Eff.
#
# Eff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
<|code_end|>
. Use current file imports:
import sys
import os
from datetime import datetime
from tutos import fetch_all
from eff_site.eff.models import ExternalSource, Project, TimeLog, Client
and context (classes, functions, or code) from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | if __name__ == '__main__': |
Predict the next line after this snippet: <|code_start|>#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
if __name__ == '__main__':
args = sys.argv[1:]
if len(args) != 4:
print ("Usage: $ tutos2eff.py <client-name> <source-name>"
" <username> <password>")
sys.exit(0)
client_name, source_name, username, password = args
try:
source = ExternalSource.objects.get(name=source_name)
except ExternalSource.DoesNotExist:
<|code_end|>
using the current file's imports:
import sys
import os
from datetime import datetime
from tutos import fetch_all
from eff_site.eff.models import ExternalSource, Project, TimeLog, Client
and any relevant context from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | print 'Source with name: %s does not exist' % source_name |
Predict the next line after this snippet: <|code_start|># but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
admin.autodiscover()
jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/')
js_dir = join(CURRENT_ABS_DIR, 'addons/js/')
jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/')
calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/')
sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
<|code_end|>
using the current file's imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and any relevant context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='login'), |
Using the snippet: <|code_start|>templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
<|code_end|>
, determine the next line of code. You have imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (class names, function names, or code) available:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | {'template_name': 'password_reset.html', |
Given the following code snippet before the placeholder: <|code_start|> # password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^accounts/change_password/done/$', |
Continue the code snippet: <|code_start|> url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
<|code_end|>
. Use current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, or code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^comments/', include('django.contrib.comments.urls')), |
Based on the snippet: <|code_start|> url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
<|code_end|>
, predict the immediate next line with the help of imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | {'template_name': 'password_change.html', |
Predict the next line for this snippet: <|code_start|> name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^attachments/add-for/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$',
add_attachment_custom, name="add_attachment_custom"),
url(r'^attachments/delete/(?P<attachment_pk>\d+)/$',
delete_attachment_custom, name="delete_attachment_custom"),
url(r'^attachments/', include('attachments.urls')),
)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}),
<|code_end|>
with the help of current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may contain function names, class names, or code. Output only the next line. | ) |
Predict the next line after this snippet: <|code_start|> url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
<|code_end|>
using the current file's imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and any relevant context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', |
Predict the next line for this snippet: <|code_start|>sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
<|code_end|>
with the help of current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may contain function names, class names, or code. Output only the next line. | 'django.contrib.auth.views.password_reset', |
Continue the code snippet: <|code_start|> name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
<|code_end|>
. Use current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, or code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'post_change_redirect': '/accounts/change_password/done/'}, |
Predict the next line after this snippet: <|code_start|> name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'},
name='password_change_done'),
url(r'^password_change/$', redirect_to,
{'url': '/accounts/password_change/'},
name='redir_password_change'),
url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'),
url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
<|code_end|>
using the current file's imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and any relevant context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='eff_admin_change_profile'), |
Using the snippet: <|code_start|> url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^attachments/add-for/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$',
add_attachment_custom, name="add_attachment_custom"),
url(r'^attachments/delete/(?P<attachment_pk>\d+)/$',
delete_attachment_custom, name="delete_attachment_custom"),
url(r'^attachments/', include('attachments.urls')),
)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
<|code_end|>
, determine the next line of code. You have imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (class names, function names, or code) available:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'document_root': settings.MEDIA_ROOT}), |
Here is a snippet: <|code_start|> 'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'},
name='password_change_done'),
url(r'^password_change/$', redirect_to,
{'url': '/accounts/password_change/'},
name='redir_password_change'),
url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'),
url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
<|code_end|>
. Write the next line using the current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may include functions, classes, or code. Output only the next line. | name='eff_dump_csv_upload'), |
Based on the snippet: <|code_start|># along with Eff. If not, see <http://www.gnu.org/licenses/>.
admin.autodiscover()
jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/')
js_dir = join(CURRENT_ABS_DIR, 'addons/js/')
jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/')
calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/')
sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
<|code_end|>
, predict the immediate next line with the help of imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='redir_login'), |
Based on the snippet: <|code_start|> url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
<|code_end|>
, predict the immediate next line with the help of imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^accounts/password_reset/done/$', |
Given the code snippet: <|code_start|> url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
<|code_end|>
, generate the next line using the imports in this file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (functions, classes, or occasionally code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^comments/', include('django.contrib.comments.urls')), |
Based on the snippet: <|code_start|>
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
<|code_end|>
, predict the immediate next line with the help of imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (classes, functions, sometimes code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='password_reset'), |
Here is a snippet: <|code_start|> 'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
'django.contrib.auth.views.password_change_done',
<|code_end|>
. Write the next line using the current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may include functions, classes, or code. Output only the next line. | {'template_name': 'password_change_done.html'}, |
Given the code snippet: <|code_start|>js_dir = join(CURRENT_ABS_DIR, 'addons/js/')
jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/')
calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/')
sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
<|code_end|>
, generate the next line using the imports in this file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (functions, classes, or occasionally code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^profiles/', include('profiles.urls'), name='profiles'), |
Given the following code snippet before the placeholder: <|code_start|>jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/')
js_dir = join(CURRENT_ABS_DIR, 'addons/js/')
jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/')
calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/')
sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='profiles_detail'), |
Predict the next line after this snippet: <|code_start|> url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
<|code_end|>
using the current file's imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and any relevant context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'django.contrib.auth.views.password_change_done', |
Predict the next line for this snippet: <|code_start|> {'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
'django.contrib.auth.views.password_reset_complete',
{'template_name': 'password_reset_complete.html'},
name='password_reset_complete'),
# password change
url(r'^accounts/change_password/$',
'django.contrib.auth.views.password_change',
{'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'},
<|code_end|>
with the help of current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may contain function names, class names, or code. Output only the next line. | name='password_change_done'), |
Given snippet: <|code_start|> url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
which might include code, classes, or functions. Output only the next line. | 'django.contrib.auth.views.password_reset_done', |
Given snippet: <|code_start|> name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
'email_template_name': 'password_reset_email.html'},
name='password_reset'),
url(r'^password_reset/$', redirect_to,
{'url': '/accounts/password_reset/'}, name='redir_password_reset'),
url(r'^accounts/password_reset/done/$',
'django.contrib.auth.views.password_reset_done',
{'template_name': 'password_reset_done.html'},
name='password_reset_done'),
url(r'^accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
{'template_name': 'password_reset_confirm.html'},
name='password_reset_confirm'),
url(r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
redirect_to,
{'url': '/accounts/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/'},
name='redir_password_reset_confirm'),
url(r'^accounts/reset/done/$',
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
which might include code, classes, or functions. Output only the next line. | 'django.contrib.auth.views.password_reset_complete', |
Given the code snippet: <|code_start|>images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
<|code_end|>
, generate the next line using the imports in this file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (functions, classes, or occasionally code) from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'email_template_name': 'password_reset_email.html'}, |
Using the snippet: <|code_start|> {'template_name': 'password_change.html',
'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'},
name='password_change_done'),
url(r'^password_change/$', redirect_to,
{'url': '/accounts/password_change/'},
name='redir_password_change'),
url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'),
url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
<|code_end|>
, determine the next line of code. You have imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context (class names, function names, or code) available:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='eff_client_reports_admin'), |
Given snippet: <|code_start|># Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/
#
# This file is part of Eff.
#
# Eff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
admin.autodiscover()
jscalendar_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/')
js_dir = join(CURRENT_ABS_DIR, 'addons/js/')
jscalendar_lang_dir = join(CURRENT_ABS_DIR, 'addons/jscalendar-1.0/lang/')
calendar_dir = join(CURRENT_ABS_DIR, 'addons/simple-calendar/')
sortable_dir = join(CURRENT_ABS_DIR, 'addons/sortable-table/')
templates_dir = join(CURRENT_ABS_DIR, 'templates/')
images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
which might include code, classes, or functions. Output only the next line. | urlpatterns = patterns('', |
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^attachments/add-for/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$',
add_attachment_custom, name="add_attachment_custom"),
url(r'^attachments/delete/(?P<attachment_pk>\d+)/$',
delete_attachment_custom, name="delete_attachment_custom"),
url(r'^attachments/', include('attachments.urls')),
)
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'document_root': settings.MEDIA_ROOT}), |
Next line prediction: <|code_start|> name='password_change_done'),
url(r'^password_change/$', redirect_to,
{'url': '/accounts/password_change/'},
name='redir_password_change'),
url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'),
url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
<|code_end|>
. Use current file imports:
(from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join)
and context including class names, function names, or small code snippets from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='eff_client_report'), |
Predict the next line for this snippet: <|code_start|> 'post_change_redirect': '/accounts/change_password/done/'},
name='password_change'),
url(r'^accounts/change_password/done/$',
'django.contrib.auth.views.password_change_done',
{'template_name': 'password_change_done.html'},
name='password_change_done'),
url(r'^password_change/$', redirect_to,
{'url': '/accounts/password_change/'},
name='redir_password_change'),
url(r'^updatehours/([A-Za-z_0-9]*)/$', update_hours, name='update_hours'),
url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
<|code_end|>
with the help of current file imports:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
, which may contain function names, class names, or code. Output only the next line. | url(r'^efi/administration/fixed_price_client_reports/$', |
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/$', eff, name='eff'),
url(r'^efi/semanaanterior/$', eff_previous_week, name='eff_previous_week'),
url(r'^efi/semanaactual/$', eff_current_week, name='eff_current_week'),
url(r'^efi/mesactual/$', eff_current_month, name='eff_current_month'),
url(r'^efi/mespasado/$', eff_last_month, name='eff_last_month'),
url(r'^efi/horasextras/$', eff_horas_extras, name='eff_extra_hours'),
url(r'^efi/next/$', eff_next, name='eff_next'),
url(r'^efi/prev/$', eff_prev, name='eff_prev'),
url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | name='eff_client_summary_period'), |
Given the following code snippet before the placeholder: <|code_start|> url(r'^efi/chart/([A-Za-z_0-9]*)/$', eff_chart, name='eff_chart'),
url(r'^efi/charts/$', eff_charts, name='eff_charts'),
url(r'^efi/reporte/([A-Za-z_0-9]*)/$', eff_report, name='eff_report'),
url(r'^efi/update-db/$', eff_update_db, name='eff_update_db'),
url(r'^efi/administration/users_password/$', eff_administration,
name='eff_administration'),
url(r'^efi/administration/users_profile/$', eff_admin_change_profile,
name='eff_admin_change_profile'),
url(r'^efi/administration/add_user/$', eff_admin_add_user,
name='eff_admin_add_user'),
url(r'^efi/administration/client_reports/$', eff_client_reports_admin,
name='eff_client_reports_admin'),
url(r'^efi/administration/fixed_price_client_reports/$',
eff_fixed_price_client_reports, name='eff_fixed_price_client_reports'),
url(r'^efi/administration/dump-csv-upload/$', eff_dump_csv_upload,
name='eff_dump_csv_upload'),
url(r'^efi/reporte_cliente/([-\w]+)/$', eff_client_report,
name='eff_client_report'),
url(r'^efi/administration/users_association/$',
eff_admin_users_association, name='eff_admin_users_association'),
url(r'^efi/administration/client_summary/$',
eff_client_summary_period,
name='eff_client_summary_period'),
url(r'^efi/administration/client_summary/([-\w]+)/$',
eff_client_summary,
name='eff_client_summary'),
url(r'^admin/', include(admin.site.urls)),
url(r'^comments/', include('django.contrib.comments.urls')),
url(r'^attachments/add-for/(?P<app_label>[\w\-]+)/(?P<module_name>[\w\-]+)/(?P<pk>\d+)/$',
add_attachment_custom, name="add_attachment_custom"),
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | url(r'^attachments/delete/(?P<attachment_pk>\d+)/$', |
Given the following code snippet before the placeholder: <|code_start|>images_dir = join(CURRENT_ABS_DIR, 'templates/images/')
urlpatterns = patterns('',
url(r'^$', index, name='root'),
url(r'^clients/home/$', eff_client_home, name='client_home'),
url(r'^clients/projects/$', eff_client_projects, name='client_projects'),
url(r'^clients/summary/period/$', eff_client_summary_period,
name='client_summary_period'),
url(r'^clients/summary/$', eff_client_summary,
name='client_summary'),
# django-profiles
url(r'^accounts/login/$', login, {'template_name': 'login.html'},
name='login'),
url(r'^accounts/logout/$', logout, {'template_name': 'logout.html'},
name='logout'),
url(r'^accounts/profile/$', eff_home, name='eff_home'),
url(r'^login/$', redirect_to, {'url': '/accounts/login/'},
name='redir_login'),
url(r'^logout/$', redirect_to, {'url': '/accounts/logout/'},
name='redir_logout'),
url(r'^checkperms/([A-Za-z_0-9]*)/$', eff_check_perms, name='checkperms'),
url(r'^profiles/edit', 'eff.views.edit_profile',
{'form_class': UserProfileForm, }, name='profiles_edit'),
url(r'^profiles/(?P<username>[\w\._-]+)/$', profile_detail,
name='profiles_detail'),
url(r'^profiles/', include('profiles.urls'), name='profiles'),
# password reset
url(r'^accounts/password_reset/$',
'django.contrib.auth.views.password_reset',
{'template_name': 'password_reset.html',
<|code_end|>
, predict the next line using imports from the current file:
from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.views.generic.simple import redirect_to
from django.conf import settings
from django.contrib import admin
from eff_site.settings import CURRENT_ABS_DIR
from eff_site.eff.views import (update_hours, eff, eff_check_perms,
eff_previous_week, eff_current_week, eff_current_month, eff_horas_extras,
eff_chart, eff_next, eff_prev, eff_charts, eff_report, eff_update_db,
eff_administration, eff_client_report, eff_client_reports_admin,
UserProfileForm, eff_last_month, eff_admin_add_user,
eff_admin_change_profile, profile_detail, eff_dump_csv_upload,
eff_fixed_price_client_reports, eff_admin_users_association, eff_home,
eff_client_home, index, eff_client_projects, eff_client_summary,
eff_client_summary_period, add_attachment_custom, delete_attachment_custom)
from os.path import join
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/settings.py
# CURRENT_ABS_DIR = dirname(abspath(normpath(__file__)))
#
# Path: eff_site/eff/views.py
# OVERTIME_FLAG = 'overtime_nav'
# MONTHLY_FLAG = 'monthly_nav'
# def __get_order_by(order_by):
# def __get_context(request):
# def __aux_mk_time(date_string):
# def __process_dates(request):
# def __process_period(request, is_prev):
# def __encFloat(lof, maxval):
# def __encList(llof, maxval):
# def __enough_perms(u):
# def __enough_perms_or_follows(view_fun):
# def _dec(request, user_name):
# def __not_a_client(u):
# def __is_client(u):
# def __enough_perms_or_client(u):
# def chart_values(username_list, from_date, to_date, request_user):
# def index(request):
# def update_hours(request, username):
# def eff_client_home(request):
# def eff_client_projects(request):
# def eff_client_summary_period(request):
# def eff_client_summary(request, company_slug=None):
# def eff_home(request):
# def eff_check_perms(request, username):
# def eff_previous_week(request):
# def eff_current_week(request):
# def eff_current_month(request):
# def eff_last_month(request):
# def eff_horas_extras(request):
# def eff_next(request):
# def eff_prev(request):
# def eff(request):
# def eff_chart(request, username):
# def eff_charts(request):
# def eff_report(request, user_name):
# def eff_update_db(request):
# def eff_administration(request):
# def eff_client_report(request, client_slug):
# def eff_client_reports_admin(request):
# def eff_admin_add_user(request):
# def eff_admin_change_profile(request):
# def profile_detail(request, username):
# def eff_dump_csv_upload(request):
# def eff_fixed_price_client_reports(request):
# def __init__(self, users, *args, **kwargs):
# def eff_admin_users_association(request):
# def edit_profile(request, form_class):
# def _clientform_changed(form, context_for_email, ctx_dict, send_email):
# def _handles_changed(formset_handles, context_for_email, ctx_dict, send_email):
# def add_url_for_obj(obj):
# def add_attachment_custom(request, app_label, module_name, pk,
# template_name='attachments/attachments.html',
# extra_context={}):
# def delete_attachment_custom(request, attachment_pk):
# class UserAssociationsForm(forms.Form):
. Output only the next line. | 'email_template_name': 'password_reset_email.html'}, |
Next line prediction: <|code_start|>
path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
def generate_timelog_data():
users = User.objects.all()
projects = Project.objects.all()
dumps = Dump.objects.all()
current_date = date.today()
previuos_date = current_date - relativedelta(weeks=+1)
date_timelog = previuos_date - relativedelta(weekday=MO(-1))
# Genera registros de Lunes a Viernes
for day in range(0, 5):
# Genera registros para 5 usuarios aleatorios
for u in range(1, 6):
user = random.choice(users)
project = random.choice(projects)
dump = random.choice(dumps)
task_name = 'task %s' % day
hours = round(random.random() * 10, 3)
description = 'description %s do %s' % (user.username, task_name)
timelog = TimeLog(
date=date_timelog,
project=project,
task_name=task_name,
user=user,
<|code_end|>
. Use current file imports:
(import sys
import os
import random
from datetime import date
from django.contrib.auth.models import User
from eff_site.eff.models import Project, Dump, TimeLog
from dateutil.relativedelta import relativedelta, MO)
and context including class names, function names, or small code snippets from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | hours_booked=hours, |
Using the snippet: <|code_start|>path = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
sys.path.insert(1, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'eff_site.settings'
def generate_timelog_data():
users = User.objects.all()
projects = Project.objects.all()
dumps = Dump.objects.all()
current_date = date.today()
previuos_date = current_date - relativedelta(weeks=+1)
date_timelog = previuos_date - relativedelta(weekday=MO(-1))
# Genera registros de Lunes a Viernes
for day in range(0, 5):
# Genera registros para 5 usuarios aleatorios
for u in range(1, 6):
user = random.choice(users)
project = random.choice(projects)
dump = random.choice(dumps)
task_name = 'task %s' % day
hours = round(random.random() * 10, 3)
description = 'description %s do %s' % (user.username, task_name)
timelog = TimeLog(
date=date_timelog,
project=project,
task_name=task_name,
user=user,
hours_booked=hours,
<|code_end|>
, determine the next line of code. You have imports:
import sys
import os
import random
from datetime import date
from django.contrib.auth.models import User
from eff_site.eff.models import Project, Dump, TimeLog
from dateutil.relativedelta import relativedelta, MO
and context (class names, function names, or code) available:
# Path: eff_site/eff/models.py
. Output only the next line. | description=description, |
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*-
# Copyright 2009 - 2011 Machinalis: http://www.machinalis.com/
#
# This file is part of Eff.
#
# Eff is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
class AvgHoursForm(forms.Form):
ah_date = forms.DateField(required=True)
hours = forms.IntegerField(required=True)
class EffQueryForm(forms.Form):
<|code_end|>
using the current file's imports:
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from django.forms.util import ErrorList
from eff_site.eff.models import UserProfile, Client, AvgHours, Wage
and any relevant context from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | from_date = forms.DateField(required=True, |
Given snippet: <|code_start|># (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
class AvgHoursForm(forms.Form):
ah_date = forms.DateField(required=True)
hours = forms.IntegerField(required=True)
class EffQueryForm(forms.Form):
from_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Desde')
to_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Hasta')
def clean_to_date(self):
cleaned_data = super(EffQueryForm, self).clean()
from_date = cleaned_data.get('from_date')
to_date = cleaned_data.get('to_date')
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from django.forms.util import ErrorList
from eff_site.eff.models import UserProfile, Client, AvgHours, Wage
and context:
# Path: eff_site/eff/models.py
which might include code, classes, or functions. Output only the next line. | if to_date < from_date: |
Given the following code snippet before the placeholder: <|code_start|># (at your option) any later version.
#
# Eff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
class AvgHoursForm(forms.Form):
ah_date = forms.DateField(required=True)
hours = forms.IntegerField(required=True)
class EffQueryForm(forms.Form):
from_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Desde')
to_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Hasta')
def clean_to_date(self):
cleaned_data = super(EffQueryForm, self).clean()
from_date = cleaned_data.get('from_date')
to_date = cleaned_data.get('to_date')
<|code_end|>
, predict the next line using imports from the current file:
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from django.forms.util import ErrorList
from eff_site.eff.models import UserProfile, Client, AvgHours, Wage
and context including class names, function names, and sometimes code from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | if to_date < from_date: |
Given the code snippet: <|code_start|>#
# You should have received a copy of the GNU General Public License
# along with Eff. If not, see <http://www.gnu.org/licenses/>.
class AvgHoursForm(forms.Form):
ah_date = forms.DateField(required=True)
hours = forms.IntegerField(required=True)
class EffQueryForm(forms.Form):
from_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Desde')
to_date = forms.DateField(required=True,
widget=forms.DateInput,
label='Hasta')
def clean_to_date(self):
cleaned_data = super(EffQueryForm, self).clean()
from_date = cleaned_data.get('from_date')
to_date = cleaned_data.get('to_date')
if to_date < from_date:
raise forms.ValidationError("This date should be greater")
return to_date
<|code_end|>
, generate the next line using the imports in this file:
from django import forms
from django.forms import ModelForm
from django.contrib.auth.models import User, Group
from django.contrib.auth.forms import UserCreationForm
from django.forms.util import ErrorList
from eff_site.eff.models import UserProfile, Client, AvgHours, Wage
and context (functions, classes, or occasionally code) from other files:
# Path: eff_site/eff/models.py
. Output only the next line. | class UserProfileForm(ModelForm): |
Continue the code snippet: <|code_start|>
if self.config.get('debug', False):
log.msg("[%s] Tick: %s" % (self.config['service'], event))
defer.returnValue(event)
@defer.inlineCallbacks
def tick(self):
"""Called for every timer tick. Calls self.get which can be a deferred
and passes that result back to the queueBack method
Returns a deferred"""
if self.sync:
if self.running:
defer.returnValue(None)
self.running = True
try:
event = yield self._get()
if event:
self.queueBack(event)
except Exception as e:
log.msg("[%s] Unhandled error: %s" % (self.service, e))
self.running = False
def createEvent(self, state, description, metric, prefix=None,
<|code_end|>
. Use current file imports:
import hashlib
import re
import time
import socket
from exceptions import NotImplementedError
from twisted.internet import task, defer
from twisted.python import log
from tensor.utils import fork
from tensor.protocol import ssh
and context (classes, functions, or code) from other files:
# Path: tensor/utils.py
# def fork(executable, args=(), env={}, path=None, timeout=3600):
# """fork
# Provides a deferred wrapper function with a timeout function
#
# :param executable: Executable
# :type executable: str.
# :param args: Tupple of arguments
# :type args: tupple.
# :param env: Environment dictionary
# :type env: dict.
# :param timeout: Kill the child process if timeout is exceeded
# :type timeout: int.
# """
# d = defer.Deferred()
# p = ProcessProtocol(d, timeout)
# reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path)
# return d
#
# Path: tensor/protocol/ssh.py
# class FakeLog(object):
# class SSHCommandProtocol(protocol.Protocol):
# class SSHClient(object):
# def msg(self, *a):
# def callWithLogger(self, *a, **kw):
# def connectionMade(self):
# def dataReceived(self, data):
# def extReceived(self, code, data):
# def connectionLost(self, reason):
# def __init__(self, hostname, username, port, password=None,
# knownhosts=None):
# def verifyHostKey(self, ui, hostname, ip, key):
# def gotHasKey(result):
# def addKeyFile(self, kfile, password=None):
# def addKeyString(self, kstring, password=None):
# def _get_endpoint(self):
# def connect(self):
# def connected(protocol):
# def fork(self, command, args=(), env={}, path=None, timeout=3600):
# def finished(result):
# def connected(connection):
. Output only the next line. | hostname=None, aggregation=None, evtime=None): |
Given the code snippet: <|code_start|>
def _qb(self, result):
pass
def test_basic_cpu(self):
self.skip_if_no_hostname()
s = basic.CPU(
{'interval': 1.0, 'service': 'cpu', 'ttl': 60}, self._qb, None)
try:
s.get()
s.get()
except:
raise unittest.SkipTest('Might not exist in docker')
def test_basic_cpu_calculation(self):
s = basic.CPU({
'interval': 1.0,
'service': 'cpu',
'ttl': 60,
'hostname': 'localhost',
}, self._qb, None)
stats = "cpu 2255 34 2290 25563 6290 127 456 0 0 0"
s._read_proc_stat = lambda: stats
# This is the first time we're getting this stat, so we get no events.
self.assertEqual(s.get(), None)
stats = "cpu 4510 68 4580 51126 12580 254 912 0 0 0"
s._read_proc_stat = lambda: stats
<|code_end|>
, generate the next line using the imports in this file:
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
and context (functions, classes, or occasionally code) from other files:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
#
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
# def get(self):
# def get(self):
#
# Path: tensor/sources/riak.py
# class RiakStats(Source):
# def _get_stats_from_node(self):
# def get(self):
#
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
# def _parse_nginx_stats(self, stats):
# def get(self):
# def __init__(self, *a):
# def _aggregate_fields(self, row, b, field, fil=None):
# def dumpEvents(self, ts):
# def got_line(self, line):
# def get(self):
# def __init__(self, *a):
# def got_eventlog(self, event):
# def _parser_proxy(self, line):
# def get(self):
#
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
# def get(self):
# def get(self):
. Output only the next line. | events = s.get() |
Given snippet: <|code_start|> def qb(src, ev):
events.append(ev)
f = open('foo.log', 'wt')
f.write('192.168.0.1 - - [16/Jan/2015:16:31:29 +0200] "GET /foo HTTP/1.1" 200 210 "-" "My Browser"\n')
f.write('192.168.0.1 - - [16/Jan/2015:16:51:29 +0200] "GET /foo HTTP/1.1" 200 410 "-" "My Browser"\n')
f.flush()
src = nginx.NginxLogMetrics({
'interval': 1.0,
'service': 'nginx',
'ttl': 60,
'hostname': 'localhost',
'log_format': 'combined',
'history': True,
'file': 'foo.log'
}, qb, None)
src.log.tmp = 'foo.log.lf'
src.get()
ev1 = events[0]
ev2 = events[1]
for i in ev1:
if i.service=='nginx.client.192.168.0.1.bytes':
self.assertEquals(i.metric, 210)
for i in ev2:
<|code_end|>
, continue by predicting the next line. Consider current file imports:
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
and context:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
#
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
# def get(self):
# def get(self):
#
# Path: tensor/sources/riak.py
# class RiakStats(Source):
# def _get_stats_from_node(self):
# def get(self):
#
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
# def _parse_nginx_stats(self, stats):
# def get(self):
# def __init__(self, *a):
# def _aggregate_fields(self, row, b, field, fil=None):
# def dumpEvents(self, ts):
# def got_line(self, line):
# def get(self):
# def __init__(self, *a):
# def got_eventlog(self, event):
# def _parser_proxy(self, line):
# def get(self):
#
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
# def get(self):
# def get(self):
which might include code, classes, or functions. Output only the next line. | if i.service=='nginx.client.192.168.0.1.bytes': |
Given the following code snippet before the placeholder: <|code_start|> events = []
f.write('192.168.0.1 - - [16/Jan/2015:17:10:31 +0200] "GET /foo HTTP/1.1" 200 410 "-" "My Browser"\n')
f.write('192.168.0.1 - - [16/Jan/2015:17:10:34 +0200] "GET /bar HTTP/1.1" 200 410 "-" "My Browser"\n')
f.close()
src.get()
for i in events[0]:
if i.service=='nginx.client.192.168.0.1.requests':
self.assertEquals(i.metric, 2)
if i.service=='nginx.user-agent.My Browser.bytes':
self.assertEquals(i.metric, 820)
if i.service=='nginx.request./foo.bytes':
self.assertEquals(i.metric, 410)
class TestRiakSources(unittest.TestCase):
def _qb(self, result):
pass
def start_fake_riak_server(self, stats):
def cb(listener):
self.addCleanup(listener.stopListening)
return listener
data = static.Data(json.dumps(stats).encode(), 'application/json')
data.isLeaf = True
site = server.Site(data)
<|code_end|>
, predict the next line using imports from the current file:
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
and context including class names, function names, and sometimes code from other files:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
#
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
# def get(self):
# def get(self):
#
# Path: tensor/sources/riak.py
# class RiakStats(Source):
# def _get_stats_from_node(self):
# def get(self):
#
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
# def _parse_nginx_stats(self, stats):
# def get(self):
# def __init__(self, *a):
# def _aggregate_fields(self, row, b, field, fil=None):
# def dumpEvents(self, ts):
# def got_line(self, line):
# def get(self):
# def __init__(self, *a):
# def got_eventlog(self, event):
# def _parser_proxy(self, line):
# def get(self):
#
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
# def get(self):
# def get(self):
. Output only the next line. | endpoint = endpoints.TCP4ServerEndpoint(reactor, 0) |
Continue the code snippet: <|code_start|> except:
pass
events = []
def qb(src, ev):
events.append(ev)
f = open('foo.log', 'wt')
f.write('192.168.0.1 - - [16/Jan/2015:16:31:29 +0200] "GET /foo HTTP/1.1" 200 210 "-" "My Browser"\n')
f.write('192.168.0.1 - - [16/Jan/2015:16:51:29 +0200] "GET /foo HTTP/1.1" 200 410 "-" "My Browser"\n')
f.flush()
src = nginx.NginxLogMetrics({
'interval': 1.0,
'service': 'nginx',
'ttl': 60,
'hostname': 'localhost',
'log_format': 'combined',
'history': True,
'file': 'foo.log'
}, qb, None)
src.log.tmp = 'foo.log.lf'
src.get()
ev1 = events[0]
ev2 = events[1]
<|code_end|>
. Use current file imports:
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
and context (classes, functions, or code) from other files:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
#
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
# def get(self):
# def get(self):
#
# Path: tensor/sources/riak.py
# class RiakStats(Source):
# def _get_stats_from_node(self):
# def get(self):
#
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
# def _parse_nginx_stats(self, stats):
# def get(self):
# def __init__(self, *a):
# def _aggregate_fields(self, row, b, field, fil=None):
# def dumpEvents(self, ts):
# def got_line(self, line):
# def get(self):
# def __init__(self, *a):
# def got_eventlog(self, event):
# def _parser_proxy(self, line):
# def get(self):
#
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
# def get(self):
# def get(self):
. Output only the next line. | for i in ev1: |
Using the snippet: <|code_start|> for i in events[0]:
if i.service=='nginx.client.192.168.0.1.requests':
self.assertEquals(i.metric, 2)
if i.service=='nginx.user-agent.My Browser.bytes':
self.assertEquals(i.metric, 820)
if i.service=='nginx.request./foo.bytes':
self.assertEquals(i.metric, 410)
class TestRiakSources(unittest.TestCase):
def _qb(self, result):
pass
def start_fake_riak_server(self, stats):
def cb(listener):
self.addCleanup(listener.stopListening)
return listener
data = static.Data(json.dumps(stats).encode(), 'application/json')
data.isLeaf = True
site = server.Site(data)
endpoint = endpoints.TCP4ServerEndpoint(reactor, 0)
return endpoint.listen(site).addCallback(cb)
def make_riak_stats_source(self, config_overrides={}):
config = {
'interval': 1.0,
'service': 'riak',
'ttl': 60,
<|code_end|>
, determine the next line of code. You have imports:
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
and context (class names, function names, or code) available:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
#
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
# def get(self):
# def get(self):
#
# Path: tensor/sources/riak.py
# class RiakStats(Source):
# def _get_stats_from_node(self):
# def get(self):
#
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
# def _parse_nginx_stats(self, stats):
# def get(self):
# def __init__(self, *a):
# def _aggregate_fields(self, row, b, field, fil=None):
# def dumpEvents(self, ts):
# def got_line(self, line):
# def get(self):
# def __init__(self, *a):
# def got_eventlog(self, event):
# def _parser_proxy(self, line):
# def get(self):
#
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
# def get(self):
# def get(self):
. Output only the next line. | 'hostname': 'localhost', |
Based on the snippet: <|code_start|> log = open('test.log', 'wt')
log.write('foo\nbar\n')
log.flush()
f = follower.LogFollower('test.log', tmp_path=".", history=True)
r = f.get()
log.write('test')
log.flush()
r2 = f.get()
log.write('ing\n')
log.flush()
r3 = f.get()
self.assertEqual(r[0], 'foo')
self.assertEqual(r[1], 'bar')
self.assertEqual(r2, [])
self.assertEqual(r3[0], 'testing')
log.close()
# Move inode
os.rename('test.log', 'testold.log')
log = open('test.log', 'wt')
<|code_end|>
, predict the immediate next line with the help of imports:
from twisted.trial import unittest
from tensor.logs import follower, parsers
import datetime
import os
and context (classes, functions, sometimes code) from other files:
# Path: tensor/logs/parsers.py
# class ApacheLogParserError(Exception):
# class ApacheLogParser:
# def __init__(self, format):
# def _parse_date(self, date):
# def alias(self, field):
# def _parse_format(self, format):
# def parse(self, line):
# def pattern(self):
# def names(self):
. Output only the next line. | log.write('foo2\nbar2\n') |
Next line prediction: <|code_start|>
testKey = """-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-128-CBC,A6588464A721D661311DBCE44C76337E
/bqr0AEIbiWubFiPEcdlNw8WdDrFqELOCZo78ohtDX/2HJhkMCCtAuv46is5UCvj
pweYupJQgZZ9g+6rKLhTo6d0VYwaSOuR6OJWEecIr7quyQBgCPOvun2fVGrx6/7U
D9HiXBdBDVc4vcEUviZu5V+E9xLmP9GteD1OR7TfR1AqFMPzHVvDE9UxrzEacFY4
KPs7KP6x+8so5KvZSJKisczc+JBt+PlZisDwX9BCHJNmAYYFRm2umY7sCmLNmeoc
Y95E6Tmpze4J1559mLM7nuzOpnnFEii4pA5H7unMUCa9AwkLLYLOV7N8iRETgG0R
snvH5uiVRqEB84ypItCZF+Nk5Y0/WPSWPDq/bhwyQeodEPjlIfiHKzDf9GuuT9El
Q4dGxA0mLOKMqPDJGGc7mwTTN5iczj94gsLTfI1me1qzTzxdko/BMqsmPSUbkNXS
wgkofT+48L00HL9zq0quHkgjoTe1Wud8tI4mG0Tl9BTFE9PUtlfdJNoEQ1dk9RcR
UkhjMbuN3h8r9w9EVugAvbp/c7SQILXEJ6QZK2NMzO01SA5Tv7hmDh1J0lcIF1zb
VI+rlxly/riDN6U9w35vOZEzKl3qYbAXrnRteo7MEYvc/BahvxBP0ZEGRXeoNfAj
JLvBrkhBUVy1cH5fGs2SYIwUEKBx5nLL5NeNI1ymRKbsyJ3oTKZU+PQhfarEJD2r
u/dZoDb/AEjxCkaM1EaDG590Bjc6ZxC1ZkF6gSK27iJRP5CCj5XoD7kIpmZFE+gc
KpVNHHe6ef2ptOngkEDUyTmZ7z18lVCeC4sBPzrLPDnWB+cie+19/cJDJpRz0n0j
qMkh7MY+FQ8t0AopFAy7r50nV5FlGt9rG7YaWO8j5Lv3TsPPDOxFk5IoB6AtRpr8
tSQCCyCcdHkD3M1wI/PD9bEjuELaDG8PaVzOuj5rVyh+saZQeD9GmegsuBkDGb4g
COtzWOQ1H0ii478rbQAxwsOEMdR5lxEFOo8mC0p4mnWJti2DzJQorQC/fjbRRv7z
vfJamXvfEuHj3NPP9cumrskBtD+kRz/c2zgVJ8vwRgNPazdfJqGYjmFB0loVVyuu
x+hBHOD5zyMPFrJW9MNDTiTEaQREaje5tUOfNoA1Wa4s2bVLnhHCXdMSWmiDmJQp
HEYAIZI2OJhMe8V431t6dBx+nutApzParWqET5D0DWvlurDWFrHMnazh164RqsGu
E4Dg6ZsRnI+PEJmroia6gYEscUfd5QSUebxIeLhNzo1Kf5JRBW93NNxhAzn9ZJ9O
2bjvkHOJlADnfON5TsPgroXX95P/9V8DWUT+/ske1Fw43V1pIT+PtraYqrlyvow+
uJMA2q9sRLzXnFb2vg7JdD1XA4f2eUBwzbtq8wSuQexSErWaTx5uAERDnGAWyaN2
3xCYl8CTfF70xN7j39hG/pI0ghRLGVBmCJ5NRzNZ80SPBE/nzYy/X6pGV+vsjPoZ
S3dBmvlBV/HzB4ljsO2pI/VjCJVNZdOWDzy18GQ/jt8/xH8R9Ld6/6tuS0HbiefS
<|code_end|>
. Use current file imports:
(from twisted.trial import unittest
from tensor.sources.linux import basic)
and context including class names, function names, or small code snippets from other files:
# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
# def _parse_loadaverage(self, data):
# def get(self):
# def sshGet(self):
# def __init__(self, *a, **kw):
# def _parse_stats(self, stats):
# def sshGet(self):
# def _getstats(self):
# def get(self):
# def __init__(self, *a):
# def _read_proc_stat(self):
# def _calculate_metrics(self, stat):
# def _transpose_metrics(self, metrics):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, mem):
# def get(self):
# def sshGet(self):
# def get(self):
# def _parse_stats(self, stats):
# def _readStats(self):
# def sshGet(self):
# def get(self):
. Output only the next line. | ZefHS5wV1KNZBK+vh08HvX/AY9WBHPH+DEbrpymn/9oAKVmhH+f73ADqVOanMPk0 |
Continue the code snippet: <|code_start|>
try:
except:
SSL=None
if SSL:
class ClientTLSContext(ssl.ClientContextFactory):
def __init__(self, key, cert):
self.key = key
self.cert = cert
<|code_end|>
. Use current file imports:
import time
import random
from twisted.internet import reactor, defer, task
from twisted.python import log
from OpenSSL import SSL
from twisted.internet import ssl
from tensor.protocol import riemann
from tensor.objects import Output
and context (classes, functions, or code) from other files:
# Path: tensor/protocol/riemann.py
# class RiemannProtobufMixin(object):
# class RiemannProtocol(Int32StringReceiver, RiemannProtobufMixin):
# class RiemannClientFactory(protocol.ReconnectingClientFactory):
# class RiemannUDP(DatagramProtocol, RiemannProtobufMixin):
# def encodeEvent(self, event):
# def encodeMessage(self, events):
# def decodeMessage(self, data):
# def sendEvents(self, events):
# def __init__(self):
# def stringReceived(self, string):
# def __init__(self, hosts, failover=False):
# def buildProtocol(self, addr):
# def _do_failover(self, connector):
# def clientConnectionLost(self, connector, reason):
# def clientConnectionFailed(self, connector, reason):
# def __init__(self, host, port):
# def sendString(self, string):
#
# Path: tensor/objects.py
# class Output(object):
# """Output parent class
#
# Outputs can inherit this object which provides a construct
# for a working output
#
# :param config: Dictionary config for this queue (usually read from the
# yaml configuration)
# :param tensor: A TensorService object for interacting with the queue manager
# """
# def __init__(self, config, tensor):
# self.config = config
# self.tensor = tensor
#
# def createClient(self):
# """Deferred which sets up the output
# """
# pass
#
# def eventsReceived(self):
# """Receives a list of events and processes them
#
# Arguments:
# events -- list of `tensor.objects.Event`
# """
# pass
#
# def stop(self):
# """Called when the service shuts down
# """
# pass
. Output only the next line. | def getContext(self): |
Here is a snippet: <|code_start|>
try:
except:
SSL=None
<|code_end|>
. Write the next line using the current file imports:
import time
import random
from twisted.internet import reactor, defer, task
from twisted.python import log
from OpenSSL import SSL
from twisted.internet import ssl
from tensor.protocol import riemann
from tensor.objects import Output
and context from other files:
# Path: tensor/protocol/riemann.py
# class RiemannProtobufMixin(object):
# class RiemannProtocol(Int32StringReceiver, RiemannProtobufMixin):
# class RiemannClientFactory(protocol.ReconnectingClientFactory):
# class RiemannUDP(DatagramProtocol, RiemannProtobufMixin):
# def encodeEvent(self, event):
# def encodeMessage(self, events):
# def decodeMessage(self, data):
# def sendEvents(self, events):
# def __init__(self):
# def stringReceived(self, string):
# def __init__(self, hosts, failover=False):
# def buildProtocol(self, addr):
# def _do_failover(self, connector):
# def clientConnectionLost(self, connector, reason):
# def clientConnectionFailed(self, connector, reason):
# def __init__(self, host, port):
# def sendString(self, string):
#
# Path: tensor/objects.py
# class Output(object):
# """Output parent class
#
# Outputs can inherit this object which provides a construct
# for a working output
#
# :param config: Dictionary config for this queue (usually read from the
# yaml configuration)
# :param tensor: A TensorService object for interacting with the queue manager
# """
# def __init__(self, config, tensor):
# self.config = config
# self.tensor = tensor
#
# def createClient(self):
# """Deferred which sets up the output
# """
# pass
#
# def eventsReceived(self):
# """Receives a list of events and processes them
#
# Arguments:
# events -- list of `tensor.objects.Event`
# """
# pass
#
# def stop(self):
# """Called when the service shuts down
# """
# pass
, which may include functions, classes, or code. Output only the next line. | if SSL: |
Given snippet: <|code_start|>
class Tests(unittest.TestCase):
def test_persistent_cache(self):
pc = utils.PersistentCache(location='test.cache')
pc.set('foo', 'bar')
pc.set('bar', 'baz')
pc2 = utils.PersistentCache(location='test.cache')
<|code_end|>
, continue by predicting the next line. Consider current file imports:
from twisted.trial import unittest
from twisted.internet import defer, reactor, error
from tensor import utils
and context:
# Path: tensor/utils.py
# class SocketyAgent(Agent):
# class Timeout(Exception):
# class Resolver(object):
# class BodyReceiver(protocol.Protocol):
# class StringProducer(object):
# class ProcessProtocol(protocol.ProcessProtocol):
# class WebClientContextFactory(ClientContextFactory):
# class HTTPRequest(object):
# class PersistentCache(object):
# def __init__(self, reactor, path, **kwargs):
# def _getEndpoint(self, scheme, host, port):
# def __init__(self):
# def reverseNameFromIPAddress(self, address):
# def reverse(self, ip):
# def _ret(result, ip):
# def __init__(self, finished):
# def dataReceived(self, data):
# def connectionLost(self, reason):
# def __init__(self, body):
# def startProducing(self, consumer):
# def pauseProducing(self):
# def stopProducing(self):
# def __init__(self, deferred, timeout):
# def outReceived(self, data):
# def errReceived(self, data):
# def processEnded(self, reason):
# def connectionMade(self):
# def killIfAlive():
# def fork(executable, args=(), env={}, path=None, timeout=3600):
# def getContext(self, hostname, port):
# def __init__(self, timeout=120):
# def abort_request(self, request):
# def response(self, request):
# def request(self, url, method='GET', headers={}, data=None, socket=None):
# def timeoutProxy(request):
# def requestAborted(failure):
# def getBody(self, url, method='GET', headers={}, data=None, socket=None):
# def getJson(self, url, method='GET', headers={}, data=None, socket=None):
# def __init__(self, location='/var/lib/tensor/cache'):
# def _changed(self):
# def _acquire_cache(self):
# def _write_cache(self, d):
# def _persist(self):
# def _read(self):
# def _remove_key(self, k):
# def expire(self, age):
# def set(self, k, v):
# def get(self, k):
# def contains(self, k):
# def delete(self, k):
# SSL=True
# SSL=False
which might include code, classes, or functions. Output only the next line. | self.assertEquals(pc2.get('foo')[1], 'bar') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.