prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_identifier
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_creation_from_unsaved_shipment
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_creation_without_supplier_and_shipment
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_creation_with_invalid_unsaved_shipment
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_partially_shipped_order_status
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def <|fim_middle|>(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_delete
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def <|fim_middle|>(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
test_shipment_with_insufficient_stock
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def <|fim_middle|>(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def _get_product_data(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
_get_order
<|file_name|>test_shipments.py<|end_file_name|><|fim▁begin|># This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import decimal import pytest from django.conf import settings from shuup.core.models import Shipment, ShippingStatus, StockBehavior from shuup.testing.factories import ( add_product_to_order, create_empty_order, create_product, get_default_shop, get_default_supplier ) from shuup.utils.excs import Problem @pytest.mark.django_db def test_shipment_identifier(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): shipment = order.create_shipment({line.product: 1}, supplier=supplier) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) assert order.shipping_status == ShippingStatus.FULLY_SHIPPED # Check that order is now fully shipped assert not order.can_edit() @pytest.mark.django_db def test_shipment_creation_from_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): unsaved_shipment = Shipment(order=order, supplier=supplier) shipment = order.create_shipment({line.product: 1}, shipment=unsaved_shipment) expected_key_start = "%s/%s" % (order.pk, i) assert shipment.identifier.startswith(expected_key_start) assert order.shipments.count() == int(line.quantity) @pytest.mark.django_db def test_shipment_creation_without_supplier_and_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): order.create_shipment({line.product: 1}) assert order.shipments.count() == 0 @pytest.mark.django_db def test_shipment_creation_with_invalid_unsaved_shipment(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) second_order = create_empty_order(shop=shop) second_order.full_clean() second_order.save() product_lines = order.lines.exclude(product_id=None) for line in product_lines: for i in range(0, int(line.quantity)): with pytest.raises(AssertionError): unsaved_shipment = Shipment(supplier=supplier, order=second_order) order.create_shipment({line.product: 1}, shipment=unsaved_shipment) assert order.shipments.count() == 0 @pytest.mark.django_db def test_partially_shipped_order_status(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert not order.can_edit() @pytest.mark.django_db def test_shipment_delete(): shop = get_default_shop() supplier = get_default_supplier() order = _get_order(shop, supplier) assert order.can_edit() first_product_line = order.lines.exclude(product_id=None).first() assert first_product_line.quantity > 1 shipment = order.create_shipment({first_product_line.product: 1}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 # Test shipment delete shipment.soft_delete() assert order.shipments.all().count() == 1 assert order.shipments.all_except_deleted().count() == 0 # Check the shipping status update assert order.shipping_status == ShippingStatus.NOT_SHIPPED @pytest.mark.django_db def test_shipment_with_insufficient_stock(): if "shuup.simple_supplier" not in settings.INSTALLED_APPS: pytest.skip("Need shuup.simple_supplier in INSTALLED_APPS") from shuup_tests.simple_supplier.utils import get_simple_supplier shop = get_default_shop() supplier = get_simple_supplier() order = _get_order(shop, supplier, stocked=True) product_line = order.lines.products().first() product = product_line.product assert product_line.quantity == 15 supplier.adjust_stock(product.pk, delta=10) stock_status = supplier.get_stock_status(product.pk) assert stock_status.physical_count == 10 order.create_shipment({product: 5}, supplier=supplier) assert order.shipping_status == ShippingStatus.PARTIALLY_SHIPPED assert order.shipments.all().count() == 1 with pytest.raises(Problem): order.create_shipment({product: 10}, supplier=supplier) # Should be fine after adding more stock supplier.adjust_stock(product.pk, delta=5) order.create_shipment({product: 10}, supplier=supplier) def _get_order(shop, supplier, stocked=False): order = create_empty_order(shop=shop) order.full_clean() order.save() for product_data in _get_product_data(stocked): quantity = product_data.pop("quantity") product = create_product( sku=product_data.pop("sku"), shop=shop, supplier=supplier, default_price=3.33, **product_data) add_product_to_order(order, supplier, product, quantity=quantity, taxless_base_unit_price=1) order.cache_prices() order.check_all_verified() order.save() return order def <|fim_middle|>(stocked=False): return [ { "sku": "sku1234", "net_weight": decimal.Decimal("1"), "gross_weight": decimal.Decimal("43.34257"), "quantity": decimal.Decimal("15"), "stock_behavior": StockBehavior.STOCKED if stocked else StockBehavior.UNSTOCKED } ] <|fim▁end|>
_get_product_data
<|file_name|>delete_specialist_pool_sample.py<|end_file_name|><|fim▁begin|># Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.<|fim▁hole|> name = name return name<|fim▁end|>
# def make_name(name: str) -> str: # Sample function parameter name in delete_specialist_pool_sample
<|file_name|>delete_specialist_pool_sample.py<|end_file_name|><|fim▁begin|># Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # def make_name(name: str) -> str: # Sample function parameter name in delete_specialist_pool_sample <|fim_middle|> <|fim▁end|>
name = name return name
<|file_name|>delete_specialist_pool_sample.py<|end_file_name|><|fim▁begin|># Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # def <|fim_middle|>(name: str) -> str: # Sample function parameter name in delete_specialist_pool_sample name = name return name <|fim▁end|>
make_name
<|file_name|>stata.py<|end_file_name|><|fim▁begin|>import pandas as pd from larray.core.array import Array from larray.inout.pandas import from_frame __all__ = ['read_stata'] def read_stata(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array: r""" Reads Stata .dta file and returns an Array with the contents Parameters ---------- filepath_or_buffer : str or file-like object Path to .dta file or a file handle. index_col : str or None, optional Name of column to set as index. Defaults to None. sort_rows : bool, optional<|fim▁hole|> sort_columns : bool, optional Whether or not to sort the columns alphabetically (sorting is more efficient than not sorting). Defaults to False. Returns ------- Array See Also -------- Array.to_stata Notes ----- The round trip to Stata (Array.to_stata followed by read_stata) loose the name of the "column" axis. Examples -------- >>> read_stata('test.dta') # doctest: +SKIP {0}\{1} row country sex 0 0 BE F 1 1 FR M 2 2 FR F >>> read_stata('test.dta', index_col='row') # doctest: +SKIP row\{1} country sex 0 BE F 1 FR M 2 FR F """ df = pd.read_stata(filepath_or_buffer, index_col=index_col, **kwargs) return from_frame(df, sort_rows=sort_rows, sort_columns=sort_columns)<|fim▁end|>
Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting). This only makes sense in combination with index_col. Defaults to False.
<|file_name|>stata.py<|end_file_name|><|fim▁begin|>import pandas as pd from larray.core.array import Array from larray.inout.pandas import from_frame __all__ = ['read_stata'] def read_stata(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array: <|fim_middle|> <|fim▁end|>
r""" Reads Stata .dta file and returns an Array with the contents Parameters ---------- filepath_or_buffer : str or file-like object Path to .dta file or a file handle. index_col : str or None, optional Name of column to set as index. Defaults to None. sort_rows : bool, optional Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting). This only makes sense in combination with index_col. Defaults to False. sort_columns : bool, optional Whether or not to sort the columns alphabetically (sorting is more efficient than not sorting). Defaults to False. Returns ------- Array See Also -------- Array.to_stata Notes ----- The round trip to Stata (Array.to_stata followed by read_stata) loose the name of the "column" axis. Examples -------- >>> read_stata('test.dta') # doctest: +SKIP {0}\{1} row country sex 0 0 BE F 1 1 FR M 2 2 FR F >>> read_stata('test.dta', index_col='row') # doctest: +SKIP row\{1} country sex 0 BE F 1 FR M 2 FR F """ df = pd.read_stata(filepath_or_buffer, index_col=index_col, **kwargs) return from_frame(df, sort_rows=sort_rows, sort_columns=sort_columns)
<|file_name|>stata.py<|end_file_name|><|fim▁begin|>import pandas as pd from larray.core.array import Array from larray.inout.pandas import from_frame __all__ = ['read_stata'] def <|fim_middle|>(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array: r""" Reads Stata .dta file and returns an Array with the contents Parameters ---------- filepath_or_buffer : str or file-like object Path to .dta file or a file handle. index_col : str or None, optional Name of column to set as index. Defaults to None. sort_rows : bool, optional Whether or not to sort the rows alphabetically (sorting is more efficient than not sorting). This only makes sense in combination with index_col. Defaults to False. sort_columns : bool, optional Whether or not to sort the columns alphabetically (sorting is more efficient than not sorting). Defaults to False. Returns ------- Array See Also -------- Array.to_stata Notes ----- The round trip to Stata (Array.to_stata followed by read_stata) loose the name of the "column" axis. Examples -------- >>> read_stata('test.dta') # doctest: +SKIP {0}\{1} row country sex 0 0 BE F 1 1 FR M 2 2 FR F >>> read_stata('test.dta', index_col='row') # doctest: +SKIP row\{1} country sex 0 BE F 1 FR M 2 FR F """ df = pd.read_stata(filepath_or_buffer, index_col=index_col, **kwargs) return from_frame(df, sort_rows=sort_rows, sort_columns=sort_columns) <|fim▁end|>
read_stata
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} <|fim▁hole|> mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test()<|fim▁end|>
for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList:
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: <|fim_middle|> def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): <|fim_middle|> def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
self.IN = actions self.OUT = responses
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): <|fim_middle|> def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): <|fim_middle|> def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
self.IN = ins self.OUT = outs
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): <|fim_middle|> #test() <|fim▁end|>
stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0)
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: <|fim_middle|> else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT)
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: <|fim_middle|> elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
mList[response] = 1
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: <|fim_middle|> print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
mList[response] += 1
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: <|fim_middle|> print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
keys.append(k) vals.append(v)
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: <|fim_middle|> return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
resp = random.choice(self.OUT)
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def <|fim_middle|>(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
__init__
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def <|fim_middle|>(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
get_act
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def <|fim_middle|>(ins, outs): self.IN = ins self.OUT = outs def test(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
update
<|file_name|>Stixai.py<|end_file_name|><|fim▁begin|>import random class ai: def __init__(self, actions, responses): self.IN = actions self.OUT = responses def get_act(self, action, valres): if action in self.IN: mList = {} for response in self.OUT: if self.IN[self.OUT.index(response)] == action and not response in mList: mList[response] = 1 elif response in mList: mList[response] += 1 print mList keys = [] vals = [] for v in sorted(mList.values(), reverse = True): for k in mList.keys(): if mList[k] == v: keys.append(k) vals.append(v) print keys print vals try: resp = keys[valres] except: resp = random.choice(self.OUT) else: resp = random.choice(self.OUT) return resp def update(ins, outs): self.IN = ins self.OUT = outs def <|fim_middle|>(): stix = ai(['attack', 'retreat', 'eat', 'attack', 'attack'], ['run', 'cheer', 'share lunch', 'fall', 'run']) print stix.get_act('attack', 0) #test() <|fim▁end|>
test
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|><|fim▁hole|> def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported")<|fim▁end|>
from keras.applications import imagenet_utils from keras.applications import mobilenet
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): <|fim_middle|> def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported") <|fim▁end|>
image -= 127.5 return image
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): <|fim_middle|> <|fim▁end|>
if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported")
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": <|fim_middle|> elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported") <|fim▁end|>
return dummyPreprocessInput
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": <|fim_middle|> elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported") <|fim▁end|>
return mobilenet.preprocess_input
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": <|fim_middle|> else: raise Exception(preprocessType + " not supported") <|fim▁end|>
return imagenet_utils.preprocess_input
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: <|fim_middle|> <|fim▁end|>
raise Exception(preprocessType + " not supported")
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def <|fim_middle|>(image): image -= 127.5 return image def getPreprocessFunction(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported") <|fim▁end|>
dummyPreprocessInput
<|file_name|>preprocess.py<|end_file_name|><|fim▁begin|>from keras.applications import imagenet_utils from keras.applications import mobilenet def dummyPreprocessInput(image): image -= 127.5 return image def <|fim_middle|>(preprocessType): if preprocessType == "dummy": return dummyPreprocessInput elif preprocessType == "mobilenet": return mobilenet.preprocess_input elif preprocessType == "imagenet": return imagenet_utils.preprocess_input else: raise Exception(preprocessType + " not supported") <|fim▁end|>
getPreprocessFunction
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。<|fim▁hole|> 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear()<|fim▁end|>
我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): <|fim_middle|> class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
def __init__(self, text): self.text = text self.clicked = Signal()
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): <|fim_middle|> class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
self.text = text self.clicked = Signal()
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: <|fim_middle|> <|fim▁end|>
""" .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear()
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return<|fim_middle|> self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
MyMusicItem(text) def add_item(self, item): self.model.add(item)
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): <|fim_middle|> self.model.clear() <|fim▁end|>
self._items.clear()
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim_middle|> <|fim▁end|>
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim_middle|> <|fim▁end|>
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def <|fim_middle|>(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
__init__
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_it<|fim_middle|>text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
em(cls,
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(<|fim_middle|>def clear(self): self._items.clear() self.model.clear() <|fim▁end|>
item)
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() se<|fim_middle|>.clear() <|fim▁end|>
lf.model
<|file_name|>my_music.py<|end_file_name|><|fim▁begin|>from feeluown.utils.dispatch import Signal from feeluown.gui.widgets.my_music import MyMusicModel class MyMusicItem(object): def __init__(self, text): self.text = text self.clicked = Signal() class MyMusicUiManager: """ .. note:: 目前,我们用数组的数据结构来保存 items,只提供 add_item 和 clear 方法。 我们希望,MyMusic 中的 items 应该和 provider 保持关联。provider 是 MyMusic 的上下文。 而 Provider 是比较上层的对象,我们会提供 get_item 这种比较精细的控制方法。 """ def __init__(self, app): self._app = app self._items = [] self.model = MyMusicModel(app) @classmethod def create_item(cls, text): return MyMusicItem(text) def add_item(self, item): self.model.add(item) self._items.append(item) def clear(self): self._items.clear() self.model.clear() <|fim_middle|><|fim▁end|>
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions']<|fim▁hole|> else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record)<|fim▁end|>
# self.insert_in_db(questions)
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): <|fim_middle|> <|fim▁end|>
def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record)
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): <|fim_middle|> def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
self.connection = None
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): <|fim_middle|> def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): <|fim_middle|> <|fim▁end|>
with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record)
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": <|fim_middle|> else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
questions = items['questions'] # self.insert_in_db(questions)
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: <|fim_middle|> return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
raise ValueError("Invalid collection:", spider.name)
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def <|fim_middle|>(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
__init__
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def <|fim_middle|>(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def insert_in_db(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
process_item
<|file_name|>pipelines.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html from scrapy.conf import settings import pymongo from datetime import datetime from .models import PQDataModel class ParliamentSearchPipeline(object): def __init__(self): self.connection = None def process_item(self, items, spider): if spider.name == "ls_questions": questions = items['questions'] # self.insert_in_db(questions) else: raise ValueError("Invalid collection:", spider.name) return items def <|fim_middle|>(self, questions): with PQDataModel.batch_write() as batch: records = [] for q in questions: record = PQDataModel() record.question_number = q['question_number'] record.question_origin = q['question_origin'] record.question_type = q['question_type'] record.question_session = q['question_session'] record.question_ministry = q['question_ministry'] record.question_member = q['question_member'] record.question_subject = q['question_subject'] record.question_type = q['question_type'] record.question_annex = q['question_annex'] record.question_url = q['question_url'] record.question_text = q['question_text'] record.question_url = q['question_url'] record.question_date = datetime.strptime(q['question_date'], '%d.%m.%Y') records.append(record) for record in records: batch.save(record) <|fim▁end|>
insert_in_db
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|># This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) <|fim▁hole|> def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None)<|fim▁end|>
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): <|fim_middle|> <|fim▁end|>
def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): <|fim_middle|> def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): <|fim_middle|> def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.status, [])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): <|fim_middle|> def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.available, True)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): <|fim_middle|> def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.domain, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): <|fim_middle|> def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, [])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): <|fim_middle|> def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, [])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): <|fim_middle|> def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.registered, False)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): <|fim_middle|> def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.created_on, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): <|fim_middle|> def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.registrar, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): <|fim_middle|> def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, [])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): <|fim_middle|> def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, [])
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): <|fim_middle|> def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.updated_on, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): <|fim_middle|> def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.domain_id, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): <|fim_middle|> def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
eq_(self.record.expires_on, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): <|fim_middle|> <|fim▁end|>
eq_(self.record.disclaimer, None)
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def <|fim_middle|>(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
setUp
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def <|fim_middle|>(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_status
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def <|fim_middle|>(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_available
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def <|fim_middle|>(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_domain
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def <|fim_middle|>(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_nameservers
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def <|fim_middle|>(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_admin_contacts
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def <|fim_middle|>(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_registered
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def <|fim_middle|>(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_created_on
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def <|fim_middle|>(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_registrar
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def <|fim_middle|>(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_registrant_contacts
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def <|fim_middle|>(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_technical_contacts
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def <|fim_middle|>(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_updated_on
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def <|fim_middle|>(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_domain_id
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def <|fim_middle|>(self): eq_(self.record.expires_on, None) def test_disclaimer(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_expires_on
<|file_name|>test_response_whois_nic_pw_status_available.py<|end_file_name|><|fim▁begin|> # This file is autogenerated. Do not edit it manually. # If you want change the content of this file, edit # # spec/fixtures/responses/whois.nic.pw/status_available # # and regenerate the tests with the following script # # $ scripts/generate_tests.py # from nose.tools import * from dateutil.parser import parse as time_parse import yawhois class TestWhoisNicPwStatusAvailable(object): def setUp(self): fixture_path = "spec/fixtures/responses/whois.nic.pw/status_available.txt" host = "whois.nic.pw" part = yawhois.record.Part(open(fixture_path, "r").read(), host) self.record = yawhois.record.Record(None, [part]) def test_status(self): eq_(self.record.status, []) def test_available(self): eq_(self.record.available, True) def test_domain(self): eq_(self.record.domain, None) def test_nameservers(self): eq_(self.record.nameservers.__class__.__name__, 'list') eq_(self.record.nameservers, []) def test_admin_contacts(self): eq_(self.record.admin_contacts.__class__.__name__, 'list') eq_(self.record.admin_contacts, []) def test_registered(self): eq_(self.record.registered, False) def test_created_on(self): eq_(self.record.created_on, None) def test_registrar(self): eq_(self.record.registrar, None) def test_registrant_contacts(self): eq_(self.record.registrant_contacts.__class__.__name__, 'list') eq_(self.record.registrant_contacts, []) def test_technical_contacts(self): eq_(self.record.technical_contacts.__class__.__name__, 'list') eq_(self.record.technical_contacts, []) def test_updated_on(self): eq_(self.record.updated_on, None) def test_domain_id(self): eq_(self.record.domain_id, None) def test_expires_on(self): eq_(self.record.expires_on, None) def <|fim_middle|>(self): eq_(self.record.disclaimer, None) <|fim▁end|>
test_disclaimer
<|file_name|>message.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Cloud Robotics FX 会話理解API用メッセージ # # @author: Osamu Noguchi <[email protected]> # @version: 0.0.1 import cloudrobotics.message as message APP_ID = 'SbrApiServices' PROCESSING_ID = 'RbAppConversationApi' # 会話メッセージ # class ConversationMessage(message.CRFXMessage): def __init__(self, visitor, visitor_id, talkByMe, type): super(ConversationMessage, self).__init__() self.header['RoutingType'] = message.ROUTING_TYPE_CALL self.header['AppProcessingId'] = PROCESSING_ID self.header['MessageId'] = type self.body = {<|fim▁hole|> 'visitor_id': visitor_id, 'talkByMe': talkByMe }<|fim▁end|>
'visitor': visitor,
<|file_name|>message.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Cloud Robotics FX 会話理解API用メッセージ # # @author: Osamu Noguchi <[email protected]> # @version: 0.0.1 import cloudrobotics.message as message APP_ID = 'SbrApiServices' PROCESSING_ID = 'RbAppConversationApi' # 会話メッセージ # class ConversationMessage(message.CRFXMessage): def __init__(self, visitor, visito<|fim_middle|> <|fim▁end|>
r_id, talkByMe, type): super(ConversationMessage, self).__init__() self.header['RoutingType'] = message.ROUTING_TYPE_CALL self.header['AppProcessingId'] = PROCESSING_ID self.header['MessageId'] = type self.body = { 'visitor': visitor, 'visitor_id': visitor_id, 'talkByMe': talkByMe }
<|file_name|>message.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Cloud Robotics FX 会話理解API用メッセージ # # @author: Osamu Noguchi <[email protected]> # @version: 0.0.1 import cloudrobotics.message as message APP_ID = 'SbrApiServices' PROCESSING_ID = 'RbAppConversationApi' # 会話メッセージ # class ConversationMessage(message.CRFXMessage): def __init__(self, visitor, visitor_id, talkByMe, type): super(ConversationMessage, self)._<|fim_middle|> <|fim▁end|>
_init__() self.header['RoutingType'] = message.ROUTING_TYPE_CALL self.header['AppProcessingId'] = PROCESSING_ID self.header['MessageId'] = type self.body = { 'visitor': visitor, 'visitor_id': visitor_id, 'talkByMe': talkByMe }
<|file_name|>message.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Cloud Robotics FX 会話理解API用メッセージ # # @author: Osamu Noguchi <[email protected]> # @version: 0.0.1 import cloudrobotics.message as message APP_ID = 'SbrApiServices' PROCESSING_ID = 'RbAppConversationApi' # 会話メッセージ # class ConversationMessage(message.CRFXMessage): def __init__(self, visitor, visitor_id<|fim_middle|>Me, type): super(ConversationMessage, self).__init__() self.header['RoutingType'] = message.ROUTING_TYPE_CALL self.header['AppProcessingId'] = PROCESSING_ID self.header['MessageId'] = type self.body = { 'visitor': visitor, 'visitor_id': visitor_id, 'talkByMe': talkByMe } <|fim▁end|>
, talkBy
<|file_name|>region_BG.py<|end_file_name|><|fim▁begin|>"""Auto-generated file, do not edit by hand. BG metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_BG = PhoneMetadata(id='BG', country_code=359, international_prefix='00', general_desc=PhoneNumberDesc(national_number_pattern='[23567]\\d{5,7}|[489]\\d{6,8}', possible_number_pattern='\\d{5,9}'), fixed_line=PhoneNumberDesc(national_number_pattern='2(?:[0-8]\\d{5,6}|9\\d{4,6})|(?:[36]\\d|5[1-9]|8[1-6]|9[1-7])\\d{5,6}|(?:4(?:[124-7]\\d|3[1-6])|7(?:0[1-9]|[1-9]\\d))\\d{4,5}', possible_number_pattern='\\d{5,8}', example_number='2123456'), mobile=PhoneNumberDesc(national_number_pattern='(?:8[7-9]|98)\\d{7}|4(?:3[0789]|8\\d)\\d{5}', possible_number_pattern='\\d{8,9}', example_number='48123456'), toll_free=PhoneNumberDesc(national_number_pattern='800\\d{5}', possible_number_pattern='\\d{8}', example_number='80012345'), premium_rate=PhoneNumberDesc(national_number_pattern='90\\d{6}', possible_number_pattern='\\d{8}', example_number='90123456'), shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), personal_number=PhoneNumberDesc(national_number_pattern='700\\d{5}', possible_number_pattern='\\d{5,9}', example_number='70012345'), voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), emergency=PhoneNumberDesc(national_number_pattern='1(?:12|50|6[06])', possible_number_pattern='\\d{3}', example_number='112'), voicemail=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), short_code=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),<|fim▁hole|> number_format=[NumberFormat(pattern='(2)(\\d{5})', format='\\1 \\2', leading_digits_pattern=['29'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(2)(\\d{3})(\\d{3,4})', format='\\1 \\2 \\3', leading_digits_pattern=['2'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{3})(\\d{4})', format='\\1 \\2', leading_digits_pattern=['43[124-7]|70[1-9]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{3})(\\d{3})(\\d{2})', format='\\1 \\2 \\3', leading_digits_pattern=['43[124-7]|70[1-9]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{3})(\\d{2})(\\d{3})', format='\\1 \\2 \\3', leading_digits_pattern=['[78]00'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{2})(\\d{3})(\\d{2,3})', format='\\1 \\2 \\3', leading_digits_pattern=['[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]'], national_prefix_formatting_rule='0\\1'), NumberFormat(pattern='(\\d{2})(\\d{3})(\\d{3,4})', format='\\1 \\2 \\3', leading_digits_pattern=['48|8[7-9]|9[08]'], national_prefix_formatting_rule='0\\1')])<|fim▁end|>
standard_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'), national_prefix='0', national_prefix_for_parsing='0',
<|file_name|>utils.py<|end_file_name|><|fim▁begin|># -*- encoding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pyparsing as pp uninary_operators = ("not", ) binary_operator = (u">=", u"<=", u"!=", u">", u"<", u"=", u"==", u"eq", u"ne", u"lt", u"gt", u"ge", u"le", u"in", u"like", u"≠", u"≥", u"≤", u"like" "in") multiple_operators = (u"and", u"or", u"∧", u"∨") operator = pp.Regex(u"|".join(binary_operator)) null = pp.Regex("None|none|null").setParseAction(pp.replaceWith(None)) boolean = "False|True|false|true" boolean = pp.Regex(boolean).setParseAction(lambda t: t[0].lower() == "true") hex_string = lambda n: pp.Word(pp.hexnums, exact=n) uuid = pp.Combine(hex_string(8) + ("-" + hex_string(4)) * 3 + "-" + hex_string(12)) number = r"[+-]?\d+(:?\.\d*)?(:?[eE][+-]?\d+)?" number = pp.Regex(number).setParseAction(lambda t: float(t[0])) identifier = pp.Word(pp.alphas, pp.alphanums + "_") quoted_string = pp.QuotedString('"') | pp.QuotedString("'") comparison_term = pp.Forward() in_list = pp.Group(pp.Suppress('[') + pp.Optional(pp.delimitedList(comparison_term)) + pp.Suppress(']'))("list") comparison_term << (null | boolean | uuid | identifier | number | quoted_string | in_list) condition = pp.Group(comparison_term + operator + comparison_term) expr = pp.operatorPrecedence(condition, [ ("not", 1, pp.opAssoc.RIGHT, ), ("and", 2, pp.opAssoc.LEFT, ), ("∧", 2, pp.opAssoc.LEFT, ), ("or", 2, pp.opAssoc.LEFT, ), ("∨", 2, pp.opAssoc.LEFT, ), ]) def _parsed_query2dict(parsed_query): result = None while parsed_query: part = parsed_query.pop() if part in binary_operator: result = {part: {parsed_query.pop(): result}}<|fim▁hole|> if result.get(part): result[part].append( _parsed_query2dict(parsed_query.pop())) else: result = {part: [result]} elif part in uninary_operators: result = {part: result} elif isinstance(part, pp.ParseResults): kind = part.getName() if kind == "list": res = part.asList() else: res = _parsed_query2dict(part) if result is None: result = res elif isinstance(result, dict): list(result.values())[0].append(res) else: result = part return result def search_query_builder(query): parsed_query = expr.parseString(query)[0] return _parsed_query2dict(parsed_query) def list2cols(cols, objs): return cols, [tuple([o[k] for k in cols]) for o in objs] def format_string_list(objs, field): objs[field] = ", ".join(objs[field]) def format_dict_list(objs, field): objs[field] = "\n".join( "- " + ", ".join("%s: %s" % (k, v) for k, v in elem.items()) for elem in objs[field]) def format_move_dict_to_root(obj, field): for attr in obj[field]: obj["%s/%s" % (field, attr)] = obj[field][attr] del obj[field] def format_archive_policy(ap): format_dict_list(ap, "definition") format_string_list(ap, "aggregation_methods") def dict_from_parsed_args(parsed_args, attrs): d = {} for attr in attrs: value = getattr(parsed_args, attr) if value is not None: d[attr] = value return d def dict_to_querystring(objs): return "&".join(["%s=%s" % (k, v) for k, v in objs.items() if v is not None])<|fim▁end|>
elif part in multiple_operators: