prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): <|fim_middle|> if __name__ == '__main__'...
def setUp(self): self.att = attachment.Attachment(att_j['value'][0]) def test_isType(self): self.assertTrue(self.att.isType('txt')) def test_getType(self): self.assertEqual(self.att.getType(),'.txt') def test_save(self): name = self.att.json['Name'] name1 = self.newFileName(name) self.att.json['Name'...
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): <|fim_middle|> def t...
self.att = attachment.Attachment(att_j['value'][0])
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
self.assertTrue(self.att.isType('txt'))
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
self.assertEqual(self.att.getType(),'.txt')
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
name = self.att.json['Name'] name1 = self.newFileName(name) self.att.json['Name'] = name1 self.assertTrue(self.att.save('/tmp')) with open('/tmp/'+name1,'r') as ins: f = ins.read() self.assertEqual('testing w00t!',f) name2 = self.newFileName(name) self.att.json['Name'] = name2 self.assertTrue(sel...
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
for i in range(4): val = str(randint(0,9)) + val return val
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
self.assertEqual(self.att.getByteString(),b'testing w00t!')
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
self.assertEqual(self.att.getBase64(),'dGVzdGluZyB3MDB0IQ==\n')
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_string = b'testing testie test' self.att.setByteString(test_string) enc = base64.encodebytes(test_string) self.assertEqual(self.att.json['ContentBytes'],enc)
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
wrong_test_string = 'I am sooooo not base64 encoded.' right_test_string = 'Base64 <3 all around!' enc = base64.encodestring(right_test_string) self.assertRaises(self.att.setBase64(wrong_test_string)) self.assertEqual(self.att.json['ContentBytes'],'dGVzdGluZyB3MDB0IQ==\n') self.att.setBase64(enc) self.as...
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
unittest.main()
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def <|fim_middle|>(self): self.att = att...
setUp
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_isType
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_getType
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_save
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
newFileName
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_getByteString
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_getBase64
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
test_setByteString
<|file_name|>test_attachment.py<|end_file_name|><|fim▁begin|>from O365 import attachment import unittest import json import base64 from random import randint att_rep = open('attachment.json','r').read() att_j = json.loads(att_rep) class TestAttachment (unittest.TestCase): def setUp(self): self.att = attachment.A...
setBase64
<|file_name|>forms.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from wtforms import validators from ..forms import ModelForm from digits import utils class ImageModelForm(ModelForm): """ Defines the form used to c...
crop_size = utils.forms.IntegerField( 'Crop Size',
<|file_name|>forms.py<|end_file_name|><|fim▁begin|># Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from wtforms import validators from ..forms import ModelForm from digits import utils class ImageModelForm(ModelForm): <|fim_middle|> <|fim▁end|>
""" Defines the form used to create a new ImageModelJob """ crop_size = utils.forms.IntegerField( 'Crop Size', validators=[ validators.NumberRange(min=1), validators.Optional() ], tooltip=("If specified, during training a random square crop will b...
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
stripped_path = path[:-1] else:
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): <|fim_middle|> def pathJoin(parent, base)...
match = PREFIX.match(path) if match is None: if path.endswith('/'): stripped_path = path[:-1] else: stripped_path = path base = FNAME_MATCH.search(stripped_path) if base is None: raise ValueError('Invalid path') parent = FNAME_MATCH.sub...
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
if parent.endswith('/'): return parent + base return parent + '/' + base
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
hash_md5 = hashlib.md5() with open(fname, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return str(hash_md5.hexdigest())
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
hash_md5 = hashlib.md5() hash_md5.update(content.encode()) return str(hash_md5.hexdigest())
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
if path.endswith('/'): stripped_path = path[:-1] else: stripped_path = path base = FNAME_MATCH.search(stripped_path) if base is None: raise ValueError('Invalid path') parent = FNAME_MATCH.sub('', stripped_path) return parent, base.group...
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
stripped_path = path[:-1]
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
stripped_path = path
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
raise ValueError('Invalid path')
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
prefix, leading_slash, uri = match.groups() parts = uri.split('/') parent_path = '/'.join(parts[:-1]) if leading_slash is not None: parent_path = '{prefix}/{uri}'.format(prefix=prefix, uri='/'.join(parts[:-1])) else: parent_path = '{prefix}{uri}'.format(p...
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
parent_path = '{prefix}/{uri}'.format(prefix=prefix, uri='/'.join(parts[:-1]))
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
parent_path = '{prefix}{uri}'.format(prefix=prefix, uri='/'.join(parts[:-1]))
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
return parent + base
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def <|fim_middle|>(path): match = PREFIX.match(path) if match is Non...
getParentAndBase
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
pathJoin
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
md5_for_file
<|file_name|>util.py<|end_file_name|><|fim▁begin|>import re import hashlib FNAME_MATCH = re.compile(r'/([^/]+)$') # From the last slash to the end of the string PREFIX = re.compile(r'([^:]+://)(/)?(.+)') # Check for a prefix like data:// def getParentAndBase(path): match = PREFIX.match(path) if match is N...
md5_for_str
<|file_name|>nuoc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from heapq import heapify, heappop, heappush with open('NUOC.INP') as f: m, n = map(int, f.readline().split()) height = [[int(i) for i in line.split()] for line in f] queue = ([(h, 0, i) for i, h in enumerate(height[0])] + [(h,...
visited = ([[True] * n] + [[True] + [False] * (n - 2) + [True] for _ in range(m - 2)]
<|file_name|>nuoc.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 from heapq import heapify, heappop, heappush with open('NUOC.INP') as f: m, n = map(int, f.readline().split()) height = [[int(i) for i in line.split()] for line in f] queue = ([(h, 0, i) for i, h in enumerate(height[0])] + [(h,...
result += max(0, h - height[x][y]) heappush(queue, (max(height[x][y], h), x, y)) visited[x][y] = True
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3<|fim▁hole|> from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, name): ...
# -*- coding: utf-8 -*-
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): <|fim_middle|> xml = r'''<?xml version="1.0"?> <ol> <li><a href="/python">Python</a></li> <li><a href="/ruby">Ruby</a></li> </...
def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, name): print('sax:end_element: %s' % name) def char_data(self, text): print('sax:char_data: %s' % text)
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): <|fim_middle|> def end_element(self, name): print('sax:end_element: %s' % nam...
print('sax:start_element: %s, attrs: %s' % (name, str(attrs)))
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, n...
print('sax:end_element: %s' % name)
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, n...
print('sax:char_data: %s' % text)
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def <|fim_middle|>(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, ...
start_element
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def <|fim_middle|>(self...
end_element
<|file_name|>use_sax.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # -*- coding: utf-8 -*- from xml.parsers.expat import ParserCreate class DefaultSaxHandler(object): def start_element(self, name, attrs): print('sax:start_element: %s, attrs: %s' % (name, str(attrs))) def end_element(self, n...
char_data
<|file_name|>loc.py<|end_file_name|><|fim▁begin|>"""Local settings and globals."""<|fim▁hole|> # Import secrets -- not needed #sys.path.append( # abspath(join(PROJECT_ROOT, '../secrets/TimelineJS/stg')) #) #from secrets import * # Set static URL STATIC_URL = '/static'<|fim▁end|>
import sys from os.path import normpath, join from .base import *
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
@abc.abstractmethod def min(self):
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): <|fim_middle|> class Monitors(UserList): @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset(self): ...
@abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset(self): pass @abc.abstractmethod def max(self): pass @abc.abstractmethod def min(self): pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): <|fim_middle|> @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod ...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): <|fim_middle|> @abc.abstractmethod ...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
@abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset(self): pass @abc.abstractmethod def max(self): pass @abc.abstractmethod def min(self): pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
pass
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
if platform.system() == "Windows": from .driver_win_wmi import WinWMIMonitors return WinWMIMonitors() elif platform.system() == "Darwin": from .driver_mac import MacMonitors return MacMonitors() elif platform.system() == "Linux": from ....
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
from .driver_win_wmi import WinWMIMonitors return WinWMIMonitors()
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
from .driver_mac import MacMonitors return MacMonitors()
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
from .driver_linux import LinuxMonitors return LinuxMonitors()
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
raise OSError()
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def <|fim_middle|>(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod de...
current
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def <|fim_middle|>(self, range): pass @abc.abstractmethod de...
percent
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def <|fim...
reset
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
max
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
min
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
percent
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
reset
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
max
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
min
<|file_name|>base.py<|end_file_name|><|fim▁begin|># -*- coding:utf-8 -*- import abc import platform from UserList import UserList class Monitor(object): @abc.abstractmethod def current(self): pass @abc.abstractmethod def percent(self, range): pass @abc.abstractmethod def reset...
get_monitors
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
def test_load_board():
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): <|fim_middle|> t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ... """) game.Board(4,3).ascii() == t(""...
return '\n'.join([i.strip() for i in ascii_board.splitlines()])
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): <|fim_middle|> def test_game(): board = game.Boa...
game.Board(3,3).ascii() == t(""" ... ... ... """) game.Board(4,3).ascii() == t(""" .... .... .... """) game.Board(3,4).ascii() == t(""" ... ... ... ... """)
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
board = game.Board(3,3,win=3) assert board.count_tokens == 0 assert board.game_status == 'active' assert board.turn_color == None # drop first token token = board.drop('x',0) assert board.game_status == 'active' assert token.position == (0,0) assert token.color == 'x' assert boar...
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
""" The Board class should provide a load method to load a predefined board. the load method should be implemented as a static method like this: >>> class Test: >>> @staticmethod >>> def a_static_factory(): >>> t = Test() >>> # do something with t and return it ...
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
board = game.Board.load(t(""" o.. o.. xxx """)) # get the axis strings in this order: | \ / - axis_strings = board.axis_strings(0,0) assert axis_strings[0] == 'xoo' assert axis_strings[1] == 'x' assert axis_strings[2] == 'x..' assert axis_strings[3] == 'xxx' # the winner :-...
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def <|fim_middle|>(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ...
trim_board
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def <|fim_middle|>(): game.Board(3,3).ascii() == t(""" ... ... ....
test_new_board
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
test_game
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
test_load_board
<|file_name|>test_game.py<|end_file_name|><|fim▁begin|>import game as game import pytest import sys sys.path.insert(0, '..') def trim_board(ascii_board): return '\n'.join([i.strip() for i in ascii_board.splitlines()]) t = trim_board def test_new_board(): game.Board(3,3).ascii() == t(""" ... ... ....
test_axis_strings
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
from api.models.user import User from cors import cors
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
new_user = User() new_user.name = request.form['name'] new_user.email = request.form['email'] new_user.password = sha1(request.form['password']).hexdigest() new_user.token = str(uuid.uuid4()) new_user.save() return JSON(message='User created successfully')
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
user_info = User.objects(email=request.form['email'], password=sha1( request.form['password']).hexdigest()) if user_info.count(): return JSON(token=user_info.get().token, roles=user_info.get().roles) else: return JSON(message='User not found')
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
return JSON(token=user_info.get().token, roles=user_info.get().roles)
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
return JSON(message='User not found')
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
signup
<|file_name|>users.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- """" ProjectName: pydemi Repo: https://github.com/chrisenytc/pydemi Copyright (c) 2014 Christopher EnyTC Licensed under the MIT license. """ # Dependencies import uuid from api import app from hashlib import sha1 from flask import request from...
signin
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os from setuptools import setup from subprocess import call from sys import platform, argv def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() SCRIPTS = ["src/bg_daemon/background_daemon.py"] # only ...
setup(
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os from setuptools import setup from subprocess import call from sys import platform, argv def read(fname): <|fim_middle|> SCRIPTS = ["src/bg_daemon/background_daemon.py"] # only compile quack when none of these options are chosen...
return open(os.path.join(os.path.dirname(__file__), fname)).read()
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os from setuptools import setup from subprocess import call from sys import platform, argv def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() SCRIPTS = ["src/bg_daemon/background_daemon.py"] # only ...
try: call(['make', '-C', 'src/bg_daemon/']) SCRIPTS.append("src/bg_daemon/quack") except OSError as e: print "Can't compile quack, reason {}".format(str(e))
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python import os from setuptools import setup from subprocess import call from sys import platform, argv def <|fim_middle|>(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() SCRIPTS = ["src/bg_daemon/background_daemon.py"...
read
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python import re userInput = raw_input("input equation\n") numCount = 0 operandCount = 0 entryBracketCount = 0 exitBracketCount = 0 charCount = 0 endOfLine = len(userInput) - 1 for i in range(len(userInput)): if (re.search('[\s*a-z\s*A-Z]+', userInpu...
print "invalid expression" print '8' exit(0) else: