prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | op.add_column('panel_applicant', sa.Column('other_pronouns', sa.Unicode(), server_default='', nullable=False))
op.add_column('panel_applicant', sa.Column('pronouns', sa.Unicode(), server_default='', nullable=False))
op.add_column('panel_application', sa.Column('is_loud', sa.Boolean(), server_default='False'... |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | op.drop_column('panel_application', 'is_loud')
op.drop_column('panel_applicant', 'pronouns')
op.drop_column('panel_applicant', 'other_pronouns') |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | op.get_context().connection.execute('PRAGMA foreign_keys=ON;')
utcnow_server_default = "(datetime('now', 'utc'))" |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | utcnow_server_default = "timezone('utc', current_timestamp)" |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | column_info['default'] = utcnow_server_default |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | sqlite_column_reflect_listener |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | upgrade |
<|file_name|>bba880ef5bbd_add_is_loud_and_pronouns_columns_to_.py<|end_file_name|><|fim▁begin|>"""Add is_loud and pronouns columns to PanelApplicant
Revision ID: bba880ef5bbd
Revises: 8f8419ebcf27
Create Date: 2019-07-20 02:57:17.794469
"""
# revision identifiers, used by Alembic.
revision = 'bba880ef5bbd'
down_rev... | downgrade |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-<|fim▁hole|><|fim▁end|> | # See README.rst file on addon root folder for license details
from . import res_partner |
<|file_name|>async_test.py<|end_file_name|><|fim▁begin|># import asyncio
#
# async def compute(x, y):
# print("Compute %s + %s ..." % (x, y))
# await asyncio.sleep(1.0)
# return x + y
#
# async def print_sum(x, y):
# for i in range(10):<|fim▁hole|># loop.run_until_complete(print_sum(1,2))
# asyncio.en... | # result = await compute(x, y)
# print("%s + %s = %s" % (x, y, result))
#
# loop = asyncio.get_event_loop() |
<|file_name|>async_test.py<|end_file_name|><|fim▁begin|># import asyncio
#
# async def compute(x, y):
# print("Compute %s + %s ..." % (x, y))
# await asyncio.sleep(1.0)
# return x + y
#
# async def print_sum(x, y):
# for i in range(10):
# result = await compute(x, y)
# print("%s + %s = %... | i = 0
while True:
if i > num:
return
print('{}: Before loop {}'.format(who, i))
await asyncio.sleep(1)
i += 1 |
<|file_name|>async_test.py<|end_file_name|><|fim▁begin|># import asyncio
#
# async def compute(x, y):
# print("Compute %s + %s ..." % (x, y))
# await asyncio.sleep(1.0)
# return x + y
#
# async def print_sum(x, y):
# for i in range(10):
# result = await compute(x, y)
# print("%s + %s = %... | return |
<|file_name|>async_test.py<|end_file_name|><|fim▁begin|># import asyncio
#
# async def compute(x, y):
# print("Compute %s + %s ..." % (x, y))
# await asyncio.sleep(1.0)
# return x + y
#
# async def print_sum(x, y):
# for i in range(10):
# result = await compute(x, y)
# print("%s + %s = %... | display_date |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from djangocms_carousel import __version__
<|fim▁hole|>
INSTALL_REQUIRES = [
]
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Fra... | |
<|file_name|>upgrade.py<|end_file_name|><|fim▁begin|>from ftw.upgrade import UpgradeStep
from plone import api
class AddLanguageIndex(UpgradeStep):<|fim▁hole|> ct = api.portal.get_tool("portal_catalog")
survey_results = ct(portal_type="euphorie.survey")
for brain in survey_results:
... | """Add Language index."""
def __call__(self):
self.install_upgrade_profile() |
<|file_name|>upgrade.py<|end_file_name|><|fim▁begin|>from ftw.upgrade import UpgradeStep
from plone import api
class AddLanguageIndex(UpgradeStep):
<|fim_middle|>
<|fim▁end|> | """Add Language index."""
def __call__(self):
self.install_upgrade_profile()
ct = api.portal.get_tool("portal_catalog")
survey_results = ct(portal_type="euphorie.survey")
for brain in survey_results:
survey = brain.getObject()
survey.reindexObject(idxs=["... |
<|file_name|>upgrade.py<|end_file_name|><|fim▁begin|>from ftw.upgrade import UpgradeStep
from plone import api
class AddLanguageIndex(UpgradeStep):
"""Add Language index."""
def __call__(self):
<|fim_middle|>
<|fim▁end|> | self.install_upgrade_profile()
ct = api.portal.get_tool("portal_catalog")
survey_results = ct(portal_type="euphorie.survey")
for brain in survey_results:
survey = brain.getObject()
survey.reindexObject(idxs=["Language"]) |
<|file_name|>upgrade.py<|end_file_name|><|fim▁begin|>from ftw.upgrade import UpgradeStep
from plone import api
class AddLanguageIndex(UpgradeStep):
"""Add Language index."""
def <|fim_middle|>(self):
self.install_upgrade_profile()
ct = api.portal.get_tool("portal_catalog")
survey_resu... | __call__ |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
<|fim_middle|>
<|fim▁end|> | def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
print bags
def recipe_as(self, recipe):
print "r_as: %s" % recipe
def as_recipe(self, recipe, input):
print "as_r: %s" % input
def bag_as(self, bag):
print "b_as: %s" % bag
def ... |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
<|fim_middle|>
def list_bags(self, bags):
... | print recipes |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print bags |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "r_as: %s" % recipe |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "as_r: %s" % input |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "b_as: %s" % bag |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "as_b: %s" % input |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "t_as: %s" % tiddler |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | print "as_t: %s" % input |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def <|fim_middle|>(self, recipes):
print recipes
def list_bags(self, bags):
... | list_recipes |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def <|fim_middle|>(self, bags)... | list_bags |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | recipe_as |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | as_recipe |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | bag_as |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | as_bag |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | tiddler_as |
<|file_name|>debug.py<|end_file_name|><|fim▁begin|>
"""
External serialization for testing remote module loading.
"""
from tiddlyweb.serializations import SerializationInterface
class Serialization(SerializationInterface):
def list_recipes(self, recipes):
print recipes
def list_bags(self, bags):
... | as_tiddler |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
#from sc2casts_parser import *
from sc2casts_client import *
import json
from pprint import *
parser = SC2CastsParser()
client = SC2CastsClient()
TEST_DATA_DIR = 'data'
# test cases:
def test_titles():
pass
# test cases:
def test_cas... | assert actual[0]['game_title'] == 'Game 1'
assert actual[1]['game_id'] == '5lFLuOKYTa8'
assert actual[1]['game_title'] == 'Game 2' |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>""" Setup file """
import os
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(HERE, "README.rst")) as f:
README = f.read()
with open(os.path.join(HERE, "CHANGES.rst")) as f:
CHANGES = f.rea... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>""" Setup file """
import os
from setuptools import find_packages, setup
HERE = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(HERE, "README.rst")) as f:
README = f.read()
with open(os.path.join(HERE, "CHANGES.rst")) as f:
CHANGES = f.rea... | setup(
name="dynamo3",
version="1.0.0",
description="Python 3 compatible library for DynamoDB",
long_description=README + "\n\n" + CHANGES,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI A... |
<|file_name|>pyunit_binop2_plus.py<|end_file_name|><|fim▁begin|>import sys
sys.path.insert(1, "../../../")
import h2o
def binop_plus(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.show()
... | res2.show()
# LHS: H2OFrame, RHS: scaler |
<|file_name|>pyunit_binop2_plus.py<|end_file_name|><|fim▁begin|>import sys
sys.path.insert(1, "../../../")
import h2o
def binop_plus(ip,port):
# Connect to h2o
<|fim_middle|>
if __name__ == "__main__":
h2o.run_test(sys.argv, binop_plus)
<|fim▁end|> | h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.show()
###################################################################
# LHS: scaler, RHS: H2OFrame
res = 2 + iris
res_rows, res_cols = res.dim()
... |
<|file_name|>pyunit_binop2_plus.py<|end_file_name|><|fim▁begin|>import sys
sys.path.insert(1, "../../../")
import h2o
def binop_plus(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.show()
... | h2o.run_test(sys.argv, binop_plus) |
<|file_name|>pyunit_binop2_plus.py<|end_file_name|><|fim▁begin|>import sys
sys.path.insert(1, "../../../")
import h2o
def <|fim_middle|>(ip,port):
# Connect to h2o
h2o.init(ip,port)
iris = h2o.import_frame(path=h2o.locate("smalldata/iris/iris_wheader_65_rows.csv"))
rows, cols = iris.dim()
iris.sho... | binop_plus |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0<|fim▁hole|> print_granularity = p
print("%s: print granularity = %s" % (sys.argv[0], print_granularity))
def loop_... | total = 0
def set_print_granularity(p):
global print_granularity |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
<|fim_middle|>
def loop_count():
global min, max, avg, total, gran_star... | global print_granularity
print_granularity = p
print("%s: print granularity = %s" % (sys.argv[0], print_granularity)) |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | global min, max, avg, total, gran_start, sum, start, first, count
now = round(time.time() * 1000)
if not first:
elapsed = now - start
if elapsed < min: min = elapsed
if elapsed > max: max = elapsed
sum = sum + elapsed
start = now
count = count + 1
total = total + 1
if count % print_granularity == 0 and n... |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | elapsed = now - start
if elapsed < min: min = elapsed
if elapsed > max: max = elapsed
sum = sum + elapsed |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | min = elapsed |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | max = elapsed |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | gran_elapsed = now - gran_start
gran_start = now
avg = sum / print_granularity
print("%s: last %s run stats in msec \t\t elapsed = %s \t min = %s \t max = %s \t avg = %s \t\t total loops = %s" % (sys.argv[0], print_granularity, sum, min, max, avg, total))
# sys.stdout.write("-")
# sys.stdout.flush() |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | gran_start = now
min = 10e10
max = -10e10
avg = 0
sum = 0
first = False |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def <|fim_middle|>(p):
global print_granularity
print_granularity = p
print("%s: print granularity = %... | set_print_granularity |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import sys
import time
import sys
num = 1000
print_granularity = 1000
count = 0
first = True
start = 0
gran_start = 0
min = 0
max = 0
avg = 0
sum = 0
total = 0
def set_print_granularity(p):
global print_granularity
print_granularity = p
print("%s: print granular... | loop_count |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|># Copyright 2014 Dev in Cachu authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.views.deco... | name="palestrantes"), |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|># Copyright 2014 Dev in Cachu authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.views.deco... | urlpatterns += patterns("",
url(r"^media/(?P<path>.*)$",
"django.views.static.serve",
{"document_root": settings.MEDIA_ROOT}),
) |
<|file_name|>PageView.py<|end_file_name|><|fim▁begin|>"""
Page view class
"""
import os
from Server.Importer import ImportFromModule
class PageView(ImportFromModule("Server.PageViewBase", "PageViewBase")):
"""
Page view class.
"""
_PAGE_TITLE = "Python Web Framework"
def __init__(self, html... | |
<|file_name|>PageView.py<|end_file_name|><|fim▁begin|>"""
Page view class
"""
import os
from Server.Importer import ImportFromModule
class PageView(ImportFromModule("Server.PageViewBase", "PageViewBase")):
<|fim_middle|>
<|fim▁end|> | """
Page view class.
"""
_PAGE_TITLE = "Python Web Framework"
def __init__(self, htmlToLoad):
"""
Constructor.
- htmlToLoad : HTML to load
"""
self.SetPageTitle(self._PAGE_TITLE)
self.AddMetaData("charset=\"UTF-8\"")
self.AddMetaData("name... |
<|file_name|>PageView.py<|end_file_name|><|fim▁begin|>"""
Page view class
"""
import os
from Server.Importer import ImportFromModule
class PageView(ImportFromModule("Server.PageViewBase", "PageViewBase")):
"""
Page view class.
"""
_PAGE_TITLE = "Python Web Framework"
def __init__(self, html... | """
Constructor.
- htmlToLoad : HTML to load
"""
self.SetPageTitle(self._PAGE_TITLE)
self.AddMetaData("charset=\"UTF-8\"")
self.AddMetaData("name=\"viewport\" content=\"width=device-width, initial-scale=1\"")
self.AddStyleSheet("/css/styles.css")
... |
<|file_name|>PageView.py<|end_file_name|><|fim▁begin|>"""
Page view class
"""
import os
from Server.Importer import ImportFromModule
class PageView(ImportFromModule("Server.PageViewBase", "PageViewBase")):
"""
Page view class.
"""
_PAGE_TITLE = "Python Web Framework"
def <|fim_middle|>(self... | __init__ |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | if user is not None:
user[field] = value
context.user_service.update(user.to_json())
else: |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | context.base_user = User(username=username, email=email, password=password, first_name=first_name,
last_name=last_name) |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | context.user_service.save(context.base_user) |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | user_exists = context.user_service.exists(user_name)
assert context.base_user.username == user_exists['username']
assert context.base_user.password == user_exists['password']
assert context.base_user.email == user_exists['email']
assert context.base_user.first_name == user_exists['first_name']
a... |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | user = context.user_service.exists(username)
if user is not None:
user[field] = value
context.user_service.update(user.to_json())
else:
raise UserNotFound(username, "User was not found") |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | user = context.user_service.exists(username)
if user is not None:
assert user[field] == value
else:
raise UserNotFound(username, "User was not found") |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | user[field] = value
context.user_service.update(user.to_json()) |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | raise UserNotFound(username, "User was not found") |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | assert user[field] == value |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | raise UserNotFound(username, "User was not found") |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def <|fim_midd... | step_impl |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | step_impl |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | step_impl |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | step_impl |
<|file_name|>user_service_steps.py<|end_file_name|><|fim▁begin|>from behave import given, when, then
from genosdb.models import User
from genosdb.exceptions import UserNotFound
# 'mongodb://localhost:27017/')
@given('a valid user with values {username}, {password}, {email}, {first_name}, {last_name}')
def step_impl(... | step_impl |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... |
class CommentUpdateSerializer(serializers.ModelSerializer): |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | def get_url(self, obj,view_name,request,format):
kwargs = {
"cat_slug":obj.video.category.slug,
"vid_slug":obj.video.slug
}
# print(reverse(view_name,kwargs=kwargs))
return reverse(view_name,kwargs=kwargs,request=request,format=format) |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | kwargs = {
"cat_slug":obj.video.category.slug,
"vid_slug":obj.video.slug
}
# print(reverse(view_name,kwargs=kwargs))
return reverse(view_name,kwargs=kwargs,request=request,format=format) |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | user = serializers.CharField(source='user.username',read_only=True)
class Meta:
model = Comment
fields = [
'id',
'user',
'text'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | model = Comment
fields = [
'id',
'user',
'text'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | class Meta:
model = Comment
fields = [
'text',
'user',
'video',
'parent'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | model = Comment
fields = [
'text',
'user',
'video',
'parent'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | user = serializers.CharField(source='user.username',read_only=True)
class Meta:
model = Comment
fields = [
'id',
"user",
'text'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | model = Comment
fields = [
'id',
"user",
'text'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | url = serializers.HyperlinkedIdentityField("comment_detail_api",lookup_field="pk")
# user = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
video = CommentVideoUrlHyperlinkedIdentityField("video_detail_api")
user = serializers.CharField(source='user.username',read_only=True)
children... |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | queryset = Comment.objects.filter(parent__pk =instance.pk)
serializer = ChildCommentSerializer(queryset,context={"request":instance}, many=True)
return serializer.data |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | model = Comment
fields = [
"url",
'id',
"children",
# "parent",
"user",
'video',
'text'
] |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | authentication_classes = [SessionAuthentication, BasicAuthentication, JSONWebTokenAuthentication]
permission_classes = [permissions.IsAuthenticated,]
queryset = Comment.objects.all()
serializer_class = CommentSerializer |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | get_url |
<|file_name|>serializers.py<|end_file_name|><|fim▁begin|>from django.contrib.auth import get_user_model
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework import routers, serializers, viewsets, permissions
from rest_framework_jwt.authentication import JSONWebTo... | get_children |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models<|fim▁hole|>from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.Da... | |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
<|fim_middle|>
class Estado(models.Model):
"""Estado"""
nom_estado = models.CharField(max_length=50)
def __unicod... | """Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(auto_now=True)
def __unicode__(self):
return self.contenido |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | return self.contenido |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | """Estado"""
nom_estado = models.CharField(max_length=50)
def __unicode__(self):
return nom_estado |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | return nom_estado |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | """Categoria"""
nombre = models.CharField(max_length=50)
descripcion = models.TextField(help_text='Escribe una descripcion de la categoria') |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | """Entrada"""
autor = models.ForeignKey(User)
comentario = models.ForeignKey(Comentario)
estado = models.ForeignKey(Estado)
titulo = models.CharField(max_length=100)
contenido = models.TextField(help_text='Redacta el contenido')
fecha_pub = models.DateField(auto_now=True)
def __unicode__(self):
return self.... |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | return self.titulo |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | """agreador"""
entrada = models.ForeignKey(Entrada)
categoria = models.ManyToManyField(Categoria) |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | __unicode__ |
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.db import models
from django.contrib.auth.models import User
import MySQLdb
# Create your models here.
class Comentario(models.Model):
"""Comentario"""
contenido = models.TextField(help_text='Escribe un comentario')
fecha_coment = models.DateField(aut... | __unicode__ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.