Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Continue the code snippet: <|code_start|> super(FreeEmailProviderTestCase, self).setUp() self.url = url_for('accounts.free_email_providers_list') self.items = [FreeEmailProvider(domain='%s+freedomain.com' % i) for i in range(10)] self.db.session.add_all(self.items) ...
response = self.client.post(self.url,
Predict the next line for this snippet: <|code_start|> if self.model_class.query.filter(*args).first(): raise ValidationError( '%s must be an unique' % str(field.label).title()) class ProjectForm(BaseForm): title = default_string_field( 'title', validators=[Uniq...
)
Here is a snippet: <|code_start|> def default_string_field(label, **extra): validators = extra.pop('validators', []) validators.append(DataRequired()) return TrackChangesStringField(label, validators=validators, **extra) class UniqueValue: def __init__(self, model_class, per_user=False): sel...
'title',
Using the snippet: <|code_start|> class UniqueValue: def __init__(self, model_class, per_user=False): self.model_class = model_class self.per_user = per_user def __call__(self, form, field): args = [getattr(self.model_class, field.name) == field.data] if self.per_user: ...
aws_access_id = default_string_field('AWS access_id')
Continue the code snippet: <|code_start|> def default_string_field(label, **extra): validators = extra.pop('validators', []) validators.append(DataRequired()) return TrackChangesStringField(label, validators=validators, **extra) class UniqueValue: def __init__(self, model_class, per_user=False): ...
if self.model_class.query.filter(*args).first():
Given the following code snippet before the placeholder: <|code_start|># coding:utf-8 # NOW MERGED INTO maclient_update.py reload(sys) sys.setdefaultencoding('utf-8') sys.path.append(os.path.abspath('..')) os.chdir(os.path.abspath('..')) sys.path[0] = os.path.abspath('.') loc = 'cn' mac = maclient.maClient(co...
str(c.skill_description).replace('\n', '\\n')))
Using the snippet: <|code_start|> return #request enemy guild resp, ct = self._dopost('battle/guild/lobby', postdata = 'event_id=%s&event_part_id=0&guild_id=%s' % (PVP_LAKE_ID, self.guild_id)) if resp['error']: return #self.logger.info() ...
postdata = 'enemy_guild_id=%s&event_id=%s&event_part_id=0&guild_id=%s' % (e_guild.guild_id, PVP_LAKE_ID, self.guild_id))
Continue the code snippet: <|code_start|># coding:utf-8 # start meta __plugin_name__ = '国服公会PVP' __author = 'fffonion' __version__ = 0.11 hooks = {} extra_cmd = {'gpvp':'guild_pvp', 'guild_pvp':'guild_pvp'} #simple version of _dopost def _dopost(self, urikey, postdata = '', usecookie = True, setcookie = True,...
pass
Given snippet: <|code_start|> return obj def iter_printer(l, sep = '\n'): cnt = 1 str = '' for e in l: str += '%d.%-10s%s' % (cnt, e.strip('\n'), (cnt % 3 and '' or sep)) cnt += 1 return str.decode('utf-8') def read_decks(plugin_vals): def do(*args): if p...
print(du8('推荐卡组:'))
Using the snippet: <|code_start|> print('total', len(clst), 'exists', len(os.listdir(download_dir)) / 4) while pct <= 100: for i in clst: if int(i) in xrange(161, 171): continue if loc != 'tw': if i in tlst: print(i, '-tw'...
open('%s/%s-%s_%d.png' % (download_dir, cname[i][0].decode('utf-8'), i, j), 'wb').write(dt)
Given the code snippet: <|code_start|># coding:utf-8 # start meta __plugin_name__ = 'MAW自动配卡转换插件' __author = 'fffonion' __version__ = 0.11 hooks = {} extra_cmd = {'mi':'maw_importter', 'cmi':'clear_maw_importted'} def _set_cfg_val(cf, sec, key, val): if not cf.has_section(sec): cf.add_section(sec) cf....
cf.write(f)
Using the snippet: <|code_start|> else: return body def _check_update(silent = False): check_file = opath.join(_get_temp(), '.MAClient.noupdate') if opath.exists(check_file): if time.time() - os.path.getmtime(check_file) < 10800:#3小时内只检查一次 return os.remove...
elif k.name == 'maclient.py':
Given the following code snippet before the placeholder: <|code_start|> dec = _dec else: try: dec = XML2Dict.fromstring(_dec).response except: try: dec = XML2Dict.fromstring(re.compile('&(?!#)').sub('&amp;',_dec)).response ...
if re.match('\d+\:\d+', _gap):
Given the following code snippet before the placeholder: <|code_start|> else: arg_minbc = int(task[i + 1]) self.factor_battle(minbc = arg_minbc, sel_lake = arg_lake) elif task[0] == 'fairy_battle' or task[0] == 'fyb': ...
self.login()
Continue the code snippet: <|code_start|>__version__ = 0.35 hooks = {} extra_cmd = {"reg":"reg_gen"} def reg_gen(plugin_vals): def do(*args): loc = plugin_vals['loc'] po = plugin_vals['poster'] logger = plugin_vals['logger'] if 'player' not in plugin_vals: logger...
while True:
Continue the code snippet: <|code_start|> if cborev: rev[4] = str(cborev) rev_str = rev_str.replace(r, ','.join(rev)) open(opath.join(getPATH0, 'db/revision.txt'), 'w').write(rev_str) def check_revision(loc, rev_tuple): rev = get_revision(loc) + [0, 0]#legacy db support if rev: retur...
c.name,
Based on the snippet: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A view provider based on jinja2 template...
def generateViewProvider(self, argstring=""):
Given the following code snippet before the placeholder: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A vie...
def generateViewProvider(self, argstring=""):
Next line prediction: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A view provider based on jinja2 template...
def generateViewProvider(self, argstring=""):
Next line prediction: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A view provider based on jinja2 template...
def generateViewProvider(self, argstring=""):
Here is a snippet: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A view provider based on jinja2 templates. ...
def generateViewProvider(self, argstring=""):
Given the code snippet: <|code_start|> # Standard library # Application modules # External modules class Jinja2ViewProviderFactory(object): """ """ implements(IPlugin, IViewProviderFactory) tag = "jinja2_view_provider" opt_help = dedent('''\ A view provider based on jinja2 templa...
def generateViewProvider(self, argstring=""):
Given the code snippet: <|code_start|> # Standard library # Application module # External module class DemoRealmFactory(object): """ """ implements(IPlugin, IRealmFactory) tag = "demo_realm" opt_help = dedent('''\ A demonstration realm that creates an avatar from an ID with phony ...
def generateRealm(self, argstring=""):
Predict the next line after this snippet: <|code_start|> # Standard library # Application module # External module class DemoRealmFactory(object): """ """ implements(IPlugin, IRealmFactory) tag = "demo_realm" opt_help = dedent('''\ A demonstration realm that creates an avatar from ...
def generateRealm(self, argstring=""):
Given the following code snippet before the placeholder: <|code_start|> print("") print "== IRealmFactory test ==" for n, thing in enumerate(getPlugins(IRealmFactory)): print("%02d %s" % (n, thing)) print(thing.tag) print("") print "== ICredentialsChecker test ==" for n, thing in enumerate(getPlugins(I...
print("")
Given snippet: <|code_start|> print("%02d %s" % (n, thing)) print(thing.tag) print("") print "== IRealmFactory test ==" for n, thing in enumerate(getPlugins(IRealmFactory)): print("%02d %s" % (n, thing)) print(thing.tag) print("") print "== ICredentialsChecker test ==" for n, thing in enumerate...
print("%02d %s" % (n, thing))
Given snippet: <|code_start|>#! /usr/bin/env python print "== ITicketStore test ==" for n, thing in enumerate(getPlugins(ITicketStoreFactory)): print("%02d %s" % (n, thing)) print(thing.tag) print("") print "== IRealmFactory test ==" for n, thing in enumerate(getPlugins(IRealmFactory)): print("%02d...
print(thing.authType)
Next line prediction: <|code_start|> # Standard library # Application module # External module class BasicRealmFactory(object): """ A basic realm factory. """ implements(IPlugin, IRealmFactory) tag = "basic_realm" opt_help = dedent('''\ A basic realm that creates an avatar from...
def generateRealm(self, argstring=""):
Predict the next line for this snippet: <|code_start|> # Standard library # Application modules # External modules def compose(*functions): return functools.reduce(lambda f, g: lambda x: f(g(x)), functions) def strip_domain(s): <|code_end|> with the help of current file imports: import functools import string...
pos = s.find('@')
Here is a snippet: <|code_start|> # Application modules # External modules class User(object): implements(ICASUser) username = None attribs = None def __init__(self, username, attribs): self.username = username self.attribs = attribs def logout(self): <|code_end|> . Writ...
pass
Based on the snippet: <|code_start|> @defer.inlineCallbacks def _get_avatar(self, avatarId, mind): endpointstr = self._endpointstr basedn = self._basedn binddn = self._binddn bindpw = self._bindpw query = self._query_template % {'username': escape_filter_chars(avatarId)} ...
if startTlsAuthority is not None:
Continue the code snippet: <|code_start|> if not ICASUser in interfaces: raise NotImplementedError("This realm only implements ICASUser.") return (ICASUser, avatar, avatar.logout) d = self._get_avatar(avatarId, mind) return d.addCallback(cb) ...
client = yield connectProtocol(e, LDAPClient())
Based on the snippet: <|code_start|> aliases=None, service_based_attribs=False, start_tls=False, start_tls_hostname=None, start_tls_cacert=None): if attribs is None: attribs = [] # Turn attribs into mapping of att...
("The provided CA cert file, '{0}', "
Next line prediction: <|code_start|> raise Exception( ("The provided CA cert file, '{0}', " "contained {1} certificates. It must contain exactly one.").format( startTlsCaCert, len(authorities))) return Certificate.loadPEM(authorities[0]) def r...
else:
Predict the next line after this snippet: <|code_start|> class LDAPRealm(object): implements(IRealm, IServiceManagerAcceptor) service_manager = None def __init__(self, endpointstr, basedn, binddn, bindpw, query_template='(uid=%(username)s)', attribs=None, ...
self._startTlsHostName = start_tls_hostname
Given the following code snippet before the placeholder: <|code_start|> def __init__(self, endpointstr, basedn, binddn, bindpw, query_template='(uid=%(username)s)', attribs=None, aliases=None, service_based_attribs=False, start_tls=Fa...
authorities = [str(cert) for cert in pem.parse_file(startTlsCaCert)]
Given the code snippet: <|code_start|> if argstring.strip() != "": argdict = dict((x.split('=') for x in argstring.split(':'))) ldap_settings.update(argdict) missing = txcas.utils.get_missing_args( LDAPRealm.__init__, ldap_settings, ['self']) if len(mis...
buf.append(" - %s: %s" % (k, v))
Given the code snippet: <|code_start|>#! /usr/bin/env python from __future__ import print_function def custom_login(ticket, service, failed, request): service_lookup = { 'http://127.0.0.1:9801/landing': 'Cool App #1', 'http://127.0.0.1:9802/landing': 'Awesome App #2', 'http://127.0.0.1:980...
<body>
Predict the next line after this snippet: <|code_start|> if allowed_path == path: return True if not allow_child_paths: return False allowed_parts = allowed_path.split('/')[1:] parts = path.split('/')[1:] for allowed, presented in itertools.izip(allowed_parts, parts): if...
def generateServiceManager(self, argstring=""):
Given snippet: <|code_start|> # Standard library from __future__ import print_function # Application modules # External modules class InMemoryTicketStoreFactory(object): implements(IPlugin, ITicketStoreFactory) tag = "memory_ticket_store" opt_help = dedent('''\ A ticket store that manages all ...
- ticket_size
Using the snippet: <|code_start|># Standard library from __future__ import print_function # Application modules # External modules class InMemoryTicketStoreFactory(object): implements(IPlugin, ITicketStoreFactory) tag = "memory_ticket_store" opt_help = dedent('''\ A ticket store that manages a...
ts_settings = settings.get('CAS', {})
Continue the code snippet: <|code_start|> if result is None: result = fn(*args, **kwargs) cache.set(cache_key, result, expiration) return result return wrapper return cache_page_mesto_dc @gzip_page @never_cache # zabranime prohlizeci cach...
request,
Given snippet: <|code_start|># views.py @gzip_page @cache_page(24 * 60 * 60) # cachujeme view v memcached s platnosti 24h @csrf_protect def mapa_view(request, poi_id=None): vrstvy = OverlayLayer.objects.filter(status__show=True) # volitelne poi_id zadane mape jako bod, na ktery se ma zazoomovat cente...
'cyclestreetsapikey': settings.CYCLESTREETS_API_KEY,
Predict the next line for this snippet: <|code_start|> # Register your models here. class ScopesDefinitionAdminInline(admin.TabularInline): model = Scopes.scopes.through class GroupAdminInline(admin.TabularInline): model = Scopes.group.through @admin.register(Scopes) class ScopesAdmin(admin.ModelAdmin): ...
def get_scopes(self, obj):
Based on the snippet: <|code_start|> # Register your models here. class ScopesDefinitionAdminInline(admin.TabularInline): model = Scopes.scopes.through class GroupAdminInline(admin.TabularInline): model = Scopes.group.through @admin.register(Scopes) class ScopesAdmin(admin.ModelAdmin): list_display =...
return ' '.join(
Given the code snippet: <|code_start|> def process_request(self, request): request.domain = request.META['HTTP_HOST'] request.subdomain = '' request.mesto = None parts = request.domain.split('.') if len(parts) in (2, 3, 4): request.subdomain = parts[0] ...
deprecation.MiddlewareMixin,
Based on the snippet: <|code_start|> sitemaps = { 'pages': NamesSitemap(['mapa_view']), 'pois': PoiSitemap(), } urlpatterns = [ url(r'^$', mapa_view, name="mapa_view"), url(r'^misto/(?P<poi_id>\d+)/$', mapa_view, name="mapa_view"), url(r'^kml/([-\w]+)/$', kml_view, name="kml_view"), url(r'^cs...
]
Predict the next line for this snippet: <|code_start|> sitemaps = { 'pages': NamesSitemap(['mapa_view']), 'pois': PoiSitemap(), <|code_end|> with the help of current file imports: from cyklomapa.feeds import NovinkyFeed, UzavirkyFeed from cyklomapa.views import ( PanelHledaniView, PanelInformaceView, ...
}
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- class UzavirkyFeed(Feed): title = "Městem na kole - aktuální uzavírky" link = "/" description = u"Aktuální uzavírky cyklostezek a cyklotras" def get_object(self, request): return request.mesto def items(self, obj): re...
def item_pubdate(self, item):
Next line prediction: <|code_start|> "windchill_C": "3.55555555556", "appTemp_C": "1.26842313302", "outTemp_C": "3.55555555556", "windGustDir": "275.0", "extraAlarm1": "0.0", "extraAlarm2": "0.0", "extraAlarm3": "0.0", "extraAlarm4": "0.0", "extraAlarm5": "0.0", "extraAlarm6": "0....
"dateTime": "1492467300.0",
Given the code snippet: <|code_start|> "extraAlarm1": "0.0", "extraAlarm2": "0.0", "extraAlarm3": "0.0", "extraAlarm4": "0.0", "extraAlarm5": "0.0", "extraAlarm6": "0.0", "extraAlarm7": "0.0", "extraAlarm8": "0.0", "humidex_C": "3.55555555556", "rain24_cm": "0.88000000022", "r...
"sunset": "1492538940.0",
Given snippet: <|code_start|> # Data payload captured from a Vantage Pro 2 weather station. data = { "windSpeed10_kph": "5.78725803977", "monthET": "1.32", "highUV": "0.0", "cloudbase_meter": "773.082217509", "leafTemp1_C": "8.33333333333", "rainAlarm": "0.0", "pressure_mbar": "948.046280104...
"windrun_km": "1.07449640224",
Based on the snippet: <|code_start|> "extraAlarm8": "0.0", "humidex_C": "3.55555555556", "rain24_cm": "0.88000000022", "rxCheckPercent": "87.9791666667", "hourRain_cm": "0.0", "inTemp_C": "26.8333333333", "watertemp": "8.33333333333", "trendIcon": "59.7350993377", "soilLeafAlarm2": "0...
@pytest.mark.mqtt
Using the snippet: <|code_start|> "dewpoint_C": "2.07088485785", "insideAlarm": "0.0", "inHumidity": "29.0", "soilLeafAlarm4": "0.0", "sunrise": "1492489200.0", "windGust_kph": "9.65608800006", "heatindex_C": "3.55555555556", "dayRain_cm": "0.0", "lowOutTemp": "38.3", "outsideAlar...
"extraAlarm8": "0.0",
Using the snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) @pytest_twisted.inlineCallbacks @pytest.mark.mqtt <|code_end|> , determine the next line of code. You have imports: import logging import pytest import pytest_twisted ...
def test_mqtt_to_influxdb_json_single(machinery, create_influxdb, reset_influxdb):
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) @pytest_twisted.inlineCallbacks @pytest.mark.mqtt @pytest.mark.homie <|code_end|> , generate the next line using the imports in this file: import logging import p...
def test_mqtt_homie(machinery, create_influxdb, reset_influxdb):
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) @pytest_twisted.inlineCallbacks @pytest.mark.mqtt <|code_end|> . Use current file imports: import logging import pytest import pytest_twisted from twisted.inte...
@pytest.mark.homie
Here is a snippet: <|code_start|>PirMotionDetector = BinaryInputPort PrivacyButton = BinaryInputPort SignalLight = BinaryOutputPort OperatorPresenceIndicator = BinaryTopicSignal class FeatureBase(object): # port allocation PORT_LED = 'P8_13' PORT_PRIVACY_BUTTON = 'P8_15' PORT_PIR_SENSOR = 'P8_19' ...
payload = {'node_id': self.node_id}
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> PirMotionDetector = BinaryInputPort PrivacyButton = BinaryInputPort SignalLight = BinaryOutputPort OperatorPresenceIndicator = BinaryTopicSignal class FeatureBase(object): # port allocation ...
PORT_PIR_SENSOR = 'P8_19'
Using the snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> PirMotionDetector = BinaryInputPort PrivacyButton = BinaryInputPort SignalLight = BinaryOutputPort OperatorPresenceIndicator = BinaryTopicSignal class FeatureBase(object): # port allocation P...
PORT_PIR_SENSOR = 'P8_19'
Using the snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> PirMotionDetector = BinaryInputPort PrivacyButton = BinaryInputPort SignalLight = BinaryOutputPort OperatorPresenceIndicator = BinaryTopicSignal class FeatureBase(object): # port allocation P...
self.node_id = node_id
Given snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> PirMotionDetector = BinaryInputPort PrivacyButton = BinaryInputPort SignalLight = BinaryOutputPort OperatorPresenceIndicator = BinaryTopicSignal class FeatureBase(object): # port allocation PORT_...
for event_filter in self.event_filters:
Next line prediction: <|code_start|> self.config = ConfigStoreJson() #print '----------------------', self.config.store #print '----------------------', self.config.get('nodes') #self.nodes = self.config.get('nodes', {}) #print '======================', self.nodes def persist...
except KeyError:
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) @pytest_twisted.inlineCallbacks @pytest.mark.grafana <|code_end|> using the current file's imports: import logging import pytest import pytest_...
def test_mqtt_to_grafana_single(machinery, create_influxdb, reset_influxdb, reset_grafana):
Next line prediction: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) @pytest_twisted.inlineCallbacks @pytest.mark.grafana <|code_end|> . Use current file imports: (import logging import pytest import pytest_twisted from test.settings...
def test_mqtt_to_grafana_single(machinery, create_influxdb, reset_influxdb, reset_grafana):
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014-2015 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> # # derived from https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/pubsub/simple/example2/client.py node_manager = None NODE_ID = str(NodeId()) NODE_HOSTNAME = get_hostnam...
class NodeProtocol(WampWebSocketClientProtocol):
Predict the next line for this snippet: <|code_start|> ] docker_image_version = "0.11.0" def run(self): """ Invoke the image building for all enabled recipes. """ for recipe in self.recipes: # Skip recipes not enabled. if not recipe.enabled: ...
--build-arg BASE_IMAGE={image} - \
Continue the code snippet: <|code_start|> architecture=architecture, flavor=flavor, version=version, ) self.deb(spec) @staticmethod def build_container_name(spec): return f"ephemeral/kotori-bu...
--tag {self.build_container_name(spec)} \
Using the snippet: <|code_start|> flavor=flavor, version=version, ) self.deb(spec) @staticmethod def build_container_name(spec): return f"ephemeral/kotori-build-{spec.distribution}-{spec.architecture}:{spec.version}"...
--build-arg BASE_IMAGE=ephemeral/{spec.distribution}-{spec.architecture}-baseline:latest \
Based on the snippet: <|code_start|> @staticmethod def build_container_name(spec): return f"ephemeral/kotori-build-{spec.distribution}-{spec.architecture}:{spec.version}" def deb(self, spec: PackageSpecification): # Compute package name and path to `.deb` file. package_name = spec.d...
--build-arg ARCHITECTURE={spec.architecture} \
Given the following code snippet before the placeholder: <|code_start|> self.deb(spec) @staticmethod def build_container_name(spec): return f"ephemeral/kotori-build-{spec.distribution}-{spec.architecture}:{spec.version}" def deb(self, spec: PackageSpecification): # Comp...
--build-arg VERSION={spec.version} \
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) event_data = { 'title': 'Some event', 'text': '<a href="https://somewhere.example.org/events?reference=482a38ce-791e-11e6-b152-7cd1c55000be">see also</a>', ...
'tags': 'event,alert,important',
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) event_data = { 'title': 'Some event', 'text': '<a href="https://somewhere.example.org/events?reference=482a38ce-791e-11e6-b152-7cd1c55000be"...
'reference': '482a38ce-791e-11e6-b152-7cd1c55000be',
Given snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) event_data = { 'title': 'Some event', 'text': '<a href="https://somewhere.example.org/events?reference=482a38ce-791e-11e6-b152-7cd1c55000be">see also</a>', 'tags...
@pytest.mark.events
Next line prediction: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) event_data = { 'title': 'Some event', 'text': '<a href="https://somewhere.example.org/events?reference=482a38ce-791e-11e6-b152-7cd1c55000be">see also</a>', ...
@pytest.mark.mqtt
Given snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) event_data = { 'title': 'Some event', 'text': '<a href="https://somewhere.example.org/events?reference=482a38ce-791e-11e6-b152-7cd1c55000be">see also</a>', <|code_en...
'tags': 'event,alert,important',
Here is a snippet: <|code_start|> logger.info('Setting up library "{}" with headers "{}", cache file is "{}"'.format( self.library_file, ', '.join(self.header_files), self.cache_file)) # holding the library essentials self.parser = None self.clib = None self.annotatio...
'uint32_t': c_uint32,
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2015-2016 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> logger = Logger() class LibraryAdapter(object): def __init__(self, header_files, library_file, include_path=None, library_path=None, cache_path=None): self.header_files = to_list(head...
cache_key = \
Predict the next line after this snippet: <|code_start|> @dataclasses.dataclass class DockerImage: name: str architecture: str version: str base_image: str dockerfile: str errors: str @property def tag(self): architecture = self.architecture if architecture == "arm3...
def build(self, package_file: Path):
Based on the snippet: <|code_start|> @dataclasses.dataclass class DockerImage: name: str architecture: str version: str base_image: str dockerfile: str errors: str @property def tag(self): architecture = self.architecture if architecture == "arm32v7": ar...
return f"daqzilla/{self.name}-{architecture}:{self.version}"
Given the following code snippet before the placeholder: <|code_start|> @dataclasses.dataclass class DockerImage: name: str architecture: str version: str base_image: str dockerfile: str errors: str @property def tag(self): architecture = self.architecture if archit...
if self.errors == "raise":
Next line prediction: <|code_start|> @dataclasses.dataclass class DockerImage: name: str architecture: str version: str <|code_end|> . Use current file imports: (import dataclasses import os import requests import sh from datetime import datetime from pathlib import Path from typing import List from in...
base_image: str
Predict the next line after this snippet: <|code_start|> @dataclasses.dataclass class DockerImage: name: str architecture: str version: str base_image: str dockerfile: str errors: str @property def tag(self): architecture = self.architecture if architecture == "arm3...
return f"daqzilla/{self.name}-{architecture}:{self.version}"
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) tasmota_sensor_topic = 'mqttkit-1/itest/foo/bar/tele/SENSOR' tasmota_state_topic = 'mqttkit-1/itest/foo/bar/tele/STATE' @pytest_twisted.inlineCallbacks @pytest.m...
def test_tasmota_sonoff_sc(machinery, create_influxdb, reset_influxdb):
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) tasmota_sensor_topic = 'mqttkit-1/itest/foo/bar/tele/SENSOR' tasmota_state_topic = 'mqttkit-1/itest/foo/bar/tele/STATE' @pytest_...
@pytest.mark.tasmota
Given snippet: <|code_start|> for channel_label in channel_labels: channel_settings = config[channel_label] channel_info = get_channel_info(channel_label, channel_settings) channel_infos.append(channel_info) print(tabulate(channel_infos, headers='keys')) def get_channel_info(channel_lab...
except KeyError:
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2016-2021 Andreas Motl <andreas.motl@elmyra.de> log = Logger() try: except ImportError: <|code_end|> . Use current file imports: import tempfile import pandas from twisted.logger import Logger, LogLevel from twisted.web.template import render...
log.failure('Tabular export not available, please install "pandas".', level=LogLevel.warn)
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2016-2021 Andreas Motl <andreas.motl@elmyra.de> log = Logger() try: except ImportError: log.failure('Tabular export not available, please install "pandas".', level=LogLevel.warn) <|code_end|> , generate the next line using the imports in this f...
class UniversalTabularExporter(object):
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2014 Andreas Motl, Elmyra UG <andreas.motl@elmyra.de> log = Logger() class CustomTemplate(Template): delimiter = '$$' class WebDashboard(Resource): def getChild(self, name, request): print('getChild:', name) ...
self.websocket_uri = websocket_uri
Given snippet: <|code_start|> document_root = resource_filename('kotori.web', '') return File(document_root) class WebDashboardIndex(Resource): def __init__(self, websocket_uri, filename): Resource.__init__(self) self.websocket_uri = websocket_uri self.filename = fi...
dashboard.putChild('poly.html', WebDashboardIndex(websocket_uri=websocket_uri, filename='poly.html'))
Next line prediction: <|code_start|> settings.setdefault('host', u'localhost') settings.setdefault('port', u'8086') settings.setdefault('username', u'root') settings.setdefault('password', u'root') settings.setdefault('database', database) settings.setdefault('pool_size', ...
timeout=10)
Next line prediction: <|code_start|> def write(self, meta, data): meta_copy = deepcopy(dict(meta)) data_copy = deepcopy(data) try: chunk = self.format_chunk(meta, data) except Exception as ex: log.failure(u'Could not format chunk (ex={ex_name}: {ex}): data=...
success = self.write_chunk(meta, chunk)
Continue the code snippet: <|code_start|> # Bookeeping for all databases having been touched already self.databases_written_once = set() # Knowledge about all databases to be accessed using UDP # TODO: Refactor to configuration setting self.udp_databases = [ {'name':...
return True
Given the following code snippet before the placeholder: <|code_start|> data_in = { "esp8266id": 12041741, "sensordatavalues": [ { "value_type": "SDS_P1", "value": "35.67" }, { "value_type": "SDS_P2", "value": "17.00" }, { "value_type": "BME280_temperature", "...
"value": "77"
Given the following code snippet before the placeholder: <|code_start|> data_in = { "esp8266id": 12041741, "sensordatavalues": [ { "value_type": "SDS_P1", "value": "35.67" }, { "value_type": "SDS_P2", "value": "17.00" }, { "value_type": "BME280_temperature", ...
"value_type": "min_micro",
Given snippet: <|code_start|> logger = logging.getLogger(__name__) # https://community.hiveeyes.org/t/more-data-acquisition-payload-formats-for-kotori/1421/2 data_in = { "esp8266id": 12041741, "sensordatavalues": [ { "value_type": "SDS_P1", "value": "35.67" }, { "value_type": "SDS...
},
Based on the snippet: <|code_start|> logger = logging.getLogger(__name__) # https://community.hiveeyes.org/t/more-data-acquisition-payload-formats-for-kotori/1421/2 data_in = { "esp8266id": 12041741, "sensordatavalues": [ { "value_type": "SDS_P1", "value": "35.67" }, { "value_type...
},
Predict the next line after this snippet: <|code_start|> }, { "value_type": "BME280_temperature", "value": "-2.83" }, { "value_type": "BME280_humidity", "value": "66.73" }, { "value_type": "BME280_pressure", "value": "100535.97" }, { "value_type":...
"software_version": "NRZ-2018-123B"
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) # https://community.hiveeyes.org/t/more-data-acquisition-payload-formats-for-kotori/1421/2 data_in = { "esp8266id": 12041741, "sensordatavalues": [ { ...
"value_type": "SDS_P2",
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- # (c) 2020-2021 Andreas Motl <andreas@getkotori.org> logger = logging.getLogger(__name__) # https://community.hiveeyes.org/t/more-data-acquisition-payload-formats-for-kotori/1421/2 data_in = { "esp8266id": 12041741, "sensordatavalues": [ { ...
{