uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
d4d70bef6a2b5280efeebfc8
train
function
def crop_and_resize_image(config, image, height, width, distort=False, nsummary=10): with tf.name_scope('crop_and_resize'): # Evaluation is done on a center-crop of this ratio eval_crop_ratio = 0.8 if distort: # crop_window = tf.stack( [0, 0, 7, 7] ) ...
def crop_and_resize_image(config, image, height, width, distort=False, nsummary=10):
with tf.name_scope('crop_and_resize'): # Evaluation is done on a center-crop of this ratio eval_crop_ratio = 0.8 if distort: # crop_window = tf.stack( [0, 0, 7, 7] ) # image = tf.image.decode_and_crop_jpeg( image, crop_window, channels=3 ) # image = tf.ima...
LenFeature(dtype=tf.float32), 'image/object/bbox/ymin': tf.VarLenFeature(dtype=tf.float32), 'image/object/bbox/xmax': tf.VarLenFeature(dtype=tf.float32), 'image/object/bbox/ymax': tf.VarLenFeature(dtype=tf.float32) } with tf.name_scope('deserialize_image_record'): obj = tf.parse_...
256
256
1,066
22
234
Ascend/modelzoo
built-in/TensorFlow/Official/cv/image_classification/ResNet50_for_TensorFlow/src/data_loader/resnet50/preprocessing.py
Python
crop_and_resize_image
crop_and_resize_image
49
131
49
50
2dec87270c946b05b86c13d34d14325a96542c97
bigcode/the-stack
train
b003f907636ce8288a7bfe73
train
function
def size_ok(FILENAME): # create a video reader using the tiny videofile VIDEOS+FILENAME video=cvCreateFileCapture(VIDEOS+FILENAME) if video is None: # couldn't open video (FAIL) return 1 # get width and height information via HighGUI's cvGetCaptureProperty function w=cvGetCaptureProperty(video,CV_CA...
def size_ok(FILENAME): # create a video reader using the tiny videofile VIDEOS+FILENAME
video=cvCreateFileCapture(VIDEOS+FILENAME) if video is None: # couldn't open video (FAIL) return 1 # get width and height information via HighGUI's cvGetCaptureProperty function w=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_WIDTH) h=cvGetCaptureProperty(video,CV_CAP_PROP_FRAME_HEIGHT) # get an i...
name of output window IMAGES = PREFIX+"images/" VIDEOS = PREFIX+"videos/" # testing routine, seeks through file and compares read images with frames in COMPARISON def size_ok(FILENAME): # create a video reader using the tiny videofile VIDEOS+FILENAME
64
64
187
23
40
qingswu/OpenCV1.2
tests/python/highgui/size_test.py
Python
size_ok
size_ok
25
52
25
26
51f4f6f55255bf52a0ce1c2c8abfdff5b713b1c8
bigcode/the-stack
train
c9a96d18944e07b2ba5b7920
train
function
def get_all(cwd): get_dir = os.listdir(cwd) #遍历当前目录,获取文件列表 for i in get_dir: sub_dir = os.path.join(cwd,i) # 把第一步获取的文件加入路径 if os.path.isdir(sub_dir): #如果当前仍然是文件夹,递归调用 get_all(sub_dir) else: ax = os.path.basename(sub_dir) #如果当前路径不是文件夹,则把文件名放入列表 ...
def get_all(cwd):
get_dir = os.listdir(cwd) #遍历当前目录,获取文件列表 for i in get_dir: sub_dir = os.path.join(cwd,i) # 把第一步获取的文件加入路径 if os.path.isdir(sub_dir): #如果当前仍然是文件夹,递归调用 get_all(sub_dir) else: ax = os.path.basename(sub_dir) #如果当前路径不是文件夹,则把文件名放入列表 result.ap...
import os result = [] def get_all(cwd):
12
64
130
6
6
kaka8686/practise
countFile.py
Python
get_all
get_all
3
12
3
3
ba7fbd31b0964668dff8ce08c2b7c1df8072bc92
bigcode/the-stack
train
45c0768a17837ae85378ce37
train
function
def get_capital_gps_location(path_locations_file, district): loc = pd.read_csv(path_locations_file, header=0, index_col=0, skipinitialspace=True) return loc['gps x'][district], loc['gps y'][district]
def get_capital_gps_location(path_locations_file, district):
loc = pd.read_csv(path_locations_file, header=0, index_col=0, skipinitialspace=True) return loc['gps x'][district], loc['gps y'][district]
(phi1) * math.cos(phi2)) arc = math.acos(cos) # Remember to multiply arc by the radius of the earth # in your favorite set of units to get length. return arc * 6371 def get_capital_gps_location(path_locations_file, district):
64
64
54
13
50
timvink/flee
distance_calc.py
Python
get_capital_gps_location
get_capital_gps_location
39
42
39
39
2a28135768fc637978fdc942f42cda9a4d75daab
bigcode/the-stack
train
64b6d3766f18d71890a1a327
train
function
def distance_on_unit_sphere(lat1, long1, lat2, long2): # https://gist.github.com/matbor/6837804 # Convert latitude and longitude to # spherical coordinates in radians. degrees_to_radians = math. pi / 180.0 # phi = 90 - latitude phi1 = (90.0 - lat1) * degrees_to_radians phi2 = (90.0 - lat2) ...
def distance_on_unit_sphere(lat1, long1, lat2, long2): # https://gist.github.com/matbor/6837804 # Convert latitude and longitude to # spherical coordinates in radians.
degrees_to_radians = math. pi / 180.0 # phi = 90 - latitude phi1 = (90.0 - lat1) * degrees_to_radians phi2 = (90.0 - lat2) * degrees_to_radians # theta = longitude theta1 = long1 * degrees_to_radians theta2 = long2 * degrees_to_radians # Compute spherical distance from spherical coord...
import math import csv import os import pandas as pd import numpy as np def distance_on_unit_sphere(lat1, long1, lat2, long2): # https://gist.github.com/matbor/6837804 # Convert latitude and longitude to # spherical coordinates in radians.
67
86
287
48
18
timvink/flee
distance_calc.py
Python
distance_on_unit_sphere
distance_on_unit_sphere
8
36
8
11
f200db75ea671c1e70843ecbddf53401dad89528
bigcode/the-stack
train
9ad1c12dc3a4089875d9103b
train
function
def update_links(path_links_file, path_locations_file): #links_file = open(path_links_file, "r") #locations_file = open(path_locations_file, "r") path_out_file = os.path.splitext(path_links_file)[0] + '-dist.csv' fileout = open(path_out_file, "w") fileout.write('#location1,location2,gps distance (km...
def update_links(path_links_file, path_locations_file): #links_file = open(path_links_file, "r") #locations_file = open(path_locations_file, "r")
path_out_file = os.path.splitext(path_links_file)[0] + '-dist.csv' fileout = open(path_out_file, "w") fileout.write('#location1,location2,gps distance (km)\n') #csvrdr = csv.reader(links_file, delimiter=",") with open(path_links_file, "r") as links_file: csvrdr_links = csv.DictReader(links_f...
loc = pd.read_csv(path_locations_file, header=0, index_col=0, skipinitialspace=True) return loc['gps x'][district], loc['gps y'][district] def update_links(path_links_file, path_locations_file): #links_file = open(path_links_file, "r") #locations_file = open(path_locations_file, "r...
78
78
263
37
41
timvink/flee
distance_calc.py
Python
update_links
update_links
45
63
45
47
e194641cbecd2206ff2cce835d6375a512df742f
bigcode/the-stack
train
43a1d6c8ea299386de955edb
train
class
@admin.register(Group) class GroupAdmin(admin.ModelAdmin): list_display = ['id','category','count','facility_preference']
@admin.register(Group) class GroupAdmin(admin.ModelAdmin):
list_display = ['id','category','count','facility_preference']
list_display = ['name','owner','capacity','id','room_count','address','occupant_count'] @admin.register(Person) class PersonAdmin(admin.ModelAdmin): list_display = ['id','name','age','risk','address','room','vip'] @admin.register(Group) class GroupAdmin(admin.ModelAdmin):
64
64
27
12
52
Harsh14901/QuarantineFacility
app/admin.py
Python
GroupAdmin
GroupAdmin
27
29
27
28
8784ca2e156bb5dcd9c2254a54b4ce68597e6ccb
bigcode/the-stack
train
3c05e963ed4fbfdeb44dc5ef
train
class
@admin.register(Room) class RoomAdmin(admin.ModelAdmin): list_display = ['room_num','floor','capacity','ward','occupant_count']
@admin.register(Room) class RoomAdmin(admin.ModelAdmin):
list_display = ['room_num','floor','capacity','ward','occupant_count']
from django.contrib import admin from .models import * # Register your models here. @admin.register(Luxury) class LuxuryAdmin(admin.ModelAdmin): list_display = ['category','cost'] @admin.register(Room) class RoomAdmin(admin.ModelAdmin):
52
64
30
12
40
Harsh14901/QuarantineFacility
app/admin.py
Python
RoomAdmin
RoomAdmin
11
13
11
12
6e86cdb6bffc221c0e6b90c563d375cdeca1f3c8
bigcode/the-stack
train
86f97d72fd66566e206a8589
train
class
@admin.register(Medicine) class MedicineAdmin(admin.ModelAdmin): list_display = ['name','cost']
@admin.register(Medicine) class MedicineAdmin(admin.ModelAdmin):
list_display = ['name','cost']
Admin(admin.ModelAdmin): list_display = ['id','name','age','risk','address','room','vip'] @admin.register(Group) class GroupAdmin(admin.ModelAdmin): list_display = ['id','category','count','facility_preference'] @admin.register(Medicine) class MedicineAdmin(admin.ModelAdmin):
64
64
22
13
51
Harsh14901/QuarantineFacility
app/admin.py
Python
MedicineAdmin
MedicineAdmin
32
34
32
33
b86b108a948c75397a6a7fb1f6b9a49e70ef078b
bigcode/the-stack
train
6ba9e1867acc94debb74fe85
train
class
@admin.register(Luxury) class LuxuryAdmin(admin.ModelAdmin): list_display = ['category','cost']
@admin.register(Luxury) class LuxuryAdmin(admin.ModelAdmin):
list_display = ['category','cost']
from django.contrib import admin from .models import * # Register your models here. @admin.register(Luxury) class LuxuryAdmin(admin.ModelAdmin):
31
64
24
14
17
Harsh14901/QuarantineFacility
app/admin.py
Python
LuxuryAdmin
LuxuryAdmin
7
9
7
8
74a6c2419fd6eb9ee0d8c95c13ac14a668a1a29c
bigcode/the-stack
train
2934e299d8a52e9398131d82
train
class
@admin.register(CheckupRecords) class CheckupRecordsAdmin(admin.ModelAdmin): list_display = ['person','doctor','date','health_status','next_checkup_date']
@admin.register(CheckupRecords) class CheckupRecordsAdmin(admin.ModelAdmin):
list_display = ['person','doctor','date','health_status','next_checkup_date']
admin.register(Group) class GroupAdmin(admin.ModelAdmin): list_display = ['id','category','count','facility_preference'] @admin.register(Medicine) class MedicineAdmin(admin.ModelAdmin): list_display = ['name','cost'] @admin.register(CheckupRecords) class CheckupRecordsAdmin(admin.ModelAdmin):
64
64
35
16
48
Harsh14901/QuarantineFacility
app/admin.py
Python
CheckupRecordsAdmin
CheckupRecordsAdmin
37
39
37
38
03d1f8c482ff437beb606d3de618284e886dfdbf
bigcode/the-stack
train
88ba42f02f66122f89e79172
train
class
@admin.register(Discharged) class DischargedAdmin(admin.ModelAdmin): list_display = ['person','date_discharged']
@admin.register(Discharged) class DischargedAdmin(admin.ModelAdmin):
list_display = ['person','date_discharged']
Admin(admin.ModelAdmin): list_display = ['name','cost'] @admin.register(CheckupRecords) class CheckupRecordsAdmin(admin.ModelAdmin): list_display = ['person','doctor','date','health_status','next_checkup_date'] @admin.register(Discharged) class DischargedAdmin(admin.ModelAdmin):
64
64
28
15
49
Harsh14901/QuarantineFacility
app/admin.py
Python
DischargedAdmin
DischargedAdmin
41
43
41
42
aebdae797aeb36ab9f3aadf40b0a63a7e5a34871
bigcode/the-stack
train
15e111b8fc6b28666feba60b
train
class
@admin.register(City) class CityAdmin(admin.ModelAdmin): list_display = ['name','admin']
@admin.register(City) class CityAdmin(admin.ModelAdmin):
list_display = ['name','admin']
(admin.ModelAdmin): list_display = ['person','doctor','date','health_status','next_checkup_date'] @admin.register(Discharged) class DischargedAdmin(admin.ModelAdmin): list_display = ['person','date_discharged'] @admin.register(City) class CityAdmin(admin.ModelAdmin):
64
64
23
13
51
Harsh14901/QuarantineFacility
app/admin.py
Python
CityAdmin
CityAdmin
45
47
45
46
fd94345562d367539a5073200f73ecaaf0f8d771
bigcode/the-stack
train
a6e23c02e25d2de3aa18ecee
train
class
@admin.register(Ward) class WardAdmin(admin.ModelAdmin): list_display = ['category','capacity','room_count','facility','occupant_count']
@admin.register(Ward) class WardAdmin(admin.ModelAdmin):
list_display = ['category','capacity','room_count','facility','occupant_count']
(Luxury) class LuxuryAdmin(admin.ModelAdmin): list_display = ['category','cost'] @admin.register(Room) class RoomAdmin(admin.ModelAdmin): list_display = ['room_num','floor','capacity','ward','occupant_count'] @admin.register(Ward) class WardAdmin(admin.ModelAdmin):
64
64
31
13
51
Harsh14901/QuarantineFacility
app/admin.py
Python
WardAdmin
WardAdmin
15
17
15
16
390bcb3e6e8d494d846a4e45906e87dfde335f8e
bigcode/the-stack
train
de7c74536c08941e6a3a1e20
train
class
@admin.register(Person) class PersonAdmin(admin.ModelAdmin): list_display = ['id','name','age','risk','address','room','vip']
@admin.register(Person) class PersonAdmin(admin.ModelAdmin):
list_display = ['id','name','age','risk','address','room','vip']
_display = ['category','capacity','room_count','facility','occupant_count'] @admin.register(Facility) class FacilityAdmin(admin.ModelAdmin): list_display = ['name','owner','capacity','id','room_count','address','occupant_count'] @admin.register(Person) class PersonAdmin(admin.ModelAdmin):
64
64
31
12
52
Harsh14901/QuarantineFacility
app/admin.py
Python
PersonAdmin
PersonAdmin
23
25
23
24
c496fcc4a4962537efaa373775cde783e0d4237d
bigcode/the-stack
train
fc1a8370dcc3bd48d203e350
train
class
@admin.register(Facility) class FacilityAdmin(admin.ModelAdmin): list_display = ['name','owner','capacity','id','room_count','address','occupant_count']
@admin.register(Facility) class FacilityAdmin(admin.ModelAdmin):
list_display = ['name','owner','capacity','id','room_count','address','occupant_count']
): list_display = ['room_num','floor','capacity','ward','occupant_count'] @admin.register(Ward) class WardAdmin(admin.ModelAdmin): list_display = ['category','capacity','room_count','facility','occupant_count'] @admin.register(Facility) class FacilityAdmin(admin.ModelAdmin):
64
64
36
14
50
Harsh14901/QuarantineFacility
app/admin.py
Python
FacilityAdmin
FacilityAdmin
19
21
19
20
16dc50f8db6ccfad1ec07b924935826439e0c0be
bigcode/the-stack
train
305349d2d82c27400e4bc24a
train
function
def radiometry_projection(M, images_loaded, calibration, mode="avg", scale=0.0038909912109375): """ This function add to a point M a new channel, computed from the loaded images. Therefore, the images should be calibrated in the same reference of your point M. Usually, the 3D point M is part of a cloud ...
def radiometry_projection(M, images_loaded, calibration, mode="avg", scale=0.0038909912109375):
""" This function add to a point M a new channel, computed from the loaded images. Therefore, the images should be calibrated in the same reference of your point M. Usually, the 3D point M is part of a cloud points. The point M is projected in all images that see the point. Then, the radiometry from...
""" Module to preprocess images. """ # -*- coding: utf-8 -*- # Created on Sun Jul 14 10:17:54 2019 # @author: Cédric Perion | Arthur Dujardin import random import numpy as np import math from colorply import process from colorply import io from colorply import mm3d def radiometry_projection(M, images_loaded, calibra...
104
177
592
26
77
arthurdjn/colorply
colorply/process/improcess.py
Python
radiometry_projection
radiometry_projection
18
84
18
18
ae58756db7739df2860c61b88bf9d14d97dd08d6
bigcode/the-stack
train
a4319dd464c52f879c46749c
train
function
def add_cloud_channel(input_ply, output_ply, calibration_file, orientation_dir, image_dir, image_ext="TIF", channel="unk", mode="avg", progress=None): """ All together. Project all points from a ply file. Parameters ---------- input_ply : plydata The cloud points to ad...
def add_cloud_channel(input_ply, output_ply, calibration_file, orientation_dir, image_dir, image_ext="TIF", channel="unk", mode="avg", progress=None):
""" All together. Project all points from a ply file. Parameters ---------- input_ply : plydata The cloud points to add a new channel. output_ply : plydata The output cloud points, with the new channel. calibration_file : str Path to the MicMac calibration file. ...
R = img.R S = img.S # Projection m = process.image_formula_corrected(F, M, R, S, pps, a, b, c) mx = int(np.round(m[0])) my = int(np.round(m[1])) # Test if the projected point is visible from the images if (0 < mx < size[0]) and (0 < m...
189
189
631
39
149
arthurdjn/colorply
colorply/process/improcess.py
Python
add_cloud_channel
add_cloud_channel
87
173
87
88
afd9178a076ddf541d66e23954cd2af488caa81b
bigcode/the-stack
train
4e25621cfcb1067b1287ad6f
train
function
def compute_eucos_dist(mav, feature): dist = spd.euclidean(mav, feature) / 200 + spd.cosine(mav, feature) return dist
def compute_eucos_dist(mav, feature):
dist = spd.euclidean(mav, feature) / 200 + spd.cosine(mav, feature) return dist
import torch import torch.nn as nn import numpy as np import scipy.spatial.distance as spd def compute_eucos_dist(mav, feature):
33
64
39
10
22
Cogito2012/OpenTAL
AFSD/thumos14/openmax.py
Python
compute_eucos_dist
compute_eucos_dist
7
9
7
7
7f650a902f860ed654d5dbb3582fed0a4d02f0d8
bigcode/the-stack
train
495d5b2da05f11c9aefe5d92
train
class
class OpenMax(nn.Module): def __init__(self, weibull_model, rank=1): super(OpenMax, self).__init__() self.weibull_model = weibull_model self.class_names = list(weibull_model.keys()) self.num_cls = len(self.class_names) self.rank = rank def compute_openmax_prob(self, ope...
class OpenMax(nn.Module):
def __init__(self, weibull_model, rank=1): super(OpenMax, self).__init__() self.weibull_model = weibull_model self.class_names = list(weibull_model.keys()) self.num_cls = len(self.class_names) self.rank = rank def compute_openmax_prob(self, openmax_score, openmax_score_...
import torch import torch.nn as nn import numpy as np import scipy.spatial.distance as spd def compute_eucos_dist(mav, feature): dist = spd.euclidean(mav, feature) / 200 + spd.cosine(mav, feature) return dist class OpenMax(nn.Module):
68
234
780
6
61
Cogito2012/OpenTAL
AFSD/thumos14/openmax.py
Python
OpenMax
OpenMax
12
86
12
12
2ed2bc334db845cdfcf6bab8d169faace7678065
bigcode/the-stack
train
55fa70b2ad0f36c740f4375e
train
function
def create_pandas_abc_type(name, attr, comp): @classmethod def _check(cls, inst): return getattr(inst, attr, "_typ") in comp dct = dict(__instancecheck__=_check, __subclasscheck__=_check) meta = type("ABCBase", (type,), dct) return meta(name, tuple(), dct)
def create_pandas_abc_type(name, attr, comp): @classmethod
def _check(cls, inst): return getattr(inst, attr, "_typ") in comp dct = dict(__instancecheck__=_check, __subclasscheck__=_check) meta = type("ABCBase", (type,), dct) return meta(name, tuple(), dct)
""" define generic base classes for pandas objects """ # define abstract base classes to enable isinstance type checking on our # objects def create_pandas_abc_type(name, attr, comp): @classmethod
43
64
82
17
25
mokshagna517/recommendation_sys
venv/Lib/site-packages/pandas/core/dtypes/generic.py
Python
create_pandas_abc_type
create_pandas_abc_type
6
13
6
7
f5812f9af96b92e56ae45c46dcc72b6a4c0f7f3d
bigcode/the-stack
train
858f5a0c88709408e66949ce
train
class
class _ABCGeneric(type): def __instancecheck__(cls, inst): return hasattr(inst, "_data")
class _ABCGeneric(type):
def __instancecheck__(cls, inst): return hasattr(inst, "_data")
CExtensionArray", "_typ", ("extension", "categorical", "periodarray", "datetimearray", "timedeltaarray"), ) ABCPandasArray = create_pandas_abc_type("ABCPandasArray", "_typ", ("npy_extension",)) class _ABCGeneric(type):
64
64
24
6
58
mokshagna517/recommendation_sys
venv/Lib/site-packages/pandas/core/dtypes/generic.py
Python
_ABCGeneric
_ABCGeneric
81
83
81
81
d1511e7be0c1b619cebc75a43832bdb5dee3f62d
bigcode/the-stack
train
8a057194f3f5e2a41c5525c8
train
class
@dataclass class OrderType: number: Optional[str] = field( default=None, metadata={ "type": "Element", "namespace": "", "required": True, } ) customer: Optional[CustomerType] = field( default=None, metadata={ "type": "El...
@dataclass class OrderType:
number: Optional[str] = field( default=None, metadata={ "type": "Element", "namespace": "", "required": True, } ) customer: Optional[CustomerType] = field( default=None, metadata={ "type": "Element", "namespa...
from dataclasses import dataclass, field from typing import Optional from tests.fixtures.defxmlschema.chapter04cust import CustomerType from tests.fixtures.defxmlschema.chapter04prod import ItemsType __NAMESPACE__ = "http://example.org/ord" @dataclass class OrderType:
62
64
125
7
55
gramm/xsdata
tests/fixtures/defxmlschema/chapter04.py
Python
OrderType
OrderType
9
34
9
10
aa155a87ecd1880963a8a44b5de5f9969b4f5f22
bigcode/the-stack
train
65cf7625d9086fcdb15a8dac
train
class
@dataclass class Order(OrderType): class Meta: name = "order" namespace = "http://example.org/ord"
@dataclass class Order(OrderType):
class Meta: name = "order" namespace = "http://example.org/ord"
", "namespace": "", "required": True, } ) items: Optional[ItemsType] = field( default=None, metadata={ "type": "Element", "namespace": "", "required": True, } ) @dataclass class Order(OrderType):
64
64
29
8
56
gramm/xsdata
tests/fixtures/defxmlschema/chapter04.py
Python
Order
Order
37
41
37
38
d2d528994c65fa41d13b204886bacaa8c09f2676
bigcode/the-stack
train
37079ea7a98f03a1bce35bea
train
function
def exec_sql(sql_: str, conn_: Union[str, "iconnection.IConnection"] = "default") -> bool: """ Run a query. """ if application.PROJECT.conn_manager is None: raise Exception("Project is not connected yet") if isinstance(conn_, str): my_conn = application.PROJECT.conn_manager.useConn...
def exec_sql(sql_: str, conn_: Union[str, "iconnection.IConnection"] = "default") -> bool:
""" Run a query. """ if application.PROJECT.conn_manager is None: raise Exception("Project is not connected yet") if isinstance(conn_, str): my_conn = application.PROJECT.conn_manager.useConn(conn_) else: my_conn = conn_ try: last = my_conn.lastError() ...
version of sqlDelete. Execute the query directly without checking and without committing signals.Use with caution. """ return exec_sql("DELETE FROM %s WHERE %s" % (table_, where_), conn_) def exec_sql(sql_: str, conn_: Union[str, "iconnection.IConnection"] = "default") -> bool:
67
68
229
25
42
Aulla/pineboo
pineboolib/application/database/utils.py
Python
exec_sql
exec_sql
352
380
352
352
7a9413f4a1084f3fc3f2727b015dcb33d444031d
bigcode/the-stack
train
b6fd272c621dad0670f6436a
train
class
class ClassManager(object): """ClassManager class.""" def __getattr__(self, name: str) -> Any: """Return class.""" class_ = None if name in application.FILE_CLASSES.keys(): class_ = getattr( qsadictmodules.QSADictModules.qsa_dict_modules(), "%s_class" % name...
class ClassManager(object):
"""ClassManager class.""" def __getattr__(self, name: str) -> Any: """Return class.""" class_ = None if name in application.FILE_CLASSES.keys(): class_ = getattr( qsadictmodules.QSADictModules.qsa_dict_modules(), "%s_class" % name, None ) ...
1: class_name = class_name[0 : class_name.find('"')] if class_name.find("'") > -1: class_name = class_name[0 : class_name.find("'")] if class_name: application.FILE_CLASSES[class_name] = file_obj.filename class ClassManager(object):
64
64
166
5
58
Aulla/pineboo
pineboolib/application/database/utils.py
Python
ClassManager
ClassManager
399
419
399
399
c1e140880c3908c6f40b5d61ec570e506006f283
bigcode/the-stack
train
117c2d0329ec56c248416931
train
function
def sql_select( from_: str, select_: str, where_: Optional[str] = None, table_list_: Optional[Union[str, List, types.Array]] = None, size_: int = 0, # pylint: disable=unused-argument conn_: Union[str, "iconnection.IConnection"] = "default", ) -> Any: """ Execute a query of type select, ...
def sql_select( from_: str, select_: str, where_: Optional[str] = None, table_list_: Optional[Union[str, List, types.Array]] = None, size_: int = 0, # pylint: disable=unused-argument conn_: Union[str, "iconnection.IConnection"] = "default", ) -> Any:
""" Execute a query of type select, returning the results of the first record found. @param from_: from the query statement. @param select_: Select statement of the query, which will be the name of the field to return. @param where_: Where statement of the query. @param table_list_: Tableslist ...
== "double": return _numero return None def sql_select( from_: str, select_: str, where_: Optional[str] = None, table_list_: Optional[Union[str, List, types.Array]] = None, size_: int = 0, # pylint: disable=unused-argument conn_: Union[str, "iconnection.IConnection"] = "default", ...
91
91
304
78
12
Aulla/pineboo
pineboolib/application/database/utils.py
Python
sql_select
sql_select
171
203
171
178
2d9f41fcc37d73671479150ab546fee2ee0bb3e2
bigcode/the-stack
train
48b4706af9f774b44857574f
train
function
def sql_update( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], where_: str, conn_: Union[str, "iconnection.IConnection"] = "default", ) -> bool: """ Modify one or more records in a table using an FLSqlCursor object....
def sql_update( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], where_: str, conn_: Union[str, "iconnection.IConnection"] = "default", ) -> bool:
""" Modify one or more records in a table using an FLSqlCursor object. @param table_ Table name. @param field_list_ Comma separated list of field names. @param value_list_ Comma separated list of corresponding values. @param where_ Where statement to identify the records to be edited. @para...
else: _cursor.setValueBuffer(_field_list[_pos], _value_list[_pos]) return _cursor.commitBuffer() def sql_update( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], where_: str, conn_: Union[str, "iconne...
93
93
311
65
28
Aulla/pineboo
pineboolib/application/database/utils.py
Python
sql_update
sql_update
271
311
271
277
fd075ddd50d28258b5bb717bd7f22f5392a30747
bigcode/the-stack
train
b5281f7eb1e5cabb68c352ee
train
function
def sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool: """ Delete one or more records in a table using an FLSqlCursor object. @param table_ Table name. @param where_ Where statement to identify the records to be deleted. @param conn_name_ C...
def sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool:
""" Delete one or more records in a table using an FLSqlCursor object. @param table_ Table name. @param where_ Where statement to identify the records to be deleted. @param conn_name_ Connection name. @return True in case of successful insertion, false in any other case. """ _cursor = ...
else: _cursor.setValueBuffer(field_list_, value_list_) if not _cursor.commitBuffer(): return False return True def sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool:
64
64
186
32
31
Aulla/pineboo
pineboolib/application/database/utils.py
Python
sql_delete
sql_delete
314
340
314
316
607de68f2a41ae13701bd53b1045427a04c9af8f
bigcode/the-stack
train
76cf9b915c73c82c618118ef
train
function
def process_file_class(file_obj: "file_app.File") -> None: """Process file class.""" file_ = open(file_obj.path(), "r", encoding="UTF-8", errors="replace") text_ = file_.read() class_name = "" if text_.find("public_class =") > -1: class_name = text_[text_.find("public_class =") + 15 :].split...
def process_file_class(file_obj: "file_app.File") -> None:
"""Process file class.""" file_ = open(file_obj.path(), "r", encoding="UTF-8", errors="replace") text_ = file_.read() class_name = "" if text_.find("public_class =") > -1: class_name = text_[text_.find("public_class =") + 15 :].split(" ")[0][1:-1] if class_name.find('"') > -1: ...
my_conn.lastError() != last: return False return True except Exception as exc: LOGGER.exception("execSql: Error al ejecutar la consulta SQL: %s %s", sql_, exc) return False def process_file_class(file_obj: "file_app.File") -> None:
64
64
166
15
48
Aulla/pineboo
pineboolib/application/database/utils.py
Python
process_file_class
process_file_class
383
396
383
383
8066983c10b36050edd529c638aed8ab23d31a9d
bigcode/the-stack
train
f5e6ab400bac7a240ee1889b
train
function
def sql_insert( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], conn_: Union[str, "iconnection.IConnection"] = "default", ) -> bool: """ Perform the insertion of a record in a table using an FLSqlCursor object. @par...
def sql_insert( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], conn_: Union[str, "iconnection.IConnection"] = "default", ) -> bool:
""" Perform the insertion of a record in a table using an FLSqlCursor object. @param table_ Table name. @param field_list_ Comma separated list of field names. @param value_list_ Comma separated list of corresponding values. @param conn_name_ Connection name. @return True in case of success...
conn_) return ( _qry.value(0) if _qry.exec_("SELECT %s FROM %s WHERE %s " % (select_, from_, where_)) and _qry.first() else False ) def sql_insert( table_: str, field_list_: Union[str, List[str], types.Array], value_list_: Union[str, List, bool, int, float, types.Array], ...
108
108
362
60
48
Aulla/pineboo
pineboolib/application/database/utils.py
Python
sql_insert
sql_insert
224
268
224
229
31bb9680788d75c38e0591c3547ad70336561f6e
bigcode/the-stack
train
9cd2daf1e96beac9e6717977
train
function
def quick_sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool: """ Quick version of sqlDelete. Execute the query directly without checking and without committing signals.Use with caution. """ return exec_sql("DELETE FROM %s WHERE %s" % (table_, wh...
def quick_sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool:
""" Quick version of sqlDelete. Execute the query directly without checking and without committing signals.Use with caution. """ return exec_sql("DELETE FROM %s WHERE %s" % (table_, where_), conn_)
_cursor.setModeAccess(_cursor.Del) _cursor.refreshBuffer() if not _cursor.commitBuffer(): return False return True def quick_sql_delete( table_: str, where_: str, conn_: Union[str, "iconnection.IConnection"] = "default" ) -> bool:
64
64
79
33
30
Aulla/pineboo
pineboolib/application/database/utils.py
Python
quick_sql_delete
quick_sql_delete
343
349
343
345
86fede46ea0e31e847fedfb80da309de8e69c24c
bigcode/the-stack
train
563cc5c13861bed20e07ee6f
train
function
def _next_counter3( serie_: str, name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optional[Union[str, int]]: if not cursor_: return None tmd = cursor_.metadata() field = tmd.field(name_) if field is None: return None _type = field.type() ...
def _next_counter3( serie_: str, name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optional[Union[str, int]]:
if not cursor_: return None tmd = cursor_.metadata() field = tmd.field(name_) if field is None: return None _type = field.type() _len: int = field.length() - len(serie_) _where: str = "length(%s)=%d AND %s" % ( name_, field.length(), cursor_.db()....
== "string": _cadena = str(_numero) return _cadena.rjust(_len, "0") if len(_cadena) < _len else _cadena elif type_ == "double": return _numero return None def _next_counter3( serie_: str, name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optiona...
96
96
321
43
52
Aulla/pineboo
pineboolib/application/database/utils.py
Python
_next_counter3
_next_counter3
125
168
125
128
25237e16427f8fd806e2b76d7fabe8cf737fe119
bigcode/the-stack
train
d0222cc2c00ca2df6098637e
train
function
def _next_counter2( name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optional[Union[str, int]]: if not cursor_: return None tmd = cursor_.metadata() field = tmd.field(name_) if field is None: return None type_ = field.type() if type_ n...
def _next_counter2( name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optional[Union[str, int]]:
if not cursor_: return None tmd = cursor_.metadata() field = tmd.field(name_) if field is None: return None type_ = field.type() if type_ not in ("string", "double"): return None _len = int(field.length()) _where: str = cursor_.db().sqlLength(name_, _len) ...
next_counter2(name_or_series, cursor_or_name) else: if not isinstance(cursor_or_name, str): raise ValueError return _next_counter3(name_or_series, cursor_or_name, cursor_) def _next_counter2( name_: str, cursor_: Union["isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"] ) -> Optiona...
84
85
284
39
45
Aulla/pineboo
pineboolib/application/database/utils.py
Python
_next_counter2
_next_counter2
79
122
79
82
b55db39320737ae895ded9494dda21c949bc88d9
bigcode/the-stack
train
d52c11687e720a1e93da925e
train
function
def quick_sql_select( from_: str, select_: str, where_: Optional[str] = "1 = 1", conn_: Union[str, "iconnection.IConnection"] = "default", ) -> Any: """ Quick version of sqlSelect. Run the query directly without checking.Use with caution. """ _qry = pnsqlquery.PNSqlQuery(None, conn_) ...
def quick_sql_select( from_: str, select_: str, where_: Optional[str] = "1 = 1", conn_: Union[str, "iconnection.IConnection"] = "default", ) -> Any:
""" Quick version of sqlSelect. Run the query directly without checking.Use with caution. """ _qry = pnsqlquery.PNSqlQuery(None, conn_) return ( _qry.value(0) if _qry.exec_("SELECT %s FROM %s WHERE %s " % (select_, from_, where_)) and _qry.first() else False )
.exec_() or not _qry.first() else _qry.value(0) def quick_sql_select( from_: str, select_: str, where_: Optional[str] = "1 = 1", conn_: Union[str, "iconnection.IConnection"] = "default", ) -> Any:
64
64
131
48
16
Aulla/pineboo
pineboolib/application/database/utils.py
Python
quick_sql_select
quick_sql_select
206
221
206
211
89a05ca1f758a8a46b298e7745c517c9f111f51d
bigcode/the-stack
train
01f1714947a02bf08fef8797
train
function
def next_counter( name_or_series: str, cursor_or_name: Union[str, "isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"], cursor_: Optional["isqlcursor.ISqlCursor"] = None, ) -> Optional[Union[str, int]]: """ Return the following value of a counter type field of a table. This method is very usefu...
def next_counter( name_or_series: str, cursor_or_name: Union[str, "isqlcursor.ISqlCursor", "dummy_cursor.DummyCursor"], cursor_: Optional["isqlcursor.ISqlCursor"] = None, ) -> Optional[Union[str, int]]:
""" Return the following value of a counter type field of a table. This method is very useful when inserting records in which the reference is sequential and we don't remember which one was the last number used The return value is a QVariant of the field type is the one that looks for the last ...
boolib.application import types, qsadictmodules, load_script from pineboolib import application from pineboolib.application.database.orm import dummy_cursor from . import pnsqlcursor, pnsqlquery from typing import Any, Union, List, Optional, TYPE_CHECKING if TYPE_CHECKING: from pineboolib.interfaces import ico...
179
179
599
58
121
Aulla/pineboo
pineboolib/application/database/utils.py
Python
next_counter
next_counter
23
76
23
27
d822aa706d29e13eadc1a895873a5df7792c0b92
bigcode/the-stack
train
0476d4c30cc0f7c47bb71ae7
train
function
def run_svc(X,y,k,n_perm,model,fileName): y_rand=np.random.permutation(y) predict,dec,y_sorted,weight=model.main_svc_rfe_cv(X,y_rand,k) # # write h5py # write_h5py(fileName,'perm'+str(n_perm),['predict','dec','y_sorted','weight'],\ # [predict,dec,y_sorted,weight]) # write mat write_mat(os...
def run_svc(X,y,k,n_perm,model,fileName):
y_rand=np.random.permutation(y) predict,dec,y_sorted,weight=model.main_svc_rfe_cv(X,y_rand,k) # # write h5py # write_h5py(fileName,'perm'+str(n_perm),['predict','dec','y_sorted','weight'],\ # [predict,dec,y_sorted,weight]) # write mat write_mat(os.path.join(fileName,str(n_perm)),\ ...
n_perm in np.arange(start,end)) start+=batchsize end=min(end+batchsize,N_perm) end_time=time.clock() print('running time is: {:.1f} second'.format(end_time-start_time)) def run_svc(X,y,k,n_perm,model,fileName):
63
64
131
14
49
dongmengshi/easylearn
eslearn/machine_learning/classfication/lc_permutation_svc.py
Python
run_svc
run_svc
46
55
46
46
66e389f41779e7a7ac03983e24c1ca2475c22bbc
bigcode/the-stack
train
1ee44d5ab64b2db6851a6a8f
train
function
def permutation(X,y,k,N_perm,batchsize,fileName): # instantiating object model=lsvc.svc_rfe_cv(permutation=1,num_jobs=1)# # blocks=int(np.ceil(N_perm/batchsize)) start_time=time.clock() start=0 end=batchsize for i in range(blocks): print('{:.1f}%'.format((i*100)/blocks)) ...
def permutation(X,y,k,N_perm,batchsize,fileName): # instantiating object
model=lsvc.svc_rfe_cv(permutation=1,num_jobs=1)# # blocks=int(np.ceil(N_perm/batchsize)) start_time=time.clock() start=0 end=batchsize for i in range(blocks): print('{:.1f}%'.format((i*100)/blocks)) Parallel(n_jobs=2,backend='threading')\ (delayed(run_svc)(X,y,k,n_per...
,read_mat #from read_write_Mat_LC import write_mat import time,os import numpy as np import pandas as pd import lc_svc_rfe_cv as lsvc # def def permutation(X,y,k,N_perm,batchsize,fileName): # instantiating object
64
64
176
20
43
dongmengshi/easylearn
eslearn/machine_learning/classfication/lc_permutation_svc.py
Python
permutation
permutation
28
44
28
29
f52fd26600ebb3183a424c504ae4a9d2f19c6e4b
bigcode/the-stack
train
46c30d0c65b2688ad58d39da
train
class
class FileSystemManager: def get_files(self, absolute_path, recursive=False): if len(absolute_path) == '' or not os.path.isdir(absolute_path) or not os.access(absolute_path, os.R_OK): return {} data = {} for file in sorted(glob.glob(os.path.join(absolute_path, '**'), recursive=r...
class FileSystemManager:
def get_files(self, absolute_path, recursive=False): if len(absolute_path) == '' or not os.path.isdir(absolute_path) or not os.access(absolute_path, os.R_OK): return {} data = {} for file in sorted(glob.glob(os.path.join(absolute_path, '**'), recursive=recursive)): i...
import os import glob import datetime class FileSystemManager:
14
124
416
5
8
didi9575/crackerjack
app/lib/base/filesystem.py
Python
FileSystemManager
FileSystemManager
6
52
6
6
e2f4350b47951dabc7695be5c56fac5deb9b147b
bigcode/the-stack
train
6287ee6c9857f2454bf61887
train
class
class BQOrganizationView(BQView): __viewname__ = 'v_organization' __viewdescr__ = 'Organization View' __pk_id__ = 'organization_id' __table__ = BQOrganization
class BQOrganizationView(BQView):
__viewname__ = 'v_organization' __viewdescr__ = 'Organization View' __pk_id__ = 'organization_id' __table__ = BQOrganization
TypeEnum.INTEGER, BQFieldModeEnum.NULLABLE, fld_enum=BQObsoleteStatusEnum) class BQOrganization(BQTable): """ Organization BigQuery Table """ __tablename__ = 'organization' __schema__ = BQOrganizationSchema class BQOrganizationView(BQView):
64
64
49
9
54
all-of-us/raw-data-repository
rdr_service/model/bq_organization.py
Python
BQOrganizationView
BQOrganizationView
29
33
29
29
aa58526a37b18dbf5ab56356d25999a7cb3e3322
bigcode/the-stack
train
cd75ea9df883ae0388b73c61
train
class
class BQOrganization(BQTable): """ Organization BigQuery Table """ __tablename__ = 'organization' __schema__ = BQOrganizationSchema
class BQOrganization(BQTable):
""" Organization BigQuery Table """ __tablename__ = 'organization' __schema__ = BQOrganizationSchema
FieldModeEnum.NULLABLE, fld_enum=BQObsoleteStatusEnum) is_obsolete_id = BQField('is_obsolete_id', BQFieldTypeEnum.INTEGER, BQFieldModeEnum.NULLABLE, fld_enum=BQObsoleteStatusEnum) class BQOrganization(BQTable):
64
64
33
8
56
all-of-us/raw-data-repository
rdr_service/model/bq_organization.py
Python
BQOrganization
BQOrganization
23
26
23
23
3463db766dca7b3284faa1438e84fd772f89063a
bigcode/the-stack
train
4ef8e864ee38b32bd2273c65
train
class
class BQOrganizationSchema(BQSchema): id = BQField('id', BQFieldTypeEnum.INTEGER, BQFieldModeEnum.REQUIRED) created = BQField('created', BQFieldTypeEnum.DATETIME, BQFieldModeEnum.REQUIRED) modified = BQField('modified', BQFieldTypeEnum.DATETIME, BQFieldModeEnum.REQUIRED) # Foreign key to awardee/hpo th...
class BQOrganizationSchema(BQSchema):
id = BQField('id', BQFieldTypeEnum.INTEGER, BQFieldModeEnum.REQUIRED) created = BQField('created', BQFieldTypeEnum.DATETIME, BQFieldModeEnum.REQUIRED) modified = BQField('modified', BQFieldTypeEnum.DATETIME, BQFieldModeEnum.REQUIRED) # Foreign key to awardee/hpo this organization belongs to. hpo_id...
from rdr_service.model.bq_base import BQTable, BQSchema, BQView, BQField, BQFieldTypeEnum, BQFieldModeEnum from rdr_service.model.bq_site import BQObsoleteStatusEnum class BQOrganizationSchema(BQSchema):
60
95
319
9
50
all-of-us/raw-data-repository
rdr_service/model/bq_organization.py
Python
BQOrganizationSchema
BQOrganizationSchema
5
20
5
5
37b4e024ae9fbbc94ce5eb211a549210b86fbfb7
bigcode/the-stack
train
4b87ffe680c75d1ec291bc94
train
function
def test_how_initialize_loads_the_default_configuration(): """ Test how `initialize` handles a `False`y first argument. If `initialize <oemof.tabular.datapackage.building.initialize>` is called with a first argument that evaluates to `False` when converted to boolean it should try to load the default ...
def test_how_initialize_loads_the_default_configuration():
""" Test how `initialize` handles a `False`y first argument. If `initialize <oemof.tabular.datapackage.building.initialize>` is called with a first argument that evaluates to `False` when converted to boolean it should try to load the default configuration. This test makes sure that this is happeni...
import pytest import oemof.tabular.datapackage.building as otdb def test_how_initialize_loads_the_default_configuration():
30
76
256
11
18
jnnr/oemof-tabular
tests/regression_tests.py
Python
test_how_initialize_loads_the_default_configuration
test_how_initialize_loads_the_default_configuration
6
29
6
6
130b13441caa61cde5874b31ada5de4de6eeab16
bigcode/the-stack
train
b643271676e4a3346ade129b
train
function
def last_charges(bot, user, chat, args, dbman, LANG, currency, parse_mode): if len(args) > 1: bot.sendMessage(chat["id"], LANG["helper_commands"]["LAST_CHARGES"], parse_mode=parse_mode) return n_max_charges = 0 if len(args) == 0: n_max_charges = 5 elif len(args) == 1: try: n_max_charges = int(args[0]) ...
def last_charges(bot, user, chat, args, dbman, LANG, currency, parse_mode):
if len(args) > 1: bot.sendMessage(chat["id"], LANG["helper_commands"]["LAST_CHARGES"], parse_mode=parse_mode) return n_max_charges = 0 if len(args) == 0: n_max_charges = 5 elif len(args) == 1: try: n_max_charges = int(args[0]) except ValueError: bot.sendMessage(chat["id"], LANG["error"]["insert_a_...
def last_charges(bot, user, chat, args, dbman, LANG, currency, parse_mode):
22
125
419
22
0
niksart/cembot
cembot/commands/last_charges.py
Python
last_charges
last_charges
1
37
1
1
dc9bcc2632dc7e675fcdf9a7e621ddb81988b145
bigcode/the-stack
train
9e8b3f5eb77e98f4f90ffcd3
train
class
class TestLinkInventTransferLearning(unittest.TestCase): def setUp(self): set_default_device_cuda() lm_enum = LoggingModeEnum() rm_enum = RunningModeEnum() mt_enum = ModelTypeEnum() self.workfolder = os.path.join(MAIN_TEST_PATH, mt_enum.LINK_INVENT + rm_enum.TRANSFER_LEARNI...
class TestLinkInventTransferLearning(unittest.TestCase):
def setUp(self): set_default_device_cuda() lm_enum = LoggingModeEnum() rm_enum = RunningModeEnum() mt_enum = ModelTypeEnum() self.workfolder = os.path.join(MAIN_TEST_PATH, mt_enum.LINK_INVENT + rm_enum.TRANSFER_LEARNING) if not os.path.isdir(self.workfolder): ...
vent_transfer_learning_configuration import \ LinkInventTransferLearningConfiguration from running_modes.constructors.transfer_learning_mode_constructor import TransferLearningModeConstructor from running_modes.utils import set_default_device_cuda from running_modes.enums.logging_mode_enum import LoggingModeEnum fr...
125
125
419
10
114
lilleswing/Reinvent-1
unittest_reinvent/running_modes/transfer_learning_tests/test_link_invent_transfer_learning.py
Python
TestLinkInventTransferLearning
TestLinkInventTransferLearning
20
64
20
21
fd673854bd1106b1bc5ce21b3f032109f434675b
bigcode/the-stack
train
78d043a1925b908c8076423e
train
class
class TaskData(Model): """ objects within taskdata list in Manifest """ task_key = UUIDType(required=True) datapoint_uri = URLType(required=True, min_length=10) datapoint_hash = StringType(required=True, min_length=10)
class TaskData(Model):
""" objects within taskdata list in Manifest """ task_key = UUIDType(required=True) datapoint_uri = URLType(required=True, min_length=10) datapoint_hash = StringType(required=True, min_length=10)
import uuid from schematics.models import Model, ValidationError from schematics.types import StringType, DecimalType, BooleanType, IntType, DictType, ListType, URLType, FloatType, \ UUIDType, ModelType class TaskData(Model):
55
64
54
5
49
todicus/hmt-escrow
basemodels/__init__.py
Python
TaskData
TaskData
7
11
7
7
16954785a66b82efd961b99539aaec36ca3b5944
bigcode/the-stack
train
7568d9f74dfcbf8ad5c9b212
train
class
class Manifest(Model): """ The manifest description. """ job_mode = StringType( required=True, choices=["batch", "online", "instant_delivery"]) job_api_key = UUIDType(default=uuid.uuid4) job_id = UUIDType(default=uuid.uuid4) job_total_tasks = IntType() requester_restricted_answer_set = ...
class Manifest(Model):
""" The manifest description. """ job_mode = StringType( required=True, choices=["batch", "online", "instant_delivery"]) job_api_key = UUIDType(default=uuid.uuid4) job_id = UUIDType(default=uuid.uuid4) job_total_tasks = IntType() requester_restricted_answer_set = DictType(DictType(Strin...
import uuid from schematics.models import Model, ValidationError from schematics.types import StringType, DecimalType, BooleanType, IntType, DictType, ListType, URLType, FloatType, \ UUIDType, ModelType class TaskData(Model): """ objects within taskdata list in Manifest """ task_key = UUIDType(required=Tr...
108
161
539
4
104
todicus/hmt-escrow
basemodels/__init__.py
Python
Manifest
Manifest
14
72
14
14
b01c1313660294eb5b3d8f8be9c0e55be14a77f8
bigcode/the-stack
train
625b31795d447734a11fa4a8
train
function
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_withdrawn_specialist_brief(current_user, app, specialist_brief): with app.app_context(): specialist_brief.status = 'live' specialist_brief.status = 'withdrawn' links = brief_overview...
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_withdrawn_specialist_brief(current_user, app, specialist_brief):
with app.app_context(): specialist_brief.status = 'live' specialist_brief.status = 'withdrawn' links = brief_overview_business.get_live_links(specialist_brief) for link in links: assert all(not link['path'] for link in links)
_links(specialist_brief) for link in links: assert all(not link['path'] for link in links) @patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_withdrawn_specialist_brief(current_user, app, specialist_brief):
64
64
98
38
26
ArenaNetworks/dto-digitalmarketplace-api
tests/app/api/business/brief_overview/test_get_live_links.py
Python
test_live_section_links_are_disabled_for_withdrawn_specialist_brief
test_live_section_links_are_disabled_for_withdrawn_specialist_brief
32
41
32
33
7e5dfdf295529b7a3f576da58b5e4d9e768b3f63
bigcode/the-stack
train
a55a41f56ff47d99f04c7952
train
function
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_closed_specialist_brief(current_user, app, specialist_brief): with app.app_context(): specialist_brief.published_at = utcnow().subtract(weeks=1) specialist_brief.questions_closed_at = utcnow(...
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_closed_specialist_brief(current_user, app, specialist_brief):
with app.app_context(): specialist_brief.published_at = utcnow().subtract(weeks=1) specialist_brief.questions_closed_at = utcnow().subtract(days=2) specialist_brief.closed_at = utcnow().subtract(days=1) links = brief_overview_business.get_live_links(specialist_brief) for lin...
.get_live_links(specialist_brief) for link in links: assert all(not link['path'] for link in links) @patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_closed_specialist_brief(current_user, app, specialist_brief):
64
64
125
36
28
ArenaNetworks/dto-digitalmarketplace-api
tests/app/api/business/brief_overview/test_get_live_links.py
Python
test_live_section_links_are_disabled_for_closed_specialist_brief
test_live_section_links_are_disabled_for_closed_specialist_brief
44
53
44
45
c620a2fcf2685d8d2cda7e3e22b8d38792f11167
bigcode/the-stack
train
4739b0bfeea2da8b57150503
train
function
@pytest.fixture() def live_links(): return ['Answer a question']
@pytest.fixture() def live_links():
return ['Answer a question']
import pytest from mock import patch from app.api.business import brief_overview_business from app.models import utcnow @pytest.fixture() def live_links():
32
64
14
7
24
ArenaNetworks/dto-digitalmarketplace-api
tests/app/api/business/brief_overview/test_get_live_links.py
Python
live_links
live_links
8
10
8
9
0b5096ea6c6c740cc7c4acd00188a9fddb63e94f
bigcode/the-stack
train
0cc615276016dfbb761ff605
train
function
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_has_all_links_for_published_specialist_brief(current_user, app, specialist_brief, live_links): with app.app_context(): specialist_brief.status = 'live' links = brief_overview_business.get_live_links(specialist_brie...
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_has_all_links_for_published_specialist_brief(current_user, app, specialist_brief, live_links):
with app.app_context(): specialist_brief.status = 'live' links = brief_overview_business.get_live_links(specialist_brief) for link in links: assert link['path'] assert any(link['text'] == text for text in live_links)
view_business from app.models import utcnow @pytest.fixture() def live_links(): return ['Answer a question'] @patch('app.api.business.brief_overview_business.current_user') def test_live_section_has_all_links_for_published_specialist_brief(current_user, app, specialist_brief, live_links):
64
64
98
40
24
ArenaNetworks/dto-digitalmarketplace-api
tests/app/api/business/brief_overview/test_get_live_links.py
Python
test_live_section_has_all_links_for_published_specialist_brief
test_live_section_has_all_links_for_published_specialist_brief
13
21
13
14
e0625e1e0a77f1bc14acb4cfb8cf97341e5a8a82
bigcode/the-stack
train
5ad9a26400236b4ca62f5a0c
train
function
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_draft_specialist_brief(current_user, specialist_brief): links = brief_overview_business.get_live_links(specialist_brief) for link in links: assert all(not link['path'] for link in links)
@patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_draft_specialist_brief(current_user, specialist_brief):
links = brief_overview_business.get_live_links(specialist_brief) for link in links: assert all(not link['path'] for link in links)
ief) for link in links: assert link['path'] assert any(link['text'] == text for text in live_links) @patch('app.api.business.brief_overview_business.current_user') def test_live_section_links_are_disabled_for_draft_specialist_brief(current_user, specialist_brief):
64
64
70
35
29
ArenaNetworks/dto-digitalmarketplace-api
tests/app/api/business/brief_overview/test_get_live_links.py
Python
test_live_section_links_are_disabled_for_draft_specialist_brief
test_live_section_links_are_disabled_for_draft_specialist_brief
24
29
24
25
d167bb7a89fdb3e9db654d1ef0fd6288052c9c6a
bigcode/the-stack
train
fb9da216388c82773a005eed
train
function
@pytest.fixture def video_json(video_data, video_content_id, video_node_id): return { "id" : video_data['id'], "title": video_data['title'], "description": "", "node_id": video_node_id.hex, "content_id": video_content_id.hex, "author": "", "children": [], ...
@pytest.fixture def video_json(video_data, video_content_id, video_node_id):
return { "id" : video_data['id'], "title": video_data['title'], "description": "", "node_id": video_node_id.hex, "content_id": video_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_VIDEO, "license": video...
video_data['author'], transcode_to_lower_resolutions=True, derive_thumbnail=True, license=video_data['license'], ) node.set_ids(channel_internal_domain, topic_node_id) return node @pytest.fixture def video_json(video_data, video_content_id, video_node_id):
64
64
99
17
46
radinamatic/ricecooker
tests/test_classes.py
Python
video_json
video_json
146
159
146
147
d174c71ec9988562d4ea63533570cf8024312288
bigcode/the-stack
train
c874060fb66259c2729c641c
train
function
def test_exercise_default_preset(exercise): assert exercise.default_preset == constants.FP_EXERCISE
def test_exercise_default_preset(exercise):
assert exercise.default_preset == constants.FP_EXERCISE
exercise_data['id'] assert exercise.title == exercise_data['title'] assert exercise.description == exercise_data['description'] assert exercise.author == exercise_data['author'] assert exercise.license == exercise_data['license'] assert exercise.kind == constants.CK_EXERCISE def test_exercise_default_preset(exerc...
64
64
24
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_exercise_default_preset
test_exercise_default_preset
454
455
454
454
8d336e93fbb37abc7e6e344823cc67df8c43fe3c
bigcode/the-stack
train
f5e28e923796e837847d22c7
train
function
@pytest.fixture def channel_id(): return "sample-channel"
@pytest.fixture def channel_id():
return "sample-channel"
import pytest import uuid import tempfile from le_utils import constants import base64 from ricecooker.classes import * """ *********** CHANNEL FIXTURES *********** """ @pytest.fixture def channel_id():
43
64
13
7
36
radinamatic/ricecooker
tests/test_classes.py
Python
channel_id
channel_id
10
12
10
11
cc7a11b82d6bce0f48bc4748ddb2d8cf4f93e6e9
bigcode/the-stack
train
94203330f82a3e7d99e24c37
train
function
def test_topic_to_dict(topic, topic_json): assert topic.id == topic_json['id'] assert topic.title == topic_json['title'] assert topic.description == None assert topic.node_id.hex == topic_json['node_id'] assert topic.content_id.hex == topic_json['content_id'] assert topic.author == None asse...
def test_topic_to_dict(topic, topic_json):
assert topic.id == topic_json['id'] assert topic.title == topic_json['title'] assert topic.description == None assert topic.node_id.hex == topic_json['node_id'] assert topic.content_id.hex == topic_json['content_id'] assert topic.author == None assert topic.files == topic_json['files'] a...
_data['description'] assert topic.author == topic_data['author'] assert topic.kind == constants.CK_TOPIC def test_topic_ids(topic, topic_content_id, topic_node_id): assert topic.content_id == topic_content_id assert topic.node_id == topic_node_id def test_topic_to_dict(topic, topic_json):
64
64
101
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_topic_to_dict
test_topic_to_dict
351
360
351
351
f0cd369edac8343fd7c5bf46e731759ce012340d
bigcode/the-stack
train
bdb759d0078ef56088c16d8b
train
function
def test_document_to_dict(document, document_json): assert document.to_dict() == document_json
def test_document_to_dict(document, document_json):
assert document.to_dict() == document_json
K_DOCUMENT def test_document_default_preset(document): assert document.default_preset == constants.FP_DOCUMENT def test_document_ids(document, document_content_id, document_node_id): assert document.content_id == document_content_id assert document.node_id == document_node_id def test_document_to_dict(document, do...
64
64
19
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_document_to_dict
test_document_to_dict
437
438
437
437
b7a459175170667982ac66e01c1b563a50b1d7f1
bigcode/the-stack
train
9c575f2b92cda330e244713c
train
function
@pytest.fixture def document_content_id(channel_internal_domain, document_id): return uuid.uuid5(channel_internal_domain, document_id)
@pytest.fixture def document_content_id(channel_internal_domain, document_id):
return uuid.uuid5(channel_internal_domain, document_id)
": [], "files": [], "kind": constants.CK_AUDIO, "license": audio_data['license'], } """ *********** DOCUMENT FIXTURES *********** """ @pytest.fixture def document_id(): return "document-id" @pytest.fixture def document_content_id(channel_internal_domain, document_id):
64
64
26
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
document_content_id
document_content_id
220
222
220
221
5405821c3ab5df2c2d69de8e80a02917b9d2532f
bigcode/the-stack
train
148fe831470fc00aa0376fd4
train
function
@pytest.fixture def audio_data(audio_id): return { "title": "audio node test", "description": None, "id" : audio_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def audio_data(audio_id):
return { "title": "audio node test", "description": None, "id" : audio_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def audio_content_id(channel_internal_domain, audio_id): return uuid.uuid5(channel_internal_domain, audio_id) @pytest.fixture def audio_node_id(topic_node_id, audio_content_id): return uuid.uuid5(topic_node_id, audio_content_id.hex) @pytest.fixture def audio_data(audio_id):
64
64
51
9
55
radinamatic/ricecooker
tests/test_classes.py
Python
audio_data
audio_data
176
184
176
177
c98a679dcddb51887965923131e54c88dd6a03c2
bigcode/the-stack
train
b0f9cb305f3b299eebf3375d
train
function
@pytest.fixture def video_data(video_id): return { "title": "video node test", "description": None, "id" : video_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def video_data(video_id):
return { "title": "video node test", "description": None, "id" : video_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def video_content_id(channel_internal_domain, video_id): return uuid.uuid5(channel_internal_domain, video_id) @pytest.fixture def video_node_id(topic_node_id, video_content_id): return uuid.uuid5(topic_node_id, video_content_id.hex) @pytest.fixture def video_data(video_id):
64
64
51
9
55
radinamatic/ricecooker
tests/test_classes.py
Python
video_data
video_data
122
130
122
123
8bff3ebaf9b5506474172501e1caed343cbce32d
bigcode/the-stack
train
0959afb30320bbf23af580b3
train
function
def test_document_created(document): assert document is not None
def test_document_created(document):
assert document is not None
_audio_ids(audio, audio_content_id, audio_node_id): assert audio.content_id == audio_content_id assert audio.node_id == audio_node_id def test_audio_to_dict(audio, audio_json): assert audio.to_dict() == audio_json """ *********** DOCUMENT TESTS *********** """ def test_document_created(document):
64
64
12
6
58
radinamatic/ricecooker
tests/test_classes.py
Python
test_document_created
test_document_created
419
420
419
419
f70519947e233f7ad9e71685e8acd5e9bc352f4b
bigcode/the-stack
train
34a782bafb977633c9a57db9
train
function
@pytest.fixture def audio_node_id(topic_node_id, audio_content_id): return uuid.uuid5(topic_node_id, audio_content_id.hex)
@pytest.fixture def audio_node_id(topic_node_id, audio_content_id):
return uuid.uuid5(topic_node_id, audio_content_id.hex)
""" *********** AUDIO FIXTURES *********** """ @pytest.fixture def audio_id(): return "audio-id" @pytest.fixture def audio_content_id(channel_internal_domain, audio_id): return uuid.uuid5(channel_internal_domain, audio_id) @pytest.fixture def audio_node_id(topic_node_id, audio_content_id):
64
64
29
15
49
radinamatic/ricecooker
tests/test_classes.py
Python
audio_node_id
audio_node_id
172
174
172
173
41f2cd7c4ef03b622806d50c43a04ae6af8acbc5
bigcode/the-stack
train
230cd64e1ef3aeca330d4938
train
function
def test_video_derive_thumbnail(video): assert True
def test_video_derive_thumbnail(video):
assert True
.description == video_data['description'] assert video.author == video_data['author'] assert video.license == video_data['license'] assert video.kind == constants.CK_VIDEO def test_video_default_preset(video): assert video.default_preset == constants.FP_VIDEO_HIGH_RES def test_video_derive_thumbnail(video):
64
64
11
8
55
radinamatic/ricecooker
tests/test_classes.py
Python
test_video_derive_thumbnail
test_video_derive_thumbnail
379
380
379
379
32ef546266a33d73f7c18de437343cf5af74da81
bigcode/the-stack
train
cc04fd4936a743221245b651
train
function
@pytest.fixture def document_data(document_id): return { "title": "document node test", "description": None, "id" : document_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def document_data(document_id):
return { "title": "document node test", "description": None, "id" : document_id, "author": None, "license": constants.L_PD, }
@pytest.fixture def document_content_id(channel_internal_domain, document_id): return uuid.uuid5(channel_internal_domain, document_id) @pytest.fixture def document_node_id(root_node_id, document_content_id): return uuid.uuid5(root_node_id, document_content_id.hex) @pytest.fixture def document_data(document_id)...
64
64
51
9
55
radinamatic/ricecooker
tests/test_classes.py
Python
document_data
document_data
228
236
228
229
0fe6a12c5936cdef5890f646535dccb42d25b676
bigcode/the-stack
train
ac2af0afa83c457457e74f9c
train
function
def test_document_ids(document, document_content_id, document_node_id): assert document.content_id == document_content_id assert document.node_id == document_node_id
def test_document_ids(document, document_content_id, document_node_id):
assert document.content_id == document_content_id assert document.node_id == document_node_id
['description'] assert document.author == document_data['author'] assert document.license == document_data['license'] assert document.kind == constants.CK_DOCUMENT def test_document_default_preset(document): assert document.default_preset == constants.FP_DOCUMENT def test_document_ids(document, document_content_id...
64
64
32
14
49
radinamatic/ricecooker
tests/test_classes.py
Python
test_document_ids
test_document_ids
433
435
433
433
153d41eabdade85a9513a1052ce32c02881e0fef
bigcode/the-stack
train
d38607c1261f28da4cf4182c
train
function
@pytest.fixture def document_id(): return "document-id"
@pytest.fixture def document_id():
return "document-id"
.hex, "content_id": audio_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_AUDIO, "license": audio_data['license'], } """ *********** DOCUMENT FIXTURES *********** """ @pytest.fixture def document_id():
64
64
13
7
57
radinamatic/ricecooker
tests/test_classes.py
Python
document_id
document_id
216
218
216
217
0ca646e3a699f8a03880cb82fd358d291e4bcb3d
bigcode/the-stack
train
71f376efe8c89223c71e2875
train
function
@pytest.fixture def document_node_id(root_node_id, document_content_id): return uuid.uuid5(root_node_id, document_content_id.hex)
@pytest.fixture def document_node_id(root_node_id, document_content_id):
return uuid.uuid5(root_node_id, document_content_id.hex)
""" *********** DOCUMENT FIXTURES *********** """ @pytest.fixture def document_id(): return "document-id" @pytest.fixture def document_content_id(channel_internal_domain, document_id): return uuid.uuid5(channel_internal_domain, document_id) @pytest.fixture def document_node_id(root_node_id, document_content_id...
64
64
29
15
49
radinamatic/ricecooker
tests/test_classes.py
Python
document_node_id
document_node_id
224
226
224
225
cc342ef2425c56c0878026a48897070011b440a2
bigcode/the-stack
train
b6020c397fdb97cf8a1f8891
train
function
def test_document_default_preset(document): assert document.default_preset == constants.FP_DOCUMENT
def test_document_default_preset(document):
assert document.default_preset == constants.FP_DOCUMENT
): assert document.id == document_data['id'] assert document.title == document_data['title'] assert document.description == document_data['description'] assert document.author == document_data['author'] assert document.license == document_data['license'] assert document.kind == constants.CK_DOCUMENT def test_docu...
64
64
19
8
55
radinamatic/ricecooker
tests/test_classes.py
Python
test_document_default_preset
test_document_default_preset
430
431
430
430
c65e89b17391d2c36a1fcb47d942dcf2459d1e4e
bigcode/the-stack
train
3817fc9bf862a6a49900305c
train
function
def test_channel_to_dict(channel, channel_json): assert channel.id.hex == channel_json['id'] assert channel.name == channel_json['name'] assert channel_json['description'] == None assert channel_json['has_changed'] == True
def test_channel_to_dict(channel, channel_json):
assert channel.id.hex == channel_json['id'] assert channel.name == channel_json['name'] assert channel_json['description'] == None assert channel_json['has_changed'] == True
TESTS *********** """ def test_channel_created(channel): assert channel is not None def test_channel_data(channel, channel_data, channel_uuid): assert channel.domain == channel_data['domain'] assert channel.name == channel_data['title'] assert channel.id == channel_uuid def test_channel_to_dict(channel, channel_j...
64
64
52
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_channel_to_dict
test_channel_to_dict
328
332
328
328
0579ba36af8180d4d8cf7c3baaad36b083b9bb0e
bigcode/the-stack
train
234d607ba4c38a18547b861f
train
function
@pytest.fixture def topic_data(topic_id): return { "title": "topic node test", "description": None, "id" : topic_id, "author": None, }
@pytest.fixture def topic_data(topic_id):
return { "title": "topic node test", "description": None, "id" : topic_id, "author": None, }
@pytest.fixture def topic_content_id(channel_internal_domain, topic_id): return uuid.uuid5(channel_internal_domain, topic_id) @pytest.fixture def topic_node_id(root_node_id, topic_content_id): return uuid.uuid5(root_node_id, topic_content_id.hex) @pytest.fixture def topic_data(topic_id):
64
64
43
9
55
radinamatic/ricecooker
tests/test_classes.py
Python
topic_data
topic_data
75
82
75
76
7b307ee6294b33fca4ecb2b8f1340bb8c3e17e88
bigcode/the-stack
train
c59fc323d6cddf40eb50cac7
train
function
def test_audio_to_dict(audio, audio_json): assert audio.to_dict() == audio_json
def test_audio_to_dict(audio, audio_json):
assert audio.to_dict() == audio_json
K_AUDIO def test_audio_default_preset(audio): assert audio.default_preset == constants.FP_AUDIO def test_audio_ids(audio, audio_content_id, audio_node_id): assert audio.content_id == audio_content_id assert audio.node_id == audio_node_id def test_audio_to_dict(audio, audio_json):
64
64
19
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_audio_to_dict
test_audio_to_dict
413
414
413
413
040a45e6815977db22a5313c0f6d2bb9d40ba76e
bigcode/the-stack
train
2acbf8cf664cca85ca25d22a
train
function
@pytest.fixture def video_content_id(channel_internal_domain, video_id): return uuid.uuid5(channel_internal_domain, video_id)
@pytest.fixture def video_content_id(channel_internal_domain, video_id):
return uuid.uuid5(channel_internal_domain, video_id)
"author": "", "files": [], "kind": constants.CK_TOPIC, "license": None, } """ *********** VIDEO FIXTURES *********** """ @pytest.fixture def video_id(): return "video-id" @pytest.fixture def video_content_id(channel_internal_domain, video_id):
64
64
26
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
video_content_id
video_content_id
114
116
114
115
0d95e669d1e664efaaeec21c7dac8af56bbc59db
bigcode/the-stack
train
bd5293a1ed384738a6dccc91
train
function
@pytest.fixture def video_node_id(topic_node_id, video_content_id): return uuid.uuid5(topic_node_id, video_content_id.hex)
@pytest.fixture def video_node_id(topic_node_id, video_content_id):
return uuid.uuid5(topic_node_id, video_content_id.hex)
""" *********** VIDEO FIXTURES *********** """ @pytest.fixture def video_id(): return "video-id" @pytest.fixture def video_content_id(channel_internal_domain, video_id): return uuid.uuid5(channel_internal_domain, video_id) @pytest.fixture def video_node_id(topic_node_id, video_content_id):
64
64
29
15
49
radinamatic/ricecooker
tests/test_classes.py
Python
video_node_id
video_node_id
118
120
118
119
ecf475c9d4f54cea5bbf23b5c2037893ff29c27d
bigcode/the-stack
train
9312d06c5e14669ea1a83ffd
train
function
@pytest.fixture def audio_content_id(channel_internal_domain, audio_id): return uuid.uuid5(channel_internal_domain, audio_id)
@pytest.fixture def audio_content_id(channel_internal_domain, audio_id):
return uuid.uuid5(channel_internal_domain, audio_id)
": [], "files": [], "kind": constants.CK_VIDEO, "license": video_data['license'], } """ *********** AUDIO FIXTURES *********** """ @pytest.fixture def audio_id(): return "audio-id" @pytest.fixture def audio_content_id(channel_internal_domain, audio_id):
64
64
26
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
audio_content_id
audio_content_id
168
170
168
169
a48ed93071ff891098912c2d6455f8410365b988
bigcode/the-stack
train
33da8ce309401d883cb010b2
train
function
def test_topic_created(topic): assert topic is not None
def test_topic_created(topic):
assert topic is not None
_dict(channel, channel_json): assert channel.id.hex == channel_json['id'] assert channel.name == channel_json['name'] assert channel_json['description'] == None assert channel_json['has_changed'] == True """ *********** TOPIC TESTS *********** """ def test_topic_created(topic):
64
64
12
6
58
radinamatic/ricecooker
tests/test_classes.py
Python
test_topic_created
test_topic_created
337
338
337
337
616b828fabf6b30554cf2925545f433ca3210a26
bigcode/the-stack
train
5f653417591fd572c1983140
train
function
def test_video_data(video, video_data): assert video.id == video_data['id'] assert video.title == video_data['title'] assert video.description == video_data['description'] assert video.author == video_data['author'] assert video.license == video_data['license'] assert video.kind == constants.CK_VIDEO
def test_video_data(video, video_data):
assert video.id == video_data['id'] assert video.title == video_data['title'] assert video.description == video_data['description'] assert video.author == video_data['author'] assert video.license == video_data['license'] assert video.kind == constants.CK_VIDEO
None assert topic.files == topic_json['files'] assert topic.kind == topic_json['kind'] assert topic.license == topic_json['license'] """ *********** VIDEO TESTS *********** """ def test_video_created(video): assert video is not None def test_video_data(video, video_data):
64
64
64
9
54
radinamatic/ricecooker
tests/test_classes.py
Python
test_video_data
test_video_data
368
374
368
368
2b408aa7f6bb1be6f6fb33799ca22ad01fa88462
bigcode/the-stack
train
ecba27777524d2aa61bb0e83
train
function
@pytest.fixture def exercise_id(): return "exercise-id"
@pytest.fixture def exercise_id():
return "exercise-id"
"content_id": document_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_DOCUMENT, "license": document_data['license'], } """ *********** EXERCISE FIXTURES *********** """ @pytest.fixture def exercise_id():
64
64
13
7
57
radinamatic/ricecooker
tests/test_classes.py
Python
exercise_id
exercise_id
268
270
268
269
1a3dbc002adb151321001f3ae8b29e1dfc2d1e08
bigcode/the-stack
train
8a637d49ace261355a568d26
train
function
def test_video_created(video): assert video is not None
def test_video_created(video):
assert video is not None
.content_id.hex == topic_json['content_id'] assert topic.author == None assert topic.files == topic_json['files'] assert topic.kind == topic_json['kind'] assert topic.license == topic_json['license'] """ *********** VIDEO TESTS *********** """ def test_video_created(video):
64
64
12
6
58
radinamatic/ricecooker
tests/test_classes.py
Python
test_video_created
test_video_created
365
366
365
365
883d90a74d6a7b5b12663b3b23ed9b49f6454ed8
bigcode/the-stack
train
577580a7d489cbca4eb511aa
train
function
def test_document_data(document, document_data): assert document.id == document_data['id'] assert document.title == document_data['title'] assert document.description == document_data['description'] assert document.author == document_data['author'] assert document.license == document_data['license'] assert docume...
def test_document_data(document, document_data):
assert document.id == document_data['id'] assert document.title == document_data['title'] assert document.description == document_data['description'] assert document.author == document_data['author'] assert document.license == document_data['license'] assert document.kind == constants.CK_DOCUMENT
_id == audio_content_id assert audio.node_id == audio_node_id def test_audio_to_dict(audio, audio_json): assert audio.to_dict() == audio_json """ *********** DOCUMENT TESTS *********** """ def test_document_created(document): assert document is not None def test_document_data(document, document_data):
64
64
64
9
54
radinamatic/ricecooker
tests/test_classes.py
Python
test_document_data
test_document_data
422
428
422
422
e52942cb1586c43f0c2c6d0f5af0bd5141d122e2
bigcode/the-stack
train
425c95c0804f99abf802751e
train
function
@pytest.fixture def channel_uuid(channel_id): return uuid.uuid3(uuid.NAMESPACE_DNS, uuid.uuid5(uuid.NAMESPACE_DNS, channel_id).hex)
@pytest.fixture def channel_uuid(channel_id):
return uuid.uuid3(uuid.NAMESPACE_DNS, uuid.uuid5(uuid.NAMESPACE_DNS, channel_id).hex)
*********** """ @pytest.fixture def channel_id(): return "sample-channel" @pytest.fixture def channel_domain(): return "learningequality.org" @pytest.fixture def channel_internal_domain(channel_domain): return uuid.uuid5(uuid.NAMESPACE_DNS, channel_domain) @pytest.fixture def channel_uuid(channel_id):
64
64
34
9
55
radinamatic/ricecooker
tests/test_classes.py
Python
channel_uuid
channel_uuid
22
24
22
23
3e97f7c8a3e0dd27031fdf68e4a6558be2c0bcb4
bigcode/the-stack
train
715b66f48542db4d64dae53a
train
function
def test_audio_data(audio, audio_data): assert audio.id == audio_data['id'] assert audio.title == audio_data['title'] assert audio.description == audio_data['description'] assert audio.author == audio_data['author'] assert audio.license == audio_data['license'] assert audio.kind == constants.CK_AUDIO
def test_audio_data(audio, audio_data):
assert audio.id == audio_data['id'] assert audio.title == audio_data['title'] assert audio.description == audio_data['description'] assert audio.author == audio_data['author'] assert audio.license == audio_data['license'] assert audio.kind == constants.CK_AUDIO
_id == video_content_id assert video.node_id == video_node_id def test_video_to_dict(video, video_json): assert video.to_dict() == video_json """ *********** AUDIO TESTS *********** """ def test_audio_created(audio): assert audio is not None def test_audio_data(audio, audio_data):
64
64
64
9
54
radinamatic/ricecooker
tests/test_classes.py
Python
test_audio_data
test_audio_data
398
404
398
398
7e0218f0831aaef94ae4dcf057f7cbe714ec251f
bigcode/the-stack
train
1879802fcec79f47c89d8a86
train
function
def test_video_transcode_to_lower_resolution(video): assert True
def test_video_transcode_to_lower_resolution(video):
assert True
['author'] assert video.license == video_data['license'] assert video.kind == constants.CK_VIDEO def test_video_default_preset(video): assert video.default_preset == constants.FP_VIDEO_HIGH_RES def test_video_derive_thumbnail(video): assert True def test_video_transcode_to_lower_resolution(video):
64
64
13
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_video_transcode_to_lower_resolution
test_video_transcode_to_lower_resolution
382
383
382
382
281630d5a3ff1141bd8d4930456f61dd9bf976af
bigcode/the-stack
train
62efb86412a6115cea853b75
train
function
@pytest.fixture def audio_json(audio_data, audio_content_id, audio_node_id): return { "id" : audio_data['id'], "title": audio_data['title'], "description": "", "node_id": audio_node_id.hex, "content_id": audio_content_id.hex, "author": "", "children": [], ...
@pytest.fixture def audio_json(audio_data, audio_content_id, audio_node_id):
return { "id" : audio_data['id'], "title": audio_data['title'], "description": "", "node_id": audio_node_id.hex, "content_id": audio_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_AUDIO, "license": audio...
['description'], title=audio_data['title'], author=audio_data['author'], license=audio_data['license'], ) node.set_ids(channel_internal_domain, topic_node_id) return node @pytest.fixture def audio_json(audio_data, audio_content_id, audio_node_id):
64
64
99
17
46
radinamatic/ricecooker
tests/test_classes.py
Python
audio_json
audio_json
198
211
198
199
6802a201c2b470628da7b5494b75a66d4237cde9
bigcode/the-stack
train
b93f466422016f742ec71f8f
train
function
@pytest.fixture def video_id(): return "video-id"
@pytest.fixture def video_id():
return "video-id"
"node_id": topic_node_id.hex, "content_id": topic_content_id.hex, "author": "", "files": [], "kind": constants.CK_TOPIC, "license": None, } """ *********** VIDEO FIXTURES *********** """ @pytest.fixture def video_id():
64
64
13
7
57
radinamatic/ricecooker
tests/test_classes.py
Python
video_id
video_id
110
112
110
111
37bf72bbc52bad0bae0cb6a3c11691aed1a9a31a
bigcode/the-stack
train
f3d3b19e0db770e5b622857a
train
function
@pytest.fixture def exercise(exercise_data, channel_internal_domain, topic_node_id): node = Exercise( id=exercise_data['id'], description=exercise_data['description'], title=exercise_data['title'], author=exercise_data['author'], license=exercise_data['license'], ) node.set_ids(channel_internal_domai...
@pytest.fixture def exercise(exercise_data, channel_internal_domain, topic_node_id):
node = Exercise( id=exercise_data['id'], description=exercise_data['description'], title=exercise_data['title'], author=exercise_data['author'], license=exercise_data['license'], ) node.set_ids(channel_internal_domain, topic_node_id) return node
_data(exercise_id): return { "title": "exercise node test", "description": None, "id" : exercise_id, "author": None, "license": constants.L_PD, } @pytest.fixture def exercise(exercise_data, channel_internal_domain, topic_node_id):
64
64
82
17
47
radinamatic/ricecooker
tests/test_classes.py
Python
exercise
exercise
290
300
290
291
a44dbed0540ebd2c139b7f6e428de570141b465a
bigcode/the-stack
train
5d0c4e084a031526e4021351
train
function
def test_topic_data(topic, topic_data): assert topic.id == topic_data['id'] assert topic.title == topic_data['title'] assert topic.description == topic_data['description'] assert topic.author == topic_data['author'] assert topic.kind == constants.CK_TOPIC
def test_topic_data(topic, topic_data):
assert topic.id == topic_data['id'] assert topic.title == topic_data['title'] assert topic.description == topic_data['description'] assert topic.author == topic_data['author'] assert topic.kind == constants.CK_TOPIC
id'] assert channel.name == channel_json['name'] assert channel_json['description'] == None assert channel_json['has_changed'] == True """ *********** TOPIC TESTS *********** """ def test_topic_created(topic): assert topic is not None def test_topic_data(topic, topic_data):
64
64
54
9
54
radinamatic/ricecooker
tests/test_classes.py
Python
test_topic_data
test_topic_data
340
345
340
340
ab2a4042ecf918f8bcfdfe3b29f50425141a0f96
bigcode/the-stack
train
577d0d6809ee1f7530e10aa9
train
function
@pytest.fixture def channel_internal_domain(channel_domain): return uuid.uuid5(uuid.NAMESPACE_DNS, channel_domain)
@pytest.fixture def channel_internal_domain(channel_domain):
return uuid.uuid5(uuid.NAMESPACE_DNS, channel_domain)
le_utils import constants import base64 from ricecooker.classes import * """ *********** CHANNEL FIXTURES *********** """ @pytest.fixture def channel_id(): return "sample-channel" @pytest.fixture def channel_domain(): return "learningequality.org" @pytest.fixture def channel_internal_domain(channel_domain):...
64
64
24
10
54
radinamatic/ricecooker
tests/test_classes.py
Python
channel_internal_domain
channel_internal_domain
18
20
18
19
cd453188ffcb9fb62d36116b35ce2c795f560d2f
bigcode/the-stack
train
73db037c6f363429b84acbcc
train
function
@pytest.fixture def exercise_content_id(channel_internal_domain, exercise_id): return uuid.uuid5(channel_internal_domain, exercise_id)
@pytest.fixture def exercise_content_id(channel_internal_domain, exercise_id):
return uuid.uuid5(channel_internal_domain, exercise_id)
"files": [], "kind": constants.CK_DOCUMENT, "license": document_data['license'], } """ *********** EXERCISE FIXTURES *********** """ @pytest.fixture def exercise_id(): return "exercise-id" @pytest.fixture def exercise_content_id(channel_internal_domain, exercise_id):
64
64
26
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
exercise_content_id
exercise_content_id
272
274
272
273
0a79be8f194b36553c9e751c846321b0fb7ef57d
bigcode/the-stack
train
f013fe3903039d2edcc997d4
train
function
@pytest.fixture def audio_id(): return "audio-id"
@pytest.fixture def audio_id():
return "audio-id"
.hex, "content_id": video_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_VIDEO, "license": video_data['license'], } """ *********** AUDIO FIXTURES *********** """ @pytest.fixture def audio_id():
64
64
13
7
57
radinamatic/ricecooker
tests/test_classes.py
Python
audio_id
audio_id
164
166
164
165
0681d126cddf3fae29c0dfb0eadc15653ab79061
bigcode/the-stack
train
eca19cd90d31298f854e8f8a
train
function
def test_audio_ids(audio, audio_content_id, audio_node_id): assert audio.content_id == audio_content_id assert audio.node_id == audio_node_id
def test_audio_ids(audio, audio_content_id, audio_node_id):
assert audio.content_id == audio_content_id assert audio.node_id == audio_node_id
['description'] assert audio.author == audio_data['author'] assert audio.license == audio_data['license'] assert audio.kind == constants.CK_AUDIO def test_audio_default_preset(audio): assert audio.default_preset == constants.FP_AUDIO def test_audio_ids(audio, audio_content_id, audio_node_id):
64
64
32
14
49
radinamatic/ricecooker
tests/test_classes.py
Python
test_audio_ids
test_audio_ids
409
411
409
409
274d632135c159512a3ae407096a815caf3f4131
bigcode/the-stack
train
0785728998ce1c9b502dd5ea
train
function
@pytest.fixture def channel(channel_data): return Channel( domain=channel_data['domain'], channel_id=channel_data['channel_id'], title=channel_data['title'], )
@pytest.fixture def channel(channel_data):
return Channel( domain=channel_data['domain'], channel_id=channel_data['channel_id'], title=channel_data['title'], )
5(uuid.NAMESPACE_DNS, channel_id).hex) @pytest.fixture def channel_data(channel_id, channel_domain): return { "domain" : channel_domain, "channel_id" : channel_id, "title" : "Sample Channel", } @pytest.fixture def channel(channel_data):
64
64
41
8
56
radinamatic/ricecooker
tests/test_classes.py
Python
channel
channel
34
40
34
35
46f1554be9641de1199a2c697d1fd5801708d99e
bigcode/the-stack
train
7b8b6e13ecda1b11f15f3a58
train
function
@pytest.fixture def topic_node_id(root_node_id, topic_content_id): return uuid.uuid5(root_node_id, topic_content_id.hex)
@pytest.fixture def topic_node_id(root_node_id, topic_content_id):
return uuid.uuid5(root_node_id, topic_content_id.hex)
*********** TOPIC FIXTURES *********** """ @pytest.fixture def topic_id(): return "topic-id" @pytest.fixture def topic_content_id(channel_internal_domain, topic_id): return uuid.uuid5(channel_internal_domain, topic_id) @pytest.fixture def topic_node_id(root_node_id, topic_content_id):
64
64
29
15
49
radinamatic/ricecooker
tests/test_classes.py
Python
topic_node_id
topic_node_id
71
73
71
72
6418340ef181b1ef3ce18416e7dd556cab033624
bigcode/the-stack
train
a56b37286bec2a01ccb695a5
train
function
def test_audio_default_preset(audio): assert audio.default_preset == constants.FP_AUDIO
def test_audio_default_preset(audio):
assert audio.default_preset == constants.FP_AUDIO
): assert audio.id == audio_data['id'] assert audio.title == audio_data['title'] assert audio.description == audio_data['description'] assert audio.author == audio_data['author'] assert audio.license == audio_data['license'] assert audio.kind == constants.CK_AUDIO def test_audio_default_preset(audio):
64
64
19
8
55
radinamatic/ricecooker
tests/test_classes.py
Python
test_audio_default_preset
test_audio_default_preset
406
407
406
406
525dac7e30d5e414a3095020b6ecf4c534e7e33d
bigcode/the-stack
train
0d54ed8ad9d693702bdeb209
train
function
def test_video_to_dict(video, video_json): assert video.to_dict() == video_json
def test_video_to_dict(video, video_json):
assert video.to_dict() == video_json
_video_derive_thumbnail(video): assert True def test_video_transcode_to_lower_resolution(video): assert True def test_video_ids(video, video_content_id, video_node_id): assert video.content_id == video_content_id assert video.node_id == video_node_id def test_video_to_dict(video, video_json):
64
64
19
10
53
radinamatic/ricecooker
tests/test_classes.py
Python
test_video_to_dict
test_video_to_dict
389
390
389
389
cb51e43786b97a449eb0e1b9768eda2a76b8f2e6
bigcode/the-stack
train
b289d6c81b50aec82f472a43
train
function
def test_exercise_created(exercise): assert exercise is not None
def test_exercise_created(exercise):
assert exercise is not None
_content_id, document_node_id): assert document.content_id == document_content_id assert document.node_id == document_node_id def test_document_to_dict(document, document_json): assert document.to_dict() == document_json """ *********** EXERCISE TESTS *********** """ def test_exercise_created(exercise):
64
64
14
8
56
radinamatic/ricecooker
tests/test_classes.py
Python
test_exercise_created
test_exercise_created
443
444
443
443
28e7c03be30dedcc41836a33b3d74e922aeac455
bigcode/the-stack
train
c24cbe982ce84ad19b7df57d
train
function
@pytest.fixture def topic_content_id(channel_internal_domain, topic_id): return uuid.uuid5(channel_internal_domain, topic_id)
@pytest.fixture def topic_content_id(channel_internal_domain, topic_id):
return uuid.uuid5(channel_internal_domain, topic_id)
) @pytest.fixture def root_node_id(channel, root_content_id): return uuid.uuid5(channel.id, root_content_id.hex) """ *********** TOPIC FIXTURES *********** """ @pytest.fixture def topic_id(): return "topic-id" @pytest.fixture def topic_content_id(channel_internal_domain, topic_id):
64
64
26
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
topic_content_id
topic_content_id
67
69
67
68
3f067453d696c09abd5046f2d78837150081fe0e
bigcode/the-stack
train
3877a99438c43eaf62e28826
train
function
@pytest.fixture def exercise_json(exercise_data, exercise_content_id, exercise_node_id): return { "id" : exercise_data['id'], "title": exercise_data['title'], "description": "", "node_id": exercise_node_id.hex, "content_id": exercise_content_id.hex, "author": "", ...
@pytest.fixture def exercise_json(exercise_data, exercise_content_id, exercise_node_id):
return { "id" : exercise_data['id'], "title": exercise_data['title'], "description": "", "node_id": exercise_node_id.hex, "content_id": exercise_content_id.hex, "author": "", "children": [], "files": [], "kind": constants.CK_EXERCISE, "...
description'], title=exercise_data['title'], author=exercise_data['author'], license=exercise_data['license'], ) node.set_ids(channel_internal_domain, topic_node_id) return node @pytest.fixture def exercise_json(exercise_data, exercise_content_id, exercise_node_id):
64
64
103
18
45
radinamatic/ricecooker
tests/test_classes.py
Python
exercise_json
exercise_json
302
315
302
303
8aa083ee7f36846b56f8cd5b440d511f22c704f9
bigcode/the-stack
train
460050c329488c5820e4817e
train
function
@pytest.fixture def document(document_data, channel_internal_domain, root_node_id): node = Document( id=document_data['id'], description=document_data['description'], title=document_data['title'], author=document_data['author'], license=document_data['license'], ) node.set_ids(channel_internal_domain...
@pytest.fixture def document(document_data, channel_internal_domain, root_node_id):
node = Document( id=document_data['id'], description=document_data['description'], title=document_data['title'], author=document_data['author'], license=document_data['license'], ) node.set_ids(channel_internal_domain, root_node_id) return node
def document_data(document_id): return { "title": "document node test", "description": None, "id" : document_id, "author": None, "license": constants.L_PD, } @pytest.fixture def document(document_data, channel_internal_domain, root_node_id):
64
64
76
16
48
radinamatic/ricecooker
tests/test_classes.py
Python
document
document
238
248
238
239
220e3df8c0520bc69d60cb6c5dc66184f527655a
bigcode/the-stack
train
41d1bfe44c992788227b8c4d
train
function
@pytest.fixture def channel_domain(): return "learningequality.org"
@pytest.fixture def channel_domain():
return "learningequality.org"
import pytest import uuid import tempfile from le_utils import constants import base64 from ricecooker.classes import * """ *********** CHANNEL FIXTURES *********** """ @pytest.fixture def channel_id(): return "sample-channel" @pytest.fixture def channel_domain():
56
64
15
7
49
radinamatic/ricecooker
tests/test_classes.py
Python
channel_domain
channel_domain
14
16
14
15
491316a9356536c513b923eb4d9d40c2be9adba4
bigcode/the-stack
train
31cfb3ba9bb21d3480b8b00a
train
function
@pytest.fixture def channel_json(channel, channel_data, channel_uuid): return { "name" : channel_data['title'], "id" : channel_uuid.hex, "thumbnail" : channel.thumbnail, "has_changed" : True, "description" : channel.description, }
@pytest.fixture def channel_json(channel, channel_data, channel_uuid):
return { "name" : channel_data['title'], "id" : channel_uuid.hex, "thumbnail" : channel.thumbnail, "has_changed" : True, "description" : channel.description, }
title" : "Sample Channel", } @pytest.fixture def channel(channel_data): return Channel( domain=channel_data['domain'], channel_id=channel_data['channel_id'], title=channel_data['title'], ) @pytest.fixture def channel_json(channel, channel_data, channel_uuid):
64
64
62
14
50
radinamatic/ricecooker
tests/test_classes.py
Python
channel_json
channel_json
42
50
42
43
47e900884a0f0fe2f0132fc4b0492300ea08938b
bigcode/the-stack
train