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 |
|---|---|---|---|---|---|
# -*- coding:utf-8 -*-
# This code is automatically transpiled by Saklient Translator
import six
from ...errors.httpbadrequestexception import HttpBadRequestException
import saklient
str = six.text_type
# module saklient.cloud.errors.sizemismatchexception
class SizeMismatchException(HttpBadRequestException):
##... | sakura-internet/saklient.python | saklient/cloud/errors/sizemismatchexception.py | Python | mit | 766 |
# UID.py
"""Dicom Unique identifiers"""
# Copyright (c) 2008-2014 Darcy Mason
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at https://github.com/darcymason/pydicom
import os
import uuid
import random
import has... | mshunshin/SegNetCMR | pydicom/uid.py | Python | mit | 9,238 |
# -*- coding: utf-8 -*-
# © 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from contextlib import contextmanager
class patch_ldap_connection(object):
def __init__(self, results):
self.results = results
... | ddico/server-tools | users_ldap_populate/tests/test_users_ldap_populate.py | Python | agpl-3.0 | 2,080 |
#------------------------------------------------------------------------
#
# Copyright (C) 2000 Autonomous Zone Industries
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
# this header remains inta... | deanhiller/databus | webapp/play1.3.x/python/Lib/bsddb/dbutils.py | Python | mpl-2.0 | 3,053 |
from collections import defaultdict
import gzip
import os
import re
import subprocess
from django.conf import settings
from settings import JBROWSE_DATA_URL_ROOT
from settings import S3_BUCKET
from main.model_utils import get_dataset_with_type
from main.models import Dataset
from utils.bam_utils import sort_bam_by_co... | woodymit/millstone | genome_designer/genome_finish/jbrowse_genome_finish.py | Python | mit | 10,505 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-10-09 20:12:41
# @Author : Ryan Stornado (ryan@zxytech.com)
# @Link : https://github.com/stornado
# @Version : $Id$
import time
from django.template.loader import render_to_string
class WechatEcho(object):
def __init__(self, toUser, fromUser):... | stornado/djwechat | djwechat/weixin/message.py | Python | apache-2.0 | 3,224 |
from exams import Test
# Compute host- and time-averaged MIC user fraction
# Single mic usage < 1
# Double mic usage < 2
class MIC_Usage(Test):
k1 = ['mic']
k2 = ['user_sum']
comp_operator = '>'
def compute_metric(self):
# Get mic stats aggregated over all hosts and mics
self.metric = 0.0
... | dimm0/tacc_stats | tacc_stats/analysis/exam/mic_usage.py | Python | lgpl-2.1 | 931 |
"""Logic expressions handling
NOTE
----
at present this is mainly needed for facts.py , feel free however to improve
this stuff for general purpose.
"""
from __future__ import print_function, division
from sympy.core.compatibility import iterable
def fuzzy_bool(x):
"""Return True, False or None according to x.... | wdv4758h/ZipPy | edu.uci.python.benchmark/src/benchmarks/sympy/sympy/core/logic.py | Python | bsd-3-clause | 7,540 |
"""
This module implements methods for solving equations and inequalities.
"""
from .inequalities import reduce_inequalities
from .ode import dsolve
from .recurr import rsolve
from .solvers import solve
__all__ = 'reduce_inequalities', 'dsolve', 'rsolve', 'solve'
| skirpichev/omg | diofant/solvers/__init__.py | Python | bsd-3-clause | 267 |
from custom.ilsgateway.tanzania.handlers.zipline import ZiplineGenericHandler
from custom.ilsgateway.tanzania.reminders import EMG_ERROR, EMG_HELP
from custom.zipline.api import initiate_emergency_order
class ParseError(Exception):
pass
class EmergencyHandler(ZiplineGenericHandler):
error_message = EMG_ERR... | qedsoftware/commcare-hq | custom/ilsgateway/tanzania/handlers/emg.py | Python | bsd-3-clause | 653 |
#Functions & Files
#Python version 2.7
#How files and functions can play together
from sys import argv
#get the script name and filename from argv
script, filename = argv
#print out all of the content of the file
def print_all(f):
print f.read()
#rewind the current position within the file at the beginning of the... | pparacch/PlayingWithPython | learnPythonTheHardWay/src/ex_20.py | Python | mit | 1,227 |
from hubcheck.pageobjects.widgets.item_list_item import ItemListItem
from hubcheck.pageobjects.basepageelement import TextReadOnly, Link
class TagsBrowseResultsRow1(ItemListItem):
def __init__(self, owner, locatordict={}, row_number=0):
super(TagsBrowseResultsRow1,self).__init__(owner,locatordict,row_num... | codedsk/hubcheck | hubcheck/pageobjects/widgets/tags_browse_results_row.py | Python | mit | 3,089 |
from collections import Counter
def solve(U, QR):
c1 = Counter("".join(QR))
c2 = Counter("".join([r[0] for r in QR]))
ans = list(set(c1)-set(c2))[0]
ordered = c2.most_common()
for x, cnt in ordered:
if x != ans[0]: ans += x
return ans
for case in range(1, eval(input()) + 1):
U = in... | zuun77/givemegoogletshirts | codejam/2020/1C/q2.py | Python | apache-2.0 | 475 |
#!/usr/bin/env python
#---------------------------------------
# IMPORTS
#---------------------------------------
import test
from pymake2 import *
#---------------------------------------
# GLOBALS
#---------------------------------------
counter = 0
#---------------------------------------
# FUNCTIONS
#--------... | philiparvidsson/pymake2 | tests/target_kwargs.py | Python | mit | 965 |
import urlparse, urllib
def path2url(path):
return urlparse.urljoin(
'file:', urllib.pathname2url(path))
| yomguy/PiPlayer | piplayer/tools.py | Python | gpl-2.0 | 119 |
import collections
import dnsq
class DNSLookup(collections.MutableMapping):
"DNSLookup has the same interface as a dict, but talks to a DNS server"
def __init__(self):
pass
def __getitem__(self, key):
try:
return dnsq.mx_hosts_for(key)
except:
return []
... | alex/flanker | flanker/addresslib/drivers/dns_lookup.py | Python | apache-2.0 | 869 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import os
from glob import glob
from logging import getLogger
from werkzeug import urls
import odoo
import odoo.modules.module # get_manifest, don't from-import it
from odoo import api, fields, models, tools
from odoo.tools import misc
_logg... | jeremiahyan/odoo | odoo/addons/base/models/ir_asset.py | Python | gpl-3.0 | 18,222 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-13 10:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('scheduler', '0003_auto_20160... | thomasleese/rooster | scheduler/migrations/0004_auto_20160213_1053.py | Python | mit | 788 |
# Copyright (C) 2016 ETH Zurich, Institute for Astronomy
"""
Tests for `tf_unet` module.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import pytest
from tf_unet import tf_unet
class TestTf_unet(object):
def setup(self):
#prepare unit test. Load data etc
... | wolffytom/tf_runet | test/test_tf_unet.py | Python | gpl-3.0 | 574 |
import time
import unittest
from Tribler.community.market.core.timestamp import Timestamp
class TimestampTestSuite(unittest.TestCase):
"""Timestamp test cases."""
def setUp(self):
# Object creation
self.timestamp = Timestamp(1462224447.117)
self.timestamp2 = Timestamp(1462224447.117)... | vandenheuvel/tribler | Tribler/Test/Community/Market/test_timestamp.py | Python | lgpl-3.0 | 2,211 |
#!/usr/bin/env python
# import keystoneclient.v2_0.client as ksclient
# import glanceclient.v2.client as glclient
# import novaclient.client as nvclient
# import neutronclient.v2_0.client as ntclient
# import cinderclient.v2.client as cdclient
# import swiftclient.client as sftclient
__author__ = 'Yuvv'
OS_PROJECT_D... | Yuvv/LearnTestDemoTempMini | py-django/DataBackup/ops/credentials.py | Python | mit | 3,202 |
# Django with Websocket for Redis under a single uWSGI server
# (for sites with low traffic)
#
# uwsgi --virtualenv /path/to/virtualenv --http :9090 --gevent 100 --http-websockets --module wsgi
#
# See: http://django-websocket-redis.readthedocs.io/en/latest/running.html#django-with-websockets-for-redis-as-a-stand-alo... | jrief/django-websocket-redis | examples/wsgi.py | Python | mit | 906 |
# -*- coding: utf-8 -*-
#
# Copyright 2011 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/LIC... | redhat-openstack/python-ironicclient | ironicclient/openstack/common/strutils.py | Python | apache-2.0 | 7,578 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 5, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Difference/trend_ConstantTrend/cycle_5/ar_12/test_artificial_128_Difference_ConstantTrend_5_12_20.py | Python | bsd-3-clause | 270 |
#!/usr/bin/python
import os, sys, time, glob, math, matplotlib, random, string
import csv
import pickle
import calendar
import re
matplotlib.use('Agg')
matplotlib.rcParams.update({'font.size': 18})
from matplotlib import pyplot as plt
from matplotlib import cm
import numpy as np
from datetime import datetime
from op... | gwpy/seismon | seismon/eqmon.py | Python | gpl-3.0 | 115,992 |
from .tangled import *
from .bricks import *
from .builder import TreeBuilder
from .evaluator import BasicEvaluator
__all__ = [*tangled.__all__,
*bricks.__all__,
'TreeBuilder',
'BasicEvaluator']
| ltron/tangle | tangle/__init__.py | Python | mit | 230 |
from core.logging.logger import Logger
from androguard.decompiler.dad import decompile
class SurgicalLibError(Exception):
def __init__(self, message):
self.logger = Logger()
self.message = message
self.logger.surgical_log("critical", "SurgicalLib : {}"
.for... | xtiankisutsa/MARA_Framework | tools/lobotomy/core/brains/surgical/lib/libsurgical.py | Python | lgpl-3.0 | 2,951 |
from logging import getLogger
import numpy as np
from numpy.fft import fftfreq
from scipy import interpolate
from scipy.fftpack import fft, ifft, next_fast_len
from scipy.linalg import eigvals_banded
from scipy.signal import detrend
logger = getLogger(__name__)
class Multitaper(object):
'''Transform time-domain... | edeno/Jadhav-2016-Data-Analysis | src/spectral/transforms.py | Python | gpl-3.0 | 21,115 |
# jsb/channelbase.py
#
#
""" provide a base class for channels. """
## jsb imports
from jsb.utils.name import stripname
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import Persist
from jsb.lib.datadir import getdatadir
from jsb.utils.trace import whichmodule
from jsb.lib.errors import NoChannelProvid... | melmothx/jsonbot | jsb/lib/channelbase.py | Python | mit | 3,101 |
from __future__ import absolute_import, unicode_literals
from datetime import timedelta
from celery import current_app
from celery import states
from celery.result import AsyncResult
from celery.task import PeriodicTask
from celery.utils import gen_unique_id
from djcelery.backends.database import DatabaseBackend
fro... | alexhayes/django-celery | djcelery/tests/test_backends/test_database.py | Python | bsd-3-clause | 3,043 |
"""Tests for Vizio config flow."""
import dataclasses
import pytest
import voluptuous as vol
from homeassistant import data_entry_flow
from homeassistant.components.media_player import DEVICE_CLASS_SPEAKER, DEVICE_CLASS_TV
from homeassistant.components.vizio.config_flow import _get_config_schema
from homeassistant.co... | mezz64/home-assistant | tests/components/vizio/test_config_flow.py | Python | apache-2.0 | 33,541 |
# Copyright (c) 2012-2016 Seafile Ltd.
import logging
from .settings import ENABLED_ROLE_PERMISSIONS, ENABLED_ADMIN_ROLE_PERMISSIONS
from seahub.constants import DEFAULT_USER, DEFAULT_ADMIN
logger = logging.getLogger(__name__)
def get_available_roles():
"""Get available roles defined in `ENABLED_ROLE_PERMISSION... | miurahr/seahub | seahub/role_permissions/utils.py | Python | apache-2.0 | 1,315 |
class LocalSettingsError(Exception):
pass
class StrategyError(LocalSettingsError):
pass
class SettingsFileNotFoundError(LocalSettingsError):
pass
class SettingsFileSectionNotFoundError(LocalSettingsError, LookupError):
pass
class SettingsFileDidNotPassCheck(LocalSettingsError):
pass
c... | wylee/django-local-settings | src/local_settings/exc.py | Python | mit | 492 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fusion.py
This script takes all the data all data the multicopter have to get the most
precise output position possible, taking in account the delays.
This file is part of ILPS (Indoor Laser Positioning System).
ILPS is free software: you can redistribute it and/or m... | AlexisTM/Indoor_Position_lasers | laserpack/bin/fusion.py | Python | mit | 2,163 |
"""
filter.py
NCBI Hackathon, RNA-seq team
January 7, 2015
Created by Abhi Nellore
Filters out all read (pairs) for which there is at least one secondary
alignment. This is a dirty way to simulate filtering out all reads for which
NH:i > 1; this field is missing from HISAT output.
"""
import sys
if __name__ == '__ma... | NCBI-Hackathons/hackathon_v001_rnaseq | filter.py | Python | cc0-1.0 | 1,134 |
import json
import logging
import inflection
from ..client.api.model import EntityEncoder
from ..client.api.client import TesseraClient
log = logging.getLogger(__name__)
class JsonImporter(object):
def __init__(self, graphite_url, tessera_url):
self.graphite_url = graphite_url
self.client = Tesser... | aalpern/tessera | tessera-server/tessera/importer/json_importer.py | Python | apache-2.0 | 1,588 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is for pump-probe measurement, with HF2LI
In this version, while I am probing (e.g. from channel 2),
I will also record the signal from the pumping channel (e.g. channel 1)
Therefore, later I can reconstruct the "pump" response
"""
from open_loop_sweep import open_loop_... | changyaochen/zi_DAQs | pump_probe_v2.py | Python | gpl-3.0 | 8,269 |
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2008
#
# 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 opti... | sYnfo/samba | python/samba/tests/core.py | Python | gpl-3.0 | 2,189 |
from django.contrib.auth.models import User
from django.test import TestCase
from ..models import Praise
class PraiseAdminTest(TestCase):
def setUp(self):
User.objects.create_superuser('admin', 'admin@pronto.com', 'admin')
self.client.login(username='admin', password='admin')
self.url = ... | prontotools/pronto-praise | pronto_praise/praises/tests/test_admin.py | Python | mit | 1,356 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.hood.TTHood
from panda3d.core import Vec4
from otp.ai.MagicWordGlobal import *
from toontown.safezone.TTSafeZoneLoader import TTSafeZoneLoader
from toontown.town.TTTownLoader import TTTownLoader
from toontown.toonbase import ToontownGlobals
from ... | DedMemez/ODS-August-2017 | hood/TTHood.py | Python | apache-2.0 | 1,368 |
#!/usr/bin/env python
"""
Functions specific to the Grading Rahm app.
"""
import copytext
import app_config
from render_utils import flatten_app_config, JavascriptIncluder, CSSIncluder
from collections import OrderedDict
from datetime import datetime, date, timedelta
def make_context(asset_depth=0):
"""
Crea... | wbez/budget-tracker | custom_context.py | Python | mit | 3,023 |
"""
Tab art provider code - a tab provider provides all drawing functionality to
the L{AuiNotebook}. This allows the L{AuiNotebook} to have a plugable look-and-feel.
By default, a L{AuiNotebook} uses an instance of this class called L{AuiDefaultTabArt}
which provides bitmap art and a colour scheme that is adapted to t... | wdmchaft/taskcoach | taskcoachlib/thirdparty/aui/tabart.py | Python | gpl-3.0 | 105,740 |
#!/usr/bin/python3
__author__ = 'paranoia'
class Adapter(object):
def __init__(self, obj, adapted_methods):
self.obj = obj
self.__dict__.update(adapted_methods)
def __getattr__(self, attr):
return getattr(self.obj, attr)
# def original_dict(self):
# return self.obj.__dict__
| paranoiasystem/SeminarioTPA | codice/python/special_adapter.py | Python | gpl-2.0 | 291 |
# -*- Coding: UTF-8 -*-
#!/usr/bin/env python
import tensorflow as tf
import numpy as np
import tfr
# import tensorflow.examples.tutorials.mnist.input_data as input_data
# from libs.utils import *
# import matplotlib.pyplot as plt
def weight_variable(shape):
initial = tf.random_normal(shape,mean=0.0,st... | xl1994/tfConvo | demo0922.py | Python | mit | 4,010 |
""" Run tests on album search filters. """
import pytest
from django.contrib.auth import models as auth_models
from django.db.models import QuerySet
from mock import ANY, MagicMock, call
from spud import exceptions, models
from ..utils import MyQ
def test_search_all():
user = MagicMock(spec=auth_models.User)
... | brianmay/spud | spud/tests/a_unit/albums/test_search.py | Python | gpl-3.0 | 6,830 |
# coding: utf-8
from cx_Freeze import setup, Executable
executables = [Executable('example.py', targetName='hello_wx.exe')]
excludes = ['logging', 'unittest', 'email', 'html', 'http', 'urllib', 'xml',
'unicodedata', 'bz2', 'select']
zip_include_packages = ['collections', 'encodings', 'importlib', 'wx']
... | Jenyay/cx_freeze_examples | example 12/setup.py | Python | mit | 659 |
""" Recursively unzip files
Loop through all files under a source folder and find all
*.zip files. Then unzip each file into the same relative
path within a destination folder. e.g.
Source:
C:\MyData\Zipped\Folder1\test.zip
Unzipped to:
C:\MyData\Unzipped\Folder1\...
"""
import os
import argparse
import zipfile
imp... | SouthForkResearch/CHaMP_Metrics | scripts/batch_unzip.py | Python | gpl-3.0 | 1,856 |
import time
import json
from twython import Twython
import ConfigParser
from dateutil import parser
propertiesFile = "my.properties"
cp = ConfigParser.ConfigParser()
cp.readfp(open(propertiesFile))
APP_KEY = cp.get('Params', 'app_key')
APP_SECRET = cp.get('Params', 'app_secret')
OAUTH_TOKEN ... | kylepolich/dataskeptic | talks/how-to-lie-with-data/tam.py | Python | cc0-1.0 | 1,885 |
from django.contrib.auth import authenticate, login
from django.views.generic.base import TemplateView, RedirectView
from clowder_account.models import Company, ClowderUser
class AccountView(TemplateView):
template_name = 'account.html'
def get(self, request, *args, **kwargs):
user = request.user
... | keithhackbarth/clowder_server | clowder_account/views.py | Python | agpl-3.0 | 1,167 |
#!/usr/bin/env python
import sys
import os
import resource
import shutil
import shlex
import time
import subprocess
import random
import signal
import hashlib
# this is a disk I/O benchmark script. It runs menchmarks
# over different filesystems, different cache sizes and
# different number of peers (can be used to f... | aliakseis/LIII | src/3rdparty/torrent-rasterbar/examples/run_benchmarks.py | Python | mit | 14,944 |
import os, filecmp, shutil, tempfile
import unittest
from test import test_support
class FileCompareTestCase(unittest.TestCase):
def setUp(self):
self.name = test_support.TESTFN
self.name_same = test_support.TESTFN + '-same'
self.name_diff = test_support.TESTFN + '-diff'
data = 'Co... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/test/test_filecmp.py | Python | mit | 4,953 |
# 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... | apark263/tensorflow | tensorflow/contrib/tensorrt/test/memory_alignment_test.py | Python | apache-2.0 | 2,982 |
# file test_xmlmap/test_premis.py
#
# Copyright 2011 Emory University Libraries
#
# 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
#
... | emory-libraries/eulxml | test/test_xmlmap/test_premis.py | Python | apache-2.0 | 3,443 |
#!/usr/bin/env python
import fewerror
crashy_tweet = '''2x more likely to hire men than women, even when he's less capable http://t.co/XcovCXpsqC
"We shouldn't sacrifice quality to hire women!"'''
def test_not_crashing():
reply = fewerror.find_corrections(crashy_tweet)
if reply:
# if we get anythin... | wjt/fewerror | tests/test_crashes.py | Python | mit | 405 |
#
# --- MIT Open Source License --------------------------------------------------
# PiB - Python Build System
# Copyright (C) 2011 by Don Williamson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
... | Celtoys/PiB | Python/Environment.py | Python | mit | 14,397 |
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(s... | wanglzh/django-study | polls/models.py | Python | gpl-3.0 | 818 |
"""
WSGI config for DjangoProyect project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | santidediego/LearningDjango | DjangoProyect/wsgi.py | Python | mit | 403 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import platform
import os
from ctypes import c_char_p, c_int, c_double, CDLL
from .__init__ import *
from .object import Object
from gi.repository import Pango
from gi.repository import PangoCairo
BARCODE_ANY = 0 # /* Choose best-fit */
BARCODE_EAN = 1 # /* Code EAN */
B... | jmouriz/sanaviron | sanaviron/objects/barcode.py | Python | apache-2.0 | 8,644 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | azumimuo/family-xbmc-addon | plugin.video.salts/scrapers/torbase_scraper.py | Python | gpl-2.0 | 7,191 |
"""
WSGI config for newsdiffs project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | flupzor/newsdiffs | bijgeschaafd/wsgi.py | Python | mit | 398 |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2021] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-import-pipeline | rnacentral_pipeline/cli/flybase.py | Python | apache-2.0 | 1,306 |
"""
Here we put all the classes that run specific jobs
"""
import logging
import time
from . import models
from .system.dmesg import dmesg_analysis
from .system.lspci import lspci_analysis
from .system.smartctl import smartinfo
from .utils.job import Job
logger = logging.getLogger(__name__)
class ScanJob(Job):
... | fairdk/lcrs-embedded | lcrs_embedded/jobs.py | Python | gpl-3.0 | 1,345 |
import math
import os
import sys
import warnings
def fn_name(): return sys._getframe(1).f_code.co_name
import gobject
import gtk; gdk = gtk.gdk
import pango
pygtk_version_required = (2,2,0)
if gtk.pygtk_version < pygtk_version_required:
raise ImportError ("PyGTK %d.%d.%d is installed\n"
"Py... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/matplotlib/backends/backend_gdk.py | Python | gpl-3.0 | 16,605 |
#!/usr/bin/env python
import urllib
import urllib2
import json
import hashlib
import datetime
from collections import OrderedDict
AUTH_REQUIRETOKEN = "/auth/requiretoken"
BASEURL = "http://api.shapelink.com"
class ShapelinkException( Exception ):
pass
SHAPELINK_METHODS = {
'get_token' : {
're... | peterstark72/shapelink | shapelink.py | Python | mit | 7,087 |
# Copyright 2016-2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | jimmyraywv/cloud-custodian | tests/test_cli.py | Python | apache-2.0 | 18,764 |
# Copyright 2017 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... | nolanliou/tensorflow | tensorflow/contrib/lite/testing/generate_examples.py | Python | apache-2.0 | 63,298 |
#!/usr/bin/env python
from ota_xml_api.ota2011b import hotel_avail
from ota_xml_api.util.date import Period
import unittest
class SourceTC(unittest.TestCase):
def test_source(self):
node = hotel_avail.Source()
self.assertEqual(str(node), '<Source><RequestorID/></Source>')
node.set_office(... | mihira/opentravel-xml-api | test/test_hotel_avail.py | Python | mit | 8,210 |
# -*- coding: utf-8 -*-
import os
from transifex.txcommon.tests.base import Languages
from transifex.languages.models import Language
from transifex.resources.formats.desktop import DesktopHandler
from transifex.resources.tests.lib.base import FormatsBaseTestCase
class TestDesktopHandler(FormatsBaseTestCase):
""... | hfeeki/transifex | transifex/resources/tests/lib/desktop/__init__.py | Python | gpl-2.0 | 2,455 |
from __future__ import unicode_literals
from __future__ import absolute_import
from django.views.generic.base import TemplateResponseMixin
from wiki.core.plugins import registry
from wiki.conf import settings
class ArticleMixin(TemplateResponseMixin):
"""A mixin that receives an article object as a parameter (u... | a-nai/django-wiki | wiki/views/mixins.py | Python | gpl-3.0 | 1,769 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'LineItem.started'
db.add_column('spreedly_lineitem', 'started',
self.g... | mediapop/django-spreedly | spreedly/migrations/0008_auto__add_field_lineitem_started__add_field_lineitem_reference__add_fi.py | Python | mit | 10,741 |
#!/usr/bin/python3
import struct
class CRCError(Exception): pass
def rint(x):
return int(round(x))
class HM305:
def __init__(self, fd = None):
if fd is None:
import serial
fd = serial.Serial('/dev/ttyCH340', baudrate=9600, timeout=0.1)
self.s = fd
def send(self, ... | markrages/py_test_interface | hm305.py | Python | apache-2.0 | 3,772 |
"""SWM, A Simple Wildfire-inspired MDP model. Version 2.1"""
"""
SWMv2.1
New Features:
-An additional weather variable ("moisture") which works against the spread of large fires and which has
a separate threshold.
-The policy function now includes the current state variables "timber" and "vulnerability" as parame... | buckinha/gravity | SWMv2_1.py | Python | mpl-2.0 | 17,498 |
from framework.auth.core import _get_current_user
from website.files.models.base import File, Folder, FileNode, FileVersion
__all__ = ('DataverseFile', 'DataverseFolder', 'DataverseFileNode')
class DataverseFileNode(FileNode):
provider = 'dataverse'
class DataverseFolder(DataverseFileNode, Folder):
pass
... | rdhyee/osf.io | website/files/models/dataverse.py | Python | apache-2.0 | 1,543 |
import datetime
from django.db import models
from django.db.models import Q
from django.core.mail import EmailMultiAlternatives
from django.conf import settings
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.utils impo... | pizzapanther/TwoSpaces | twospaces/conference/models.py | Python | mit | 10,145 |
# 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, random
from frappe.desk import query_report
from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.serial_... | anandpdoshi/erpnext | erpnext/demo/user/stock.py | Python | agpl-3.0 | 3,322 |
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
from __future__ import unicode_literals # make all strings unicode in python2
import os
import json
from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime, Foreign... | cwtaylor/viper | viper/core/database.py | Python | bsd-3-clause | 18,045 |
"""
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | schakrava/rockstor-core | src/rockstor/scripts/pwreset.py | Python | gpl-3.0 | 2,030 |
"""The Tailscale integration."""
from __future__ import annotations
from tailscale import Device as TailscaleDevice
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry... | jawilson/home-assistant | homeassistant/components/tailscale/__init__.py | Python | apache-2.0 | 2,677 |
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | EliteTK/qutebrowser | scripts/dev/segfault_test.py | Python | gpl-3.0 | 3,754 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | kubeflow/kfp-tekton-backend | components/gcp/container/component_sdk/python/kfp_component/google/dataflow/_process.py | Python | apache-2.0 | 1,423 |
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
pytest.main(self... | oozappa/maiden | setup.py | Python | apache-2.0 | 403 |
"""
Controller to interface with Spotify.
"""
import logging
import threading
from . import BaseController
from ..config import APP_SPOTIFY
from ..error import LaunchError
APP_NAMESPACE = "urn:x-cast:com.spotify.chromecast.secure.v1"
TYPE_GET_INFO = "getInfo"
TYPE_GET_INFO_RESPONSE = "getInfoResponse"
TYPE_SET_CREDEN... | balloob/pychromecast | pychromecast/controllers/spotify.py | Python | mit | 2,978 |
from .views import auth_login, auth_logout, thanks, registration, \
reset_password, activate, set_password
from .ajax import save_profile
from django.conf.urls import url
urlpatterns = [
url(r'^login/$', auth_login, name='login'),
url(r'^logout/$', auth_logout, name='logout'),
url(r'^thanks/$', thanks... | ChaoticEvil/django_base | src/apps/accounts/urls.py | Python | gpl-3.0 | 737 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyCarputils(PythonPackage):
"""The carputils framework for running simulations with the openCARP software."""
... | LLNL/spack | var/spack/repos/builtin/packages/py-carputils/package.py | Python | lgpl-2.1 | 1,313 |
# The contents of this file are subject to the Mozilla Public License
# (MPL) Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/lepl/_example/separators.py | Python | agpl-3.0 | 5,123 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pages', '0002_remove_page_script'),
]
operations = [
migrations.AddField(
model_name='page',
name='s... | stahlnow/stahlnow | website/apps/pages/migrations/0003_page_script.py | Python | mit | 450 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@version: 0.1
@author: quantpy
@email: quantpy@qq.com
@file: figure.py
@time: 2017-08-07 17:57
"""
from __future__ import division, print_function, unicode_literals
from functools import wraps
import pandas as pd
def parser(name, x, y, legend, args1, kwar... | xbanke/ebokeh | ebokeh/plotting/figure.py | Python | mit | 2,931 |
# Author: Mathieu Blondel
# License: BSD Style.
from .stochastic_gradient import BaseSGDClassifier
from ..feature_selection.selector_mixin import SelectorMixin
class Perceptron(BaseSGDClassifier, SelectorMixin):
"""Perceptron
Parameters
----------
penalty : None, 'l2' or 'l1' or 'elasticnet'
... | florian-f/sklearn | sklearn/linear_model/perceptron.py | Python | bsd-3-clause | 3,758 |
import sublime, sublime_plugin
import json
import os.path
try:
import urllib.request as urllib2
except ImportError:
import urllib2
import urllib.parse
import re
import threading
import os, random, string
import subprocess
from subprocess import Popen, PIPE, STDOUT
# Check to see if we're in Sublime Text 3
ST3 ... | rguisewite/MvSublimeTemplateEditor | src/MvSublimeTemplateEditor.py | Python | mit | 33,074 |
import rethinkdb as r
VERSION = (0, 0, 1)
def get_version():
if isinstance(VERSION[-1], basestring):
return '.'.join(map(str, VERSION[:-1])) + VERSION[-1]
return '.'.join(map(str, VERSION))
__version__ = get_version()
class RethinkEngine(object):
_options = {}
_connection = None
_models... | NamPNQ/rethinkengine | rethinkengine/__init__.py | Python | mit | 962 |
import re
from django import forms
from django.core.validators import RegexValidator
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit
from crispy_forms.bootstrap import FormActions
from fabric_bolt.projects import models
class ProjectCreateForm(forms.ModelForm):
button_... | lethe3000/fabric-bolt | fabric_bolt/projects/forms.py | Python | mit | 5,340 |
# Adagios is a web based Nagios configuration interface
#
# Copyright (C) 2014, Pall Sigurdsson <palli@opensource.is>
#
# 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... | opinkerfi/adagios | adagios/settings.py | Python | agpl-3.0 | 12,039 |
# 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 use ... | bluebreezecf/kafka | tests/kafkatest/services/performance/consumer_performance.py | Python | apache-2.0 | 6,518 |
# Copyright 2019, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/federated | tensorflow_federated/python/core/impl/executors/thread_delegating_executor.py | Python | apache-2.0 | 5,242 |
# -*- coding: utf-8 -*-
import os
import sys
from configurations import values
from postgresify import postgresify
from .base import Base as Settings
class Production(Settings):
# Installed Applications (featuring Production).
# --------------------------------------------------------------------------
... | bryanveloso/avalonstar-tv | avalonstar/settings/production.py | Python | apache-2.0 | 3,820 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | cvandeplas/plaso | plaso/winnt/shell_folder_ids.py | Python | apache-2.0 | 13,850 |
#!/usr/bin/python3
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# 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 y... | odahoda/noisicaa | noisicaa/core/recordfile.py | Python | gpl-2.0 | 5,836 |
# -*- coding: utf-8 -*-
# Copyright (C) 2019 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
def cuda_detect():
'''Attempt to detect the version of CUDA present in the operating system.
On Windows and Linux, the CUDA library is installed by the NVIDIA
driver package, and is typically found in the st... | huguesv/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda/common/cuda.py | Python | apache-2.0 | 2,163 |
from instructions import instruction_types, instruction_regex, RBracket, LBracket
from node import Node
import re, sys
class TerminatedException(Exception):
pass
class ParseException(Exception):
pass
class BrainfuckInterpreter:
def __init__(self, code):
"""
Takes a string that represents the code, and i... | Detry322/brainfuck-interpreter | interpreter.py | Python | mit | 2,129 |
from wepay.calls.base import Call
class Batch(Call):
""" The /batch API calls """
call_name = 'batch'
def __create(self, client_id, client_secret, calls, **kwargs):
"""Call documentation: `/batch/create
<https://www.wepay.com/developer/reference/batch#create>`_, plus extra
keyword... | lehins/python-wepay | wepay/calls/batch.py | Python | mit | 788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.