prompt
large_stringlengths 72
9.34k
| completion
large_stringlengths 0
7.61k
|
---|---|
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
<|fim_middle|>
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
<|fim_middle|>
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all() |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
<|fim_middle|>
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404])) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
<|fim_middle|>
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Application with ES and DB."""
yield base_app |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
<|fim_middle|>
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
<|fim_middle|>
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | """Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit() |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
<|fim_middle|>
<|fim▁end|> | """Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
<|fim_middle|>
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | create_database(str(_db.engine.url)) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
<|fim_middle|>
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True) |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
<|fim_middle|>
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | request.param = "Firefox" |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def <|fim_middle|>(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | base_app |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def <|fim_middle|>(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | db |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def <|fim_middle|>(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | es |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def <|fim_middle|>(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | app |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def <|fim_middle|>(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | pytest_generate_tests |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def <|fim_middle|>(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def demo_records(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | env_browser |
<|file_name|>conftest.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
# This file is part of CERN Document Server.
# Copyright (C) 2016, 2019 CERN.
#
# CERN Document Server is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# CERN Document Server is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CERN Document Server; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307, USA.
#
# In applying this license, CERN does not
# waive the privileges and immunities granted to it by virtue of its status
# as an Intergovernmental Organization or submit itself to any jurisdiction.
"""Pytest configuration.
Before running any of the tests you must have initialized the assets using
the ``script scripts/setup-assets.sh``.
"""
from __future__ import absolute_import, print_function
import os
import shutil
import tempfile
import uuid
import pkg_resources
import pytest
from cds_dojson.marc21 import marc21
from dojson.contrib.marc21.utils import create_record, split_blob
from elasticsearch.exceptions import RequestError
from invenio_db import db as _db
from invenio_indexer.api import RecordIndexer
from invenio_pidstore import current_pidstore
from invenio_records.api import Record
from invenio_search import current_search, current_search_client
from selenium import webdriver
from sqlalchemy_utils.functions import create_database, database_exists
from cds.factory import create_app
@pytest.yield_fixture(scope='session', autouse=True)
def base_app(request):
"""Flask application fixture."""
instance_path = tempfile.mkdtemp()
os.environ.update(
APP_INSTANCE_PATH=instance_path
)
app = create_app(
# CELERY_ALWAYS_EAGER=True,
# CELERY_CACHE_BACKEND="memory",
# CELERY_EAGER_PROPAGATES_EXCEPTIONS=True,
# CELERY_RESULT_BACKEND="cache",
SECRET_KEY="CHANGE_ME",
SECURITY_PASSWORD_SALT="CHANGE_ME",
MAIL_SUPPRESS_SEND=True,
TESTING=True,
)
with app.app_context():
yield app
# Teardown
shutil.rmtree(instance_path)
@pytest.yield_fixture(scope='session')
def db(base_app):
"""Initialize database."""
# Init
if not database_exists(str(_db.engine.url)):
create_database(str(_db.engine.url))
_db.create_all()
yield _db
# Teardown
_db.session.remove()
_db.drop_all()
@pytest.yield_fixture(scope='session')
def es(base_app):
"""Provide elasticsearch access."""
try:
list(current_search.create())
except RequestError:
list(current_search.delete())
list(current_search.create())
current_search_client.indices.refresh()
yield current_search_client
list(current_search.delete(ignore=[404]))
@pytest.yield_fixture(scope='session', autouse=True)
def app(base_app, es, db):
"""Application with ES and DB."""
yield base_app
def pytest_generate_tests(metafunc):
"""Override pytest's default test collection function.
For each test in this directory which uses the `env_browser` fixture,
the given test is called once for each value found in the
`E2E_WEBDRIVER_BROWSERS` environment variable.
"""
if 'env_browser' in metafunc.fixturenames:
# In Python 2.7 the fallback kwarg of os.environ.get is `failobj`,
# in 3.x it's `default`.
browsers = os.environ.get('E2E_WEBDRIVER_BROWSERS',
'Firefox').split()
metafunc.parametrize('env_browser', browsers, indirect=True)
@pytest.yield_fixture()
def env_browser(request):
"""Fixture for a webdriver instance of the browser."""
if request.param is None:
request.param = "Firefox"
# Create instance of webdriver.`request.param`()
browser = getattr(webdriver, request.param)()
yield browser
# Quit the webdriver instance
browser.quit()
@pytest.fixture()
def <|fim_middle|>(app):
"""Create demo records."""
data_path = pkg_resources.resource_filename(
'cds.modules.fixtures', 'data/records.xml'
)
with open(data_path) as source:
indexer = RecordIndexer()
with _db.session.begin_nested():
for index, data in enumerate(split_blob(source.read()), start=1):
# create uuid
rec_uuid = uuid.uuid4()
# do translate
record = marc21.do(create_record(data))
# create PID
current_pidstore.minters['recid'](
rec_uuid, record
)
# create record
indexer.index(Record.create(record, id_=rec_uuid))
_db.session.commit()
return data_path
<|fim▁end|> | demo_records |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
import os
# The version of the wrapped library is the starting point for the
# version number of the python package.
# In bugfix releases of the python package, add a '-' suffix and an
# incrementing integer.
# For example, a packaging bugfix release version 1.4.4 of the
# js.jquery package would be version 1.4.4-1 .
version = '0.9.7rt'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = (
read('README.txt')
+ '\n' +
read('js', 'chosen', 'test_chosen.txt')
+ '\n' +
read('CHANGES.txt'))
setup(
name='js.chosen',
version=version,
description="Fanstatic packaging of Chosen",
long_description=long_description,
classifiers=[],
keywords='',
author='Fanstatic Developers',
author_email='[email protected]',
license='BSD',
packages=find_packages(),namespace_packages=['js'],
include_package_data=True,
zip_safe=False,
install_requires=[
'fanstatic',
'js.jquery',
'setuptools',<|fim▁hole|> 'chosen = js.chosen:library',
],
},
)<|fim▁end|> | ],
entry_points={
'fanstatic.libraries': [ |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
import os
# The version of the wrapped library is the starting point for the
# version number of the python package.
# In bugfix releases of the python package, add a '-' suffix and an
# incrementing integer.
# For example, a packaging bugfix release version 1.4.4 of the
# js.jquery package would be version 1.4.4-1 .
version = '0.9.7rt'
def read(*rnames):
<|fim_middle|>
long_description = (
read('README.txt')
+ '\n' +
read('js', 'chosen', 'test_chosen.txt')
+ '\n' +
read('CHANGES.txt'))
setup(
name='js.chosen',
version=version,
description="Fanstatic packaging of Chosen",
long_description=long_description,
classifiers=[],
keywords='',
author='Fanstatic Developers',
author_email='[email protected]',
license='BSD',
packages=find_packages(),namespace_packages=['js'],
include_package_data=True,
zip_safe=False,
install_requires=[
'fanstatic',
'js.jquery',
'setuptools',
],
entry_points={
'fanstatic.libraries': [
'chosen = js.chosen:library',
],
},
)
<|fim▁end|> | return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
import os
# The version of the wrapped library is the starting point for the
# version number of the python package.
# In bugfix releases of the python package, add a '-' suffix and an
# incrementing integer.
# For example, a packaging bugfix release version 1.4.4 of the
# js.jquery package would be version 1.4.4-1 .
version = '0.9.7rt'
def <|fim_middle|>(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = (
read('README.txt')
+ '\n' +
read('js', 'chosen', 'test_chosen.txt')
+ '\n' +
read('CHANGES.txt'))
setup(
name='js.chosen',
version=version,
description="Fanstatic packaging of Chosen",
long_description=long_description,
classifiers=[],
keywords='',
author='Fanstatic Developers',
author_email='[email protected]',
license='BSD',
packages=find_packages(),namespace_packages=['js'],
include_package_data=True,
zip_safe=False,
install_requires=[
'fanstatic',
'js.jquery',
'setuptools',
],
entry_points={
'fanstatic.libraries': [
'chosen = js.chosen:library',
],
},
)
<|fim▁end|> | read |
<|file_name|>PracticeQuestions.py<|end_file_name|><|fim▁begin|>"""Chapter 22 Practice Questions
Answers Chapter 22 Practice Questions via Python code.
"""
from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage
def main():<|fim▁hole|> message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh." # Encrypted with key "PRIMES"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 2. What are integers that are not prime called?
# Hint: Check page 323
message = "Vbmggpcw wlvx njr bhv pctqh emi psyzxf czxtrwdxr fhaugrd." # Encrypted with key "NOTCALLEDEVENS"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 3. What are two algorithms for finding prime numbers?
# Hint: Check page 323
# Encrypted with key "ALGORITHMS"
message = "Tsk hyzxl mdgzxwkpfz gkeo ob kpbz ngov gfv: bkpmd dtbwjqhu, eaegk cw Mkhfgsenseml, hzv Rlhwe-Ubsxwr."
#print(decryptMessage(blank, blank)) # Fill in the blanks
# If PracticeQuestions.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
main()<|fim▁end|> | # 1. How many prime numbers are there?
# Hint: Check page 322 |
<|file_name|>PracticeQuestions.py<|end_file_name|><|fim▁begin|>"""Chapter 22 Practice Questions
Answers Chapter 22 Practice Questions via Python code.
"""
from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage
def main():
# 1. How many prime numbers are there?
# Hint: Check page 322
<|fim_middle|>
# If PracticeQuestions.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
main()
<|fim▁end|> | message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh." # Encrypted with key "PRIMES"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 2. What are integers that are not prime called?
# Hint: Check page 323
message = "Vbmggpcw wlvx njr bhv pctqh emi psyzxf czxtrwdxr fhaugrd." # Encrypted with key "NOTCALLEDEVENS"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 3. What are two algorithms for finding prime numbers?
# Hint: Check page 323
# Encrypted with key "ALGORITHMS"
message = "Tsk hyzxl mdgzxwkpfz gkeo ob kpbz ngov gfv: bkpmd dtbwjqhu, eaegk cw Mkhfgsenseml, hzv Rlhwe-Ubsxwr."
#print(decryptMessage(blank, blank)) # Fill in the blanks |
<|file_name|>PracticeQuestions.py<|end_file_name|><|fim▁begin|>"""Chapter 22 Practice Questions
Answers Chapter 22 Practice Questions via Python code.
"""
from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage
def main():
# 1. How many prime numbers are there?
# Hint: Check page 322
message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh." # Encrypted with key "PRIMES"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 2. What are integers that are not prime called?
# Hint: Check page 323
message = "Vbmggpcw wlvx njr bhv pctqh emi psyzxf czxtrwdxr fhaugrd." # Encrypted with key "NOTCALLEDEVENS"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 3. What are two algorithms for finding prime numbers?
# Hint: Check page 323
# Encrypted with key "ALGORITHMS"
message = "Tsk hyzxl mdgzxwkpfz gkeo ob kpbz ngov gfv: bkpmd dtbwjqhu, eaegk cw Mkhfgsenseml, hzv Rlhwe-Ubsxwr."
#print(decryptMessage(blank, blank)) # Fill in the blanks
# If PracticeQuestions.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | main() |
<|file_name|>PracticeQuestions.py<|end_file_name|><|fim▁begin|>"""Chapter 22 Practice Questions
Answers Chapter 22 Practice Questions via Python code.
"""
from pythontutorials.books.CrackingCodes.Ch18.vigenereCipher import decryptMessage
def <|fim_middle|>():
# 1. How many prime numbers are there?
# Hint: Check page 322
message = "Iymdi ah rv urxxeqfi fjdjqv gu gzuqw clunijh." # Encrypted with key "PRIMES"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 2. What are integers that are not prime called?
# Hint: Check page 323
message = "Vbmggpcw wlvx njr bhv pctqh emi psyzxf czxtrwdxr fhaugrd." # Encrypted with key "NOTCALLEDEVENS"
#print(decryptMessage(blank, blank)) # Fill in the blanks
# 3. What are two algorithms for finding prime numbers?
# Hint: Check page 323
# Encrypted with key "ALGORITHMS"
message = "Tsk hyzxl mdgzxwkpfz gkeo ob kpbz ngov gfv: bkpmd dtbwjqhu, eaegk cw Mkhfgsenseml, hzv Rlhwe-Ubsxwr."
#print(decryptMessage(blank, blank)) # Fill in the blanks
# If PracticeQuestions.py is run (instead of imported as a module), call
# the main() function:
if __name__ == '__main__':
main()
<|fim▁end|> | main |
<|file_name|>_arrowcolor.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
):<|fim▁hole|> super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "arraydraw"),
role=kwargs.pop("role", "style"),
**kwargs
)<|fim▁end|> | |
<|file_name|>_arrowcolor.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
<|fim_middle|>
<|fim▁end|> | def __init__(
self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
):
super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "arraydraw"),
role=kwargs.pop("role", "style"),
**kwargs
) |
<|file_name|>_arrowcolor.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
):
<|fim_middle|>
<|fim▁end|> | super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "arraydraw"),
role=kwargs.pop("role", "style"),
**kwargs
) |
<|file_name|>_arrowcolor.py<|end_file_name|><|fim▁begin|>import _plotly_utils.basevalidators
class ArrowcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def <|fim_middle|>(
self, plotly_name="arrowcolor", parent_name="layout.annotation", **kwargs
):
super(ArrowcolorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "arraydraw"),
role=kwargs.pop("role", "style"),
**kwargs
)
<|fim▁end|> | __init__ |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):<|fim▁hole|> return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
<|fim_middle|>
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()}) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
<|fim_middle|>
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,}) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
<|fim_middle|>
<|fim▁end|> | categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form}) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
<|fim_middle|>
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category) |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def <|fim_middle|>(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | category_list |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def <|fim_middle|>(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def product_detail(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | product_list |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from django.shortcuts import render, render_to_response, get_object_or_404
from django.template import RequestContext
# Create your views here.
from django.views.generic import ListView, DetailView
from .models import Category, Product
from cart.forms import CartAddProductForm
def category_list(request):
return render(request, "shop/category_list.html",
{'nodes': Category.objects.all()})
'''
class CategoryList(ListView):
model = Category
template_name = "category_list.html"
'''
def product_list(request, category_slug=None):
category = None
categories = Category.objects.all()
products = Product.objects.filter(available=True)
if category_slug:
category = get_object_or_404(Category, slug=category_slug)
products = products.filter(category=category)
return render(request, "shop/product_list.html",
{'category': category,
'nodes': categories,
'products': products,})
'''
class ProductList(ListView):
model = DesignProduct
template_name = "shop/product_list.html"
'''
def <|fim_middle|>(request, id, slug):
categories = Category.objects.all()
product = get_object_or_404(Product,
id=id,
slug=slug,
available=True)
cart_product_form = CartAddProductForm()
return render(request,
'shop/product_detail.html',
{'product': product,
'nodes': categories,
'cart_product_form': cart_product_form})<|fim▁end|> | product_detail |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
<|fim▁hole|> def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()<|fim▁end|> | |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
<|fim_middle|>
crossepg_main = CrossEPG_Main()
<|fim▁end|> | def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
<|fim_middle|>
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
<|fim_middle|>
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
<|fim_middle|>
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if result is True:
self.session.open(CrossEPG_Setup) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
<|fim_middle|>
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
<|fim_middle|>
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
<|fim_middle|>
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.openWithCallback(self.importerCallback, CrossEPG_Importer) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
<|fim_middle|>
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
<|fim_middle|>
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.openWithCallback(self.converterCallback, CrossEPG_Converter) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
<|fim_middle|>
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
<|fim_middle|>
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
<|fim_middle|>
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
<|fim_middle|>
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
<|fim_middle|>
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
<|fim_middle|>
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
<|fim_middle|>
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
<|fim_middle|>
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.open(CrossEPG_Setup) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
<|fim_middle|>
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.importer() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if self.patchtype != 3:
self.converter()
else:
self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
<|fim_middle|>
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.converter() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
<|fim_middle|>
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if self.patchtype != 3:
self.converter()
else:
self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
<|fim_middle|>
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.converter() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
<|fim_middle|>
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
<|fim_middle|>
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.loader() |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | self.session.open(TryQuitMainloop, 3) |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
<|fim_middle|>
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
<|fim_middle|>
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | CrossEPG_Auto.instance.lock = False |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def <|fim_middle|>(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | __init__ |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def <|fim_middle|>(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | downloader |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def <|fim_middle|>(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | configureCallback |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def <|fim_middle|>(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | loaderAsPlugin |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def <|fim_middle|>(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | downloadCallback |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def <|fim_middle|>(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | importer |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def <|fim_middle|>(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | importerCallback |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def <|fim_middle|>(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | converter |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def <|fim_middle|>(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | converterCallback |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def <|fim_middle|>(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | loader |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def <|fim_middle|>(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | loaderCallback |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def <|fim_middle|>(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def setupCallback(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | setup |
<|file_name|>crossepg_main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import absolute_import
from enigma import *
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from . crossepglib import *
from . crossepg_downloader import CrossEPG_Downloader
from . crossepg_importer import CrossEPG_Importer
from . crossepg_converter import CrossEPG_Converter
from . crossepg_loader import CrossEPG_Loader
from . crossepg_setup import CrossEPG_Setup
from . crossepg_menu import CrossEPG_Menu
from . crossepg_auto import CrossEPG_Auto
class CrossEPG_Main:
def __init__(self):
self.config = CrossEPG_Config()
self.patchtype = getEPGPatchType()
def downloader(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.config.load()
if self.config.configured == 0:
self.session.openWithCallback(self.configureCallback, MessageBox, _("You need to configure crossepg before starting downloader.\nWould You like to do it now ?"), type=MessageBox.TYPE_YESNO)
else:
self.config.deleteLog()
self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
def configureCallback(self, result):
if result is True:
self.session.open(CrossEPG_Setup)
def loaderAsPlugin(self, session):
self.session = session
CrossEPG_Auto.instance.lock = True
CrossEPG_Auto.instance.stop()
self.loader()
def downloadCallback(self, ret):
if ret:
if self.config.csv_import_enabled == 1:
self.importer()
else:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def importer(self):
self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
def importerCallback(self, ret):
if ret:
if self.patchtype != 3:
self.converter()
else:
self.loader()
else:
CrossEPG_Auto.instance.lock = False
def converter(self):
self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
def converterCallback(self, ret):
if ret:
if self.patchtype != -1:
self.loader()
else:
if self.config.download_manual_reboot:
self.session.open(TryQuitMainloop, 3)
else:
CrossEPG_Auto.instance.lock = False
else:
CrossEPG_Auto.instance.lock = False
def loader(self):
self.session.openWithCallback(self.loaderCallback, CrossEPG_Loader)
def loaderCallback(self, ret):
CrossEPG_Auto.instance.lock = False
def setup(self, session, **kwargs):
CrossEPG_Auto.instance.lock = True
session.openWithCallback(self.setupCallback, CrossEPG_Menu)
def <|fim_middle|>(self):
CrossEPG_Auto.instance.lock = False
CrossEPG_Auto.instance.doneConfiguring()
crossepg_main = CrossEPG_Main()
<|fim▁end|> | setupCallback |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
<|fim▁hole|> Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from<|fim▁end|> |
def parse_course_keys(course_key_strings):
""" |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
<|fim_middle|>
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | """
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0] |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
<|fim_middle|>
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | """
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.') |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
<|fim_middle|>
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | """
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.') |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
<|fim_middle|>
<|fim▁end|> | """
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
<|fim_middle|>
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}') |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
<|fim_middle|>
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.') |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
<|fim_middle|>
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.') |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def <|fim_middle|>(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | get_mutually_exclusive_required_option |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def <|fim_middle|>(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | validate_mutually_exclusive_option |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def <|fim_middle|>(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def parse_course_keys(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | validate_dependent_option |
<|file_name|>command_utils.py<|end_file_name|><|fim▁begin|>"""
Useful utilities for management commands.
"""
from django.core.management.base import CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def get_mutually_exclusive_required_option(options, *selections):
"""
Validates that exactly one of the 2 given options is specified.
Returns the name of the found option.
"""
selected = [sel for sel in selections if options.get(sel)]
if len(selected) != 1:
selection_string = ', '.join(f'--{selection}' for selection in selections)
raise CommandError(f'Must specify exactly one of {selection_string}')
return selected[0]
def validate_mutually_exclusive_option(options, option_1, option_2):
"""
Validates that both of the 2 given options are not specified.
"""
if options.get(option_1) and options.get(option_2):
raise CommandError(f'Both --{option_1} and --{option_2} cannot be specified.')
def validate_dependent_option(options, dependent_option, depending_on_option):
"""
Validates that option_1 is specified if dependent_option is specified.
"""
if options.get(dependent_option) and not options.get(depending_on_option):
raise CommandError(f'Option --{dependent_option} requires option --{depending_on_option}.')
def <|fim_middle|>(course_key_strings):
"""
Parses and returns a list of CourseKey objects from the given
list of course key strings.
"""
try:
return [CourseKey.from_string(course_key_string) for course_key_string in course_key_strings]
except InvalidKeyError as error:
raise CommandError('Invalid key specified: {}'.format(str(error))) # lint-amnesty, pylint: disable=raise-missing-from
<|fim▁end|> | parse_course_keys |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
from setuptools import setup, find_packages<|fim▁hole|> version='0.1',
author='Chad Birch',
author_email='[email protected]',
packages=find_packages(),
install_requires=[
'r2',
],
entry_points={
'r2.plugin':
['gold = reddit_gold:Gold']
},
include_package_data=True,
zip_safe=False,
)<|fim▁end|> |
setup(name='reddit_gold',
description='reddit gold', |
<|file_name|>bpzfinalize.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import division
# python bpzchisq2run.py ACS-Subaru
# PRODUCES ACS-Subaru_bpz.cat
# ADDS A FEW THINGS TO THE BPZ CATALOG
# INCLUDING chisq2 AND LABEL HEADERS
# ~/p/bpzchisq2run.py NOW INCLUDED!
# ~/Tonetti/colorpro/bpzfinalize7a.py
# ~/UDF/Elmegreen/phot8/bpzfinalize7.py
# ~/UDF/bpzfinalize7a.py, 7, 5, 4, 23_djh, 23, 3
# NOW TAKING BPZ OUTPUT w/ 3 REDSHIFT PEAKS
# ALSO USING NEW i-band CATALOG istel.cat -- w/ CORRECT IDs
# python bpzfinalize.py bvizjh_cut_sexseg2_allobjs_newres_offset3_djh_Burst_1M
from builtins import range
from past.utils import old_div
from coetools import *
sum = add.reduce # Just to make sure
##################
# add nf, jhgood, stellarity, x, y
inbpz = capfile(sys.argv[1], 'bpz')
inroot = inbpz[:-4]
infile = loadfile(inbpz)
for line in infile:
if line[:7] == '##INPUT':
incat = line[8:]
break
for line in infile:
if line[:9] == '##N_PEAKS':
npeaks = string.atoi(line[10])
break
#inchisq2 = inroot + '.chisq2'
#outbpz = inroot + '_b.bpz'
outbpz = inroot + '_bpz.cat'
if npeaks == 1:
labels = string.split(
'id zb zbmin zbmax tb odds zml tml chisq')
elif npeaks == 3:
labels = string.split(
'id zb zbmin zbmax tb odds zb2 zb2min zb2max tb2 odds2 zb3 zb3min zb3max tb3 odds3 zml tml chisq')
else:
print('N_PEAKS = %d!?' % npeaks)
sys.exit(1)
labelnicks = {'Z_S': 'zspec', 'M_0': 'M0'}
read = 0
ilabel = 0
for iline in range(len(infile)):
line = infile[iline]
if line[:2] == '##':
if read:
break
else:
read = 1
if read == 1:
ilabel += 1
label = string.split(line)[-1]
if ilabel >= 10:
labels.append(labelnicks.get(label, label))
mybpz = loadvarswithclass(inbpz, labels=labels)
mycat = loadvarswithclass(incat)
#icat = loadvarswithclass('/home/coe/UDF/istel.cat')
#icat = icat.takeids(mycat.id)
#bpzchisq2 = loadvarswithclass(inchisq2)
#################################
# CHISQ2, nfdet, nfobs
if os.path.exists(inroot + '.flux_comparison'):
data = loaddata(inroot + '.flux_comparison+')
#nf = 6
nf = old_div((len(data) - 5), 3)
# id M0 zb tb*3
id = data[0]
ft = data[5:5 + nf] # FLUX (from spectrum for that TYPE)
fo = data[5 + nf:5 + 2 * nf] # FLUX (OBSERVED)
efo = data[5 + 2 * nf:5 + 3 * nf] # FLUX_ERROR (OBSERVED)
# chisq 2
eft = old_div(ft, 15.)
eft = max(eft) # for each galaxy, take max eft among filters
ef = sqrt(efo**2 + eft**2) # (6, 18981) + (18981) done correctly
dfosq = (old_div((ft - fo), ef))**2
dfosqsum = sum(dfosq)
detected = greater(fo, 0)
nfdet = sum(detected)
observed = less(efo, 1)
nfobs = sum(observed)
# DEGREES OF FREEDOM
dof = clip2(nfobs - 3., 1, None) # 3 params (z, t, a)
chisq2clip = old_div(dfosqsum, dof)<|fim▁hole|> chisq2 = where(less(sedfrac, 1e-10), 900., chisq2)
chisq2 = where(equal(nfobs, 1), 990., chisq2)
chisq2 = where(equal(nfobs, 0), 999., chisq2)
#################################
#print 'BPZ tb N_PEAKS BUG FIX'
#mybpz.tb = mybpz.tb + 0.667
#mybpz.tb2 = where(greater(mybpz.tb2, 0), mybpz.tb2 + 0.667, -1.)
#mybpz.tb3 = where(greater(mybpz.tb3, 0), mybpz.tb3 + 0.667, -1.)
mybpz.add('chisq2', chisq2)
mybpz.add('nfdet', nfdet)
mybpz.add('nfobs', nfobs)
#mybpz.add('jhgood', jhgood)
if 'stel' in mycat.labels:
mybpz.add('stel', mycat.stel)
elif 'stellarity' in mycat.labels:
mybpz.add('stel', mycat.stellarity)
if 'maxsigisoaper' in mycat.labels:
mybpz.add('sig', mycat.maxsigisoaper)
if 'sig' in mycat.labels:
mybpz.assign('sig', mycat.maxsigisoaper)
#mybpz.add('x', mycat.x)
#mybpz.add('y', mycat.y)
if 'zspec' not in mybpz.labels:
if 'zspec' in mycat.labels:
mybpz.add('zspec', mycat.zspec)
print(mycat.zspec)
if 'zqual' in mycat.labels:
mybpz.add('zqual', mycat.zqual)
print(mybpz.labels)
mybpz.save(outbpz, maxy=None)
##################
# det
# 0 < mag < 99
# dmag > 0
# fo > 0
# efo -> 1.6e-8, e.g.
# undet
# mag = 99
# dmag = -m_1sigma
# fo = 0
# efo = 0 -> 5e13, e.g.
# unobs
# mag = -99
# dmag = 0
# fo = 0
# efo = inf (1e108)
## # original chisq usually matches this:
## dfosq = ((ft - fo) / efo) ** 2
## dfosqsum = sum(dfosq)
## observed = less(efo, 1)
## nfobs = sum(observed)
## chisq = dfosqsum / (nfobs - 1.)<|fim▁end|> |
sedfrac = divsafe(max(fo - efo), max(ft), -1) # SEDzero
chisq2 = chisq2clip[:] |
<|file_name|>bpzfinalize.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import division
# python bpzchisq2run.py ACS-Subaru
# PRODUCES ACS-Subaru_bpz.cat
# ADDS A FEW THINGS TO THE BPZ CATALOG
# INCLUDING chisq2 AND LABEL HEADERS
# ~/p/bpzchisq2run.py NOW INCLUDED!
# ~/Tonetti/colorpro/bpzfinalize7a.py
# ~/UDF/Elmegreen/phot8/bpzfinalize7.py
# ~/UDF/bpzfinalize7a.py, 7, 5, 4, 23_djh, 23, 3
# NOW TAKING BPZ OUTPUT w/ 3 REDSHIFT PEAKS
# ALSO USING NEW i-band CATALOG istel.cat -- w/ CORRECT IDs
# python bpzfinalize.py bvizjh_cut_sexseg2_allobjs_newres_offset3_djh_Burst_1M
from builtins import range
from past.utils import old_div
from coetools import *
sum = add.reduce # Just to make sure
##################
# add nf, jhgood, stellarity, x, y
inbpz = capfile(sys.argv[1], 'bpz')
inroot = inbpz[:-4]
infile = loadfile(inbpz)
for line in infile:
if line[:7] == '##INPUT':
<|fim_middle|>
for line in infile:
if line[:9] == '##N_PEAKS':
npeaks = string.atoi(line[10])
break
#inchisq2 = inroot + '.chisq2'
#outbpz = inroot + '_b.bpz'
outbpz = inroot + '_bpz.cat'
if npeaks == 1:
labels = string.split(
'id zb zbmin zbmax tb odds zml tml chisq')
elif npeaks == 3:
labels = string.split(
'id zb zbmin zbmax tb odds zb2 zb2min zb2max tb2 odds2 zb3 zb3min zb3max tb3 odds3 zml tml chisq')
else:
print('N_PEAKS = %d!?' % npeaks)
sys.exit(1)
labelnicks = {'Z_S': 'zspec', 'M_0': 'M0'}
read = 0
ilabel = 0
for iline in range(len(infile)):
line = infile[iline]
if line[:2] == '##':
if read:
break
else:
read = 1
if read == 1:
ilabel += 1
label = string.split(line)[-1]
if ilabel >= 10:
labels.append(labelnicks.get(label, label))
mybpz = loadvarswithclass(inbpz, labels=labels)
mycat = loadvarswithclass(incat)
#icat = loadvarswithclass('/home/coe/UDF/istel.cat')
#icat = icat.takeids(mycat.id)
#bpzchisq2 = loadvarswithclass(inchisq2)
#################################
# CHISQ2, nfdet, nfobs
if os.path.exists(inroot + '.flux_comparison'):
data = loaddata(inroot + '.flux_comparison+')
#nf = 6
nf = old_div((len(data) - 5), 3)
# id M0 zb tb*3
id = data[0]
ft = data[5:5 + nf] # FLUX (from spectrum for that TYPE)
fo = data[5 + nf:5 + 2 * nf] # FLUX (OBSERVED)
efo = data[5 + 2 * nf:5 + 3 * nf] # FLUX_ERROR (OBSERVED)
# chisq 2
eft = old_div(ft, 15.)
eft = max(eft) # for each galaxy, take max eft among filters
ef = sqrt(efo**2 + eft**2) # (6, 18981) + (18981) done correctly
dfosq = (old_div((ft - fo), ef))**2
dfosqsum = sum(dfosq)
detected = greater(fo, 0)
nfdet = sum(detected)
observed = less(efo, 1)
nfobs = sum(observed)
# DEGREES OF FREEDOM
dof = clip2(nfobs - 3., 1, None) # 3 params (z, t, a)
chisq2clip = old_div(dfosqsum, dof)
sedfrac = divsafe(max(fo - efo), max(ft), -1) # SEDzero
chisq2 = chisq2clip[:]
chisq2 = where(less(sedfrac, 1e-10), 900., chisq2)
chisq2 = where(equal(nfobs, 1), 990., chisq2)
chisq2 = where(equal(nfobs, 0), 999., chisq2)
#################################
#print 'BPZ tb N_PEAKS BUG FIX'
#mybpz.tb = mybpz.tb + 0.667
#mybpz.tb2 = where(greater(mybpz.tb2, 0), mybpz.tb2 + 0.667, -1.)
#mybpz.tb3 = where(greater(mybpz.tb3, 0), mybpz.tb3 + 0.667, -1.)
mybpz.add('chisq2', chisq2)
mybpz.add('nfdet', nfdet)
mybpz.add('nfobs', nfobs)
#mybpz.add('jhgood', jhgood)
if 'stel' in mycat.labels:
mybpz.add('stel', mycat.stel)
elif 'stellarity' in mycat.labels:
mybpz.add('stel', mycat.stellarity)
if 'maxsigisoaper' in mycat.labels:
mybpz.add('sig', mycat.maxsigisoaper)
if 'sig' in mycat.labels:
mybpz.assign('sig', mycat.maxsigisoaper)
#mybpz.add('x', mycat.x)
#mybpz.add('y', mycat.y)
if 'zspec' not in mybpz.labels:
if 'zspec' in mycat.labels:
mybpz.add('zspec', mycat.zspec)
print(mycat.zspec)
if 'zqual' in mycat.labels:
mybpz.add('zqual', mycat.zqual)
print(mybpz.labels)
mybpz.save(outbpz, maxy=None)
##################
# det
# 0 < mag < 99
# dmag > 0
# fo > 0
# efo -> 1.6e-8, e.g.
# undet
# mag = 99
# dmag = -m_1sigma
# fo = 0
# efo = 0 -> 5e13, e.g.
# unobs
# mag = -99
# dmag = 0
# fo = 0
# efo = inf (1e108)
## # original chisq usually matches this:
## dfosq = ((ft - fo) / efo) ** 2
## dfosqsum = sum(dfosq)
## observed = less(efo, 1)
## nfobs = sum(observed)
## chisq = dfosqsum / (nfobs - 1.)
<|fim▁end|> | incat = line[8:]
break |
<|file_name|>bpzfinalize.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import division
# python bpzchisq2run.py ACS-Subaru
# PRODUCES ACS-Subaru_bpz.cat
# ADDS A FEW THINGS TO THE BPZ CATALOG
# INCLUDING chisq2 AND LABEL HEADERS
# ~/p/bpzchisq2run.py NOW INCLUDED!
# ~/Tonetti/colorpro/bpzfinalize7a.py
# ~/UDF/Elmegreen/phot8/bpzfinalize7.py
# ~/UDF/bpzfinalize7a.py, 7, 5, 4, 23_djh, 23, 3
# NOW TAKING BPZ OUTPUT w/ 3 REDSHIFT PEAKS
# ALSO USING NEW i-band CATALOG istel.cat -- w/ CORRECT IDs
# python bpzfinalize.py bvizjh_cut_sexseg2_allobjs_newres_offset3_djh_Burst_1M
from builtins import range
from past.utils import old_div
from coetools import *
sum = add.reduce # Just to make sure
##################
# add nf, jhgood, stellarity, x, y
inbpz = capfile(sys.argv[1], 'bpz')
inroot = inbpz[:-4]
infile = loadfile(inbpz)
for line in infile:
if line[:7] == '##INPUT':
incat = line[8:]
break
for line in infile:
if line[:9] == '##N_PEAKS':
<|fim_middle|>
#inchisq2 = inroot + '.chisq2'
#outbpz = inroot + '_b.bpz'
outbpz = inroot + '_bpz.cat'
if npeaks == 1:
labels = string.split(
'id zb zbmin zbmax tb odds zml tml chisq')
elif npeaks == 3:
labels = string.split(
'id zb zbmin zbmax tb odds zb2 zb2min zb2max tb2 odds2 zb3 zb3min zb3max tb3 odds3 zml tml chisq')
else:
print('N_PEAKS = %d!?' % npeaks)
sys.exit(1)
labelnicks = {'Z_S': 'zspec', 'M_0': 'M0'}
read = 0
ilabel = 0
for iline in range(len(infile)):
line = infile[iline]
if line[:2] == '##':
if read:
break
else:
read = 1
if read == 1:
ilabel += 1
label = string.split(line)[-1]
if ilabel >= 10:
labels.append(labelnicks.get(label, label))
mybpz = loadvarswithclass(inbpz, labels=labels)
mycat = loadvarswithclass(incat)
#icat = loadvarswithclass('/home/coe/UDF/istel.cat')
#icat = icat.takeids(mycat.id)
#bpzchisq2 = loadvarswithclass(inchisq2)
#################################
# CHISQ2, nfdet, nfobs
if os.path.exists(inroot + '.flux_comparison'):
data = loaddata(inroot + '.flux_comparison+')
#nf = 6
nf = old_div((len(data) - 5), 3)
# id M0 zb tb*3
id = data[0]
ft = data[5:5 + nf] # FLUX (from spectrum for that TYPE)
fo = data[5 + nf:5 + 2 * nf] # FLUX (OBSERVED)
efo = data[5 + 2 * nf:5 + 3 * nf] # FLUX_ERROR (OBSERVED)
# chisq 2
eft = old_div(ft, 15.)
eft = max(eft) # for each galaxy, take max eft among filters
ef = sqrt(efo**2 + eft**2) # (6, 18981) + (18981) done correctly
dfosq = (old_div((ft - fo), ef))**2
dfosqsum = sum(dfosq)
detected = greater(fo, 0)
nfdet = sum(detected)
observed = less(efo, 1)
nfobs = sum(observed)
# DEGREES OF FREEDOM
dof = clip2(nfobs - 3., 1, None) # 3 params (z, t, a)
chisq2clip = old_div(dfosqsum, dof)
sedfrac = divsafe(max(fo - efo), max(ft), -1) # SEDzero
chisq2 = chisq2clip[:]
chisq2 = where(less(sedfrac, 1e-10), 900., chisq2)
chisq2 = where(equal(nfobs, 1), 990., chisq2)
chisq2 = where(equal(nfobs, 0), 999., chisq2)
#################################
#print 'BPZ tb N_PEAKS BUG FIX'
#mybpz.tb = mybpz.tb + 0.667
#mybpz.tb2 = where(greater(mybpz.tb2, 0), mybpz.tb2 + 0.667, -1.)
#mybpz.tb3 = where(greater(mybpz.tb3, 0), mybpz.tb3 + 0.667, -1.)
mybpz.add('chisq2', chisq2)
mybpz.add('nfdet', nfdet)
mybpz.add('nfobs', nfobs)
#mybpz.add('jhgood', jhgood)
if 'stel' in mycat.labels:
mybpz.add('stel', mycat.stel)
elif 'stellarity' in mycat.labels:
mybpz.add('stel', mycat.stellarity)
if 'maxsigisoaper' in mycat.labels:
mybpz.add('sig', mycat.maxsigisoaper)
if 'sig' in mycat.labels:
mybpz.assign('sig', mycat.maxsigisoaper)
#mybpz.add('x', mycat.x)
#mybpz.add('y', mycat.y)
if 'zspec' not in mybpz.labels:
if 'zspec' in mycat.labels:
mybpz.add('zspec', mycat.zspec)
print(mycat.zspec)
if 'zqual' in mycat.labels:
mybpz.add('zqual', mycat.zqual)
print(mybpz.labels)
mybpz.save(outbpz, maxy=None)
##################
# det
# 0 < mag < 99
# dmag > 0
# fo > 0
# efo -> 1.6e-8, e.g.
# undet
# mag = 99
# dmag = -m_1sigma
# fo = 0
# efo = 0 -> 5e13, e.g.
# unobs
# mag = -99
# dmag = 0
# fo = 0
# efo = inf (1e108)
## # original chisq usually matches this:
## dfosq = ((ft - fo) / efo) ** 2
## dfosqsum = sum(dfosq)
## observed = less(efo, 1)
## nfobs = sum(observed)
## chisq = dfosqsum / (nfobs - 1.)
<|fim▁end|> | npeaks = string.atoi(line[10])
break |
<|file_name|>bpzfinalize.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
from __future__ import division
# python bpzchisq2run.py ACS-Subaru
# PRODUCES ACS-Subaru_bpz.cat
# ADDS A FEW THINGS TO THE BPZ CATALOG
# INCLUDING chisq2 AND LABEL HEADERS
# ~/p/bpzchisq2run.py NOW INCLUDED!
# ~/Tonetti/colorpro/bpzfinalize7a.py
# ~/UDF/Elmegreen/phot8/bpzfinalize7.py
# ~/UDF/bpzfinalize7a.py, 7, 5, 4, 23_djh, 23, 3
# NOW TAKING BPZ OUTPUT w/ 3 REDSHIFT PEAKS
# ALSO USING NEW i-band CATALOG istel.cat -- w/ CORRECT IDs
# python bpzfinalize.py bvizjh_cut_sexseg2_allobjs_newres_offset3_djh_Burst_1M
from builtins import range
from past.utils import old_div
from coetools import *
sum = add.reduce # Just to make sure
##################
# add nf, jhgood, stellarity, x, y
inbpz = capfile(sys.argv[1], 'bpz')
inroot = inbpz[:-4]
infile = loadfile(inbpz)
for line in infile:
if line[:7] == '##INPUT':
incat = line[8:]
break
for line in infile:
if line[:9] == '##N_PEAKS':
npeaks = string.atoi(line[10])
break
#inchisq2 = inroot + '.chisq2'
#outbpz = inroot + '_b.bpz'
outbpz = inroot + '_bpz.cat'
if npeaks == 1:
<|fim_middle|>
elif npeaks == 3:
labels = string.split(
'id zb zbmin zbmax tb odds zb2 zb2min zb2max tb2 odds2 zb3 zb3min zb3max tb3 odds3 zml tml chisq')
else:
print('N_PEAKS = %d!?' % npeaks)
sys.exit(1)
labelnicks = {'Z_S': 'zspec', 'M_0': 'M0'}
read = 0
ilabel = 0
for iline in range(len(infile)):
line = infile[iline]
if line[:2] == '##':
if read:
break
else:
read = 1
if read == 1:
ilabel += 1
label = string.split(line)[-1]
if ilabel >= 10:
labels.append(labelnicks.get(label, label))
mybpz = loadvarswithclass(inbpz, labels=labels)
mycat = loadvarswithclass(incat)
#icat = loadvarswithclass('/home/coe/UDF/istel.cat')
#icat = icat.takeids(mycat.id)
#bpzchisq2 = loadvarswithclass(inchisq2)
#################################
# CHISQ2, nfdet, nfobs
if os.path.exists(inroot + '.flux_comparison'):
data = loaddata(inroot + '.flux_comparison+')
#nf = 6
nf = old_div((len(data) - 5), 3)
# id M0 zb tb*3
id = data[0]
ft = data[5:5 + nf] # FLUX (from spectrum for that TYPE)
fo = data[5 + nf:5 + 2 * nf] # FLUX (OBSERVED)
efo = data[5 + 2 * nf:5 + 3 * nf] # FLUX_ERROR (OBSERVED)
# chisq 2
eft = old_div(ft, 15.)
eft = max(eft) # for each galaxy, take max eft among filters
ef = sqrt(efo**2 + eft**2) # (6, 18981) + (18981) done correctly
dfosq = (old_div((ft - fo), ef))**2
dfosqsum = sum(dfosq)
detected = greater(fo, 0)
nfdet = sum(detected)
observed = less(efo, 1)
nfobs = sum(observed)
# DEGREES OF FREEDOM
dof = clip2(nfobs - 3., 1, None) # 3 params (z, t, a)
chisq2clip = old_div(dfosqsum, dof)
sedfrac = divsafe(max(fo - efo), max(ft), -1) # SEDzero
chisq2 = chisq2clip[:]
chisq2 = where(less(sedfrac, 1e-10), 900., chisq2)
chisq2 = where(equal(nfobs, 1), 990., chisq2)
chisq2 = where(equal(nfobs, 0), 999., chisq2)
#################################
#print 'BPZ tb N_PEAKS BUG FIX'
#mybpz.tb = mybpz.tb + 0.667
#mybpz.tb2 = where(greater(mybpz.tb2, 0), mybpz.tb2 + 0.667, -1.)
#mybpz.tb3 = where(greater(mybpz.tb3, 0), mybpz.tb3 + 0.667, -1.)
mybpz.add('chisq2', chisq2)
mybpz.add('nfdet', nfdet)
mybpz.add('nfobs', nfobs)
#mybpz.add('jhgood', jhgood)
if 'stel' in mycat.labels:
mybpz.add('stel', mycat.stel)
elif 'stellarity' in mycat.labels:
mybpz.add('stel', mycat.stellarity)
if 'maxsigisoaper' in mycat.labels:
mybpz.add('sig', mycat.maxsigisoaper)
if 'sig' in mycat.labels:
mybpz.assign('sig', mycat.maxsigisoaper)
#mybpz.add('x', mycat.x)
#mybpz.add('y', mycat.y)
if 'zspec' not in mybpz.labels:
if 'zspec' in mycat.labels:
mybpz.add('zspec', mycat.zspec)
print(mycat.zspec)
if 'zqual' in mycat.labels:
mybpz.add('zqual', mycat.zqual)
print(mybpz.labels)
mybpz.save(outbpz, maxy=None)
##################
# det
# 0 < mag < 99
# dmag > 0
# fo > 0
# efo -> 1.6e-8, e.g.
# undet
# mag = 99
# dmag = -m_1sigma
# fo = 0
# efo = 0 -> 5e13, e.g.
# unobs
# mag = -99
# dmag = 0
# fo = 0
# efo = inf (1e108)
## # original chisq usually matches this:
## dfosq = ((ft - fo) / efo) ** 2
## dfosqsum = sum(dfosq)
## observed = less(efo, 1)
## nfobs = sum(observed)
## chisq = dfosqsum / (nfobs - 1.)
<|fim▁end|> | labels = string.split(
'id zb zbmin zbmax tb odds zml tml chisq') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.