prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | vis_label = tm.main.tests_title
tests_dir = 'tests'
def __init__(self):
QDialog.__init__(self, appdata.topwindow, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.setWindowTitle(self.vis_label)
layout = QVBoxLayout(self)
box = QGroupBox(tm.main.tests_field, self)
... |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | QDialog.__init__(self, appdata.topwindow, Qt.WindowSystemMenuHint | Qt.WindowTitleHint)
self.setWindowTitle(self.vis_label)
layout = QVBoxLayout(self)
box = QGroupBox(tm.main.tests_field, self)
self.tests_list = QListWidget(box)
boxlayout = QHBoxLayout(box)
boxl... |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | self.tests_list.SetChecked([x for x in xrange(self.tests_list.Count)]) |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | self.tests_list.SetChecked([]) |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | if Choice(tm.main.tests_prepare_warning):
for k in self.tests_list.CheckedStrings:
self.report.AppendText(tm.main.tests_preparing.format(k))
locals = {'mode': 'prepare'}
ec = EnvironmentContext(None, locals)
ec.ExecutePythonFile(os.path... |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | all_passed = True
self.report.appendPlainText(tm.main.tests_running)
count = 0
passed = 0
for i in xrange(self.tests_list.count()):
item = self.tests_list.item(i)
name = item.text()
if not item.checkState() == Qt.Checked:
conti... |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | vis_label = tm.main.menu_tests
@classmethod
def Do(cls):
TestWindow() |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | TestWindow() |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | continue |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | for k in self.tests_list.CheckedStrings:
self.report.AppendText(tm.main.tests_preparing.format(k))
locals = {'mode': 'prepare'}
ec = EnvironmentContext(None, locals)
ec.ExecutePythonFile(os.path.join(self.tests_dir, k + '.py'))
self... |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | continue |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | passed += 1
self.report.appendPlainText(tm.main.test_passed.format(name)) |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | self.report.appendPlainText(tm.main.test_failed.format(name)) |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | @public('workbench.menu.help')
class xTestMenu:
vis_label = tm.main.menu_tests
@classmethod
def Do(cls):
TestWindow() |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | __init__ |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | SelectAll |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | UnselectAll |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | OnPrepare |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | OnRun |
<|file_name|>testing.py<|end_file_name|><|fim▁begin|>"""
.15925 Editor
Copyright 2014 TechInvestLab.ru dot15926@gmail.com
.15925 Editor is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 o... | Do |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | return self.page.previous_page_number() |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
<|fim_middle|>
<|fim▁end|> | def get_paginated_response(self, data):
return Response(OrderedDict([
('count', self.page.paginator.count),
('next', self.get_next_page_number()),
('has_next', self.page.has_next()),
('previous', self.get_previous_page_number()),
('has_previous', s... |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | return Response(OrderedDict([
('count', self.page.paginator.count),
('next', self.get_next_page_number()),
('has_next', self.page.has_next()),
('previous', self.get_previous_page_number()),
('has_previous', self.page.has_previous()),
('curr... |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | if not self.page.has_next():
return self.page.number
return self.page.next_page_number() |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | if not self.page.has_previous():
return 1
return self.page.previous_page_number() |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | return self.page.number |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | return 1 |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def <|fim_middle|>(self, data):
return ... | get_paginated_response |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | get_next_page_number |
<|file_name|>pagination.py<|end_file_name|><|fim▁begin|>from collections import OrderedDict
from rest_framework import pagination
from rest_framework.response import Response
__author__ = 'alexandreferreira'
class DetailPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
... | get_previous_page_number |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def largestRectangleArea(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):<|fim▁hole|> ... | if height[i]<height[stack[-1]]:
top = stack.pop()
ma = max(ma, height[top]*(i-1-stack[-1])) |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
<|fim_middle|>
<|fim▁end|> | def largestRectangleArea(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
if height[i]<height[stack[-1]]:
top = stack.pop()
ma = max(ma, height[top]*(i-1-stack[-1]))
... |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def largestRectangleArea(self, height):
<|fim_middle|>
<|fim▁end|> | n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
if height[i]<height[stack[-1]]:
top = stack.pop()
ma = max(ma, height[top]*(i-1-stack[-1]))
else:
break
... |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def largestRectangleArea(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
... | top = stack.pop()
ma = max(ma, height[top]*(i-1-stack[-1])) |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def largestRectangleArea(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
... | break |
<|file_name|>largestRectangleArea.py<|end_file_name|><|fim▁begin|>class Solution:
# @param {integer[]} height
# @return {integer}
def <|fim_middle|>(self, height):
n = len(height)
ma = 0
stack = [-1]
for i in xrange(n):
while(stack[-1] > -1):
if h... | largestRectangleArea |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | tile_size = int(request.form['size'])
wall_file = request.files['walls']
floor_file = request.files['floor']
floorplan_file = request.files['floorplan'] |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | """ Web interface landing page. """
return render_template('index.html') |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | """ Display errors. """
return render_template('error.html') |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | tile_size = int(request.form['size'])
wall_file = request.files['walls']
floor_file = request.files['floor']
floorplan_file = request.files['floorplan']
try:
room_data, content_type = render_room(
floor_file.read(),
wall_file.read(),
floorplan_file.read()... |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | return make_map(request, format='svg') |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | return make_map(request, format='png') |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | return make_map(request, format='jpg') |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | """ Process submitted form data. """
format = request.form['format']
try:
node = {
'png': 'map_png',
'svg': 'map_svg',
'jpg': 'map_jpg',
}[format]
except KeyError:
flash("The output format you selected is not supported.")
return redire... |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | """ Parse arguments and get things going for the web interface """
parser = argparse.ArgumentParser(description=HELP_TEXT)
parser.add_argument(
'-p', '--port',
help="Port to serve the interface on.",
type=int,
default=5050
)
parser.add_argument(
'-a', '-... |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | return redirect(url_for(node, _method='POST'), code=307) |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | root |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | error |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | make_map |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | map_svg |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | map_png |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | map_jpg |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | process |
<|file_name|>app.py<|end_file_name|><|fim▁begin|>"""
Copyright 2014 Jason Heeris, jason.heeris@gmail.com
This file is part of the dungeon excavator web interface ("webcavate").
Webcavate is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Fr... | main |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
<|fim_middle|>
<|fim▁end|> | """ Set global state within controled context
This lets you specify various global settings in a tightly controlled with
block
Valid keyword arguments currently include:
get - the scheduler to use
pool - a thread or process pool
cache - Cache to use for intermediate results
... |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | self.old = _globals.copy()
_globals.update(kwargs) |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | return |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | _globals.clear()
_globals.update(self.old) |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | __init__ |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | __enter__ |
<|file_name|>context.py<|end_file_name|><|fim▁begin|>"""
Control global computation context
"""
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify various globa... | __exit__ |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Save string lines into an UTF8 text files.
"""
with open(fn, "w") as out_file:
out_file.write("\n".join(lines).encode("utf-8")) |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | r"""Return a main name of a basename of a given file path.
Example
-------
>>> main_basename('c:\code\langconv\MsgID.h')
'MsgID.h'
"""
base = os.path.basename(path)
base_main, _base_ext = os.path.splitext(base)
return base_main |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | try:
_offset = int(eval(str))
except:
return False
return True |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Return a char replaced text.
Arguments
---------
text -- the text
replaced_pairs -- the replaced chars
Example
-------
>>> replaced = [('a','b'), ('c','d')]
>>> removed = 'e'
>>> replace_chars('abcde', replaced, removed)
'bbdd'
"""
for old, new in r... |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Return camel case string from a space-separated string.
Example
-------
>>> camel_case('good job')
'GoodJob'
"""
return ''.join(w.capitalize() for w in string.split()) |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Replace punctuation characters with abbreviations for a string.
"""
punctuations = [
('?', 'Q'), # Q: question mark
('.', 'P'), # P: period; full stop
('!', 'E'), # E: exclamation mark
("'", 'SQ'), # SQ: single quotation mark; single quote
('"', 'D... |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Remain digits and English letters of a string.
"""
return ''.join(c for c in text if c.isalnum()
and ord(' ') <= ord(c) <= ord('z')) |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Convert input text into an legal identifier in C.
Example
-------
>>> c_identifier("Hello World")
'HelloWorld'
>>> c_identifier("Anti-Shake")
'Antishake'
"""
if ' ' in text:
text = camel_case(text)
text = re.sub(r'\+\d+', lambda x: x.group().replace('+', 'P... |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Wrap a C header guard for a given line list.
"""
def underscore(txt):
"""Return an under_scores text from a CamelCase text.
This function will leave a CamelCase text unchanged.
"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', txt)
return re.sub('([a-z0-9])([A... |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Return an under_scores text from a CamelCase text.
This function will leave a CamelCase text unchanged.
"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', txt)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | """Prefix information to the given lines with given comment-mark.
"""
prefix = ['%s Generated by the %s v%s' % (comment_mark,
software, version)]
prefix += ['%s !author: %s' % (comment_mark, author)]
prefix += ['%s !trail: %s %s' % (comment_mark,
os.path.base... |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | text = camel_case(text) |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | save_utf8_file |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | main_basename |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | is_numeric |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | replace_chars |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | camel_case |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | replace_punctuations |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | remain_alnum |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | c_identifier |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | wrap_header_guard |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | underscore |
<|file_name|>myutil.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <yukuan.jiang@gmail.com>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#---------------------------... | prefix_info |
<|file_name|>testingColorImg.py<|end_file_name|><|fim▁begin|>import cv2
import numpy as np
np.set_printoptions(threshold=np.nan)
import util as util
import edge_detect
import lineseg
import drawedgelist
# img = cv2.imread("img/Slide2.jpg", 0)
img = cv2.imread("unsorted/Unit Tests/lambda.png", 0)
im_size = img.shape
re... |
#print(Line_new, "line new")
print(len(Line_new), "len line new") |
<|file_name|>testingColorImg.py<|end_file_name|><|fim▁begin|>import cv2
import numpy as np
np.set_printoptions(threshold=np.nan)
import util as util
import edge_detect
import lineseg
import drawedgelist
# img = cv2.imread("img/Slide2.jpg", 0)
img = cv2.imread("unsorted/Unit Tests/lambda.png", 0)
im_size = img.shape
re... | res.append(current) |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | generateRandomTree(root2,2) |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
<|fim_middle|>
root1 = BTree()
root1.value = 0
root2 = BTree()
roo... | if root.left is None and root.right is None:
return True, 1, root.value, root.value
if root.left:
isBSTL, sizeL, minL, maxL = largestBST(root.left)
else:
isBSTL = True
sizeL = 0
minL = -float('inf')
if root.right:
isBSTR, sizeR, minR, maxR = largestBST(roo... |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
<|fim_middle|>
... | return True, 1, root.value, root.value |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | isBSTL, sizeL, minL, maxL = largestBST(root.left) |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | isBSTL = True
sizeL = 0
minL = -float('inf') |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | isBSTR, sizeR, minR, maxR = largestBST(root.right) |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | isBSTR = True
sizeR = 0
maxR = float('inf') |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | if maxL <= root.value <= minR:
return True, sizeL+sizeR+1, minL, maxR, |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def largestBST(root):
if root.left is None and root.right is None:
return True, 1, root.val... | return True, sizeL+sizeR+1, minL, maxR, |
<|file_name|>largest_BST_in_a_binary_tree.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Nov 19 17:38:50 2015
@author: deep
"""
from binaryTree import BTree, generateRandomTree, inorder
def <|fim_middle|>(root):
if root.left is None and root.right is None:
return True, 1, root... | largestBST |
<|file_name|>parser_init_mapping.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Class representing the mapper for the parser init files."""
from plasoscaffolder.bll.mappings import base_mapping_helper
from plasoscaffolder.bll.mappings import base_sqliteplugin_mapping
from plasoscaffolder.model import init_d... | |
<|file_name|>parser_init_mapping.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""Class representing the mapper for the parser init files."""
from plasoscaffolder.bll.mappings import base_mapping_helper
from plasoscaffolder.bll.mappings import base_sqliteplugin_mapping
from plasoscaffolder.model import init_d... | """Class representing the parser mapper."""
_PARSER_INIT_TEMPLATE = 'parser_init_template.jinja2'
def __init__(self, mapping_helper: base_mapping_helper.BaseMappingHelper):
"""Initializing the init mapper class.
Args:
mapping_helper (base_mapping_helper.BaseMappingHelper): the helper class
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.