prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | ret.append(('', day))
prev_day = day
continue |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | item = ('down', day) |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | item = ('up', day) |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | item = ('equal', day) |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | get_data = lambda x: x['apps'][app]['percent'] |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | get_data = lambda x: x['percent'] |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def <|fim_middle|>(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = Non... | __init__ |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | get_data |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | summary |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | _mark_movement |
<|file_name|>status.py<|end_file_name|><|fim▁begin|>import requests
class Status(object):
SKIP_LOCALES = ['en_US']
def __init__(self, url, app=None, highlight=None):
self.url = url
self.app = app
self.highlight = highlight or []
self.data = []
self.created = None
... | history |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | except User.DoesNotExist:
return None |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | def authenticate(self, assertion):
logging.warning('entering authenticate function')
response = requests.post(
PERSONA_VERIFY_URL,
data = {'assertion': assertion, 'audience': settings.DOMAIN}
)
logging.warning('got response from persona')
logging.warni... |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | logging.warning('entering authenticate function')
response = requests.post(
PERSONA_VERIFY_URL,
data = {'assertion': assertion, 'audience': settings.DOMAIN}
)
logging.warning('got response from persona')
logging.warning(response.content.decode())
i... |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | try:
return User.objects.get(email=email)
except User.DoesNotExist:
return None |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | email = response.json()['email']
try:
return User.objects.get(email=email)
except User.DoesNotExist:
return User.objects.create(email=email) |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | logger.warning(
'Persona says no. Json was: {}'.format(response.json())
) |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | authenticate |
<|file_name|>authentication.py<|end_file_name|><|fim▁begin|># accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.or... | get_user |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | return w |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
<|fim_middle|>
class PlaySmart(WordPreference):
def __init__(self, *args, **kwargs):
WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_smart'}],*args,**kwargs)... | def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m)
else:
w = voc.get_random_known_w(m=m)
elif voc.get_unknown_words():
w = v... |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
<|fim_middle|>
class PlaySmart(WordPreference):
def __init__(self, *args, **kwargs):
WordPreference.__init__(self,memory_policies=[{'mem_type'... | if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m)
else:
w = voc.get_random_known_w(m=m)
elif voc.get_unknown_words():
w = voc.get_new_unknown_w()
else:
w = vo... |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | def __init__(self, *args, **kwargs):
WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_smart'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_smart'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | def __init__(self, *args, **kwargs):
WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_last'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_last'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | def __init__(self, *args, **kwargs):
WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_first'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | WordPreference.__init__(self,memory_policies=[{'mem_type':'wordpreference_first'}],*args,**kwargs) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
<|fim_middle|>
elif voc.get_unknown_words():
w = voc.get_new_unknown_w()
else:
w = voc.get_random... | if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m)
else:
w = voc.get_random_known_w(m=m) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
<|fim_middle|>
else:
w = voc.get_random_known_w(m=m... | w = mem['prefered words'][m]
if w not in voc.get_known_words(m=m):
w = voc.get_random_known_w(m=m) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | w = voc.get_random_known_w(m=m) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | w = voc.get_random_known_w(m=m) |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | w = voc.get_new_unknown_w() |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | w = voc.get_random_known_w(option='min') |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def <|fim_middle|>(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_kn... | pick_w |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | __init__ |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | __init__ |
<|file_name|>word_preference.py<|end_file_name|><|fim▁begin|>from . import BaseWordChoice
class WordPreference(BaseWordChoice):
def pick_w(self,m,voc,mem,context=[]):
if m in voc.get_known_meanings():
if m in list(mem['prefered words'].keys()):
w = mem['prefered words'][m]
if w not in voc.get_known_word... | __init__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | self.remaining_lines = MAX_NUM_LINES
self.lines = [] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
<|fim_middle|>
def num_lines(string):
"""
Return number of lines.
"""
line_list = string.split("\n")
num = len(line_list)
for l in line_list... | """
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
Construct empty object.
"""
self.num_lines = 0
self.remaining_lines = MAX_NUM_LINES
self.lines = []
def i... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
<|fi... | """
Construct empty object.
"""
self.num_lines = 0
self.remaining_lines = MAX_NUM_LINES
self.lines = [] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Insert string at the end. This always begins a new line.
"""
if (self.num_lines >= MAX_NUM_LINES):
pass
input_num_lines = num_lines(string)
#if (input_num_lines > self.remaining_lines):
# num = self.remaining_lines
#else:
... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Merge with another CmdText object by appending the input objects content.
"""
self.lines |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Remove excessive number of lines. This deletes the oldest half.
"""
if (self.num_lines > MAX_NUM_STORED_LINES):
for i in range(MAX_NUM_STORED_LINES // 2):
self.lines.pop(i) |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Update the number of lines member.
"""
self.num_lines = len(self.lines) |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Return the line with index n.
"""
if n < self.num_lines:
return self.lines[n]
else:
raise IndexError("Line index out of range.") |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Return MAX_NUM_LINES lines.
"""
return self.lines[-MAX_NUM_LINES:] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Iterator for CmdText object.
"""
for l in self.lines:
yield l |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | return self.lines[ind] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Return number of lines.
"""
line_list = string.split("\n")
num = len(line_list)
for l in line_list:
num += (len(string) // LINEWIDTH + 1)
return num |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Return list of lines extracted from string.
"""
line_list = string.split('\n')
new_list = []
for l in line_list:
new_list += [l[i*LINEWIDTH:(i+1)*LINEWIDTH] for i in range(len(l) // LINEWIDTH + 1)]
return new_list |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | def __init__(self, string, rind=None):
CmdText.__init__(self)
self.insert(string)
if (rind is not None):
self.response = rind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | CmdText.__init__(self)
self.insert(string)
if (rind is not None):
self.response = rind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | def __init__(self, string, cind=None):
CmdText.__init__(self)
self.insert(string)
if (cind is not None):
self.command = cind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | CmdText.__init__(self)
self.insert(string)
if (cind is not None):
self.command = cind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Base class for tests.
"""
@classmethod
def run(cls):
"""
Runs all tests (methods which begin with 'test').
"""
#print(cls)
max_len = max([len(a) for a in cls.__dict__])
for key in cls.__dict__:
if key.startswith("test"):
... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Runs all tests (methods which begin with 'test').
"""
#print(cls)
max_len = max([len(a) for a in cls.__dict__])
for key in cls.__dict__:
if key.startswith("test"):
fill = max_len - len(key)
sys.stdout.write("Testing {} ...{}... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Tests for static methods.
"""
def test_get_lines_with_empty_string():
assert get_lines("") == [""]
def test_get_lines_with_short_string():
assert len(get_lines("a"*(LINEWIDTH-1))) == 1
def test_get_lines_with_long_string():
assert len(get_lines("a"*(2*LINEW... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | assert get_lines("") == [""] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | assert len(get_lines("a"*(LINEWIDTH-1))) == 1 |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | assert len(get_lines("a"*(2*LINEWIDTH-1))) == 2 |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | assert len(get_lines("a"*(4*LINEWIDTH-1))) == 4 |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | text = "This is a test string, which should simulate real text. The command should" \
+ " correctly split this text into two lines."
LINEWIDTH = 80
correct_lines = [text[:LINEWIDTH], text[LINEWIDTH:]]
assert len(get_lines(text)) == len(text) // LINEWIDTH + 1
assert get_l... |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | """
Tests for CmdText class methods.
"""
pass |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | pass |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | for i in range(MAX_NUM_STORED_LINES // 2):
self.lines.pop(i) |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | return self.lines[n] |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | raise IndexError("Line index out of range.") |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | self.response = rind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | self.command = cind |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | fill = max_len - len(key)
sys.stdout.write("Testing {} ...{} ".format(key, '.'*fill))
try:
cls.__dict__[key]()
except:
raise
else:
print("Test passed!") |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | print("Test passed!") |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def <|fim_middle|>(self):
... | __init__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | insert |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | merge_after |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | strip_lines |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | update_num_lines |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | get_line |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | print_screen |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | __iter__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | __getitem__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | num_lines |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | get_lines |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | __init__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | __init__ |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | run |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | test_get_lines_with_empty_string |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | test_get_lines_with_short_string |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | test_get_lines_with_long_string |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | test_get_lines_with_very_long_string |
<|file_name|>cmdtext.py<|end_file_name|><|fim▁begin|>import sys
MAX_NUM_STORED_LINES = 200
MAX_NUM_LINES = 10
LINEWIDTH = 80
class CmdText(object):
"""
Represents a command line text device. Text is split into lines
corresponding to the linewidth of the device.
"""
def __init__(self):
"""
... | test_get_lines_with_long_text_string |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | #
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | module = KatelloEntityAnsibleModule(
argument_spec=dict(
manifest_path=dict(type='path'),
state=dict(default='present', choices=['absent', 'present', 'refreshed']),
repository_url=dict(aliases=['redhat_repository_url']),
),
foreman_spec=dict(
o... |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | if 'repository_url' in module.foreman_params:
payload = {'redhat_repository_url': module.foreman_params['repository_url']}
org_spec = dict(id=dict(), redhat_repository_url=dict())
organization = module.ensure_entity('organizations', payload, organization, stat... |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | payload = {'redhat_repository_url': module.foreman_params['repository_url']}
org_spec = dict(id=dict(), redhat_repository_url=dict())
organization = module.ensure_entity('organizations', payload, organization, state='present', foreman_spec=org_spec) |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | params['repository_url'] = module.foreman_params['repository_url'] |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | break |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | module.fail_json(msg="Manifest is older than existing data.") |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | module.fail_json(msg="Upload of the manifest failed: %s" % error) |
<|file_name|>subscription_manifest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Andrew Kofink <ajkofink@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... | module.set_changed() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.