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 |
|---|---|---|---|---|---|
from StringIO import StringIO
import urllib2
import logging
import csv_parser
import metadata
import json_generator
import metadata_extractor
__author__ = 'sebastian'
logging.basicConfig()
logger = logging.getLogger(__name__)
class CSVW:
def __init__(self, url=None, path=None, handle=None, metadata_url=None, ... | sebneu/csvw-parser | pycsvw/main.py | Python | mit | 2,001 |
# P2P vendor specific extension tests
# Copyright (c) 2014, Qualcomm Atheros, Inc.
import logging
logger = logging.getLogger()
def test_p2p_ext_discovery(dev):
"""P2P device discovery with vendor specific extensions"""
addr0 = dev[0].p2p_dev_addr()
addr1 = dev[1].p2p_dev_addr()
try:
if "OK" n... | aelarabawy/hostap | tests/hwsim/test_p2p_ext.py | Python | gpl-2.0 | 4,299 |
import logging
import os
import tornado.web
import tornado.wsgi
from tornado.web import url
from google.appengine.ext import db
from google.appengine.ext.webapp.util import run_wsgi_app
import forms
import models
# Constants
IS_DEV = os.environ['SERVER_SOFTWARE'].startswith('Dev') # Development server
class Appli... | haldun/gae-tornado-template | app.py | Python | mit | 1,085 |
'''
modifier: 02
eqtime: 30
'''
def main():
info("Air Pipette x1-4 bone only")
gosub('felix:WaitForMiniboneAccess')
gosub('felix:PrepareForAirShot')
open(name='N')
open(name='Q')
open(name='D')
open(name='B')
gosub('common:EvacPipette2')
gosub('common:FillPipette2')
go... | USGSDenverPychron/pychron | docs/user_guide/operation/scripts/examples/helix/extraction/felix_air_x1_boneonly.py | Python | apache-2.0 | 564 |
# -*- coding: utf-8 -*-
import logging
from functools import wraps
from urllib.parse import urljoin, urlencode
import requests
from tvdbrest import VERSION
from tvdbrest.objects import *
import datetime
import time
logger = logging.getLogger(__name__)
class Unauthorized(Exception):
pass
class NotFound(Except... | ercpe/tvdb-rest | tvdbrest/client.py | Python | gpl-3.0 | 6,771 |
import unittest
from mudlib.character import *
class CharacterTestCase(unittest.TestCase):
def setup(self):
pass
def teardown(self):
pass
class ParserTestCase(unittest.TestCase):
def setup(self):
pass
def teardown(self):
pass
def test_parser_look(self):
... | jon-stewart/mud | mudlib/test_character.py | Python | mit | 1,212 |
"""First 100 days of the US House of Representatives 1995"""
__docformat__ = 'restructuredtext'
COPYRIGHT = """Used with express permission from the original author,
who retains all rights."""
TITLE = __doc__
SOURCE = """
Jeff Gill's `Generalized Linear Models: A Unifited Approach`
http://jgill.wustl.ed... | wesm/statsmodels | scikits/statsmodels/datasets/committee/data.py | Python | bsd-3-clause | 2,533 |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 13 19:59:46 2014
@author: pedro
"""
import os
from libphys import *
dname = '/home/pedro/LAB/DATA/2014/Aug/PF/14_08_14/pf03/'
files = []
for file in os.listdir(dname):
if file.endswith(".bmp"):
files = np.append(files,file)
files.sort()
print 'Found %d files... | atreyv/atom-phys | change_filenames_template.py | Python | gpl-3.0 | 739 |
#
# 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... | h2oai/sparkling-water | py-scoring/src/ai/h2o/sparkling/ml/models/__init__.py | Python | apache-2.0 | 2,803 |
import os, sys
from django.template import Template, Context
from django.conf import settings
from django.utils.crypto import get_random_string
MY_PATH = os.path.abspath(os.path.dirname(__file__))
def main():
target_path = os.path.abspath(os.path.join(MY_PATH, '..', 'trackersite', 'settings.py'))
if os.path.e... | urbanecm/teh-tracker | support/makesettings.py | Python | gpl-2.0 | 1,037 |
'''
Created on Oct 29, 2017
@author: bkehoe
'''
from __future__ import absolute_import
import uuid
import itertools
import json
from . import components, states
def is_heaviside_execution(context):
return Executor.CONTEXT_EXECUTION_ID_KEY in context
class Executor(object):
@classmethod
def create(cls,... | benkehoe/heaviside | src/heaviside/executor.py | Python | apache-2.0 | 6,552 |
import unittest
from test import test_support
import subprocess
import sys
import signal
import os
import errno
import tempfile
import time
import re
import sysconfig
try:
import resource
except ImportError:
resource = None
try:
import threading
except ImportError:
threading = None
mswindows = (sys.pl... | sometallgit/AutoUploader | Python27/Lib/test/test_subprocess.py | Python | mit | 59,584 |
# coding=utf-8
"""
DCRM - Darwin Cydia Repository Manager
Copyright (C) 2017 WU Zheng <i.82@me.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at yo... | 82Flex/DCRM | WEIPDCRM/templatetags/package_title_style.py | Python | agpl-3.0 | 1,157 |
from __future__ import annotations
from ..core.bitmap import bitmap
from ..core.index_update import IndexUpdate
from ..table.dshape import DataShape, dshape_from_dict
import numpy as np
from typing import Any, List, Optional, Dict, Tuple, TYPE_CHECKING
if TYPE_CHECKING:
from progressivis.core.changemanager_dict... | jdfekete/progressivis | progressivis/utils/psdict.py | Python | bsd-2-clause | 5,156 |
from ._llops import dense_forward
from brainforge.util.typing import zX
class DenseOp:
@staticmethod
def forward(X, W, b=None):
if b is None:
b = zX(W.shape[-1])
return dense_forward(X, W, b)
@staticmethod
def backward(X, E, W):
raise NotImplementedError("No backw... | csxeba/brainforge | brainforge/llatomic/llcore_op.py | Python | gpl-3.0 | 340 |
from __future__ import division
import numpy as np
from numpy.testing import assert_almost_equal
import pytest
from acoustics.power import lw_iso3746
@pytest.mark.parametrize("background_noise, expected", [
(79, 91.153934187),
(83, 90.187405234),
(88, 88.153934187),
])
def test_lw_iso3746(background_no... | FRidh/python-acoustics | tests/test_power.py | Python | bsd-3-clause | 637 |
from info import __doc__
from arpack import *
| lesserwhirls/scipy-cwt | scipy/sparse/linalg/eigen/arpack/__init__.py | Python | bsd-3-clause | 46 |
<<<<<<< HEAD
<<<<<<< HEAD
"""Unit tests for the copy module."""
import copy
import copyreg
import weakref
import abc
from operator import le, lt, ge, gt, eq, ne
import unittest
from test import support
order_comparisons = le, lt, ge, gt
equality_comparisons = eq, ne
comparisons = order_comparisons + equality_compari... | ArcherSys/ArcherSys | Lib/test/test_copy.py | Python | mit | 67,430 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.words.protocols.jabber.xmlstream}.
"""
from twisted.trial import unittest
from zope.interface.verify import verifyObject
from twisted.internet import defer, task
from twisted.internet.error import ConnectionL... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/Twisted/twisted/words/test/test_jabberxmlstream.py | Python | bsd-3-clause | 44,418 |
import pytest
from thespian.system.timing import ExpirationTimer, currentTime
from datetime import datetime, timedelta
from time import sleep
class TestUnitExpirationTimer(object):
def testNoneExpired(self):
et = ExpirationTimer(None)
assert not et.view().expired()
def testZeroExpired(self):... | kquick/Thespian | thespian/system/test/test_expirytime.py | Python | mit | 9,211 |
#!/usr/bin/env python
import hashlib
import os
import wx
class NotBookMainFrame(wx.Frame):
def __init__(self,parent,title):
wx.Frame.__init__(self,parent,title=title)
self.tb = self.CreateToolBar()
self.control = wx.TextCtrl(self,style=wx.TE_MULTILINE|wx.TE_LINEWRAP,size=(300... | cirline/ct | python/notepad.py | Python | gpl-3.0 | 7,029 |
import copy
import skin
from enigma import eListboxPythonMultiContent, gFont, getPrevAsciiCode, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_HALIGN_RIGHT, RT_VALIGN_TOP, RT_VALIGN_CENTER, RT_VALIGN_BOTTOM, BT_SCALE
from Components.ActionMap import HelpableNumberActionMap
from Components.Input import Input
from Components.Lab... | IanSav/enigma2 | lib/python/Screens/VirtualKeyBoard.py | Python | gpl-2.0 | 61,006 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'AsyncTask'
db.create_table('async_task', (
('id', self.gf('django.db.models.fiel... | EduPepperPDTesting/pepper2013-testing | common/djangoapps/async_task/migrations/0001_initial.py | Python | agpl-3.0 | 5,286 |
from datetime import datetime
from django.forms.widgets import (DateInput, DateTimeInput, Select,
SelectMultiple, TimeInput)
from django.utils.safestring import mark_safe
class StyledSelect(Select):
def render(self, name, value, attrs=None, renderer=None):
try:
... | dgbc/django-arctic | arctic/widgets.py | Python | mit | 2,774 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipIf
from django.core.exceptions import ValidationError
from django.db import connection, models
from django.test import SimpleTestCase, TestCase
from django.utils.functional import lazy
from .models import Post
class TestCharFi... | nemesisdesign/django | tests/model_fields/test_charfield.py | Python | bsd-3-clause | 2,630 |
# -*- 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):
def forwards(self, orm):
# Deleting field 'Audio.encoding'
db.delete_column(u'multimedia_audio', '... | teury/django-multimedia | multimedia/south_migrations/0020_auto__del_field_audio_encoding__del_field_audio_encoded__del_field_vid.py | Python | bsd-3-clause | 7,755 |
"""
Saucebrush data sources, convert data in some format into python dicts.
All sources must implement the iterable interface and return python
dictionaries.
"""
from __future__ import unicode_literals
import string
from saucebrush import utils
class CSVSource(object):
""" Saucebrush source for readi... | sunlightlabs/saucebrush | saucebrush/sources.py | Python | bsd-3-clause | 10,715 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of MoaT, the Master of all Things.
##
## MoaT is Copyright © 2007-2016 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See the file `README.rst` for details... | smurfix/MoaT | irrigation/rainman/logging.py | Python | gpl-3.0 | 1,920 |
import datetime
import re
from typing import Any, Dict, List, Mapping, Union
from unittest import mock
import orjson
from django.conf import settings
from django.utils.timezone import now as timezone_now
from confirmation.models import Confirmation, create_confirmation_link
from zerver.lib.actions import (
do_add... | hackerkid/zulip | zerver/tests/test_realm.py | Python | apache-2.0 | 42,353 |
#!/usr/bin/env python
import os
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from math import (
log,
exp
)
from matplotlib import pyplot as plt
import time
import util
import math
import ipdb
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.font... | birlrobotics/HMM | hmm_for_baxter_using_only_success_trials/emission_log_prob_plot.py | Python | bsd-3-clause | 5,609 |
#!/usr/bin/env python
'''
Fit weighted average of multiple predictions
'''
import sys, argparse
from common import *
from scipy.optimize import minimize
def fit_weights(Y, labels):
w0 = np.ones(Y.shape[1]) / Y.shape[1]
cons = ({'type': 'eq', 'fun': lambda x: x.sum()-1})
b = [(0,1) for i in xrange(Y.shape... | timpalpant/KaggleTSTextClassification | scripts/average.py | Python | gpl-3.0 | 2,440 |
#!/usr/bin/env python3
from . import cab
def dump_cabfolder(folder, outfile):
while True:
data = folder.pseudofile.read(4096)
if data == b"":
break
outfile.write(data)
def print_cabfile(cabfile):
print("\x1b[1mHeader\x1b[m")
print(cabfile.header)
for number, folder... | LukasEgger3/Lukas | py/openage/convert/cabextract/__main__.py | Python | gpl-3.0 | 1,073 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('deals', '0002_advertiser_logo'),
]
operations = [
migrations.RemoveField(
model_name='advertiser',
n... | andela/troupon | troupon/deals/migrations/0003_remove_advertiser_logo.py | Python | mit | 349 |
#!/usr/bin/env python
# encoding: utf-8
"""
game.py
Created by Scott on 2013-12-28.
Copyright (c) 2013 Scott Rice. All rights reserved.
"""
import sys
import os
import shutil
class Game(object):
@staticmethod
def valid_custom_image_extensions():
return ['.png', '.jpg', '.jpeg', '.tga']
def __in... | rwesterlund/pysteam | pysteam/game.py | Python | mit | 1,546 |
from qmeq.indexing import *
def test_binarylist_to_integer():
assert binarylist_to_integer([1, 0, 1, 1, 0, 0]) == 44
def test_integer_to_binarylist():
assert integer_to_binarylist(33) == [1, 0, 0, 0, 0, 1]
assert integer_to_binarylist(33, strq=True) == '100001'
assert integer_to_binarylist(33, binle... | gedaskir/qmeq | qmeq/tests/test_indexing.py | Python | bsd-2-clause | 27,609 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/agrifood/azure-agrifood-farming/azure/agrifood/farming/operations/_harvest_data_operations.py | Python | mit | 43,380 |
class brokerClient(object):
"""
Broker server classes are called by the brokers server application (eg IB Gateway)
We inherit from this for specific brokers and over ride the methods in the base class to ensure a consistent API
"""
def __init__(self):
pass
def speakingClock(self):
... | cmorgan/pysystemtrade | sysbrokers/baseClient.py | Python | gpl-3.0 | 392 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: A Chart Parser
#
# Copyright (C) 2001-2010 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@csse.unimelb.edu.au>
# Jean Mark Gawron <gawron@mail.sdsu.edu>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# ... | markgw/jazzparser | lib/nltk/parse/chart.py | Python | gpl-3.0 | 65,856 |
#!/usr/bin/python
#
# GemUO
#
# (c) 2005-2010 Max Kellermann <max@duempel.org>
#
# 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.
#
# This program is distribut... | fungos/gemuo | src/entities.py | Python | gpl-2.0 | 1,058 |
# -*- coding: utf-8 -*-
##############################################################################
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# OeMedical, HMS Opensource Solution
####################################################... | eneldoserrata/marcos_openerp | oemedical/oemedical_gynecology_and_obstetrics/__openerp__.py | Python | agpl-3.0 | 2,889 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
import os, sys
from opus_core.tests import opus_unittest
from opus_core.opus_package import OpusPackage
class TestTutorialCode(opus_unittest.OpusTestCase):
"""Fails if tutorial_code.... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_docs/tests/test_tutorial_code.py | Python | gpl-2.0 | 709 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 30, transform = "Fisher", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Fisher/trend_MovingMedian/cycle_30/ar_/test_artificial_1024_Fisher_MovingMedian_30__100.py | Python | bsd-3-clause | 267 |
__all__ = ["root"]
import os
import numpy as np
import scipy.optimize as opt
from ._memoize import memoize
from ._calc_energies import *
from ._determinants import *
from ._singular_points import *
@memoize(500)
def root(L, mpi, a0, r0, a2, r2, d=np.array([0., 0., 0.]), irrep="A1", n=1):
"""Returns roots of the ... | chjost/analysis-code | analysis/findroot.py | Python | gpl-3.0 | 3,814 |
"""
Copyright 2016, 2017 UFPE - Universidade Federal de Pernambuco
Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS
O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela ... | amadeusproject/amadeuslms | news/admin.py | Python | gpl-2.0 | 1,126 |
from __future__ import (
absolute_import, print_function, division, unicode_literals
)
import inspect
import json as json_module
import re
import six
from collections import namedtuple, Sequence, Sized
from functools import update_wrapper
from cookies import Cookies
from requests.utils import cookiejar_from_dict
... | heddle317/moto | moto/packages/responses/responses.py | Python | apache-2.0 | 9,675 |
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import User
from django.template import RequestContext
from fclover.account.forms import S... | weaponsjtu/love-stranger | fcloverV0/account/views.py | Python | apache-2.0 | 1,367 |
# Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import odoo.tests
from odoo.api import Environment
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
... | yelizariev/addons-yelizariev | project_task_subtask/tests/test_subtask_sort_button.py | Python | lgpl-3.0 | 1,815 |
"""
The :mod:`sklearn.model_selection._search` includes utilities to fine-tune the
parameters of an estimator.
"""
from __future__ import print_function
from __future__ import division
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Andreas... | altairpearl/scikit-learn | sklearn/model_selection/_search.py | Python | bsd-3-clause | 44,970 |
#!/usr/bin/python
# Check dashboard JSON files for common errors, like forgetting to templatize a
# datasource.
import json
import os
with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
"boulderdash.json")) as f:
dashboard = json.load(f)
# When exporting, the current value of templated variable... | ibukanov/boulder | test/grafana/lint.py | Python | mpl-2.0 | 1,176 |
from tdlearner import TDLearner
from collections import defaultdict
import numpy as np
# finds Euclidean norm distance between two lists a, b
def find_dist(a,b):
cumsum = 0.0
for i in xrange(len(a)):
cumsum += (a[i]-b[i])**2
return np.sqrt(cumsum/float(len(a)))
class ModelBased(TDLearner):
''... | kandluis/machine-learning | prac4/practical4-code/modelbased.py | Python | mit | 3,542 |
# Licensed to Hortonworks, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Hortonworks, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this f... | hortonworks/hortonworks-sandbox | tutorials/tutorials_app/__init__.py | Python | apache-2.0 | 774 |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
version = __import__('philo').VERSION
setup(
name = 'philo',
version = '.'.join([str(v) for v in version]),
url = "http://philocms.org/",
description = "A foundation for developing web content management systems.",
long_description = o... | ithinksw/philo | setup.py | Python | isc | 1,421 |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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 applicab... | TribeMedia/synapse | tests/handlers/test_directory.py | Python | apache-2.0 | 3,440 |
json_filepath="/var/tmp/applconn/static/applconn.json"
pathprefix='/var/tmp/applconn/static'
rsyncgitpath='/var/tmp/rsyncgit/'
##
list_import_def=[
#"import_ansible_facts",
#"import_haproxy",
#"import_tungsten_fabric_network_policy",
#"import_tungsten_fabric_prouterlinkentry",
"import_testlogic"
]... | tnaganawa/applconn | settings.py | Python | apache-2.0 | 693 |
# Copyright 2014 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.
from __future__ import division
from telemetry.core import util
from telemetry.image_processing import histogram
from telemetry.image_processing import rgba... | mohamed--abdel-maksoud/chromium.src | tools/telemetry/telemetry/image_processing/image_util_numpy_impl.py | Python | bsd-3-clause | 6,616 |
import sys
import pytest
from numpy.testing import assert_equal
import torch
import torch.nn as nn
sys.path.append("../../../")
from pycroscopy.learn import nnblocks
@pytest.mark.parametrize("nlayers, bnorm, nbnorm",
[(1, True, 1), (1, False, 0),
(3, True, 3), (3, ... | pycroscopy/pycroscopy | tests/learn/dl/test_nnblocks.py | Python | mit | 3,166 |
"""Reads the Reuters dataset for Multi-label Classification
Important: Train and test sets are _switched_, since the original split leaves
the sides unbalanced.
"""
import os
import tarfile
import anna.data.utils as utils
from anna.data.api import Doc
from collections import Counter
from bs4 import BeautifulSoup
NAM... | jpbottaro/anna | anna/data/dataset/reuters.py | Python | mit | 4,617 |
"""SCons.Tool.tar
Tool-specific initialization for tar.
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, 2009, 2010, 2011, 2012, 2013, 2014 Th... | FireWRT/OpenWrt-Firefly-Libraries | staging_dir/host/lib/scons-2.3.1/SCons/Tool/tar.py | Python | gpl-2.0 | 2,544 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 25 22:34:05 2020
@author: mostafamousavi
"""
from EQTransformer.utils.downloader import downloadMseeds, makeStationList, downloadSacs
import pytest
import glob
import os
def test_downloader():
makeStationList(client_list=["SCEDC"],
... | smousavi05/EQTransformer | tests/test_downloader.py | Python | mit | 1,620 |
import csv
import os
import re
import tempfile
import urllib2
from lib.boolops import xor
# Set maximum field size to 20MB
csv.field_size_limit(20000000)
class defaultcsv(csv.Dialect):
def __init__(self):
self.delimiter = ','
self.doublequote = True
self.quotechar = '"'
self.quoti... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/lib/inoutparsing.py | Python | mit | 3,972 |
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/lo/cholesky.py | Python | apache-2.0 | 3,209 |
from flask import Flask, Response, abort, render_template
import config
import traceback
import sys
import shutil
import helpers
import os
import datetime
app = Flask(__name__)
@app.route("/")
def home():
message = '{0}\n'.format(config.domain)
message += 'a bytestring safe terminal pastebin clone\n'
mess... | hmngwy/pipebin | http_server.py | Python | gpl-2.0 | 3,640 |
from settings import *
import logging
BAD_LOGGER_NAMES = ['south', 'factory.containers', 'factory.generate']
bad_loggers = []
for bln in BAD_LOGGER_NAMES:
logger = logging.getLogger(bln)
logger.setLevel(logging.INFO)
bad_loggers.append(bln)
# Nose Test Runner
INSTALLED_APPS += ('django_nose',)
NOSE_ARGS ... | VikParuchuri/movide | movide/test.py | Python | agpl-3.0 | 507 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
script.module.metadatautils
extrafanart.py
Get extrafanart location for kodi media
'''
import os
import xbmcvfs
def get_extrafanart(file_path):
'''get extrafanart path on disk based on media path'''
result = {}
efa_path = ""
if "plugin.video.... | mrquim/mrquimrepo | script.module.metadatautils/lib/helpers/extrafanart.py | Python | gpl-2.0 | 1,209 |
"""Version of the SFS Toolbox.
This is the only place where the version number is stored.
During installation, this file is read by ../setup.py and when importing
the 'sfs' module, this module is imported by __init__.py.
Whenever the version is incremented, a Git tag with the same name should
be created.
"""
__vers... | AchimTuran/sfs-python | sfs/_version.py | Python | mit | 336 |
"""Wrapper around the jQuery UI library
Exposes a single object, jq, to manipulate the widgets designed in the library
This object supports :
- subscription : js[elt_id] returns an object matching the element with the
specified id
- a method get(**kw). The only keyword currently supported is "selector". The
metho... | code4futuredotorg/reeborg_tw | src/libraries/brython/Lib/jqueryui/__init__.py | Python | agpl-3.0 | 3,680 |
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge... | EmanueleCannizzaro/scons | src/engine/SCons/Tool/mssdk.py | Python | mit | 1,834 |
# -*- coding: utf-8 -*-
"""
sphinx.util.inspect
~~~~~~~~~~~~~~~~~~~
Helpers for inspecting Python modules.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from six import PY3, binary_type
from six.moves import builtins
from ... | axbaretto/beam | sdks/python/.tox/docs/lib/python2.7/site-packages/sphinx/util/inspect.py | Python | apache-2.0 | 5,997 |
from terane.settings import *
class TestSettings(object):
def test_settings_option(self):
settings = Settings("usage", "description", section="test", appname="test", confbase="./")
settings.addOption("o", "option", "test option")
ns = settings.parse(argv=['test', '-o', 'foo'])
asse... | msfrank/terane-toolbox | tests/test_settings.py | Python | gpl-3.0 | 3,553 |
import pylab as pyl
from astLib import astStats
from sklearn.metrics import median_absolute_error, mean_squared_error
import h5py as hdf
from matplotlib.ticker import AutoMinorLocator
def calc_err(pred, true):
return (pred - true) / true
golden_mean = (pyl.sqrt(5.) - 1.0) / 2.0
f = pyl.figure(figsize=(10, 10 * ... | boada/vpCluster | data/boada/analysis_all/MLmethods/plot_massComparison_ML.py | Python | mit | 8,088 |
"""
byceps.services.shop.order.actions.create_ticket_bundles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from .....typing import UserID
from ....ticketing.dbmodels.ticket_bundle import TicketBundle
from... | homeworkprod/byceps | byceps/services/shop/order/actions/create_ticket_bundles.py | Python | bsd-3-clause | 2,185 |
import os
from django.apps import AppConfig
def samevalues(names):
records = []
for name in names:
if type(name) == str:
records.append({key: name for key in ['label', 'model', 'title']})
return records
pages = [
{'label': 'port', 'view': 'port_view', 'title': 'Port'},
{'labe... | tulsluper/sanscript | apps/bc/apps.py | Python | gpl-3.0 | 1,152 |
# -*- encoding: utf-8 -*-
import copy
import inspect
from abjad.tools import indicatortools
from abjad.tools import markuptools
from abjad.tools import pitchtools
from abjad.tools import stringtools
from abjad.tools.abctools.AbjadObject import AbjadObject
class Instrument(AbjadObject):
'''A musical instrument.
... | mscuthbert/abjad | abjad/tools/instrumenttools/Instrument.py | Python | gpl-3.0 | 14,020 |
"""STAFF_ADMIN role stands alone - remove STAFF role from current STAFF_ADMINs
Revision ID: ed4283df2db5
Revises: 30f20e54eb5c
Create Date: 2020-08-31 11:12:30.249107
"""
from alembic import op
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import text
from portal.models.role import ROLE, Role
from port... | uwcirg/true_nth_usa_portal | portal/migrations/versions/ed4283df2db5_.py | Python | bsd-3-clause | 1,805 |
import sys,time,requests,json
from netaddr import *
#NetBox API Token
headers = {'Authorization': 'Token YOUR_API_TOKEN'}
def ipv4_stage():
#NetBox API call to retreive test prefix 169.254.0.0/20 list.
stage_supernet = '169.254.0.0/20'
stage_set = set()
api_link = 'https://netbox-url.net/api/ipam/prefixe... | rkutsel/netbox-scripts | aws-direct-connect/api.py | Python | mit | 1,666 |
import mock
import unittest
from ice import steam_shortcut_synchronizer
from ice.rom import ICE_FLAG_TAG
from pysteam.shortcut import Shortcut
class SteamShortcutSynchronizerTests(unittest.TestCase):
def setUp(self):
self.mock_user = mock.MagicMock()
self.mock_archive = mock.MagicMock()
self.mock_log... | rdoyle1978/Ice | src/ice/tests/steam_shortcut_synchronizer_tests.py | Python | mit | 9,315 |
import logging
import numpy as np
import numpy.ma as ma
import pandas as pd
from bson import Binary, SON
from .._compression import compress, decompress, compress_array
from ._serializer import Serializer
DATA = 'd'
MASK = 'm'
TYPE = 't'
DTYPE = 'dt'
COLUMNS = 'c'
INDEX = 'i'
METADATA = 'md'
LENGTHS = 'ln'
class ... | Frankkkkk/arctic | arctic/serialization/numpy_arrays.py | Python | lgpl-2.1 | 6,258 |
from django.apps import AppConfig
class DjangoMultiimapConfig(AppConfig):
name = 'django_multiimap'
| OpenInfoporto/django_multiimap | django_multiimap/apps.py | Python | gpl-2.0 | 106 |
"""
Gregory Way 2016
NF1 Inactivation Classifier for Glioblastoma
scripts/process_rnaseq.py
Cleans up the downloaded RNAseq data and zero-one normalizes
Usage:
Run only once by run_pipeline.sh
Output:
Normalized PCL file with genes as rows and sample IDs as columns and MAD genes
if option is selected
"""
import os
... | gwaygenomics/nf1_inactivation | scripts/process_rnaseq.py | Python | bsd-3-clause | 4,077 |
import unittest
from bolt.core.plugin import Plugin
from bolt import interval
from bolt import Bot
import yaml
class TestIntervalPlugin(Plugin):
@interval(60)
def intervaltest(self):
pass
class TestInterval(unittest.TestCase):
def setUp(self):
self.config_file = "/tmp/bolt-test-config.y... | Arcbot-Org/Arcbot | tests/core/test_interval.py | Python | gpl-3.0 | 910 |
#!/usr/bin/env python
def coreference_cluster_match(gold, auto):
if len(gold) != len(auto):
return False
for gcluster in gold:
matched = False
for acluster in auto:
if acluster == gcluster:
matched = True
break
if not matched:
return False
return True
def calc_prf(match, gold, test):
'''Calc... | jkkummerfeld/1ec-graph-parser | evaluation/nlp_util/nlp_eval.py | Python | isc | 1,048 |
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import copy
from logging import getLogger
import chainer
fr... | toslunar/chainerrl | chainerrl/agents/dqn.py | Python | mit | 22,430 |
import os
import numpy as np
import librosa
import collections
def getNewTime(t):
"""
Given a time in second, convert into time in min'sec" in string format
"""
tmin = int(t/60)
tsec = (t-int(t/60)*60) # * 100
return str(tmin) + "\'" + str(int(tsec))
def printSegInfo(segs,all_idx,timeLabel)... | kittyshi/medley | medleycode/medley_helper.py | Python | gpl-3.0 | 2,998 |
"""Gaussian Mixture Model."""
# Author: Wei Xue <xuewei4d@gmail.com>
# Modified by Thierry Guillemot <thierry.guillemot.work@gmail.com>
# License: BSD 3 clause
import numpy as np
from scipy import linalg
from .base import BaseMixture, _check_shape
from ..externals.six.moves import zip
from ..utils import check_arra... | aabadie/scikit-learn | sklearn/mixture/gaussian_mixture.py | Python | bsd-3-clause | 27,463 |
# this script implements the Java interface IOSProvider
from osapi import DebugSessionException, ExecutionContext, ExecutionContextsProvider, \
Table, createField, DECIMAL, TEXT, ADDRESS, Model
def areOSSymbolsLoaded(debugger):
return debugger.symbolExists('context_switch_counter')
def isOSIniti... | kishoredbn/barrelfish | tools/ds5/configdb/OS/Barrelfish/provider.py | Python | mit | 5,161 |
#!/usr/bin/python3
import json
import numpy as np
import random
class Payload():
'''
Instance contains altitude data for a balloon flight. Use alt() method
to get interpolated data.
'''
addr = None
name = "Payload"
time_index = 0.0 # index into the flight profile data, in seconds.
tim... | liberza/bacon | simulator/payload.py | Python | mit | 4,318 |
# coding:utf-8
from __future__ import unicode_literals
import os
import shutil
from six.moves import http_client, urllib
from cactus.site import Site
from cactus.plugin.manager import PluginManager
from cactus.utils.helpers import CaseInsensitiveDict
from cactus.utils.parallel import PARALLEL_DISABLED
from cactus.te... | dreadatour/Cactus | cactus/tests/integration/__init__.py | Python | bsd-3-clause | 4,636 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import getpass
pwd = getpass.getpass("请输入密码:")
#列表增删改查 | zhangyage/Python-oldboy | my_study/mm/getpass_mima.py | Python | apache-2.0 | 125 |
import random
# Binary search tree. Not balanced.
class Node(object):
def __init__(self, value, left=None, right=None):
self.v = value
self.l = left
self.r = right
def min(self):
if self.l:
return self.l.min()
else:
return self.v
def max(se... | jlucangelio/cs-basics | data_structures/binary_search_tree.py | Python | bsd-3-clause | 2,059 |
#
# Copyright 2014 Quantopian, 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 wr... | euri10/zipline | zipline/finance/trading.py | Python | apache-2.0 | 19,394 |
# Copyright 2015 Cisco Systems, Inc.
# 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 requi... | smartbgp/yarib | yarib/db/mongodb.py | Python | apache-2.0 | 4,903 |
__author__ = 'robert'
from pypet import Environment, Trajectory
from pypet.tests.testutils.ioutils import make_temp_dir, get_log_config
import os
import matplotlib.pyplot as plt
import numpy as np
import time
def job(traj):
traj.f_ares('$set.$', 42, comment='A result')
def get_runtime(length):
filename =... | nigroup/pypet | pypet/tests/profiling/speed_analysis/avg_runtima_as_function_of_length.py | Python | bsd-3-clause | 2,266 |
import urllib,urllib2,re,string,sys,os
import xbmc, xbmcgui, xbmcaddon, xbmcplugin
from resources.libs import main
#Mash Up - by Mash2k3 2012.
addon_id = 'plugin.video.movie25'
selfAddon = xbmcaddon.Addon(id=addon_id)
art = main.art
prettyName = 'iWatchOnline'
def AtoZiWATCHtv():
main.addDir('0-9','http://www.iw... | marduk191/plugin.video.movie25 | resources/libs/plugins/iwatchonline.py | Python | gpl-3.0 | 22,479 |
#!/usr/bin/env python3
"""
Calculate mean and standard deviation of column data using Welford's one pass algorithm
"""
import sys
import numpy as np
np.set_printoptions(formatter={"float": lambda x: "{0:10.3f}".format(x)})
def average_columns(filename):
with open(filename) as f:
mean, sdev = None, None
... | jag1g13/pycgtool | doc/tutorial_files/average_columns.py | Python | gpl-3.0 | 1,517 |
class Coordinate:
coordX = 0
coordY = 0
def __init__(self, coordX=0, coordY=0):
self.coordX = coordX
self.coordY = coordY
pass
def set(self, coordX, coordY):
self.coordX = coordX
self.coordY = coordY
return coordX, coordY
if __name__ == '_... | hemmerling/codingdojo | src/game_of_life/python_coderetreat_socramob/cr_socramob05/coordinate.py | Python | apache-2.0 | 340 |
# -*- python -*-
# Copyright (C) 2009-2014 Free Software Foundation, Inc.
# 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 versio... | trfiladelfo/tdk | gcc-arm-none-eabi/arm-none-eabi/lib/armv7-m/libstdc++.a-gdb.py | Python | mit | 2,397 |
"""
Copyright 2015 Erik Perillo <erik.perillo@gmail.com>
This file is part of pig.
This 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.
... | erikperillo/pig | pig/beagle/compass.py | Python | gpl-3.0 | 4,266 |
"""The tests for the Graphite component."""
import socket
import unittest
try:
from unittest import mock
except ImportError:
import mock
import homeassistant.core as ha
import homeassistant.components.graphite as graphite
from homeassistant.const import (
EVENT_STATE_CHANGED,
EVENT_HOMEASSISTANT_START,... | Julian/home-assistant | tests/components/test_graphite.py | Python | mit | 8,257 |
"""A cache for storing small matrices in multiple formats."""
from sympy import Matrix, I, Pow, Rational, exp, pi
from sympy.physics.quantum.matrixutils import (
to_sympy, to_numpy, to_scipy_sparse
)
class MatrixCache(object):
"""A cache for small matrices in different formats.
This class takes small m... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/physics/quantum/matrixcache.py | Python | agpl-3.0 | 3,427 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | allevin/PyGithub | tests/AllTests.py | Python | lgpl-3.0 | 7,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.