prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
recs = self.get_selected_recs() l = len(recs) if l > 20: if not de.getBoolean( title=_('Email recipes'), # only called for l>20, so fancy gettext methods # shouldn't be necessary if my knowledge of # linguistics serves m...
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
recs = self.rd.fetch_all(self.rd.recipe_table, deleted=False, sort_by=[('title',1)])
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
if not de.getBoolean( title=_('Email recipes'), # only called for l>20, so fancy gettext methods # shouldn't be necessary if my knowledge of # linguistics serves me sublabel=_('Do you really want to email all %s selected recipes...
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
return
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
setup_action_groups
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
activate
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
get_selected_recs
<|file_name|>emailer_plugin.py<|end_file_name|><|fim▁begin|>from gi.repository import Gtk import gourmet.gtk_extras.dialog_extras as de from gourmet.plugin import RecDisplayModule, UIPlugin, MainPlugin, ToolPlugin from .recipe_emailer import RecipeEmailer from gettext import gettext as _ class EmailRecipePlugin (MainP...
email_selected
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.<|fim▁hole|># All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #----...
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
'''Configure the default output state to generate output saved to a file when :func:`show` is called. Does not change the current ``Document`` from ``curdoc()``. File and notebook output may be active at the same time, so e.g., this does not clear the effects of ``output_notebook()``. Args: ...
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
''' Configure the default output state to generate output in notebook cells when :func:`show` is called. Note that, :func:`show` may be called multiple times in a single cell to display multiple objects in the output cell. The objects will be displayed in order. Args: resources (Resource, o...
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
''' Clear the default state of all output modes. Returns: None ''' curstate().reset()
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
output_file
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
output_notebook
<|file_name|>output.py<|end_file_name|><|fim▁begin|>#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #---------------...
reset_output
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
"""Setup the uncased bert model. Args: model_config: The model configuration to be loaded. Returns: tokenizer: The tokenizer to be used to convert between tokens and ids. model: The model that has been initialized. device: The device to be used in this run. embedding_map: Holding all token e...
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
"""Setup the uncased bert model without embedding maps. Args: model_config: The model configuration to be loaded. Returns: tokenizer: The tokenizer to be used to convert between tokens and ids. model: The model that has been initialized. device: The device to be used in this run. """ # Load ...
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
"""Setup the uncased bert model with classification head. Args: model_config: The model configuration to be loaded. Returns: tokenizer: The tokenizer to be used to convert between tokens and ids. model: The model that has been initialized. device: The device to be used in this run. """ # Loa...
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
setup_uncased
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
setup_bert_vanilla
<|file_name|>setup_helper.py<|end_file_name|><|fim▁begin|># Copyright 2018 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licen...
setup_bert_mlm
<|file_name|>test_is_thue_morse.py<|end_file_name|><|fim▁begin|>"""Test.""" import pytest TM_TABLE = [ ([0, 1, 1, 0, 1], True), ([0], True), ([1], False), ([0, 1, 0, 0], False), ] <|fim▁hole|>def test_is_thue_morse(n, result): """Test.""" from is_thue_morse import is_thue_morse assert is...
@pytest.mark.parametrize("n, result", TM_TABLE)
<|file_name|>test_is_thue_morse.py<|end_file_name|><|fim▁begin|>"""Test.""" import pytest TM_TABLE = [ ([0, 1, 1, 0, 1], True), ([0], True), ([1], False), ([0, 1, 0, 0], False), ] @pytest.mark.parametrize("n, result", TM_TABLE) def test_is_thue_morse(n, result): <|fim_middle|> <|fim▁end|>
"""Test.""" from is_thue_morse import is_thue_morse assert is_thue_morse(n) == result
<|file_name|>test_is_thue_morse.py<|end_file_name|><|fim▁begin|>"""Test.""" import pytest TM_TABLE = [ ([0, 1, 1, 0, 1], True), ([0], True), ([1], False), ([0, 1, 0, 0], False), ] @pytest.mark.parametrize("n, result", TM_TABLE) def <|fim_middle|>(n, result): """Test.""" from is_thue_morse i...
test_is_thue_morse
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Rappresenta un giudizio sociale ad un oggetto generico. Utilizzare tramite il tratto ConGiudizio ed i suoi metodi. """ class Meta: verbose_name_plural = "Giudizi" permissions = ( ("view_giudizio", "Can view giudizio"), ) autore = models.ForeignKey("anagr...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
verbose_name_plural = "Giudizi" permissions = ( ("view_giudizio", "Can view giudizio"), )
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Rappresenta un commento sociale ad un oggetto generico. Utilizzare tramite il tratto ConCommento ed i suoi metodi. """ class Meta: verbose_name_plural = "Commenti" app_label = "social" abstract = False permissions = ( ("view_commento", "Can view comme...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
verbose_name_plural = "Commenti" app_label = "social" abstract = False permissions = ( ("view_commento", "Can view commento"), )
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Aggiunge le funzionalita' di giudizio, stile social, positivi o negativi. """ class Meta: abstract = True giudizi = GenericRelation( Giudizio, related_query_name='giudizi', content_type_field='oggetto_tipo', object_id_field='oggetto_id' ) de...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
abstract = True
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Registra un giudizio positivo :param autore: Autore del giudizio """ self._giudizio(autore, True)
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Registra un giudizio negativo :param autore: Autore del giudizio """ self._giudizio(autore, False)
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Registra un giudizio :param autore: Autore del giudizio :param positivo: Vero se positivo, falso se negativo """ g = self.giudizio_cerca(autore) if g: # Se gia' esiste un giudizio, modifico il tipo g.positivo = positivo else: # Altrimenti...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Restituisce il numero di giudizi positivi associati all'oggetto. """ return self._giudizi(self, True)
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Restituisce il numero di giudizi negativi associati all'oggetto. """ return self._giudizi(self, False)
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Restituisce il numero di giudizi positivi o negativi associati all'oggetto. """ return self.giudizi.filter(positivo=positivo).count()
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Cerca il giudizio di un autore sull'oggetto. Se non presente, ritorna None. """ g = self.giudizi.filter(autore=autore)[:1] if g: return g return None
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" Aggiunge la possibilita' di aggiungere commenti ad un oggetto. """ class Meta: abstract = True commenti = GenericRelation( Commento, related_query_name='%(class)s', content_type_field='oggetto_tipo', object_id_field='oggetto_id' ) def commen...
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
abstract = True
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
""" SOVRASCRIVIMI! Ritorna il queryset di persone che devono ricevere una notifica ogni volta che un commento viene aggiunto da un dato mittente. """ from anagrafica.models import Persona return Persona.objects.none()
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
g.positivo = positivo
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
g = Giudizio( oggetto=self, positivo=positivo, autore=autore )
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
return g
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
giudizio_positivo
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
giudizio_negativo
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
_giudizio
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
giudizi_positivi
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
giudizi_negativi
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
_giudizi
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
giudizio_cerca
<|file_name|>models.py<|end_file_name|><|fim▁begin|>from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation from django.contrib.contenttypes.models import ContentType from django.db import models from base.models import ModelloSemplice from base.tratti import ConMarcaTemporale class Giudizi...
commento_notifica_destinatari
<|file_name|>ipblock.py<|end_file_name|><|fim▁begin|><|fim▁hole|>import sys def ip2str(ip): l = [ (ip >> (3*8)) & 0xFF, (ip >> (2*8)) & 0xFF, (ip >> (1*8)) & 0xFF, (ip >> (0*8)) & 0xFF, ] return '.'.join([str(i) for i in l]) def str2ip(line): a, b, c, d = [int(s) fo...
#!/usr/bin/env python
<|file_name|>ipblock.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys def ip2str(ip): <|fim_middle|> def str2ip(line): a, b, c, d = [int(s) for s in line.split('.')] ip = 0 ip += (a << (3*8)) ip += (b << (2*8)) ip += (c << (1*8)) ip += (d << (0*8)) return ip blockip ...
l = [ (ip >> (3*8)) & 0xFF, (ip >> (2*8)) & 0xFF, (ip >> (1*8)) & 0xFF, (ip >> (0*8)) & 0xFF, ] return '.'.join([str(i) for i in l])
<|file_name|>ipblock.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys def ip2str(ip): l = [ (ip >> (3*8)) & 0xFF, (ip >> (2*8)) & 0xFF, (ip >> (1*8)) & 0xFF, (ip >> (0*8)) & 0xFF, ] return '.'.join([str(i) for i in l]) def str2ip(line): <|fim_middle|...
a, b, c, d = [int(s) for s in line.split('.')] ip = 0 ip += (a << (3*8)) ip += (b << (2*8)) ip += (c << (1*8)) ip += (d << (0*8)) return ip
<|file_name|>ipblock.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys def <|fim_middle|>(ip): l = [ (ip >> (3*8)) & 0xFF, (ip >> (2*8)) & 0xFF, (ip >> (1*8)) & 0xFF, (ip >> (0*8)) & 0xFF, ] return '.'.join([str(i) for i in l]) def str2ip(line): a, b,...
ip2str
<|file_name|>ipblock.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import sys def ip2str(ip): l = [ (ip >> (3*8)) & 0xFF, (ip >> (2*8)) & 0xFF, (ip >> (1*8)) & 0xFF, (ip >> (0*8)) & 0xFF, ] return '.'.join([str(i) for i in l]) def <|fim_middle|>(line): a, b,...
str2ip
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
{time_total} Print total song time in milliseconds
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
" """ # available configuration parameters cache_timeout = 5 format = u'♫ {info}' @staticmethod def _run_cmd(cmd): return check_output(['gpmdp-remote', cmd]).decode('utf-8').strip() def gpmdp(self, i3s_output_list, i3s_config): if self._run_cmd('status') == 'Paused': ...
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
rn check_output(['gpmdp-remote', cmd]).decode('utf-8').strip()
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
elf._run_cmd('status') == 'Paused': result = '' else: cmds = ['info', 'title', 'artist', 'album', 'status', 'current', 'time_total', 'time_current', 'album_art'] data = {} for cmd in cmds: if '{%s}' % cmd in self.format:...
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
lt = ''
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
= ['info', 'title', 'artist', 'album', 'status', 'current', 'time_total', 'time_current', 'album_art'] data = {} for cmd in cmds: if '{%s}' % cmd in self.format: data[cmd] = self._run_cmd(cmd) result = self.format....
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
[cmd] = self._run_cmd(cmd)
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
Run module in test mode. """ from py3status.module_test import module_test module_test(Py3status)
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
_cmd(cmd
<|file_name|>gpmdp.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """ Display currently playing song from Google Play Music Desktop Player. Configuration parameters: cache_timeout: how often we refresh this module in seconds (default 5) format: specify the items and ordering of the data in th...
p(sel
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): <|fim_middle|> <|fim▁end|>
class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in_decimal"] pass class ApplicableAddon(Model): fields = ["id"] pass class AttachedAddon(Model): fields = ["id", "quantity", "billing_cycles", "typ...
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): <|fim_middle|> class ApplicableAddon(Model): fields = ["id"] pass class AttachedAddon(Model):...
fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in_decimal"] pass
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
fields = ["id"] pass
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
fields = ["id", "quantity", "billing_cycles", "type", "quantity_in_decimal"] pass
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
fields = ["id", "quantity", "on_event", "charge_once", "quantity_in_decimal"] pass
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('post', request.uri_path("plans"), params, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('post', request.uri_path("plans",id), params, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send_list_request('get', request.uri_path("plans"), params, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('get', request.uri_path("plans",id), None, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('post', request.uri_path("plans",id,"delete"), None, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('post', request.uri_path("plans","copy"), params, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
return request.send('post', request.uri_path("plans",id,"unarchive"), None, env, headers)
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
create
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
update
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
list
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
retrieve
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
delete
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
copy
<|file_name|>plan.py<|end_file_name|><|fim▁begin|>import json from chargebee.model import Model from chargebee import request from chargebee import APIError class Plan(Model): class Tier(Model): fields = ["starting_unit", "ending_unit", "price", "starting_unit_in_decimal", "ending_unit_in_decimal", "price_in...
unarchive
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
self._state = result.lower() in ("true", STATE_ON)
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Create the Template switches.""" switches = [] for device, device_config in config[CONF_SWITCHES].items(): friendly_name = device_config.get(ATTR_FRIENDLY_NAME, device) state_template = device_config.get(CONF_VALUE_TEMPLATE) icon_template = device_config.get(CONF_ICON_TEMPLATE) ...
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Set up the template switches.""" await async_setup_reload_service(hass, DOMAIN, PLATFORMS) async_add_entities(await _async_create_entities(hass, config))
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Representation of a Template switch.""" def __init__( self, hass, device_id, friendly_name, state_template, icon_template, entity_picture_template, availability_template, on_action, off_action, unique_id, ): ...
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Initialize the Template switch.""" super().__init__( availability_template=availability_template, icon_template=icon_template, entity_picture_template=entity_picture_template, ) self.entity_id = async_generate_entity_id( ENTITY_ID_FORMAT...
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
super()._update_state(result) if isinstance(result, TemplateError): self._state = None return self._state = result.lower() in ("true", STATE_ON)
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Register callbacks.""" if self._template is None: # restore state after startup await super().async_added_to_hass() state = await self.async_get_last_state() if state: self._state = state.state == STATE_ON # no need to lis...
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Return the name of the switch.""" return self._name
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Return the unique id of this switch.""" return self._unique_id
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Return true if device is on.""" return self._state
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Return the polling state.""" return False
<|file_name|>switch.py<|end_file_name|><|fim▁begin|>"""Support for switches which integrates with other components.""" import logging import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( ATTR_ENTITY_...
"""Fire the on action.""" await self._on_script.async_run(context=self._context) if self._template is None: self._state = True self.async_write_ha_state()