text stringlengths 12 6.59M |
|---|
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Optimization Tool (SPOTPY).
:author: Tobias Houska
This is the parent class of all algorithms, which can handle the database
structure during the sample.
'''
from __future__ import absolute_import
from __future... |
# vim: set expandtab sw=4 ts=4:
# disable pylint message about unused variable 'fig'
# pylint: disable=unused-variable
'''
Generates a trend (graph) from the buildtimes in buildtimes.xml
Copyright (C) 2014-2015 Dieter Adriaenssens <ruleant@users.sourceforge.net>
This file is part of buildtimetrend/python-lib
<https:/... |
# coding: utf8
from __future__ import unicode_literals
# Source https://github.com/stopwords-iso/stopwords-fi/blob/master/stopwords-fi.txt
# Reformatted with some minor corrections
STOP_WORDS = set("""
aiemmin aika aikaa aikaan aikaisemmin aikaisin aikana aikoina aikoo aikovat
aina ainakaan ainakin ainoa ainoat aio... |
from __future__ import unicode_literals
import os
import time
import json
import sys
import shutil
from converter import Converter
from extensions import valid_input_extensions, valid_output_extensions, bad_subtitle_codecs, valid_subtitle_extensions
from qtfaststart import processor, exceptions
from babelfish import La... |
# (c) 2012, 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) any lat... |
# -*- coding: utf-8 -*-
from twisted.internet.defer import inlineCallbacks, succeed
from txtwitter.twitter import TwitterClient
from vumi.tests.utils import LogCatcher
from vumi.tests.helpers import VumiTestCase
from vumi.transports.twitter import TwitterTransport
from vumi.transports.tests.helpers import TransportHe... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Herald HTTP transport servlet
:author: Thomas Calmant
:copyright: Copyright 2014, isandlaTech
:license: Apache License 2.0
:version: 0.0.3
:status: Alpha
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
yo... |
"""Cover Platform for the Somfy MyLink component."""
import logging
from homeassistant.components.cover import CoverDeviceClass, CoverEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_CLOSED, STATE_OPEN
from homeassistant.core import HomeAssistant
from homeassistant.help... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Optimization Tool (SPOTPY).
:author: Tobias Houska
This is the parent class of all algorithms, which can handle the database
structure during the sample.
'''
from __future__ import absolute_import
from __future... |
#!/usr/bin/env python3
from accessoryFunctions.accessoryFunctions import printtime, run_subprocess, write_to_logfile, make_path, \
combinetargets, MetadataObject, GenObject, make_dict
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.Application import ApplicationError
from Bio.pairwise2 import form... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
class TestAuditConf(object):
@pytest.fixture(autouse=True)
def init(self, ssh_audit):
self.AuditConf = ssh_audit.AuditConf
self.usage = ssh_audit.usage
def _test_conf(self, conf, **kwargs):
options = {
'host': None,
'port': 22,
'ssh1': Tr... |
#
# 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 the Apache License, Version 2.0
# (the "License"); you may not us... |
# Copyright 2015 IBM 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 applicable law or agreed t... |
"""View to accept incoming websocket connection."""
import asyncio
from contextlib import suppress
import logging
from aiohttp import web, WSMsgType
import async_timeout
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import callback
from homeassistant.components.http import HomeAssis... |
# coding: utf-8
#
# spyne - Copyright (C) Spyne contributors.
#
# This library 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 2.1 of the License, or (at your option) any later version.... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from configparser import RawConfigParser, NoOptionError
except ImportError:
from ConfigParser import RawConfigParser, NoOptionError
try:
from StringIO import StringIO
except:
from io import StringIO
import argparse
import os
impor... |
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
from .cursor import Cursor
from .exceptions import Error
class Connection(object):
def __init__(self, db_handle):
... |
#!/usr/bin/python
from flask import Flask, jsonify, request
import solr_query_wordcount_timer
import ipdb
app = Flask(__name__)
solr = solr_query_wordcount_timer.solr_connection()
@app.route('/wc/')
def word_count():
fq = request.args.getlist('fq')
q = request.args.get('q')
num_words = request.args.... |
"""Switch implementation for Wireless Sensor Tags (wirelesstag.net)."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.components.switch import (
PLATFORM_SCHEMA,
SwitchEntity,
SwitchEntityDescription,
)
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homea... |
from .topping import Topping
try:
import json
except ImportError:
import simplejson as json
class TagsTopping(Topping):
"""Provides a list of all block and item tags"""
PROVIDES = [
"tags"
]
DEPENDS = []
@staticmethod
def act(aggregate, classloader, verbose=False):
ta... |
from datetime import datetime, date
import os
import pyverdict
import prestodb
test_schema = 'pyverdict_presto_datatype_test_schema'
test_table = 'pyverdict_presto_datatype_test_table'
def test_data_types():
(presto_conn, verdict_conn) = setup_sandbox()
# result = verdict_conn.sql('select * from {}.{}'.for... |
"""
Copyright 2011 Jeff Garzik
AuthServiceProxy has the following improvements over python-jsonrpc's
ServiceProxy class:
- HTTP connections persist for the life of the AuthServiceProxy object
(if server supports HTTP/1.1)
- sends protocol 'version', per JSON-RPC 1.1
- sends proper, incrementing 'id'
... |
# Copyright 2016-2018 Capital One Services, 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 ... |
import os
import sys
import pip
import urllib2
import mimetypes
import tempfile
from optparse import OptionParser
try:
from hashlib import md5
except ImportError:
import md5 as md5_module
md5 = md5_module.new
def main():
usage = "usage: %prog release"
parser = OptionParser(usage)
(options, args... |
from __future__ import print_function
import os
import sys
from mock import patch
from mock import Mock, MagicMock
from unittest import skipIf
from binascii import b2a_base64
from zope.interface import implementer, directlyProvides
from twisted.trial import unittest
from twisted.test import proto_helpers
from twiste... |
# encoding: utf-8
"""
inet/parser.py
Created by Thomas Mangin on 2015-06-04.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from struct import pack
from exabgp.protocol.ip import IP
from exabgp.protocol.ip import IPSelf
from exabgp.protocol.family import AFI
# from exabgp.protocol.family import SAFI
... |
# -*- coding: utf-8 -*-
from gibberish import classify_gibberish, strip_unwanted
from datahandling import is_frequent_sentence
from globalvars import GlobalVars
import pytest
GlobalVars.frequent_sentences = ["try this", "try the following",
"try this code"]
# actual sentences are stor... |
# -*- coding: utf-8 -*-
import threading
from collections import defaultdict
import six
from django.db import DEFAULT_DB_ALIAS
from django.db.backends.utils import CursorWrapper
from django.db.transaction import Atomic, get_connection
# Hack for Django < 1.9
try:
from django.db.transaction import on_commit
except ... |
#coding:utf-8
import os
import logging
from django.template.base import Library
from django.conf import settings
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
logger = logging.getLogger(__name__)
register = Library()
def static(context, link_url):
"""
Get the pa... |
# Copyright 2012-2014 MongoDB, 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 law or agreed to in writin... |
# coding=utf-8
import json
import unittest
from loadimpact.clients import Client
from loadimpact.resources import Resource, TestConfig, UserScenario
class MockRequestsResponse(object):
def __init__(self, status_code=200, **kwargs):
self.status_code = status_code
self.kwargs = kwargs
for ... |
import re
from flask import Blueprint, g, request, redirect
from dateutil.parser import parse as dateparse
from twilio import twiml
from calloncongress import data, logger
from calloncongress.utils import twilioify
voice = Blueprint('voice', __name__)
def bill_type(abbr):
abbr = re.split(r'([a-zA-Z.\-]*)', abb... |
# -*- coding: utf-8 -*-
#
from mpmath import mp
import pytest
import quadpy
import sympy
mp.dps = 50
@pytest.mark.parametrize(
'f, a, b, exact',
[(lambda t: 1, -1, +1, 2)]
+ [(lambda t: 1, 0, +5, 5)]
+ [(lambda t: t, -0, +1, sympy.Rational(1, 2))]
+ [(lambda t: t**2, -1, +1, sympy.Rational(2, 3))... |
from unit.applications.proto import TestApplicationProto
class TestVariables(TestApplicationProto):
prerequisites = {}
def setup_method(self):
assert 'success' in self.conf(
{
"listeners": {"*:7080": {"pass": "routes/$method"}},
"routes": {
... |
"""
Created on Jun 30, 2012
@author: eric
"""
import unittest
import os
from bundles.testbundle.bundle import Bundle
from ambry.run import get_runconfig
from ambry.warehouse.manifest import Manifest
from test_base import TestBase
from ambry.util import get_logger, Constant
from ambry.orm import Config
import manifes... |
import testbase
from testlib import testing
schema = None
__all__ = 'Table', 'Column',
table_options = {}
def Table(*args, **kw):
"""A schema.Table wrapper/hook for dialect-specific tweaks."""
global schema
if schema is None:
from sqlalchemy import schema
test_opts = dict([(k,kw.pop(k)) for... |
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from scipy.fftpack import fft, ifft
from .utils import sizeof_fmt, logger, get_config
# Support CUDA for FFTs; requires scikits.cuda and pycuda
_cuda_capable = False
_multiply_inplace_c128 = _halve_c128 = _real_c128 = No... |
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
from scipy import linalg
from . import io, Epochs
from .utils import check_fname, logger, verbose
from .io.pick import pick_types, pick_types_forward
from .io.proj import Projection, _has_eeg_average... |
# Authors: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
from scipy import linalg
from . import fiff, Epochs
from .fiff.pick import pick_types
from .event import make_fixed_length_events
def read_proj(fname):
"""Read projections from a FIF file.
Parameters
... |
# Copyright (c) 2019 Nordic Semiconductor ASA
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: BSD-3-Clause
# Tip: You can view just the documentation with 'pydoc3 edtlib'
"""
Library for working with devicetrees at a higher level compared to dtlib. Like
dtlib, this library presents a tree of devicetree... |
#!/usr/bin/env python
from dbus.mainloop.glib import DBusGMainLoop
import gobject
import argparse
import logging
import sys
import os
# our own packages
sys.path.insert(1, os.path.join(os.path.dirname(__file__), '../ext/velib_python'))
from dbusdummyservice import DbusDummyService
from logger import setup_logging
# ... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import division
from __future__ import print_function
import copy
import math
import os
import re
import sys
import uuid
import random
from datetime import datetime
from pprint import pformat
import ete3
import matplotlib.pyplot as pyplot # use this instead
from ... |
#!/bin/python3
import requests
import grequests
import multiprocessing
assets = ['USD', 'USDT', 'EUR', 'BTC', 'XRP', 'ETH', 'HKD', 'LTC', 'RUR',
'CNY', 'DASH', 'ZEC']
#btce
def btc_e(assets):
r = requests.get('https://btc-e.com/api/3/info').json()
urls=[]
pairs = []
for k, v in r['pairs'].it... |
# -*- coding: utf-8 -*-
"""
Boolean Network
================
"""
# Copyright (C) 2017 by
# Rion Brattig Correia <rionbr@gmail.com>
# Alex Gates <ajgates@indiana.edu>
# Thomas Parmer <tjparmer@indiana.edu>
# All rights reserved.
# MIT license.
from collections import defaultdict
try:
import cStringIO.StringIO as Str... |
from kivy.properties import ObjectProperty, StringProperty
from kivy.uix.button import Button
from kivy.uix.popup import Popup
from Service.smtpsender import SMTPSender
from src.database import Database
__author__ = 'grafgustav'
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
Builder.load_file... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import hashlib
import hmac
from datetime import datetime
import logging
import random
import threading
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
from odoo.tools.safe_eval impor... |
"""
abuse.ch Palevo C&C feed RSS bot.
Maintainer: Lari Huttunen <mit-code@huttu.net>
"""
import urlparse
from abusehelper.core import bot
from . import host_or_ip, split_description, AbuseCHFeedBot
class PalevoCcBot(AbuseCHFeedBot):
feed_malware = "Palevo"
feed_type = "c&c"
feeds = bot.ListParam(defau... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import division
from __future__ import print_function
import copy
import math
import os
import re
import sys
import uuid
from datetime import datetime
from pprint import pformat
import ete3
import matplotlib.pyplot as pyplot # use this instead
from matplotlib.pat... |
import os
import requests
import pandas as pd
def enterobase():
'''
Downloads all the E.coli genomes from Enterobase.
'''
options = {
'no_legacy':'true',
'experiment':'assembly_stats',
'database':'ecoli',
'strain_query_type':'query',
'strain_query':'all'
}
... |
""" NaCl SDK support"""
import os
import stat
import urllib
import zipfile
import subprocess
from mod import log, util, config
#-------------------------------------------------------------------------------
def get_sdk_url() :
"""returns the SDK download URL"""
return 'http://storage.googleapis.com/nativecl... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_dronebl
# Purpose: SpiderFoot plug-in for looking up whether IPs/Netblocks/Domains
# appear in the DroneBL blocklist, indicating potential open-relays,
# open pr... |
from __future__ import unicode_literals
from future.builtins import super, zip
"""
Admin classes for all the shop models.
Many attributes in here are controlled by the ``SHOP_USE_VARIATIONS``
setting which defaults to True. In this case, variations are managed in
the product change view, and are created given the ``P... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
# Frederic Mohier, frederic.mohier@gmail.com
# Guillaume Subiron, maethor@subi... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import division
from __future__ import print_function
import copy
import math
import os
import re
import sys
import uuid
import random
from datetime import datetime
from pprint import pformat,pprint
import ete3
import matplotlib.pyplot as pyplot # use this instea... |
from __future__ import unicode_literals
from future.builtins import int, str
from json import dumps
from django.contrib.auth.decorators import login_required
from django.contrib.messages import info
from django.core.urlresolvers import reverse
from django.db.models import Sum
from django.http import Http404, HttpResp... |
#
# Collective Knowledge (Grigori's misc research functions)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updat... |
from lib.bitparser import Parse
from lib.lexer import lex
from lib.basefuncs import Token, tokens
import os
from lib.evaluator import runStates as evaluate
import hashlib
def h11(w):
return hashlib.md5(w.encode()).hexdigest()[:9]
def interpret(text):
lexed = lex(text, tokens)
parsed = Parse(lexed)
evaluate(par... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: tetra5 <tetra5dotorg@gmail.com>
"""
__version__ = "2012.1"
import re
import urllib
import urllib2
import time
try:
from lxml import etree
except ImportError:
try:
from xml.etree import cElementTree as etree
except ImportError:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
(C) 2012, Legoktm, under the MIT License
Checks the recently moved pages list to see
if they were messed up AFC moves. If so, log them at [[Wikipedia:Articles for creation/Wrongly moved submissions]]
"""
import pywikibot
import pywikibot.data.api
import datetime
site =... |
#!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
# Fam Zheng <famz@redhat.com>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
import os
import subprocess
import tempfile
import shutil
import hashlib
from django.conf.urls im... |
# Copyright (c) 2012-2014 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
import os
import sys
import shutil
import hashlib
import subprocess
import requests
requests.packages.urllib3.disable_warnings()
import re
import traceback
import uuid
from datetime import datetime
from pprint import pprint, pformat
import numpy as np
from Bio import SeqIO
from ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... |
import os
import re
import utils
import config
import plotter
import subprocess
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
class experiment:
""" an experiment run/trial consists of:
- a trial (fold index or None if cumulat... |
# Swift Message & Alert System
#
# Opens and accepts messages over a socket
# and from a multiprocessing queue for irc channel alerts
import asyncio
import sqlite3
import socket
import ssl
import sys
import re
from hangups import ChatMessageSegment
from Bank.Hangouts import name_to_nick
from Bank import g
import json
... |
from __future__ import absolute_import, unicode_literals
from dash.orgs.models import Org
from dash.utils import intersection
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
from django.db import models
from django.db.models import Q, Count, Prefetch
from django.utils.en... |
#
# Collective Knowledge (checking and installing software)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be update... |
from itertools import product
def rna_to_aa(rna):
''' Translate an RNA string into an amino acid string.
Input: An RNA string Pattern.
Output: The translation of Pattern into an amino acid string Peptide.
'''
rna_codon_table = { "UUU":"F", "UUC":"F", "UUA":"L", "UUG":"L", "UCU":"S", "UCC":"S", "UCA":... |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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) any later version.
#
# Ansible is distributed i... |
from django.contrib import admin
from member.models import (Member, Client, Contact, Address,
Referencing, Route, Client_avoid_component,
Client_avoid_ingredient, Option,
Client_option, Restriction)
from meal.models import Ingredient
cl... |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
from __future__ import print_function
from __future__ import division
import os
import sys
import shutil
import hashlib
import subprocess
import requests
requests.packages.urllib3.disable_warnings()
import re
import traceback
import uuid
from datetime import datetime
from pprint i... |
import logging
import argparse
from sqlalchemy.exc import ProgrammingError
from dataset.util import FreezeException
from dataset.persistence.database import Database
from dataset.freeze.config import Configuration, Export
from dataset.freeze.format import get_serializer
logging.basicConfig(level=logging.DEBUG)
log =... |
# -*- coding: utf-8 -*-
"""
Helper functions used in views.
"""
import csv
from threading import Lock
import urllib
from datetime import datetime, timedelta
from json import dumps
from functools import wraps
from flask import Response
from lxml import etree
from presence_analyzer.main import app
import logging
... |
"""
This script is part of a spectroscopic reduction pipeline used to
extract 1D optical spectra from data taken at MDM observatory with
the ModSpec spectrograph mounted on the 2.4m Hiltner telescope.
This script processes and extracts 1D spectra from the 2D raw images
from a single night or block of observing. The in... |
"""Implementation of org.mpris.MediaPlayer2.Player interface.
https://specifications.freedesktop.org/mpris-spec/2.2/Player_Interface.html
"""
import logging
from gi.repository.GLib import Variant
from pydbus.generic import signal
from mopidy.core import PlaybackState
from mopidy_mpris.interface import Interface
l... |
import os, subprocess, time
from bl.dict import Dict
class File(Dict):
def __init__(self, fn=None, log=print, **args):
Dict.__init__(self, fn=fn, log=log, **args)
def __repr__(self):
return "%s(fn=%r)" % (
self.__class__.__name__, self.fn)
def open(self):
subprocess.c... |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# 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) any later version.
#
# Ansible is distributed i... |
from django import forms
from django.template import Context
from django.template.loader import get_template
from django import template
from materializecssform import config
register = template.Library()
@register.filter
def materializecss(element, label_cols={}):
if not label_cols:
label_cols = 's12'
... |
from __future__ import unicode_literals
import os
import sha
import datetime
from flask import Flask, render_template, g, session, request
from flask_openid import OpenID
from catsnap.web.middleware.exception_logger import ExceptionLogger
from catsnap.web.middleware.exception_notifier import ExceptionNotifier
from cat... |
#!/usr/bin/env python
# Copyright 2011 Nigel Small
#
# 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... |
from collections import Counter
from functools import partial, wraps
from itertools import izip_longest
from recipes import *
__all__ = ['chunked', 'first', 'peekable', 'collate', 'consumer', 'ilen',
'iterate', 'with_iter', 'distinct_permutations']
_marker = object()
def chunked(iterable, n):
"""Bre... |
from pprint import pprint
from django.core.cache import cache
from utils.cache import entkeys
from utils.functions import my_make_key_cache, fo2logger
from utils.functions.models import rows_to_dict_list, rows_to_dict_list_lower
import produto.queries
def produtos_n1_basic(cursor, param):
tipo = param[0:2]
... |
# External module imports
import RPi.GPIO as GPIO
import time
# Pin Definitons:
pwmPin = 24 # Broadcom pin 18 (P1 pin 12)
ledPin = 23 # Broadcom pin 23 (P1 pin 16)
butPin = 17 # Broadcom pin 17 (P1 pin 11)
dc = 95 6 # duty cycle (0-100) for PWM pin
# Pin Setup:
GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme
... |
import pandas as pd
import numpy as np
from util import cartesian
from itertools import product
class Variable(object):
"""A discrete variable, with a distribution over N states.
"""
USED_NAMES = set()
def __init__(self, name, n_states):
"""Name the variable, and say how many states it has. ... |
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
import socket
import sys
import time
## this agent reads from the solarmax inverter socket and
## publishes the data to a mqtt listener
## constants
inverter_ip = "192.168.1.90"
inverter_port = 12345
mqtt_broker_ip = "192.168.1.24"
mqtt_broker_por... |
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014-2018) James Kermode, King's College London
# Lars Pastewka, University of Freiburg
#
# This program is free software: you ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Manages production plants initialization
"""
import erppeek
import datetime
from consolemsg import step, success, warn, error, fail
import dbconfig
from yamlns import namespace as ns
import click
erp = erppeek.Client(**dbconfig.erppeek)
Mix = erp.GenerationkwhProduc... |
from __future__ import unicode_literals
import uuid
from jinja2 import Template
from moto.core import BaseBackend
from moto.core.utils import get_random_hex
class HealthCheck(object):
def __init__(self, health_check_id, health_check_args):
self.id = health_check_id
self.ip_address = health_check... |
from django.db import connections
from django.core.cache import cache
from utils.cache import entkeys
from utils.functions import my_make_key_cache, fo2logger
from utils.functions.models import rows_to_dict_list, rows_to_dict_list_lower
import produto.queries
def produtos_n1_basic(param):
tipo = param[0:2]
... |
# Copyright 2020 Google LLC. 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 applicable law or a... |
from pymongo import MongoClient
from mdstudio.db.impl.mongo_database_wrapper import MongoDatabaseWrapper
from mdstudio.logging.logger import Logger
logger = Logger()
class MongoClientWrapper(object):
def __init__(self, host, port):
self._host = host
self._port = port
self._client = self... |
"""This file contains utility functions for find icon computer vision algorithms."""
from typing import List, Tuple
import cv2
from modules.bounding_box import BoundingBox
import numpy as np
import sklearn.cluster
# experimentally-derived constants for the precision-recall curve
_HIGH_PRECISION_MULTIPLIER = 1.5
_OPTI... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Program to (re)categorize images at commons.
The program uses commonshelper for category suggestions.
It takes the suggestions and the current categories. Put the categories through
some filters and adds the result.
The following command line parameters are supported:
-o... |
#! /usr/bin/env python2.7
import modules.apis.api_base as api
class NewbsAPI(api.API):
def __init__(self, session = None):
super(NewbsAPI, self).__init__("https://leagueofnewbs.com/api", session)
def add_textutil(self, channel, text_type, data, **kwargs):
endpoint = "/users/{0}/{1}s".format(... |
#!/usr/bin/python
#
# Download and import airspace files for the mapserver
#
import sys
import os
import re
import shutil
import math
import subprocess
import transaction
from osgeo import ogr
from paste.deploy.loadwsgi import appconfig
from skylines.config.environment import load_environment
from skylines.model impor... |
import logging; logger = logging.getLogger("minimalKB."+__name__);
DEBUG_LEVEL=logging.DEBUG
from Queue import Queue, Empty
import json
import traceback
DEFAULT_MODEL = "default"
import shlex
from multiprocessing import Process
hasRDFlib = False
try:
import rdflib
import rdflib.namespace
hasRDFlib = Tru... |
"""
Simple script to install PyQt or PySide in CI (Travis and AppVeyor).
"""
from __future__ import print_function
import os
import sys
import subprocess
import urllib
if 'APPVEYOR' in os.environ:
def fix_registry(python_ver):
"""Update install path on windows registry so PyQt installation installs at the... |
# -*- coding: utf-8 -*-
# Django settings for the mozillians project.
import json
import logging
import os.path
import sys
from django.utils.functional import lazy
from decouple import config, Csv
from unipath import Path
from dj_database_url import parse as db_url
from django_jinja.builtins import DEFAULT_EXTENSION... |
import os, re, bson
import pandas as pd
import cufflinks as cf
cf.set_config_file(world_readable=True, theme='pearl')
import plotly.plotly as py
from plotly.graph_objs import *
from itertools import groupby
from io.utils import nest_dict, RecursiveDict
from config import mp_level01_titles
from utils import Author, get_... |
"""
Low-level functions for arbitrary-precision floating-point arithmetic.
"""
__docformat__ = 'plaintext'
import math
from bisect import bisect
import sys
# Importing random is slow
#from random import getrandbits
getrandbits = None
from .backend import (MPZ, MPZ_TYPE, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE,
B... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.