prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | MAX_BALANCE = 2 ** 64
def __init__(self):
self._balance = 0
self.__id = generate_id()
def withdraw(self, amount):
if not isinstance(amount, int):
raise ValueError
if self._balance < amount:
raise WithdrawError(amount)
self._balance -= amount
... |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | self._balance = 0
self.__id = generate_id() |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | if not isinstance(amount, int):
raise ValueError
if self._balance < amount:
raise WithdrawError(amount)
self._balance -= amount
return self._balance |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | self._balance += amount
return self._balance |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | return AdvancedBankAccount.MAX_BALANCE |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | try:
print('Tricky called')
return 1
finally:
print('Tricky finally called')
return 42
return 0 |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | def area(self):
raise NotImplementedError |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | raise NotImplementedError |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | def __init__(self, radius):
self.radius = radius
def area(self):
return math.pi * self.radius ** 2 |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | self.radius = radius |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | return math.pi * self.radius ** 2 |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | def __init__(self, side):
self.side = side
def area(self):
return self.side ** 2 |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | self.side = side |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | return self.side ** 2 |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | print('Sorry, minimum balance must be maintained.') |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | BankAccount.withdraw(self, amount) |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | raise ValueError |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | raise WithdrawError(amount) |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | a = AdvancedBankAccount()
b = a
c = AdvancedBankAccount()
a.deposit(10)
# AdvancedBankAccount.deposit(a, 10) # the same
print('UNACCEPTABLE! b balance:', b._balance)
# print(b.__id) # error, name mangling
a.get_id = lambda self: self.__id
# print(a.get_id()) # TypeError
# print(... |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | print('no exception') |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | a = [Square(10), Circle(2)]
s = sum(s.area() for s in a)
print(s) |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def <|fim_middle|>(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global b... | deposit |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def <|fim_middle|>(amount):
global ba... | withdraw |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | make_account |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | deposit |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | withdraw |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | withdraw |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | deposit |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | withdraw |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | generate_id |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | withdraw |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | deposit |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | get_max_balance |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | tricky |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | area |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | area |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | __init__ |
<|file_name|>common_objects.py<|end_file_name|><|fim▁begin|>import os
import sys
import string
import random
import math
#################################################
# State
balance = 0
def deposit(amount):
global balance
balance += amount
return balance
def withdraw(amount):
global balance
... | area |
<|file_name|>0007_auto_20160710_1833.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0006_auto_20160616_1640'),
]
operations = [
migrations.AlterField(
model_name='episode'... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-10 18:33
from __future__ import unicode_literals |
<|file_name|>0007_auto_20160710_1833.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-10 18:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_middle|>
<|fim▁end|> | dependencies = [
('main', '0006_auto_20160616_1640'),
]
operations = [
migrations.AlterField(
model_name='episode',
name='edit_key',
field=models.CharField(blank=True, default='41086227', help_text='key to allow unauthenticated users to edit this item.', ... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.a * point[0] + self.b * point[1] + self.c > 0
|
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
<|fim_middle|>
class Polyhedron(object):
def __init__(self, surfaces):
self.surfaces = surfaces
class Space(object):
def __init__(self, models=None):
self.models = models or []
def add_... | def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surface's coordinate system.
:param image: image array
:param edge_points3d: array of ... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
<|fim_middle|>
def top_left_corner3d(self):
return self.edge_points3d[0]
def top_right_corner3d(self):
return self.edge_points3... | """
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surface's coordinate system.
:param image: image array
:param edge_points3d: array of 3d coordinates of 4 corner points in clockwise direction
... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.edge_points3d[0] |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.edge_points3d[1] |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.edge_points3d[2] |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.edge_points3d[3] |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | point_to_surface = point - self.top_left_corner3d()
distance_to_surface = self.normal.dot(point_to_surface)
return distance_to_surface |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | """
:return: the normal vector of the surface. It determined the front side
of the surface and it's not necessarily a unit vector
"""
p0 = self.edge_points3d[0]
p1 = self.edge_points3d[1]
p3 = self.edge_points3d[3]
v1 = p3 - p0
v2 = p1 - p0
... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | def __init__(self, surfaces):
self.surfaces = surfaces |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | self.surfaces = surfaces |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | def __init__(self, models=None):
self.models = models or []
def add_model(self, model):
assert isinstance(model, Polyhedron)
self.models.append(model) |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | self.models = models or [] |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | assert isinstance(model, Polyhedron)
self.models.append(model) |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | def __init__(self, point1, point2):
"""
Using the line equation a*x + b*y + c = 0 with b >= 0
:param point1: starting point
:param point2: ending point
:return: a Line object
"""
assert len(point1) == 2 and len(point2) == 2
self.a = point2[1] - point1... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | """
Using the line equation a*x + b*y + c = 0 with b >= 0
:param point1: starting point
:param point2: ending point
:return: a Line object
"""
assert len(point1) == 2 and len(point2) == 2
self.a = point2[1] - point1[1]
self.b = point1[0] - point2[... |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.a * point[0] + self.b * point[1] + self.c > 0 |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.a * point[0] + self.b * point[1] + self.c < 0 |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return self.a * point[0] + self.b * point[1] + self.c == 0 |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | if self.b == 0:
return 0.0
return 1.0 * (-self.c - self.a * x) / self.b |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | if self.a == 0:
return 0.0
return 1.0 * (-self.c - self.b * y) / self.a |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | self.a = -self.a
self.b = -self.b
self.c = -self.c |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return 0.0 |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | return 0.0 |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def <|fim_middle|>(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the ... | __init__ |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | top_left_corner3d |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | top_right_corner3d |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | bottom_right_corner3d |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | bottom_left_corner3d |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | distance_to_point |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | _get_normal_vector |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | __init__ |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | __init__ |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | add_model |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | __init__ |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | is_point_on_left |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | is_point_on_right |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | is_point_on_line |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | get_y_from_x |
<|file_name|>surface.py<|end_file_name|><|fim▁begin|>import numpy as np
class Surface(object):
def __init__(self, image, edge_points3d, edge_points2d):
"""
Constructor for a surface defined by a texture image and
4 boundary points. Choose the first point as the origin
of the surfac... | get_x_from_y |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | description = _("Comma-separated slug field")
def get_internal_type(self): |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | """A :class:`TextField` which is validated with a :class:`.TemplateValidator`. ``allow``, ``disallow``, and ``secure`` will be passed into the validator's construction."""
def __init__(self, allow=None, disallow=None, secure=True, *args, **kwargs):
super(TemplateField, self).__init__(*args, **kwargs)
self.validat... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | super(TemplateField, self).__init__(*args, **kwargs)
self.validators.append(TemplateValidator(allow, disallow, secure)) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | def __init__(self, field):
self.field = field
def __get__(self, instance, owner):
if instance is None:
raise AttributeError # ?
if self.field.name not in instance.__dict__:
json_string = getattr(instance, self.field.attname)
instance.__dict__[self.field.name] = json.loads(json_string)
return ... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | self.field = field |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | if instance is None:
raise AttributeError # ?
if self.field.name not in instance.__dict__:
json_string = getattr(instance, self.field.attname)
instance.__dict__[self.field.name] = json.loads(json_string)
return instance.__dict__[self.field.name] |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | instance.__dict__[self.field.name] = value
setattr(instance, self.field.attname, json.dumps(value)) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | del(instance.__dict__[self.field.name])
setattr(instance, self.field.attname, json.dumps(None)) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | """A :class:`TextField` which stores its value on the model instance as a python object and stores its value in the database as JSON. Validated with :func:`.json_validator`."""
default_validators = [json_validator]
def get_attname(self):
return "%s_json" % self.name
def contribute_to_class(self, cls, name):
... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | return "%s_json" % self.name |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | super(JSONField, self).contribute_to_class(cls, name)
setattr(cls, name, JSONDescriptor(self))
models.signals.pre_init.connect(self.fix_init_kwarg, sender=cls) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | if self.name in kwargs:
value = kwargs.pop(self.name)
# Hack to handle the xml serializer's handling of "null"
if value is None:
value = 'null'
kwargs[self.attname] = value |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | kwargs["form_class"] = JSONFormField
return super(JSONField, self).formfield(*args, **kwargs) |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | """Stores a selection of multiple items with unique slugs in the form of a comma-separated list. Also knows how to correctly handle :class:`RegistryIterator`\ s passed in as choices."""
__metaclass__ = models.SubfieldBase
description = _("Comma-separated slug field")
def get_internal_type(self):
return "TextFie... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation... | return "TextField" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.