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
e07d00e66ccf572597d82a12
train
function
@pytest.fixture def shipping_method(db): # pylint: disable=W0613 method = ShippingMethod.objects.create(name='DHL') method.price_per_country.create(price=10) return method
@pytest.fixture def shipping_method(db): # pylint: disable=W0613
method = ShippingMethod.objects.create(name='DHL') method.price_per_country.create(price=10) return method
='Mirumee Software', street_address_1='Tęczowa 7', city='Wrocław', postal_code='53-601', country='PL', phone='+48713988102') @pytest.fixture def shipping_method(db): # pylint: disable=W0613
64
64
43
17
47
VanilleBid/weekly-saleor
tests/conftest.py
Python
shipping_method
shipping_method
139
143
139
140
66836ed62911ac42ad7371e505e9333d38f852e6
bigcode/the-stack
train
2cdba0c6b961a9d2c1359924
train
function
@pytest.fixture def permission_impersonate_user(): return Permission.objects.get(codename='impersonate_user')
@pytest.fixture def permission_impersonate_user():
return Permission.objects.get(codename='impersonate_user')
_user(): return Permission.objects.get(codename='view_user') @pytest.fixture def permission_edit_user(): return Permission.objects.get(codename='edit_user') @pytest.fixture def permission_edit_settings(): return Permission.objects.get(codename='edit_settings') @pytest.fixture def permission_impersonate_...
64
64
24
10
54
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_impersonate_user
permission_impersonate_user
649
651
649
650
285d4545c1b64c5952a7ed2fd525dc7f073e959e
bigcode/the-stack
train
a1cf8c56ac3cf96fc6af3065
train
function
@pytest.fixture def permission_view_order(): return Permission.objects.get(codename='view_order')
@pytest.fixture def permission_view_order():
return Permission.objects.get(codename='view_order')
return Permission.objects.get(codename='edit_sale') @pytest.fixture def permission_view_voucher(): return Permission.objects.get(codename='view_voucher') @pytest.fixture def permission_edit_voucher(): return Permission.objects.get(codename='edit_voucher') @pytest.fixture def permission_view_order():
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_order
permission_view_order
253
255
253
254
679a40ff870eee23ede7a8b2053a5059c738882b
bigcode/the-stack
train
b59f9b9787b5dc46b723da43
train
function
@pytest.fixture def authorization_key(db, site_settings): return AuthorizationKey.objects.create( site_settings=site_settings, name='Backend', key='Key', password='Password')
@pytest.fixture def authorization_key(db, site_settings):
return AuthorizationKey.objects.create( site_settings=site_settings, name='Backend', key='Key', password='Password')
.name) recalculate_order(order) order.refresh_from_db() return group @pytest.fixture() def sale(db, default_category): sale = Sale.objects.create(name="Sale", value=5) sale.categories.add(default_category) return sale @pytest.fixture def authorization_key(db, site_settings):
64
64
38
11
52
VanilleBid/weekly-saleor
tests/conftest.py
Python
authorization_key
authorization_key
587
591
587
588
e823c676b0a65bcc9ef2ea7c95619396ae557bd7
bigcode/the-stack
train
fbeeed81944a0ea913b17a2c
train
function
@pytest.fixture def permission_view_shipping(): return Permission.objects.get(codename='view_shipping')
@pytest.fixture def permission_view_shipping():
return Permission.objects.get(codename='view_shipping')
permission_edit_group(): return Permission.objects.get(codename='edit_group') @pytest.fixture def permission_view_properties(): return Permission.objects.get(codename='view_properties') @pytest.fixture def permission_edit_properties(): return Permission.objects.get(codename='edit_properties') @pytest.f...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_shipping
permission_view_shipping
624
626
624
625
800e459477c854721cd4f66fa7f52ef6151b37cd
bigcode/the-stack
train
f319704ee0fed3b0515e1fb0
train
function
@pytest.fixture() def authorized_client(client, customer_user): client.login(username=customer_user.email, password='password') return client
@pytest.fixture() def authorized_client(client, customer_user):
client.login(username=customer_user.email, password='password') return client
password', is_staff=True, is_active=True) @pytest.fixture() def staff_client(client, staff_user): """Return a Django test client logged in as an staff member.""" client.login(username=staff_user.email, password='password') return client @pytest.fixture() def authorized_client(client, customer_user...
64
64
28
11
52
VanilleBid/weekly-saleor
tests/conftest.py
Python
authorized_client
authorized_client
121
124
121
122
d64d43be7b8309e616ee8d9a98789ee87643d233
bigcode/the-stack
train
c48c71d47ed17554aef90575
train
function
@pytest.fixture def stock_location(): warehouse_1 = StockLocation.objects.create(name='Warehouse 1') return warehouse_1
@pytest.fixture def stock_location():
warehouse_1 = StockLocation.objects.create(name='Warehouse 1') return warehouse_1
_email': admin_user.email, 'total': Price(123, currency='USD')} order = Order.objects.create(**data) order1 = Order.objects.create(**data) order2 = Order.objects.create(**data) return [order, order1, order2] @pytest.fixture def stock_location():
64
64
28
7
57
VanilleBid/weekly-saleor
tests/conftest.py
Python
stock_location
stock_location
371
374
371
372
2791250525513d9b03034b74ac7c6ad735910cf2
bigcode/the-stack
train
da32476d72841623ef5ce3ee
train
function
@pytest.fixture def permission_edit_order(): return Permission.objects.get(codename='edit_order')
@pytest.fixture def permission_edit_order():
return Permission.objects.get(codename='edit_order')
(): return Permission.objects.get(codename='view_voucher') @pytest.fixture def permission_edit_voucher(): return Permission.objects.get(codename='edit_voucher') @pytest.fixture def permission_view_order(): return Permission.objects.get(codename='view_order') @pytest.fixture def permission_edit_order():
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_order
permission_edit_order
258
260
258
259
82e4eb23d5f333a404c9fe00f8451585dd147bd6
bigcode/the-stack
train
a6004f751014932d762a0fbb
train
function
@pytest.fixture() def sale(db, default_category): sale = Sale.objects.create(name="Sale", value=5) sale.categories.add(default_category) return sale
@pytest.fixture() def sale(db, default_category):
sale = Sale.objects.create(name="Sale", value=5) sale.categories.add(default_category) return sale
3, unit_price_net=Decimal('30.00'), unit_price_gross=Decimal('30.00'), stock=stock, stock_location=stock.location.name) recalculate_order(order) order.refresh_from_db() return group @pytest.fixture() def sale(db, default_category):
64
64
35
10
53
VanilleBid/weekly-saleor
tests/conftest.py
Python
sale
sale
580
584
580
581
aea3e8e96b09733fe8622777fba3c3954cad66d4
bigcode/the-stack
train
798ee80fb87d653b9a7e659d
train
function
@pytest.fixture def collection(db): collection = Collection.objects.create(name='Collection', slug='collection') return collection
@pytest.fixture def collection(db):
collection = Collection.objects.create(name='Collection', slug='collection') return collection
)) orders.append(Order.objects.create(billing_address=billing_address)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.CANCELLED)) # empty order is considered as closed orders.append(Order.objects.create(billing_address=billing_address)) return orders @pytest.fixture def collection...
64
64
25
7
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
collection
collection
703
706
703
704
795c38048e9a040436d97320889c914e2ea9ac59
bigcode/the-stack
train
fce279ce38f6e472f0898573
train
function
@pytest.fixture def permission_edit_stock_location(): return Permission.objects.get(codename='edit_stock_location')
@pytest.fixture def permission_edit_stock_location():
return Permission.objects.get(codename='edit_stock_location')
(): return Permission.objects.get(codename='view_category') @pytest.fixture def permission_edit_category(): return Permission.objects.get(codename='edit_category') @pytest.fixture def permission_view_stock_location(): return Permission.objects.get(codename='view_stock_location') @pytest.fixture def perm...
64
64
22
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_stock_location
permission_edit_stock_location
228
230
228
229
c461b6d56312c11f7f58baacd26d1a6bb5657afb
bigcode/the-stack
train
21b8ae50376a1a49123bed03
train
function
@pytest.fixture def request_checkout(checkout): import saleor.checkout.core def _override(*args, **kwargs): return checkout return set_value( saleor.checkout.core.Checkout, 'from_storage', _override)
@pytest.fixture def request_checkout(checkout):
import saleor.checkout.core def _override(*args, **kwargs): return checkout return set_value( saleor.checkout.core.Checkout, 'from_storage', _override)
cart.discounts = Sale.objects.all() return cart @pytest.fixture def request_cart_with_item(product_in_stock, request_cart): variant = product_in_stock.variants.get() # Prepare some data request_cart.add(variant) return request_cart @pytest.fixture def request_checkout(checkout):
64
64
50
9
54
VanilleBid/weekly-saleor
tests/conftest.py
Python
request_checkout
request_checkout
75
83
75
76
f5f79ddb45fcdd4ad0ce222afce93d6cc6915707
bigcode/the-stack
train
88c8078057f5410e84aae6c7
train
function
@pytest.fixture def permission_edit_voucher(): return Permission.objects.get(codename='edit_voucher')
@pytest.fixture def permission_edit_voucher():
return Permission.objects.get(codename='edit_voucher')
(): return Permission.objects.get(codename='view_sale') @pytest.fixture def permission_edit_sale(): return Permission.objects.get(codename='edit_sale') @pytest.fixture def permission_view_voucher(): return Permission.objects.get(codename='view_voucher') @pytest.fixture def permission_edit_voucher():
64
64
22
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_voucher
permission_edit_voucher
248
250
248
249
2819074ee44e27f4fdeab389f6834f8fe36d8ffb
bigcode/the-stack
train
93465cd0fb563dfbfa7b24a8
train
function
@pytest.fixture() def order_with_variant_from_different_stocks(order_with_lines_and_stock): line = OrderLine.objects.get(product_sku='SKU_A') variant = ProductVariant.objects.get(sku=line.product_sku) warehouse_2 = StockLocation.objects.create(name='Warehouse 2') stock = Stock.objects.create( va...
@pytest.fixture() def order_with_variant_from_different_stocks(order_with_lines_and_stock):
line = OrderLine.objects.get(product_sku='SKU_A') variant = ProductVariant.objects.get(sku=line.product_sku) warehouse_2 = StockLocation.objects.create(name='Warehouse 2') stock = Stock.objects.create( variant=variant, cost_price=1, quantity=5, quantity_allocated=2, location=warehouse_2)...
quantity=2, unit_price_net=Decimal('20.00'), unit_price_gross=Decimal('20.00'), stock=stock, stock_location=stock.location.name) recalculate_order(order) order.refresh_from_db() return order @pytest.fixture() def order_with_variant_from_different_stocks(order_with_lin...
75
75
250
18
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
order_with_variant_from_different_stocks
order_with_variant_from_different_stocks
526
550
526
527
45abb9d59a048688e94738e544cd7a140e4228ab
bigcode/the-stack
train
e6bc804d81114b5873274ae2
train
function
@pytest.fixture def permission_edit_sale(): return Permission.objects.get(codename='edit_sale')
@pytest.fixture def permission_edit_sale():
return Permission.objects.get(codename='edit_sale')
(): return Permission.objects.get(codename='view_stock_location') @pytest.fixture def permission_edit_stock_location(): return Permission.objects.get(codename='edit_stock_location') @pytest.fixture def permission_view_sale(): return Permission.objects.get(codename='view_sale') @pytest.fixture def permis...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_sale
permission_edit_sale
238
240
238
239
e243f580d238c6d07d62980c1018b8011ee7b088
bigcode/the-stack
train
88507088eada4502d72851b5
train
function
@pytest.fixture def product_with_images(product_type, default_category): product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) file_mock_0 = MagicMock(spec=File, name='FileMock0') file_mock_0.name = 'image0.jpg' ...
@pytest.fixture def product_with_images(product_type, default_category):
product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) file_mock_0 = MagicMock(spec=File, name='FileMock0') file_mock_0.name = 'image0.jpg' file_mock_1 = MagicMock(spec=File, name='FileMock1') file_mock_1.n...
unavailable_product(product_type, default_category): product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, is_published=False, category=default_category) return product @pytest.fixture def product_with_images(product_type, default_cate...
64
64
130
13
50
VanilleBid/weekly-saleor
tests/conftest.py
Python
product_with_images
product_with_images
401
412
401
402
f80f6df18e78d49001c4e0cfb243cadb576db2d6
bigcode/the-stack
train
3ef5518aad32480152e1351e
train
function
@pytest.fixture def permission_view_group(): return Permission.objects.get(codename='view_group')
@pytest.fixture def permission_view_group():
return Permission.objects.get(codename='view_group')
site_settings, name='Backend', key='Key', password='Password') @pytest.fixture def permission_view_staff(): return Permission.objects.get(codename='view_staff') @pytest.fixture def permission_edit_staff(): return Permission.objects.get(codename='edit_staff') @pytest.fixture def permission_view_group...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_group
permission_view_group
604
606
604
605
e2ce363448cba2095bd0857dc683f8326a1e6e23
bigcode/the-stack
train
2bfd41038aea2c5e4d094f4b
train
function
@pytest.fixture def checkout(request_cart, customer_user, billing_address, shipping_method): res = Checkout(request_cart, customer_user, 'tracking_code') customer_user.default_shipping_address = billing_address customer_user.default_billing_address = billing_address customer_user.save() return res
@pytest.fixture def checkout(request_cart, customer_user, billing_address, shipping_method):
res = Checkout(request_cart, customer_user, 'tracking_code') customer_user.default_shipping_address = billing_address customer_user.default_billing_address = billing_address customer_user.save() return res
image1.jpg' product.images.create(image=file_mock_0) product.images.create(image=file_mock_1) return product @pytest.fixture def anonymous_checkout(): return Checkout((), AnonymousUser(), 'tracking_code') @pytest.fixture def checkout(request_cart, customer_user, billing_address, shipping_method):
64
64
61
17
47
VanilleBid/weekly-saleor
tests/conftest.py
Python
checkout
checkout
420
426
420
421
6dc8676dab897a229985d50c9d7d106c0681f40e
bigcode/the-stack
train
bdd77f452cfaa7b8bf6ae7f8
train
function
@pytest.fixture def customer_user(db): # pylint: disable=W0613 return User.objects.create_user('test@example.com', 'password')
@pytest.fixture def customer_user(db): # pylint: disable=W0613
return User.objects.create_user('test@example.com', 'password')
SiteSettings.objects.get_or_create(site=site)[0] settings.SITE_ID = site.pk return obj @pytest.fixture def cart(db): # pylint: disable=W0613 return Cart.objects.create() @pytest.fixture def customer_user(db): # pylint: disable=W0613
64
64
31
17
47
VanilleBid/weekly-saleor
tests/conftest.py
Python
customer_user
customer_user
52
54
52
53
1737ca922ae746fade0fc00aaac15dd34555e05b
bigcode/the-stack
train
7d2a6f878361b8efaf1adbfd
train
function
@pytest.fixture def permission_edit_staff(): return Permission.objects.get(codename='edit_staff')
@pytest.fixture def permission_edit_staff():
return Permission.objects.get(codename='edit_staff')
def authorization_key(db, site_settings): return AuthorizationKey.objects.create( site_settings=site_settings, name='Backend', key='Key', password='Password') @pytest.fixture def permission_view_staff(): return Permission.objects.get(codename='view_staff') @pytest.fixture def permission_edit_...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_staff
permission_edit_staff
599
601
599
600
7349154a495d70174d51352dc6ce9f40708fb4bd
bigcode/the-stack
train
013fc9f3b9bf6cd89c9c815b
train
function
@pytest.fixture def page(db): data = { 'slug': 'test-url', 'title': 'Test page', 'content': 'test content'} page = Page.objects.create(**data) return page
@pytest.fixture def page(db):
data = { 'slug': 'test-url', 'title': 'Test page', 'content': 'test content'} page = Page.objects.create(**data) return page
_address=billing_address)) return orders @pytest.fixture def collection(db): collection = Collection.objects.create(name='Collection', slug='collection') return collection @pytest.fixture def tax_rates_countries(): return {'FR': .20, 'FI': .24} @pytest.fixture def page(db):
64
64
48
7
57
VanilleBid/weekly-saleor
tests/conftest.py
Python
page
page
713
720
713
714
0b9b7c8b384368a84b2ab33f3f11fd6af7e2dce1
bigcode/the-stack
train
06a9c954bda7c3229d0dbc91
train
function
@pytest.fixture def permission_view_staff(): return Permission.objects.get(codename='view_staff')
@pytest.fixture def permission_view_staff():
return Permission.objects.get(codename='view_staff')
="Sale", value=5) sale.categories.add(default_category) return sale @pytest.fixture def authorization_key(db, site_settings): return AuthorizationKey.objects.create( site_settings=site_settings, name='Backend', key='Key', password='Password') @pytest.fixture def permission_view_staff():
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_staff
permission_view_staff
594
596
594
595
b9883846a310d58ee898615dcd76e09d8f9aadab
bigcode/the-stack
train
e3d03a3140b2d65efd755886
train
function
@pytest.fixture def request_cart(cart, monkeypatch): # FIXME: Fixtures should not have any side effects monkeypatch.setattr( utils, 'get_cart_from_request', lambda request, cart_queryset=None: cart) cart.discounts = Sale.objects.all() return cart
@pytest.fixture def request_cart(cart, monkeypatch): # FIXME: Fixtures should not have any side effects
monkeypatch.setattr( utils, 'get_cart_from_request', lambda request, cart_queryset=None: cart) cart.discounts = Sale.objects.all() return cart
=W0613 return Cart.objects.create() @pytest.fixture def customer_user(db): # pylint: disable=W0613 return User.objects.create_user('test@example.com', 'password') @pytest.fixture def request_cart(cart, monkeypatch): # FIXME: Fixtures should not have any side effects
64
64
61
23
41
VanilleBid/weekly-saleor
tests/conftest.py
Python
request_cart
request_cart
57
64
57
59
c944bfe939e69f7c9eb7424671b7199993de39dd
bigcode/the-stack
train
acafd402ce4bfe1ee975fb99
train
function
@pytest.fixture def permission_view_category(): return Permission.objects.get(codename='view_category')
@pytest.fixture def permission_view_category():
return Permission.objects.get(codename='view_category')
@pytest.fixture def staff_group(): return Group.objects.create(name='test') @pytest.fixture def permission_view_product(): return Permission.objects.get(codename='view_product') @pytest.fixture def permission_edit_product(): return Permission.objects.get(codename='edit_product') @pytest.fixture def perm...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_category
permission_view_category
213
215
213
214
123087e6b9d762a5531eacfcbd527cc2caa582a1
bigcode/the-stack
train
5ae6339165a209f88ea044f9
train
function
@pytest.fixture() def staff_client(client, staff_user): """Return a Django test client logged in as an staff member.""" client.login(username=staff_user.email, password='password') return client
@pytest.fixture() def staff_client(client, staff_user):
"""Return a Django test client logged in as an staff member.""" client.login(username=staff_user.email, password='password') return client
.email, password='password') return client @pytest.fixture() def staff_user(db): """Return a staff member.""" return User.objects.create_user( email='staff_test@example.com', password='password', is_staff=True, is_active=True) @pytest.fixture() def staff_client(client, staff_user):
64
64
42
11
53
VanilleBid/weekly-saleor
tests/conftest.py
Python
staff_client
staff_client
114
118
114
115
3bfa6bafd95c395583967ecf448717cf0c8e3417
bigcode/the-stack
train
e12b09daa80c4a4a994ca556
train
function
@pytest.fixture() def order_with_lines(order, product_type, default_category): group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) OrderLine.objects.create( ...
@pytest.fixture() def order_with_lines(order, product_type, default_category):
group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) OrderLine.objects.create( delivery_group=group, product=product, product_name=produc...
tracking_code') @pytest.fixture def checkout(request_cart, customer_user, billing_address, shipping_method): res = Checkout(request_cart, customer_user, 'tracking_code') customer_user.default_shipping_address = billing_address customer_user.default_billing_address = billing_address customer_user.save(...
111
111
373
15
96
VanilleBid/weekly-saleor
tests/conftest.py
Python
order_with_lines
order_with_lines
434
478
434
435
9da62fc7022fb8610975b9cf1d8bc25663da5c48
bigcode/the-stack
train
dfb8e56f7f3674d333725433
train
function
@pytest.fixture def permission_view_stock_location(): return Permission.objects.get(codename='view_stock_location')
@pytest.fixture def permission_view_stock_location():
return Permission.objects.get(codename='view_stock_location')
_edit_product(): return Permission.objects.get(codename='edit_product') @pytest.fixture def permission_view_category(): return Permission.objects.get(codename='view_category') @pytest.fixture def permission_edit_category(): return Permission.objects.get(codename='edit_category') @pytest.fixture def perm...
64
64
22
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_stock_location
permission_view_stock_location
223
225
223
224
2e9efe9a4488b85ae198b3167fcfe17713c6b1d5
bigcode/the-stack
train
41ebe9a9450017f8ec39472a
train
function
@pytest.fixture def staff_group(): return Group.objects.create(name='test')
@pytest.fixture def staff_group():
return Group.objects.create(name='test')
big') return attribute @pytest.fixture def default_category(db): # pylint: disable=W0613 return Category.objects.create(name='Default', slug='default') @pytest.fixture def default_stock_location(db): return StockLocation.objects.create(name='Warehouse 1') @pytest.fixture def staff_group():
64
64
16
7
57
VanilleBid/weekly-saleor
tests/conftest.py
Python
staff_group
staff_group
198
200
198
199
fd9e83224030209dfdb7773d8d8844b26c82cb98
bigcode/the-stack
train
c0140792699e3c122ecbd08d
train
function
@pytest.fixture def multiple_shipping_methods(): data = ( (('PL', 10.0), ('US', 11.0)), (('PL', 31.0), ('US', 61.0)) ) shipping_methods = [] for i, shipment_method in enumerate(data): method = ShippingMethod.objects.create(name=str(i)) for country_code, price in shipme...
@pytest.fixture def multiple_shipping_methods():
data = ( (('PL', 10.0), ('US', 11.0)), (('PL', 31.0), ('US', 61.0)) ) shipping_methods = [] for i, shipment_method in enumerate(data): method = ShippingMethod.objects.create(name=str(i)) for country_code, price in shipment_method: method_country = method.pr...
country='PL', phone='+48713988102') @pytest.fixture def shipping_method(db): # pylint: disable=W0613 method = ShippingMethod.objects.create(name='DHL') method.price_per_country.create(price=10) return method @pytest.fixture def multiple_shipping_methods():
64
64
119
8
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
multiple_shipping_methods
multiple_shipping_methods
146
164
146
147
a7224c59586cebfc5f4f309110202a3c0d1f6e97
bigcode/the-stack
train
70900d9c780270b71c76eca6
train
function
@pytest.fixture def open_orders(billing_address): def group_data(orders, status): return {'order': orders[-1], 'status': status} orders = [] orders.append(Order.objects.create(billing_address=billing_address)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.NEW)) orders.appe...
@pytest.fixture def open_orders(billing_address):
def group_data(orders, status): return {'order': orders[-1], 'status': status} orders = [] orders.append(Order.objects.create(billing_address=billing_address)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.NEW)) orders.append(Order.objects.create(billing_address=billing_ad...
return Permission.objects.get(codename='edit_user') @pytest.fixture def permission_edit_settings(): return Permission.objects.get(codename='edit_settings') @pytest.fixture def permission_impersonate_user(): return Permission.objects.get(codename='impersonate_user') @pytest.fixture def open_orders(billin...
66
66
221
10
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
open_orders
open_orders
654
677
654
655
476f80c48cbc659e56b7333afe492b314d0efc72
bigcode/the-stack
train
39987344d324b7ceb13feda2
train
function
@pytest.fixture def permission_edit_category(): return Permission.objects.get(codename='edit_category')
@pytest.fixture def permission_edit_category():
return Permission.objects.get(codename='edit_category')
permission_view_product(): return Permission.objects.get(codename='view_product') @pytest.fixture def permission_edit_product(): return Permission.objects.get(codename='edit_product') @pytest.fixture def permission_view_category(): return Permission.objects.get(codename='view_category') @pytest.fixture...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_category
permission_edit_category
218
220
218
219
85edb47468c24a24d740c3c9c8e753d7ca4a7c29
bigcode/the-stack
train
a2f3db8da62c652f8148747f
train
function
@pytest.fixture def permission_edit_product(): return Permission.objects.get(codename='edit_product')
@pytest.fixture def permission_edit_product():
return Permission.objects.get(codename='edit_product')
.fixture def default_stock_location(db): return StockLocation.objects.create(name='Warehouse 1') @pytest.fixture def staff_group(): return Group.objects.create(name='test') @pytest.fixture def permission_view_product(): return Permission.objects.get(codename='view_product') @pytest.fixture def permissio...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_product
permission_edit_product
208
210
208
209
d7666c92d1dcef1820951a3310ae2e700903000d
bigcode/the-stack
train
048f4d8dab0d7339ad697937
train
function
@pytest.fixture def product_list(product_type, default_category): product_attr = product_type.product_attributes.first() attr_value = product_attr.values.first() attributes = {smart_text(product_attr.pk): smart_text(attr_value.pk)} product_1 = Product.objects.create( name='Test product 1', pric...
@pytest.fixture def product_list(product_type, default_category):
product_attr = product_type.product_attributes.first() attr_value = product_attr.values.first() attributes = {smart_text(product_attr.pk): smart_text(attr_value.pk)} product_1 = Product.objects.create( name='Test product 1', price=Decimal('10.00'), product_type=product_type, attributes=...
) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) ProductVariant.objects.create(product=product, sku='SKU_B') return product @pytest.fixture def product_list(product_type, default_category):
64
64
203
12
51
VanilleBid/weekly-saleor
tests/conftest.py
Python
product_list
product_list
317
338
317
318
0320593ab0c27d88c37bb19c0fd161d528c2c39f
bigcode/the-stack
train
695c9a5c7f704d8b679a1a51
train
function
@pytest.fixture def product_with_image(product_in_stock, product_image): product = product_in_stock ProductImage.objects.create(product=product, image=product_image) return product
@pytest.fixture def product_with_image(product_in_stock, product_image):
product = product_in_stock ProductImage.objects.create(product=product, image=product_image) return product
def product_image(): img_data = BytesIO() image = Image.new('RGB', size=(1, 1)) image.save(img_data, format='JPEG') return SimpleUploadedFile('product.jpg', img_data.getvalue()) @pytest.fixture def product_with_image(product_in_stock, product_image):
64
64
39
14
50
VanilleBid/weekly-saleor
tests/conftest.py
Python
product_with_image
product_with_image
385
389
385
386
10fb71b00dc869956edadfa5644967be499130e1
bigcode/the-stack
train
7cf5a1c3d4efe0e218fd28a7
train
function
@pytest.fixture() def admin_user(db): """Return a Django admin user.""" return User.objects.create_superuser('admin@example.com', 'password')
@pytest.fixture() def admin_user(db):
"""Return a Django admin user.""" return User.objects.create_superuser('admin@example.com', 'password')
def _override(*args, **kwargs): return checkout return set_value( saleor.checkout.core.Checkout, 'from_storage', _override) @pytest.fixture def order(billing_address): return Order.objects.create(billing_address=billing_address) @pytest.fixture() def admin_user(db):
64
64
31
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
admin_user
admin_user
91
94
91
92
9cc64f69e0f77fc25e7f8c562ca8789d6c8fb598
bigcode/the-stack
train
edba042f82c1272b02ac18aa
train
function
@pytest.fixture def product_in_stock(product_type, default_category): product_attr = product_type.product_attributes.first() attr_value = product_attr.values.first() attributes = {smart_text(product_attr.pk): smart_text(attr_value.pk)} product = Product.objects.create( name='Test product', pric...
@pytest.fixture def product_in_stock(product_type, default_category):
product_attr = product_type.product_attributes.first() attr_value = product_attr.values.first() attributes = {smart_text(product_attr.pk): smart_text(attr_value.pk)} product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, attributes=attr...
_edit_order(): return Permission.objects.get(codename='edit_order') @pytest.fixture def product_type(color_attribute, size_attribute): product_type = ProductType.objects.create( name='Default Type', has_variants=False, is_shipping_required=True) product_type.product_attributes.add(color_attribute)...
88
88
294
13
74
VanilleBid/weekly-saleor
tests/conftest.py
Python
product_in_stock
product_in_stock
272
302
272
273
7c10908522fd1456c526e1f17f668a88a38642d2
bigcode/the-stack
train
869fd974d7c9b44c0e0e722d
train
function
@pytest.fixture def permission_edit_group(): return Permission.objects.get(codename='edit_group')
@pytest.fixture def permission_edit_group():
return Permission.objects.get(codename='edit_group')
permission_view_staff(): return Permission.objects.get(codename='view_staff') @pytest.fixture def permission_edit_staff(): return Permission.objects.get(codename='edit_staff') @pytest.fixture def permission_view_group(): return Permission.objects.get(codename='view_group') @pytest.fixture def permissio...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_group
permission_edit_group
609
611
609
610
57926994b3de8797ec1dd2e941cfc1641b885f26
bigcode/the-stack
train
a427360d2c468eb38a55e60b
train
function
@pytest.fixture def color_attribute(db): # pylint: disable=W0613 attribute = ProductAttribute.objects.create( slug='color', name='Color') AttributeChoiceValue.objects.create( attribute=attribute, name='Red', slug='red') AttributeChoiceValue.objects.create( attribute=attribute, name=...
@pytest.fixture def color_attribute(db): # pylint: disable=W0613
attribute = ProductAttribute.objects.create( slug='color', name='Color') AttributeChoiceValue.objects.create( attribute=attribute, name='Red', slug='red') AttributeChoiceValue.objects.create( attribute=attribute, name='Blue', slug='blue') return attribute
(name=str(i)) for country_code, price in shipment_method: method_country = method.price_per_country.create( country_code=country_code, price=price) shipping_methods.append(method_country) return shipping_methods @pytest.fixture def color_attribute(db): # pylint: d...
64
64
78
17
46
VanilleBid/weekly-saleor
tests/conftest.py
Python
color_attribute
color_attribute
167
175
167
168
d9665f531a6580ae42d34819b7a9da8ef9160814
bigcode/the-stack
train
40c60aff80fa90b2d5a68a73
train
function
@pytest.fixture def default_category(db): # pylint: disable=W0613 return Category.objects.create(name='Default', slug='default')
@pytest.fixture def default_category(db): # pylint: disable=W0613
return Category.objects.create(name='Default', slug='default')
='Size') AttributeChoiceValue.objects.create( attribute=attribute, name='Small', slug='small') AttributeChoiceValue.objects.create( attribute=attribute, name='Big', slug='big') return attribute @pytest.fixture def default_category(db): # pylint: disable=W0613
64
64
30
17
46
VanilleBid/weekly-saleor
tests/conftest.py
Python
default_category
default_category
188
190
188
189
59c261eb10a248a5e95fc154a17d20b4e3287874
bigcode/the-stack
train
097a74fadae88d65ec545579
train
function
@pytest.fixture def tax_rates_countries(): return {'FR': .20, 'FI': .24}
@pytest.fixture def tax_rates_countries():
return {'FR': .20, 'FI': .24}
.CANCELLED)) # empty order is considered as closed orders.append(Order.objects.create(billing_address=billing_address)) return orders @pytest.fixture def collection(db): collection = Collection.objects.create(name='Collection', slug='collection') return collection @pytest.fixture def tax_rates_c...
64
64
23
9
54
VanilleBid/weekly-saleor
tests/conftest.py
Python
tax_rates_countries
tax_rates_countries
709
711
709
710
406c777155d689af0f333e449dfe0508640dbeae
bigcode/the-stack
train
95cdd4ed4d97625550b74cbc
train
function
@pytest.fixture def voucher(db): # pylint: disable=W0613 return Voucher.objects.create(code='mirumee', discount_value=20)
@pytest.fixture def voucher(db): # pylint: disable=W0613
return Voucher.objects.create(code='mirumee', discount_value=20)
, shipping_method): res = Checkout(request_cart, customer_user, 'tracking_code') customer_user.default_shipping_address = billing_address customer_user.default_billing_address = billing_address customer_user.save() return res @pytest.fixture def voucher(db): # pylint: disable=W0613
64
64
32
16
47
VanilleBid/weekly-saleor
tests/conftest.py
Python
voucher
voucher
429
431
429
430
d6d0a389221646650506f1b3e8665051a4120ca1
bigcode/the-stack
train
ad81dbbf37a8e523efdff87b
train
function
@pytest.fixture def anonymous_checkout(): return Checkout((), AnonymousUser(), 'tracking_code')
@pytest.fixture def anonymous_checkout():
return Checkout((), AnonymousUser(), 'tracking_code')
0.jpg' file_mock_1 = MagicMock(spec=File, name='FileMock1') file_mock_1.name = 'image1.jpg' product.images.create(image=file_mock_0) product.images.create(image=file_mock_1) return product @pytest.fixture def anonymous_checkout():
64
64
19
7
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
anonymous_checkout
anonymous_checkout
415
417
415
416
057f59acc5279cbccf9ebe3a47ed1343938003c2
bigcode/the-stack
train
6af34fa1af27495b5ef89792
train
function
@pytest.fixture def permission_edit_user(): return Permission.objects.get(codename='edit_user')
@pytest.fixture def permission_edit_user():
return Permission.objects.get(codename='edit_user')
permission_view_shipping(): return Permission.objects.get(codename='view_shipping') @pytest.fixture def permission_edit_shipping(): return Permission.objects.get(codename='edit_shipping') @pytest.fixture def permission_view_user(): return Permission.objects.get(codename='view_user') @pytest.fixture def...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_user
permission_edit_user
639
641
639
640
20960ceb4e9ff93e3a316f62d89900b3c644334e
bigcode/the-stack
train
41223904595580c17c6f4df9
train
function
@pytest.fixture(autouse=True) def site_settings(db, settings): """Create a site and matching site settings. This fixture is autouse because django.contrib.sites.models.Site and saleor.site.models.SiteSettings have a one-to-one relationship and a site should never exist without a matching settings objec...
@pytest.fixture(autouse=True) def site_settings(db, settings):
"""Create a site and matching site settings. This fixture is autouse because django.contrib.sites.models.Site and saleor.site.models.SiteSettings have a one-to-one relationship and a site should never exist without a matching settings object. """ site = Site.objects.get_or_create( name=...
ProductType, ProductVariant, Stock, StockLocation) from saleor.shipping.models import ShippingMethod from saleor.site.models import AuthorizationKey, SiteSettings from saleor.userprofile.models import Address, User from .utils import set_value @pytest.fixture(autouse=True) def site_settings(db, settings):
64
64
122
14
49
VanilleBid/weekly-saleor
tests/conftest.py
Python
site_settings
site_settings
32
44
32
33
e37621b0233084fbfb7733f1e632ef96722cdfab
bigcode/the-stack
train
7d745ace21972533192e7792
train
function
@pytest.fixture() def order_with_lines_and_stock(order, product_type, default_category): group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) variant = ProductVar...
@pytest.fixture() def order_with_lines_and_stock(order, product_type, default_category):
group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) variant = ProductVariant.objects.create(product=product, sku='SKU_A') warehouse = StockLocation.objects.c...
product_type=product_type, category=default_category) OrderLine.objects.create( delivery_group=group, product=product, product_name=product.name, product_sku='SKU_%d' % (product.pk,), is_shipping_required=product.product_type.is_shipping_required, quantity=1,...
117
117
391
17
99
VanilleBid/weekly-saleor
tests/conftest.py
Python
order_with_lines_and_stock
order_with_lines_and_stock
481
523
481
482
e983d6b63ebcbdc2035df8a93e38d45d76ffeeac
bigcode/the-stack
train
449e107dbf8763b89c67b7b8
train
function
@pytest.fixture def permission_view_sale(): return Permission.objects.get(codename='view_sale')
@pytest.fixture def permission_view_sale():
return Permission.objects.get(codename='view_sale')
return Permission.objects.get(codename='edit_category') @pytest.fixture def permission_view_stock_location(): return Permission.objects.get(codename='view_stock_location') @pytest.fixture def permission_edit_stock_location(): return Permission.objects.get(codename='edit_stock_location') @pytest.fixture ...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_sale
permission_view_sale
233
235
233
234
3c303840b419d1999c89722522611f4a6d14eaa2
bigcode/the-stack
train
adbb8b7ab4b72ad1a738ea3e
train
function
@pytest.fixture def permission_edit_settings(): return Permission.objects.get(codename='edit_settings')
@pytest.fixture def permission_edit_settings():
return Permission.objects.get(codename='edit_settings')
permission_edit_shipping(): return Permission.objects.get(codename='edit_shipping') @pytest.fixture def permission_view_user(): return Permission.objects.get(codename='view_user') @pytest.fixture def permission_edit_user(): return Permission.objects.get(codename='edit_user') @pytest.fixture def permiss...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_settings
permission_edit_settings
644
646
644
645
50c4af2705eedbfa02513706b2d99d9aae6d70d2
bigcode/the-stack
train
a0b2679601cbe78cbc4fbbe6
train
function
@pytest.fixture def variant_list(product_list): res = [] product_type = product_list[0].product_type variant_attr = product_type.variant_attributes.first() variant_attr_value = variant_attr.values.first() variant_attributes = { smart_text(variant_attr.pk): smart_text(variant_attr_value.pk)}...
@pytest.fixture def variant_list(product_list):
res = [] product_type = product_list[0].product_type variant_attr = product_type.variant_attributes.first() variant_attr_value = variant_attr.values.first() variant_attributes = { smart_text(variant_attr.pk): smart_text(variant_attr_value.pk)} for i, product in enumerate(product_list):...
.create( name='Test product 3', price=Decimal('20.00'), product_type=product_type, attributes=attributes, is_published=True, category=default_category) return [product_1, product_2, product_3] @pytest.fixture def variant_list(product_list):
64
64
113
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
variant_list
variant_list
341
356
341
342
e500163f048fa752f0b50cb47adcd3c6f88c6795
bigcode/the-stack
train
8668b6f787d1718846007e49
train
function
@pytest.fixture() def delivery_group(order, product_type, default_category): group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) variant = ProductVariant.objects...
@pytest.fixture() def delivery_group(order, product_type, default_category):
group = DeliveryGroup.objects.create(order=order) product = Product.objects.create( name='Test product', price=Decimal('10.00'), product_type=product_type, category=default_category) variant = ProductVariant.objects.create(product=product, sku='SKU_A') warehouse = StockLocation.objects.c...
3') Stock.objects.create( variant=variant, cost_price=1, quantity=5, quantity_allocated=0, location=warehouse_2) recalculate_order(order_with_lines_and_stock) return order_with_lines_and_stock @pytest.fixture() def delivery_group(order, product_type, default_category):
66
66
220
14
51
VanilleBid/weekly-saleor
tests/conftest.py
Python
delivery_group
delivery_group
553
577
553
554
1a95d2be9d9bac791e80a73cb104bde59859041d
bigcode/the-stack
train
c8a030ccbdeda61e6f37c880
train
function
@pytest.fixture def closed_orders(billing_address): def group_data(orders, status): return {'order': orders[-1], 'status': status} orders = [] orders.append(Order.objects.create(billing_address=billing_address)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.SHIPPED)) order...
@pytest.fixture def closed_orders(billing_address):
def group_data(orders, status): return {'order': orders[-1], 'status': status} orders = [] orders.append(Order.objects.create(billing_address=billing_address)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.SHIPPED)) orders.append(Order.objects.create(billing_address=billin...
)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.NEW)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.SHIPPED)) DeliveryGroup.objects.create(**group_data(orders, GroupStatus.CANCELLED)) return orders @pytest.fixture def closed_orders(billing_address):
64
64
170
10
53
VanilleBid/weekly-saleor
tests/conftest.py
Python
closed_orders
closed_orders
680
700
680
681
428550ac0af18129bdee6c2afc50f6fcf2f28fa3
bigcode/the-stack
train
475fc070fc7617706d763a48
train
function
@pytest.fixture def permission_view_user(): return Permission.objects.get(codename='view_user')
@pytest.fixture def permission_view_user():
return Permission.objects.get(codename='view_user')
permission_edit_properties(): return Permission.objects.get(codename='edit_properties') @pytest.fixture def permission_view_shipping(): return Permission.objects.get(codename='view_shipping') @pytest.fixture def permission_edit_shipping(): return Permission.objects.get(codename='edit_shipping') @pytest...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_user
permission_view_user
634
636
634
635
373901d9f7b8decc5d9257853946f2b463b9e2db
bigcode/the-stack
train
cab1606f926b6f225c721b35
train
function
@pytest.fixture def default_stock_location(db): return StockLocation.objects.create(name='Warehouse 1')
@pytest.fixture def default_stock_location(db):
return StockLocation.objects.create(name='Warehouse 1')
') AttributeChoiceValue.objects.create( attribute=attribute, name='Big', slug='big') return attribute @pytest.fixture def default_category(db): # pylint: disable=W0613 return Category.objects.create(name='Default', slug='default') @pytest.fixture def default_stock_location(db):
64
64
21
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
default_stock_location
default_stock_location
193
195
193
194
233c726454bcab721433072da95349e79cc19acf
bigcode/the-stack
train
02e4d2e0cf40b9e56a655780
train
function
@pytest.fixture def permission_edit_shipping(): return Permission.objects.get(codename='edit_shipping')
@pytest.fixture def permission_edit_shipping():
return Permission.objects.get(codename='edit_shipping')
permission_view_properties(): return Permission.objects.get(codename='view_properties') @pytest.fixture def permission_edit_properties(): return Permission.objects.get(codename='edit_properties') @pytest.fixture def permission_view_shipping(): return Permission.objects.get(codename='view_shipping') @py...
64
64
20
8
56
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_edit_shipping
permission_edit_shipping
629
631
629
630
16fc6566faf8b657999d8ad6cdc1e2be3dcb292d
bigcode/the-stack
train
09b9c24b36ec67533074955b
train
function
@pytest.fixture def permission_view_voucher(): return Permission.objects.get(codename='view_voucher')
@pytest.fixture def permission_view_voucher():
return Permission.objects.get(codename='view_voucher')
_location(): return Permission.objects.get(codename='edit_stock_location') @pytest.fixture def permission_view_sale(): return Permission.objects.get(codename='view_sale') @pytest.fixture def permission_edit_sale(): return Permission.objects.get(codename='edit_sale') @pytest.fixture def permission_view_v...
64
64
22
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
permission_view_voucher
permission_view_voucher
243
245
243
244
1852c38329c3a11c95ccd88853d0b2ed14a02135
bigcode/the-stack
train
1d39b66466d1fcc3e1168cbc
train
function
@pytest.fixture() def admin_client(admin_user): """Return a Django test client logged in as an admin user.""" from django.test.client import Client client = Client() client.login(username=admin_user.email, password='password') return client
@pytest.fixture() def admin_client(admin_user):
"""Return a Django test client logged in as an admin user.""" from django.test.client import Client client = Client() client.login(username=admin_user.email, password='password') return client
_override) @pytest.fixture def order(billing_address): return Order.objects.create(billing_address=billing_address) @pytest.fixture() def admin_user(db): """Return a Django admin user.""" return User.objects.create_superuser('admin@example.com', 'password') @pytest.fixture() def admin_client(admin_user...
64
64
53
9
55
VanilleBid/weekly-saleor
tests/conftest.py
Python
admin_client
admin_client
97
103
97
98
ac87a063cead04679f669eb3a0e7f05297205f19
bigcode/the-stack
train
b622ba7809cfd4c08fd36c4d
train
function
@pytest.fixture def size_attribute(db): # pylint: disable=W0613 attribute = ProductAttribute.objects.create(slug='size', name='Size') AttributeChoiceValue.objects.create( attribute=attribute, name='Small', slug='small') AttributeChoiceValue.objects.create( attribute=attribute, name='Big', s...
@pytest.fixture def size_attribute(db): # pylint: disable=W0613
attribute = ProductAttribute.objects.create(slug='size', name='Size') AttributeChoiceValue.objects.create( attribute=attribute, name='Small', slug='small') AttributeChoiceValue.objects.create( attribute=attribute, name='Big', slug='big') return attribute
='Color') AttributeChoiceValue.objects.create( attribute=attribute, name='Red', slug='red') AttributeChoiceValue.objects.create( attribute=attribute, name='Blue', slug='blue') return attribute @pytest.fixture def size_attribute(db): # pylint: disable=W0613
64
64
77
17
46
VanilleBid/weekly-saleor
tests/conftest.py
Python
size_attribute
size_attribute
178
185
178
179
4a7d609d238557c95ff54f79fbb5bbe8fd4112a3
bigcode/the-stack
train
bc1bcac87a08321b5cfd2404
train
function
@pytest.fixture def order_list(admin_user, billing_address): data = { 'billing_address': billing_address, 'user': admin_user, 'user_email': admin_user.email, 'total': Price(123, currency='USD')} order = Order.objects.create(**data) order1 = Order.objects.create(**data) order2 = Order.obj...
@pytest.fixture def order_list(admin_user, billing_address):
data = { 'billing_address': billing_address, 'user': admin_user, 'user_email': admin_user.email, 'total': Price(123, currency='USD')} order = Order.objects.create(**data) order1 = Order.objects.create(**data) order2 = Order.objects.create(**data) return [order, order1, order2]
variant_attr_value.pk)} for i, product in enumerate(product_list): variant = ProductVariant.objects.create( product=product, sku='sku-%d' % i, attributes=variant_attributes) res.append(variant) return res @pytest.fixture def order_list(admin_user, billing_address):
64
64
90
12
51
VanilleBid/weekly-saleor
tests/conftest.py
Python
order_list
order_list
359
368
359
360
588714795a4f7062e579f24654adf5aeb713fc9d
bigcode/the-stack
train
1e73e322ab20092025946a90
train
class
class ParsersMediatorTest(test_lib.ParserTestCase): """Tests for the parsers mediator.""" # pylint: disable=protected-access def testGetEarliestYearFromFileEntry(self): """Tests the _GetEarliestYearFromFileEntry function.""" session = sessions.Session() storage_writer = fake_writer.FakeStorageWriter...
class ParsersMediatorTest(test_lib.ParserTestCase):
"""Tests for the parsers mediator.""" # pylint: disable=protected-access def testGetEarliestYearFromFileEntry(self): """Tests the _GetEarliestYearFromFileEntry function.""" session = sessions.Session() storage_writer = fake_writer.FakeStorageWriter(session) parsers_mediator = self._CreateParserM...
#!/usr/bin/python # -*- coding: utf-8 -*- """Tests for the parsers mediator.""" from __future__ import unicode_literals import unittest from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.path import factory as path_spec_factory from dfvfs.resolver import resolver as path_spec_resolver from plaso.cont...
134
256
1,688
11
122
ir4n6/plaso
tests/parsers/mediator.py
Python
ParsersMediatorTest
ParsersMediatorTest
22
212
22
22
905a22f199143c9d7a909fc386f518c5e53e478e
bigcode/the-stack
train
35364a8df70be3f95c52fb04
train
class
class BSTNode: def __init__(self, value): self.value = value self.left = None self.right = None # Insert the given value into the tree def insert(self, value): # left case? # check if the value is less than the root value? if value < self.value: #...
class BSTNode:
def __init__(self, value): self.value = value self.left = None self.right = None # Insert the given value into the tree def insert(self, value): # left case? # check if the value is less than the root value? if value < self.value: # move to the le...
""" Binary search trees are a data structure that enforce an ordering over the data they store. That ordering in turn makes it a lot more efficient at searching for a particular piece of data in the tree. This part of the project comprises two days: 1. Implement the methods `insert`, `contains`, `get_max`, and `for_...
113
256
1,085
4
109
jduell12/CS35_DataStructures_GP
bst.py
Python
BSTNode
BSTNode
11
183
11
11
90d70cf0ef98ca3bb1869248f8ace3fddb835d6b
bigcode/the-stack
train
d44b1086ffbc4b23d361629d
train
class
class Task(FrozenClass): def __str__(self): return '\n' + self.__class__.__name__ + ': \n' + pprint.pformat(self.__dict__) + '\n' def __repr__(self): return self.__str__()
class Task(FrozenClass):
def __str__(self): return '\n' + self.__class__.__name__ + ': \n' + pprint.pformat(self.__dict__) + '\n' def __repr__(self): return self.__str__()
import pprint from Utility.Classes.Frozen_Class import FrozenClass class Task(FrozenClass):
19
64
55
6
12
SBCV/PythonUtility
Types/Task/Task.py
Python
Task
Task
5
11
5
6
e30ad60e431f118be70a4912ca5d881e7132b47a
bigcode/the-stack
train
d91a426fb9e70d27e6472a57
train
class
class TestHTTP(TestUnit): def http(self, start_str, **kwargs): sock_type = ( 'ipv4' if 'sock_type' not in kwargs else kwargs['sock_type'] ) port = 7080 if 'port' not in kwargs else kwargs['port'] url = '/' if 'url' not in kwargs else kwargs['url'] http = 'HTTP/1.0...
class TestHTTP(TestUnit):
def http(self, start_str, **kwargs): sock_type = ( 'ipv4' if 'sock_type' not in kwargs else kwargs['sock_type'] ) port = 7080 if 'port' not in kwargs else kwargs['port'] url = '/' if 'url' not in kwargs else kwargs['url'] http = 'HTTP/1.0' if 'http_10' in kwargs e...
import binascii import io import json import os import re import select import socket import time from unit.main import TestUnit class TestHTTP(TestUnit):
38
256
2,305
6
31
dakshinai/unit
test/unit/http.py
Python
TestHTTP
TestHTTP
13
374
13
13
ffec788c16f539a8b9441b5cb5821cf96f79ec47
bigcode/the-stack
train
52a41dc8e8c934ff010c8260
train
class
class HANATStateSync(Packet): name = "HA NAT state sync" fields_desc = [XByteField("version", 1), FlagsField("flags", 0, 8, ['ACK']), FieldLenField("count", None, count_of="events"), IntField("sequence_number", 1), IntField("thread_inde...
class HANATStateSync(Packet):
name = "HA NAT state sync" fields_desc = [XByteField("version", 1), FlagsField("flags", 0, 8, ['ACK']), FieldLenField("count", None, count_of="events"), IntField("sequence_number", 1), IntField("thread_index", 0), Pac...
Field("ehn_port", None), IntField("fib_index", None), IntField("total_pkts", 0), LongField("total_bytes", 0)] def extract_padding(self, s): return "", s # NAT HA protocol header class HANATStateSync(Packet):
64
64
98
7
56
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
HANATStateSync
HANATStateSync
60
68
60
60
f83f58f2dae54e0a6702f6c54d9957ab1fe07fc6
bigcode/the-stack
train
a134feb3f37983e325e44ade
train
class
class TestNATMisc(MethodHolder): """ NAT misc Test Cases """ max_translations = 10240 max_users = 10240 def setUp(self): super(TestNATMisc, self).setUp() self.vapi.nat44_plugin_enable_disable( sessions=self.max_translations, users=self.max_users, enable=1) ...
class TestNATMisc(MethodHolder):
""" NAT misc Test Cases """ max_translations = 10240 max_users = 10240 def setUp(self): super(TestNATMisc, self).setUp() self.vapi.nat44_plugin_enable_disable( sessions=self.max_translations, users=self.max_users, enable=1) def tearDown(self): super...
self.assertEqual(p[layer].sport, self.server_out_port) self.assertEqual(p[layer].dport, self.port_in) else: self.assertEqual(p[layer].id, self.port_in) self.assertEqual(data, p[Raw].load) class TestNATMisc(MethodHolder):
64
64
178
8
56
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNATMisc
TestNATMisc
1,163
1,185
1,163
1,163
00c7744ba6858e83ad3efaebd31048c366e1639b
bigcode/the-stack
train
42a2ac9efbfb06329cfba6b6
train
class
class TestNAT44EndpointDependent2(MethodHolder): """ Endpoint-Dependent mapping and filtering test cases """ @classmethod def tearDownClass(cls): super(TestNAT44EndpointDependent2, cls).tearDownClass() def tearDown(self): super(TestNAT44EndpointDependent2, self).tearDown() @classm...
class TestNAT44EndpointDependent2(MethodHolder):
""" Endpoint-Dependent mapping and filtering test cases """ @classmethod def tearDownClass(cls): super(TestNAT44EndpointDependent2, cls).tearDownClass() def tearDown(self): super(TestNAT44EndpointDependent2, self).tearDown() @classmethod def create_and_add_ip4_table(cls, i, ta...
] try: ip = p[IP] tcp = p[TCP] except IndexError: self.logger.error(ppp("Invalid packet:", p)) raise else: self.assertEqual(ip.src, self.pg1.remote_ip4) self.assertEqual(ip.dst, self.pg0.remote_ip4) self.assertEq...
255
256
997
11
244
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNAT44EndpointDependent2
TestNAT44EndpointDependent2
3,962
4,092
3,962
3,962
bd6fc4cfd59554bb334ca6c72b4058d6e7027ddd
bigcode/the-stack
train
7f6f58c0dc71684a5711c971
train
class
class MethodHolder(VppTestCase): """ NAT create capture and verify method holder """ @property def config_flags(self): return VppEnum.vl_api_nat_config_flags_t @property def nat44_config_flags(self): return VppEnum.vl_api_nat44_config_flags_t @property def SYSLOG_SEVERITY(...
class MethodHolder(VppTestCase):
""" NAT create capture and verify method holder """ @property def config_flags(self): return VppEnum.vl_api_nat_config_flags_t @property def nat44_config_flags(self): return VppEnum.vl_api_nat44_config_flags_t @property def SYSLOG_SEVERITY(self): return VppEnum.vl_...
1: "udp", 2: "tcp", 3: "icmp"}), ShortField("flags", 0), IPField("in_addr", None), IPField("out_addr", None), ShortField("in_port", None), ShortField("out_port", None), IPField("eh_addr", None), ...
255
256
10,216
8
247
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
MethodHolder
MethodHolder
71
1,160
71
71
10b587d78e3389d78fce69cc3a87dceee9aa0223
bigcode/the-stack
train
e9e7c9a192ada427b990d017
train
class
class TestNAT44Out2InDPO(MethodHolder): """ NAT44 Test Cases using out2in DPO """ @classmethod def setUpClass(cls): super(TestNAT44Out2InDPO, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_port_out = 6303 cls.udp_port_...
class TestNAT44Out2InDPO(MethodHolder):
""" NAT44 Test Cases using out2in DPO """ @classmethod def setUpClass(cls): super(TestNAT44Out2InDPO, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_port_out = 6303 cls.udp_port_in = 6304 cls.udp_port_out = 630...
for i in range(0, self.max_translations - 1): p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) / IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, ttl=64) / UDP(sport=7000+i, dport=80)) pkts.append(p) self.pg0.add_stream(pkts) ...
256
256
1,288
13
243
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNAT44Out2InDPO
TestNAT44Out2InDPO
7,044
7,176
7,044
7,044
5bd821146d33638a07a72ae03612c09a669b8cb6
bigcode/the-stack
train
136746c403bc9a717fa8036d
train
class
class TestNAT44(MethodHolder): """ NAT44 Test Cases """ max_translations = 10240 max_users = 10240 @classmethod def setUpClass(cls): super(TestNAT44, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_port_out = 6303 ...
class TestNAT44(MethodHolder):
""" NAT44 Test Cases """ max_translations = 10240 max_users = 10240 @classmethod def setUpClass(cls): super(TestNAT44, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_port_out = 6303 cls.udp_port_in = 6304 ...
_ip4) if proto != IP_PROTOS.icmp: self.assertEqual(p[layer].sport, self.server_out_port) self.assertEqual(p[layer].dport, self.port_in) else: self.assertEqual(p[layer].id, self.port_in) self.assertEqual(data, p[Raw].load) class TestNA...
256
256
27,425
8
248
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNAT44
TestNAT44
1,188
3,959
1,188
1,188
54523a364cb70e1443e8bc37c6f32a44138e3417
bigcode/the-stack
train
2f4c29a985a2fc633f66eaba
train
class
class Event(Packet): name = "Event" fields_desc = [ByteEnumField("event_type", None, {1: "add", 2: "del", 3: "refresh"}), ByteEnumField("protocol", None, {0: "other", 1: "udp", 2: "tcp", 3: "icmp"}), ShortFie...
class Event(Packet):
name = "Event" fields_desc = [ByteEnumField("event_type", None, {1: "add", 2: "del", 3: "refresh"}), ByteEnumField("protocol", None, {0: "other", 1: "udp", 2: "tcp", 3: "icmp"}), ShortField("flags", 0), ...
from vpp_acl import AclRule, VppAcl, VppAclInterface from vpp_ip_route import VppIpRoute, VppRoutePath from vpp_neighbor import VppNeighbor from vpp_papi import VppEnum # NAT HA protocol event data class Event(Packet):
64
64
203
4
59
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
Event
Event
36
56
36
36
bf2672051753e8f43543568992c20e04bae1da44
bigcode/the-stack
train
92b615f99834ebea188642b6
train
class
class TestNAT44EndpointDependent(MethodHolder): """ Endpoint-Dependent mapping and filtering test cases """ @classmethod def setUpClass(cls): super(TestNAT44EndpointDependent, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_por...
class TestNAT44EndpointDependent(MethodHolder):
""" Endpoint-Dependent mapping and filtering test cases """ @classmethod def setUpClass(cls): super(TestNAT44EndpointDependent, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.tcp_port_in = 6303 cls.tcp_port_out = 6303 cls.udp_port_in = 6304 ...
= 5 # 2 interfaces pg0, pg1 (vrf10, limit 1 tcp session) # non existing vrf_id makes process core dump self.vapi.nat44_set_session_limit(session_limit=limit, vrf_id=10) self.nat_add_inside_interface(inside) self.nat_add_inside_interface(inside_vrf10) self.nat_add_outsi...
256
256
27,509
10
246
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNAT44EndpointDependent
TestNAT44EndpointDependent
4,095
6,935
4,095
4,095
240cff6ccede895eda242b4c8a3c45a76f45a964
bigcode/the-stack
train
2f777d8640fe9ea68d71d2a9
train
class
class TestNAT44EndpointDependent3(MethodHolder): """ Endpoint-Dependent mapping and filtering extra test cases """ max_translations = 50 @classmethod def setUpClass(cls): super(TestNAT44EndpointDependent3, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.nat...
class TestNAT44EndpointDependent3(MethodHolder):
""" Endpoint-Dependent mapping and filtering extra test cases """ max_translations = 50 @classmethod def setUpClass(cls): super(TestNAT44EndpointDependent3, cls).setUpClass() cls.vapi.cli("set log class nat level debug") cls.nat_addr = '10.0.0.3' cls.create_pg_interfa...
.assertEqual(non_static_user.nstaticsessions, 0) self.assertEqual(non_static_user.nsessions, 3) finally: self.vapi.nat44_forwarding_enable_disable(enable=0) flags = self.config_flags.NAT_IS_ADDR_ONLY self.vapi.nat44_add_del_static_mapping( is_add=...
255
256
992
11
244
hesingh/vpp
src/plugins/nat/test/test_nat44.py
Python
TestNAT44EndpointDependent3
TestNAT44EndpointDependent3
6,938
7,041
6,938
6,938
fd53406cb10a873ca173734e41045f5f99108697
bigcode/the-stack
train
ece5e809369fa6cef5bab8e6
train
class
class DjangoSummernoteTest(TestCase): def setUp(self): self.site = AdminSite() def test_base(self): self.assertTrue(True) def test_url(self): url = reverse('django_summernote-editor', kwargs={'id': 'foobar'}) response = self.client.get(url) self.assertEqual(respons...
class DjangoSummernoteTest(TestCase):
def setUp(self): self.site = AdminSite() def test_base(self): self.assertTrue(True) def test_url(self): url = reverse('django_summernote-editor', kwargs={'id': 'foobar'}) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.asser...
# -*- coding: utf-8 -*- from django.contrib.admin.sites import AdminSite from django.core.urlresolvers import reverse from django.test import TestCase from django_summernote.settings import summernote_config from imp import reload class DjangoSummernoteTest(TestCase):
58
256
1,534
8
49
Sponsorcraft/django-summernote
django_summernote/tests.py
Python
DjangoSummernoteTest
DjangoSummernoteTest
9
220
9
9
f857629ef22378c4514be3a86cced71f7fcf4899
bigcode/the-stack
train
ceb4512e48fb1bf04843b3d5
train
function
def init_model(engine): """Call me before using any of the tables or classes in the model.""" sm = orm.sessionmaker(autoflush=True, transactional=True, bind=engine) meta.engine = engine meta.Session = orm.scoped_session(sm)
def init_model(engine):
"""Call me before using any of the tables or classes in the model.""" sm = orm.sessionmaker(autoflush=True, transactional=True, bind=engine) meta.engine = engine meta.Session = orm.scoped_session(sm)
import sqlalchemy as sa import datetime from sqlalchemy import orm from sqlalchemy import schema, types import sqlalchemy import meta def init_model(engine):
31
64
56
5
25
bobrock/AuthKit
examples/user/database-model/model.py
Python
init_model
init_model
8
14
8
8
1ee352330cc1b08bf018a50993f61643229f1422
bigcode/the-stack
train
381e2372c0d2c083e3ac3a01
train
function
def disconf_execute_new(disconf_obj): ''' 操作disconf新版本 :param disconf_obj: :return: ''' logger.debug("操作disconf入参为: {0}".format(disconf_obj)) try: disconf_method = disconf_obj.pop("disconf_method") disconf_id = disconf_obj.pop("disconf_id") disconf_name = disconf_obj....
def disconf_execute_new(disconf_obj):
''' 操作disconf新版本 :param disconf_obj: :return: ''' logger.debug("操作disconf入参为: {0}".format(disconf_obj)) try: disconf_method = disconf_obj.pop("disconf_method") disconf_id = disconf_obj.pop("disconf_id") disconf_name = disconf_obj.pop("disconf_name") disconf_va...
_method == "delete": return del_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value) elif disconf_method == "query": return query_disconf_value(disconf_host, disconf_id, disconf_name) else: return make_response({"code": "100", "desc": "入参校验失败"}) def disconf_execute_new(d...
86
87
293
9
77
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_execute_new
disconf_execute_new
137
165
137
137
65566426152f9be44953238364874432b0813011
bigcode/the-stack
train
a2fd1eba42e2199b51f49907
train
function
def disconf_execute(disconf_obj): ''' 操作disconf :param disconf_obj: :return: ''' logger.debug("操作disconf入参为: {0}".format(disconf_obj)) try: disconf_method = disconf_obj.pop("disconf_method") disconf_id = disconf_obj.pop("disconf_id") disconf_name = disconf_obj.pop("di...
def disconf_execute(disconf_obj):
''' 操作disconf :param disconf_obj: :return: ''' logger.debug("操作disconf入参为: {0}".format(disconf_obj)) try: disconf_method = disconf_obj.pop("disconf_method") disconf_id = disconf_obj.pop("disconf_id") disconf_name = disconf_obj.pop("disconf_name") disconf_value...
# disconf_List = [] # for i in tmp_value_list: # if disconf_name == i.split('=', 1)[0]: # # disconf_List = re.findall(disconf_name + r"=(.+?)\n", value, re.S) # # disconf_List = i.split('=', 1)[-1] # disconf_List.append(i) # return disconf_List def disconf_execute(di...
101
101
339
8
92
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_execute
disconf_execute
102
134
102
102
fb2f3aa671b0796547d01cdfe5e3482c809187ef
bigcode/the-stack
train
52618f44d403e910c9415145
train
function
def disconf_get_config(disconf_host, cookie, config_id): url = disconf_host + '/api/web/config/' + str(config_id) heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} value = None try: response = requests.get(url=url, headers=heard_info) log...
def disconf_get_config(disconf_host, cookie, config_id):
url = disconf_host + '/api/web/config/' + str(config_id) heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} value = None try: response = requests.get(url=url, headers=heard_info) logger.debug("response.text: {0}".format(response.text)) ...
0" try: response = requests.post(url=url, headers=heard_info, data=body) logger.debug("response.text: {0}".format(response.text)) except Exception as err: raise err return cookie def disconf_get_config(disconf_host, cookie, config_id):
64
64
136
14
49
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_get_config
disconf_get_config
40
52
40
40
6825020033af4f69f431a513a9213a7f51707877
bigcode/the-stack
train
ae8b18f8e03ebf780b0d0a8e
train
function
def disconf_put_config(disconf_host, cookie, config_id, body): url = disconf_host + '/api/web/config/filetext/' + str(config_id) heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} body = "fileContent=" + parse.quote(body.encode('utf-8')) # urlencode str_...
def disconf_put_config(disconf_host, cookie, config_id, body):
url = disconf_host + '/api/web/config/filetext/' + str(config_id) heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} body = "fileContent=" + parse.quote(body.encode('utf-8')) # urlencode str_response = None try: response = requests.put(url=ur...
(response.text)) response_dict = json.loads(response.text) logger.info('response_dict: {}'.format(response_dict)) value = response_dict['result']['value'] except Exception as err: raise err return value def disconf_put_config(disconf_host, cookie, config_id, body):
64
64
158
16
47
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_put_config
disconf_put_config
55
67
55
55
9765184e07e139fb7c220f24a726b7c770c65d65
bigcode/the-stack
train
7eb73f704c15b6cc73e4ce68
train
function
def disconf_session(disconf_host): url = disconf_host + '/api/account/session' cookie = None heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} # 请求头 try: response = requests.get(url=url, headers=heard_info) logger.debug("response.headers: {0}".format(resp...
def disconf_session(disconf_host):
url = disconf_host + '/api/account/session' cookie = None heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'} # 请求头 try: response = requests.get(url=url, headers=heard_info) logger.debug("response.headers: {0}".format(response.headers)) cookie = res...
# -*- coding:utf-8 -*- import json import re import requests import traceback from urllib import parse from atp.utils.common import make_response from atp.api.comm_log import logger from atp.models.atp_auto import EnvInfo def disconf_session(disconf_host):
61
64
123
8
52
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_session
disconf_session
14
25
14
14
908f8e2cf1b234241347955fa1c68dd67f0b0bbf
bigcode/the-stack
train
45442b170218e75a9e09df3b
train
function
def edit_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value): """ 根据传入的配置文件唯一标识id修改某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 配置文件的变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(d...
def edit_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value):
""" 根据传入的配置文件唯一标识id修改某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 配置文件的变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(disconf_host, cookie) value = disconf_get_config(disconf_host, cookie, disco...
": return add_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value) elif disconf_method == "delete": return del_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value) elif disconf_method == "query": return query_disconf_value(disconf_host, disconf_id, disco...
125
126
420
21
104
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
edit_disconf_value
edit_disconf_value
168
207
168
168
58efd15ee596ed3e76cee541ac290712d0ad9f7c
bigcode/the-stack
train
a9e78905a44aa675fbee4f3f
train
function
def del_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value): """ 根据传入的配置文件唯一标识id删除某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 需要删除的配置文件变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signi...
def del_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value):
""" 根据传入的配置文件唯一标识id删除某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 需要删除的配置文件变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(disconf_host, cookie) value = disconf_get_config(disconf_host, cookie, d...
_disconf_value) # disconf_List[0] = disconf_List[0] + ',' + disconf_value disconf_edit_value = disconf_name + "=" + disconf_List[0] + ',' + disconf_value return disconf_put_config(disconf_host, cookie, disconf_id, disconf_edit_value.join(tmp_list)) except IndexError: ...
114
114
380
21
92
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
del_disconf_value
del_disconf_value
253
282
253
253
2f2bf2ac5b4095ab66a44488fcb054d5fd21cc44
bigcode/the-stack
train
df0327c84cf00a682dfab6d6
train
function
def query_configId_value(disconf_name, value): # 判断第一个和最后一个配置是否符合 # if value.split('=')[0] == disconf_name: # disconf_List = re.findall(disconf_name + r"=(.+?)\n", value, re.S) # elif value.split('\n')[-1].split('=')[0] == disconf_name: # disconf_List = [] # disconf_List.append(value...
def query_configId_value(disconf_name, value): # 判断第一个和最后一个配置是否符合 # if value.split('=')[0] == disconf_name: # disconf_List = re.findall(disconf_name + r"=(.+?)\n", value, re.S) # elif value.split('\n')[-1].split('=')[0] == disconf_name: # disconf_List = [] # disconf_List.append(value...
tmp_value = value.split('\n') disconf_List = [] for i in tmp_value: if i.split('=', 1)[0] == disconf_name: # disconf_List = re.findall(disconf_name + r"=(.+?)\n", value, re.S) # disconf_List = i.split('=', 1)[-1] disconf_List.append(i) return disconf_List
def query_configId_value(disconf_name, value): # 判断第一个和最后一个配置是否符合 # if value.split('=')[0] == disconf_name: # disconf_List = re.findall(disconf_name + r"=(.+?)\n", value, re.S) # elif value.split('\n')[-1].split('=')[0] == disconf_name: # disconf_List = [] # disconf_List.append(value...
157
74
249
157
0
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
query_configId_value
query_configId_value
70
88
70
80
0ccb6a03d9bd609e82ac5bbe413deb74a462f5b1
bigcode/the-stack
train
1613aeab28d9da5ce97a9f6f
train
function
def disconf_signin(disconf_host, cookie): url = disconf_host + '/api/account/signin' heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} body = "name=admin&password=admin&remember=0" try: response = requests.post(url=url, headers=heard_info, data=b...
def disconf_signin(disconf_host, cookie):
url = disconf_host + '/api/account/signin' heard_info = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Cookie': cookie} body = "name=admin&password=admin&remember=0" try: response = requests.post(url=url, headers=heard_info, data=body) logger.debug("response.text: ...
response.headers: {0}".format(response.headers)) cookie = response.headers['Set-Cookie'] # 获取JSESSIONID logger.debug("cookie: {0}".format(cookie)) except Exception as err: raise err return cookie def disconf_signin(disconf_host, cookie):
64
64
113
11
52
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
disconf_signin
disconf_signin
28
37
28
28
5df9be05d10a9ce183a6bfaad4b20b1adecb8678
bigcode/the-stack
train
b662cc3c8fca2fcef86ebe70
train
function
def query_disconf_value(disconf_host, disconf_id, disconf_name): """ 根据传入的配置文件唯一标识id查询某个配置的值(Disconf) :param disconf_id:配置文件唯一标识 :param disconf_name:配置文件的变量名 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(disconf_host, cookie) value = disconf_get_config(d...
def query_disconf_value(disconf_host, disconf_id, disconf_name):
""" 根据传入的配置文件唯一标识id查询某个配置的值(Disconf) :param disconf_id:配置文件唯一标识 :param disconf_name:配置文件的变量名 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(disconf_host, cookie) value = disconf_get_config(disconf_host, cookie, disconf_id) if value: disconf_Li...
return tmp_value_list return disconf_put_config(disconf_host, cookie, disconf_id, "\n".join(tmp_value_list)) except IndexError: return -2 else: return -1 def query_disconf_value(disconf_host, disconf_id, disconf_name):
64
64
176
17
46
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
query_disconf_value
query_disconf_value
210
225
210
210
fcd537dccc2f976120a6988afef3b12669ac9e16
bigcode/the-stack
train
4b3a58170292b245702b8cf7
train
function
def add_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value): """ 根据传入的配置文件唯一标识id增加某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 配置文件的变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(di...
def add_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value):
""" 根据传入的配置文件唯一标识id增加某个配置的值(Disconf) :param disconf_id: 配置文件唯一标识 :param disconf_name: 配置文件的变量名 :param disconf_value: 配置文件的变量名的值 :return: """ cookie = disconf_session(disconf_host) cookie = disconf_signin(disconf_host, cookie) value = disconf_get_config(disconf_host, cookie, disco...
: disconf_List = query_configId_value(disconf_name, value) logger.info("查询disconf结果为: {0}".format(disconf_List[0])) return str(disconf_List[0]).split('=', 1)[1] else: return -1 def add_disconf_value(disconf_host, disconf_id, disconf_name, disconf_value):
82
82
274
21
60
rebecca1202/testAuto
atp-auto-core-open/atp/api/disconf_executor.py
Python
add_disconf_value
add_disconf_value
228
250
228
228
f2e293f3c30fb50a36b8e52f30aa7be8a347dca8
bigcode/the-stack
train
631f098052db006b0c2c903c
train
function
def test_direct_use(): reference = dcase_util.containers.MetaDataContainer([ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_labe...
def test_direct_use():
reference = dcase_util.containers.MetaDataContainer([ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_label': 'quietstreet', ...
''' Unit tests for scene classification ''' import numpy import nose.tools import sed_eval import dcase_util def test_direct_use():
29
100
335
5
23
TUT-ARG/sed_eval
tests/test_scene.py
Python
test_direct_use
test_direct_use
11
69
11
11
d384d35ea88ddc7e6b4133ca433cb5cddbc101c5
bigcode/the-stack
train
91625bbf508824b59bb7f4a0
train
function
def test_direct_use2(): reference = [ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_label': 'quietstreet', 'file': ...
def test_direct_use2():
reference = [ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_label': 'quietstreet', 'file': 'quietstreet08.wav' ...
}, { 'scene_label': 'car', 'file': 'bus01.wav' }, ]) scene_labels = sed_eval.sound_event.util.unique_scene_labels(reference) scene_metrics = sed_eval.scene.SceneClassificationMetrics(scene_labels) scene_metrics.evaluate( reference_scene_list=reference, ...
108
108
360
6
102
TUT-ARG/sed_eval
tests/test_scene.py
Python
test_direct_use2
test_direct_use2
72
134
72
72
166b76befe93b2488616abb7ead74e0531640900
bigcode/the-stack
train
c3a8576649c151c0dd22aa5e
train
function
@nose.tools.raises(ValueError) def test_parameters_1(): reference = [ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_label': 'qu...
@nose.tools.raises(ValueError) def test_parameters_1():
reference = [ { 'scene_label': 'supermarket', 'file': 'supermarket09.wav' }, { 'scene_label': 'tubestation', 'file': 'tubestation10.wav' }, { 'scene_label': 'quietstreet', 'file': 'quietstreet08.wav' ...
.assert_almost_equals(results['overall']['accuracy'], 0.4) print(scene_metrics) scene_metrics.reset() results = scene_metrics.results() nose.tools.assert_almost_equals(results['overall']['count']['Nref'], 0) @nose.tools.raises(ValueError) def test_parameters_1():
64
64
182
13
51
TUT-ARG/sed_eval
tests/test_scene.py
Python
test_parameters_1
test_parameters_1
137
167
137
138
cd4a9101237ab0d5346f4d7cbcb55edbd8922fcb
bigcode/the-stack
train
c7b18ffcc604ae655cd629ed
train
function
def patch_mn_optimizer(optimizer): def reset_prev_params(self): super(_MultiNodeOptimizer, self).__setattr__( 'target_params', []) optimizer.reset_prev_params = six.create_bound_method(reset_prev_params, optimizer)
def patch_mn_optimizer(optimizer):
def reset_prev_params(self): super(_MultiNodeOptimizer, self).__setattr__( 'target_params', []) optimizer.reset_prev_params = six.create_bound_method(reset_prev_params, optimizer)
import six from chainermn.optimizers import _MultiNodeOptimizer def patch_mn_optimizer(optimizer):
23
64
50
8
14
pfnet-research/echainer
echainer/monkey_patch.py
Python
patch_mn_optimizer
patch_mn_optimizer
4
9
4
4
350d62c220f1764a4013747b58cb93740db00f51
bigcode/the-stack
train
fe4d36e17379ab80991278a3
train
class
class ModifyMetricRuleTemplateRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Cms', '2019-01-01', 'ModifyMetricRuleTemplate','cms') self.set_method('POST') def get_RestVersion(self): return self.get_query_params().get('RestVersion') def set_RestVersion(self,RestVersion): self.ad...
class ModifyMetricRuleTemplateRequest(RpcRequest):
def __init__(self): RpcRequest.__init__(self, 'Cms', '2019-01-01', 'ModifyMetricRuleTemplate','cms') self.set_method('POST') def get_RestVersion(self): return self.get_query_params().get('RestVersion') def set_RestVersion(self,RestVersion): self.add_query_param('RestVersion',RestVersion) def get...
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
196
256
1,424
10
185
jia-jerry/aliyun-openapi-python-sdk
aliyun-python-sdk-cms/aliyunsdkcms/request/v20190101/ModifyMetricRuleTemplateRequest.py
Python
ModifyMetricRuleTemplateRequest
ModifyMetricRuleTemplateRequest
22
94
22
23
4bc38f6cf2289a307bbf7abd14e593e132f57b5e
bigcode/the-stack
train
29d18ea476dc0f51f092cadb
train
class
class LocationTests(ApiTestBase): """Tests for LocationsEndpointsMixin.""" @staticmethod def init_all(api): return [ { 'name': 'test_location_info', 'test': LocationTests('test_location_info', api), }, { 'name': 'te...
class LocationTests(ApiTestBase):
"""Tests for LocationsEndpointsMixin.""" @staticmethod def init_all(api): return [ { 'name': 'test_location_info', 'test': LocationTests('test_location_info', api), }, { 'name': 'test_location_related', ...
from .common import ApiTestBase class LocationTests(ApiTestBase):
15
132
440
7
7
zmike808/instagram_private_api_old
api_tests/private/locations.py
Python
LocationTests
LocationTests
4
57
4
4
443bcc3381578f2d63a9ff93991307b80e9f4ed9
bigcode/the-stack
train
eddc159776e4fc0975ecf861
train
class
class Session: def __init__(self, **kwargs): self.kwargs = kwargs self.output_dir = self.output_dir_name() self.output_dir_create(self.output_dir) def output_dir_name(self): name_date = datetime.datetime.now().strftime('%Y%m%d_%H%M') name = footrecon.name_lower + '-' + ...
class Session:
def __init__(self, **kwargs): self.kwargs = kwargs self.output_dir = self.output_dir_name() self.output_dir_create(self.output_dir) def output_dir_name(self): name_date = datetime.datetime.now().strftime('%Y%m%d_%H%M') name = footrecon.name_lower + '-' + name_date ...
import datetime import pathlib import asyncio import footrecon from footrecon.core.logs import logger class Session:
26
64
145
3
22
tasooshi/footrecon
footrecon/core/modules.py
Python
Session
Session
9
26
9
10
98e90379a0bcdba7116a55842202e3f7a77a2b40
bigcode/the-stack
train
0ba424cbd29f97edd555c2d8
train
class
class Module: output_prefix = 'tmp' output_suffix = '.tmp' def __init__(self, app, executor): self.app = app self.device = None self.device_name = '' self.session = None self.executor = executor self.setup() def output_file_name(self, idx=''): r...
class Module:
output_prefix = 'tmp' output_suffix = '.tmp' def __init__(self, app, executor): self.app = app self.device = None self.device_name = '' self.session = None self.executor = executor self.setup() def output_file_name(self, idx=''): return str(pathl...
while pathlib.Path(name).exists(): suffix += 1 name = footrecon.name_lower + '-' + name_date + '-' + str(suffix) return name def output_dir_create(self, dirname): pathlib.Path(dirname).mkdir(parents=True, exist_ok=True) class Module:
64
64
169
3
61
tasooshi/footrecon
footrecon/core/modules.py
Python
Module
Module
29
57
29
30
d807ef6cee30a5459bba2b87dfc9810392b10b72
bigcode/the-stack
train
1e537370397b6516e7343173
train
class
class HERTrainer(TorchTrainer): """ Hindsight Experience Replay (Andrychowicz et al. 2017). Duplicates transitions using different goals with particular reward function. """ def __init__( self, policy_trainer, replay_buffer, state_dim, re...
class HERTrainer(TorchTrainer):
""" Hindsight Experience Replay (Andrychowicz et al. 2017). Duplicates transitions using different goals with particular reward function. """ def __init__( self, policy_trainer, replay_buffer, state_dim, reward_func=None, relab...
import numpy as np import copy from lifelong_rl.core.rl_algorithms.torch_rl_algorithm import TorchTrainer import lifelong_rl.torch.pytorch_util as ptu class HERTrainer(TorchTrainer):
42
254
849
7
34
nakamotoo/lifelong_rl
lifelong_rl/trainers/her/her.py
Python
HERTrainer
HERTrainer
9
116
9
10
957b54e1e3ddab0e49d29e6438e674bbc29cb87e
bigcode/the-stack
train
df2177f5b28a6d6895fb3269
train
class
class TradesAtTimeApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_c...
class TradesAtTimeApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client self.tick_history...
><p>Tick History provides dynamic access to tick data for a specific security intra-day or historically via standard HTTPS protocol. History is available for all quotes and trades for a trailing 6 months or 1-year, respectively. Quotes and trade data for Options is available for 30 days. Tick History data is also avail...
256
256
3,885
7
248
factset/enterprise-sdk
code/python/IntradayTickHistory/v1/fds/sdk/IntradayTickHistory/api/trades_at_time_api.py
Python
TradesAtTimeApi
TradesAtTimeApi
34
339
34
34
a39ca0dcd6bb36645def4a3ae23ed698d8a1f13d
bigcode/the-stack
train
7813c87e309b2f451df81153
train
function
def GetOpts(argv): """Returns a dictionary of parsed options. Args: argv: raw command line. Returns: Dictionary of parsed options. """ committer_parser = chrome_committer.ChromeCommitter.GetParser() parser = commandline.ArgumentParser(description=__doc__, pare...
def GetOpts(argv):
"""Returns a dictionary of parsed options. Args: argv: raw command line. Returns: Dictionary of parsed options. """ committer_parser = chrome_committer.ChromeCommitter.GetParser() parser = commandline.ArgumentParser(description=__doc__, parents=[committer_pars...
._lkgm, cq_includes=cq_includes) def CommitNewLKGM(self): """Commits the new LKGM file using our template commit message.""" self._committer.Commit([constants.PATH_TO_CHROME_LKGM], self.ComposeCommitMsg()) def GetOpts(argv):
64
64
105
5
59
khromiumos/chromiumos-chromite
scripts/chrome_chromeos_lkgm.py
Python
GetOpts
GetOpts
139
154
139
139
f3635bb4ae90fbf2cf3de46bed487495201e8e6e
bigcode/the-stack
train
a39e3666078c2c39160dcdd3
train
class
class LKGMFileNotFound(chrome_committer.CommitError): """Raised if the LKGM file is not found."""
class LKGMFileNotFound(chrome_committer.CommitError):
"""Raised if the LKGM file is not found."""
.version_info >= (3, 6), 'This module requires Python 3.6+' class LKGMNotValid(chrome_committer.CommitError): """Raised if the LKGM version is unset or not newer than the current value.""" class LKGMFileNotFound(chrome_committer.CommitError):
63
64
25
13
50
khromiumos/chromiumos-chromite
scripts/chrome_chromeos_lkgm.py
Python
LKGMFileNotFound
LKGMFileNotFound
30
31
30
30
c64b844b40f1649990b28817fb3cb50ccb2e25ac
bigcode/the-stack
train
01b0e85823596b8697b162ab
train
function
def main(argv): opts = GetOpts(argv) committer = ChromeLKGMCommitter(opts.user_email, opts.workdir, opts.lkgm, opts.dryrun) committer.Run() return 0
def main(argv):
opts = GetOpts(argv) committer = ChromeLKGMCommitter(opts.user_email, opts.workdir, opts.lkgm, opts.dryrun) committer.Run() return 0
ter.GetParser() parser = commandline.ArgumentParser(description=__doc__, parents=[committer_parser], add_help=False, logging=False) parser.add_argument('--lkgm', required=True, help='LKGM version to update to.') retu...
64
64
49
4
60
khromiumos/chromiumos-chromite
scripts/chrome_chromeos_lkgm.py
Python
main
main
156
161
156
156
7fe05276ca32161f0a50d0d23e03f0a8996fc842
bigcode/the-stack
train
a732829037e486f8c0041aa0
train
class
class ChromeLKGMCommitter(object): """Committer object responsible for obtaining a new LKGM and committing it.""" # The list of trybots we require LKGM updates to run and pass on before # landing. Since they're internal trybots, the CQ won't automatically trigger # them, so we have to explicitly tell it to. ...
class ChromeLKGMCommitter(object):
"""Committer object responsible for obtaining a new LKGM and committing it.""" # The list of trybots we require LKGM updates to run and pass on before # landing. Since they're internal trybots, the CQ won't automatically trigger # them, so we have to explicitly tell it to. _PRESUBMIT_BOTS = [ 'chromeos...
# -*- coding: utf-8 -*- # Copyright 2017 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Update the CHROMEOS_LKGM file in a chromium repository.""" from __future__ import print_function import distutils.version # ...
240
256
1,037
8
232
khromiumos/chromiumos-chromite
scripts/chrome_chromeos_lkgm.py
Python
ChromeLKGMCommitter
ChromeLKGMCommitter
34
136
34
34
b49242f42bba8843a09907730fa0445cd3619a20
bigcode/the-stack
train
b3a7a1dd91de77525663247e
train
class
class LKGMNotValid(chrome_committer.CommitError): """Raised if the LKGM version is unset or not newer than the current value."""
class LKGMNotValid(chrome_committer.CommitError):
"""Raised if the LKGM version is unset or not newer than the current value."""
constants from chromite.lib import cros_logging as logging from chromite.lib import gerrit from chromite.lib import osutils assert sys.version_info >= (3, 6), 'This module requires Python 3.6+' class LKGMNotValid(chrome_committer.CommitError):
64
64
30
12
51
khromiumos/chromiumos-chromite
scripts/chrome_chromeos_lkgm.py
Python
LKGMNotValid
LKGMNotValid
26
27
26
26
8374ecd1d4b29035132c88bf61c4b948309d4a9a
bigcode/the-stack
train
3206b9905bd710db9561cf49
train
class
@DATASETS.register_module() class Custom3DDataset(Dataset): """Customized 3D dataset. This is the base dataset of SUNRGB-D, ScanNet, nuScenes, and KITTI dataset. Args: data_root (str): Path of dataset root. ann_file (str): Path of annotation file. pipeline (list[dict], optional...
@DATASETS.register_module() class Custom3DDataset(Dataset):
"""Customized 3D dataset. This is the base dataset of SUNRGB-D, ScanNet, nuScenes, and KITTI dataset. Args: data_root (str): Path of dataset root. ann_file (str): Path of annotation file. pipeline (list[dict], optional): Pipeline used for data processing. Defaults t...
import mmcv import numpy as np import tempfile from os import path as osp from torch.utils.data import Dataset from mmdet.datasets import DATASETS from ..core.bbox import get_box_type from .pipelines import Compose @DATASETS.register_module() class Custom3DDataset(Dataset):
66
256
2,224
14
51
SimonDoll/mmdetection3d
mmdet3d/datasets/custom_3d.py
Python
Custom3DDataset
Custom3DDataset
12
311
12
13
fff7e89f4b329804d5e510602450412b335b9c81
bigcode/the-stack
train
1b4abd242bd103aaf7efa66e
train
class
class GAN(object): def __init__(self, loss, discriminator, generator): """ Provides GAN model. :param loss: loss functions (scores real, scores pseudo), must return two expressions loss for discriminator training and generator loss, both for **minimization** . :param discriminator: a `craynn.Exp...
class GAN(object):
def __init__(self, loss, discriminator, generator): """ Provides GAN model. :param loss: loss functions (scores real, scores pseudo), must return two expressions loss for discriminator training and generator loss, both for **minimization** . :param discriminator: a `craynn.Expression` should ret...
import theano.tensor as T from functools import reduce from ...objectives import energy_based __all__ = [ 'GAN', 'CycleGAN', 'StageGAN' ] class GAN(object):
44
111
372
4
40
maxim-borisyak/craynn
craynn/networks/gans/gan.py
Python
GAN
GAN
13
57
13
13
81475131e4c2ad653c8f1df993a4427a84f2754b
bigcode/the-stack
train