prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>331.py<|end_file_name|><|fim▁begin|>class Solution:
def <|fim_middle|>(self, preorder):
"""
:type preorder: str
:rtype: bool
"""
arr_pre_order = preorder.split(',')
stack = []
for node in arr_pre_order:
stack.append(node)
... | isValidSerialization |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... |
self.root = ET.fromstring(s)
print(root)
|
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
<|fim_middle|>
class PDBTM:
def __init__(self, filename):
#self.tree = ET.parse(filename)
#sel... | for x in msgs: print('[WARNING]:', x, file=sys.stderr) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
<|fim_middle|>
def get_databa... | def __init__(self, filename):
#self.tree = ET.parse(filename)
#self.root = self.tree.getroot()
def strsum(l):
s = ''
for x in l: s += x.rstrip() + '\n'
return s
f = open(filename)
s = []
for l in f: s.append(l)
#s = strsum(s[1:-1]).strip()
s = strsum(s).strip()
self.root = ET.fromstring(s)
... |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | def strsum(l):
s = ''
for x in l: s += x.rstrip() + '\n'
return s
f = open(filename)
s = []
for l in f: s.append(l)
#s = strsum(s[1:-1]).strip()
s = strsum(s).strip()
self.root = ET.fromstring(s)
print(root) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | s = ''
for x in l: s += x.rstrip() + '\n'
return s |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | if not prefix.endswith('/'): prefix += '/'
print('Fetching database...', file=sys.stderr)
db = urllib.urlopen('http://pdbtm.enzim.hu/data/pdbtmall')
print('Saving database...', file=sys.stderr)
f = open('%s/pdbtmall' % prefix, 'w')
for l in db: f.write(l)
#f.write(db.read())
db.close()
f.close() |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | print('Unpacking database...', file=sys.stderr)
f = open(fn)
db = f.read()
f.close()
firstline = 1
header = ''
entries = []
pdbids = []
for l in db.split('\n'):
if firstline:
header += l
firstline -= 1
continue
if 'PDBTM>' in l: continue
if l.startswith('<?'): continue
if l.startswith('<pdbtm... |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | prefix += '/' |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | header += l
firstline -= 1
continue |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | continue |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | continue |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | a = l.find('ID=') + 4
b = a + 4
pdbids.append(l[a:b])
entries.append(header) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | prefix += '/' |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | os.mkdir(prefix) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | parser = argparse.ArgumentParser(description='Manages PDBTM databases. Automatically fetches the PDBTM database if no options are specified. Run without any arguments, dbtool will retrieve the PDBTM database, store it in pdbtm, and unpack it.')
parser.add_argument('-d', '--db', default='pdbtmall', help='name of conc... |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | build_database(args.db, args.directory) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | if not os.path.isdir(args.directory): os.mkdir(args.directory)
if args.force_refresh or not os.path.isfile('%s/%s' % (args.directory, args.db)): get_database(args.directory)
build_database('%s/%s' % (args.directory, args.db), args.directory) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | os.mkdir(args.directory) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | get_database(args.directory) |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def <|fim_middle|>(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, fi... | warn |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def <|fim_middle|>(self, filena... | __init__ |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | strsum |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | get_database |
<|file_name|>dbtool.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python2
from __future__ import print_function
import sys
import os
import urllib
import argparse
import xml.etree.ElementTree as ET
def warn(*msgs):
for x in msgs: print('[WARNING]:', x, file=sys.stderr)
class PDBTM:
def __init__(self, filename):
... | build_database |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | identifier = "category_links"
name = _("Category Links") |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | """
A configuration form for the CategoryLinksPlugin
"""
def populate(self):
"""
A custom populate method to display category choices
"""
for field in self.plugin.fields:
if isinstance(field, tuple):
name, value = field
value.in... |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | """
A custom populate method to display category choices
"""
for field in self.plugin.fields:
if isinstance(field, tuple):
name, value = field
value.initial = self.plugin.config.get(name, value.initial)
self.fields[name] = value... |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | """
A custom clean method to save category configuration information in a serializable form
"""
cleaned_data = super(CategoryLinksConfigForm, self).clean()
categories = cleaned_data.get("categories", [])
cleaned_data["categories"] = [category.pk for category in categories... |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | """
A plugin for displaying links to visible categories on the shop front
"""
identifier = "category_links"
name = _("Category Links")
template_name = "shuup/xtheme/plugins/category_links.jinja"
editor_form_class = CategoryLinksConfigForm
fields = [
("title", TranslatableField(la... |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | """
A custom get_context_data method to return only visible categories
for request customer.
"""
selected_categories = self.config.get("categories", [])
show_all_categories = self.config.get("show_all_categories", True)
request = context.get("request")
cat... |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | name, value = field
value.initial = self.plugin.config.get(name, value.initial)
self.fields[name] = value |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | categories = categories.filter(id__in=selected_categories) |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | populate |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | clean |
<|file_name|>category_links.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django impo... | get_context_data |
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|>"""
WSGI config for readbacks project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/<|fim▁hole|>"""
import os
os.environ.setdefault("D... | |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | mk_scrollable_area(listbox, listbox_frame, sbars)
return listbox
|
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
<|fim_middle|>
def mk_scrollable_area(obj, obj_frame, sbars):
obj.grid(row=0, column=0, sticky='NSWE')
if 'y' in sbars:
y_scrollbar = tkinter.ttk.Scrollbar(obj_frame)
y_scrollba... | __root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
self.__root.title(param['title'])
self.__root.geometry('%sx%s+%s+%s' % (param['w'],
... |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
<|fim_middle|>
@property
def root(self):
return self.__root
def close(self):
self.__... | param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
self.__root.title(param['title'])
self.__root.geometry('%sx%s+%s+%s' % (param['w'],
param['h'],
... |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | return self.__root |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | self.__root.destroy()
self.__root.quit() |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | pass |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | param = {
'x': 0,
'y': 0,
'w': 500,
'h': 500,
'title': '% Type Prog Title Here %',
}
return param |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | obj.grid(row=0, column=0, sticky='NSWE')
if 'y' in sbars:
y_scrollbar = tkinter.ttk.Scrollbar(obj_frame)
y_scrollbar.grid(row=0, column=1, sticky='NS')
y_scrollbar['command'] = obj.yview
obj['yscrollcommand'] = y_scrollbar.set
if 'x' in sbars:
x_scrollbar = tkinter.t... |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | BORDER = 0
COLOR = 'grey'
listbox_frame = tkinter.Frame(frame, bg=COLOR, bd=BORDER)
listbox_frame.pack(side=side, fill='both', expand=True)
listbox = tkinter.Listbox(listbox_frame, selectmode=sel_mode)
mk_scrollable_area(listbox, listbox_frame, sbars)
return listbox |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | BORDER = 0
COLOR = 'grey'
treeview_frame = tkinter.Frame(frame, bg=COLOR, bd=BORDER)
treeview_frame.pack(side=side, fill='both', expand=True)
treeview = tkinter.ttk.Treeview(treeview_frame)
mk_scrollable_area(treeview, treeview_frame, sbars)
return treeview |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
<|fim_middle|>
... | self.__root = tkinter.Tk()
self.__root.title(param['title'])
self.__root.geometry('%sx%s+%s+%s' % (param['w'],
param['h'],
param['x'],
... |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | self.__root = root |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | main_f = tkinter.Frame(master=self.__root, bg='black', bd=self.bd)
main_f.pack(fill='both', expand=True) |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | main_f = main_frame |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | y_scrollbar = tkinter.ttk.Scrollbar(obj_frame)
y_scrollbar.grid(row=0, column=1, sticky='NS')
y_scrollbar['command'] = obj.yview
obj['yscrollcommand'] = y_scrollbar.set |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | x_scrollbar = tkinter.ttk.Scrollbar(obj_frame, orient='horizontal')
x_scrollbar.grid(row=1, column=0, sticky='WE')
x_scrollbar['command'] = obj.xview
obj['xscrollcommand'] = x_scrollbar.set |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def <|fim_middle|>(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk(... | __init__ |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | root |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | close |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | make_widgets |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | params |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | mk_scrollable_area |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | mk_listbox |
<|file_name|>common.py<|end_file_name|><|fim▁begin|>import tkinter
FRAME_BORDER = 5
class PageView(object):
__root = None
bd = None
def __init__(self, root=None, main_frame=None):
param = self.params()
if root is None:
# standalone
self.__root = tkinter.Tk()
... | mk_treeview |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>"""
Application file for the code snippets app.
"""
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SnippetsConfig(AppConfig):
"""<|fim▁hole|> """
name = 'apps.snippets'
verbose_name = _('Code snippets')... | Application configuration class for the code snippets app. |
<|file_name|>apps.py<|end_file_name|><|fim▁begin|>"""
Application file for the code snippets app.
"""
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class SnippetsConfig(AppConfig):
<|fim_middle|>
<|fim▁end|> | """
Application configuration class for the code snippets app.
"""
name = 'apps.snippets'
verbose_name = _('Code snippets') |
<|file_name|>rgb_led.py<|end_file_name|><|fim▁begin|>#! /usr/bin/env python
"""
This is an example that demonstrates how to use an
RGB led with BreakfastSerial. It assumes you have an
RGB led wired up with red on pin 10, green on pin 9,
and blue on pin 8.
"""
from BreakfastSerial import RGBLed, Arduino
from time impor... |
# Blue (R: off, G: off, B: on)
led.blue() |
<|file_name|>tempdirtest.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modi... | td.cleanup()
|
<|file_name|>tempdirtest.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modi... | def test_all(self):
td = tempdir.default()
self.assert_(td.mktemp() != td.mktemp())
dir = td.mktemp()
os.mkdir(dir)
os.rmdir(dir)
fd, fname = td.mkstemp()
os.close(fd)
os.unlink(fname)
td.forget(fname)
fo, fname = td.mkstemp_file()
... |
<|file_name|>tempdirtest.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modi... | td = tempdir.default()
self.assert_(td.mktemp() != td.mktemp())
dir = td.mktemp()
os.mkdir(dir)
os.rmdir(dir)
fd, fname = td.mkstemp()
os.close(fd)
os.unlink(fname)
td.forget(fname)
fo, fname = td.mkstemp_file()
fo.close() # don... |
<|file_name|>tempdirtest.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modi... | unittest.main() |
<|file_name|>tempdirtest.py<|end_file_name|><|fim▁begin|># -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright 2002 Ben Escoto <ben@emerose.org>
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modi... | test_all |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:<|fim▁hole|>#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software:... | |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | """A class that mimic's the built-in range class."""
def __init__(self, start, stop=None, step=1):
"""Initialize a Range instance.
Semantics is similar to built-in range class.
"""
if step == 0:
raise ValueError('step cannot be 0')
if stop is No... |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | """Initialize a Range instance.
Semantics is similar to built-in range class.
"""
if step == 0:
raise ValueError('step cannot be 0')
if stop is None: # special case of range(n)
start, stop = 0, start # should be trea... |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | """Return number of entries in the range."""
return self._length |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | """Return entry at index k (using standard interpretation if negative)."""
if k < 0:
k += len(self) # attempt to convert negative index
if not 0 <= k < self._length:
raise IndexError('index out of range')
return self._start + k * self._step |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | raise ValueError('step cannot be 0') |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | start, stop = 0, start # should be treated as if range(0,n) |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | k += len(self) # attempt to convert negative index |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | raise IndexError('index out of range') |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | __init__ |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | __len__ |
<|file_name|>range.py<|end_file_name|><|fim▁begin|># Copyright 2013, Michael H. Goldwasser
#
# Developed for use with the book:
#
# Data Structures and Algorithms in Python
# Michael T. Goodrich, Roberto Tamassia, and Michael H. Goldwasser
# John Wiley & Sons, 2013
#
# This program is free software: you can re... | __getitem__ |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIP... | with open(sys.argv[1] + '/' + filename, 'r') as infile:
for line in infile:
if line.startswith('snv'): |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
<|fim_middle|>
if len(sys.argv) == 2:
print_header()
logdir_files = os.listdir(sys.argv[1])
for filename in logdir_files:
if filename.endswith('.log'):
wi... | print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIPOS,Number=2,Type=Integer,Description="Confidence interval around POS for imprecise variants">
##INFO=<ID=IMPRECISE,Number=0... |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIP... | print_header()
logdir_files = os.listdir(sys.argv[1])
for filename in logdir_files:
if filename.endswith('.log'):
with open(sys.argv[1] + '/' + filename, 'r') as infile:
for line in infile:
if line.startswith('snv'):
#chrom, po... |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIP... | with open(sys.argv[1] + '/' + filename, 'r') as infile:
for line in infile:
if line.startswith('snv'):
#chrom, pos, mut = line.strip().split()
c = line.strip().split()
chrom = c[1].split(':')[0]
... |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIP... | c = line.strip().split()
chrom = c[1].split(':')[0]
pos = c[3]
mut = c[4]
dpr = c[6]
vaf = c[7]
ref,alt = mut.split('-->')
print... |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def print_header():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=CIP... | print "usage:", sys.argv[0], "<log directory>" |
<|file_name|>makevcf.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import sys,os
import textwrap
def <|fim_middle|>():
print textwrap.dedent("""\
##fileformat=VCFv4.1
##phasing=none
##INDIVIDUAL=TRUTH
##SAMPLE=<ID=TRUTH,Individual="TRUTH",Description="bamsurgeon spike-in">
##INFO=<ID=C... | print_header |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""schmankerl URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpa... | url(r'^restaurant/meal/add$', views.restaurant_add_meal, name='restaurant-add-meal'),
url(r'^restaurant/order/$', views.restaurant_order, name='restaurant-order'), |
<|file_name|>caching.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Import this module to have access to a global redis cache named GLOBAL_CACHE.
<|fim▁hole|> GLOBAL_CACHE.store('foo', 'bar')
GLOBAL_CACHE.get('foo')
>> bar
'''
from redis_cache import SimpleCache
try:
GLOBAL_CACHE
except Name... | USAGE:
from caching import GLOBAL_CACHE
|
<|file_name|>caching.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
'''
Import this module to have access to a global redis cache named GLOBAL_CACHE.
USAGE:
from caching import GLOBAL_CACHE
GLOBAL_CACHE.store('foo', 'bar')
GLOBAL_CACHE.get('foo')
>> bar
'''
from redis_cache import SimpleCache
... | pass |
<|file_name|>_helpers.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
def strip_region_tags(sample_text): |
<|file_name|>_helpers.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | """Remove blank lines and region tags from sample text"""
magic_lines = [
line for line in sample_text.split("\n") if len(line) > 0 and "# [" not in line
]
return "\n".join(magic_lines) |
<|file_name|>_helpers.py<|end_file_name|><|fim▁begin|># Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | strip_region_tags |
<|file_name|>wsgi.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "asignacion_horario.settings")
applicati... | """
WSGI config for horario project.
It exposes the WSGI callable as a module-level variable named ``application``. |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
'''Setup the keyring'''
keyring_path ... | with open(os.path.join("test", "inputdata", key_name + ".txt"), "r") as keyfile:
key_str = "".join(keyfile.readlines())
import_result = gpg.import_keys(key_str)
print("Import result:", type(import_result)) |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
<|fim_middle|>
CRYPTO = setup_keyring("... | '''Setup the keyring'''
keyring_path = os.path.join("test", "outputdata", keyring_name)
# Delete the entire keyring
shutil.rmtree(keyring_path, ignore_errors=True)
os.makedirs(keyring_path)
gpg = GPG(gnupghome=keyring_path, gpgbinary="gpg")
for key_name in ["key1_private", "key1_public"]:
... |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
'''Setup the keyring'''
keyring_path ... | print("Got one import result") |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
'''Setup the keyring'''
keyring_path ... | print("Ready", CRYPTO) |
<|file_name|>check_key_import.py<|end_file_name|><|fim▁begin|>'''Manual check (not a discoverable unit test) for the key import,
to identify problems with gnupg, gpg, gpg1, gpg2 and so on'''
import os
import shutil
from gnupg import GPG
def setup_keyring(keyring_name):
'''Setup the keyring'''
keyring_path ... | print("ERROR: Number of keys should be 1, not", NUM_KEYS) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.