prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
my_app_id = 'my_app_id' my_secret = 'my_secret' # Create a Pushbots instance pushbots = Pushbots(app_id=my_app_id, secret=my_secret)
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
"""Get analytics by calling Pushbots.get_analytics()""" # Define app_id and secret my_app_id = 'my_app_id' my_secret = 'my_secret' # Create a Pushbots instance pushbots = Pushbots(app_id=my_app_id, secret=my_secret) code, message = pushbots.get_analytics() print('Returned code: {0}'.for...
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
"""Record analytics by passing platform directly to Pushbots.record_analytics() """ # Define app_id and secret my_app_id = 'my_app_id' my_secret = 'my_secret' # Create a Pushbots instance pushbots = Pushbots(app_id=my_app_id, secret=my_secret) # Define platform platform = Pushbo...
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
"""Record analytics by passing data defined by you to Pushbots.record_analytics() """ # Define app_id and secret my_app_id = 'my_app_id' my_secret = 'my_secret' # Create a Pushbots instance pushbots = Pushbots(app_id=my_app_id, secret=my_secret) # Define data data = {'platform':...
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
example_get_analytics
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
example_record_analytics1
<|file_name|>analytics.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ The following examples are used to demonstrate how to get/record analytics The method signatures are: Pushbots.get_analytics() and Pushbots.record_analytics(platform=None, data=None) In which you must specify either platform or data. ...
example_record_analytics2
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from .models import AbuseReport, SearchTermRecord admin.site.register(AbuseReport) class SearchTermAdmin(admin.ModelAdmin): list_display = ('__unicode__...
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from .models import AbuseReport, SearchTermRecord admin.site.register(AbuseReport) class SearchTermAdmin(admin.ModelAdmin): <|fim_middle|> admin.site...
list_display = ('__unicode__', 'ip_address', 'get_user_full_name', ) search_fields = ('term', ) def get_user_full_name(self, obj): if obj.user is None: return "(%s)" % _(u"None") return obj.user.get_full_name() get_user_full_name.short_description = "user"
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from .models import AbuseReport, SearchTermRecord admin.site.register(AbuseReport) class SearchTermAdmin(admin.ModelAdmin): list_display = ('__unicode__...
if obj.user is None: return "(%s)" % _(u"None") return obj.user.get_full_name()
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from .models import AbuseReport, SearchTermRecord admin.site.register(AbuseReport) class SearchTermAdmin(admin.ModelAdmin): list_display = ('__unicode__...
return "(%s)" % _(u"None")
<|file_name|>admin.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- from django.contrib import admin from django.utils.translation import ugettext as _ from .models import AbuseReport, SearchTermRecord admin.site.register(AbuseReport) class SearchTermAdmin(admin.ModelAdmin): list_display = ('__unicode__...
get_user_full_name
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
def disconnect(): pass
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
nfig = dict(hf.config.items("database")) hf.database.engine = engine_from_config(config, prefix="") if implicit_execution: metadata.bind = hf.database.engine
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
ss
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
tadata.bind = hf.database.engine
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
nnect(i
<|file_name|>database.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
sconnect()
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
Internal implementation of TimerService. """
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
def __init__(self, timestamp: int, key: K, namespace: N): self._timestamp = timestamp self._key = key self._namespace = namespace def get_timestamp(self) -> int: return self._timestamp def get_key(self) -> K: return self._key def get_namespace(self) -> N: ...
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._timestamp = timestamp self._key = key self._namespace = namespace
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._timestamp
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._key
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._namespace
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
result = int(self._timestamp ^ (self._timestamp >> 32)) result = 31 * result + hash(tuple(self._key)) result = 31 * result + hash(self._namespace) return result
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self.__class__ == other.__class__ and self._timestamp == other._timestamp \ and self._key == other._key and self._namespace == other._namespace
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
REGISTER_EVENT_TIMER = 0 REGISTER_PROC_TIMER = 1 DELETE_EVENT_TIMER = 2 DELETE_PROC_TIMER = 3
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
""" Internal implementation of InternalTimerService. """ def __init__(self, keyed_state_backend: RemoteKeyedStateBackend): self._keyed_state_backend = keyed_state_backend self._current_watermark = None self.timers = collections.OrderedDict() def current_processing_time(self...
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._keyed_state_backend = keyed_state_backend self._current_watermark = None self.timers = collections.OrderedDict()
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return int(time.time() * 1000)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._current_watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._current_watermark = watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_key = self._keyed_state_backend.get_current_key() timer = (TimerOperandType.REGISTER_PROC_TIMER, InternalTimerImpl(t, current_key, namespace)) self.timers[timer] = None
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_key = self._keyed_state_backend.get_current_key() timer = (TimerOperandType.REGISTER_EVENT_TIMER, InternalTimerImpl(t, current_key, namespace)) self.timers[timer] = None
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_key = self._keyed_state_backend.get_current_key() timer = (TimerOperandType.DELETE_PROC_TIMER, InternalTimerImpl(t, current_key, namespace)) self.timers[timer] = None
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_key = self._keyed_state_backend.get_current_key() timer = (TimerOperandType.DELETE_EVENT_TIMER, InternalTimerImpl(t, current_key, namespace)) self.timers[timer] = None
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
""" Internal implementation of TimerService. """ def __init__(self, internal_timer_service: InternalTimerServiceImpl): self._internal = internal_timer_service self.timers = self._internal.timers def current_processing_time(self) -> int: return self._internal.current_process...
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal = internal_timer_service self.timers = self._internal.timers
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._internal.current_processing_time()
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
return self._internal.current_watermark()
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal.advance_watermark(wm)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal.register_processing_time_timer(None, t)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal.register_event_time_timer(None, t)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal.delete_processing_time_timer(None, t)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
self._internal.delete_event_time_timer(None, t)
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
__init__
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
get_timestamp
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
get_key
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
get_namespace
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
__hash__
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
__eq__
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
__init__
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_processing_time
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
advance_watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
register_processing_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
register_event_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
delete_processing_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
delete_event_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
__init__
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_processing_time
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
current_watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
advance_watermark
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
register_processing_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
register_event_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
delete_processing_time_timer
<|file_name|>timerservice_impl.py<|end_file_name|><|fim▁begin|>################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional infor...
delete_event_time_timer
<|file_name|>metadata_definitions.py<|end_file_name|><|fim▁begin|># coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Flood Raster Impact on Population. Contact : ole.moller.nielsen@gmail.com<|fim▁hole|> it under the terms of the GNU General Public License as published by the Free Software Founda...
.. note:: This program is free software; you can redistribute it and/or modify
<|file_name|>metadata_definitions.py<|end_file_name|><|fim▁begin|># coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Flood Raster Impact on Population. Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU...
"""Metadata for FloodEvacuationFunction. .. versionadded:: 2.1 We only need to re-implement as_dict(), all other behaviours are inherited from the abstract base class. """ @staticmethod def as_dict(): """Return metadata as a dictionary. This is a static method. You can us...
<|file_name|>metadata_definitions.py<|end_file_name|><|fim▁begin|># coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Flood Raster Impact on Population. Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU...
"""Return metadata as a dictionary. This is a static method. You can use it to get the metadata in dictionary format for an impact function. :returns: A dictionary representing all the metadata for the concrete impact function. :rtype: dict """ dict_...
<|file_name|>metadata_definitions.py<|end_file_name|><|fim▁begin|># coding=utf-8 """InaSAFE Disaster risk tool by Australian Aid - Flood Raster Impact on Population. Contact : ole.moller.nielsen@gmail.com .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU...
as_dict
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
else:
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
def test_correct_output(self): hfmt = HtmlFormatter(nowrap=True) houtfile = StringIO.StringIO() hfmt.format(tokensource, houtfile) nfmt = NullFormatter() noutfile = StringIO.StringIO() nfmt.format(tokensource, noutfile) stripped_html = re.sub('<.*?>', '', ho...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
hfmt = HtmlFormatter(nowrap=True) houtfile = StringIO.StringIO() hfmt.format(tokensource, houtfile) nfmt = NullFormatter() noutfile = StringIO.StringIO() nfmt.format(tokensource, noutfile) stripped_html = re.sub('<.*?>', '', houtfile.getvalue()) escaped_...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
fmt1 = HtmlFormatter(full=True, cssfile='fmt1.css', outencoding='utf-8') # CSS should be in TESTDIR (TESTDIR is absolute) fmt2 = HtmlFormatter(full=True, cssfile=join(TESTDIR, 'fmt2.css'), outencoding='utf-8') tfile = tempfile.NamedTemporaryFile(suffix='.html...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
for optdict in [dict(nowrap=True), dict(linenos=True), dict(linenos=True, full=True), dict(linenos=True, full=True, noclasses=True)]: outfile = StringIO.StringIO() fmt = HtmlFormatter(**optdict) fmt.form...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
fmt = HtmlFormatter(full=True, linenos=True, noclasses=True, outencoding='utf-8') handle, pathname = tempfile.mkstemp('.html') tfile = os.fdopen(handle, 'w+b') fmt.format(tokensource, tfile) tfile.close() catname = os.path.join(TESTDIR, 'dtds'...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
fmt = HtmlFormatter() sd = fmt.get_style_defs() self.assert_(sd.startswith('.')) fmt = HtmlFormatter(cssclass='foo') sd = fmt.get_style_defs() self.assert_(sd.startswith('.foo')) sd = fmt.get_style_defs('.bar') self.assert_(sd.startswith('.bar')) ...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
fmt = HtmlFormatter(title=u'Föö', cssclass=u'bär', cssstyles=u'div:before { content: \'bäz\' }', encoding='utf-8') handle, pathname = tempfile.mkstemp('.html') tfile = os.fdopen(handle, 'w+b') fmt.format(...
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
raise OSError # not found
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
self.failIf(ret, 'nsgmls run reported errors')
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_correct_output
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_external_css
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_all_options
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_valid_output
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_get_style_defs
<|file_name|>test_html_formatter.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Pygments HTML formatter tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2009 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import unittest im...
test_unicode_options
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
str = '' if len(specific_status) > 0:
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants <|fim_middle|> <|fim▁end|>
NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_cmd.FLOAT STRING = hazc_cmd.STRING INT = hazc_cmd.INT global running running = False def __init__(self, ipaddr): self.version = "0.1" self.config = configparser.ConfigParser() self.config.read('c...
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
self.version = "0.1" self.config = configparser.ConfigParser() self.config.read('config.ini') self.MSGLEN = 1024 self.END_OF_MSG = '*' self.ip = ipaddr self.buffer = 20 # self.commands = {'version?':self.version_cmd,'commands?':self.commands_cmd,'status?':...
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
if not('?' in name or '!' in name): # log("Function name requires a '?' or '!', assuming '!'") name += '!' self.commands[name] = hazc_cmd.hazc_cmd(name, handler, paramtype)
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
cmd_name = 'set-'+controlname self.commands[cmd_name] = hazc_cmd.hazc_cmd(cmd_name+'?', handler, paramtype) self.addStatus(controlname, statushandler)
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
self.status[name] = handler
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
postfix = self.config['global']['service_prefix'] self.port = int(self.config['global']['port']) #print(self.config['device']['hostname']+postfix) info = ServiceInfo(postfix, self.config['device']['hostname']+"."+postfix, socket.inet_aton(self.ip), self.port, 0, 0,...
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
data = bytes() rbytes = 0 while rbytes < self.MSGLEN: d = self.conn.recv(self.buffer) if not d: break data += d rbytes += len(d) # print data.decode('utf-8') self.handledata(data)
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
command, param = self.cleanandstringdata(data) print('->' + command + ';' + param) # replystr = "ERROR" try: replystr = self.commands[command].execute(param) except KeyError: if(command==''): command = "(empty string)" print("E...
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
longmsg = msg while len(longmsg) < self.MSGLEN: longmsg += self.END_OF_MSG # print(longmsg) self.conn.send(longmsg.encode('utf-8'))
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
dstr = data.decode('utf-8') full = dstr.strip(self.END_OF_MSG) if '?' in full: li = full.split('?') param = li[-1] cmd = li[0] elif '!' in full: li = full.split('!') param = li[-1] cmd = li[0] else: ...
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
try: self.webcontrol = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.webcontrol.bind((self.ip, self.port)) self.webcontrol.listen(1) except OSError as e: print(e) quit()
<|file_name|>hazc_device.py<|end_file_name|><|fim▁begin|>#!/usr/local/bin/python3 from zeroconf import Zeroconf, ServiceInfo import socket import configparser from . import hazc_cmd # import pdb class hazc_device: #Forward constants NO_PARAM = hazc_cmd.NO_PARAM BOOL = hazc_cmd.BOOL FLOAT = hazc_c...
return "Running"