src stringlengths 721 1.04M |
|---|
from __future__ import print_function
import codecs
import os
from leapp.compat import string_types
from leapp.libraries.stdlib.eventloop import POLL_HUP, POLL_IN, POLL_OUT, POLL_PRI, EventLoop
STDIN = 0
STDOUT = 1
STDERR = 2
def _multiplex(ep, read_fds, callback_raw, callback_linebuffered,
encoding... |
from requests import get as _get
from .app import App as _App
from .user import User as _User
from .errors import AppNotFound as _AppNotFound
from .errors import MissingArguments as _MissingArguments
class Client(object):
'''
Provides a client for you to get apps, users, and other miscellania with.
:para... |
import sys
import os
major = sys.version_info[0]
if major < 3:
reload(sys)
sys.setdefaultencoding('utf-8')
from catsup.options import g
from catsup.logger import logger, enable_pretty_logging
enable_pretty_logging()
import catsup
doc = """Catsup v%s
Usage:
catsup init [<path>]
catsup build [-s <fi... |
import os
import time
from functools import wraps
class FileLockTimeout(Exception):
pass
class FileLockError(Exception):
pass
class FileLock(object):
"""
Simple file lock.
"""
def __init__(self, lockfile):
self._lockfile = lockfile
self._lockfile_fd = None
def __repr__... |
import logging
import weakref
from abc import abstractmethod, abstractproperty
from ebu_tt_live.utils import AutoRegisteringABCMeta, AbstractStaticMember, validate_types_only
log = logging.getLogger(__name__)
# Interfaces
# ==========
class IDocumentDataAdapter(object, metaclass=AutoRegisteringABCMeta):
"""
... |
# -*- coding: utf-8 -*-
import math
import scrapy
from .spiders import ManoloBaseSpider
from ..items import ManoloItem
from ..item_loaders import ManoloItemLoader
from ..utils import make_hash, get_dni
# url: http://intranet.minem.gob.pe/GESTION/visitas_pcm
class MinemSpider(ManoloBaseSpider):
name = 'minem'
... |
# Copyright 2012 OpenStack Foundation
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import json
import urllib.request
def __input(text, default):
return input('%s [%s]: ' % (text, default)) or default
print()
print('Enter HTTP connection params:')
url = __input('REST service URL', 'http://customer-service.blue.s12n.de/customers')
... |
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... |
"""
Microservice that provides temporary user credentials to the catalog
"""
from datetime import timedelta
import boto3
import requests
from botocore.exceptions import ClientError
from flask import Flask
from flask_cors import CORS
from flask_json import as_json
app = Flask(__name__) # pylint: disable=invalid-name... |
#!/usr/bin/env python
'''
routines which solve min_m||Gm - d|| with potentially additional
constraints on m.
'''
import numpy as np
import scipy.optimize
import scipy.sparse.linalg
import scipy.linalg
import scipy.sparse
import modest._bvls as _bvls
import logging
try:
import modest.petsc
except ImportError:
print(... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'AcquisitionSessionConfig.dark_thumbnail'
db.add_column(u'acquisition_acquisitionsessionconfi... |
class Term(object):
"""Collections of constants and setting for ANSI terminal sequence generation."""
# Those are real ANSI color number, used as foreground color codes
COLOR_BLACK = 0
COLOR_RED = 1
COLOR_GREEN = 2
COLOR_YELLOW = 3
COLOR_BLUE = 4
COLOR_MAGENTA = 5
COLOR_CYAN = ... |
# -*- coding: utf-8 -*-
# __init__.py -- plugin object
#
# Copyright (C) 2006 - Steve Frécinaux
# Copyright (C) 2012-2021 MATE Developers
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; eithe... |
#!/usr/bin/env python
from __future__ import division
from subprocess import PIPE, Popen
import psutil,time
import RPi.GPIO as GPIO
import smbus
import time,spidev
import urllib2
import simplejson as json # pip install simplejson
import ast
import sqlite3
import decimal
import os
import glob
import psut... |
"""
Arrow shapes
"""
from pynoded.graph import GraphObject
from math import atan2,pi
from cubicspline import cubicspline
from numpy import array
class Arrow(GraphObject):
"""
An arrow connecting two objects.
"""
def __init__(self,parent,x0,y0,x1,y1,color):
GraphObject.__init__(self,parent,x0,y... |
from python.src.neural_networks.neural_network_utils import NeuralNetworkUtils
from python.src.neurons.neurons import NeuronType
import math
import random
# http://home.agh.edu.pl/~vlsi/AI/backp_t_en/backprop.html
# http://www.cse.unsw.edu.au/~cs9417ml/MLP2/
class TrainingResult(object):
def __init__(self, epo... |
import tensorflow as tf
import tensorflow.contrib.slim as slim
from flowfairy.conf import settings
from util import lrelu, conv2d, maxpool2d, embedding, avgpool2d, GLU, causal_GLU
from functools import partial
import ops
discrete_class = settings.DISCRETE_CLASS
batch_size = settings.BATCH_SIZE
samplerate = sr = settin... |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, Inc.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
"""
Gui to inspect spectra in 1/2D
"""
try:
import Tkinter as tkinter
import tkFont as tkfont
from Tkinter import Tk
import tkFileDialog as filedialog
except:
import tkinter
from tkinter import font as tkfont
from tkinter import Tk
from tkinter import filedialog
from astropy.io import fits
import matplot... |
"""start_django URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
from ast import literal_eval
class Error(Exception):
def __init__(self, message):
self.message = message
class CLI(object):
def __init__(self):
self.transformations = []
self.configurations = []
self.controls = []
self.loop = []
self.capture_loop = False
... |
import os
#from pida.core.doctype import DocType
#from pida.core.testing import test, assert_equal, assert_notequal
from pida.utils.languages import OutlineItem, ValidationError, Definition, \
Suggestion, Documentation
from pida.core.languages import (Validator, Outliner, External, JobServer,
ExternalProxy,
... |
from node import Node
from let import Let
from copy import deepcopy as copy
from map import Map, KVPair
from tools import ItemStream
import fern
class Function(Node):
def __init__(self, child, args=None):
Node.__init__(self)
self.child = child
self.reparent(child)
self.args = args o... |
import chessmoves # Source: https://github.com/kervinck/chessmoves.git
import floyd as engine
import multiprocessing
import sys
def parseEpd(rawLine):
# 4-field FEN
line = rawLine.strip().split(' ', 4)
pos = ' '.join(line[0:4])
if len(line) < 5:
line.append('')
... |
# -*- coding: utf-8 -*-
#!/usr/bin/python2.7
#description :This file creates a plot: Calculates the development of the tag-completeness [%] of all "transport" POIs
#author :Christopher Barron @ http://giscience.uni-hd.de/
#date :19.01.2013
#version :0.1
#usage :python pyscrip... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 6 16:04:32 2017
@author: AmatVictoriaCuramIII
"""
from DefNCAdviceGiver import DefNCAdviceGiver
import numpy as np
import pandas as pd
from pandas_datareader import data
Aggregate = pd.read_pickle('SP500NCAGGSHARPE0205')
Aggregate = Aggregate.loc[:,~Aggregat... |
"""
Django settings for testprj project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... |
#!/usr/bin/env python
#coding=utf8
from whacked4 import utils
from whacked4.ui import editormixin, windows
import copy
import wx
class MiscFrame(editormixin.EditorMixin, windows.MiscFrameBase):
"""
Misc editor window.
"""
def __init__(self, parent):
windows.MiscFrameBase.__init__(self, paren... |
#!/usr/bin/env python
from pySIR.pySIR import pySIR
import argparse
import datetime
import json
import os
import shlex
import subprocess
import sys
import time
import logging
logger = logging.getLogger('fib_optimizer')
log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(level=log... |
import sys
from genStubs import *
stub = Stubs( "neom8", sys.argv[1], sys.argv[2] )
stub.include("NeoM8.h")
stub.newline()
stub.stubConstructor( "NeoM8", "const char * const PUartName", "m_config( )",
"m_uart( PUartName )",
... |
import xml.etree.ElementTree as ET
from os.path import isfile, join, abspath, dirname, lexists
from os import listdir
from sys import argv
import argparse
import pdb, getopt
class ProjectConfigurator:
#SSI_PLUGIN_SOURCE_DIRECTORY = "build\\%s"
def __init__(self, argv):
self.XML_TAG_SUFFIX = "%s"
self.INPUT... |
# uArm Swift Pro - Python Library Example
# Created by: Richard Garsthagen - the.anykey@gmail.com
# V0.1 - June 2017 - Still under development
import uArmRobot
import time
bots = 1
#Configure Serial Port
myRobot = []
myRobot.append(uArmRobot.robot("com3"))
myRobot.append(uArmRobot.robot("com4"))
#... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel, PageChooserPanel
from wagtail.wagtailcore.mode... |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d.axes3d as p3
import matplotlib.animation as anm
#plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'
plt.close('all')
data = np.loadtxt('solar_system.dat')
data2 = data[:,0:15]
fig = plt.figure()
ax = p3.Axes3D(fi... |
#!/usr/bin/python
"""
(C) Copyright 2016-2017 Carlos Falcon, Zbigniew Reszela, Marc Rosanes
The program is distributed under the terms of the
GNU General Public License (or the Lesser GPL).
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... |
"""
WSGI config for tbl project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... |
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Conector videobb By Alfa development Group
# --------------------------------------------------------
from core import httptools
from core import scrapertools
from platformcode import logger
def test_video_exists(page_url):
logg... |
#!/usr/bin/env python
import unittest
from game.strategy import Strategy
from game.tournament import NotEnoughStrategies
from game.tournament import Tournament
import time
import itertools
class DummyStrategy1(Strategy):
def return_column(self, board):
return board.retrieve_first_non_full_column()
class D... |
from django.contrib import admin
from .models import InvitationCode, BlacklistedDomain, EmailConfirmation
@admin.register(InvitationCode)
class InvitationCodeAdmin(admin.ModelAdmin):
list_display = ('code', 'time_created', 'time_accepted', 'expired')
list_display_links = ('code',)
search_fields = ('code... |
#!/usr/bin/env python
# vim: ts=4:sw=4:expandtab
## tweets2sql
## Copyright (C) 2013 Andrew Ziem
## https://github.com/az0/tweets2sql
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, eithe... |
# Lab 12 Character Sequence RNN
from lib.rnn_core2 import RNNCore2
class XXX (RNNCore2):
def init_network(self):
self.set_placeholder(self.sequence_length) #15
hypothesis = self.rnn_lstm_cell(self.X, self.num_classes, self.hidden_size, self.batch_size)
self.set_hypothesis(hypothesis)
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
import sys
import base64
import struct
from datetime import datetime, tzinfo, timedelta
from uuid import UUID
from lxml import etree
from crashdump.exception_info import exception_code_names_per_pla... |
# Copyleft (c) 2016 Cocobug All Rights Reserved.
# -*- coding: utf_8 -*-
import os,sys,codecs
import re
import traceback
class WebPage(object):
"A webpage object, with some variables and all localisations"
def __init__(self,path):
self.path=path
self.name=os.path.split(path)[-1]
self.v... |
# -*- coding:utf-8 -*-
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.views.generic import View
from account.forms import LoginForm
class LoginPageView(View):
"""
用户登陆
"""
# print(... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
if os.getenv... |
# Higgins - A multi-media server
# Copyright (c) 2007-2009 Michael Frank <msfrank@syntaxjockey.com>
#
# This program is free software; for license information see
# the COPYING file.
import random
from twisted.internet import defer, reactor
from higgins.http.channel import HTTPFactory
from higgins.http.server import ... |
"""Module testing the kale.task module."""
import mock
import unittest
from kale import exceptions
from kale import task
from kale import test_utils
class TaskFailureTestCase(unittest.TestCase):
"""Test handle_failure logic."""
def _create_patch(self, name):
"""Helper method for creating scoped moc... |
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <kapitan-admins@googlegroups.com>
#
# SPDX-License-Identifier: Apache-2.0
"hashicorp vault kv secrets module"
import base64
import logging
import os
from binascii import Error as b_error
from sys import exit
from kapitan import c... |
#!/usr/bin/python
from distutils.core import setup, Command
from distutils.util import convert_path
from distutils.command.build_scripts import build_scripts
from distutils import log
import os
from os.path import join, basename
from subprocess import check_call
class Gettext(Command):
description = "Use po/POTF... |
# -*- coding: utf-8 -*-
""":mod:`dodotable.schema` --- table schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
import collections
try:
from collections.abc import MutableSequence
except ImportError:
from collections import MutableSequence
import math
from sqlalchem... |
#!/usr/bin/python
import web
import os
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3
import simplejson
import urllib
TMPDIR = "../tmp/GEvo/"
if not os.path.exists(TMPDIR):
TMPDIR = os.path.join(os.path.dirname(__file__), TMPDIR)
DBTMPL = os.path.join(TMPDIR, "%s.sqlite")
... |
DIFF_THRESHOLD = 1e-40
width = height = 10
class Fixed:
FREE = 0
A = 1
B = 2
class Node:
__slots__ = ["voltage", "fixed"]
def __init__(self, v=0.0, f=Fixed.FREE):
self.voltage = v
self.fixed = f
def set_boundary(mesh):
mesh[width / 2][height / 2] = Node(1.0, Fixed.A)
m... |
"""
A component which allows you to send data to an Influx database.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/influxdb/
"""
import logging
import re
import queue
import threading
import time
import math
import requests.exceptions
import voluptuou... |
from django.core import management
from django.contrib import auth
from askbot.tests.utils import AskbotTestCase
from askbot import models
from django.contrib.auth.models import User
class ManagementCommandTests(AskbotTestCase):
def test_add_askbot_user(self):
username = 'test user'
password = 'sec... |
import unittest
import tempfile
import os
from due.persistence import serialize, deserialize
from due.models.dummy import DummyAgent
from due.event import *
from due.action import Action, RecordedAction
from datetime import datetime
T_0 = datetime(2018, 1, 1, 12, 0, 0, 0)
class TestEvent(unittest.TestCase):
def ... |
#
# Copyright (C) 2001 Andrew T. Csillag <drew_csillag@geocities.com>
#
# You may distribute under the terms of either the GNU General
# Public License or the SkunkWeb License, as specified in the
# README file.
#
from RuleItems import Rule
import CompileGrammar
ruleSet=[
#Rule("Start", ['S'... |
#!/usr/bin/env python2
# Copyright 2015 Dejan D. M. Milosavljevic
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
import os
import io
import Bio.PDB as PDB
from . import topology
from . import secondary_structures
def structure_from_pdb_file(file_path, name=''):
'''Read the structure stored in a PDB file.'''
parser = PDB.PDBParser()
return parser.get_structure(name, file_path)
def structure_from_pdb_string(pdb_string, n... |
##adds survey parameters such as magnitude etc. to things
from .initialize import *
from tqdm import tqdm
from scipy.interpolate import interp1d
import wisps
from .initialize import SELECTION_FUNCTION, SPGRID
from wisps import drop_nan
from astropy.coordinates import SkyCoord
#import pymc3 as pm
from .core import ... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
# -*- coding: utf-8 -*-
'''
An execution module which can manipulate an f5 bigip via iControl REST
:maturity: develop
:platform: f5_bigip_11.6
'''
# Import python libs
from __future__ import absolute_import
import json
import logging as logger
# Import third party libs
try:
import requests
i... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
#Useful: http://docs.python.org/library/wsgiref.html
#
import httplib
import sqlite3
from datetime import datetime
from wsgiref.util import shift_path_info, request_uri
from string import Template
from cStringIO import StringIO
from akara.resource import *
from akara.resource.repository import driver
from akara.resour... |
# -*- coding: utf-8 -*-
"""
Class and methods to handle Job submission.
This module only defines a single object: the Job class.
"""
import os as _os
import sys as _sys
from uuid import uuid4 as _uuid
from time import sleep as _sleep
from datetime import datetime as _dt
from traceback import print_tb as _tb
# Try to... |
from setuptools import setup, find_packages
__version__ = eval(open('mitty/version.py').read().split('=')[1])
setup(
name='mitty',
version=__version__,
description='Simulator for genomic data',
author='Seven Bridges Genomics',
author_email='kaushik.ghose@sbgenomics.com',
packages=find_packages(... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Module to manage Input and Output. This is important to save the evolution at some stage and load it later and continue."""
from os import listdir, remove
#####
##### Managin snapshots
#####
def saveSnapshot(continent,popNo,xmen,t,population,bestpopulation,prefix=None):
... |
"""
django-guardian helper functions.
Functions defined within this module should be considered as django-guardian's
internal functionality. They are **not** guaranteed to be stable - which means
they actual input parameters/output type may change in future releases.
"""
import os
import logging
from itertools import ... |
#!/usr/bin/env python
# region Import
from sys import path
from os.path import dirname, abspath
project_root_path = dirname(dirname(dirname(abspath(__file__))))
utils_path = project_root_path + "/Utils/"
path.append(utils_path)
from base import Base
from network import Ethernet_raw, IPv6_raw, ICMPv6_raw, UDP_raw, DHC... |
class MockTokenizer:
@staticmethod
def tokenize(sentence_data):
return sentence_data.split(" ") # Yes, yes, very sophisticated
class MockTagger:
def __init__(self, naive_tag_rule):
assert callable(naive_tag_rule)
self.naive_tag_rule = naive_tag_rule
def tag(self, tokenized_se... |
'''
Created on 09/ott/2013
@author: bveronesi
'''
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import imp
import sys
import functools
import os
class AnApp(QWidget):
mySignal = pyqtSignal()
def __init__(self,mainapp,*args):
self.loaded_module = None
self.app = maina... |
# This script configures QScintilla for PyQt v4.10 and later. It will fall
# back to the old script if an earlier version of PyQt is found.
#
# Copyright (c) 2012 Riverbank Computing Limited <info@riverbankcomputing.com>
#
# This file is part of QScintilla.
#
# This file may be used under the terms of the GNU Genera... |
import pygame
class SpriteQuadTree(object):
def __init__(self, rect, depth=6, parent=None):
depth -= 1
self.rect = rect
self.sprites = []
self.parent = parent
self.depth = depth
self.cx = self.rect.centerx
self.cy = self.rect.centery
self._moved_cnx... |
from PyQt4 import QtGui, QtCore
from .settings import PlotSettings
from . import basewidgets as bw
from .. import datasets
def _marker_field(**kwargs):
return bw.Dropdown(
['.', ',', 'o', '*',
'+', 'x', 'd', 'D',
'v', '^', '<', '>',
's', 'p', '|', '_'], **kwargs)
def _label_f... |
import pytest
from lcdblib.snakemake import aligners
def test_hisat2_prefixes():
files = [
'a/b/c.1.ht2',
'a/b/c.2.ht2',
'a/b/c.3.ht2',
'a/b/c.4.ht2',
'a/b/c.5.ht2',
'a/b/c.6.ht2',
'a/b/c.7.ht2',
'a/b/c.8.ht2']
assert aligners.hisat2_index_from_p... |
#! /usr/bin/env python
#
# Dakota utility programs for converting output.
#
# Mark Piper (mark.piper@colorado.edu)
import shutil
from subprocess import check_call, CalledProcessError
from .read import get_names
def has_interface_column(tab_file):
'''
Returns True if the tabular output file has the v6.1 'inte... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import os
import webbrowser
from datetime import datetime
import numpy as np
import time
from scipy.spatial.distance import euclidean
from dtwextension import dtwdistance
from search.visualize import display_all_occurences
from utils.fio import get_absolute_path, parse_feature_map
from utils.fio import get_config
f... |
__all__ = [
'create_engine',
]
import sqlalchemy
from garage.assertions import ASSERT
def create_engine(
db_uri, *,
check_same_thread=False,
echo=False,
pragmas=()):
ASSERT(db_uri.startswith('sqlite://'), 'expect sqlite URI: %s', db_uri)
engine = sqlalchemy.create_engine... |
#!/usr/bin/env python
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
DEBUG = 1
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
return -1
GPIO.output(cspin, True)
GPIO.output(clockpin, False) # start clock low
... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChan... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... |
import configparser
import os
import aiofiles
from typing import Dict, List, Optional, Union # noqa: F401
class BotConfig:
def __init__(self) -> None:
self.development: bool = False
self.botnick: str = ''
self.password: str = ''
self.owner: str = ''
self.awsServer: str... |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) a... |
import inspect
import builtins
import re
from . import options
from .parsers import Parser, RegexParser
class ParsersDict(dict):
def __init__(self, old_options: dict):
super().__init__()
self.old_options = old_options # Holds state of options at start of definition
self.forward_declarati... |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
from django.views.generic.edit import ProcessFormView
from django.urls.base import reverse
from django.http.response import HttpResponseRedirect
from edc_base.models import UserProfile
from django.contrib.auth.mixins import LoginRequiredMixin
class ChangePrinterView(LoginRequiredMixin, ProcessFormView):
success... |
# Copyright 2017 TWO SIGMA OPEN SOURCE, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import logging
import Queue
import time
from threading import Thread, current_thread, Lock
import zmq
from binder.binderd.client import BinderClient
from binder.settings import LogSettings
class LoggerClient(Thread):
_singleton = None
@staticmethod
def getInstance():
if not LoggerClient._singl... |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2018 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
import pprint
import re
from datetime import datetime
from unittest import TestCase
from unittest import main as run_tests
from pyvaru import ValidationRule, Validator, ValidationResult, ValidationException, RuleGroup, \
InvalidRuleGroupException
from pyvaru.rules import TypeRule, FullStringRule, ChoiceRule, MinVa... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
# Copyright (C) 2005 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# ... |
import functools
import numpy as np
import regreg.api as rr
from .query import query, optimization_sampler
from .base import restricted_estimator
class greedy_score_step(query):
def __init__(self,
loss,
penalty,
active_groups,
candidate_grou... |
from abc import ABCMeta, abstractmethod # , abstractproperty
import os
import logging
logger = logging.getLogger(__name__)
from hyo2.soundspeed.base.files import FileManager
from hyo2.soundspeed.formats.abstract import AbstractFormat
class AbstractWriter(AbstractFormat, metaclass=ABCMeta):
""" Abstract data wr... |
import os
import sys
from setuptools import setup, find_packages
# project libraries path
LIBRARIES_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src', 'python')
# Manage imports of project libraries
if not os.path.exists(LIBRARIES_PATH):
sys.stderr.write('\nERROR: can not find project librari... |
"""answer any requests for talltowers data
Run from RUN_1MIN.sh
"""
# pylint: disable=abstract-class-instantiated
import smtplib
import time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import pandas as pd
from pandas.io.sql import read_sql
from pyiem.util import get_dbconn
TOW... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.