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 |
|---|---|---|---|---|---|
"""
@package mi.dataset.driver.moas.gl.engineering.test.test_driver
@file marine-integrations/mi/dataset/driver/moas/gl/engineering/test/test_driver.py
@author Bill French, Nick Almonte
@brief Test cases for glider ctd data
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/dsa/test_driver
... | ooici/marine-integrations | mi/dataset/driver/moas/gl/engineering/test/test_driver.py | Python | bsd-2-clause | 36,688 |
#####################################################################################
#
# 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... | w1z2g3/crossbar | crossbar/controller/cli.py | Python | agpl-3.0 | 36,181 |
from collections import defaultdict
import matplotlib.pyplot as plt
from itertools import product
plt.ion()
# node = (dot,N,NW,W,SW,S,SE,E,NE)
O = 0
N = 1
NW = 2
W = 3
SW = 4
S = 5
SE = 6
E = 7
NE = 8
def dot():
return [True,None,None,None,None,None,None,None,None]
def empty():
return [None,None,None,None,Non... | karolciba/playground | cross/solver.py | Python | unlicense | 7,020 |
# coding=utf-8
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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... | richm/designate | designate/tests/test_api/test_v1/test_domains.py | Python | apache-2.0 | 11,537 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.controllers.temp import Controller
from bliss.common.temperature import Input, Output, Loop
import random
import time
import m... | tiagocoutinho/bliss | bliss/controllers/temperature/mockup.py | Python | lgpl-3.0 | 10,600 |
#!/usr/bin/env python3
#$#HEADER-START
# vim:set expandtab ts=4 sw=4 ai ft=python:
#
# Reflex Configuration Event Engine
#
# Copyright (C) 2016 Brandon Gillespie
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as publ... | reflexsc/reflex | src/rfxcmd/__init__.py | Python | agpl-3.0 | 45,284 |
import os, sys
import numpy as np
import argparse
import glob
import types
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import tensorflow as tf
import data
import model
from util import *
def get_results_self(args, ds_src, ds_tar, ide... | googleinterns/intern2020_cocal | uncertainty/plots/plot_why_self.py | Python | apache-2.0 | 9,063 |
"""
Group APIs
----------
Create
Create a new Group
Add
Add a user to a group
Get
Get info about a specified group
List
Get a list of all groups
Get a list of all users in a group
Update
Update info for an existing group
Delete
Delete a group
Remove
Remove a user from a group
"""
from ... | RyanWilsonDev/DomoPy | domopy/groupmanagement.py | Python | mit | 2,100 |
"""superlists URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/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')
Class-... | JMwill/wiki | notebook/book/python/Test-Driven-Development-With-Python/superlists/superlists/urls.py | Python | mit | 802 |
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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 applicabl... | jerryz1982/neutron | neutron/tests/unit/db/test_l3_hamode_db.py | Python | apache-2.0 | 23,269 |
#!/usr/bin/env python
#
# Copyright (c) 2018, The OpenThread 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:
# 1. Redistributions of source code must retain the above copyright
# notic... | erja-gp/openthread | tools/harness-automation/cases/reed_5_7_2.py | Python | bsd-3-clause | 1,872 |
import datetime
import logging
import pprint
import decorator
from cryptokit.rpc import CoinRPCException, CoinserverRPC
@decorator.decorator
def rpc_conn(func, *args, **kwargs):
"""
Catches all uncaught exceptions and coerces them to a CoinRPCException
"""
try:
res = func(*args, **kwargs)
... | simplecrypto/cryptokit | cryptokit/rpc_wrapper.py | Python | gpl-3.0 | 13,528 |
"""
Tumblr OAuth 1.0a support.
Take a look to http://www.tumblr.com/docs/en/api/v2
You need to register OAuth site here: http://www.tumblr.com/oauth/apps
Then update your settings values using registration information
ref:
https://github.com/gkmngrgn/django-tumblr-auth
"""
from social.utils import first
from so... | nvbn/python-social-auth | social/backends/tumblr.py | Python | bsd-3-clause | 1,191 |
"""
.. _tut-forward:
Head model and forward computation
==================================
The aim of this tutorial is to be a getting started for forward computation.
For more extensive details and presentation of the general
concepts for forward modeling, see :ref:`ch_forward`.
"""
import os.path as op
import mne... | rkmaddox/mne-python | tutorials/forward/30_forward.py | Python | bsd-3-clause | 11,511 |
# Copyright 2017 Rackspace, US 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... | openstack/octavia | octavia/tests/unit/amphorae/backends/agent/api_server/test_haproxy_compatibility.py | Python | apache-2.0 | 6,088 |
import urlparse
import sys,urllib
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
import urlresolver
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
args = urlparse.parse_qs(sys.argv[2][1:])
_addon = xbmcaddon.Addon()
_icon = _addon.getAddonInfo('icon')
def build_url(query):
return base_url + '?' + urlli... | munchycool/forthelulz | plugin.video.v1d30play/playvideo.py | Python | agpl-3.0 | 2,398 |
#!/usr/bin/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")... | ryba-io/ryba | packages/metal/retired/nagios/resources/plugins/sys_logger.py | Python | mit | 10,367 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Module for Latent Semantic Analysis (aka Latent Semantic Indexing) in Python.
Implements fast truncated SVD (Singular Value Decomp... | sjebbara/gensim | gensim/models/lsimodel.py | Python | gpl-3.0 | 34,968 |
from Domain import Exceptions
from UI.ConsoleUI import ConsoleUI
import UI.WebGUI
from UI.WebGUI.FlaskRunner import FlaskRunner
class UIHandler:
def __init__(self, graph):
self._graph = graph
def run(self):
"""
UI entry point, will let the user select between a menu or command lin... | Zephyrrus/ubb | YEAR 1/SEM2/GRAPH/Lab1Final/UI/UIHandler.py | Python | mit | 1,951 |
import os
import shutil
from trtools.io.pytables import HDF5Handle, convert_frame, frame_to_table
from trtools.io.panda_hdf import OneBigTable, create_obt
def hdf_save(obj, filename):
try:
hdf = HDFFile(filename, 'w')
hdf.save(obj)
finally:
hdf.handle.close()
def hdf_open(obj, filenam... | dalejung/trtools | trtools/io/hdf5_store.py | Python | mit | 4,036 |
import copy
import re
from io import BytesIO
from itertools import chain
from urllib.parse import quote, urlencode, urljoin, urlsplit
from django.conf import settings
from django.core import signing
from django.core.exceptions import (
DisallowedHost, ImproperlyConfigured, RequestDataTooBig,
)
from django.core.fil... | EmadMokhtar/Django | django/http/request.py | Python | mit | 21,619 |
#!/usr/bin/python
import sys
import datetime
with open(sys.argv[1]) as f:
content = f.readlines()
monthinteger = int(sys.argv[1].split('/')[0][-2:])
month = datetime.date(1900, monthinteger, 1).strftime('%b')
filename = "{}.sql".format(month)
ff = open(filename,'w')
ff.write("use wikistats;\n")
ff.write("... | tdj28/WikiStats | MapReduce/data/convert.py | Python | apache-2.0 | 693 |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWSumm.
#
# GWSumm 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) ... | maxisi/gwsumm | gwsumm/mode.py | Python | gpl-3.0 | 2,487 |
#!/usr/bin/env python2.7
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""This program will create the virtual python setup.
It will do this bu creating symbolic links to existing python in the system.
This program can be used if the user doent have root permission to install
python
usage : Usage: vir... | tst-eclamar/earthenterprise | earth_enterprise/third_party/python/virtual-python.py | Python | apache-2.0 | 4,230 |
__author__ = "gjoshi"
from graph import Graph
from digraph import DiGraph
from algorithms.dfs import dfs
def test_dfs_on_graph_with_no_edges():
g = Graph()
g.add_nodes_from([1, 2, 3, 4, 5])
assert dfs(g, 1) == [1]
def test_dfs_on_undirected_graph():
g = Graph()
g.add_nodes_from([1, 2, 3, 4, 5]... | gj1292/Plexus | tests/test_dfs.py | Python | gpl-2.0 | 664 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# url(r'^$', 'proyecto.views.home', name='home'),
url(r'^', include('xbapp.urls')),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', includ... | developingo/Bicitacora | xbtrack/urls.py | Python | gpl-3.0 | 343 |
# Copyright 2011-2012 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/LICENSE-2.0
#
# Unless... | OpenDaisy/daisy-api | daisy/contrib/plugins/artifacts_sample/v1/artifact.py | Python | apache-2.0 | 768 |
import os
from lxml import etree
# write_rss_xml writes name and date data for podcast RSS feeds to XML files
# contained in the relative path ./feeds. It is currently assumed that each
# podcast will have its data stored in a separate file.
def write_rss_xml( feed, feed_url, latest_title, latest_date ):
# the fu... | digwiz/engrss | write_rss_xml.py | Python | mit | 1,634 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | jaggu303619/asylum | openerp/addons/point_of_sale/report/pos_details.py | Python | agpl-3.0 | 9,434 |
"""
Django settings for sw_tts project.
Generated by 'django-admin startproject' using Django 1.9.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# ... | g10k/sw_tts | sw_tts/settings.py | Python | mit | 5,058 |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Exercise 1
A = np.array([[0.3,0.6,0.1],[0.5,0.2,0.3],[0.4,0.1,0.5]])
v = np.array([1/3,1/3,1/3])
v_dist = []
v_next = v
for i in range(1,25):
v_current = v_next
v_next = v_next*A
v_dist.append(np.linalg.norm(v_next-v_c... | balazssimon/ml-playground | udemy/lazyprogrammer/numpy-stack/exercises.py | Python | apache-2.0 | 1,916 |
##########################################################################
#
# Copyright (c) 2012-2013, Image Engine Design 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:
#
# * Redi... | cedriclaunay/gaffer | python/GafferCortexTest/IndexedIOPathTest.py | Python | bsd-3-clause | 4,654 |
from PIL import Image
import urllib.request, urllib.parse, urllib.error
import io
def get_image_from_url(url):
'''Reads image from a (trusted) url to an image file readable by PIL.
Note: only works properly if the image has a standard file-extension.'''
f = io.StringIO(urllib.request.urlopen(url).read())
... | athuras/Compositor | Compositor/util.py | Python | mit | 359 |
from Battery import *
# Open Testing File
#fin = open('sim_3600_pulse.csv', 'r')
#fout = open('sim_3600_pulse_out.csv', 'w')
fin = open('sim_glasgow.csv', 'r')
fout = open('sim_glasgow_out.csv', 'w')
Battery.P_GAIN = 15
Battery.I_GAIN = 0.01
Battery.HYST_GAIN = 17.45
Battery.SHORT_TERM_DAMP = 1.8
Battery.SOC_CORRECTI... | dcambron/State-of-Charge-Estimator | simulator.py | Python | mit | 735 |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | wavefrontHQ/python-client | wavefront_api_client/api/anomaly_api.py | Python | apache-2.0 | 30,220 |
def test_floats():
import simplejson
for num in [1617161771.7650001]:
assert simplejson.dumps(num) == str(num)
| ramsay/projectloot | simplejson/tests/test_float.py | Python | apache-2.0 | 131 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Charles Li <chuck@mixed-metaphors.com>
# Copyright (c) 2011 Tristan Matthews <le.businessman@gmail.com>
# This file is part of CloudSound.
# CloudSound is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | tmatth/CloudSound | feldmanesque.py | Python | gpl-3.0 | 6,736 |
import nose
from shorten.key import bx_encode, bx_decode
def test_bx_encode_wrong_type():
alphabet = 'abc'
string = 'a'
nose.tools.assert_raises(TypeError, lambda: bx_encode(string, alphabet))
def test_bx_decode_empty():
alphabet = ''
string = 'a string'
nose.tools.assert_raises(ValueError, lambd... | clibc/shorten | tests/test_bx.py | Python | mit | 1,011 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utilities for handling results.
"""
import sys
import copy
import numpy as np
import shutil
__all__ = ["Results", "print_fn"]
def print_fn(results,
niter,
ncall,
add_live_it=None,
dlogz=None,
stop_val... | joshspeagle/dynesty | py/dynesty/results.py | Python | mit | 13,789 |
""" Thoroughly document Bokeh model classes.
The ``bokeh-model`` directive will automatically document
all the attributes (including Bokeh properties) of a Bokeh
model class. A JSON prototype showing all the possible
JSON fields will also be generated.
Usage
-----
This directive takes the path to a Bokeh model class... | gpfreitas/bokeh | bokeh/sphinxext/bokeh_model.py | Python | bsd-3-clause | 2,618 |
from base64 import b64encode, b64decode
from hashlib import md5
from time import time
import random
def get_random_data(length):
return ''.join(chr(random.randint(0, 255)) for x in range(length))
class LoginFailed(Exception):
pass
def calc_ha1(**parameters):
ha1_text = "%(username)s:%(realm)s:%(password... | AGProjects/msrprelay | msrp/digest.py | Python | gpl-2.0 | 4,411 |
"""
Base tinman data models. The Model class is the base model that all other base
model classes extend. StorageModel defines the interfaces for models with built
in storage functionality.
Specific model storage base classes exist in the tornado.model package.
Example use::
from tornado import gen
from torna... | lucius-feng/tinman | tinman/model.py | Python | bsd-3-clause | 7,193 |
#!/usr/bin/env python
"""
print DCommands working directory
"""
import os
from COMDIRAC.Interfaces import critical
from COMDIRAC.Interfaces import DSession
if __name__ == "__main__":
import sys
from DIRAC.Core.Base import Script
Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
... | pigay/COMDIRAC | Interfaces/scripts/dpwd.py | Python | gpl-3.0 | 652 |
import time
import re
import logging
import os
from autotest.client.shared import error
from autotest.client.shared import utils
from virttest import utils_test
from virttest import utils_misc
from virttest import data_dir
from virttest import env_process
@error.context_aware
def run(test, params, env):
"""
... | swapnakrishnan2k/tp-qemu | qemu/tests/win_virtio_update.py | Python | gpl-2.0 | 10,420 |
from .aliquot_form import AliquotForm
from .box_form import BoxForm
from .box_item_form import BoxItemForm
from .box_type_form import BoxTypeForm
from .manifest_form import ManifestForm
from .manifest_item_form import ManifestItemForm
from .modelform_mixins import RequisitionFormMixin
| botswana-harvard/edc-lab | edc_lab/forms/__init__.py | Python | gpl-2.0 | 286 |
__author__ = 'chris'
import json
import nacl.signing
import nacl.utils
import nacl.encoding
import nacl.hash
from binascii import unhexlify
from collections import OrderedDict
from interfaces import MessageProcessor, BroadcastListener, MessageListener, NotificationListener
from keys.bip32utils import derive_childkey
f... | tomgalloway/OpenBazaar-Server | market/protocol.py | Python | mit | 22,431 |
"""Contains miscellaneous helpers"""
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from future.moves.urllib import request
from future.utils import PY2
from html.entities import name2codepoint
from past.builtins import bases... | tarzasai/Flexget | flexget/utils/tools.py | Python | mit | 14,832 |
#!/usr/bin/env python
#
# This file is part of moses. Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.
import sys
FEAT_FIELD = 2
SCORE_FIELD = 3
def main():
if len(sys.argv[1:]) != 1:
sys.stderr.write('Usage: {} moses.ini <nbest.with-n... | alvations/mosesdecoder | scripts/nbest-rescore/rescore.py | Python | lgpl-2.1 | 1,545 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack 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
#
... | tylertian/Openstack | openstack F/nova/nova/db/sqlalchemy/migrate_repo/versions/110_drop_deprecated_auth.py | Python | apache-2.0 | 6,898 |
class ParserBaseStatic(object):
def visit(self, bar):
pass
Parser1 = ParserBaseStatic | sourcesimian/pyPlugin | tests/base.py | Python | mit | 99 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... | mvaled/sentry | src/sentry/south_migrations/0429_auto__add_integrationexternalproject__add_unique_integrationexternalpr.py | Python | bsd-3-clause | 113,432 |
from flask import Flask, render_template,session
app = Flask(__name__)
app.secret_key = 'my_secret_key'
# SOLUTION added secret_key
@app.route('/')
def myfirstfunction():
if not 'title' in session:
session['title'] = 'hello world'
return render_template('index.html', name="Mike")
if __name__ == '__mai... | jiobert/python | raj_chetan/flask_olympics/olympics3/server.py | Python | mit | 350 |
def failure(self, f):
return self.trace((f.type, f.value, f.tb))
| dreid/twixxy | twixxy/features/failure.py | Python | mit | 69 |
#!/usr/bin/python
command += testshade("-g 512 512 -od uint8 -o Cout out.tif test")
outputs = [ "out.txt", "out.tif" ]
# expect a few LSB failures
failthresh = 0.004
failpercent = 0.05
| Anteru/OpenShadingLanguage | testsuite/noise-gabor2d-filter/run.py | Python | bsd-3-clause | 187 |
# Copyright (c) 2015 Intel 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 writing... | zhangjunli177/sahara | sahara/tests/unit/plugins/cdh/v5_4_0/test_edp_engine.py | Python | apache-2.0 | 4,231 |
"""Unit tests for settings.py."""
import unittest
from third_party_auth import provider, settings
from third_party_auth.tests import testutil
_ORIGINAL_AUTHENTICATION_BACKENDS = ['first_authentication_backend']
_ORIGINAL_INSTALLED_APPS = ['first_installed_app']
_ORIGINAL_MIDDLEWARE_CLASSES = ['first_middleware_clas... | jolyonb/edx-platform | common/djangoapps/third_party_auth/tests/test_settings.py | Python | agpl-3.0 | 2,500 |
"""Home Assistant command line scripts."""
import argparse
import asyncio
import importlib
import logging
import os
import sys
from typing import List
from homeassistant.bootstrap import async_mount_local_lib_path
from homeassistant.config import get_default_config_dir
from homeassistant.requirements import pip_kwargs... | aequitas/home-assistant | homeassistant/scripts/__init__.py | Python | apache-2.0 | 2,112 |
"""
Agent for reporting virtual guest IDs to subscription-manager
Copyright (C) 2011 Radek Novacek <rnovacek@redhat.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; either version 2
of the Licen... | alikins/virt-who | virt-who.py | Python | gpl-2.0 | 23,696 |
# Copyright (C) 2010 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 list of conditions and the ... | espadrine/opera | chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py | Python | bsd-3-clause | 9,540 |
# (c) Simon J Galbraith 2007.
# Daniel Hyduke 2010
import java, jarray
from copy import deepcopy
from cern.colt.list import IntArrayList, DoubleArrayList
from cern.colt.matrix import DoubleFactory2D
from cern.colt.matrix.impl import DenseDoubleMatrix2D
from cern.colt.matrix.impl import SparseDoubleMatrix2D
from cern.co... | jeicher/cobrapy | cobra/oven/danielhyduke/jython/numpy/core/core.py | Python | lgpl-2.1 | 16,920 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
tiles = [(n, 4) for n in ('Ton', 'Nan', 'Shā', 'Pei', 'Haku', 'Hatsu', 'Chun',
'Īpin', 'Ryanpin', 'Sanpin', 'Sū... | N-Yuki/Haitei | rules/riichi/tileset.py | Python | mpl-2.0 | 3,953 |
from __future__ import unicode_literals
from django.apps import AppConfig
class kohrsupplyConfig(AppConfig):
name = 'kohrsupply'
| klml/kohrsupply | apps.py | Python | mit | 136 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.permissions
from erpnext.controllers.recurring_document import date_field_map
from frappe.utils import get_first_day, get_la... | mahabuber/erpnext | erpnext/controllers/tests/test_recurring_document.py | Python | agpl-3.0 | 4,701 |
""" Unit tests for input/output functions """
import numpy as np
import json
import mir_eval
import warnings
import nose.tools
import tempfile
def test_load_delimited():
# Test for ValueError when a non-string or file handle is passed
nose.tools.assert_raises(
IOError, mir_eval.io.load_delimited, Non... | bmcfee/mir_eval | tests/test_input_output.py | Python | mit | 6,414 |
from __future__ import division, print_function, absolute_import
import numpy as np
from .smoother import LinearSmoother
from .utils import multinterp, setattr_context
class SuperSmoother(LinearSmoother):
"""SuperSmoother for nonparametric smoothing of scatter plots.
SuperSmoother is an adaptive component-... | moreati/supersmoother | supersmoother/supersmoother.py | Python | bsd-2-clause | 4,775 |
#!/usr/bin/env python
"""
Monitor the jobs present in the repository
"""
import DIRAC
from DIRAC.Core.Utilities.DIRACScript import DIRACScript as Script
@Script()
def main():
# Registering arguments will automatically add their description to the help menu
Script.registerArgument("RepoDir: Location of Job Re... | ic-hep/DIRAC | src/DIRAC/Interfaces/scripts/dirac_repo_monitor.py | Python | gpl-3.0 | 756 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from erpnext.hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError
from frappe.permiss... | ThiagoGarciaAlves/erpnext | erpnext/hr/doctype/leave_application/test_leave_application.py | Python | agpl-3.0 | 8,447 |
#!/usr/bin/python
#
# (c) 2017 Apstra Inc, <community@apstra.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 opt... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/aos/aos_logical_device.py | Python | bsd-3-clause | 7,996 |
# Copyright 2011 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 co... | openstack/python-troveclient | troveclient/tests/test_accounts.py | Python | apache-2.0 | 3,641 |
from sqlalchemy import ForeignKey
from brewlog import db
class ParamRecord(db.Model):
__tablename__ = 'params'
id = db.Column(db.Integer, primary_key=True)
brew_id = db.Column(db.Integer, ForeignKey('brews.brew_id'))
param_type = db.Column(db.String(20), nullable=False)
value = db.Column(db.Strin... | hinnefe2/brewlog | brewlog/models/params.py | Python | gpl-3.0 | 413 |
#!D:\PycharmProjects\UFT\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==1.2.1','console_scripts','pip-2.7'
__requires__ = 'pip==1.2.1'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('pip==1.2.1', 'console_scripts', 'pip-2.7')()
)
| hardanimal/UFT_UPGEM | Scripts/pip-2.7-script.py | Python | gpl-3.0 | 275 |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
with open(filename) as fh:
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", fh.read()))
return metadata['version']
setup(
name='Mopidy-GMusic',
version=get_ver... | jodal/mopidy-gmusic | setup.py | Python | apache-2.0 | 1,349 |
import os.path
from askapdev.rbuild.builders import CMake as Builder
import askapdev.rbuild.utils as utils
# CMake doesn't know about ROOT_DIR for blas and lapack, so need to
# explicitly name them. Want to use the dynamic libraries in order
# to avoid link problems with missing FORTRAN symbols.
platform = utils.g... | ATNF/askapsdp | 3rdParty/casacore/casacore-1.6.0a/build.py | Python | gpl-2.0 | 1,801 |
from setuptools import setup
setup(name='simpholib',
version='1.0b1',
description='Simple Photo Library',
long_description='Tool for ordering unsorted photos and arrange them in a directories by dates.',
url='https://github.com/dstdnk/simple-photo-library',
download_url='https://github.co... | dstdnk/simple-photo-library | setup.py | Python | mit | 663 |
from time import time
from sklearn.preprocessing import StandardScaler
from sklearn import model_selection
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report,confusion_matrix,accuracy_score
from sklearn.tree import DecisionTreeClassifier
from sklearn.neural_netw... | isabellewei/deephealth | data/gary/heart_submit.py | Python | mit | 1,745 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'AddingLines.ui'
#
# Created: Wed May 4 11:00:30 2011
# by: PyQt4 UI code generator 4.8.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Att... | epiqc/ScaffCC | rkqc/tools/gui/ui/AddingLines.py | Python | bsd-2-clause | 2,809 |
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import sys
import os
import re
import csv
import copy
import warnings
from optparse import OptionParser
from gnuradio import filter, fft
try:
import numpy as np
except ImportError:... | sdh11/gnuradio | gr-filter/python/filter/design/filter_design.py | Python | gpl-3.0 | 91,770 |
"""Test helpers for Panasonic Viera."""
from unittest.mock import Mock, patch
from panasonic_viera import TV_TYPE_ENCRYPTED, TV_TYPE_NONENCRYPTED
import pytest
from homeassistant.components.panasonic_viera.const import (
ATTR_FRIENDLY_NAME,
ATTR_MANUFACTURER,
ATTR_MODEL_NUMBER,
ATTR_UDN,
CONF_APP... | w1ll1am23/home-assistant | tests/components/panasonic_viera/conftest.py | Python | apache-2.0 | 2,351 |
#!/bin/env python3
# 提取OUTCAR中每一步的原子坐标和能量
# 用法:excoor.py
# 或:excoor.py 20 24 35 (将分别提取第20,24,35步的构型并生成相应的POSCAR文件)
import re
import math
import sys
import os
from VASP import execCmd, CmdRrror
def writePOSCAR(content, base, number_of_atoms, step):
os.system("head -7 POSCAR > POSCAR%d" % step)
with open("POSC... | Mabinogiysk/VASP-script | excoor.py | Python | gpl-2.0 | 2,286 |
"""
Revision ID: 0170_hidden_non_nullable
Revises: 0169_hidden_templates_nullable
Create Date: 2018-02-21 14:05:04.448977
"""
from alembic import op
revision = '0170_hidden_non_nullable'
down_revision = '0169_hidden_templates_nullable'
def upgrade():
op.execute('UPDATE templates SET hidden=false WHERE hidden ... | alphagov/notifications-api | migrations/versions/0170_hidden_non_nullable.py | Python | mit | 681 |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace the code in this block
### end... | GeosoftInc/gxpy | geosoft/gxapi/GXST.py | Python | bsd-2-clause | 13,194 |
# -*- coding: utf-8 -*-
class SettingsBuilder(object):
def __init__(self, settings=None, mappings=None):
self.settings = settings or {'index.number_of_replicas': 1,
"index.number_of_shards": 5}
self.mappings = mappings or {}
def add_mapping(self, data, name... | artefactual/archivematica-history | src/archivematicaCommon/lib/externals/pyes/helpers.py | Python | agpl-3.0 | 785 |
# Django
from django.db import models
# Django Local
from exam.models import CustomExam
from prescription.models import Prescription
class PrescriptionCustomExam(models.Model):
"""
Model to associate prescription to Custom Exam many to many cardinality.
"""
prescription = models.ForeignKey(Prescripti... | fga-gpp-mds/2017.2-Receituario-Medico | medical_prescription/prescription/models/prescriptioncustomexam.py | Python | mit | 365 |
"""Python interface to GenoLogics LIMS via its REST API.
Entities and their descriptors for the LIMS interface.
Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
Copyright (C) 2012 Per Kraulis
"""
import re
from xml.etree import ElementTree
_NSMAP = dict(
art='http://genologics.com/ri/artifact',
... | BigelowLab/genologics | genologics/constants.py | Python | mit | 2,138 |
# coding=utf-8
import time
import math
import multiprocessing
import os
import random
import sys
import signal
try:
from setproctitle import getproctitle, setproctitle
except ImportError:
setproctitle = None
from diamond.utils.signals import signal_to_exception
from diamond.utils.signals import SIGALRMExcept... | jriguera/Diamond | src/diamond/utils/scheduler.py | Python | mit | 3,514 |
"""
Conversion from ctypes to dtype.
In an ideal world, we could acheive this through the PEP3118 buffer protocol,
something like::
def dtype_from_ctypes_type(t):
# needed to ensure that the shape of `t` is within memoryview.format
class DummyStruct(ctypes.Structure):
_fields_ = [('a',... | ryfeus/lambda-packs | pytorch/source/numpy/core/_dtype_ctypes.py | Python | mit | 3,448 |
"""pymoku example: Basic IIR Filter Box
This example demonstrates how you can configure the IIR Filter instrument,
configure real-time monitoring of the input and output signals.
(c) 2019 Liquid Instruments Pty. Ltd.
"""
from pymoku import Moku
from pymoku.instruments import IIRFilterBox
# This script provides a bas... | liquidinstruments/pymoku | examples/iirfilterbox_basic.py | Python | mit | 2,272 |
import threading, socket, json
# Size of the buffer for receiving TCP messages (in bytes)
BUFFER_SIZE = 1024
# Don't worry too much about SOCKET_QUEUE_SIZE
SOCKET_QUEUE_SIZE = 20
class Worker:
def __init__(self, client1_port, client2_port):
self.client2_port = client2_port
# Create TCP socket
s = sock... | WesCoomber/591ProjectWcoomber | test_client.py | Python | mit | 1,249 |
# coding: utf-8
from __future__ import unicode_literals
from .theplatform import ThePlatformIE
from ..utils import int_or_none
class CNETIE(ThePlatformIE):
_VALID_URL = r'https?://(?:www\.)?cnet\.com/videos/(?P<id>[^/]+)/'
_TESTS = [{
'url': 'http://www.cnet.com/videos/hands-on-with-microsofts-window... | akirk/youtube-dl | youtube_dl/extractor/cnet.py | Python | unlicense | 3,591 |
from database import Database
if __name__ == '__main__':
database = Database("../databases/...")
database.load()
database.delete_all_inscriptions()
| studio1247/gertrude | tools/clean.py | Python | gpl-3.0 | 162 |
"""Solon Voting configuration file"""
conf = {}
# These parameters are used to connect to the PostgreSQL db used by the "dummy" backend
conf['dummydb.host'] = '127.0.0.1'
conf['dummydb.password'] = 'password'
# These are currently ignored by the code so changing them here won't help.
conf['dummydb.user'] ... | henrikingo/solon-voting | config.py | Python | gpl-3.0 | 787 |
import os
from sfa.util.xml import XML
class SimpleStorage(dict):
"""
Handles storing and loading python dictionaries. The storage file created
is a string representation of the native python dictionary.
"""
db_filename = None
type = 'dict'
def __init__(self, db_filename, db = None):
... | onelab-eu/sfa | sfa/util/storage.py | Python | mit | 2,108 |
"""Listens to Treadmill server events.
There is single event manager process per server node.
Each server subscribes to the content of /servers/<servername> Zookeeper node.
The content contains the list of all apps currently scheduled to run on the
server.
Applications that are scheduled to run on the server are mi... | Morgan-Stanley/treadmill | lib/python/treadmill/eventmgr.py | Python | apache-2.0 | 8,107 |
import numpy as np
import theano
import theano.tensor as T
import lasagne
from neuralnet import train
from custom_updates import *
from SVRGOptimizer import SVRGOptimizer
from StreamingSVRGOptimizer import StreamingSVRGOptimizer
from operator import itemgetter
MLPBN= False
def classifier_network(input_var, n_inpu... | myt00seven/svrg | bk/svrg_no_BN/neuralclassifier.py | Python | mit | 4,682 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from autoslug import AutoSlugField
from events.models import Event
class AccessControl(models.Model):
event = models.ForeignKey(Event, related_name='access', verbose_name=_(
'event'), o... | wadobo/congressus | congressus/access/models.py | Python | agpl-3.0 | 1,801 |
#
# -*- coding: utf-8 -*-
# Copyright 2019 Cisco and/or its affiliates.
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# Telemetry Command Reference File
from __future__ import absolute_import, division, print_function
__metaclass__ = type
TMS_GLOBAL = '''
# The cmd_r... | thaim/ansible | lib/ansible/module_utils/network/nxos/cmdref/telemetry/telemetry.py | Python | mit | 4,234 |
"""
MagPy
IAGA02 input filter
Written by Roman Leonhardt June 2012
- contains test, read and write function
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from io import open
from magpy.stream import *
#global va... | hschovanec-usgs/magpy | magpy/lib/format_iaga02.py | Python | gpl-3.0 | 20,820 |
# Copyright (c) 2014 Hoang Do, Phuc Vo, P. Michiardi, D. Venzano
#
# 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 appli... | shakamunyi/sahara | sahara/plugins/spark/plugin.py | Python | apache-2.0 | 23,247 |
import numpy as np
import pandas as pd
ops = ['mean', 'sum', 'median', 'std', 'skew', 'kurt', 'mad', 'prod', 'sem',
'var']
class FrameOps(object):
params = [ops, ['float', 'int'], [0, 1], [True, False]]
param_names = ['op', 'dtype', 'axis', 'use_bottleneck']
def setup(self, op, dtype, axis, use... | harisbal/pandas | asv_bench/benchmarks/stat_ops.py | Python | bsd-3-clause | 3,231 |
"""Uber call functions.
These are light weight call functions that basically just wrap call classes
under ubersmith.calls. If a call function doesn't exist it will be generated
by generate_generic_calls which searches for a call class and if one isn't
found one is created using ubersmith.calls.BaseCall.
"""
from ub... | hivelocity/python-ubersmith | ubersmith/uber.py | Python | mit | 439 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.