code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
class MsgpackError(Exception):
pass
class ConnectionError(MsgpackError):
pass
class ResponseError(MsgpackError):
pass
class InvalidRequest(MsgpackError):
pass
class InvalidResponse(MsgpackError):
pass
class InvalidData(MsgpackError):
pass
class TimeoutError(MsgpackError):
pass
... | jakm/txmsgpackrpc | txmsgpackrpc/error.py | Python | mit | 369 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2018-02-08 10:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0013_auto_20180206_0826'),
]
operations = [
migrations.AddField(
... | mcmaxwell/idea_digital_agency | idea/blog/migrations/0014_auto_20180208_1025.py | Python | mit | 2,473 |
# 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 ... | yaqiyang/autorest | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/SubscriptionIdApiVersion/microsoftazuretesturl/operations/group_operations.py | Python | mit | 3,678 |
# -*- coding: utf-8 -*-
from django.views.generic import TemplateView, View
from django.template import RequestContext, Template
from django.shortcuts import render_to_response
from django.http import HttpResponse
from test_app.models import EditliveBaseFieldsTest
TEST_TEMPLATE = """
{%% extends "test_app/base.html"... | h3/django-editlive | example_project/test_app/views.py | Python | bsd-3-clause | 1,504 |
def extractInsouciantetranslationsWordpressCom(item):
'''
Parser for 'insouciantetranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if item['tags'] == ['Uncategorized']:
titlemap = [... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractInsouciantetranslationsWordpressCom.py | Python | bsd-3-clause | 1,213 |
# -*- coding: utf-8 -*-
##############################################################################
#
# licence AGPL version 3 or later
# see licence in __openerp__.py or http://www.gnu.org/licenses/agpl-3.0.txt
# Copyright (C) 2014 Akretion (http://www.akretion.com).
# @author David BEAL <david.beal@akretion.co... | akretion/carrier-delivery-colipostefr | __unported__/delivery_carrier_label_so_colissimo/stock.py | Python | agpl-3.0 | 6,422 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | timsnyder/bokeh | bokeh/models/sources.py | Python | bsd-3-clause | 29,941 |
#!/usr/bin/env python
import unittest
from pycoin.ecdsa import sign, verify, public_pair_for_secret_exponent, possible_public_pairs_for_signature, generator_secp256k1
class SigningTest(unittest.TestCase):
def test_sign(self):
for se in ["47f7616ea6f9b923076625b4488115de1ef1187f760e65f89eb6f4f7ff04b012"] ... | gitonio/pycoin | tests/signature_test.py | Python | mit | 1,126 |
#!/usr/bin/env python
import time
import threading
import pprint
import copy
import Bybop_NetworkAL
from Bybop_Network import *
from Bybop_Commands import *
from Bybop_Discovery import *
from Bybop_Connection import *
import ARCommandsParser
class State(object):
"""
Three level dictionnary to save the intern... | Tala/bybop | src/Bybop_Device.py | Python | bsd-3-clause | 23,839 |
'''
working with gitlab's groups
'''
from crud import Crud
import members
class Groups(Crud, members.Members):
def __init__(self):
Crud.__init__(self, 'groups')
'''
add a new group
'''
def add(self, sysNam, grpNam):
return Crud.add(self, sysNam, {'name': grpNam, 'path': grpNam})
| alces/gitlab-rest-client | groups.py | Python | bsd-2-clause | 292 |
#!/usr/bin/env python3
from bisect import insort
from collections import defaultdict, namedtuple
from operator import attrgetter
from intervaltree import Interval, IntervalTree
from ck2parser import (rootpath, vanilladir, is_codename, TopLevel, Number,
Pair, Obj, Date as ASTDate, Comment, Simple... | zijistark/ck2utils | esc/check_title_history.py | Python | gpl-2.0 | 34,052 |
# CTCI 1.3
# URLify
import unittest
# My Solution
#-------------------------------------------------------------------------------
# CTCI Solution
def urlify(string, length):
'''function replaces single spaces with %20 and removes trailing spaces'''
new_index = len(string)
for i in reversed(range(leng... | kyle8998/Practice-Coding-Questions | CTCI/Chapter1/1.3-URLify.py | Python | unlicense | 1,208 |
from flask import render_template
import erc_config
from erc_server import app
@app.route('/')
def root():
return render_template('index.html', resources=erc_config.ERC_SERVER_STATIC_PATH) | veasy/easy-remote-control | erc-server/erc_server/routes/default_routes.py | Python | mit | 194 |
import elaspic.elaspic_model
import pytest
@pytest.mark.parametrize("alignment, scores", [
[('AAAAA', 'AAAAA'), (1.0, 1.0, None, None)],
])
def test_analyze_alignment(alignment, scores):
assert elaspic.elaspic_model.analyze_alignment(alignment) == scores
| ostrokach/elaspic | tests/test_elaspic_model.py | Python | mit | 265 |
from __future__ import unicode_literals
import base64
import logging
import threading
import spotify
from spotify import ffi, lib, serialized, utils
__all__ = ['Image', 'ImageFormat', 'ImageSize']
logger = logging.getLogger(__name__)
class Image(object):
"""A Spotify image.
You can get images from :met... | mopidy/pyspotify | spotify/image.py | Python | apache-2.0 | 5,521 |
__author__ = 'bryson'
"""
The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to
instantiate. Factory Method lets a class defer instantiation to subclasses.
"""
class PizzaStore(object):
def __init__(self):
pass
def order_pizza(self, type):... | bpeeters/DesignPatterns | Factory_Pattern/PizzaFactoryMethod.py | Python | gpl-2.0 | 2,318 |
#!/usr/bin/env python
#########################################################################################
# Spinal Cord Registration module
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2020 NeuroPoly, Polytechnique Montreal <www.neuro.polymtl.ca>
#
# ... | neuropoly/spinalcordtoolbox | spinalcordtoolbox/registration/register.py | Python | mit | 66,785 |
# -*- coding: utf-8 -*-
"""
@package Sekator
@brief Contain an iterator function to read fastq files and return FastqSeq objects
@copyright [GNU General Public License v2](http://www.gnu.org/licenses/gpl-2.0.html)
@author Adrien Leger - 2014
* <adrien.leger@gmail.com>
* <adrien.leger@inserm.fr>
* <adrien... | a-slide/py_NGS_tools | FastqReader.py | Python | gpl-2.0 | 3,073 |
#!/usr/bin/env python
from urlparse import urlparse
import re
def url_split(url):
"""split url and return only strings in a list"""
url_split = urlparse(url)
url_path = url_split.path
clean_url = re.sub('[^A-Za-z]+', ',', url_path).split(",")
wordList = []
for word in clean_url:
"""rem... | mad01/hermit | src/lib/wsplit.py | Python | mit | 499 |
#!/usr/bin/env python
# test --flatten : turn deep into composited non-deep
command += oiiotool("src/deepalpha.exr --flatten -o flat.exr")
# test --ch on deep files (and --chnames)
command += oiiotool("src/deepalpha.exr --ch =0.0,A,=0.5,A,Z --chnames R,G,B,A,Z --flatten -d half -o ch.exr")
# To add more tests, jus... | scott-wilson/oiio | testsuite/oiiotool-deep/run.py | Python | bsd-3-clause | 609 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-04 16:36
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pootle_app', '0014_set_directory_tp_path'),
]
operations = [
migrations.AlterIndexT... | claudep/pootle | pootle/apps/pootle_app/migrations/0015_add_tp_path_idx.py | Python | gpl-3.0 | 470 |
#!/usr/bin/env python2
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | google/transperf | virtsetup.py | Python | apache-2.0 | 44,507 |
import sys
import pprint
import bucky3.module as module
class DebugOutput(module.MetricsPushProcess):
pprinter = pprint.PrettyPrinter(stream=sys.stderr, indent=1, width=120, depth=5, compact=False)
def process_values(self, *args, **kwargs):
if args:
self.pprinter.pprint(args)
if... | jsiembida/bucky3 | bucky3/debug.py | Python | apache-2.0 | 370 |
#!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the importdescriptors RPC.
Test importdescriptors by generating keys on node0, importing the correspon... | jonasschnelli/bitcoin | test/functional/wallet_importdescriptors.py | Python | mit | 26,479 |
# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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... | sapcc/monasca-notification | monasca_notification/plugins/jira_notifier.py | Python | apache-2.0 | 8,896 |
# -*- coding: utf-8 -*-
"""Toolbox to handle date intervals
A period is a triple (unit, start, size), where unit is either "month" or "year", where start format is a
(year, month, day) triple, and where size is an integer > 1.
Since a period is a triple it can be used as a dictionary key.
"""
import calendar
impo... | adrienpacifico/openfisca-core | openfisca_core/periods.py | Python | agpl-3.0 | 43,653 |
import numpy as np
from scipy import sparse
from ..affine import astransform, affine_transform
def difference_transform(X, order=1, sorted=False,
transform=False):
"""
Compute the divided difference matrix for X
after sorting X.
Parameters
----------
X: np.array, np... | klingebj/regreg | code/regreg/affine/fused_lasso.py | Python | bsd-3-clause | 3,706 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
import unittest
from whispy_lispy import lexer
from whispy_lispy import cst
from ..constructors import *
import whispy_lispy.exceptions
def like_tokens(obj):
"""Wraps all the objects in the nested list (or the single... | vladiibine/whispy_lispy | tests/test_lexer/__init__.py | Python | mit | 7,832 |
#!/usr/bin/python
# Copyright (C) 2010, 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this lis... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py | Python | gpl-3.0 | 21,671 |
#!/usr/bin/env python
# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility for generating experimental API tokens
usage: generate_token.py [-h] [--key-file KEY_FILE]
[--... | danakj/chromium | tools/origin_trials/generate_token.py | Python | bsd-3-clause | 6,023 |
from itertools import chain
import os
from six import string_types
def flatten_path_dict(path_dict, base_prefix="", delimiter=os.sep):
"""
Convert a directory tree dict into a list of leaf file paths.
For example:
paths = {'ohsu':
{'test': 'simple',
'pasat': [
... | sibis-platform/ncanda-data-integration | scripts/import/laptops/config_utils.py | Python | bsd-3-clause | 1,862 |
import praw
import pdb
import re
import os
import csv
import pdb
from bot_config import *
from IPython import embed
from nltk import *
from weight_response import WeightResponse
from subreddit_dictionary import SubredditDictionary
if not os.path.isfile('bot_config.py'):
print "You must create config file with your... | Pinwheeler/F4tB0t | f4tb0t.py | Python | gpl-2.0 | 2,500 |
''' Handlers for the Player List pages /players/{firstletter}
This only returns a small dataset on each player like Name, College, Draft Year'''
import pandas
import requests
import datetime
import os
from bs4 import BeautifulSoup
baseurl = "http://www.basketball-reference.com/players/{firstletter}/{playerid}.html"... | mblanchard23/brefcrawler | get_players.py | Python | mit | 3,878 |
# encoding: utf8
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [("podcasts", "0005_auto_20140610_1854")]
operations = [
migrations.AlterField(
model_name="episode",
name="outdated",
field=models.BooleanField(defau... | gpodder/mygpo | mygpo/podcasts/migrations/0006_auto_20140614_0836.py | Python | agpl-3.0 | 701 |
"""
Project: athena-server
Author: Saj Arora
Description:
"""
from api.v1 import SageController, SageMethod, make_json_ok_response
def sage_account_me_function(self, account, **kwargs):
return account.to_dict()
def sage_account_update_function(self, key, resource, **kwargs):
return make_json_ok_response(dic... | aroraenterprise/projecteos | backend/api/v1/account_module/account_api.py | Python | mit | 564 |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 1 10:31:00 2015
@author: kienle
"""
import numpy as np
import matplotlib.pyplot as plt
import pickle
from matplotlib import cm
from generalFunctions import *
from skimage import filters
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
path = 'X:\\Nicola\\16... | nicolagritti/ACVU_scripts | source/check_piezo_movements.py | Python | gpl-3.0 | 1,793 |
"""
Module with code executed during Studio startup
"""
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup
import django
from monkey_patch import third_part... | franosincic/edx-platform | cms/startup.py | Python | agpl-3.0 | 3,052 |
'''
kinkin
'''
import urllib,urllib2,re,xbmcplugin,xbmcgui,os
import settings
import time,datetime
from datetime import date
from threading import Timer
from helpers import clean_file_name
import shutil
import glob
from threading import Thread
import cookielib
from t0mm0.common.net import Net
from helpe... | odicraig/kodi2odi | addons/plugin.video.tv4me/default.py | Python | gpl-3.0 | 37,025 |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
import os
from astropy.io import fits
import sys
from sklearn.mixture import GMM
from pandas import DataFrame
import legacyanalysis.decals_sim_priors as priors
# Globals
xyrange=dict(x_star=[-0.5,2... | legacysurvey/pipeline | py/obiwan/decals_sim_priors_plots.py | Python | gpl-2.0 | 7,697 |
import flask
import gzip
def generateResponse(token, data = None):
"""
Return a flask response with required headers for osu! client, token and gzip compressed data
token -- user token
data -- plain response body
return -- flask response
"""
resp = flask.Response(gzip.compress(data, 6))
resp.headers['cho-tok... | RlSEN/bannedcho | c.ppy.sh/responseHelper.py | Python | gpl-3.0 | 1,381 |
from __future__ import unicode_literals
import collections
from collections import OrderedDict
from django.utils.encoding import force_text
from rest_framework.compat import unicode_to_repr
from rest_framework.utils import json
class ReturnDict(OrderedDict):
"""
Return object from `serializer.data` for the... | interlegis/saap | config/rest_framework/utils/serializer_helpers.py | Python | gpl-3.0 | 5,187 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import json
import os
from distutils.version import LooseVersion
from cms import __version__ as cms_version
from cms.toolbar.utils import get_toolbar_from_request
from django import template
from django.conf import settings
from django.core.cac... | haricot/djangocms-bs4forcascade | cmsplugin_bs4forcascade/templatetags/cascade_tags.py | Python | mit | 3,625 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from odoo import api, fields, models
class ProductProduct(models.Model):
_inherit = "product.product"
date_from = fields.Date(compute='_compute_product_margin_fields_values', string='Margin Date F... | ygol/odoo | addons/product_margin/models/product_product.py | Python | agpl-3.0 | 9,711 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | a0c/odoo | addons/mail/mail_group.py | Python | agpl-3.0 | 11,974 |
import sys
from PyQt4 import QtGui, QtCore
from mainwindow import Ui_MainWindow
import ntpath
from socket import *
import os
import time
ntpath.basename("a/b/c")
# Stack Overflow : http://stackoverflow.com/questions/8384737/python-extract-file-name-from-path-no-matter-what-the-os-path-format
def path_leaf(path):
... | WheelBarrow2/EzFileSender | Old fiels/app_old.py | Python | mit | 6,579 |
from __future__ import print_function
from __future__ import absolute_import
import numpy as np
from ..forest import Forest
def simple_forest():
""" generate a simple forest
"""
parents = np.array([2, 2, 4, 4, 4])
F = Forest(5, parents)
return F
def test_forest():
""" test creation of forest... | alexis-roche/nipy | nipy/algorithms/graph/tests/test_forest.py | Python | bsd-3-clause | 3,578 |
"""
gts v0.01
genetic test sequencer
Copyright 2011 Brian Monkaba
This file is part of ga-bitbot.
ga-bitbot 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
... | Pascal66/ga-bitbot | gts.py | Python | gpl-3.0 | 20,392 |
#!/usr/bin/env python
"""
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");... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service.py | Python | apache-2.0 | 5,505 |
### Copyright (C) 2007-2016 Peter Williams <pwil3058@gmail.com>
###
### 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; version 2 of the License only.
###
### This program is distributed in th... | pwil3058/pysm_wsm | patch_diff/gui/diff.py | Python | gpl-2.0 | 22,025 |
#!/usr/bin/python
# TODO: Use tracy (https://github.com/MerlijnWajer/tracy) to see if lwan
# performs certain system calls. This should speed up the mmap tests
# considerably and make it possible to perform more low-level tests.
import subprocess
import time
import unittest
import requests
import socket
im... | schets/lwan | tools/testsuite.py | Python | gpl-2.0 | 12,353 |
import numpy
import sklearn.datasets
infile = "./covtype"
outfile1 = "./covtype_train_noise"
outfile2 = "./covtype_test_noise"
x0, y0 = sklearn.datasets.load_svmlight_file(infile)
x0 = x0.todense()
x1 = numpy.concatenate((x0, x0, x0, x0, x0), axis=0)
y1 = numpy.concatenate((y0, y0, y0, y0, y0), axis=0)
n, d = x1.shape... | wangshusen/SparkGiant | data/RandNoise.py | Python | mit | 664 |
#####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... | GoodgameStudios/crossbar | crossbar/common/process.py | Python | agpl-3.0 | 15,725 |
"""
This file contains all the classes used by has_access for error handling
"""
from django.utils.translation import ugettext as _
class AccessResponse(object):
"""Class that represents a response from a has_access permission check."""
def __init__(self, has_access, error_code=None, developer_message=None, ... | nagyistoce/edx-platform | lms/djangoapps/courseware/access_response.py | Python | agpl-3.0 | 4,494 |
from dowser.dowser import Root, ReferrerTree # NOQA
| appknox/dowser-py3 | dowser/__init__.py | Python | mit | 53 |
import types
import inspect
def get_attrs(obj):
all_obj_attrs = [x for x in dir(obj) if not x.startswith('_')]
props = []
funcs = []
fields = []
for obj_attr in all_obj_attrs:
objs_to_check = list(obj.__class__.__mro__)
objs_to_check.insert(0, obj)
for obj_class in objs_t... | openrazer/openrazer | pylib/openrazer/client/debug.py | Python | gpl-2.0 | 4,206 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import fasta
import genetics
import table
def main(argv):
codon = table.codon(argv[0])
strings = fasta.read_ordered(argv[1])
dna = strings[0]
introns = strings[1:]
for intron in introns:
dna ... | cowboysmall/rosalind | src/stronghold/rosalind_splc.py | Python | mit | 466 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import copy
import s... | dbentley/pants | src/python/pants/option/options.py | Python | apache-2.0 | 13,830 |
# Copyright 2013 IBM Corp.
# Copyright (c) 2013 OpenStack Foundation
# 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... | bswartz/cinder | cinder/tests/unit/test_ibm_xiv_ds8k.py | Python | apache-2.0 | 33,327 |
# Copyright (c) 2015, Frappe and contributors
# For license information, please see license.txt
from frappe.model.document import Document
class ProgramCourse(Document):
pass
| frappe/erpnext | erpnext/education/doctype/program_course/program_course.py | Python | gpl-3.0 | 180 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 of the Licen... | hjoliver/cylc | cylc/flow/cfgspec/globalcfg.py | Python | gpl-3.0 | 54,288 |
#
# =================================================================
# =================================================================
"""Table Creation/Deletion for Schema changes in the PowerVC 1.2.1 Release"""
from datetime import datetime
from sqlalchemy import MetaData, Boolean, Column, DateTime
from sqlalchem... | windskyer/k_nova | paxes_nova/db/sqlalchemy/migrate_repo/versions/002_ibm_powervc_v1r2m1.py | Python | apache-2.0 | 3,470 |
from scipy.ndimage import gaussian_filter1d
from scipy.optimize import curve_fit
import scipy.fft as fp
import numpy as np
import pickle
import matplotlib.pyplot as plt
import lib.plotting as plt2
def parse_probe_qubit_sts(freqs, S21):
amps = np.abs(S21)
frequencies = freqs[gaussian_filter1d(amps, sigma=1).ar... | vdrhtc/Measurement-automation | scripts/photon_wave_mixing/helpers.py | Python | gpl-3.0 | 3,114 |
import os
from pcs import settings
from pcs.common import pcs_pycurl as pycurl
from pcs.common import reports
from pcs.common.reports.item import ReportItem
from pcs.common.node_communicator import (
CommunicatorLoggerInterface,
HostNotFound,
NodeTargetFactory,
)
from pcs.common.reports import (
Report... | feist/pcs | pcs/lib/node_communication.py | Python | gpl-2.0 | 10,162 |
"""
# Majic
# Copyright (C) 2014 CEH
#
# 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
# (at your option) any later version.
#
# This pr... | NERC-CEH/jules-jasmin | majic_web_service/majic_web_service/tests/functional/test_get_run_properties.py | Python | gpl-2.0 | 6,320 |
"""Support for UPnP/IGD Binary Sensors."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity... | lukas-hetzenecker/home-assistant | homeassistant/components/upnp/binary_sensor.py | Python | apache-2.0 | 1,960 |
'''Library / toolkit for creating command line programs with minimal effort.'''
# Copyright (c) 2013-2016, 2018 Benjamin Althues <benjamin@babab.nl>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and... | babab/pycommand | pycommand/__init__.py | Python | isc | 1,254 |
from unittest import TestCase
from django.contrib.sites.models import Site
from django.http import HttpRequest
from mock import Mock, patch
import urls # NOQA
from cmsplugin_feedback.models import Message
from cmsplugin_feedback import signals
class EmailTest(TestCase):
def setUp(self):
self.msg = Mess... | satyrius/cmsplugin-feedback | tests/test_email.py | Python | mit | 1,443 |
import atexit
import base64
import datetime
import importlib
import json
import logging
import os
import shutil
import subprocess
import traceback
import urllib
import falcon
import engine.util as util
from engine.code_runner import CodeRunner, FilePushError, FilePullError, EngineExecutionError
from engine.docker_ut... | project-lovelace/lovelace-engine | engine/api.py | Python | mit | 15,244 |
# -*- coding: utf-8 -*-
# $URL$
# $Date$
# $Revision$
# See LICENSE.txt for licensing terms
import os
from urllib.parse import urljoin, urlparse
from xml.sax.saxutils import escape
import docutils.nodes
from rst2pdf.basenodehandler import NodeHandler
from rst2pdf.image import MyImage, missing
from rst2pdf.opt_imp... | aquavitae/rst2pdf-py3-dev | rst2pdf/genpdftext.py | Python | mit | 8,587 |
import matplotlib.pyplot as plt
import numpy as np
t = np.loadtxt( "../../res/time.dat" )
data = np.loadtxt("res/ppar_1d_0_0.dat")
a = data[:,4]
font_title = {'family' : 'serif',
'weight' : 'normal',
'size' : 18,}
font_label = {
'weight' : 'normal',
'size' : 16,}
fig = plt.figure(... | timy/dm_spec | ana/pullerits_1d/plot_test.py | Python | mit | 611 |
import os
import base64
from requests import Session, Request
from OpenSSL import crypto
url = 'http://ct.googleapis.com/aviator/ct/v1/get-roots'
s = Session()
r = Request('GET',
url)
prepped = r.prepare()
r = s.send(prepped)
if r.status_code == 200:
roots = r.json()
# RFC 6962 defines the cert... | wgoulet/CTPyClient | fetchroots.py | Python | apache-2.0 | 1,184 |
"""Feed to Zinnia command module"""
import os
import sys
from urllib2 import urlopen
from datetime import datetime
from optparse import make_option
from django.conf import settings
from django.utils import timezone
from django.core.files import File
from django.utils.text import Truncator
from django.utils.html import... | westinedu/similarinterest | zinnia/management/commands/feed2zinnia.py | Python | bsd-3-clause | 7,134 |
"""
Copyright (C) 2010 Stephen Georg
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
(at your option) any later version.
This program is ... | SteveG/tracks-queue | src/pagecontexts.py | Python | gpl-2.0 | 9,901 |
import sys
sys.path.insert(0, '..')
import os
import glob
import unittest
os.chdir(os.path.dirname(__file__))
tests_names = []
for test in glob.glob('Test*.py'):
if test.endswith('TestAll.py'):
continue
tests_names.append(test[:-3])
loader = unittest.defaultTestLoader
suites = loader.loadTestsFromNam... | mbudde/mail-indicator | tests/TestAll.py | Python | gpl-3.0 | 386 |
# -*- coding: utf-8 -*-
from dateutil import parser
import logging
import gzip
import os
from visir_slurper.settings import DATA_DIR
from scrapy.utils.serialize import ScrapyJSONEncoder
import json
logger = logging.getLogger(__name__)
_encoder = ScrapyJSONEncoder()
class VisirSlurperSaveArticleByDate(object):
... | gogn-in/visir_slurper | visir_slurper/visir_slurper/pipelines.py | Python | mit | 2,870 |
"""LomLobot configuration data."""
from beem.config import BotConfig
class LomLobotConfig(BotConfig):
"""Handle configuration data loading for LomLobot."""
def check_twitch(self):
"""Check the 'twitch' table in the TOML config."""
if not self.get("twitch"):
self.error("The twitch... | gammafunk/lomlobot | lomlobot/config.py | Python | gpl-2.0 | 2,686 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-18 01:21
from __future__ import unicode_literals
import django.db.models.deletion
import jsonfield.fields
import morango.utils.uuids
from django.conf import settings
from django.db import migrations
from django.db import models
class Migration(migration... | lyw07/kolibri | kolibri/core/lessons/migrations/0001_initial.py | Python | mit | 4,431 |
#
# Test Cases for the ShareBackendClassic Class
#
# 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 of the License, or
# (at your option) any later version.
#
# This program i... | rvelhote/GSoC-SWAT | swat/tests/test_sharebackendclassic.py | Python | gpl-3.0 | 5,698 |
# Copyright 2018 The TensorFlow 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 applica... | kevin-coder/tensorflow-fork | tensorflow/python/distribute/moving_averages_test.py | Python | apache-2.0 | 6,514 |
from cwpoliticl.extensions.base_parser import BaseParser
from cwpoliticl.items import CacheItem, WDPost
class DeccanchronicleParser(BaseParser):
detail_root_selector = '//*[@class="story-main"]'
page_selector_dict = {
"title": '{}/h1/span/text()'.format(detail_root_selector),
"image": '{}/*[@c... | trujunzhang/djzhang-targets | cwpoliticl/cwpoliticl/extensions/deccanchronicle_parser.py | Python | mit | 2,532 |
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext as _
from selvbetjening.sadmin2 import menu
from selvbetjening.sadmin2.decorators import sadmin_prerequisites
from selvbetjening.sadmi... | animekita/selvbetjening | selvbetjening/sadmin2/views/user.py | Python | mit | 1,851 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
NUMERALS = "Zv0w2x4y6z8AaBcCeDgEiFkGmHoIqJsKuL3M7NbOfPjQnRrS1T9UhVpW5XlYdt"
def rebase(num, numerals=NUMERALS):
base = len(numerals)
left_digits = num // base
if left_digits == 0... | brianloveswords/webpagemaker | webpagemaker/api/migrations/0003_create_short_url_ids.py | Python | mpl-2.0 | 1,419 |
from .base import *
DEBUG = True
ALLOWED_HOSTS = ['*']
SECRET_KEY = 'dev'
#
# Third app config
#
# Django debug toolbar
# INSTALLED_APPS.append('debug_toolbar')
# MIDDLEWARE_CLASSES.append('debug_toolbar.middleware.DebugToolbarMiddleware')
# INTERNAL_IPS = ['127.0.0.1']
# Sorl Thumbnail
THUMBNAIL_DEBUG = ... | mittya/duoclub | duoclub/duoclub/settings/dev.py | Python | mit | 326 |
input = """
c num blocks = 1
c num vars = 100
c minblockids[0] = 1
c maxblockids[0] = 100
p cnf 100 415
-71 -62 -94 0
-33 -74 93 0
16 -58 -2 0
-65 -69 56 0
12 -46 -68 0
6 14 7 0
-39 -31 -87 0
-47 -71 75 0
11 -85 -8 0
-49 -64 63 0
-8 -1 15 0
-21 -60 -40 0
-68 -71 -85 0
-68 49 -55 0
51 17 -40 0
-51 -82 -59 0
-53 45 -41 0... | alviano/aspino | tests/sat/Models/c415.100.UNSAT.dimacs.test.py | Python | apache-2.0 | 5,236 |
"""
.. _ex-vector-mne-solution:
============================================
Plotting the full vector-valued MNE solution
============================================
The source space that is used for the inverse computation defines a set of
dipoles, distributed across the cortex. When visualizing a source estimate,... | mne-tools/mne-tools.github.io | 0.21/_downloads/9de3654ac15b4882b43ef0142cacd42b/plot_vector_mne_solution.py | Python | bsd-3-clause | 3,659 |
people = 30
cars = 40
buses = 15
if cars > people:
print "We should take the car."
elif cars < people:
print "We should not take the cars."
else:
print "We can not decide."
if buses > cars:
print "That's too many buses"
elif buses < cars:
print "May be we could take the buses."
else:
print "We can not decide.... | auspbro/CodeSnippets | Python/LPTHW/ex30.py | Python | gpl-3.0 | 433 |
'''
common.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright (C) 2008-2009 Nikolaus Rath <Nikolaus@rath.org>
This program can be distributed under the terms of the GNU GPLv3.
'''
from __future__ import division, print_function, absolute_import
from functools import wraps
from llfuse import ROOT_I... | drewlu/ossql | src/s3ql/common.py | Python | gpl-3.0 | 18,254 |
"""Support for Plaato devices."""
from datetime import timedelta
import logging
from aiohttp import web
from pyplaato.models.airlock import PlaatoAirlock
from pyplaato.plaato import (
ATTR_ABV,
ATTR_BATCH_VOLUME,
ATTR_BPM,
ATTR_BUBBLES,
ATTR_CO2_VOLUME,
ATTR_DEVICE_ID,
ATTR_DEVICE_NAME,
... | rohitranjan1991/home-assistant | homeassistant/components/plaato/__init__.py | Python | mit | 7,162 |
"""Unit tests for cat2cohort."""
import unittest
from bingo import bingo
class TestBingoGenerator(unittest.TestCase):
"""Test methods from bingo."""
def test_bingo_generator_has_default_size(self):
bingo_generator = bingo.BingoGenerator()
expected = pow(bingo.DEFAULT_SIZE, 2)
self.a... | Commonists/bingo | tests/test_bingo.py | Python | mit | 1,598 |
import os
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..commands import *
from ...common import ui
from ..git_command import GitCommand
from ...common import util
class GsShowStatusCommand(WindowCommand, GitCommand):
"""
Open a status view for the active git repository.
""... | stoivo/GitSavvy | core/interfaces/status.py | Python | mit | 26,371 |
# Copyright 2015 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
## py2/py3 compat
from __future__ import print_function
import iface
### test docs
print("doc(iface): %r" % (iface.__doc__,))
print("t = iface.T()")
t =... | kellrott/gopy | _examples/iface/test.py | Python | bsd-3-clause | 401 |
from dipy.reconst.cache import Cache
from dipy.core.sphere import Sphere
from numpy.testing import assert_, assert_equal, run_module_suite
class TestModel(Cache):
def __init__(self):
pass
def test_basic_cache():
t = TestModel()
s = Sphere(theta=[0], phi=[0])
assert_(t.cache_get("design_mat... | StongeEtienne/dipy | dipy/reconst/tests/test_cache.py | Python | bsd-3-clause | 593 |
"""This component provides basic support for Foscam IP cameras."""
import asyncio
from libpyfoscam import FoscamCamera
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, SUPPORT_STREAM, Camera
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
... | w1ll1am23/home-assistant | homeassistant/components/foscam/camera.py | Python | apache-2.0 | 8,588 |
#
# 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, software
# ... | sileht/python-gnocchiclient | gnocchiclient/v1/resource_cli.py | Python | apache-2.0 | 10,589 |
"""SCons.Tool.wix
Tool-specific initialization for wix, the Windows Installer XML Tool.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCo... | taxilian/omaha | site_scons/site_tools/wix.py | Python | apache-2.0 | 4,114 |
#!/usr/bin/env python
# Copyright 2013 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice... | nextsmsversion/macchina.io | platform/JS/V8/v8-3.28.4/tools/push-to-trunk/common_includes.py | Python | apache-2.0 | 21,066 |
"""
Example of usage of builder classes. Builder class is sommething which takes interface as an input and can be used to automatically instanciate, configure and connect
various component to that interface.
Components like buffers, CDC, parsers, inteconnects, decoders, interface conventors can be easily instanciated u... | Nic30/hwtLib | hwtLib/examples/builders/__init__.py | Python | mit | 342 |
# -*- coding: utf-8 -*-
"""
Unit tests for the da.monitor module.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the License);
y... | wtpayne/hiai | a3_src/h70_internal/da/monitor/spec/spec_monitor.py | Python | apache-2.0 | 4,825 |
#!/usr/bin/env python
#
# grass_lidar
#
# Author: Dan Clewley (dac@pml.ac.uk)
# Created on: 05 November 2014
# This file has been created by ARSF Data Analysis Node and
# is licensed under the GPL v3 Licence. A copy of this
# licence is available to download with this file.
"""
Functions for working with LiDAR data u... | pmlrsg/arsf_dem_scripts | arsf_dem/dem_lidar/grass_lidar.py | Python | gpl-3.0 | 26,458 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 BhaaL
#
# This file is part of translate.
#
# translate 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) any lat... | unho/translate | translate/convert/po2flatxml.py | Python | gpl-2.0 | 5,280 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.