repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
zionist/mon | mon/apps/build/migrations/0012_auto__chg_field_ground_developer__del_field_copybuilding_building_stat.py | # -*- 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):
# Changing field 'Ground.developer'
db.alter_column(u'build_ground', 'de... |
liamfraser/lantex | parser/grako.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# CAVEAT UTILITOR
# This file was automatically generated by Grako.
# https://bitbucket.org/apalala/grako/
# Any changes you make to it will be overwritten the
# next time the file is generated.
#
from __future__ import print_function, division, absolute_import, unico... |
colour-science/colour | colour/models/rgb/transfer_functions/cineon.py | """
Kodak Cineon Encoding
=====================
Defines the *Kodak Cineon* encoding:
- :func:`colour.models.log_encoding_Cineon`
- :func:`colour.models.log_decoding_Cineon`
References
----------
- :cite:`SonyImageworks2012a` : Sony Imageworks. (2012). make.py. Retrieved
November 27, 2014, from
https://... |
cedriclaunay/gaffer | python/GafferTest/SequencePathTest.py | ##########################################################################
#
# Copyright (c) 2012-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... |
DemocracyClub/EveryElection | every_election/apps/elections/migrations/0052_auto_20181005_1645.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-05 16:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("elections", "0051_auto_20181005_1618")]
operations = [
migrations.AlterModelOptions(
... |
jokey2k/sentry | src/sentry/utils/pytest.py | from __future__ import absolute_import
import mock
import os
from django.conf import settings
def pytest_configure(config):
os.environ['RECAPTCHA_TESTING'] = 'True'
if not settings.configured:
os.environ['DJANGO_SETTINGS_MODULE'] = 'sentry.conf.server'
# only configure the db if its not al... |
rapidpro/rapidpro-python | temba_client/utils.py | import json
import iso8601
import pytz
import requests
def parse_iso8601(value):
"""
Parses a datetime as a UTC ISO8601 date
"""
if not value:
return None
return iso8601.parse_date(value)
def format_iso8601(value):
"""
Formats a datetime as a UTC ISO8601 date or returns None if... |
EtienneCmb/tensorpac | examples/misc/plot_itc.py | """
================================================
Compute and plot the Inter-Trial Coherence (ITC)
================================================
This example illustrate how to compute and plot the Inter-Trial Coherence
(ITC). The ITC can be used to inspect if phases are aligned across trials or
said differently,... |
nuagenetworks/bambou | tests/functionnal/enterprise/test_create_enterprise.py | # -*- coding: utf-8 -*-
from unittest import TestCase
from mock import patch
from bambou.exceptions import BambouHTTPError
from tests.utils import MockUtils
from tests.functionnal import start_session, get_valid_enterprise
class Create(TestCase):
@classmethod
def setUpClass(self):
self.user = start... |
michalbachowski/pyevent | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
# monkey patch os.link to force using symlinks
import os
del os.link
setup(name='PyEvent',
url='https://github.com/michalbachowski/pyevent',
version='1.0.0',
description='Python implementation of PHP`s (from Symfony Components) E... |
ODM2/ODM2WebSDL | src/hydroshare_util/resource.py | import logging
import os
import json
from django.http import Http404
from tempfile import mkstemp
from re import search as regex_search
from hs_restclient import HydroShareNotFound, HydroShareNotAuthorized
from hydroshare_util.adapter import HydroShareAdapter
from . import HydroShareUtilityBaseClass
from coverage impor... |
harvard-vpal/bridge-adaptivity | bridge_adaptivity/config/settings/local.py | # flake8: noqa: F405
from config.settings.base import * # noqa: F403
TEST_RUNNER = 'config.test_runner.PytestTestRunner'
SECRET_KEY = secure.SECRET_KEY
DATABASES = secure.DATABASES
# Configure Bridge host with is used for lis_outcome_service_url composition
BRIDGE_HOST = secure.BRIDGE_HOST
try:
# Engine for A... |
Boberito25/ButlerBot | rosbuild_ws/src/behaviors/src/behaviors/msg/_Completed.py | """autogenerated by genpy from behaviors/Completed.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class Completed(genpy.Message):
_md5sum = "5360d8dc63ebb508e9d3b0ff75130e31"
_type = "behaviors/Completed"
_has_header = False #flag to mark the ... |
etonello/crnpy | tests/test_complex.py | #!/usr/bin/env python
"""Tests for Reaction class."""
import unittest
import sympy as sp
from crnpy.crn import CRN, from_react_file
from crnpy.crncomplex import Complex
from crnpy.parsereaction import parse_complex, parse_expr
__author__ = "Elisa Tonello"
__copyright__ = "Copyright (c) 2016, Elisa Tonello"
__licen... |
bischjer/auxiliary | aux/api/__init__.py | import paramiko
from aux.protocol.http import HTTPClient
from aux.protocol.ssh import SSHClient
# def run(engine, func, *args, **kwargs):
# engine.start()
# try:
# func(*args, **kwargs)
# finally:
# results = engine.stop()
# return results
ssh = SSHClient()
http = HTTPClient()
|
ustudio/nose_connection_report | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name="nose_connection_report",
version="0.2",
description = "Nose testing framework plugin for monitoring network connections",
author = "Thomas Stephens, John J. Lee, Dan McCombs",
author_email = "thomas@ustudio.com",
license = "BSD",... |
YouNeedToSleep/sleepy | src/sleepy/conf/development.py | from sleepy.conf.base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sleepy_dev',
}
}
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '' # noqa
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
SOCIAL_AUTH_TWITTER_KEY = ''
SOCIAL_AUT... |
carrerasrodrigo/torrent_scrapper | torrent_scrapper/Browser.py | import requests
from bs4 import BeautifulSoup
class Browser:
def __init__(self):
self.session = requests.Session()
def get(self, url, params=None):
f = self.session.get(url, params=params)
return f.content
def post(self, url, params=None):
pass
def get_soup(self, ur... |
sunlightlabs/tcamp | tcamp/camp/management/commands/exportenv.py | import re
import json
import sys
import StringIO
from importlib import import_module
from optparse import make_option
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = '''Serializes individual settings items into json-safe
strings suitable for dumping into a .en... |
kaushik94/sympy | sympy/strategies/core.py | """ Generic SymPy-Independent Strategies """
from __future__ import print_function, division
from sympy.core.compatibility import get_function_name
identity = lambda x: x
def exhaust(rule):
""" Apply a rule repeatedly until it has no effect """
def exhaustive_rl(expr):
new, old = rule(expr), expr
... |
quantmind/pulsar | pulsar/cmds/pypi_version.py | """Check PyPI version
"""
from distutils.cmd import Command
from distutils.errors import DistutilsError
try:
from xmlrpc.client import ServerProxy
except ImportError:
from xmlrpclib import ServerProxy
class InvalidVersion(DistutilsError):
pass
class PyPi(Command):
description = (
'Validate ... |
swarna-k/MyDiary | db_repository/versions/005_migration.py | from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
entry = Table('entry', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('name', String(length=100)),
Column('body', String(length=5000)),
Column('t... |
pdebuyl/pyh5md | pyh5md/h5md_module.py | import numpy as np
import h5py
CHUNK_0_MAX=32
CHUNK_1_MAX=128
class Element(object):
def append(self, *args, **kwargs):
raise NotImplementedError
class FixedElement(h5py.Dataset, Element):
def __init__(self, loc, name, **kwargs):
if name in loc:
d = loc[name]
else:
... |
klusta-team/kwiklib | setup.py | from setuptools import setup
setup(
name='kwiklib',
version='0.3.7',
author='KwikTeam',
author_email='rossant@github',
packages=[
'kwiklib',
'kwiklib.dataio',
'kwiklib.dataio.tests',
'kwiklib.scripts',
'kwiklib.utils',
... |
ihuston/pyflation | pyflation/analysis/test/test_nonadiabatic.py | """ test_nonadiabatic - Test functions for nonadiabatic module
"""
#Author: Ian Huston
#For license and copyright information see LICENSE.txt which was distributed with this file.
import numpy as np
from numpy.testing import assert_, assert_raises, \
assert_equal,\
... |
DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_wakefield.py | from data_importers.management.commands import BaseDemocracyCountsCsvImporter
class Command(BaseDemocracyCountsCsvImporter):
council_id = "WKF"
addresses_name = (
"2021-03-24T10:33:03.462547/Democracy Club Polling Districts 24_03_21.csv"
)
stations_name = (
"2021-03-24T10:33:03.462547/... |
davebridges/ExperimentDB | external/views.py | '''This app contains the views for the external app.
'''
from django.views.generic import DetailView, CreateView, UpdateView, DeleteView, ListView
from braces.views import LoginRequiredMixin, PermissionRequiredMixin
from external.models import Reference, Vendor, Contact
class PaperListView(ListView):
'''This class... |
kfranson/TNODatabase | TNODatabase/TNODatabase.py | from __future__ import print_function
from __future__ import division
import easyaccess as ea
import pandas as pd
import numpy as np
import ephem
from Orbit import Orbit
from calendar import monthrange
from MPCRecord import MPCToTNO
from astropy.coordinates import SkyCoord
class Connect:
"""
Interacts with TN... |
GenericMappingTools/gmt-python | examples/projections/misc/misc_mollweide.py | """
Mollweide
=========
This pseudo-cylindrical, equal-area projection was developed by the German
mathematician and astronomer Karl Brandan Mollweide in 1805. Parallels are unequally
spaced straight lines with the meridians being equally spaced elliptical arcs. The
scale is only true along latitudes 40°44’ north and ... |
pnelson/flask-passport | setup.py | """
Flask-Passport
--------------
Flask authorization and authentication helpers.
"""
from setuptools import setup
setup(
name="Flask-Passport",
version="0.1.0",
url="https://github.com/pnelson/flask-passport",
license="BSD",
author="Philip Nelson",
author_email="me@pnelson.ca",
descripti... |
PacificBiosciences/rDnaTools | src/pbrdna/utils.py | import os
import sys
import logging
from collections import namedtuple
BlasrM1 = namedtuple('BlasrM1', ['qname', 'tname', 'qstrand', 'tstrand',
'score', 'pctsimilarity',
'tstart', 'tend', 'tlength',
'qstart', 'qend', 'q... |
DLR-SC/DataFinder | test/unittest/datafinder_test/persistence/common/__init__.py | # $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... |
arocchi/Klampt | Python/klampt/cspace.py | """This module provides convenient access to the motionplanning module
functionality by defining the CSpace and MotionPlan classes."""
import motionplanning
import random
class CSpace:
"""Used alongside MotionPlan to define a configuration space for
motion planning.
Attributes:
- eps: the collisio... |
JohnRandom/django-aggregator | dasdocc/aggregator/templatetags/aggregates.py | try: from settings import aggregate_feeds_template
except ImportError: from dasdocc.aggregator.aggregator_settings import aggregate_feeds_template
import ttag
from django import template
from django.conf import settings
from dasdocc.aggregator.models import Feed, Entry, StaticContent as StaticContentModel
register = ... |
stscieisenhamer/ginga | ginga/rv/plugins/Pan.py | #
# Pan.py -- Pan plugin for fits viewer
#
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys
import traceback
import math
from ginga.BaseImage import BaseImage
from ginga.gw import Widgets, Viewers
from ginga.misc import Bunch
from ginga import Ging... |
adamrp/american-gut-web | amgut/lib/data_access/ag_data_access.py | from __future__ import division
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The American Gut Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------... |
wrboyce/hueman | docs/conf.py | # -*- coding: utf-8 -*-
import hueman
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (na... |
sievetech/hived | tests/test_log.py | import json
import unittest
import mock
from hived.log import json_handler, JsonFormatter
class SampleObject:
def __repr__(self):
return "I'm an object"
class ISOObject(SampleObject):
def isoformat(self):
return "ISOFORMAT"
class Record:
def __init__(self, msg, event=None):
se... |
SimonSapin/cairocffi | cairocffi/test_xcb.py | """
cairocffi.test_xcb
~~~~~~~~~~~~~~~~~~
Test suite for cairocffi.xcb.
:copyright: Copyright 2014-2019 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
import os
import time
import pytest
xcffib = pytest.importorskip('xcffib') # noqa
import xcffib.xproto # noqa isort:skip
from xc... |
Pytwitcher/pytwitcherapi | test/test_chat_message.py | import pytest
from pytwitcherapi import chat
from pytwitcherapi.chat import message
@pytest.mark.parametrize('text,expected', [('hallo!', 'hallo!'),
('ciao bella', 'ciao ...')])
def test_repr(text, expected):
source = chat.Chatter('me')
target = '#you'
msg = mes... |
youtube/cobalt | third_party/llvm-project/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py | """Show bitfields and check that they display correctly."""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class BitfieldsTestCase(TestBase):
mydir = TestBase.compute_mydi... |
awesto/django-shop | shop/admin/defaults/commodity.py | from django.conf import settings
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from adminsortable2.admin import SortableAdminMixin
from cms.admin.placeholderadmin import PlaceholderAdminMixin, FrontendEditableAdminMixin
from shop.admin.product import CMSPageAsCategoryMixin, Uni... |
cuauv/software | libshm/generate_dshm.py | #!/usr/bin/env python3
# generate_dshm.py parses the file at libshm/vars.conf using libshm/parse.py
# and generates:
# - dshm_index
# - c/dshm.h
# - c/dshm.c
# Note: this imposes the following additional "restrictions" on vars.conf:
# - groups and variables names are case insensitive
# - "__" (double underscore) is i... |
endlessm/chromium-browser | third_party/catapult/third_party/gsutil/gslib/addlhelp/apis.py | # -*- coding: utf-8 -*-
# Copyright 2014 Google 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 require... |
unomena/unobase | unobase/support/urls.py | __author__ = 'michael'
from django.conf.urls.defaults import patterns, url
from unobase.support import views, forms
from unobase.mixins import login_required
urlpatterns = patterns('',
# Case request
url(r'^overview/$',
views.CaseList.as_view(
template_name='support/case/case_list.html')... |
WaveBlocks/WaveBlocksND | examples/henon_heiles/eigenstates[eps=0.5].py | dimension = 2
ncomponents = 1
potential = "henon_heiles"
eigenstate_of_level = 0
eigenstates_indices = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
starting_point = [0, 0]
eps = 0.5
hawp_template = {
"type": "HagedornWavepacket",
"dimension": dimension,
"ncomponents": ncomponents,
"eps": eps,
"b... |
ConnorMcMahon/geoinference | python/src/geolocate/geolocation/geo_median.py | __author__ = 'joh12041'
# Code largely taken from: https://gist.github.com/endolith/2837160
# with some help from https://github.com/ahwolf/meetup_location/blob/master/code/geo_median.py
# and adapted to support great circle distances over Euclidean.
from geopy.distance import vincenty
from geopy.distance import gr... |
jbittel/base32-crockford | setup.py | #!/usr/bin/env python
from setuptools import setup
import base32_crockford
setup(
name='base32-crockford',
version='0.3.0',
description=("A Python implementation of Douglas Crockford's "
"base32 encoding scheme"),
long_description=base32_crockford.__doc__,
license='BSD',
aut... |
andresriancho/billiard | billiard/reduction.py | #
# Module which deals with pickling of objects.
#
# multiprocessing/reduction.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
import functools
import io
import os
import pickle
import socket
import sys
__all__ = ['send_handle', 'recv... |
the-it-dude/django_rest_hipchat | django_rest_hipchat/migrations/0006_installation_integration.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-01 07:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_rest_hipchat', '0005_installation_uninstalled'),
... |
qedsoftware/commcare-hq | custom/ilsgateway/zipline/reports/zipline_report.py | from corehq.apps.reports.datatables import DataTablesHeader
from corehq.apps.reports.generic import GenericTabularReport
from corehq.apps.reports.standard import CustomProjectReport, DatespanMixin
from corehq.toggles import EMG_AND_REC_SMS_HANDLERS
class ZiplineReport(CustomProjectReport, GenericTabularReport, Datesp... |
geggo/pyface | pyface/ui/qt4/tasks/split_editor_area_pane.py | # Standard library imports.
import sys
# Enthought library imports.
from pyface.tasks.i_editor_area_pane import IEditorAreaPane, \
MEditorAreaPane
from traits.api import Bool, cached_property, Callable, Dict, Instance, List, \
on_trait_change, Property, provides, Str
from pyface.qt import QtCore, QtGui
from py... |
squirrelo/qiita | qiita_db/base.py | r"""
Base objects (:mod: `qiita_db.base`)
====================================
..currentmodule:: qiita_db.base
This module provides base objects for dealing with any qiita_db object that
needs to be stored on the database.
Classes
-------
..autosummary::
:toctree: generated/
QiitaObject
QiitaStatusObje... |
sideffect0/django-tastypie | tastypie/resources.py | from __future__ import unicode_literals
from __future__ import with_statement
from copy import deepcopy
from datetime import datetime
import logging
from time import mktime
import warnings
from wsgiref.handlers import format_date_time
import django
from django.conf import settings
from django.conf.urls import patterns... |
fenceFoil/canopto | tiletest.py | import pygame
from pygame.locals import *
import wx
import sys, os
if sys.platform == 'win32' or sys.platform == 'win64':
os.environ['SDL_VIDEO_CENTERED'] = '1'
pygame.init()
icon = pygame.Surface((1,1)); icon.set_alpha(0); pygame.display.set_icon(icon)
pygame.display.set_caption("TileTest - Ian Mallett")
def Choo... |
SEL-Columbia/commcare-hq | corehq/apps/app_manager/exceptions.py | import couchdbkit
class AppManagerException(Exception):
pass
class VersioningError(AppManagerException):
"""For errors that violate the principles of versioning in VersionedDoc"""
pass
class ModuleNotFoundException(AppManagerException, IndexError):
pass
class FormNotFoundException(AppManagerExce... |
mmcloughlin/finsky | finsky/protos/legal_message_outer_class_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: legal_message_outer_class.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import re... |
CGATOxford/CGATPipelines | CGATPipelines/pipeline_docs/pipeline_template/trackers/TemplateReport.py |
from CGATReport.Tracker import *
from CGATReport.Utils import PARAMS as P
###################################################################
###################################################################
# parameterization
EXPORTDIR = P['template_exportdir']
DATADIR = P['template_datadir']
DATABASE = P['templ... |
pferreir/indico | indico/modules/events/papers/operations.py | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import mimetypes
from operator import attrgetter
from flask import session
from indico.core.db import db... |
waldocollective/swiftwind | swiftwind/core/management/commands/run_scheduler.py | import logging
import schedule
import time
from django.core.management.base import BaseCommand
from swiftwind.accounts.tasks import import_tellerio
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Run the scheduler which executes periodic tasks'
def handle(self, *args, **options):
... |
toumorokoshi/transmute-core | transmute_core/tests/test_handler.py | import json
import pytest
from transmute_core.handler import process_result
from transmute_core import default_context, APIException, Response
CONTENT_TYPE = "application/json"
class SomeOtherException(Exception):
pass
def test_process_result_200(complex_transmute_func):
result = {"kind": "dog", "age": 5}
... |
vaporry/pydevp2p | devp2p/app.py | from UserDict import IterableUserDict
from service import BaseService
from slogging import get_logger
import utils
import crypto
from devp2p import __version__
log = get_logger('app')
class BaseApp(object):
default_config = dict(client_version='pydevp2p {}'.format(__version__),
deactiva... |
yunlongliukm/chm1_scripts | Genotyping/CombineCountFiles.py | #!/usr/bin/env python
import sys
import argparse
ap = argparse.ArgumentParser(description="Combine multiple .count files into one.")
ap.add_argument("--input", help="input files", nargs="+")
ap.add_argument("--output", help="output files")
args = ap.parse_args()
def GetLines(filename):
f = open(filename)
r... |
engineer0x47/SCONS | engine/SCons/Tool/gdc.py | """SCons.Tool.gdc
Tool-specific initialization for the GDC compiler.
(https://github.com/D-Programming-GDC/GDC)
Developed by Russel Winder (russel@winder.org.uk)
2012-05-09 onwards
Compiler variables:
DC - The name of the D compiler to use. Defaults to gdc.
DPATH - List of paths to search for import modules... |
spacy-io/spaCy | spacy/lang/nb/syntax_iterators.py | from typing import Union, Iterator
from ...symbols import NOUN, PROPN, PRON
from ...errors import Errors
from ...tokens import Doc, Span
def noun_chunks(doclike: Union[Doc, Span]) -> Iterator[Span]:
"""Detect base noun phrases from a dependency parse. Works on Doc and Span."""
# fmt: off
labels = ["nsubj... |
edx/django-oauth2-provider | provider/oauth2/admin.py | from django.contrib import admin
from provider.oauth2.models import AccessToken, Grant, Client, RefreshToken
@admin.register(AccessToken)
class AccessTokenAdmin(admin.ModelAdmin):
list_display = ('user', 'client', 'token', 'expires', 'scope',)
raw_id_fields = ('user',)
@admin.register(Grant)
class GrantAdm... |
bittner/django-allauth | allauth/socialaccount/providers/ynab/views.py | import requests
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from .provider import YNABProvider
class YNABOAuth2Adapter(OAuth2Adapter):
provider_id = YNABProvider.id
access_token_url = 'https://app.youneedabudget.com/oauth/token... |
nlgcoin/guldencoin-official | contrib/zmq/zmq_sub.py | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
ZMQ example using python3's asyncio
Bitcoin should be started with the command line argument... |
jemdwood/cs234_proj | viewer.py | import pyglet
class SimpleImageViewer(object):
"""
Modified version of gym viewer to chose format (RBG or I)
see source here https://github.com/openai/gym/blob/master/gym/envs/classic_control/rendering.py
"""
def __init__(self, display=None):
self.window = None
self.isope... |
chilland/scraper | scraper_sched.py | from functools import wraps
import errno
import os
import signal
from scraper import run_scraper
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
class TimeoutError(Exception):
pass
def timeout(seconds=10, error_message=os.strerror(errno.ETIME)):
... |
Cyberbio-Lab/bcbio-nextgen | bcbio/variation/recalibrate.py | """Perform quality score recalibration with the GATK toolkit.
Corrects read quality scores post-alignment to provide improved estimates of
error rates based on alignments to the reference genome.
http://www.broadinstitute.org/gsa/wiki/index.php/Base_quality_score_recalibration
"""
import os
import toolz as tz
from ... |
romansalin/django-seo | djangoseo/admin.py | from __future__ import unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.contenttypes.forms import BaseGenericInlineFormSet
from django.contrib.contenttypes.admin import GenericStackedInline
from django.contrib.contenttypes.models import ContentType
from django.utils.encodi... |
p-lauer/spotpy | spotpy/examples/spot_setup_cmf1d.py | '''
Copyright 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
A one dimensional cmf model analysing data from the FACE experiment.
You need to have cmf installed on your system: svn checkout svn://fb09-pasig.umwelt.uni-giessen.de/cmf/trunk cmf
'''
imp... |
barthisrael/OmniDB | OmniDB/OmniDB/runtime_settings.py | import os, shutil
from . import custom_settings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if custom_settings.DEV_MODE:
HOME_DIR = BASE_DIR
elif custom_settings.HOME_DIR:
HOME_DIR = custom_settings.HOME_DIR
else:
if custom_settings.DESKTOP_MODE:
HOME_DIR = os.path.join(... |
parlar/calls2xls | external/CrossMap/usr/lib64/python2.7/site-packages/cmmodule/annoGene.py | import collections
from bx.intervals import *
from cmmodule import BED
'''Compare given bed entry to reference gene model'''
def getCDSExonFromFile(bedfile):
'''Only Extract CDS exon regions from input bed file (must be 12-column).'''
ret_lst=[]
for f in open(bedfile,'r'):
f = f.strip().split()
chrom = f[0... |
lmazuel/azure-sdk-for-python | azure-cognitiveservices-search-websearch/azure/cognitiveservices/search/websearch/models/web_page.py | # 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 ... |
jontyjashan/PiNN_Caffe2 | pinn/exporter.py | import caffe2_paths
import numpy as np
from caffe2.python import workspace, core, model_helper, brew, optimizer, utils
from caffe2.proto import caffe2_pb2
def load_net(INIT_NET, PREDICT_NET):
init_def = caffe2_pb2.NetDef()
with open(INIT_NET, 'r') as f:
init_def.ParseFromString(f.read())
#init_def.devic... |
jmluy/xpython | exercises/concept/ghost-gobble-arcade-game/.meta/exemplar.py | def eat_ghost(power_pellet_active, touching_ghost):
"""
:param power_pellet_active: bool - does the player have an active power pellet?
:param touching_ghost: bool - is the player touching a ghost?
:return: bool
"""
return power_pellet_active and touching_ghost
def score(touching_power_pell... |
PIVX-Project/PIVX | test/functional/rpc_spork.py | #!/usr/bin/env python3
# Copyright (c) 2019-2020 The PIVX developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from time import sleep
from test_framework.test_framework import PivxTestFramework
from test_framework.util impo... |
futureshocked/RaspberryPi-FullStack | env_log.py | #!/usr/bin/env python
'''
FILE NAME
env_log.py
1. WHAT IT DOES
Takes a reading from a DHT sensor and records the values in an SQLite3 database using a Raspberry Pi.
2. REQUIRES
* Any Raspberry Pi
* A DHT sensor
* A 10kOhm resistor
* Jumper wires
3. ORIGINAL WORK
Raspberry Full stack 2015, Peter Dalmaris
4. HARDW... |
shl198/Pipeline | RibosomeProfilePipeline/04_Proteomaps.py | from __future__ import division
import os
import pandas as pd
from natsort import natsorted
from f02_RiboDataModule import *
#===============================================================================
# 1. generate count data for day3 and day6 proteomaps
#=================================... |
Schevo/schevo | bootstrap.py | ##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... |
dvro/UnbalancedDataset | imblearn/under_sampling/tests/test_cluster_centroids.py | """Test the module cluster centroids."""
from __future__ import print_function
import numpy as np
from numpy.testing import assert_raises
from numpy.testing import assert_equal
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_warns
from ... |
michaelBenin/django-pipeline | setup.py | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='django-pipeline',
version='1.3.12',
description='Pipeline is an asset packaging library for Django.',
long_description=open('README.rst').read() + '\n\n' +
open('HISTORY.rst').read(),
author='Timothée Peignier... |
datalogics/scons | test/Builder/multi/same-overrides.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... |
anuragpapineni/Hearthbreaker-evolved-agent | neat-python-read-only/neat/chromosome.py | import random
import math
from .config import Config
from . import genome
# Temporary workaround - default settings
#node_gene_type = genome.NodeGene
conn_gene_type = genome.ConnectionGene
class Chromosome(object):
""" A chromosome for general recurrent neural networks. """
_id = 0
def __init__(self, pare... |
bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib_pypy/pyrepl/reader.py | # Copyright 2000-2010 Michael Hudson-Doyle <micahel@gmail.com>
# Antonio Cuni
# Armin Rigo
#
# All Rights Reserved
#
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose is hereby granted without fe... |
JohnTroony/nikola | nikola/plugins/loghandler/stderr.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2015 Daniel Devine and others.
# 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... |
pbanaszkiewicz/amy | amy/workshops/migrations/0190_auto_20190728_1118.py | # Generated by Django 2.1.7 on 2019-07-28 11:18
from django.db import migrations, models
import django.db.models.deletion
def new_mix_match_curriculum(apps, schema_editor):
"""Add new mix & match Curriculum entry."""
Curriculum = apps.get_model('workshops', 'Curriculum')
Curriculum.objects.create(
... |
filipeximenes/talk_testing_web_apis | awesomebikes/awesomebikes/urls.py | """awesomebikes URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
sightmachine/LightGBM | examples/python-guide/advanced_example.py | # coding: utf-8
# pylint: disable = invalid-name, C0111
import lightgbm as lgb
import pandas as pd
import numpy as np
# load or create your dataset
print('Load data...')
df_train = pd.read_csv('../binary_classification/binary.train', header=None, sep='\t')
df_test = pd.read_csv('../binary_classification/binary.test', ... |
diorcety/translate | translate/tools/podebug.py | # -*- coding: utf-8 -*-
#
# Copyright 2004-2006,2008-2010 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 versio... |
FUB-HCC/neonion | accounts/tests.py | from django.test import TestCase
from models import WorkingGroup, Membership
from backends import EmailAuthBackend
from accounts.models import User
from django.core.urlresolvers import reverse
from accounts import views
def create_test_user(email='test@neonin.org'):
if not WorkingGroup.objects.filter(name="Public... |
SDSG-Invenio/invenio | invenio/modules/records/views.py | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2012, 2013, 2014, 2015 CERN.
#
# Invenio 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... |
dahaic/outerspace | server/lib/ige/SQLiteDatabase.py | #
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space 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
# (... |
kohnle-lernmodule/palama | exe/webui/appletblock.py | # -- coding: utf-8 --
# ===========================================================================
# eXe
# Copyright 2004-2005, University of Auckland
# Copyright 2004-2007 eXe Project http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gen... |
AstroVPK/libcarma | tests/test_carma.py | import math
import numpy as np
import copy
import unittest
import random
import psutil
import sys
import pdb
import matplotlib.pyplot as plt
import matplotlib.cm as colormap
try:
import kali.carma
except ImportError:
print 'Cannot import kali.carma! kali is not setup. Setup kali by sourcing bin/setup.sh'
... |
blissland/blissflixx | lib/player/omxproc.py | import os, time, locations
from processpipe import ExternalProcess, ProcessException
OMX_CMD = "omxplayer --timeout 120 -I --no-keys "
_DBUS_PATH = os.path.join(locations.BIN_PATH, "dbus.sh")
_INPUT_TIMEOUT = 10
_START_TIMEOUT = 120
class OmxplayerProcess(ExternalProcess):
def __init__(self):
ExternalProcess._... |
vrutkovs/gnome-music | gnomemusic/searchbar.py | # Copyright (c) 2013 Seif Lotfy <seif@lotfy.com>
# Copyright (c) 2013 Vadim Rutkovsky <vrutkovs@redhat.com>
# Copyright (c) 2014 Arnel A. Borja <kyoushuu@yahoo.com>
#
# GNOME Music 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 S... |
hpcuantwerpen/easybuild-easyblocks | easybuild/easyblocks/i/imkl.py | # #
# Copyright 2009-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.