prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>dummy_operator.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under th... | pass |
<|file_name|>dummy_operator.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under th... | __init__ |
<|file_name|>dummy_operator.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under th... | execute |
<|file_name|>guimporter.py<|end_file_name|><|fim▁begin|>#guimporter.py
import sys
from PySide import QtGui, QtCore, QtWebKit<|fim▁hole|><|fim▁end|> | Signal = QtCore.Signal |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1<|fim▁ho... | #notes : |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | tour=list(range(tour_length))
random.shuffle(tour)
return tour |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | '''generator to return all possible variations where the section between two cities are swapped'''
for i,j in tsp.AllEdges(len(tour)):
if i != j:
copy=tour[:]
if i < j:
copy[i:j+1]=reversed(tour[i:j+1])
else:
copy[i+1:]=reversed(tour[:j... |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | T = start_temp
while True:
yield T
T = alpha * T |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | if next_score > prev_score:
return 1.0
else:
return math.exp( -abs(next_score-prev_score)/temperature ) |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | '''class to wrap an objective function and
keep track of the best solution evaluated'''
def __init__(self,objective_function):
self.objective_function=objective_function
self.best=None
self.best_score=None
def __call__(self,solution):
score=self.objective_function(s... |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | self.objective_function=objective_function
self.best=None
self.best_score=None |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | score=self.objective_function(solution)
if self.best is None or score > self.best_score:
self.best_score=score
self.best=solution
return score |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | objective_function=ObjectiveFunction(objective_function)
current = init_function()
current_score = objective_function(current)
iterationCount = 1
cooling_schedule = kirkpatrick_cooling(start_temp, alpha)
for temperature in cooling_schedule:
done = False
# e... |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | print("Starting to solve travel salesman problem")
coordinates = tsp.ReadCoordinatesFromFile(".\cityCoordinates.csv")
distance_matrix = tsp.ComputeDistanceMatrix(coordinates);
init_function = lambda: GenerateInitialPath(len(coordinates))
objective_function = lambda tour: -tsp.ComputeTo... |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | copy=tour[:]
if i < j:
copy[i:j+1]=reversed(tour[i:j+1])
else:
copy[i+1:]=reversed(tour[:j])
copy[:j]=reversed(tour[i+1:])
if copy != tour: # no point returning the same tour
yield copy |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | copy[i:j+1]=reversed(tour[i:j+1]) |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | copy[i+1:]=reversed(tour[:j])
copy[:j]=reversed(tour[i+1:]) |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | yield copy |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | return 1.0 |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | return math.exp( -abs(next_score-prev_score)/temperature ) |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | self.best_score=score
self.best=solution |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | done=True
break |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | current = next
current_score= next_score
break |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | break |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | SolveTSP(); |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | GenerateInitialPath |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | reversed_sections |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | kirkpatrick_cooling |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | P |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | __init__ |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | __call__ |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | ApplySimulatedAnnealing |
<|file_name|>SolveTSPSimulatedAnnealing.py<|end_file_name|><|fim▁begin|>#==============================================================================
#description : Solves travelling salesman problem by using Hill Climbing.
#author : Yakup Cengiz
#date : 20151121
#version : 0.1
#notes ... | SolveTSP |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | GSFLOW_indir = GSFLOW_DIR + '/inputs/MODFLOW_2005/'
# MODFLOW output files
GSFLOW_outdir = GSFLOW_DIR + '/outputs/MODFLOW_2005/' |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | GSFLOW_indir = GSFLOW_DIR + '/inputs/MODFLOW_NWT/'
# MODFLOW output files
GSFLOW_outdir = GSFLOW_DIR + '/outputs/MODFLOW_NWT/' |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | os.makedirs(GSFLOW_indir) |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | os.makedirs(GSFLOW_outdir) |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | mf.write_lpf_MOD2_f2_2(GSFLOW_indir, infile_pre, surfz_fil, NLAY); |
<|file_name|>print_MODFLOW_inputs_res_NWT.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
# print_MODFLOW_inputs
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
im... | mf.write_upw_MOD2_f2_2(GSFLOW_indir, infile_pre, surfz_fil, NLAY);
mf.NWT_write_file(GSFLOW_indir, infile_pre); |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding: utf8
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiec... | subprocess.run(['cmake', PROJECT_DIR]) |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding: utf8
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiec... | def execute(self):
os.chdir(os.path.join(PROJECT_DIR, 'build'))
subprocess.run(['cmake', PROJECT_DIR]) |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding: utf8
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiec... | os.chdir(os.path.join(PROJECT_DIR, 'build'))
subprocess.run(['cmake', PROJECT_DIR]) |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# coding: utf8
import os
import subprocess
from '{% if cookiecutter.namespace %}{{ cookiecutter.namespace }}.{{ cookiecutter.project_slug }}{% else %}{{ cookiecutter.project_slug }}{% endif %}'.commands.base import BaseCommand
from '{% if cookiec... | execute |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | # def my_add (a, b):
# return a + b
#
# Then we get import this... |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
<|fim_middle|>
# To create a binary operator just make a function that takes 2 arguments like say
#... | def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix(lambda x: self.function(other, x))
def __or__(self, other):
return self.function(other)
def __rlshift__(self, other):
return Infix(lambda x, self=self, other=other: self.function(other, x))
... |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
<|fim_middle|>
def __ror__(self, other):
return Infix(lambda x... | self.function = function |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
<|fim_middle... | return Infix(lambda x: self.function(other, x)) |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | return self.function(other) |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | return Infix(lambda x, self=self, other=other: self.function(other, x)) |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | return self.function(other) |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | return self.function(value1, value2) |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def <|fim_middle|>(self, function):
self.function = function
def __ror__(self, other):
return... | __init__ |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def <|fim_middle|>(self, other):
retur... | __ror__ |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | __or__ |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | __rlshift__ |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | __rshift__ |
<|file_name|>Infix.py<|end_file_name|><|fim▁begin|># Allows the creation of infix operators
# Thanks to Ferdinand Jamitzky
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/384122
class Infix(object):
def __init__(self, function):
self.function = function
def __ror__(self, other):
return Infix... | __call__ |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results<|fim▁hole|>from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.... | |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | if request.method == 'POST':
query = request.form['liner-text']
text = query.split('.')[:-1]
if len(text) == 0:
return render_template('projects/line.html', message='Please separate each line with "."')
abbr_expanded_text = ""
for word in query.split():
... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | query = request.form['liner-text']
text = query.split('.')[:-1]
if len(text) == 0:
return render_template('projects/line.html', message='Please separate each line with "."')
abbr_expanded_text = ""
for word in query.split():
if word in abbr_map:
... |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | return render_template('projects/line.html', message='Please separate each line with "."') |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | abbr_expanded_text += abbr_map[word] |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | abbr_expanded_text += word |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | return render_template('projects/line.html') |
<|file_name|>views.py<|end_file_name|><|fim▁begin|>from flask import Blueprint, request, render_template
from ..load import processing_results
from ..abbr import get_abbr_map
abbr_map = get_abbr_map()
liner_mod = Blueprint('liner', __name__, template_folder='templates', static_folder='static')
@liner_mod.route('/lin... | liner |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
from app import read_config
class ConfigFileReaderTest(unittest.TestCase):
def test_read(self):
config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')<|fim▁hole|>
if __name__ == '__main__':
unittest.m... | self.assertEqual(config['cmus_passwd'], 'PaSsWd')
self.assertEqual(config['app_host'], 'localhost')
self.assertEqual(config['app_port'], '8080') |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
from app import read_config
class ConfigFileReaderTest(unittest.TestCase):
<|fim_middle|>
if __name__ == '__main__':
unittest.main()
<|fim▁end|> | def test_read(self):
config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')
self.assertEqual(config['cmus_passwd'], 'PaSsWd')
self.assertEqual(config['app_host'], 'localhost')
self.assertEqual(config['app_port'], '8080') |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
from app import read_config
class ConfigFileReaderTest(unittest.TestCase):
def test_read(self):
<|fim_middle|>
if __name__ == '__main__':
unittest.main()
<|fim▁end|> | config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')
self.assertEqual(config['cmus_passwd'], 'PaSsWd')
self.assertEqual(config['app_host'], 'localhost')
self.assertEqual(config['app_port'], '8080') |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
from app import read_config
class ConfigFileReaderTest(unittest.TestCase):
def test_read(self):
config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')
self.assertEqual(config['cmus_passwd'], 'PaSs... | unittest.main() |
<|file_name|>tests.py<|end_file_name|><|fim▁begin|>import unittest
from app import read_config
class ConfigFileReaderTest(unittest.TestCase):
def <|fim_middle|>(self):
config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')
self.assertEqual(config['cmus_passwd'], ... | test_read |
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hel... | |
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hel... | if not settings.configured:
settings.configure(**DEFAULT_SETTINGS)
django.setup()
parent = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent)
try:
from django.test.runner import DiscoverRunner
runner_class = DiscoverRunner
test_args = ["pinax.pin... |
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hel... | settings.configure(**DEFAULT_SETTINGS) |
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hel... | runtests(*sys.argv[1:]) |
<|file_name|>runtests.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hel... | runtests |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | global Led_status
Led_status = not Led_status
GPIO.output(LedPin, Led_status) # switch led status(on-->off; off-->on)
print "LED: " + ("on" if Led_status else "off") |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
<|fim_middle|>
def swLed(ev=None):
global Led_status
Led_status = not Led_status
GPIO.output(LedPin, Led_status) # switch led status(on-->off; off-->on)
print "... | GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.output(LedPin, GPIO.HIGH) # Set LedPin high(+3.3V) to off led |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | global Led_status
Led_status = not Led_status
GPIO.output(LedPin, Led_status) # switch led status(on-->off; off-->on)
print "LED: " + ("on" if Led_status else "off") |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | GPIO.add_event_detect(KnockPin, GPIO.FALLING, callback=swLed, bouncetime=200) # wait for falling
while True:
pass # Don't do anything |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | GPIO.output(LedPin, GPIO.LOW) # led off
GPIO.cleanup() # Release resource |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | setup()
try:
loop()
except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the child program destroy() will be executed.
destroy() |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def <|fim_middle|>():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull... | setup |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | swLed |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | loop |
<|file_name|>knock-rgb-led-smd.py<|end_file_name|><|fim▁begin|>import RPi.GPIO as GPIO
KnockPin = 11
LedPin = 12
Led_status = 1
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(KnockPin, GPIO.IN, pull_up_down=... | destroy |
<|file_name|>_type.py<|end_file_name|><|fim▁begin|># ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.... | |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | return None
def get_python_diana_version(): |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
<|fim_middle|>
def get_python_diana_version():
line = open("debian/changelog").readline()
pieces = line.split()
return pieces[1]... | depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pieces:
name_pieces = piece.strip(",").split("-")
if len(name_pieces) == 2 and name_pieces[0] =... |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | line = open("debian/changelog").readline()
pieces = line.split()
return pieces[1][1:-1] |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | return name_pieces[1] |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | if len(sys.argv) not in (1, 3, 5):
sys.stderr.write("Usage: %s [<directory containing diana headers> <directory containing libdiana>] "
"[<directory containing metlibs headers> <directory containing metlibs libraries>]\n" % sys.argv[0])
sys.exit(1)
if len(sys.a... |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | sys.stderr.write("Usage: %s [<directory containing diana headers> <directory containing libdiana>] "
"[<directory containing metlibs headers> <directory containing metlibs libraries>]\n" % sys.argv[0])
sys.exit(1) |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | metlibs_inc_dir = sys.argv[3]
metlibs_lib_dir = sys.argv[4] |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | metlibs_inc_dir = "/usr/include/metlibs"
metlibs_lib_dir = "/usr/lib" |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | diana_inc_dir = sys.argv[1]
diana_lib_dir = sys.argv[2] |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | diana_inc_dir = "/usr/include/diana"
diana_lib_dir = "/usr/lib" |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | os.mkdir("modules") |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | os.mkdir(output_dir) |
<|file_name|>configure.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends... | sys.exit(1) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.