uid stringlengths 24 24 | split stringclasses 1
value | category stringclasses 2
values | content stringlengths 5 482k | signature stringlengths 1 14k | suffix stringlengths 1 482k | prefix stringlengths 9 14k | prefix_token_count int64 3 5.01k | prefix_token_budget int64 64 256 | element_token_count int64 1 292k | signature_token_count int64 1 5.01k | prefix_context_token_count int64 0 255 | repo stringlengths 7 112 | path stringlengths 4 208 | language stringclasses 1
value | name stringlengths 1 218 | qualname stringlengths 1 218 | start_line int64 1 26.7k | end_line int64 1 26.7k | signature_start_line int64 1 26.7k | signature_end_line int64 1 26.7k | source_hash stringlengths 40 40 | source_dataset stringclasses 1
value | source_split stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
09d62ec794855ec2b6508267 | train | function | def test_install_with_id(zk_znode):
args = ['--app-id=chronos-1', '--yes']
stdout = (
b'Installing Marathon app for package [chronos] version [3.0.1] with '
b'app id [chronos-1]\n'
)
_install_chronos(args=args, stdout=stdout)
args = ['--app-id=chronos-2', '--yes']
stdout = (
... | def test_install_with_id(zk_znode):
| args = ['--app-id=chronos-1', '--yes']
stdout = (
b'Installing Marathon app for package [chronos] version [3.0.1] with '
b'app id [chronos-1]\n'
)
_install_chronos(args=args, stdout=stdout)
args = ['--app-id=chronos-2', '--yes']
stdout = (
b'Installing Marathon app for ... | /'
b'current/usage/service-guides/cassandra/uninstall to remove any '
b'persistent state if required.\n'
)
package_uninstall('cassandra', stderr=stderr)
delete_zk_node('dcos-service-cassandra')
def test_install_with_id(zk_znode):
| 64 | 64 | 148 | 10 | 54 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_install_with_id | test_install_with_id | 498 | 512 | 498 | 498 | d2b76eb908f1337171466d42c242c18f9507a02c | bigcode/the-stack | train |
ae732e390eed3e757e1539aa | train | function | def test_uninstall_subcommand():
_install_helloworld()
_uninstall_helloworld()
_list(args=['--json'], stdout=b'[]\n')
| def test_uninstall_subcommand():
| _install_helloworld()
_uninstall_helloworld()
_list(args=['--json'], stdout=b'[]\n')
| stderr=stderr)
stderr = 'Package [chronos] with id [/chronos-1] is not installed\n'
_uninstall_chronos(
args=['--app-id=chronos-1'],
returncode=1,
stderr=stderr)
def test_uninstall_subcommand():
| 64 | 64 | 37 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_uninstall_subcommand | test_uninstall_subcommand | 541 | 544 | 541 | 541 | d1460e4375789db7b7bfe86d383c2843da68a125 | bigcode/the-stack | train |
d375440ea01bfa4a95a34848 | train | function | def test_list_cli_only(env):
helloworld_path = 'tests/data/package/json/test_list_helloworld_cli.json'
helloworld_json = file_json(helloworld_path)
with _helloworld_cli(), \
update_config('package.cosmos_url', 'http://nohost', env):
assert_command(
cmd=['dcos', 'package', 'l... | def test_list_cli_only(env):
| helloworld_path = 'tests/data/package/json/test_list_helloworld_cli.json'
helloworld_json = file_json(helloworld_path)
with _helloworld_cli(), \
update_config('package.cosmos_url', 'http://nohost', env):
assert_command(
cmd=['dcos', 'package', 'list', '--json', '--cli'],
... | install_helloworld(args=['--cli', '--yes'], stdout=stdout)
stdout = file_json(
'tests/data/package/json/test_list_helloworld_cli.json')
_list(args=['--json'], stdout=stdout)
_uninstall_cli_helloworld()
def test_list_cli_only(env):
| 64 | 64 | 162 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_list_cli_only | test_list_cli_only | 685 | 702 | 685 | 685 | 24d98cb3ae3795b556443bb4015c6961936b36a9 | bigcode/the-stack | train |
af96002e43e06a64d97b8a7d | train | function | def _uninstall_chronos(args=[], returncode=0, stdout=b'', stderr=''):
result_returncode, result_stdout, result_stderr = exec_command(
['dcos', 'package', 'uninstall', 'chronos'] + args)
assert result_returncode == returncode
assert result_stdout == stdout
assert result_stderr.decode('utf-8').st... | def _uninstall_chronos(args=[], returncode=0, stdout=b'', stderr=''):
| result_returncode, result_stdout, result_stderr = exec_command(
['dcos', 'package', 'uninstall', 'chronos'] + args)
assert result_returncode == returncode
assert result_stdout == stdout
assert result_stderr.decode('utf-8').startswith(stderr)
| returncode=0):
assert_command(['dcos', 'package', 'uninstall', 'helloworld'] + args,
stdout=stdout,
stderr=stderr,
returncode=returncode)
def _uninstall_chronos(args=[], returncode=0, stdout=b'', stderr=''):
| 64 | 64 | 84 | 20 | 44 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _uninstall_chronos | _uninstall_chronos | 904 | 910 | 904 | 904 | 5f7228d2edb8b718b0167d1fa3abd054fab4ec53 | bigcode/the-stack | train |
2749a07e66f3c71de9c86d90 | train | function | def _uninstall_cli_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0):
assert_command(['dcos', 'package', 'uninstall', 'helloworld'] + args,
stdout=stdout,
stderr=stderr,
returncode=returncode)
| def _uninstall_cli_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0):
| assert_command(['dcos', 'package', 'uninstall', 'helloworld'] + args,
stdout=stdout,
stderr=stderr,
returncode=returncode)
| ', 'helloworld'] + args,
stdout=stdout,
stderr=uninstalled+stderr,
returncode=returncode)
watch_all_deployments()
def _uninstall_cli_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0):
| 64 | 64 | 67 | 29 | 35 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _uninstall_cli_helloworld | _uninstall_cli_helloworld | 893 | 901 | 893 | 897 | db4ec2cabbd832335465b072941d727b010e1645 | bigcode/the-stack | train |
0bc013c7d3cd433603a32ca9 | train | function | def test_package_metadata():
_install_helloworld()
# test marathon labels
expected_metadata = {
'maintainer': 'support@mesosphere.io',
'framework': False,
'name': 'helloworld',
'version': '0.1.0',
'packagingVersion': '3.0',
'preInstallNotes': 'A sample pre-in... | def test_package_metadata():
| _install_helloworld()
# test marathon labels
expected_metadata = {
'maintainer': 'support@mesosphere.io',
'framework': False,
'name': 'helloworld',
'version': '0.1.0',
'packagingVersion': '3.0',
'preInstallNotes': 'A sample pre-installation message',
... | ',
args=['--yes', '--package-version=0.11.1'],
stdout=stdout,
uninstall_stderr=uninstall_stderr):
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'list', 'marathon', '--json'])
assert returncode == 0
assert stderr ... | 172 | 172 | 574 | 5 | 167 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_package_metadata | test_package_metadata | 402 | 471 | 402 | 402 | 7a70a7858e20c405589d7334e0b44186b9b73e92 | bigcode/the-stack | train |
6e1fb1fa2c46730736ecfd1d | train | function | def test_describe_package_version_missing():
stderr = b'Version [bogus] of package [marathon] not found\n'
assert_command(
['dcos', 'package', 'describe', 'marathon', '--package-version=bogus'],
returncode=1,
stderr=stderr)
| def test_describe_package_version_missing():
| stderr = b'Version [bogus] of package [marathon] not found\n'
assert_command(
['dcos', 'package', 'describe', 'marathon', '--package-version=bogus'],
returncode=1,
stderr=stderr)
| athon',
'--package-version=1.3.10'])
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))
assert output == json.loads(stdout.decode('utf-8'))
assert stderr_ == b''
def test_describe_package_version_missing():
| 63 | 64 | 67 | 8 | 55 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_package_version_missing | test_describe_package_version_missing | 263 | 268 | 263 | 263 | a5e5dbac052b544e8ff3791fb13fa6deae0f5f7d | bigcode/the-stack | train |
0bbb97f1b18ce876fe989722 | train | function | def _install_helloworld(
args=['--yes'],
stdout=b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] '
b'version [0.1.0]\n'
b'Installing CLI subcommand for package [helloworld] '
b'version [0.1.0]\n'
... | def _install_helloworld(
args=['--yes'],
stdout=b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] '
b'version [0.1.0]\n'
b'Installing CLI subcommand for package [helloworld] '
b'version [0.1.0]\n'
... | assert_command(
['dcos', 'package', 'install', 'helloworld'] + args,
stdout=stdout,
returncode=returncode,
stdin=stdin,
stderr=stderr)
| def _install_helloworld(
args=['--yes'],
stdout=b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] '
b'version [0.1.0]\n'
b'Installing CLI subcommand for package [helloworld] '
b'version [0.1.0]\n'
... | 128 | 64 | 172 | 128 | 0 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _install_helloworld | _install_helloworld | 858 | 876 | 858 | 870 | 74311bea9ee6ab296eb1235016bf56d51dd7f3f4 | bigcode/the-stack | train |
e9fc28e7a44ae14f3d80a6c3 | train | function | def test_search_start_with_wildcard():
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', '*nos', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert stderr == b''
registries = json.loads(stdout.decode('utf-8'))
assert len(registries['packages']) ... | def test_search_start_with_wildcard():
| returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', '*nos', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert stderr == b''
registries = json.loads(stdout.decode('utf-8'))
assert len(registries['packages']) == 1
| ''
registries = json.loads(stdout.decode('utf-8'))
# cosmos matches wildcards in name/description/tags
# so will find more results (3 instead of 2)
assert len(registries['packages']) >= 2
def test_search_start_with_wildcard():
| 64 | 64 | 88 | 9 | 54 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_search_start_with_wildcard | test_search_start_with_wildcard | 816 | 825 | 816 | 816 | 0ce5d9b30543e256c92c246ba8e00f710cf21197 | bigcode/the-stack | train |
d4b62bb5888ec9b90275f6fc | train | function | def test_repo_remove():
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
_repo_remove(['1.7-universe'], repo_list)
... | def test_repo_remove():
| repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
_repo_remove(['1.7-universe'], repo_list)
repo_list = bytes(
... | }\n"
).format(repo17, UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
args = ["1.7-universe", repo17, '--index=1']
_repo_add(args, repo_list)
def test_repo_remove():
| 64 | 64 | 155 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_repo_remove | test_repo_remove | 114 | 132 | 114 | 114 | a1982586748bb070f205dda973c0a4037f8f815f | bigcode/the-stack | train |
b03d218ab7cfa3f34ea7bc0a | train | function | def test_repo_add_index():
repo17 = "http://universe.mesosphere.com/repo-1.7"
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"1.7-universe: {0}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {1}\n"
).format(repo17, UNIVERSE_... | def test_repo_add_index():
| repo17 = "http://universe.mesosphere.com/repo-1.7"
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"1.7-universe: {0}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {1}\n"
).format(repo17, UNIVERSE_REPO, **UNIVERSE_TEST_REPOS... | n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
args = ["Universe", UNIVERSE_REPO]
_repo_add(args, repo_list)
def test_repo_add_index():
| 64 | 64 | 140 | 6 | 58 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_repo_add_index | test_repo_add_index | 98 | 111 | 98 | 98 | 3fde9368705158f5b56a5f1bb53c42ccb94ebc59 | bigcode/the-stack | train |
c810892b7982a10155b39567 | train | function | def test_search():
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'cron', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert stderr == b''
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'xyzzy', '--json'])
a... | def test_search():
| returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'cron', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert stderr == b''
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'xyzzy', '--json'])
assert returncode ==... | 1]\n'
'Unable to shutdown [chronos] service framework with name '
'[chronos-user] because there are multiple framework ids '
'matching this name: ')
for framework in get_services(args=['--inactive']):
if framework['name'] == 'chronos-user':
service_s... | 74 | 75 | 253 | 4 | 70 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_search | test_search | 757 | 788 | 757 | 757 | d257c0920eb2267f13a0cd1d29f453823268b173 | bigcode/the-stack | train |
443a0ad7f2d28aa093c25799 | train | function | def test_cli_global():
helloworld_path = 'tests/data/package/json/test_list_helloworld_cli.json'
helloworld_json = file_json(helloworld_path)
with _helloworld_cli(global_=True):
assert os.path.exists(subcommand.global_package_dir("helloworld"))
assert_command(
cmd=['dcos', 'pac... | def test_cli_global():
| helloworld_path = 'tests/data/package/json/test_list_helloworld_cli.json'
helloworld_json = file_json(helloworld_path)
with _helloworld_cli(global_=True):
assert os.path.exists(subcommand.global_package_dir("helloworld"))
assert_command(
cmd=['dcos', 'package', 'list', '--json'... | ', 'list', '--json', '--cli',
'--app-id=/helloworld'],
stdout=b'[]\n')
assert_command(
cmd=['dcos', 'package', 'list', '--json', '--cli', 'helloworld'],
stdout=helloworld_json)
def test_cli_global():
| 64 | 64 | 88 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_cli_global | test_cli_global | 705 | 714 | 705 | 705 | 3b1df5df288222bc4799a744775b27ee39a8587a | bigcode/the-stack | train |
da5697d6c6d976d0a8f2d57c | train | function | def test_version():
assert_command(['dcos', 'package', '--version'],
stdout=b'dcos-package version SNAPSHOT\n')
| def test_version():
| assert_command(['dcos', 'package', '--version'],
stdout=b'dcos-package version SNAPSHOT\n')
| (['dcos', 'package', '--help'],
stdout=content.read().encode('utf-8'))
def test_info():
info = b"Install and manage DC/OS software packages\n"
assert_command(['dcos', 'package', '--info'],
stdout=info)
def test_version():
| 64 | 64 | 28 | 4 | 60 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_version | test_version | 62 | 64 | 62 | 62 | ebd4b8c61a3faf52dda6ab2dd5f2e1a731a3e698 | bigcode/the-stack | train |
904e362a9bebc4585dbb2a93 | train | function | def _install_bad_chronos(args=['--yes'],
stdout=b'',
stderr=''):
cmd = ['dcos', 'package', 'install', 'chronos'] + args
returncode_, stdout_, stderr_ = exec_command(cmd)
assert returncode_ == 1
assert stderr in stderr_.decode('utf-8')
pre_install_not... | def _install_bad_chronos(args=['--yes'],
stdout=b'',
stderr=''):
| cmd = ['dcos', 'package', 'install', 'chronos'] + args
returncode_, stdout_, stderr_ = exec_command(cmd)
assert returncode_ == 1
assert stderr in stderr_.decode('utf-8')
pre_install_notes = (b'We recommend a minimum of one node with at least 2 '
b'CPUs and 2.5GiB of RAM avai... | package', 'uninstall', 'chronos'] + args)
assert result_returncode == returncode
assert result_stdout == stdout
assert result_stderr.decode('utf-8').startswith(stderr)
def _install_bad_chronos(args=['--yes'],
stdout=b'',
stderr=''):
| 64 | 64 | 132 | 21 | 43 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _install_bad_chronos | _install_bad_chronos | 913 | 923 | 913 | 915 | 21a67d869e04abefd342b1b9f4a2dfc1aeb82945 | bigcode/the-stack | train |
7c9053677fadac46047dc820 | train | function | def test_describe_nonexistent():
assert_command(['dcos', 'package', 'describe', 'xyzzy'],
stderr=b'Package [xyzzy] not found\n',
returncode=1)
| def test_describe_nonexistent():
| assert_command(['dcos', 'package', 'describe', 'xyzzy'],
stderr=b'Package [xyzzy] not found\n',
returncode=1)
| \n")
assert returncode == 1
assert stdout == b''
assert stderr == stderr_msg
for name, url in UNIVERSE_TEST_REPOS.items():
assert_command(['dcos', 'package', 'repo', 'add', name, url])
def test_describe_nonexistent():
| 64 | 64 | 43 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_nonexistent | test_describe_nonexistent | 188 | 191 | 188 | 188 | 918cd11eb4662a915a69a5d8e83c16b21a63b3fb | bigcode/the-stack | train |
570eaa588f2fc835fce87cb7 | train | function | def test_uninstall_multiple_apps():
stdout = (b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] version '
b'[0.1.0] with app id [/helloworld-1]\n'
b'A sample post-installation message\n')
_install_helloworld(['--yes', '--app-id=/... | def test_uninstall_multiple_apps():
| stdout = (b'A sample pre-installation message\n'
b'Installing Marathon app for package [helloworld] version '
b'[0.1.0] with app id [/helloworld-1]\n'
b'A sample post-installation message\n')
_install_helloworld(['--yes', '--app-id=/helloworld-1', '--app'],
... | /mesosphere/dcos-helloworld"
}
returncode_, stdout_, stderr_ = exec_command(
['dcos', 'package', 'list', '--json'])
assert stderr_ == b''
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-8'))[0]
assert output == stdout_json
_uninstall_helloworld()
def test_uninstall_m... | 91 | 91 | 304 | 7 | 84 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_uninstall_multiple_apps | test_uninstall_multiple_apps | 581 | 610 | 581 | 581 | aad8d3786d814eb5830e13ad1eaf89efbfa1bbab | bigcode/the-stack | train |
93cd3392819cdd9f650af81e | train | function | def _get_app_labels(app_id):
returncode, stdout, stderr = exec_command(
['dcos', 'marathon', 'app', 'show', app_id])
assert returncode == 0
assert stderr == b''
app_json = json.loads(stdout.decode('utf-8'))
return app_json.get('labels')
| def _get_app_labels(app_id):
| returncode, stdout, stderr = exec_command(
['dcos', 'marathon', 'app', 'show', app_id])
assert returncode == 0
assert stderr == b''
app_json = json.loads(stdout.decode('utf-8'))
return app_json.get('labels')
| *s', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert stderr == b''
registries = json.loads(stdout.decode('utf-8'))
assert len(registries['packages']) == 4
def _get_app_labels(app_id):
| 64 | 64 | 73 | 8 | 55 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _get_app_labels | _get_app_labels | 840 | 848 | 840 | 840 | f18f585c580da4a0ea54b8768c35db1164aa61d4 | bigcode/the-stack | train |
8d2aeb64808126e4d8d7cc6e | train | function | @pytest.fixture(scope="module")
def zk_znode(request):
request.addfinalizer(delete_zk_nodes)
return request
| @pytest.fixture(scope="module")
def zk_znode(request):
| request.addfinalizer(delete_zk_nodes)
return request
| setup_module(module):
setup_universe_server()
def teardown_module(module):
services = get_services()
for framework in services:
if framework['name'] == 'chronos':
service_shutdown(framework['id'])
teardown_universe_server()
@pytest.fixture(scope="module")
def zk_znode(request):
| 64 | 64 | 26 | 12 | 52 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | zk_znode | zk_znode | 44 | 47 | 44 | 45 | 74fd6fb89d3a6e5951fc9144e05cd8d631e2c324 | bigcode/the-stack | train |
c8a60cf2bfbc078db64a500a | train | function | @pytest.fixture
def env():
r = os.environ.copy()
r.update({constants.PATH_ENV: os.environ[constants.PATH_ENV]})
return r
| @pytest.fixture
def env():
| r = os.environ.copy()
r.update({constants.PATH_ENV: os.environ[constants.PATH_ENV]})
return r
| ments
from .helpers.package import (package_install, package_uninstall,
setup_universe_server, teardown_universe_server,
UNIVERSE_REPO, UNIVERSE_TEST_REPOS)
from .helpers.service import get_services, service_shutdown
from ..common import file_bytes
@pytest.fix... | 64 | 64 | 35 | 6 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | env | env | 23 | 28 | 23 | 24 | 817f10f5dee397e9355705955bb6d418dd65478c | bigcode/the-stack | train |
43249acab5bbd62afe91ef1d | train | function | def test_install_specific_version():
stdout = (b'We recommend a minimum of one node with at least 2 '
b'CPU\'s and 1GB of RAM available for the Marathon Service.\n'
b'Installing Marathon app for package [marathon] '
b'version [0.11.1]\n'
b'Marathon DCOS Servic... | def test_install_specific_version():
| stdout = (b'We recommend a minimum of one node with at least 2 '
b'CPU\'s and 1GB of RAM available for the Marathon Service.\n'
b'Installing Marathon app for package [marathon] '
b'version [0.11.1]\n'
b'Marathon DCOS Service has been successfully installed!\n\... | code=1)
_uninstall_helloworld()
def test_install_missing_options_file():
"""Test that a missing options file results in the expected stderr
message."""
assert_command(
['dcos', 'package', 'install', 'chronos', '--yes',
'--options=asdf.json'],
returncode=1,
stderr=b"Err... | 95 | 95 | 319 | 6 | 89 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_install_specific_version | test_install_specific_version | 364 | 390 | 364 | 364 | 8977b562a1d6fb74dc2fc136ab8c604373483dd5 | bigcode/the-stack | train |
a14359cead3e2afa968d4276 | train | function | def _uninstall_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0,
uninstalled=b'Uninstalled package [helloworld] version [0.1.0]\n'):
assert_command(['dcos', 'package', 'uninstall', 'helloworld'] + args,
stdout=stdout,
stderr=unin... | def _uninstall_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0,
uninstalled=b'Uninstalled package [helloworld] version [0.1.0]\n'):
| assert_command(['dcos', 'package', 'uninstall', 'helloworld'] + args,
stdout=stdout,
stderr=uninstalled+stderr,
returncode=returncode)
watch_all_deployments()
| =returncode,
stdin=stdin,
stderr=stderr)
def _uninstall_helloworld(
args=[],
stdout=b'',
stderr=b'',
returncode=0,
uninstalled=b'Uninstalled package [helloworld] version [0.1.0]\n'):
| 64 | 64 | 98 | 50 | 14 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _uninstall_helloworld | _uninstall_helloworld | 879 | 890 | 879 | 884 | 30a9ac973bc3bad58a3faeaa12d4ebfec739cdc0 | bigcode/the-stack | train |
96c6129fd6e5896d415e48d4 | train | function | @contextlib.contextmanager
def _chronos_package(
args=['--yes'],
returncode=0,
stdout=b'Installing Marathon app for package [chronos] '
b'version [3.0.1]\n',
stderr=b'',
pre_install_notes=b'We recommend a minimum of one node with at least '
... | @contextlib.contextmanager
def _chronos_package(
args=['--yes'],
returncode=0,
stdout=b'Installing Marathon app for package [chronos] '
b'version [3.0.1]\n',
stderr=b'',
pre_install_notes=b'We recommend a minimum of one node with at least '
... | _install_chronos(
args,
returncode,
stdout,
stderr,
pre_install_notes,
post_install_notes,
stdin)
try:
yield
finally:
_uninstall_chronos()
delete_zk_node('chronos')
watch_all_deployments()
| @contextlib.contextmanager
def _chronos_package(
args=['--yes'],
returncode=0,
stdout=b'Installing Marathon app for package [chronos] '
b'version [3.0.1]\n',
stderr=b'',
pre_install_notes=b'We recommend a minimum of one node with at least '
... | 171 | 71 | 237 | 171 | 0 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _chronos_package | _chronos_package | 952 | 983 | 952 | 969 | 5f85848e06b31838f5839d8952cd523b2cfaeaaa | bigcode/the-stack | train |
af01665fc7aa93de27e02a2a | train | function | def test_describe_app_cli():
stdout = file_bytes(
'tests/data/package/json/test_describe_app_cli.json')
assert_command(
['dcos', 'package', 'describe', 'kafka', '--app', '--cli'],
stdout=stdout)
| def test_describe_app_cli():
| stdout = file_bytes(
'tests/data/package/json/test_describe_app_cli.json')
assert_command(
['dcos', 'package', 'describe', 'kafka', '--app', '--cli'],
stdout=stdout)
| equality are more descriptive
assert base64_to_dict(value) == \
base64_to_dict(actual_labels.get(label))
else:
assert value == actual_labels.get(label)
assert stdout == stdout_
assert stderr == b''
assert returncode == 0
def test_describe_app_cli():
| 64 | 64 | 56 | 7 | 56 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_app_cli | test_describe_app_cli | 306 | 311 | 306 | 306 | e8698902877ec216b605bfa0ede9c13deec5ef0b | bigcode/the-stack | train |
df41894940daee7ab1534150 | train | function | def teardown_module(module):
services = get_services()
for framework in services:
if framework['name'] == 'chronos':
service_shutdown(framework['id'])
teardown_universe_server()
| def teardown_module(module):
| services = get_services()
for framework in services:
if framework['name'] == 'chronos':
service_shutdown(framework['id'])
teardown_universe_server()
| get_services, service_shutdown
from ..common import file_bytes
@pytest.fixture
def env():
r = os.environ.copy()
r.update({constants.PATH_ENV: os.environ[constants.PATH_ENV]})
return r
def setup_module(module):
setup_universe_server()
def teardown_module(module):
| 64 | 64 | 42 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | teardown_module | teardown_module | 35 | 41 | 35 | 35 | 5d002f8009b353d5486f1a3c7435694f06f3b406 | bigcode/the-stack | train |
3f76dfddb8f1cfa32028a201 | train | function | def test_package():
with open('dcoscli/data/help/package.txt') as content:
assert_command(['dcos', 'package', '--help'],
stdout=content.read().encode('utf-8'))
| def test_package():
| with open('dcoscli/data/help/package.txt') as content:
assert_command(['dcos', 'package', '--help'],
stdout=content.read().encode('utf-8'))
| get_services()
for framework in services:
if framework['name'] == 'chronos':
service_shutdown(framework['id'])
teardown_universe_server()
@pytest.fixture(scope="module")
def zk_znode(request):
request.addfinalizer(delete_zk_nodes)
return request
def test_package():
| 64 | 64 | 44 | 4 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_package | test_package | 50 | 53 | 50 | 50 | c1332193279e81775c0e98dc54b8b41f2b26fe0c | bigcode/the-stack | train |
b8e5f5ef553073ebf92b47d8 | train | function | def test_uninstall_multiple_frameworknames(zk_znode):
_install_chronos(
args=['--yes', '--options=tests/data/package/chronos-1.json'])
_install_chronos(
args=['--yes', '--options=tests/data/package/chronos-2.json'])
watch_all_deployments()
expected_output = file_json(
'tests/da... | def test_uninstall_multiple_frameworknames(zk_znode):
| _install_chronos(
args=['--yes', '--options=tests/data/package/chronos-1.json'])
_install_chronos(
args=['--yes', '--options=tests/data/package/chronos-2.json'])
watch_all_deployments()
expected_output = file_json(
'tests/data/package/json/test_list_chronos_two_users.json')
... | ', '--json', '--cli', 'helloworld'],
stdout=helloworld_json)
def test_cli_global():
helloworld_path = 'tests/data/package/json/test_list_helloworld_cli.json'
helloworld_json = file_json(helloworld_path)
with _helloworld_cli(global_=True):
assert os.path.exists(subcommand.global_packag... | 118 | 118 | 394 | 12 | 106 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_uninstall_multiple_frameworknames | test_uninstall_multiple_frameworknames | 717 | 754 | 717 | 717 | 6712bce6c1be1b2f75717944ebf4e62c0f9480b7 | bigcode/the-stack | train |
944ab7d6db4f5dfe35d01322 | train | function | def test_list_table():
with _helloworld():
assert_lines(['dcos', 'package', 'list'], 2)
| def test_list_table():
| with _helloworld():
assert_lines(['dcos', 'package', 'list'], 2)
| chronos'], stdout=expected_output)
le_package = 'ceci-nest-pas-une-package'
_list(args=['--json', le_package], stdout=empty)
_list(args=['--json', '--app-id=/' + le_package], stdout=empty)
def test_list_table():
| 64 | 64 | 27 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_list_table | test_list_table | 633 | 635 | 633 | 633 | 5f13f834e9d5af98918068a824e145a59fb9816e | bigcode/the-stack | train |
a9bf9a4c7aee5f338bcffb52 | train | function | def _list(args, stdout):
assert_command(['dcos', 'package', 'list'] + args, stdout=stdout)
| def _list(args, stdout):
| assert_command(['dcos', 'package', 'list'] + args, stdout=stdout)
| ,
returncode,
stdout,
stderr,
pre_install_notes,
post_install_notes,
stdin)
try:
yield
finally:
_uninstall_chronos()
delete_zk_node('chronos')
watch_all_deployments()
def _list(args, stdout):
| 64 | 64 | 27 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _list | _list | 986 | 987 | 986 | 986 | 2f5c29c9d4ea429fc81ecbddc6c4de9586ffefd8 | bigcode/the-stack | train |
4af55f79bf589258e2931c99 | train | function | def _executable_name(name):
if sys.platform == 'win32':
return name + b'.exe'
else:
return name
| def _executable_name(name):
| if sys.platform == 'win32':
return name + b'.exe'
else:
return name
| exec_command(
['dcos', 'marathon', 'app', 'show', app_id])
assert returncode == 0
assert stderr == b''
app_json = json.loads(stdout.decode('utf-8'))
return app_json.get('labels')
def _executable_name(name):
| 64 | 64 | 31 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _executable_name | _executable_name | 851 | 855 | 851 | 851 | ef912bc56db5c5d11fa91403241ab5ef47141822 | bigcode/the-stack | train |
9698421a18f3cd397ee16187 | train | function | def test_uninstall_cli():
_install_helloworld()
_uninstall_cli_helloworld(args=['--cli'])
stdout_json = {
"apps": [
"/helloworld"
],
"description": "Example DCOS application package",
"framework": False,
"maintainer": "support@mesosphere.io",
"nam... | def test_uninstall_cli():
| _install_helloworld()
_uninstall_cli_helloworld(args=['--cli'])
stdout_json = {
"apps": [
"/helloworld"
],
"description": "Example DCOS application package",
"framework": False,
"maintainer": "support@mesosphere.io",
"name": "helloworld",
... | '
_uninstall_chronos(
args=['--app-id=chronos-1'],
returncode=1,
stderr=stderr)
def test_uninstall_subcommand():
_install_helloworld()
_uninstall_helloworld()
_list(args=['--json'], stdout=b'[]\n')
def test_uninstall_cli():
| 75 | 75 | 250 | 6 | 69 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_uninstall_cli | test_uninstall_cli | 547 | 578 | 547 | 547 | 9ccf7ea9dc8d0b8c8007faae3aef7126be27a694 | bigcode/the-stack | train |
bc9d00684f6fc98794953793 | train | function | def test_describe_render():
stdout = file_json(
'tests/data/package/json/test_describe_marathon_app_render.json')
stdout = json.loads(stdout.decode('utf-8'))
expected_labels = stdout.pop("labels", None)
returncode, stdout_, stderr = exec_command(
['dcos', 'package', 'describe', 'maratho... | def test_describe_render():
| stdout = file_json(
'tests/data/package/json/test_describe_marathon_app_render.json')
stdout = json.loads(stdout.decode('utf-8'))
expected_labels = stdout.pop("labels", None)
returncode, stdout_, stderr = exec_command(
['dcos', 'package', 'describe', 'marathon', '--app', '--render'])
... | app'],
stdout=stdout)
def test_describe_config():
stdout = file_json(
'tests/data/package/json/test_describe_marathon_config.json')
assert_command(['dcos', 'package', 'describe', 'marathon', '--config'],
stdout=stdout)
def test_describe_render():
| 64 | 64 | 201 | 6 | 58 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_render | test_describe_render | 223 | 246 | 223 | 223 | 14dd7b5e5c92f4a33e72d3ba8c638b9d08b9905b | bigcode/the-stack | train |
9d408569b8ba62d13538dbf0 | train | function | def test_describe_package_versions():
stdout = file_bytes(
'tests/data/package/json/test_describe_kafka_package_versions.json')
assert_command(
['dcos', 'package', 'describe', 'kafka', '--package-versions'],
stdout=stdout)
| def test_describe_package_versions():
| stdout = file_bytes(
'tests/data/package/json/test_describe_kafka_package_versions.json')
assert_command(
['dcos', 'package', 'describe', 'kafka', '--package-versions'],
stdout=stdout)
| = b'Version [bogus] of package [marathon] not found\n'
assert_command(
['dcos', 'package', 'describe', 'marathon', '--package-version=bogus'],
returncode=1,
stderr=stderr)
def test_describe_package_versions():
| 64 | 64 | 57 | 7 | 57 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_package_versions | test_describe_package_versions | 271 | 276 | 271 | 271 | 59efd83e9ccc57046308abae6fe09f3afb33b759 | bigcode/the-stack | train |
b6071ea7450196648b0afd4f | train | function | def test_describe_package_version():
stdout = file_json(
'tests/data/package/json/test_describe_marathon_package_version.json')
returncode_, stdout_, stderr_ = exec_command(
['dcos', 'package', 'describe', 'marathon',
'--package-version=1.3.10'])
assert returncode_ == 0
out... | def test_describe_package_version():
| stdout = file_json(
'tests/data/package/json/test_describe_marathon_package_version.json')
returncode_, stdout_, stderr_ = exec_command(
['dcos', 'package', 'describe', 'marathon',
'--package-version=1.3.10'])
assert returncode_ == 0
output = json.loads(stdout_.decode('utf-... | equality are more descriptive
assert base64_to_dict(value) == \
base64_to_dict(actual_labels.get(label))
else:
assert value == actual_labels.get(label)
assert stdout == stdout_
assert stderr == b''
assert returncode == 0
def test_describe_package_version():
| 64 | 64 | 108 | 7 | 56 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_package_version | test_describe_package_version | 249 | 260 | 249 | 249 | 76948de112d2550b7a5439d2c5c7270ccc7e76ab | bigcode/the-stack | train |
5f1486b982a4095d1fe25883 | train | function | @contextlib.contextmanager
def _package(name,
args,
stdout=b'',
uninstall_stderr=b''):
"""Context manager that installs a package on entrance, and uninstalls it on
exit.
:param name: package name
:type name: str
:param args: extra CLI args
:type args: [str... | @contextlib.contextmanager
def _package(name,
args,
stdout=b'',
uninstall_stderr=b''):
| """Context manager that installs a package on entrance, and uninstalls it on
exit.
:param name: package name
:type name: str
:param args: extra CLI args
:type args: [str]
:param stdout: Expected stdout
:type stdout: bytes
:param uninstall_stderr: Expected stderr
:type uninstall_... | global_:
args += ['--global']
return _package(name='helloworld',
args=args,
stdout=HELLOWORLD_CLI_STDOUT,
uninstall_stderr=b'')
@contextlib.contextmanager
def _package(name,
args,
stdout=b'',
uninstall_stderr... | 67 | 67 | 225 | 26 | 41 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _package | _package | 1,019 | 1,054 | 1,019 | 1,023 | da1d07c8b931768a6793cd5bc0c9115c9535aae7 | bigcode/the-stack | train |
e095c2cee4f964cb33c5c1bb | train | function | def test_describe_config():
stdout = file_json(
'tests/data/package/json/test_describe_marathon_config.json')
assert_command(['dcos', 'package', 'describe', 'marathon', '--config'],
stdout=stdout)
| def test_describe_config():
| stdout = file_json(
'tests/data/package/json/test_describe_marathon_config.json')
assert_command(['dcos', 'package', 'describe', 'marathon', '--config'],
stdout=stdout)
| cli'],
stdout=stdout)
def test_describe_app():
stdout = file_bytes(
'tests/data/package/json/test_describe_app_marathon.json')
assert_command(['dcos', 'package', 'describe', 'marathon', '--app'],
stdout=stdout)
def test_describe_config():
| 64 | 64 | 51 | 6 | 58 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_describe_config | test_describe_config | 216 | 220 | 216 | 216 | 5f047b8061d9199047c362194fe9e23d61ec5560 | bigcode/the-stack | train |
f5371511dde9270feef11e7a | train | function | def test_list(zk_znode):
empty = b'[]\n'
_list(args=['--json'], stdout=empty)
_list(args=['xyzzy', '--json'], stdout=empty)
_list(args=['--app-id=/xyzzy', '--json'], stdout=empty)
with _chronos_package():
expected_output = file_json(
'tests/data/package/json/test_list_chronos.... | def test_list(zk_znode):
| empty = b'[]\n'
_list(args=['--json'], stdout=empty)
_list(args=['xyzzy', '--json'], stdout=empty)
_list(args=['--app-id=/xyzzy', '--json'], stdout=empty)
with _chronos_package():
expected_output = file_json(
'tests/data/package/json/test_list_chronos.json')
_list(args... | 1
_uninstall_helloworld(stderr=stderr,
returncode=returncode,
uninstalled=b'')
_uninstall_helloworld(args=['--all'], stdout=b'', stderr=b'', returncode=0)
watch_all_deployments()
def test_list(zk_znode):
| 64 | 64 | 191 | 8 | 56 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_list | test_list | 613 | 630 | 613 | 613 | 3f4308c375a4905c57540f60ed0f6dce943b5676 | bigcode/the-stack | train |
0e4a1c157aab3a20e078cad0 | train | function | def test_repo_add():
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
args = ["Universe", UNIVERSE_REPO]
_repo_ad... | def test_repo_add():
| repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
args = ["Universe", UNIVERSE_REPO]
_repo_add(args, repo_list)
| dcos_url with a cosmos_url config
dcos_url = config.get_config_val("core.dcos_url")
with update_config('package.cosmos_url', dcos_url):
assert_command(['dcos', 'package', 'repo', 'list'], stdout=repo_list)
def test_repo_add():
| 64 | 64 | 97 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_repo_add | test_repo_add | 84 | 95 | 84 | 84 | ce68f5858d1598a6c4fe24d29910bbf6c276dfcd | bigcode/the-stack | train |
3f877b73a718a4fa79b064c7 | train | function | def _helloworld_cli(global_=False):
args = ['--yes', '--cli']
if global_:
args += ['--global']
return _package(name='helloworld',
args=args,
stdout=HELLOWORLD_CLI_STDOUT,
uninstall_stderr=b'')
| def _helloworld_cli(global_=False):
| args = ['--yes', '--cli']
if global_:
args += ['--global']
return _package(name='helloworld',
args=args,
stdout=HELLOWORLD_CLI_STDOUT,
uninstall_stderr=b'')
| post-installation message\n')
stderr = b'Uninstalled package [helloworld] version [0.1.0]\n'
return _package(name='helloworld',
args=['--yes'],
stdout=stdout,
uninstall_stderr=stderr)
def _helloworld_cli(global_=False):
| 64 | 64 | 62 | 9 | 55 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | _helloworld_cli | _helloworld_cli | 1,009 | 1,016 | 1,009 | 1,009 | 14ee464fd673c56a27ec93eaf8731032e173f90f | bigcode/the-stack | train |
8bbc2f2209b33588aad52b3f | train | function | def test_repo_list():
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
).format(**UNIVERSE_TEST_REPOS),
'utf-8'
)
assert_command(['dcos', 'package', 'repo', 'list'], stdout=repo_list)
# test again, bu... | def test_repo_list():
| repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
).format(**UNIVERSE_TEST_REPOS),
'utf-8'
)
assert_command(['dcos', 'package', 'repo', 'list'], stdout=repo_list)
# test again, but override the dcos_ur... | = b"Install and manage DC/OS software packages\n"
assert_command(['dcos', 'package', '--info'],
stdout=info)
def test_version():
assert_command(['dcos', 'package', '--version'],
stdout=b'dcos-package version SNAPSHOT\n')
def test_repo_list():
| 64 | 64 | 148 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_repo_list | test_repo_list | 67 | 81 | 67 | 67 | 68c656211a68cd984307cdb207f81b3f802d44ea | bigcode/the-stack | train |
c74e1c99558428083dde3aeb | train | function | def test_uninstall_with_id(zk_znode):
_uninstall_chronos(args=['--app-id=chronos-1'])
| def test_uninstall_with_id(zk_znode):
| _uninstall_chronos(args=['--app-id=chronos-1'])
| , stdout=stdout)
def test_install_missing_package():
stderr = b'Package [missing-package] not found\n'
assert_command(['dcos', 'package', 'install', 'missing-package'],
returncode=1,
stderr=stderr)
def test_uninstall_with_id(zk_znode):
| 64 | 64 | 29 | 11 | 53 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_uninstall_with_id | test_uninstall_with_id | 522 | 523 | 522 | 522 | f3366303d30ea6e40783eaf7660de2304673f1e6 | bigcode/the-stack | train |
a12c7c884a5e1da1bba779f2 | train | function | def test_list_cli():
_install_helloworld()
stdout = file_json(
'tests/data/package/json/test_list_helloworld.json')
_list(args=['--json'], stdout=stdout)
_uninstall_helloworld()
stdout = (b"Installing CLI subcommand for package [helloworld] " +
b"version [0.1.0]\n"
... | def test_list_cli():
| _install_helloworld()
stdout = file_json(
'tests/data/package/json/test_list_helloworld.json')
_list(args=['--json'], stdout=stdout)
_uninstall_helloworld()
stdout = (b"Installing CLI subcommand for package [helloworld] " +
b"version [0.1.0]\n"
b"New command avai... | with open('tests/data/package/assume_no.txt') as no_file:
_install_helloworld(
args=[],
stdin=no_file,
stdout=b'A sample pre-installation message\n'
b'Continue installing? [yes/no] Exiting installation.\n')
def test_list_cli():
| 64 | 64 | 168 | 5 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_list_cli | test_list_cli | 664 | 682 | 664 | 664 | 4b16b3f10e528ccd0152d532a869485e2de781be | bigcode/the-stack | train |
5b77aecdc2ca33756269299e | train | function | def test_install_missing_package():
stderr = b'Package [missing-package] not found\n'
assert_command(['dcos', 'package', 'install', 'missing-package'],
returncode=1,
stderr=stderr)
| def test_install_missing_package():
| stderr = b'Package [missing-package] not found\n'
assert_command(['dcos', 'package', 'install', 'missing-package'],
returncode=1,
stderr=stderr)
| 2', '--yes']
stdout = (
b'Installing Marathon app for package [chronos] version [3.0.1] with '
b'app id [chronos-2]\n'
)
_install_chronos(args=args, stdout=stdout)
def test_install_missing_package():
| 64 | 64 | 48 | 6 | 58 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_install_missing_package | test_install_missing_package | 515 | 519 | 515 | 515 | 9aff16287f97ca9b4638f936be5d799f5a1ba062 | bigcode/the-stack | train |
5c82183478e0fd368b15a138 | train | function | def test_repo_remove_multi():
# Add "Universe" repo so we can test removing it
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf... | def test_repo_remove_multi():
# Add "Universe" repo so we can test removing it
| repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
"Universe: {0}\n"
).format(UNIVERSE_REPO, **UNIVERSE_TEST_REPOS),
'utf-8'
)
args = ["Universe", UNIVERSE_REPO]
_repo_add(args, repo_list)
... | )
_repo_remove(['1.7-universe'], repo_list)
repo_list = bytes(
(
"test-universe: {test-universe}\n"
"helloworld-universe: {helloworld-universe}\n"
).format(**UNIVERSE_TEST_REPOS),
'utf-8'
)
_repo_remove(['Universe'], repo_list)
def test_repo_remove_multi... | 100 | 100 | 336 | 20 | 80 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_repo_remove_multi | test_repo_remove_multi | 135 | 169 | 135 | 136 | 5ed573689e3c2e57d3f9c2b04c2f40e0254bc09e | bigcode/the-stack | train |
a937c9a8567499292f6cb63d | train | function | def test_info():
info = b"Install and manage DC/OS software packages\n"
assert_command(['dcos', 'package', '--info'],
stdout=info)
| def test_info():
| info = b"Install and manage DC/OS software packages\n"
assert_command(['dcos', 'package', '--info'],
stdout=info)
| ):
request.addfinalizer(delete_zk_nodes)
return request
def test_package():
with open('dcoscli/data/help/package.txt') as content:
assert_command(['dcos', 'package', '--help'],
stdout=content.read().encode('utf-8'))
def test_info():
| 63 | 64 | 37 | 4 | 59 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_info | test_info | 56 | 59 | 56 | 56 | de4e394d2bb1fb6422cf334ae52b8d7ca55febdb | bigcode/the-stack | train |
70f85e326b5c5a79e4249dea | train | function | def test_search_ends_with_wildcard():
returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'c*', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert b'cassandra' in stdout
assert stderr == b''
registries = json.loads(stdout.decode('utf-8'))
# co... | def test_search_ends_with_wildcard():
| returncode, stdout, stderr = exec_command(
['dcos', 'package', 'search', 'c*', '--json'])
assert returncode == 0
assert b'chronos' in stdout
assert b'cassandra' in stdout
assert stderr == b''
registries = json.loads(stdout.decode('utf-8'))
# cosmos matches wildcards in name/descrip... | ['dcos', 'package', 'search'])
assert returncode == 0
assert b'chronos' in stdout
assert len(stdout.decode('utf-8').split('\n')) > 5
assert stderr == b''
def test_search_ends_with_wildcard():
| 63 | 64 | 127 | 10 | 53 | christopherhein/dcos-cli | cli/tests/integrations/test_package.py | Python | test_search_ends_with_wildcard | test_search_ends_with_wildcard | 801 | 813 | 801 | 801 | 0a54edae7ad6c0b84d6d82a1d558265400588806 | bigcode/the-stack | train |
055163586845b67230315e5b | train | function | def __healSmooch(heal, hasInteractivePropHealBonus):
toon = heal['toon']
target = heal['target']['toon']
level = heal['level']
hp = heal['target']['hp']
ineffective = heal['sidestep']
track = Sequence(__runToHealSpot(heal))
lipstick = globalPropPool.getProp('lipstick')
lipstick2 = MovieU... | def __healSmooch(heal, hasInteractivePropHealBonus):
| toon = heal['toon']
target = heal['target']['toon']
level = heal['level']
hp = heal['target']['hp']
ineffective = heal['sidestep']
track = Sequence(__runToHealSpot(heal))
lipstick = globalPropPool.getProp('lipstick')
lipstick2 = MovieUtil.copyProp(lipstick)
lipsticks = [lipstick, lip... | targets:
targetToon = target['toon']
hp = target['hp']
reactTrack.append(Func(__healToon, targetToon, hp, ineffective, hasInteractivePropHealBonus))
reactTrack.append(Wait(dTargetLaugh))
for target in targets:
targetToon = target['toon']
reactTrack.append(Func(targetToo... | 174 | 174 | 580 | 15 | 158 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healSmooch | __healSmooch | 231 | 261 | 231 | 231 | 2745ebcc16f0832d1ad23f934e359b8719bc85be | bigcode/the-stack | train |
e70bc00e04ef65a96d827761 | train | function | def __healJoke(heal, hasInteractivePropHealBonus):
npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
level... | def __healJoke(heal, hasInteractivePropHealBonus):
| npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
level = heal['level']
if npcId == 4141:
joke... | (tFeatherScaleUp), Func(MovieUtil.showProps, feathers, hands), Func(scaleFeathers, feathers), MovieUtil.getScaleIntervals(feathers, dFeatherScaleUp, MovieUtil.PNT3_NEARZERO, feathers[0].getScale)), Sequence(Wait(toon.getDuration('tickle') - dFeatherScaleDown), MovieUtil.getScaleIntervals(feathers, dFeatherScaleDown, No... | 237 | 237 | 792 | 14 | 222 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healJoke | __healJoke | 168 | 228 | 168 | 168 | 1fb7825f1276be9a5db2c1eb000382e8df01b53e | bigcode/the-stack | train |
d499e80ff5131679320fb8dd | train | function | def stopLook(toonsInBattle):
for someToon in toonsInBattle:
someToon.stopStareAt()
| def stopLook(toonsInBattle):
| for someToon in toonsInBattle:
someToon.stopStareAt()
| return track
def add3(t1, t2):
returnThree = Point3(t1[0] + t2[0], t1[1] + t2[1], t1[2] + t2[2])
return returnThree
def stopLook(toonsInBattle):
| 64 | 64 | 28 | 8 | 55 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | stopLook | stopLook | 483 | 485 | 483 | 483 | ba494d6c17114fd80fc9d7a9e3c112f4fb0aa185 | bigcode/the-stack | train |
b5045acc0d25d7327d7190c5 | train | function | def __runToHealSpot(heal):
toon = heal['toon']
battle = heal['battle']
level = heal['level']
origPos, origHpr = battle.getActorPosHpr(toon)
runAnimI = ActorInterval(toon, 'run', duration=runHealTime)
a = Func(toon.headsUp, battle, healPos)
b = Parallel(runAnimI, LerpPosInterval(toon, runHeal... | def __runToHealSpot(heal):
| toon = heal['toon']
battle = heal['battle']
level = heal['level']
origPos, origHpr = battle.getActorPosHpr(toon)
runAnimI = ActorInterval(toon, 'run', duration=runHealTime)
a = Func(toon.headsUp, battle, healPos)
b = Parallel(runAnimI, LerpPosInterval(toon, runHealTime, healPos, other=battle... | (heal, hasInteractivePropHealBonus)
if level == 5:
return __healJuggle(heal, hasInteractivePropHealBonus)
if level == 6:
return __healDive(heal, hasInteractivePropHealBonus)
return
def __runToHealSpot(heal):
| 64 | 64 | 181 | 9 | 54 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __runToHealSpot | __runToHealSpot | 57 | 71 | 57 | 57 | 2489442d706a52be3f16331e3a5dc45a026b686a | bigcode/the-stack | train |
1907349895852bf9937727d4 | train | function | def __healTickle(heal, hasInteractivePropHealBonus):
toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
track = Sequence(__runToHealSpot(heal))
feather = globalPropPool.getProp('feather')
feather2 = MovieUtil... | def __healTickle(heal, hasInteractivePropHealBonus):
| toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
track = Sequence(__runToHealSpot(heal))
feather = globalPropPool.getProp('feather')
feather2 = MovieUtil.copyProp(feather)
feathers = [feather, feather2]... | == 3:
worldRelative = partExtraArgs[2]
else:
worldRelative = 1
return Sequence(Wait(startDelay), ParticleInterval(pEffect, parent, worldRelative, duration=durationDelay, cleanup=True))
def __getSoundTrack(level, delay, duration=None, node=None):
soundEffect = globalBattleSoundCache.getSou... | 159 | 159 | 531 | 14 | 144 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healTickle | __healTickle | 127 | 165 | 127 | 127 | 13803c598e5f3a7c1637ea6840058fb890922a95 | bigcode/the-stack | train |
7516b9fd25f8dce6b131ca71 | train | function | def __returnToBase(heal):
toon = heal['toon']
battle = heal['battle']
origPos, origHpr = battle.getActorPosHpr(toon)
runAnimI = ActorInterval(toon, 'run', duration=runHealTime)
a = Func(toon.headsUp, battle, origPos)
b = Parallel(runAnimI, LerpPosInterval(toon, runHealTime, origPos, other=battle... | def __returnToBase(heal):
| toon = heal['toon']
battle = heal['battle']
origPos, origHpr = battle.getActorPosHpr(toon)
runAnimI = ActorInterval(toon, 'run', duration=runHealTime)
a = Func(toon.headsUp, battle, origPos)
b = Parallel(runAnimI, LerpPosInterval(toon, runHealTime, origPos, other=battle))
c = Func(toon.setHp... | .setHpr, battle, healHpr)
else:
target = heal['target']['toon']
targetPos = target.getPos(battle)
c = Func(toon.headsUp, battle, targetPos)
return Sequence(a, b, c)
def __returnToBase(heal):
| 64 | 64 | 137 | 8 | 56 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __returnToBase | __returnToBase | 74 | 83 | 74 | 74 | f7b41f0c35510584687f500e1ea7cdeb924ed99f | bigcode/the-stack | train |
279fc031280e2cd74211fd8c | train | function | def add3(t1, t2):
returnThree = Point3(t1[0] + t2[0], t1[1] + t2[1], t1[2] + t2[2])
return returnThree
| def add3(t1, t2):
| returnThree = Point3(t1[0] + t2[0], t1[1] + t2[1], t1[2] + t2[2])
return returnThree
| track.append(MovieNPCSOS.teleportOut(heal, toon))
else:
track.append(__returnToBase(heal))
for target in targets:
targetToon = target['toon']
track.append(Func(targetToon.clearChat))
return track
def add3(t1, t2):
| 64 | 64 | 53 | 9 | 54 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | add3 | add3 | 478 | 480 | 478 | 478 | 8d468c460ac2f81bf63a6276f13043d4c7134050 | bigcode/the-stack | train |
b09bf6dc1378d98c44ca33eb | train | function | def __healSprinkle(heal, hasInteractivePropHealBonus):
toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
track = Sequence(__runToHealSpot(heal))
sprayEffect = BattleParticles.createParticleEffect(file='pixieSpra... | def __healSprinkle(heal, hasInteractivePropHealBonus):
| toon = heal['toon']
target = heal['target']['toon']
hp = heal['target']['hp']
ineffective = heal['sidestep']
level = heal['level']
track = Sequence(__runToHealSpot(heal))
sprayEffect = BattleParticles.createParticleEffect(file='pixieSpray')
dropEffect = BattleParticles.createParticleEffe... | Interval(toon, 'happy-dance'), __getSoundTrack(level, 0.2, duration=6.4, node=toon), targetTrack)
track.append(Func(toon.loop, 'neutral'))
track.append(Wait(0.1))
track.append(mtrack)
if npcId != 0:
track.append(MovieNPCSOS.teleportOut(heal, toon))
else:
track.append(__returnToBase(h... | 138 | 138 | 461 | 14 | 123 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healSprinkle | __healSprinkle | 317 | 344 | 317 | 317 | c68607e393d756f866c4a208b797924d64e9a5ea | bigcode/the-stack | train |
3efe93af23226ddb03e51220 | train | function | def doHeals(heals, hasInteractivePropHealBonus):
if len(heals) == 0:
return (None, None)
else:
track = Sequence()
for h in heals:
ival = __doHealLevel(h, hasInteractivePropHealBonus)
if ival:
track.append(ival)
camDuration = track.getDurat... | def doHeals(heals, hasInteractivePropHealBonus):
| if len(heals) == 0:
return (None, None)
else:
track = Sequence()
for h in heals:
ival = __doHealLevel(h, hasInteractivePropHealBonus)
if ival:
track.append(ival)
camDuration = track.getDuration()
camTrack = MovieCamera.chooseHealSh... | AA_heal_High_Dive.ogg')
healPos = Point3(0, 0, 0)
healHpr = Vec3(180.0, 0, 0)
runHealTime = 1.0
def doHeals(heals, hasInteractivePropHealBonus):
| 64 | 64 | 106 | 14 | 49 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | doHeals | doHeals | 21 | 34 | 21 | 21 | 2e2e5af02549586dc01d76b740940b9bd1b57cd4 | bigcode/the-stack | train |
24608684246671231e949e84 | train | function | def __getSoundTrack(level, delay, duration=None, node=None):
soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
soundIntervals = Sequence()
if soundEffect:
if duration:
playSound = SoundInterval(soundEffect, duration=duration, node=node)
else:
playSound ... | def __getSoundTrack(level, delay, duration=None, node=None):
| soundEffect = globalBattleSoundCache.getSound(soundFiles[level])
soundIntervals = Sequence()
if soundEffect:
if duration:
playSound = SoundInterval(soundEffect, duration=duration, node=node)
else:
playSound = SoundInterval(soundEffect, node=node)
soundInterval... | 3:
worldRelative = partExtraArgs[2]
else:
worldRelative = 1
return Sequence(Wait(startDelay), ParticleInterval(pEffect, parent, worldRelative, duration=durationDelay, cleanup=True))
def __getSoundTrack(level, delay, duration=None, node=None):
| 64 | 64 | 95 | 15 | 49 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __getSoundTrack | __getSoundTrack | 114 | 124 | 114 | 114 | 67a5c6325376ab07452831d87e39524631468a7c | bigcode/the-stack | train |
1997463105c0c0bc6d47c267 | train | function | def __getPartTrack(particleEffect, startDelay, durationDelay, partExtraArgs):
pEffect = partExtraArgs[0]
parent = partExtraArgs[1]
if len(partExtraArgs) == 3:
worldRelative = partExtraArgs[2]
else:
worldRelative = 1
return Sequence(Wait(startDelay), ParticleInterval(pEffect, parent, ... | def __getPartTrack(particleEffect, startDelay, durationDelay, partExtraArgs):
| pEffect = partExtraArgs[0]
parent = partExtraArgs[1]
if len(partExtraArgs) == 3:
worldRelative = partExtraArgs[2]
else:
worldRelative = 1
return Sequence(Wait(startDelay), ParticleInterval(pEffect, parent, worldRelative, duration=durationDelay, cleanup=True))
| toon.toonUp(hp, hasInteractivePropHealBonus)
else:
notify.debug('__healToon() - toon: %d hp: %d' % (toon.doId, hp))
return
def __getPartTrack(particleEffect, startDelay, durationDelay, partExtraArgs):
| 64 | 64 | 95 | 19 | 44 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __getPartTrack | __getPartTrack | 104 | 111 | 104 | 104 | 1856186e0645e75e6943cb698842f4a054c1638f | bigcode/the-stack | train |
b309798c86762dd2bc7123f9 | train | function | def __healJuggle(heal, hasInteractivePropHealBonus):
npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
lev... | def __healJuggle(heal, hasInteractivePropHealBonus):
| npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
level = heal['level']
if npcId != 0:
track =... | ofEffect, target, 0]), __getPartTrack(wallEffect, 4.05, 1.2, [wallEffect, toon, 0]), __getSoundTrack(level, 2, duration=4.1, node=toon), Sequence(Func(face90), ActorInterval(toon, 'sprinkle-dust')), Sequence(Wait(delay), Func(__healToon, target, hp, ineffective, hasInteractivePropHealBonus)))
track.append(mtrack)
... | 135 | 135 | 450 | 14 | 120 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healJuggle | __healJuggle | 347 | 390 | 347 | 347 | cdb378eaf93bd754aacce6dc17947f6f82fd734a | bigcode/the-stack | train |
8560c92bd2b0b5357070b104 | train | function | def __doHealLevel(heal, hasInteractivePropHealBonus):
level = heal['level']
if level == 0:
return __healTickle(heal, hasInteractivePropHealBonus)
else:
if level == 1:
return __healJoke(heal, hasInteractivePropHealBonus)
if level == 2:
return __healSmooch(heal,... | def __doHealLevel(heal, hasInteractivePropHealBonus):
| level = heal['level']
if level == 0:
return __healTickle(heal, hasInteractivePropHealBonus)
else:
if level == 1:
return __healJoke(heal, hasInteractivePropHealBonus)
if level == 2:
return __healSmooch(heal, hasInteractivePropHealBonus)
if level == 3:
... | hasInteractivePropHealBonus)
if ival:
track.append(ival)
camDuration = track.getDuration()
camTrack = MovieCamera.chooseHealShot(heals, camDuration)
return (
track, camTrack)
def __doHealLevel(heal, hasInteractivePropHealBonus):
| 64 | 64 | 180 | 14 | 50 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __doHealLevel | __doHealLevel | 37 | 54 | 37 | 37 | acd238a3dbb11e8e38069718fac7aed9068114aa | bigcode/the-stack | train |
e1745436f5305179dc987487 | train | function | def toonsLook(toons, someNode, offset):
for someToon in toons:
someToon.startStareAt(someNode, offset) | def toonsLook(toons, someNode, offset):
| for someToon in toons:
someToon.startStareAt(someNode, offset) | 1] + t2[1], t1[2] + t2[2])
return returnThree
def stopLook(toonsInBattle):
for someToon in toonsInBattle:
someToon.stopStareAt()
def toonsLook(toons, someNode, offset):
| 64 | 64 | 35 | 12 | 52 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | toonsLook | toonsLook | 488 | 490 | 488 | 488 | c8070921c86e34fbf5b600054e533b188ad813c6 | bigcode/the-stack | train |
f96b75c49badfe5bfe72b0b1 | train | function | def __healDance(heal, hasInteractivePropHealBonus):
npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
leve... | def __healDance(heal, hasInteractivePropHealBonus):
| npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidestep']
level = heal['level']
if npcId != 0:
track =... | , 3, 3), startScale=MovieUtil.PNT3_NEARZERO), Wait(tThrow - tLips - dScale), LerpPosInterval(lips, dThrow, Point3(target.getPos() + Point3(0, 0, target.getHeight()))), Func(MovieUtil.removeProp, lips))
delay = tThrow + dThrow
mtrack = Parallel(lipstickTrack, lipsTrack, __getSoundTrack(level, 2, node=toon), Sequ... | 189 | 189 | 630 | 13 | 175 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healDance | __healDance | 264 | 314 | 264 | 264 | 28ae0d4ddd5b37fd2efac5785e526387310f7853 | bigcode/the-stack | train |
20d7a2143da1d14bb24c6315 | train | function | def __healDive(heal, hasInteractivePropHealBonus):
splash = Splash.Splash(render)
splash.reparentTo(render)
npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targ... | def __healDive(heal, hasInteractivePropHealBonus):
| splash = Splash.Splash(render)
splash.reparentTo(render)
npcId = 0
if 'npcId' in heal:
npcId = heal['npcId']
toon = NPCToons.createLocalNPC(npcId)
if toon == None:
return
else:
toon = heal['toon']
targets = heal['target']
ineffective = heal['sidest... | targetTrack.append(Wait(delay))
first = 0
targetTrack.append(reactIval)
cube = globalPropPool.getProp('cubes')
cube2 = MovieUtil.copyProp(cube)
cubes = [cube, cube2]
hips = [toon.getLOD(toon.getLODNames()[0]).find('**/joint_hips'), toon.getLOD(toon.getLODNames()[1]).find('**/joint_... | 256 | 256 | 1,426 | 13 | 242 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healDive | __healDive | 393 | 475 | 393 | 393 | dbc0d6f37bffbe684e2366139878e28a3061fbc8 | bigcode/the-stack | train |
1ecb4e920210ca457f899809 | train | function | def __healToon(toon, hp, ineffective, hasInteractivePropHealBonus):
notify.debug('healToon() - toon: %d hp: %d ineffective: %d' % (toon.doId, hp, ineffective))
if ineffective == 1:
laughter = random.choice(TTLocalizer.MovieHealLaughterMisses)
else:
maxDam = AvPropDamage[0][1][0][1]
i... | def __healToon(toon, hp, ineffective, hasInteractivePropHealBonus):
| notify.debug('healToon() - toon: %d hp: %d ineffective: %d' % (toon.doId, hp, ineffective))
if ineffective == 1:
laughter = random.choice(TTLocalizer.MovieHealLaughterMisses)
else:
maxDam = AvPropDamage[0][1][0][1]
if hp >= maxDam - 1:
laughter = random.choice(TTLocalizer... | , origPos, other=battle))
c = Func(toon.setHpr, battle, origHpr)
d = Func(toon.loop, 'neutral')
return Sequence(a, b, c, d)
def __healToon(toon, hp, ineffective, hasInteractivePropHealBonus):
| 64 | 64 | 210 | 18 | 46 | TTOFFLINE-LEAK/ttoffline | v1.0.0.test/toontown/battle/MovieHeal.py | Python | __healToon | __healToon | 86 | 101 | 86 | 86 | bbcd9f78c7deeba41563d3df5b33ad3602597cba | bigcode/the-stack | train |
3f9139206099d13e32047d44 | train | function | def test_passthru():
model_pt = PassthruModel()
config_dict = {}
model_pt.set_config(config_dict)
dut = PassThroughMod()
magma_dut = k.util.to_magma(dut,
flatten_array=True,
check_flip_flop_always_ff=False)
tester = fault.Tester(m... | def test_passthru():
| model_pt = PassthruModel()
config_dict = {}
model_pt.set_config(config_dict)
dut = PassThroughMod()
magma_dut = k.util.to_magma(dut,
flatten_array=True,
check_flip_flop_always_ff=False)
tester = fault.Tester(magma_dut, magma_dut.cl... | from lake.models.passthru_model import PassthruModel
from lake.modules.passthru import PassThroughMod
import magma as m
from magma import *
import fault
import tempfile
from kratos import *
import random as rand
import kratos as k
import pytest
def test_passthru():
| 66 | 71 | 237 | 6 | 59 | StanfordAHA/Lake | tests/test_passthru.py | Python | test_passthru | test_passthru | 13 | 48 | 13 | 14 | 3bbe8ad82f9b298b3df3fe5d3bc268ae488c2a90 | bigcode/the-stack | train |
22e11aea4d70e7ca5a8e56cf | train | class | class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Post.title'
db.alter_column('feedjack_post', 'title', self.gf('django.db.models.fields.CharField')(max_length=2047))
# Changing field 'Post.link'
db.alter_column('feedjack_post', 'link', self.gf('django.d... | class Migration(SchemaMigration):
| def forwards(self, orm):
# Changing field 'Post.title'
db.alter_column('feedjack_post', 'title', self.gf('django.db.models.fields.CharField')(max_length=2047))
# Changing field 'Post.link'
db.alter_column('feedjack_post', 'link', self.gf('django.db.models.fields.URLField')(max_leng... | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
| 37 | 256 | 2,227 | 6 | 30 | allo-/feedjack | feedjack/migrations.south/0016_auto__chg_field_post_title__chg_field_post_link.py | Python | Migration | Migration | 8 | 128 | 8 | 9 | 86830cc4827a176334d9000a1605137d3069e939 | bigcode/the-stack | train |
815192b1344487fb16d704d5 | train | class | class SettingsDialog(Factory.Popup):
def __init__(self, app):
self.app = app
self.plugins = self.app.plugins
self.config = self.app.electrum_config
Factory.Popup.__init__(self)
layout = self.ids.scrollviewlayout
layout.bind(minimum_height=layout.setter('height'))
... | class SettingsDialog(Factory.Popup):
| def __init__(self, app):
self.app = app
self.plugins = self.app.plugins
self.config = self.app.electrum_config
Factory.Popup.__init__(self)
layout = self.ids.scrollviewlayout
layout.bind(minimum_height=layout.setter('height'))
# cached dialogs
self._fx... | .boolean_dialog, 'use_rbf', _('Replace by fee'), self.message)
CardSeparator
SettingsItem:
status: _('Yes') if app.use_unconfirmed else _('No')
title: _('Spend unconfirmed') + ': ' + self.status
description: _("Use unconfirmed c... | 255 | 256 | 1,096 | 7 | 248 | BTCPrime/electrum | gui/kivy/uix/dialogs/settings.py | Python | SettingsDialog | SettingsDialog | 97 | 220 | 97 | 98 | 16e242dc82e73b38b64e3dea94d402591e178390 | bigcode/the-stack | train |
92e19b96b4d4874414a80ec5 | train | class | class VideoManager(models.Manager):
def search_by_description(self,query):
query = query.lower()
videos = Video.objects.all()
filtered_videos = [video for video in videos if query in video.description.lower()]
return filtered_videos
def search_by_title(self,query):
query... | class VideoManager(models.Manager):
| def search_by_description(self,query):
query = query.lower()
videos = Video.objects.all()
filtered_videos = [video for video in videos if query in video.description.lower()]
return filtered_videos
def search_by_title(self,query):
query = query.lower()
videos = Vi... | from django.db import models
class VideoManager(models.Manager):
| 12 | 64 | 98 | 6 | 5 | dragonman164/Youtube-BASIC-API- | API/models.py | Python | VideoManager | VideoManager | 4 | 15 | 4 | 4 | 6f65f1c3aa4003a019597ada32c0bca4ee856cea | bigcode/the-stack | train |
b5905cdf4d698b11ea127afe | train | class | class Video(models.Model):
id = models.CharField(primary_key=True,max_length=100,null = False,blank=False)
title = models.CharField(max_length=100,null = False, blank = False)
description = models.TextField(null = True, blank = True)
publishing_date_time = models.DateTimeField(null = False, blank = Fals... | class Video(models.Model):
| id = models.CharField(primary_key=True,max_length=100,null = False,blank=False)
title = models.CharField(max_length=100,null = False, blank = False)
description = models.TextField(null = True, blank = True)
publishing_date_time = models.DateTimeField(null = False, blank = False)
thumbnail_URL = mode... | query in video.description.lower()]
return filtered_videos
def search_by_title(self,query):
query = query.lower()
videos = Video.objects.all()
filtered_videos = [video for video in videos if query in video.title.lower()]
return filtered_videos
class Video(models.Model):
| 63 | 64 | 99 | 5 | 57 | dragonman164/Youtube-BASIC-API- | API/models.py | Python | Video | Video | 19 | 26 | 19 | 19 | 07386497b450be6c8f4614dc1b4c3cc1dc5c1ac7 | bigcode/the-stack | train |
7aca0635830b63013f40c3ab | train | class | class ResNet50(BaseModel):
"""resnet50"""
def __init__(self, *args, **kwargs):
"""TODO: to be defined1. """
BaseModel.__init__(self, *args, **kwargs)
def _setup_model(self):
"""setup ResNet50
Returns: TODO
"""
model_input = keras.layers.Input(self._input_sh... | class ResNet50(BaseModel):
| """resnet50"""
def __init__(self, *args, **kwargs):
"""TODO: to be defined1. """
BaseModel.__init__(self, *args, **kwargs)
def _setup_model(self):
"""setup ResNet50
Returns: TODO
"""
model_input = keras.layers.Input(self._input_shape)
base_model = r... | # author: klaus
# email: klaus.cheng@qq.com
# created date: 2018/01/08
# description:
#
#================================================================
import keras
from keras.applications import resnet50
from .base_model import BaseModel
class ResNet50(BaseModel):
| 64 | 64 | 165 | 7 | 56 | klauscc/keras-extra | keras_extra/applications/resnet50.py | Python | ResNet50 | ResNet50 | 20 | 40 | 20 | 20 | 3fdbf2b56a61b7f72778e29be7b5ed8ea19fd25b | bigcode/the-stack | train |
ea07be7d9693b2847880862d | train | class | class ChoiceStep(Step):
""" Base class for steps that can have multiple transitions """
def __init__(self, next_step_selector=None, *args, **kwargs):
self.next_step_selector = next_step_selector or self._next_step_selector
super().__init__(*args, **kwargs)
def transition(self, *args, **kwa... | class ChoiceStep(Step):
| """ Base class for steps that can have multiple transitions """
def __init__(self, next_step_selector=None, *args, **kwargs):
self.next_step_selector = next_step_selector or self._next_step_selector
super().__init__(*args, **kwargs)
def transition(self, *args, **kwargs):
next_step ... | .next_step:
return self.state, self.next_step
else:
return self.state, None
def add_action(self, action=None, *args, **kwargs):
""" Add an action to the action list. """
if action:
self.actions.append(action())
class ChoiceStep(Step):
| 64 | 64 | 115 | 6 | 58 | richardschris/flow | flow/steps/__init__.py | Python | ChoiceStep | ChoiceStep | 57 | 70 | 57 | 57 | 87de4c9d55184cf6a752515fe2713ad9cdb8ee21 | bigcode/the-stack | train |
276df186a740f38f7a67aef6 | train | class | class Step(Base, AddStepMixin, WorkflowSearchMixin):
""" Base class for steps
attributes:
- actions: a list of actions the step performs
- next_step: the next step
- state: the state from the workflow
"""
actions = []
next_step = None
state = None
def __init__(self, next_ste... | class Step(Base, AddStepMixin, WorkflowSearchMixin):
| """ Base class for steps
attributes:
- actions: a list of actions the step performs
- next_step: the next step
- state: the state from the workflow
"""
actions = []
next_step = None
state = None
def __init__(self, next_step=None, state=None, *args, **kwargs):
"""
... | from flow.core import Base
from flow.core.mixins import AddStepMixin, WorkflowSearchMixin
from flow.core.exceptions import TooManyNextStepsError
from flow.steps.utils import NextStepChoice
class Step(Base, AddStepMixin, WorkflowSearchMixin):
| 52 | 102 | 342 | 12 | 39 | richardschris/flow | flow/steps/__init__.py | Python | Step | Step | 7 | 54 | 7 | 7 | bff66969c2d9f34611ce9b63d7ffbb175bb188db | bigcode/the-stack | train |
d90c6c3ce90163e33ba75975 | train | class | class FixedChoiceStep(ChoiceStep):
""" Step for selectively transitioning between steps based on an evaluator. Takes
an array of NextStepChoices and executes the evaluators on them; if one succeeds,
it transitions to the next step, otherwise, it raises an exception.
"""
def __init__(self, choices=N... | class FixedChoiceStep(ChoiceStep):
| """ Step for selectively transitioning between steps based on an evaluator. Takes
an array of NextStepChoices and executes the evaluators on them; if one succeeds,
it transitions to the next step, otherwise, it raises an exception.
"""
def __init__(self, choices=None, *args, **kwargs):
""" ... | _step_selector or self._next_step_selector
super().__init__(*args, **kwargs)
def transition(self, *args, **kwargs):
next_step = self.next_step_selector(*args, **kwargs)
return self.state, next_step
def _next_step_selector(self, *args, **kwargs):
raise NotImplementedError
class... | 80 | 80 | 269 | 8 | 71 | richardschris/flow | flow/steps/__init__.py | Python | FixedChoiceStep | FixedChoiceStep | 73 | 108 | 73 | 73 | eb09e34d542082070e8e221097b37454553bc8f6 | bigcode/the-stack | train |
e5d3ba890ff1771c3c5ae34f | train | function | def mail(att, subject, text): # メール送信用関数
mime = MIMEText(text.encode(), 'plain', 'utf-8') # TEXTをMIME形式に変換
mime['From'] = MAIL_ID # 送信者を代入
mime['To'] = att # 宛先を代入
mime['Subject'] = subject ... | def mail(att, subject, text): # メール送信用関数
| mime = MIMEText(text.encode(), 'plain', 'utf-8') # TEXTをMIME形式に変換
mime['From'] = MAIL_ID # 送信者を代入
mime['To'] = att # 宛先を代入
mime['Subject'] = subject # 件名を代入
smtp = smtplib.SMTP('smtp.gmail.com', 587) ... |
MAIL_PASS = '************' ## 要変更 ## # パスワード
mail_to = 'watt@bokunimo.net' ## 要変更 ## # メールの宛先
def mail(att, subject, text): # メール送信用関数
| 64 | 64 | 185 | 17 | 46 | bokunimowakaru/iot | server/mail_sender.py | Python | mail | mail | 13 | 22 | 13 | 13 | cdc925120465e49e99f3567903f27463b30e5946 | bigcode/the-stack | train |
71c005fdc6fcdcce98e02379 | train | function | def is_dev():
async def checker(ctx):
return await user_is_developer(ctx)
return commands.check(checker)
| def is_dev():
| async def checker(ctx):
return await user_is_developer(ctx)
return commands.check(checker)
| Image
from io import BytesIO
import discord
from discord.ext import commands
async def user_is_developer(ctx):
is_owner = await ctx.bot.is_owner(ctx.author)
if is_owner:
return True
else:
return ctx.message.author.id in c.dev_ids
def is_dev():
| 64 | 64 | 26 | 4 | 59 | runarsf/rufus | src/cogs/utils/checks.py | Python | is_dev | is_dev | 19 | 22 | 19 | 19 | 447ea94f7a116d0d2ee49e148fe633b2048dac53 | bigcode/the-stack | train |
74ed521f02fc8f7f101199f7 | train | function | def getDominantColor(filename: str):
try:
#Resizing parameters
width, height = 150, 150
response = requests.get(filename)
image = Image.open(BytesIO(response.content))
image = image.resize((width, height), resample=0)
#Get colors from image object
pixels = ima... | def getDominantColor(filename: str):
| try:
#Resizing parameters
width, height = 150, 150
response = requests.get(filename)
image = Image.open(BytesIO(response.content))
image = image.resize((width, height), resample=0)
#Get colors from image object
pixels = image.getcolors(width * height)
... | .bot.is_owner(ctx.author)
if is_owner:
return True
else:
return ctx.message.author.id in c.dev_ids
def is_dev():
async def checker(ctx):
return await user_is_developer(ctx)
return commands.check(checker)
def getDominantColor(filename: str):
| 64 | 64 | 174 | 9 | 55 | runarsf/rufus | src/cogs/utils/checks.py | Python | getDominantColor | getDominantColor | 24 | 41 | 24 | 24 | efff42fd0dcc3c33c97b8a455c67a3dc5d4ae677 | bigcode/the-stack | train |
689ebd0da21100bca2e8b2ed | train | function | async def user_is_developer(ctx):
is_owner = await ctx.bot.is_owner(ctx.author)
if is_owner:
return True
else:
return ctx.message.author.id in c.dev_ids
| async def user_is_developer(ctx):
| is_owner = await ctx.bot.is_owner(ctx.author)
if is_owner:
return True
else:
return ctx.message.author.id in c.dev_ids
| import config as c
import urllib.request
import requests
from PIL import Image
from io import BytesIO
import discord
from discord.ext import commands
async def user_is_developer(ctx):
| 40 | 64 | 43 | 8 | 31 | runarsf/rufus | src/cogs/utils/checks.py | Python | user_is_developer | user_is_developer | 12 | 17 | 12 | 12 | 921374abd585c1fd10465678123b307af4118795 | bigcode/the-stack | train |
86ee5a56db9660b960aef11e | train | class | class UserSchema(ma.ModelSchema):
posts=ma.Nested('PostSchema',many=True)
class Meta:
model=User
exclude=('created_at','updated_at')
| class UserSchema(ma.ModelSchema):
| posts=ma.Nested('PostSchema',many=True)
class Meta:
model=User
exclude=('created_at','updated_at')
| # -*- coding: utf-8 -*-
__author__ = ''
from instagram_scraper.model.insta import User, Post, Comment
from instagram_scraper import ma
from instagram_scraper.schemas import safe_execute
class UserSchema(ma.ModelSchema):
| 50 | 64 | 38 | 7 | 42 | stark3998/Instagram | instagram_scraper/schemas/insta.py | Python | UserSchema | UserSchema | 8 | 12 | 8 | 8 | 9e186e2e59fd94a246f38e5945c63d5436ce5134 | bigcode/the-stack | train |
08448658c12cf602b6688112 | train | class | class PostSchema(ma.ModelSchema):
comments=ma.Nested('CommentSchema',many=True)
class Meta:
model=Post
exclude=('created_at','updated_at')
| class PostSchema(ma.ModelSchema):
| comments=ma.Nested('CommentSchema',many=True)
class Meta:
model=Post
exclude=('created_at','updated_at')
| , Comment
from instagram_scraper import ma
from instagram_scraper.schemas import safe_execute
class UserSchema(ma.ModelSchema):
posts=ma.Nested('PostSchema',many=True)
class Meta:
model=User
exclude=('created_at','updated_at')
class PostSchema(ma.ModelSchema):
| 64 | 64 | 38 | 7 | 57 | stark3998/Instagram | instagram_scraper/schemas/insta.py | Python | PostSchema | PostSchema | 14 | 18 | 14 | 14 | d75da776c3e60945cdb6b0121e7ca7d35e21fa86 | bigcode/the-stack | train |
02dd59ad308c7a6dcc4d6e79 | train | class | class CommentSchema(ma.ModelSchema):
class Meta:
model=Comment
exclude=('created_at','updated_at') | class CommentSchema(ma.ModelSchema):
| class Meta:
model=Comment
exclude=('created_at','updated_at') | )
class Meta:
model=User
exclude=('created_at','updated_at')
class PostSchema(ma.ModelSchema):
comments=ma.Nested('CommentSchema',many=True)
class Meta:
model=Post
exclude=('created_at','updated_at')
class CommentSchema(ma.ModelSchema):
| 64 | 64 | 25 | 7 | 57 | stark3998/Instagram | instagram_scraper/schemas/insta.py | Python | CommentSchema | CommentSchema | 20 | 23 | 20 | 20 | 993e8e7d3c21f0e1a60076672b0c01cf539ae8f8 | bigcode/the-stack | train |
163627e5ed7e1d00697349d1 | train | function | def changeFileRemove(title, message, image, pathway):
with open(pathway) as inf:
txt = inf.read()
soup = bs4.BeautifulSoup(txt, features="html.parser")
string = "<button class=\"button1\" onclick=\"send('"+message+"')\"><img src=\"imgs/Custom/"+image+"\"/>"+title+"</button>"
str1 = soup.con... | def changeFileRemove(title, message, image, pathway):
| with open(pathway) as inf:
txt = inf.read()
soup = bs4.BeautifulSoup(txt, features="html.parser")
string = "<button class=\"button1\" onclick=\"send('"+message+"')\"><img src=\"imgs/Custom/"+image+"\"/>"+title+"</button>"
str1 = soup.contents
str2 = str1[0].__str__().split(string, 1)
... | Img.get()
pathway = paths[variable.get()]
print(title, message, image, pathway)
changeFileAdd(title, message, image, pathway)
output.config(text = "Button Successfully Added!")
addLog(title, message, image)
def changeFileRemove(title, message, image, pathway):
| 64 | 64 | 160 | 12 | 52 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | changeFileRemove | changeFileRemove | 95 | 109 | 95 | 95 | 446b855a04b06ae611c7fc13377e2b52b25f133e | bigcode/the-stack | train |
8b34c94ab106fb842cfe271d | train | function | def updateLog(title):
menu2['menu'].add_command(label=title, command=tk._setit(variable2, title))
| def updateLog(title):
| menu2['menu'].add_command(label=title, command=tk._setit(variable2, title))
| delete(title)
print(data)
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
def pullLog():
with open("Simple/libs/data.json", 'r') as openfile:
return json.load(openfile)
def updateLog(title):
| 64 | 64 | 27 | 5 | 59 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | updateLog | updateLog | 31 | 32 | 31 | 31 | 9f7e66e5a28d5ef170c64b307fb041384d3e6c01 | bigcode/the-stack | train |
d561b9a692790441ba2e2cde | train | function | def changeFileAdd(title, message, image, pathway):
with open(pathway) as inf:
txt = inf.read()
soup = bs4.BeautifulSoup(txt, features="html.parser")
str1 = soup.contents
print(str1)
str2 = str1[0].__str__().split("</body>", 1)
data = str2[0] + "<button onclick=\"send('"+message+"')\... | def changeFileAdd(title, message, image, pathway):
| with open(pathway) as inf:
txt = inf.read()
soup = bs4.BeautifulSoup(txt, features="html.parser")
str1 = soup.contents
print(str1)
str2 = str1[0].__str__().split("</body>", 1)
data = str2[0] + "<button onclick=\"send('"+message+"')\" class=\"button1\"><img src=\"imgs/Custom/"+image+... | .keys())
variable2 = tk.StringVar(window)
variable2.set("None") # default value
print('|•/||••|/|||||•|•|•|')
menu2 = tk.OptionMenu(window,variable2, *k2)
def changeFileAdd(title, message, image, pathway):
| 64 | 64 | 165 | 12 | 52 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | changeFileAdd | changeFileAdd | 68 | 82 | 68 | 68 | 8d1b02c2284e264957bb94fbdcee3c642751e2b9 | bigcode/the-stack | train |
5836e7122730b8de46b504a2 | train | function | def addLog(title, message, image):
with open('Simple/libs/data.json', 'r') as openfile:
data = json.load(openfile)
data[title] = [message, image]
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
updateLog(title)
| def addLog(title, message, image):
| with open('Simple/libs/data.json', 'r') as openfile:
data = json.load(openfile)
data[title] = [message, image]
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
updateLog(title)
| import bs4
import tkinter as tk
window = tk.Tk()
import json
def addLog(title, message, image):
| 28 | 64 | 71 | 9 | 18 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | addLog | addLog | 7 | 13 | 7 | 7 | 747498495768fdc70fffe0e03ce006ef06abaaa0 | bigcode/the-stack | train |
fc456849349b4b5c4f5cded5 | train | function | def handle_clickRemove(event):
title = variable2.get()
message = pullLog()[title][0]
image = pullLog()[title][1]
pathway = paths[variable.get()]
print(title, message, image, pathway)
changeFileRemove(title, message, image, pathway)
output.config(text = "Button Successfully Removed!")
rem... | def handle_clickRemove(event):
| title = variable2.get()
message = pullLog()[title][0]
image = pullLog()[title][1]
pathway = paths[variable.get()]
print(title, message, image, pathway)
changeFileRemove(title, message, image, pathway)
output.config(text = "Button Successfully Removed!")
removeLog(title)
| 1)
data = str2[0] + str2[1]
print(data)
soup2 = bs4.BeautifulSoup(data, features="html.parser")
with open(pathway, "w") as outf:
outf.write(str(soup2))
def handle_clickRemove(event):
| 64 | 64 | 78 | 6 | 58 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | handle_clickRemove | handle_clickRemove | 111 | 119 | 111 | 111 | d78903b1a29b806b6bde63e7455e02b6fcfa6720 | bigcode/the-stack | train |
3576996a315abcb5fe466b9d | train | function | def removeLog(title):
with open('Simple/libs/data.json', 'r') as openfile:
data = json.load(openfile)
variable2.set("None")
data.pop(title)
menu2['menu'].delete(title)
print(data)
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
| def removeLog(title):
| with open('Simple/libs/data.json', 'r') as openfile:
data = json.load(openfile)
variable2.set("None")
data.pop(title)
menu2['menu'].delete(title)
print(data)
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
| ('Simple/libs/data.json', 'r') as openfile:
data = json.load(openfile)
data[title] = [message, image]
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
updateLog(title)
def removeLog(title):
| 64 | 64 | 78 | 5 | 59 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | removeLog | removeLog | 14 | 26 | 14 | 14 | 238daf217a7923def76ae1c49739ea5013b3f7e3 | bigcode/the-stack | train |
e5db11b32d221e6380c3ae19 | train | function | def handle_clickAdd(event):
message = entryMessage.get()
title = entryTitle.get()
image = entryImg.get()
pathway = paths[variable.get()]
print(title, message, image, pathway)
changeFileAdd(title, message, image, pathway)
output.config(text = "Button Successfully Added!")
addLog(title, me... | def handle_clickAdd(event):
| message = entryMessage.get()
title = entryTitle.get()
image = entryImg.get()
pathway = paths[variable.get()]
print(title, message, image, pathway)
changeFileAdd(title, message, image, pathway)
output.config(text = "Button Successfully Added!")
addLog(title, message, image)
| /"+image+"\"/>"+title+"</button>" +"\n</body>"+ str2[1]
soup2 = bs4.BeautifulSoup(data, features="html.parser")
with open(pathway, "w") as outf:
outf.write(str(soup2))
def handle_clickAdd(event):
| 64 | 64 | 76 | 6 | 58 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | handle_clickAdd | handle_clickAdd | 84 | 92 | 84 | 84 | a3c504e9d67f0562dac35888e002892fa3809341 | bigcode/the-stack | train |
09223eb0bd1aa01d149622bf | train | function | def pullLog():
with open("Simple/libs/data.json", 'r') as openfile:
return json.load(openfile)
| def pullLog():
| with open("Simple/libs/data.json", 'r') as openfile:
return json.load(openfile)
| file:
data = json.load(openfile)
variable2.set("None")
data.pop(title)
menu2['menu'].delete(title)
print(data)
with open("Simple/libs/data.json", "w") as outfile:
json.dump(data, outfile)
def pullLog():
| 63 | 64 | 27 | 4 | 59 | Gasai-Olson/DownSyndrome_NLP_MOC2021 | UI_NATE/Simple/libs/CustomButton.py | Python | pullLog | pullLog | 28 | 30 | 28 | 28 | 2f106575b4c05588444fd81906fd24707b4feaf2 | bigcode/the-stack | train |
da727477a04b081447a5007b | train | function | def validate_config(config, parameter, value):
"""
Validates parameter setting on a hidden config parameter.
"""
orig = getattr(config, parameter)
try:
setattr(config, parameter, value)
except Exception as e:
raise e
finally:
setattr(config, parameter, orig)
| def validate_config(config, parameter, value):
| """
Validates parameter setting on a hidden config parameter.
"""
orig = getattr(config, parameter)
try:
setattr(config, parameter, value)
except Exception as e:
raise e
finally:
setattr(config, parameter, orig)
| = any(v in __version__ for v in ('post', 'dirty'))
#---------------------------------------------------------------------
# Public API
#---------------------------------------------------------------------
_PATH = os.path.abspath(os.path.dirname(__file__))
_CSS_FILES = glob.glob(os.path.join(_PATH, '_styles', '*.css... | 64 | 64 | 64 | 9 | 55 | slamer59/panel | panel/config.py | Python | validate_config | validate_config | 36 | 46 | 36 | 36 | 34aa7f9f11a5d8d9f7be75616b56394c904cf8dd | bigcode/the-stack | train |
d7b250f9d2ef84ff0d03e55e | train | function | def _cleanup_panel(msg_id):
"""
A cleanup action which is called when a plot is deleted in the notebook
"""
if msg_id not in state._views:
return
viewable, model, _, _ = state._views.pop(msg_id)
viewable._cleanup(model)
| def _cleanup_panel(msg_id):
| """
A cleanup action which is called when a plot is deleted in the notebook
"""
if msg_id not in state._views:
return
viewable, model, _, _ = state._views.pop(msg_id)
viewable._cleanup(model)
| kws
if name not in sig.parameters
]
parameters.append(Parameter('kwargs', Parameter.VAR_KEYWORD))
cls.__init__.__signature__ = Signature(
parameters, return_annotation=sig.return_annotation
)
#--------------------------------------------... | 64 | 64 | 63 | 7 | 57 | slamer59/panel | panel/config.py | Python | _cleanup_panel | _cleanup_panel | 556 | 563 | 556 | 556 | fb28d508080015b1b352cc4e654ca16f8befb0e6 | bigcode/the-stack | train |
db4123d4be44a06e68b4c763 | train | class | class panel_extension(_pyviz_extension):
"""
Initializes the pyviz notebook extension to allow plotting with
bokeh and enable comms.
"""
_loaded = False
_imports = {'katex': 'panel.models.katex',
'mathjax': 'panel.models.mathjax',
'plotly': 'panel.models.plotly'... | class panel_extension(_pyviz_extension):
| """
Initializes the pyviz notebook extension to allow plotting with
bokeh and enable comms.
"""
_loaded = False
_imports = {'katex': 'panel.models.katex',
'mathjax': 'panel.models.mathjax',
'plotly': 'panel.models.plotly',
'deckgl': 'panel.models... | _
else:
return os.environ.get('PANEL_OAUTH_ENCRYPTION', _config._oauth_encryption_key)
@oauth_encryption_key.setter
def oauth_encryption_key(self, value):
validate_config(self, '_oauth_encryption_key', value)
self._oauth_encryption_key_ = value
@property
def oauth_e... | 255 | 256 | 1,205 | 8 | 247 | slamer59/panel | panel/config.py | Python | panel_extension | panel_extension | 403 | 549 | 403 | 403 | 1f66056a926207e95ef9322ed754f67141450377 | bigcode/the-stack | train |
6b42dcb6018b9a87e06a9bf6 | train | function | def _cleanup_server(server_id):
"""
A cleanup action which is called when a server is deleted in the notebook
"""
if server_id not in state._servers:
return
server, viewable, docs = state._servers.pop(server_id)
server.stop()
for doc in docs:
for root in doc.roots:
... | def _cleanup_server(server_id):
| """
A cleanup action which is called when a server is deleted in the notebook
"""
if server_id not in state._servers:
return
server, viewable, docs = state._servers.pop(server_id)
server.stop()
for doc in docs:
for root in doc.roots:
if root.ref['id'] in viewable.... | ):
"""
A cleanup action which is called when a plot is deleted in the notebook
"""
if msg_id not in state._views:
return
viewable, model, _, _ = state._views.pop(msg_id)
viewable._cleanup(model)
def _cleanup_server(server_id):
| 64 | 64 | 93 | 7 | 57 | slamer59/panel | panel/config.py | Python | _cleanup_server | _cleanup_server | 566 | 577 | 566 | 566 | 23c4ef8a93a2e06bc978a9f529debea17c8276e8 | bigcode/the-stack | train |
0d1cf6eab2d5f75144057b20 | train | class | class _config(param.Parameterized):
"""
Holds global configuration options for Panel. The options can be
set directly on the global config instance, via keyword arguments
in the extension or via environment variables. For example to set
the embed option the following approaches can be used:
... | class _config(param.Parameterized):
| """
Holds global configuration options for Panel. The options can be
set directly on the global config instance, via keyword arguments
in the extension or via environment variables. For example to set
the embed option the following approaches can be used:
pn.config.embed = True
pn.... | the extension
which provides convenient support for loading and configuring panel
components.
"""
from __future__ import absolute_import, division, unicode_literals
import ast
import glob
import inspect
import os
import sys
from contextlib import contextmanager
import param
from pyviz_comms import (JupyterCommMan... | 256 | 256 | 2,679 | 7 | 249 | slamer59/panel | panel/config.py | Python | _config | _config | 49 | 390 | 49 | 49 | 31cd300fdbb7347e8bbf1e743bcc512e70d2c83c | bigcode/the-stack | train |
f3fb416c4e505fefd9716904 | train | function | def get_item_info(appid: int, market_hash_name: str, currency: int = 1):
item_info = {'exact_item': True, 'full_info': True}
(price_overview_response,
market_search_response) = request_item_info_async(
appid, market_hash_name, currency
)
if market_search_response is None:
item_inf... | def get_item_info(appid: int, market_hash_name: str, currency: int = 1):
| item_info = {'exact_item': True, 'full_info': True}
(price_overview_response,
market_search_response) = request_item_info_async(
appid, market_hash_name, currency
)
if market_search_response is None:
item_info['full_info'] = False
item_info['name'] = market_hash_name
... | response.json()
def market_search(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
response = requests.get(
MARKET_SEARCH_URL,
params={
'norender': 1,
'query': query,
'appid': a... | 138 | 138 | 461 | 22 | 116 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | get_item_info | get_item_info | 97 | 160 | 97 | 97 | 13ded4e7071e1cbe80e1083baf0067189ee9f7c4 | bigcode/the-stack | train |
961e09bae50c4b2c80eb80e0 | train | function | async def run_async_requests(url_params_tuples: List[tuple]):
async with ClientSession() as session:
tasks = [
asyncio.create_task(fetch(session, url, params))
for url, params in url_params_tuples
]
return await asyncio.gather(*tasks)
| async def run_async_requests(url_params_tuples: List[tuple]):
| async with ClientSession() as session:
tasks = [
asyncio.create_task(fetch(session, url, params))
for url, params in url_params_tuples
]
return await asyncio.gather(*tasks)
| \
ERRMSG_API_COOLDOWN
from telegram_bot.exceptions.exceptions import ApiException
async def fetch(session, url: str, params: dict):
async with session.get(url, params=params) as response:
return await response.json()
async def run_async_requests(url_params_tuples: List[tuple]):
| 64 | 64 | 60 | 14 | 50 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | run_async_requests | run_async_requests | 24 | 31 | 24 | 24 | f68c7f79b267638df25ed27c0fbedc62bd94f0f4 | bigcode/the-stack | train |
e5b9c771f81c37d556015c6f | train | function | def market_search(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
response = requests.get(
MARKET_SEARCH_URL,
params={
'norender': 1,
'query': query,
'appid': appid,
'... | def market_search(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
| response = requests.get(
MARKET_SEARCH_URL,
params={
'norender': 1,
'query': query,
'appid': appid,
'count': count,
'sort_column': sort_column,
'sort_dir': sort_dir,
**kwargs
}
)
return response.json... | _name': market_hash_name,
'currency': currency
}
)
return response.json()
def market_search(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
| 64 | 64 | 113 | 43 | 21 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | market_search | market_search | 77 | 94 | 77 | 80 | 074abe68f46b239d1e5408a62a19e00e97024a02 | bigcode/the-stack | train |
78a32cfdd8a93c9ec513bc23 | train | function | async def fetch(session, url: str, params: dict):
async with session.get(url, params=params) as response:
return await response.json()
| async def fetch(session, url: str, params: dict):
| async with session.get(url, params=params) as response:
return await response.json()
| build_market_url, \
parse_market_search_general_info
from telegram_bot.constants import SELL_PRICE
from telegram_bot.exceptions.error_messages import ERRMSG_NOTHING_FOUND, \
ERRMSG_API_COOLDOWN
from telegram_bot.exceptions.exceptions import ApiException
async def fetch(session, url: str, params: dict):
| 64 | 64 | 32 | 13 | 50 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | fetch | fetch | 19 | 21 | 19 | 19 | 32c39c3e32449e04cf7a7ae265d361e2de3c618b | bigcode/the-stack | train |
e884236b901909359b92a31c | train | function | def market_search_for_command(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
market_search_dict = {}
market_search_response = market_search(query=query)
if market_search_response is None:
raise ApiException(ERRMSG... | def market_search_for_command(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
| market_search_dict = {}
market_search_response = market_search(query=query)
if market_search_response is None:
raise ApiException(ERRMSG_API_COOLDOWN)
elif market_search_response['success']:
if market_search_response['total_count'] == 0:
raise ApiException(ERRMSG_NOTHING_FOU... | is None:
raise ApiException(ERRMSG_API_COOLDOWN)
return item_info
def market_search_for_command(
query: str = None, appid: int = None, count: int = None,
sort_column: str = None, sort_dir: str = None, **kwargs
):
| 64 | 64 | 176 | 45 | 18 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | market_search_for_command | market_search_for_command | 163 | 184 | 163 | 166 | 84d59d4a29455385233b5045ef7f4b50426a5321 | bigcode/the-stack | train |
c68f6feee4d7d9a016b29209 | train | function | def price_overview(appid: int, market_hash_name: str, currency: int = 1):
response = requests.get(
PRICE_OVERVIEW_URL,
params={
'appid': appid,
'market_hash_name': market_hash_name,
'currency': currency
}
)
return response.json()
| def price_overview(appid: int, market_hash_name: str, currency: int = 1):
| response = requests.get(
PRICE_OVERVIEW_URL,
params={
'appid': appid,
'market_hash_name': market_hash_name,
'currency': currency
}
)
return response.json()
| _dicts = loop.run_until_complete(run_async_requests([
price_overview_tuple, market_search_tuple
]))
return reslting_dicts[0], reslting_dicts[1]
def price_overview(appid: int, market_hash_name: str, currency: int = 1):
| 64 | 64 | 70 | 22 | 42 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | price_overview | price_overview | 64 | 74 | 64 | 64 | 1ef41a390ea68eb1b40aa073c849de27f93135e0 | bigcode/the-stack | train |
d77dc36fa8d8260dadc2a790 | train | function | def request_item_info_async(
appid: int, market_hash_name: str, currency: int = 1
):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
price_overview_tuple = (
PRICE_OVERVIEW_URL,
{
'appid': appid,
'market_hash_name': market_hash_name,
... | def request_item_info_async(
appid: int, market_hash_name: str, currency: int = 1
):
| loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
price_overview_tuple = (
PRICE_OVERVIEW_URL,
{
'appid': appid,
'market_hash_name': market_hash_name,
'currency': currency
}
)
market_search_tuple = (
MARKET_SEARCH_URL,
... | :
tasks = [
asyncio.create_task(fetch(session, url, params))
for url, params in url_params_tuples
]
return await asyncio.gather(*tasks)
def request_item_info_async(
appid: int, market_hash_name: str, currency: int = 1
):
| 64 | 64 | 170 | 26 | 38 | Mikedreyeu/steam-market-warden | market_api/api.py | Python | request_item_info_async | request_item_info_async | 34 | 61 | 34 | 36 | 3390aff2808269d6fc685ffccf0b47ed1c373a51 | bigcode/the-stack | train |
9e3edc80943c9d85479887e8 | train | class | class Controller(Thread):
def __init__(self, device_manager: DeviceManager, client: cc_lib.client.Client, zway: Zway):
super().__init__(name="controller", daemon=True)
self.__device_manager = device_manager
self.__client = client
self.__zway = zway
self.__worker_pool = dict()... | class Controller(Thread):
| def __init__(self, device_manager: DeviceManager, client: cc_lib.client.Client, zway: Zway):
super().__init__(name="controller", daemon=True)
self.__device_manager = device_manager
self.__client = client
self.__zway = zway
self.__worker_pool = dict()
def run(self):
... | dropped command - max age exceeded - correlation id: {}".format(
self.name,
command.correlation_id
)
)
except Empty:
pass
del self.__device
del self.__client
del self.... | 105 | 105 | 353 | 4 | 101 | SENERGY-Platform/zway-connector-rest | zway/controller.py | Python | Controller | Controller | 84 | 122 | 84 | 84 | 2f85dbdcc9d8e39c40688b34327841c96f73fa55 | bigcode/the-stack | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.