prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>factories.py<|end_file_name|><|fim▁begin|>import factory
from .models import User
USER_PASSWORD = "2fast2furious"
class UserFactory(factory.DjangoModelFactory):
name = "John Doe"
email = factory.Sequence(lambda n: "john{}@example.com".format(n))
password = factory.PostGenerationMethodCall('... | model = User |
<|file_name|>test_universe_create.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
"""
This pretty much just tests creating a user, a universe, a planet, a building type name, a building
type, and a building.
"""
import os
import sys
import sqlalchemy
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dir... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>"""generated file, don't modify or your data will be lost"""
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:<|fim▁hole|><|fim▁end|> | pass |
<|file_name|>ptime.py<|end_file_name|><|fim▁begin|>import sys
import time
<|fim▁hole|>sleep = time.sleep
if sys.platform == 'win32':
time = time.clock
else:
time = time.time<|fim▁end|> | |
<|file_name|>ptime.py<|end_file_name|><|fim▁begin|>import sys
import time
sleep = time.sleep
if sys.platform == 'win32':
<|fim_middle|>
else:
time = time.time
<|fim▁end|> | time = time.clock |
<|file_name|>ptime.py<|end_file_name|><|fim▁begin|>import sys
import time
sleep = time.sleep
if sys.platform == 'win32':
time = time.clock
else:
<|fim_middle|>
<|fim▁end|> | time = time.time |
<|file_name|>aliases.py<|end_file_name|><|fim▁begin|>""" Encoding Aliases Support
This module is used by the encodings package search function to
map encodings names to module names.
Note that the search function converts the encoding names to lower
case and replaces hyphens with underscores *before* ... | } |
<|file_name|>faux-editor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | |
<|file_name|>faux-editor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | path = os.path.abspath(args[1])
fo = open(path, 'r+')
content = fo.readlines()
content.append('faux editor added at %s\n' % time.time())
fo.seek(0)
fo.write(''.join(content))
fo.close()
return 0 |
<|file_name|>faux-editor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | sys.exit(main(sys.argv[:])) |
<|file_name|>faux-editor.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versi... | main |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | """
:rtype: bool
""" |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
<|fim_middle|>
"Страница просмотра... | """Локаторы страницы просмотра информации о фильме"""
TITLE_LOCATOR = (By.CSS_SELECTOR, '#movie h2')
COUNTRY_LOCATOR = (By.NAME, 'country')
DIRECTOR_LOCATOR = (By.NAME, 'director')
WRITER_LOCATOR = (By.NAME, 'writer')
PRODUCER_LOCATOR = (By.NAME, 'producer')
EDIT_BUTTON_LOCATOR = (By.CSS_SE... |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | ""
def __init__(self, driver):
super(BrowseMoviePage, self).__init__(driver)
self.nav = NavBlock(driver)
title = SimpleText(BrowseMoviePageLocators.TITLE_LOCATOR)
director = SimpleText(BrowseMoviePageLocators.DIRECTOR_LOCATOR)
writer = SimpleText(BrowseMoviePageLocators.WRITER_LOCA... |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | iver)
title = SimpleText(BrowseMoviePageLocators.TITLE_LOCATOR)
director |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | .EDIT_BUTTON_LOCATOR)
return EditMoviePage(self._driver)
@allure.step('Нажмем на кноку "Remove"')
def click_remove_button(self):
|
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | ATOR)
self.alert_accept()
from .home import HomePage
return HomePage(self._driver)
class AddMoviePageLocators(object):
"""Локаторы страницы создания описания фильма"""
TITLE |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | E_INPUT_ERROR_LOCATOR = (By.CSS_SELECTOR, 'input[name="name"].error')
ALSO_KNOWN_AS_INPUT_LOCATOR = (By.NAME, 'aka')
YEAR_INPUT_LOCATOR = (By.NAME, 'year')
YEAR_INPUT_ERROR_LOCATOR = (By.CSS_SELECTOR, 'input[name="year"].error')
DURATION_INPUT_LOCATOR = (By.NAME, 'duration')
TRAILER_URL_INPUT_LO... |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | = NavBlock(driver)
title = SimpleInput(AddMoviePageLocators.TITLE_INPUT_LOCATOR, 'название фильма')
also_know_as = SimpleInput(AddMoviePageLocators.ALSO_KNOWN_AS_INPUT_LOCATOR, 'оригинальное название фильма')
year = SimpleInput(AddMoviePageLocators.YEAR_INPUT_LOCATOR, 'год')
duration = SimpleInput... |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | lso_know_as = SimpleInput(AddMoviePageLocators.ALSO_KNOWN_AS_INPUT_LOCATOR, 'о |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | PageLocators.TITLE_INPUT_ERROR_LOCATOR)
def year_field_is_required_present(self):
"""
:rtype: bool
"""
return self._i |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | OCATOR)
class EditMoviePageLocators(object):
"""Локаторы для страницы редактирования описания фильма"""
REMOVE_BU |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... |
class EditMoviePage(AddMoviePage):
"""Страница редактирования описания фильма"""
@allure.step('Нажмем на кноку " |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... |
"""
:rtype: HomePage
"""
self._click(EditMoviePageLocators.REMOVE_BUTTON_LOCATOR)
self.alert_accept()
from .home import HomePa |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | )
|
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | lf._click(BrowseM |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | MoviePageLocators.R |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | OCATOR, |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | self._is_element_ |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | present(AddMoviePageLocators.YE |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | OR = (By.CSS_SELECTOR, 'img[ti |
<|file_name|>movie.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
import allure
from selenium.webdriver.common.by import By
from .base import BasePage
from .elements import SimpleInput, SimpleText
from .blocks.nav import NavBlock
class BrowseMoviePageLocators(object):
"""Локаторы страницы просмотра инф... | |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
<|fim_middle|>
<|fim▁end|> | """An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
"""Get the information for the specified bug.
This should return a dictionary with 'summary', 'description', and
... |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | """Get the information for the specified bug.
This should return a dictionary with 'summary', 'description', and
'status' keys.
This is cached for 60 seconds to reduce the number of queries to the
bug trackers and make things seem fast after the first infobox load,
but ... |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | """Get the information for the specified bug (implementation).
This should be implemented by subclasses, and should return a
dictionary with 'summary', 'description', and 'status' keys.
If any of those are unsupported by the given bug tracker, the unknown
values should be given ... |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | """Returns a key to use when caching fetched bug information."""
return 'repository-%s-bug-%s' % (repository.pk, bug_id) |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def <|fim_middle|>(self, repository, bug_id):
... | get_bug_info |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | get_bug_info_uncached |
<|file_name|>bugtracker.py<|end_file_name|><|fim▁begin|>from djblets.cache.backend import cache_memoize
class BugTracker(object):
"""An interface to a bug tracker.
BugTracker subclasses are used to enable interaction with different
bug trackers.
"""
def get_bug_info(self, repository, bug_id):
... | make_bug_cache_key |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
__author__ = "Massimiliano Pippi & Federico Frenguelli"
VERSION = __version__ # synonym<|fim▁end|> | __version__ = '0.8.1' |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... |
@function_trace('safe_exec') |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | """
Update a `hashlib` hasher with a nested object.
To properly cache nested structures, we need to compute a hash from the
entire structure, canonicalizing at every level.
`hasher`'s `.update()` method is called a number of times, touching all of
`obj` in the process. Only primitive JSON-saf... |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | """
Execute python code safely.
`code` is the Python code to execute. It has access to the globals in `globals_dict`,
and any changes it makes to those globals are visible in `globals_dict` when this
function returns.
`random_seed` will be used to see the `random` module available to the code... |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | lazymod_py_file = lazymod_py_file[:-1] |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | for e in obj:
update_hash(hasher, e) |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | for k in sorted(obj):
update_hash(hasher, k)
update_hash(hasher, obj[k]) |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | hasher.update(six.b(repr(obj))) |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | safe_globals = json_safe(globals_dict)
md5er = hashlib.md5()
md5er.update(repr(code).encode('utf-8'))
update_hash(md5er, safe_globals)
key = "safe_exec.%r.%s" % (random_seed, md5er.hexdigest())
cached = cache.get(key)
if cached is not None:
# We have a... |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | emsg, cleaned_results = cached
globals_dict.update(cleaned_results)
if emsg:
raise SafeExecException(emsg)
return |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | raise SafeExecException(emsg) |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | data = {
"code": code_prolog + LAZY_IMPORTS + code,
"globals_dict": globals_dict,
"python_path": python_path,
"limit_overrides_context": limit_overrides_context,
"slug": slug,
"unsafely": unsafely,
"extra_files": extra_files,
... |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | if unsafely:
exec_fn = codejail_not_safe_exec
else:
exec_fn = codejail_safe_exec
# Run the code! Results are side effects in globals_dict.
try:
exec_fn(
code_prolog + LAZY_IMPORTS + code,
globals_dict,
... |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | exec_fn = codejail_not_safe_exec |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | exec_fn = codejail_safe_exec |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | emsg = None |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | cleaned_results = json_safe(globals_dict)
cache.set(key, (emsg, cleaned_results)) |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | raise exception |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | update_hash |
<|file_name|>safe_exec.py<|end_file_name|><|fim▁begin|>"""Capa's specialized use of codejail.safe_exec."""
import hashlib
from codejail.safe_exec import SafeExecException, json_safe
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import safe_exec as codejail_safe_exec
f... | safe_exec |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | distance = t_distance
if d_salle is None:
personnage << "|err|Aucun quai n'a pu être trouvé à " \ |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | ""Commande 'debarquer'"""
def __init__(self):
"""Constructeur de la commande"""
Commande.__init__(self, "debarquer", "debark")
self.nom_categorie = "navire"
self.aide_courte = "débarque du navire"
self.aide_longue = \
"Cette commande permet de débarquer du na... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | ""Constructeur de la commande"""
Commande.__init__(self, "debarquer", "debark")
self.nom_categorie = "navire"
self.aide_courte = "débarque du navire"
self.aide_longue = \
"Cette commande permet de débarquer du navire sur lequel " \
"on se trouve. On doit s... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | hode d'interprétation de commande"""
salle = personnage.salle
if not hasattr(salle, "navire") or salle.navire is None:
personnage << "|err|Vous n'êtes pas sur un navire.|ff|"
return
navire = salle.navire
if navire.etendue is None:
personnage <... |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | ge << "|err|Vous n'êtes pas sur un navire.|ff|"
return
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | e << "|err|Vous n'êtes pas sur un navire.|ff|"
return
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | t_z = t_salle.coords.tuple()
t_distance = sqrt((x - t_x) ** 2 + (y - t_y) ** 2)
if t_distance < distance and t_salle.nom_terrain in \
TERRAINS_ACCOSTABLES:
d_salle = t_salle
distance = t_distance
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | t_salle
distance = t_distance
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | << "|err|Aucun quai n'a pu être trouvé à " \
"proximité.|ff|"
return
pers |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | oyer_tip("N'oubliez pas d'amarrer votre navire " \
"avec %amarre% %amarre:attacher%.")
|
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | _init__( |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|># -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sourc... | reter(self, |
<|file_name|>test.py<|end_file_name|><|fim▁begin|><|fim▁hole|>zhangyu<|fim▁end|> | |
<|file_name|>TestSyncGConfFolder.py<|end_file_name|><|fim▁begin|>#common sets up the conduit environment
from common import *
#setup test
test = SimpleSyncTest()
#Setup the key to sync
gconf = test.get_dataprovider("GConfTwoWay")
gconf.module.whitelist = ['/apps/metacity/general/num_workspaces']
folder = test.get_dat... | f = folder.module.get(
folder.module.get_all()[0] |
<|file_name|>TestSyncGConfFolder.py<|end_file_name|><|fim▁begin|>#common sets up the conduit environment
from common import *
#setup test
test = SimpleSyncTest()
#Setup the key to sync
gconf = test.get_dataprovider("GConfTwoWay")
gconf.module.whitelist = ['/apps/metacity/general/num_workspaces']
folder = test.get_dat... | f = folder.module.get(
folder.module.get_all()[0]
)
f._set_file_mtime(datetime.datetime(2008,1,i)) |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.description = "APSync {0} process".format(self.name)
else:
self.description = description |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | '''The base class for all modules'''
def __init__(self, in_queue, out_queue, name, description = None):
super(APModule, self).__init__()
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.signal(signal.SIGTERM, self.exit_gracefully)
self.daemon = True
self.config_l... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | super(APModule, self).__init__()
signal.signal(signal.SIGINT, self.exit_gracefully)
signal.signal(signal.SIGTERM, self.exit_gracefully)
self.daemon = True
self.config_list= [] # overwrite this list
self.config_changed = False
self.config = read_config()
se... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | if len(config_list):
self.config_list = config_list
for (var_name, var_default) in self.config_list:
self.set_config(var_name, var_default)
if self.config_changed:
# TODO: send a msg to the webserver to update / reload the current page
... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.out_queue.put_nowait(ping(self.name, self.pid)) |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.unload() |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | print self.name, 'called unload'
self.unload_callback()
self.needs_unloading.set() |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | ''' overload to perform any module specific cleanup'''
pass |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | if self.in_queue_thread is not None:
self.in_queue_thread.start()
while not self.needs_unloading.is_set():
try:
self.main()
except:
print ("FATAL: module ({0}) exited while multiprocessing".format(self.name))
traceback.... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | pass |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | while not self.needs_unloading.is_set():
(inputready,outputready,exceptready) = select.select([self.in_queue._reader],[],[],0.1)
for s in inputready:
while not self.in_queue.empty():
# drain the queue
data = self.in_queue.get_nowait()
... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | pass |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.out_queue.put_nowait(json_wrap_with_target({'msg':message, 'level':level}, target = 'logging')) |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | new_val = self.config.get(var_name, var_default)
try:
cur_val = self.config[var_name]
if new_val != cur_val:
self.config_changed = True
except:
self.config_changed = True
finally:
self.config[var_name] = new_val
... |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | def __init__(self, name):
self.ack = False |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.ack = False |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.description = "APSync {0} process".format(self.name) |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.description = description |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.config_list = config_list |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.log('At least one of your cloudsync settings was missing or has been updated, please reload the webpage if open.', 'INFO')
self.config_changed = False |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.config[k] = config_on_disk[k] |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.in_queue_thread.start() |
<|file_name|>APSync_module.py<|end_file_name|><|fim▁begin|># A template for APSync process based modules
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.ut... | self.unload() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.