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 |
|---|---|---|---|---|---|
# encoding: 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 'Field.placeholder_text'
db.add_column('forms_field', 'placeholder_text', self.gf('django.db.models... | orlenko/bccf | src/mezzanine/forms/migrations/0002_auto__add_field_field_placeholder_text.py | Python | unlicense | 6,019 |
'''
Created on Mar 2, 2012
@author: Stephen O'Hara
Latent Configuration Clustering
Algorithm:
Compute Proximity Forest over a data set that has an unknown configuration
Compute graph from connectivity of leaf nodes in forest
Cluster using the weighted graph, hierarchical or spectral clustering
Copyright (C) 2012 Ste... | Sciumo/ProximityForest | samples/LatentConfigurationClustering_Demo.py | Python | gpl-3.0 | 8,896 |
#!python
# coding=utf-8
# Package level logger
import logging
logger = logging.getLogger("pocean")
logger.addHandler(logging.NullHandler())
__version__ = "1.0.0"
| joefutrelle/pocean-core | pocean/__init__.py | Python | mit | 164 |
import docutils.nodes
import sphinx.addnodes
class GetError(LookupError):
pass
def get_fullname(node):
if isinstance(node, docutils.nodes.section):
return get_sectionname(node)
if isinstance(node, sphinx.addnodes.desc):
return get_descname(node)
raise TypeError("Unrecognized node type... | gmittal/aar-nlp-research-2016 | src/pygame-pygame-6625feb3fc7f/docs/reST/ext/utils.py | Python | mit | 4,072 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/network/netbridge.py | Python | apache-2.0 | 6,086 |
# coding=utf-8
"""
"""
__author__ = 'Alisue <lambdalisue@hashnote.net>'
import numpy as np
from xlwt import Formula
from xlwt import Workbook
from xlwt.Utils import rowcol_pair_to_cellrange
from maidenhair.utils.peakset import find_peakset
from txt2xls.writer.utils import ensure_iterable
from txt2xls.writer.utils impor... | lambdalisue/txt2xls | src/txt2xls/writer/__init__.py | Python | mit | 6,172 |
"""
.. module:: follower
:synopsis: Log tailing classes
.. moduleauthor:: Colin Alston <colin@imcol.in>
"""
import os
class LogFollower(object):
"""Provides a class for following log files between runs
:param logfile: Full path to logfile
:type logfile: str
:param parser: Optional parser method f... | ducted/duct | duct/logs/follower.py | Python | mit | 2,971 |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum.util import base_units_list
from electrum.i18n import languages
from electrum.gui.kivy.i18n import _
from electrum.plugin import run_hook
from electrum import coinchooser
fr... | cryptapus/electrum | electrum/gui/kivy/uix/dialogs/settings.py | Python | mit | 9,722 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | jiahaoliang/group-based-policy | gbpservice/nfp/proxy_agent/notifications/pull.py | Python | apache-2.0 | 3,442 |
import os
import time
import cPickle
import datetime
import logging
import flask
import werkzeug
import optparse
import tornado.wsgi
import tornado.httpserver
import numpy as np
import pandas as pd
from PIL import Image as PILImage
import cStringIO as StringIO
import urllib
import caffe
import exifutil
REPO_DIRNAME = ... | chizhizhen/DNT | caffe/examples/web_demo/app.py | Python | mit | 7,659 |
import sys
from setuptools import setup, find_packages
import lazyconf
l = 'lazyconf/'
s = 'schema/'
setup(
name='lazyconf',
version='0.5.4',
author='Fareed Dudhia',
author_email='fareeddudhia@gmail.com',
packages=find_packages(),
package_data={"lazyconf": ['schema/' 'lazyconf/schema/*.json',]... | fmd/lazyconf | setup.py | Python | mit | 705 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Variation',
fields=[
... | kronicz/ecommerce-2 | src/products/migrations/0002_variation.py | Python | mit | 927 |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
cm_data = [[0.0000208612, 0.0000200049, 0.0000198463],
[0.000405063, 0.000332768, 0.000320958],
[0.00119499, 0.000941283, 0.00090058],
[0.00236152, 0.0018053, 0.00171716],
[0.00389363, 0.00290336, 0.00274803],
[0.00578633, 0.00422109, 0.00... | planetarymike/IDL-Colorbars | IDL_py_test/082_Singlehue_RedOrange.py | Python | gpl-2.0 | 8,754 |
# -*- coding: utf-8 -*-
"""
dummydrivers
~~~~~~~~~~~~
Just some fake drivers to show how the backend, frontend works.
:copyright: 2015 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import numpy as np
from lantz import Driver, Feat, ureg, Action
... | varses/awsch | lantz/drivers/examples/dummydrivers.py | Python | bsd-3-clause | 1,485 |
###
### This script can be run with pvpython rather than pvbatch, as it does not
### need mpi.
###
### Purpose:
###
### Read all timesteps of the halos point files (vtu) which have fewer
### halo points and the raw-particles (vtu) which have many more halo points.
### For the few halo points, we create a glyph fil... | Kitware/cinema | scripts/data_generation/cosmology/hacc_composite_time.py | Python | bsd-3-clause | 11,672 |
# -*- 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 'PaymentRequest.payment_methods'
db.add_column('skrill_paymentrequest', 'payment_methods',
... | byteweaver/django-skrill | skrill/migrations/0002_auto__add_field_paymentrequest_payment_methods.py | Python | bsd-3-clause | 14,044 |
import exceptions
class LconfError (exceptions.Exception):
def __init__(self, args):
self.args = args
class OptionError (exceptions.Exception):
def __init__(self, args):
self.args = args
| behlendorf/lustre | lustre/utils/Lustre/error.py | Python | gpl-2.0 | 214 |
#!/usr/bin/env python
"""Generates the PDB structures given a LightDock swarm results file"""
import argparse
import os
import numpy as np
from lightdock.error.lightdock_errors import LightDockError
from lightdock.util.logger import LoggingManager
from lightdock.constants import DEFAULT_LIST_EXTENSION, DEFAULT_LIGHTD... | brianjimenez/lightdock | bin/post/lgd_generate_conformations.py | Python | gpl-3.0 | 7,790 |
#!/usr/bin/python
from __future__ import print_function
import sys
from PIL import Image
import math
try:
range = xrange
except:
pass
if len(sys.argv) <= 2:
print("Usage: ./cinemut-nm-decode.py <inputfile> <outputfile>")
sys.exit(0)
try:
import numpy
def encode(im, len=len):
im.load()
... | vinni-au/vega-strike | vegastrike/tools/cinemut-nm-decode.py | Python | gpl-2.0 | 2,052 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dailydream.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| KellyChan/python-examples | python/django/elf/dailydream/dailydream/manage.py | Python | mit | 253 |
class A(object):
__slots__ = ["a","b","c"]
def __init__(self):
self.a="x"
self.b="xx"
self.c="xxx"
def __str__(self):
"list all slot attributes"
return "\n".join(["%s: %s" %
... | gizela/gizela | example/code/slots.py | Python | gpl-3.0 | 560 |
import requests
import rdflib
from whyis import nanopub
import datetime
import pytz
import dateutil.parser
from dateutil.tz import tzlocal
from werkzeug.datastructures import FileStorage
from werkzeug.http import http_date
from setlr import FileLikeFromIter
import re
import os
from requests_testadapter import Resp
impo... | tetherless-world/graphene | whyis/importer/importer.py | Python | apache-2.0 | 3,304 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
from PyQt4.Qt import QTextCharFormat
from calibre.ebooks.oeb.base import OEB... | insomnia-lab/calibre | src/calibre/gui2/tweak_book/editor/__init__.py | Python | gpl-3.0 | 1,430 |
from django.http import HttpResponse
class IcalResponse(HttpResponse):
def __init__(self, data, **kwargs):
kwargs.setdefault('content_type', 'text/calendar')
data = data.to_ical()
super(IcalResponse, self).__init__(content=data, **kwargs)
| Inter-Actief/alexia | alexia/http/response.py | Python | bsd-3-clause | 269 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from imagekit.models import ProcessedImageField, ImageSpecField
from pilkit.processors import ResizeToFit, ResizeToFill
from bands.helpers import RandomFileName
from bands.models im... | InsulaCoworking/MusicCity | bands/models/professional.py | Python | gpl-2.0 | 2,695 |
"""
Tests of the neo.core.container.Container class
"""
import unittest
import numpy as np
try:
from IPython.lib.pretty import pretty
except ImportError as err:
HAVE_IPYTHON = False
else:
HAVE_IPYTHON = True
from neo.core.container import Container, unique_objs
class Test_unique_objs(unittest.TestCase... | samuelgarcia/python-neo | neo/test/coretest/test_container.py | Python | bsd-3-clause | 6,562 |
"""Base Command class, and related routines"""
import os
import sys
import tempfile
import traceback
import time
import optparse
from pip import cmdoptions
from pip.log import logger
from pip.download import PipSession
from pip.exceptions import (BadCommand, InstallationError, UninstallationError,
... | alquerci/pip | pip/basecommand.py | Python | mit | 6,530 |
##
##SMART FP7 - Search engine for MultimediA enviRonment generated contenT
##Webpage: http://smartfp7.eu
##
## 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/.
##... | SmartSearch/Edge-Node | LinkedDataManager/feed_generator/ldm_feeder.py | Python | mpl-2.0 | 8,016 |
import os
import json
import datetime
import pprint
import logging
log = logging.getLogger()
pp = pprint.PrettyPrinter()
class Cache(object):
def __init__(self, app, frequency):
self.app = app
self.frequency = frequency
self.data = self.init_data()
self.stored_data = self.read_... | hgn/hippod | hippod/cache_achievements.py | Python | mit | 8,131 |
# Simple test program to debug + play with assassination models.
from os import path
import sys
from pprint import pprint
sys.path.append(path.abspath(path.join(path.dirname(__file__), '..')))
from shadowcraft.calcs.rogue.Aldriana import AldrianasRogueDamageCalculator
from shadowcraft.calcs.rogue.Aldriana import setti... | Mystler/ShadowCraft-Engine | scripts/outlaw.py | Python | lgpl-3.0 | 4,715 |
import re
from valideer import *
class where(Pattern):
name = "where"
regexp = re.compile(r"[\w&<>|*/\+\-\(\)]+")
rp = re.compile(r"(\w+)")
def validate(self, value, adapt=True):
super(where, self).validate(value)
keys = self.rp.findall(value)
value = self.rp.sub(r'%(\1)s', val... | stevepeak/inquiry | inquiry/validators.py | Python | apache-2.0 | 1,497 |
#!/usr/bin/env python
'''
For Python 2.7
'''
import re, sys, os, glob, time
from twisted.web import server, resource
from twisted.internet import reactor
timestamp_re = re.compile("<!\[CDATA\[(\d+)\]\]>")
timestamp_format = "<![CDATA[{timestamp}]]>"
class BicingSimResource(resource.Resource):
isLeaf = True
... | juanrh/bicing-bcn | storm/ingestion/src/test/resources/bicing_test_service.py | Python | apache-2.0 | 1,975 |
import datetime
import numpy as np
# Class which can have attributes set.
class expando(object): pass
class Dataserver:
'''
Loads in and serves data between the dates indicated.
Forecast is returned for firstday for the period from
firstday + day_ahead_delta until day_ahead_period later.
'''
def __init__(s... | DTU-ELMA/European_Dataset | Scripts/Dataserver/data_server.py | Python | apache-2.0 | 3,189 |
import math
def main():
"""Main program"""
for n in xrange(1, 500):
for m in xrange(n + 1, 500):
a = int(math.pow(m, 2) - math.pow(n, 2))
b = 2 * m * n
c = int(math.pow(m, 2) + math.pow(n, 2))
if a + b + c == 1000:
product = a * b * c
print "a = %d, b = %d, c = %d" % (a, b, c)
print "Product ... | SenFuerte/dt211-3-cloud | Euler/Sol_nr9.py | Python | mit | 376 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('auth', '0006_require_contenttypes_0002'),
... | picobyte/photo-gallery | gallery/gallery/migrations/0011_auto_20150911_1700.py | Python | gpl-3.0 | 539 |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
program... | n1bor/bitcoin | contrib/gitian-build.py | Python | mit | 14,742 |
#!/Users/saz/Workspace/spaceapps/spaceapps/bin/python3.5
#
# The Python Imaging Library.
# $Id$
#
# convert image files
#
# History:
# 0.1 96-04-20 fl Created
# 0.2 96-10-04 fl Use draft mode when converting images
# 0.3 96-12-30 fl Optimize output (PNG, JPEG)
# 0.4 97-01-18 fl Made optimize an ... | saaqibz/SpaceApps2017 | bin/pilconvert.py | Python | mit | 2,396 |
from dmpr import DMPR
from dmpr.path import Path, LinkAttributes
class TestPath:
@staticmethod
def get_path():
return Path(path='A>[1]>B>[2]>C',
attributes=LinkAttributes({
'1': {'loss': 10},
'2': {'loss': 20}
}),... | protocollabs/dmpr-core | test_dmpr.py | Python | mit | 3,838 |
# -*- coding: utf-8; -*-
#
# Licensed to CRATE Technology GmbH ("Crate") under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. Crate licenses
# this file to you under the Apache License, Version 2.0 (the "License"... | mfelsche/crate-django | bootstrap.py | Python | apache-2.0 | 6,073 |
# -*- coding: utf-8 -*-
#
# Python BloomFilter documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 31 16:25:58 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fi... | raven47git/pybloomfiltermmap | docs/conf.py | Python | mit | 6,423 |
from __future__ import print_function, division
from sympy.core import Function, S, sympify
from sympy.core.add import Add
from sympy.core.containers import Tuple
from sympy.core.operations import LatticeOp, ShortCircuit
from sympy.core.function import (Application, Lambda,
ArgumentIndexError)
from sympy.core.expr... | kaushik94/sympy | sympy/functions/elementary/miscellaneous.py | Python | bsd-3-clause | 25,501 |
#
# 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... | MonoCloud/zipline | zipline/finance/trading.py | Python | apache-2.0 | 19,626 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer.functions import vae
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestGaussianKLDivergence(unittest.Te... | woodshop/chainer | tests/functions_tests/test_vae.py | Python | mit | 3,930 |
"""Utilities to help convert mp4s to fmp4s."""
import io
def find_box(segment: io.BytesIO, target_type: bytes, box_start: int = 0) -> int:
"""Find location of first box (or sub_box if box_start provided) of given type."""
if box_start == 0:
box_end = segment.seek(0, io.SEEK_END)
segment.seek(0... | tboyce021/home-assistant | homeassistant/components/stream/fmp4utils.py | Python | apache-2.0 | 5,317 |
"""
@package mi.instrument.nortek.driver
@file mi/instrument/nortek/driver.py
@author Bill Bollenbacher
@author Steve Foley
@author Ronald Ronquillo
@brief Base class for Nortek instruments
"""
__author__ = 'Rachel Manoni, Ronald Ronquillo'
__license__ = 'Apache 2.0'
import re
import time
import base64
from mi.core... | mikeh77/mi-instrument | mi/instrument/nortek/driver.py | Python | bsd-2-clause | 110,468 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your o... | FedoraScientific/salome-gui | src/GUI_PY/mytestdialog.py | Python | lgpl-2.1 | 5,327 |
from django.core.management import call_command
from celery import shared_task
@shared_task(ignore_result=False,
track_started=True)
def syncldap():
"""
Call the appropriate management command to synchronize the LDAP users
with the local database.
"""
call_command('syncldap')
| alexsilva/django-ldap-sync | ldap_sync/tasks.py | Python | bsd-3-clause | 313 |
# decodex - simple enigma decoder.
#
# Copyright (c) 2013 Paul R. Tagliamonte <tag@pault.ag>
#
# 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 ... | paultag/decodex | decodex/utils/words.py | Python | agpl-3.0 | 2,313 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | vicnet/weboob | modules/caissedepargne/browser.py | Python | lgpl-3.0 | 47,604 |
#############################################################################
##
## Copyright (C) 2015 The Qt Company Ltd.
## Contact: http://www.qt.io/licensing
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance wit... | xianian/qt-creator | tests/system/shared/utils.py | Python | lgpl-2.1 | 31,486 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-07-04 22:04
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', ... | BridgeCityBicycleCoop/workstand | registration/migrations/0001_initial.py | Python | mit | 3,388 |
# Copyright 2015 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... | tensorflow/tensorflow | tensorflow/python/framework/dtypes_test.py | Python | apache-2.0 | 15,671 |
# pylint: disable=W0232, R0903
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from accounts.models import User
from rest_framework.authtoken.models import Token
from common.forms import get_bootstrap_helper
class RegistrationForm(forms.ModelForm):
"""
A form that creates a u... | Turupawn/website | accounts/forms.py | Python | agpl-3.0 | 3,416 |
"""
WSGI config for Admirals project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | PhilMacKay/django-admirals | Admirals/Admirals/wsgi.py | Python | mit | 1,138 |
#
# utils.py
#
# Auxiliary functions for the `docmaker' tool (library file).
#
# Copyright 2002-2018 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
# modified, and distributed under the terms of the FreeType project
# license, LICENSE.TXT. By continuing to use, modify,... | joncampbell123/dosbox-rewrite | vs2015/freetype/src/tools/docmaker/utils.py | Python | gpl-2.0 | 3,513 |
from django.test import TestCase
from wellcom_app.models import Well, Note, DeviceData, WaterTest, Usage
from django.utils import timezone
from django.core.urlresolvers import reverse
from time import sleep
# Using this for Django testing guidance:
# https://realpython.com/blog/python/testing-in-django-part-1-best-pra... | WellConstructed/WellCom | wellcom_app/tests/tests.py | Python | mit | 3,019 |
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
f... | thiagopa/django-mumblr | mumblr/views/admin.py | Python | mit | 5,871 |
'''
Awesome people who have directly contributed to the project:
Jon Palmer - Bug finder & advice on project direction
Mahmut Uludag - Bug finder
Help: print pybam.wat
Github: http://github.com/JohnLonginotto/pybam
This code was written by John Longinotto, a PhD student of the Pospisilik Lab at the Max Plan... | JohnLonginotto/pybam | pybam.py | Python | apache-2.0 | 53,233 |
"""Support for MQTT JSON lights."""
from contextlib import suppress
import json
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_MODE,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_FLASH,
ATTR_HS_COLOR,
ATTR_RGB_COLOR,
ATTR_RGBW_COLO... | sander76/home-assistant | homeassistant/components/mqtt/light/schema_json.py | Python | apache-2.0 | 23,959 |
from django.shortcuts import render,get_object_or_404
from django.http import HttpResponse
from django.http import Http404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
#from django.template import RequestContext, loader
from .models import Question,Choice
# Cr... | DingYuanfang/Django-simple-liwu | polls/views0.py | Python | mit | 2,477 |
#!/usr/bin/env python
## \file filter_adjoint.py
# \brief Applies various filters to the adjoint surface sensitivities of an airfoil
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com).
# Dr. Thomas D. Ec... | cspode/SU2 | SU2_PY/SU2/util/filter_adjoint.py | Python | lgpl-2.1 | 16,651 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/homoludens/projekti/eric4/brePodder/DialogAdd.ui'
#
# Created: Wed Feb 6 01:40:43 2008
# by: PyQt4 UI code generator 4.3.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui
class Ui_Dialog... | homoludens/brePodder | Ui_DialogAdd.py | Python | gpl-3.0 | 2,216 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Openstack, LLC
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eB... | deepakselvaraj/federated-horizon | openstack_dashboard/api/nova.py | Python | apache-2.0 | 22,424 |
# app/data.py
from flask.ext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class CRUDMixin(object):
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True)
@classmethod
def create(cls, commit=True, **kwargs):
instance = cls(**kwargs)
return instance... | ChristopherGS/sensor_readings | app/data.py | Python | bsd-3-clause | 1,496 |
stopCodons = ['TAG', 'TAA', 'TGA']
translation = {'CTT': 'L', 'ATG': 'M', 'AAG': 'K', 'AAA': 'K', 'ATC': 'I', 'AAC': 'N', 'ATA': 'I', 'AGG': 'R', 'CCT': 'P', 'ACT': 'T', 'AGC': 'S', 'ACA': 'T', 'AGA': 'R', 'CAT': 'H', 'AAT': 'N', 'ATT': 'I', 'CTG': 'L', 'CTA': 'L', 'CTC': 'L', 'CAC': 'H', 'ACG': 'T', 'CAA': 'Q', 'AGT':... | louiejtaylor/pyViKO | pyviko/core.py | Python | mit | 6,958 |
#!/usr/bin/env python
"""
Tetris Tk - A tetris clone written in Python using the Tkinter GUI library.
Controls:
Left Arrow Move left
Right Arrow Move right
Down Arrow Move down
Up Arrow Drop Tetronimoe to the bottom
'a' Rotate anti-clockwise (to the left)
... | strommer/Python_rpi | tetris_tk.py | Python | gpl-2.0 | 17,632 |
from utils.voiceParser import *
COMMANDS = [
{
'aliases': ['please set', 'pls set', 'please','pls', 'go','set'],
'script': 'env python3 kodiCrud.py',
'hasArgs': True
},
{
'aliases': ['music','play music'],
'script': 'env python3 playYtPlaylist.py'
},
{
... | hamidzr/kodi-extras | voiceControl.py | Python | mit | 790 |
"""Tests for sudo handling of engage_utils.process and engage.drivers.action.
There are three modes that we can be running in:
1. If running as root, sudo actions will be transparently run directly
2. If running as normal user, but no password is needed for sudo access,
process utilities will call sudo -n.
3. If... | quaddra/engage | python_pkg/engage/tests/test_sudo.py | Python | apache-2.0 | 9,510 |
"""
Used for two things: 1. Locally for git workflow, 2. Update remote servers.
"""
from __future__ import with_statement
from fabric.api import *
from fabric.colors import *
from fabric.context_managers import cd, lcd
import os.path
HOST = '' # e.g. seb@bla.com
REMOTE_BASE_DIR = '/webapps/seb_django/www' # absolute ... | sschmeier/genomics-tutorial | fabfile.py | Python | mit | 5,363 |
# -*- coding: utf-8 -*-
## @package pil_exif
#
# pil_exif utility package.
# @author Tody
# @date 2016/07/22
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
## Exifデータの取得.
def getExif(file_path):
image = Image.open(file_path)
exif = image._getexif()
if exif is None:
... | tody411/PyIntroduction | lib/pil_exif.py | Python | mit | 895 |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
import socket
import socks
import os
class ehentai():
def request(self , url):
socks.set_default_proxy(socks.SOCKS5, "127.0.0.1", 1080)
socket.socket = socks.socksocket
# proxies = { "http": "http://127.0.0.1:1080", "ht... | Heshichun/ehentai_picker | ehentai.py | Python | gpl-2.0 | 1,943 |
from __future__ import absolute_import, unicode_literals
import logging
from django import forms
from django.contrib import messages
from django.http import Http404
from django.utils.encoding import smart_str
from easy_maps.models import Address
from . import lib
log = logging.getLogger(__name__)
class AddressFor... | jackton1/django_google_app | map_app/forms.py | Python | gpl-3.0 | 4,132 |
import numpy as np
from .VariableUnitTest import VariableUnitTest
from gwlfe.Output.Loading import NetDisLoad
class TestNetDisLoad(VariableUnitTest):
def test_NetDisLoad(self):
z = self.z
np.testing.assert_array_almost_equal(
NetDisLoad.NetDisLoad_f(z.NYrs, z.DaysMonth, z.Temp, z.Ini... | WikiWatershed/gwlf-e | test/unittests/test_NetDisLoad.py | Python | apache-2.0 | 1,093 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from pydispatch import dispatcher
class Context(object):
"""
The top context for all other entities.
"""
def __init__(self, agent):
self._agent = agent
self._attributes = {}
... | eavatar/ava | src/eavatar.ava/ava/spi/context.py | Python | bsd-3-clause | 2,110 |
from datetime import date, timedelta
from django.views.generic import DetailView, ListView
from django.views.generic.base import ContextMixin
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.db.models import F, Sum
from django.shortcuts import get_list_or_... | patricmutwiri/pombola | pombola/info/views.py | Python | agpl-3.0 | 4,079 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | sasha-gitg/python-aiplatform | schema/predict/instance/google/cloud/aiplatform/v1/schema/predict/instance_v1/types/video_object_tracking.py | Python | apache-2.0 | 2,394 |
#!/usr/bin/env python
# coding=utf-8
import argparse
import urllib2 # python 2.7
import re
import sqlite3
import traceback
import datetime
import csv
headers = { 'User-Agent' : 'Mozilla/5.0 (compatible; Googlebot/2.1;'
+' +http://www.google.com/bot.html)' }
... | ofaurax/LeechCoin | leechcoin.py | Python | gpl-3.0 | 12,394 |
"""
Tests for EmbargoMiddleware
"""
from contextlib import contextmanager
import mock
from nose.plugins.attrib import attr
import unittest
import pygeoip
import ddt
from django.conf import settings
from django.test.utils import override_settings
from django.core.cache import cache
from django.db import connection
fr... | synergeticsedx/deployment-wipro | openedx/core/djangoapps/embargo/tests/test_api.py | Python | agpl-3.0 | 13,295 |
"""
Script that patches a Keras HDF5 model file with parameter values
obtained from a TensorFlow saved model.
When I trained the neural networks for the MPG Ranch NFC Coarse Classifier
versions 3.0 and 4.0, I inadvertently saved untrained parameter values to
a Keras HDF5 model file instead of trained parameter values.... | HaroldMills/Vesper | vesper/mpg_ranch/nfc_coarse_classifier_3_1/patch_hdf5_model_from_saved_model.py | Python | mit | 3,802 |
# Copyright 2019 Fortinet, 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 version.
#
# This program is distributed in the... | thaim/ansible | test/units/modules/network/fortios/test_fortios_antivirus_settings.py | Python | mit | 5,944 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <bram@topydo.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, either version 3 of the License,... | bram85/topydo | topydo/lib/PrettyPrinterFilter.py | Python | gpl-3.0 | 1,130 |
"""
Lamina module
When you set the display mode for OpenGL, you enable all the coolness of 3D rendering,
but you disable the bread-and-butter raster SDL functionality like fill() and blit().
Since the GUI libraries use those surface methods extensively, they cannot readily be
used in OpenGL displays.
Lamin... | alexdu/robot-sandbox | sim-files/lamina.py | Python | gpl-3.0 | 16,152 |
# Copyright 2017 Vector Creations 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 applicable law or agreed to in ... | matrix-org/synapse | synapse/groups/attestations.py | Python | apache-2.0 | 8,299 |
from abc import abstractmethod
from neupy.utils import preformat_value
from neupy.helpers.logs import Verbose
from .config import ConfigurableABC
__all__ = ('BaseSkeleton',)
class BaseSkeleton(ConfigurableABC, Verbose):
""" Base class for neural network algorithms.
Methods
-------
fit(\*args, \*\*... | stczhc/neupy | neupy/core/base.py | Python | mit | 2,210 |
from model.base import Distro, Package
from util import tree
import logging
import os
from os import path
import urllib
import error
from deb.version import Version
import config
logger = logging.getLogger('model.debian')
class DebianDistro(Distro):
"""An ordinary Debian derivative, with no OBS integration."""
d... | dbnicholson/merge-our-misc | model/debian.py | Python | gpl-3.0 | 413 |
#!/usr/bin/env python
#
# Protein Engineering Analysis Tool DataBase (PEATDB)
# Copyright (C) 2010 Damien Farrell & Jens Erik Nielsen
#
# 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 ver... | dmnfarrell/peat | PEATDB/Ekin/Ekin_map.py | Python | mit | 23,383 |
REQUIREMENT_SCHEMA = {
'description': 'A set of requirement definitions',
'type': ['object', 'null'],
'addtionalProperties': {
'required': ['reason', 'key', 'equals'],
'properties': {
'reason': {
'description':
'Human-readable motivation for th... | thiderman/piper | piper/schema.py | Python | mit | 804 |
from django.forms import widgets
from rest_framework import serializers
from coopInfo.models import Person, State, Cooperative
class PersonSerializer(serializers.ModelSerializer):
class Meta:
model = Person
fields = ('id', 'coopId', 'name', 'ethnicity', 'distric', 'title', 'inBoardSince', 'picture'... | antoineclaval/ruralpowerproject | ruralpowerproject/coopInfo/serializers.py | Python | bsd-3-clause | 876 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fabric.tasks import Task
from fabric.contrib import console
from fabric import colors, operations, state, api
from fabric.api import local, run, cd, lcd, env, output, hide, show, warn_only
from fabpress import utils
import os, sys, json
def strtobool(v):
try:
... | EliotBerriot/fabpress | fabpress/tasks/base.py | Python | bsd-3-clause | 16,731 |
#!/usr/bin/env python3
import math
from functools import cmp_to_key, partial
PRECISION = 2**(-10)
def float_eq(a, b):
"""Check if two floats are equal within a certain accuracy."""
return abs(a - b) < PRECISION
def point_eq(a, b):
"""Check if two points are equal within a certain accuracy."""
return... | moyamo/polygon2square | geometry.py | Python | mit | 16,498 |
from ruffus import *
import pandas as pd
from util.util import file_by_type
import datatables.traveltime
import pipeline.data_bt
import pipeline.data_vs
# BLUETH_YYYYMMDD.traveltime, VSDATA_YYYYMMDD.volume -> YYYYMMDD.merged
@collate([pipeline.data_bt.import_bt, pipeline.data_vs.import_vs],
regex(r"^data/(BLU... | anjsimmo/simple-ml-pipeline | pipeline/data_merged.py | Python | mit | 875 |
#!/usr/bin/env python
# Copyright (c) 2009 Six Apart Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this lis... | alex/remoteobjects | examples/giantbomb.py | Python | bsd-3-clause | 5,184 |
import codecs
import glob
import os
from setuptools import setup, find_packages
# Prevent spurious errors during `python setup.py test`, a la
# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html:
try:
import multiprocessing
except ImportError:
pass
def read(fname):
fpath = os.path.join(os.path... | KaiRo-at/socorro | setup.py | Python | mpl-2.0 | 2,021 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
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 righ... | alexforencich/python-ivi | ivi/tektronix/tektronixDPO71604B.py | Python | mit | 1,563 |
# Copyright 2019 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... | tensorflow/tensorflow | tensorflow/python/tpu/tpu_test_wrapper_test.py | Python | apache-2.0 | 6,127 |
"""Parent class for every Overkiz device."""
from __future__ import annotations
from enum import unique
from typing import cast
from pyoverkiz.enums import OverkizAttribute, OverkizState
from pyoverkiz.models import Device
from homeassistant.backports.enum import StrEnum
from homeassistant.helpers.entity import Devi... | rohitranjan1991/home-assistant | homeassistant/components/overkiz/entity.py | Python | mit | 4,412 |
import math
import time
t1 = time.time()
# f(0) = 1 000
# f(1) = 1 001
# f(2) = 2 010
# f(3) = 1 011
# f(4) = 3 100
# f(5) = 2 101
# f(6) = 3 110
# f(7) = 1 111
# f(8) = 4 1000
def tobin(n):
if n == 0:
return [0]
r = []
while n != 0:
if n%2 == 0:
r... | Adamssss/projectEuler | pb169.py | Python | mit | 1,470 |
import os
import tempita
import re
def instantiate_template(name, **args):
path = os.path.join(os.path.dirname(__file__), name)
with file(path) as f:
template = f.read()
code = tempita.sub(template, **args)
# Strip comments
code, n = re.subn(r'/\*.*?\*/', '', code, flags=re.DOTALL)
# S... | wavemoth/wavemoth | wavemoth/cuda/core.py | Python | gpl-2.0 | 563 |
#!/usr/bin/env python
"""Load all aff4 objects in order to populate the registry.
"""
# pylint: disable=unused-import
from grr.lib.aff4_objects import aff4_grr
from grr.lib.aff4_objects import collects
from grr.lib.aff4_objects import cronjobs
from grr.lib.aff4_objects import filestore
from grr.lib.aff4_objects import ... | pidydx/grr | grr/lib/aff4_objects/registry_init.py | Python | apache-2.0 | 583 |
# noinspection PyPackageRequirements
from Crypto.Cipher import AES
import base64
#AES256
BLOCK_SIZE = 32
PADDING = '{'
DECRYPTION_CHECK = "|PASSMON|"
def aes_encrypt(word, key):
"""Encrypts password"""
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
encode_aes = lambda c, s: base64.b64encode(c.enc... | Plasticoo/Pass_Shelter3 | src/encryption/aes_encryption.py | Python | mit | 936 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.