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 |
|---|---|---|---|---|---|
import inspect
from django.db import models
from graphene.core.options import Options
from graphene.core.types import BaseObjectType
from graphene.relay.utils import is_node
VALID_ATTRS = ('model', 'only_fields', 'exclude_fields')
def is_base(cls):
from graphene.contrib.django.types import DjangoObjectType
... | jhgg/graphene | graphene/contrib/django/options.py | Python | mit | 1,122 |
# -*- coding: utf-8 -*-
# PROJECT : picopico
# TIME : 17-3-16 下午4:30
# AUTHOR : youngershen <younger.x.shen@gmail.com>
from picopico.utils.captcha.captcha import get_captcha_code, send_captcha
__all__ = ['get_captcha_code', 'send_captcha']
| universalyouth/picopico | picopico/utils/captcha/__init__.py | Python | mit | 249 |
from functools import partial
from sympy.strategies import chain, minimize
import sympy.strategies.branch as branch
from sympy.strategies.branch import yieldify
identity = lambda x: x
def treeapply(tree, join, leaf=identity):
""" Apply functions onto recursive containers (tree)
join - a dictionary mapping co... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/strategies/tree.py | Python | gpl-3.0 | 3,710 |
#!/usr/bin/env python
"""
main.py -- Udacity conference server-side Python App Engine
HTTP controller handlers for memcache & task queue access
$Id$
created by wesc on 2014 may 24
Modified by Richard Gieg on 12/2/2015 for Udacity Full Stack Project #4
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from... | richgieg/ConferenceCentral | main.py | Python | apache-2.0 | 2,056 |
# Plot the gamma distribution
# Based on https://github.com/probml/pmtk3/blob/master/demos/gammaPlotDemo.m
import superimport
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
from scipy.stats import gamma
x = np.linspace(0, 7, 100)
aa = [1.0, 1.5, 2.0, 1.0, 1.5, 2.0]
bb = [1.0, 1.0, ... | probml/pyprobml | scripts/gamma_dist_plot.py | Python | mit | 1,137 |
VERSION = (0, 0, 2)
__version__ = ".".join(map(str, VERSION)) | myles-archive/django-faq | faq/__init__.py | Python | bsd-3-clause | 61 |
from __future__ import unicode_literals, division, absolute_import
import logging
import sys
import os
from flexget import plugin
from flexget.event import event
log = logging.getLogger('change')
found_deprecated = False
class ChangeWarn(object):
"""
Gives warning if user has deprecated / changed config... | voriux/Flexget | flexget/plugins/plugin_change_warn.py | Python | mit | 3,389 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 pr... | otsaloma/gaupol | gaupol/agents/format.py | Python | gpl-3.0 | 2,965 |
# Copyright 2010-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/LICENSE-2.0
#
# Unless... | dims/cinder | cinder/api/views/versions.py | Python | apache-2.0 | 3,378 |
# This file is part of Parti.
# Copyright (C) 2008, 2009 Nathaniel Smith <njs@pobox.com>
# Parti is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
import gtk
import wimpiggy.lowlevel
from wimpiggy.wm import Wm
from wimpiggy.keys import HotkeyMan... | njsmith/partiwm | parti/parti_main.py | Python | gpl-2.0 | 2,693 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2006-2007 Lukáš Lalinský
# Copyright (C) 2013-2015, 2018 Laurent Monin
# Copyright (C) 2014, 2019 Philipp Wolfer
# Copyright (C) 2016-2017 Sambhav Kothari
#
# This program is free software; you can redistribute it and/or
# modi... | Sophist-UK/Sophist_picard | picard/ui/options/advanced.py | Python | gpl-2.0 | 4,214 |
#!/usr/bin/env python3
import itertools
from collections import defaultdict
import networkx as nx
import numpy as np
from pgmpy.base import UndirectedGraph
from pgmpy.factors import factor_product, Factor
from pgmpy.independencies import Independencies
from pgmpy.extern.six.moves import map, range, zip
class Markov... | anaviltripathi/pgmpy | pgmpy/models/MarkovModel.py | Python | mit | 27,052 |
# Copyright 2013, Big Switch Networks, 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... | wangxiangyu/horizon | openstack_dashboard/dashboards/project/firewalls/forms.py | Python | apache-2.0 | 16,187 |
import time
import logging
from .CogCompilerInterface import CogCompilerInterface
from .functions import str_fname_inode
class TestbenchCompiler(CogCompilerInterface):
'''This compiler only generates compile-time timestamp the given time
it's been called. Can be retrieved in the same instance at the... | CogPy/cog | src/TestbenchCompiler.py | Python | lgpl-3.0 | 1,558 |
from . import *
from webstar.core import *
from webstar import core
from webstar.router import Router
class TestRouterBasics(TestCase):
def setUp(self):
self.router = Router()
self.app = TestApp(self.router)
@self.router.register('/static')
def static(environ, start... | mikeboers/WebStar | test_webstar/test_router.py | Python | bsd-3-clause | 5,107 |
# -*- coding: utf-8 -*-
#
# 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
... | holygits/incubator-airflow | airflow/ti_deps/deps/dag_ti_slots_available_dep.py | Python | apache-2.0 | 1,176 |
# -*- Mode: Python; test-case-name:flumotion.test.test_config -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public Li... | ylatuya/Flumotion | flumotion/test/test_logfilter.py | Python | gpl-2.0 | 2,099 |
from __future__ import unicode_literals
from django.contrib import messages
from django.contrib.auth.decorators import permission_required
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db import transaction
from django.db.models import Count
from django.shortcuts import get_object_or_404, ... | snazy2000/netbox | netbox/circuits/views.py | Python | apache-2.0 | 9,414 |
'''
Created on Dec 23, 2011
@author: ajju
'''
from common.DataObjects import VideoHostingInfo, VideoInfo, VIDEO_QUAL_SD, \
VIDEO_QUAL_HD_720
from common import HttpUtils
import re
import urllib
def getVideoHostingInfo():
video_hosting_info = VideoHostingInfo()
video_hosting_info.set_video_hosting_image('h... | dknlght/dkodi | src/script.module.turtle/lib/snapvideo/Facebook.py | Python | gpl-2.0 | 1,880 |
# from the paper `using cython to speedup numerical python programs'
#pythran export wave(float, float, float, float, float, float [] [], float [] [], float [] [])
#runas A=[map(float,range(2000)) for i in xrange(100)] ; B=[map(float,range(2000)) for i in xrange(100)] ; C=[map(float,range(2000)) for i in xrange(100)] ;... | serge-sans-paille/pythran | docs/papers/sc2013/bench/pythran/wave_.py | Python | bsd-3-clause | 1,258 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 by Christian Tremblay, P.Eng <christian.tremblay@servisys.com>
# Licensed under LGPLv3, see file LICENSE in this source tree.
#
"""
Read.py - creation of ReadProperty and ReadPropertyMultiple requests
Used while defining an app:
Example::
... | ChristianTremblay/BAC0 | BAC0/core/io/Read.py | Python | lgpl-3.0 | 33,614 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer WMS GetLegendGraphic.
From build dir, run: ctest -R PyQgsServerWMSGetLegendGraphic -V
.. note:: 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 Foundati... | blazek/QGIS | tests/src/python/test_qgsserver_wms_getlegendgraphic.py | Python | gpl-2.0 | 32,351 |
# -*- coding: utf-8 -*-
# author: Pavel Studenik
# email: pstudeni@redhat.com
# created: 24.1.2014
# Author: Martin Korbel
# Email: mkorbel@redhat.com
# Date: 20.07.2014
import logging
import shlex
import sys
import time
import traceback
from cStringIO import StringIO
from datetime import timedelta
from croniter imp... | SatelliteQE/GreenTea | apps/taskomatic/models.py | Python | gpl-2.0 | 8,244 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import string
import datetime
import re
_logger = logging.getLogger(__name__)
try:
import vatnumber
except ImportError:
_logger.warning("VAT validation partially unavailable because the `vatnumber... | tvtsoft/odoo8 | addons/base_vat/base_vat.py | Python | agpl-3.0 | 13,019 |
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
cur = []
res = []
x = [i for i in range(1,10)]
self.helper(x,res,cur,k,n)
return res
def helper(self,x,res,c... | tedye/leetcode | Python/leetcode.216.combination-sum-iii.py | Python | mit | 589 |
# Copyright 2013-2020 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)
from spack import *
class PyOpenslidePython(PythonPackage):
"""OpenSlide Python is a Python interface to the OpenSli... | iulian787/spack | var/spack/repos/builtin/packages/py-openslide-python/package.py | Python | lgpl-2.1 | 812 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
####################################################################################################################################################################################################################################
############################################... | dimtion/jml | outputFiles/statistics/archives/ourIA/improved_closest_v2.py/0.7/5/player1.py | Python | mit | 11,263 |
import json
import six
from jwkest import b64d, as_unicode
from jwkest import b64e
from jwkest import BadSyntax
__author__ = 'roland'
def split_token(token):
if not token.count(b"."):
raise BadSyntax(token,
"expected token to contain at least one dot")
return tuple(token.split... | catapult-project/catapult-csm | third_party/google-endpoints/jwkest/jwt.py | Python | bsd-3-clause | 2,652 |
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local') # pragma: no cover
app = Cele... | cuongnb14/swagger-ui | swagger_ui/taskapp/celery.py | Python | mit | 911 |
# -*- coding: utf-8 -*-
__version__ = '0.3.5'
| joebowen/movement_validation_cloud | djangodev/lib/python2.7/site-packages/django_boto/__init__.py | Python | mit | 47 |
'''
New Test For mini cluster creation and roll back when creation failed
@author: Glody
'''
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpe... | zstackio/zstack-woodpecker | integrationtest/vm/simulator/test_minicluster.py | Python | apache-2.0 | 2,859 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://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 with the co... | qtproject/qt-creator | tests/system/suite_debugger/tst_qml_js_console/test.py | Python | gpl-3.0 | 9,763 |
from .nvd3 import NVD3
from flask import jsonify, request
import numpy as np
class TwoAxisFocus(NVD3):
_allowed_axes = ["sigma", "minmax"]
def __init__(self, x, y1, y2, data_source, init_params={},
chart_id="new_chart", url="/new_chart/", colors=[], auto_scale="sigma",
y1_axis_range=[], y2_axi... | MKridler/pyxley | pyxley/charts/nvd3/two_axis_focus.py | Python | mit | 2,870 |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 20 15:50:23 2016
@author: jessime
"""
#TODO integrate this with play_levels and remove duplicated Code
import sys
import os
import subprocess as sp
import traceback
import numpy as np
from shutil import copyfile
from importlib import import_module, reload
class Tutoria... | Jessime/Excision | src/tutorial.py | Python | mit | 4,392 |
#Author: Maxwell Bertolero, bertolero@berkeley.edu, mbertolero@gmail.com
import numpy as np
from random import choice
import networkx as nx
def within_community_degree(weighted_partition, nan = 0.0, catch_edgeless_node=True):
''' Computes "within-module degree" (z-score) for each node (Guimera 2007, J Stat Mech)
... | jrcohen02/brainx_archive2 | build/lib/brainx/nodal_roles.py | Python | bsd-3-clause | 3,526 |
"""
Definition of test files and directories which can be used in the tests.
"""
from __future__ import absolute_import
import os
TESTDATA_DIR = os.path.dirname(os.path.realpath(__file__))
SEDML_TEST_DIR = os.path.join(TESTDATA_DIR, 'sedml', 'sed-ml')
OMEX_TEST_DIR = os.path.join(TESTDATA_DIR, 'sedml', 'omex')
OMEX... | kirichoi/tellurium | tellurium/tests/testdata/__init__.py | Python | apache-2.0 | 538 |
"""Distance utils."""
import numpy
from scipy.linalg import eigvalsh
from .base import logm, sqrtm
def distance_kullback(A, B):
"""Kullback leibler divergence between two covariance matrices A and B.
:param A: First covariance matrix
:param B: Second covariance matrix
:returns: Kullback leibler dive... | alexandrebarachant/decoding-brain-challenge-2016 | models/pyriemann/utils/distance.py | Python | bsd-3-clause | 4,099 |
# Copyright (c) 2014 VMware, 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 required b... | ekcs/congress | congress/api/schema_model.py | Python | apache-2.0 | 2,959 |
#!/usr/bin/env python
#
# Send/receive UDP multicast packets.
# Requires that your OS kernel supports IP multicast.
#
# Usage:
# mcast -s (sender, IPv4)
# mcast -s -6 (sender, IPv6)
# mcast (receivers, IPv4)
# mcast -6 (receivers, IPv6)
MYPORT = 8123
MYGROUP_4 = '225.0.0.250'
MYGROUP_6 = 'ff1... | google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Demo/sockets/mcast.py | Python | apache-2.0 | 2,294 |
#!/usr/bin/env python2
import subprocess
import atexit
import sys
from math import pi, sin, cos
from chips.api.api import Chip, Stimulus, Response, Wire, Component
try:
import scipy as s
except ImportError:
print "You need scipy to run this script!"
exit(0)
try:
import numpy as n
except ImportError:
... | dawsonjon/Chips-2.0 | examples/example_5.py | Python | mit | 3,603 |
# -*- coding: utf-8 -*-
'''
Verhoeff algorithm
~~~~~~~~~~~~~~~~~~
'''
from ..checksum import (
ChecksumStrategy,
)
class Verhoeff(ChecksumStrategy):
'''
Provides Verhoeff checksum algorithm.
'''
name = 'verhoeff'
d = [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[1, 2, 3, 4, 0, 6, 7, 8... | vaiski/checksum | src/checksum/strategies/verhoeff.py | Python | mit | 1,448 |
from announcements import views
from django.conf.urls import url
app_name = 'announcements'
urlpatterns = [
url(r'^$', views.list, name='list'), # function based view
url(r'^b/$', views.list2, name='list2'), # function based view
# url(r'^$', views.List.as_view(), name='list'), # CBV
# url(r'^crea... | timberline-secondary/hackerspace | src/announcements/urls.py | Python | gpl-3.0 | 836 |
from SimpleCV import *
import time
import serial
cam = JpegStreamCamera('http://192.168.1.6:8080/videofeed')
disp=Display()
"""This script was used for the demonstration of doing control with visual feedback
A android mobile phone was used with ipcam application to stream the video
A green fresbee was attached t... | baptistelabat/robokite | ObjectTracking/test/basicControl1D.py | Python | mit | 1,041 |
Project_list = ['CMIP5', 'GeoMIP', 'LUCID', 'TAMIP', 'obs4MIPs', 'sdc5p', 'test']
Freq = {'3h': '3-hourly', '6h': '6-hourly', 'clm': 'Climatology-Monthly-Mean',
'day': 'Daily', 'fx': 'Fixed', 'mon': 'Monthly', 'sh': 'Sub-Hourly',
'yr': 'Yearly'}
Realm = {'Ae': 'Aerosol', 'A': 'Atmosphere', 'L': 'Land'... | arulalant/CMIPs-Handler | scripts/mv/projectdatatypes.py | Python | gpl-3.0 | 415 |
# *****************************************************************************
# Copyright (c) 2020, Intel Corporation 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 sou... | IntelLabs/hpat | examples/series/series_mod.py | Python | bsd-2-clause | 1,733 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-12-20 22:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('swiper', '0009_userprofile'),
]
operations = [
migrations.AddField(
... | GFynbo/GoudaTime | swiper/migrations/0010_auto_20171220_1729.py | Python | mit | 1,131 |
# -*- coding: UTF-8 -*-
#
# Copyright (C) 2007 by ULPM: Alexandre Yukio Harano
# Fábio Cassarotti Parronchi Navarro
# Gabriel Geraldo França Marcondes
# Luiz Carlos Irber Júnior
#
# This program is free software; you can redistribute it... | Lasanha/Gambiarra | Gambiarra/levels.py | Python | gpl-2.0 | 6,934 |
#!/usr/bin/env python
#coding=utf8
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/..")
import time
from sample_common import MNSSampleCommon
from mns.mns_account import Account
from mns.mns_queue import *
#从sample.cfg中读取基本配置信息
## WARNING: Please do not hard code your accessId ... | stormtrader/gw_trade | dysms_python/mns_python_sdk/sample/deletequeue.py | Python | gpl-3.0 | 924 |
from django.conf.urls import patterns, include, url, static
from django.conf import settings
from django.contrib import admin
from ticketing.views import GetTicket, GetVideos, ViewVideoByTicket, stream_video, stream_mp4
from videostore.views import watermark
from django.contrib.staticfiles.urls import staticfiles_urlpa... | alrusdi/video-store | core/urls.py | Python | mit | 1,075 |
# -*- coding: utf-8 -*-
"""setup.py -- setup file for Matrioshka deployment mother brain.
"""
from setuptools import setup
setup(
name = "matrioshka",
packages = ['matrioshka'],
install_requires = [
'Fabric',
'boto',
'Paved',
'path.py',
],
zip_safe = False,
... | eykd/matrioshka | setup.py | Python | bsd-3-clause | 659 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | iemejia/incubator-beam | sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py | Python | apache-2.0 | 5,990 |
from openerp import models, fields
class testwidget(models.Model):
_name = 'testwidget'
name = fields.Char()
| nishad-jobsglobal/odoo-marriot | openerp/addons/testwidget/testwidget.py | Python | agpl-3.0 | 129 |
#!/usr/bin/python
import xml.etree.ElementTree as ET
import os
import urllib
import urllib2
if 'MY_HOME' not in os.environ:
os.environ['MY_HOME']='/usr/libexec/cernvm-appliance-agent'
def prepare():
transaction=ET.Element('cernvm-api', {'version':'1.0'})
username=ET.Element('username')
username.text='... | cernvm/cernvm-appliance-agent | api-tests/xml_poster.py | Python | gpl-3.0 | 2,177 |
import sys
import importlib
import os
import pickle
import numpy as np
import random
class Problem(object):
settings = {}
def __init__(self, default_settings_filename = None):
# set defaults
if default_settings_filename:
self.load_from_file(default_settings_filename, only_setting... | mkondratyev85/pgm | problem.py | Python | mit | 6,816 |
bl_info = {
"name": "Cars Generator",
"category": "Object",
"author": "Cottet & Hurteau"
}
import bpy, os, math
import random
import mathutils
from mathutils import Vector
from math import pi
from bpy.props import FloatVectorProperty, FloatProperty
class CarsGenerator(bpy.types.Operator):
"""It gene... | MarionLeHerisson/CarsGenerator | CarsGeneratorAddOn.py | Python | gpl-3.0 | 11,781 |
#!/usr/bin/python
#
# Copyright (C) Citrix Systems Inc.
#
# This program 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; version 2.1 only.
#
# This program is distributed in the hope that it will be use... | xapi-project/sm | drivers/mpath_cli.py | Python | lgpl-2.1 | 3,107 |
#!/usr/bin/python
import os
import sys
extra_opts = {'test_suite': 'tests'}
extra_deps = []
extra_test_deps = []
if sys.version_info[:2] == (2, 6):
extra_deps.append('argparse')
extra_deps.append('simplejson')
extra_test_deps.append('unittest2')
extra_opts['test_suite'] = 'unittest2.collector'
try:
... | agilemobiledev/mongo-orchestration | setup.py | Python | apache-2.0 | 2,438 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
def randomize():
return random.randint(-250, 250)
class Pressure(object):
def __init__(self):
pass
def get_value(self):
return randomize()
| robinsonsantos/sensorsimulator | utils/pressure.py | Python | gpl-2.0 | 231 |
#
# Convenience module for fetching files from a network source
#
# Copyright 2006-2007 Red Hat, Inc.
# Daniel P. Berrange <berrange@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundatio... | cardoe/virt-manager | virtinst/ImageFetcher.py | Python | gpl-2.0 | 6,859 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2021, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | mrcslws/nupic.research | src/nupic/research/frameworks/vernon/mixins/sync_batchnorm.py | Python | agpl-3.0 | 1,943 |
from bettercache.utils import CachingMixin, strip_wsgi
from bettercache.proxy import proxy
import logging
logger = logging.getLogger(__name__)
class BetterView(CachingMixin):
"""Accepts any path and attempts to serve it from the cache. If it cannot
find the response in the cache, it will use ``bettercache.pro... | ironfroggy/django-better-cache | bettercache/views.py | Python | mit | 1,519 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django import VERSION as DJANGO_VERSION
from django.middleware.csrf import CsrfViewMiddleware
from django.middleware.csrf import _sanitize_token as sanitize_csrf_token
if DJANGO_VERSION < (1, 10):
from django.middleware.csrf import _get_new_csrf_... | samuelmaudo/yepes | yepes/middleware/csrf_token.py | Python | bsd-3-clause | 1,653 |
import logging
from urllib import urlencode
from requests.exceptions import ConnectionError, Timeout
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from waffle import switch_is_active
from courses.views import CourseTemplateWithNav... | Stanford-Online/edx-analytics-dashboard | analytics_dashboard/courses/views/learners.py | Python | agpl-3.0 | 3,430 |
from pipeline.conf import settings
from pipeline.compressors import SubProcessCompressor
class UglifyJSCompressor(SubProcessCompressor):
def compress_js(self, js):
command = '%s -nc %s' % (settings.PIPELINE_UGLIFYJS_BINARY, settings.PIPELINE_UGLIFYJS_ARGUMENTS)
if self.verbose:
command... | GbalsaC/bitnamiP | venv/src/django-pipeline/pipeline/compressors/uglifyjs.py | Python | agpl-3.0 | 386 |
"""=============================
Subclassing ndarray in python
=============================
Introduction
------------
Subclassing ndarray is relatively simple, but it has some complications
compared to other Python objects. On this page we explain the machinery
that allows you to subclass ndarray, and the implicati... | MSeifert04/numpy | numpy/doc/subclassing.py | Python | bsd-3-clause | 28,624 |
# -*- coding: utf-8 -*-
"""
Django Extensions additional model fields
"""
import re
import six
import string
import warnings
try:
import uuid
HAS_UUID = True
except ImportError:
HAS_UUID = False
try:
import shortuuid
HAS_SHORT_UUID = True
except ImportError:
HAS_SHORT_UUID = False
from django... | neilpelow/wmap-django | venv/lib/python3.5/site-packages/django_extensions/db/fields/__init__.py | Python | gpl-3.0 | 18,263 |
#!/usr/bin/env python3
# Safe Eyes is a utility to remind you to take break frequently
# to protect your eyes from eye strain.
# Copyright (C) 2016 Gobinath
# 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 Softwar... | slgobinath/SafeEyes | safeeyes/__main__.py | Python | gpl-3.0 | 5,874 |
from __future__ import division, print_function, absolute_import
from numpy.testing import dec, assert_, assert_array_equal
try:
import matplotlib
matplotlib.rcParams['backend'] = 'Agg'
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
has_matplotlib = True
except:
... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/spatial/tests/test__plotutils.py | Python | mit | 1,567 |
# Copyright (c) 2008 David Aguilar
# Copyright (c) 2015 Daniel Harding
"""Provides an filesystem monitoring for Linux (via inotify) and for Windows
(via pywin32 and the ReadDirectoryChanges function)"""
from __future__ import division, absolute_import, unicode_literals
import errno
import os
import os.path
import sele... | dirtycold/git-cola | cola/fsmonitor.py | Python | gpl-2.0 | 19,637 |
#!/usr/bin/python
import matplotlib.pyplot as plt, numpy as np, subprocess as sp, argparse
parser=argparse.ArgumentParser()
parser.add_argument('--option_tag',nargs='*')
parser.add_argument('--path',nargs='*')
args=parser.parse_args()
option_tag=''.join(args.option_tag)
path_current=''.join(args.path)
folder = pat... | JXing-Lab/ME-SCAN-SVA | modules/JW_heatmap.py | Python | gpl-3.0 | 2,930 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | xpansa/stock-logistics-tracking | stock_tracking_add_remove_pack/__openerp__.py | Python | agpl-3.0 | 1,858 |
from aospy import Run
am2_control = Run(
name='am2_control',
description=(
'Preindustrial control simulation.'
),
data_in_direc=('/archive/Yi.Ming/sm2.1_fixed/'
'SM2.1U_Control-1860_lm2_aie_rerun6.YIM/pp'),
data_in_dur=5,
data_in_start_date='0001-01-01',
data_in_e... | spencerkclark/aospy-obj-lib | aospy_user/runs/cases.py | Python | gpl-3.0 | 6,191 |
# -*- coding: utf-8 -*-
###############################################################################
#
# RunInstances
# Launches the specified number of instances of an AMI for which you have permissions.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Versio... | jordanemedlock/psychtruths | temboo/core/Library/Amazon/EC2/RunInstances.py | Python | apache-2.0 | 11,517 |
from __future__ import absolute_import
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from .parcel_analysis import ParcelAnalysis, parcel_analysis
from nipy.testing import Tester
test = Tester().test
bench = Tester().bench
| alexis-roche/nipy | nipy/algorithms/group/__init__.py | Python | bsd-3-clause | 291 |
import os
import numpy as np
import MMTK
class Grid:
"""
Class to read and write alchemical grids.
Data is a dictionary with
spacing - the grid spacing, in Angstroms.
counts - the number of points in each dimension.
vals - the values.
All are numpy arrays.
"""
def __init__(self):
pass
def r... | luizcieslak/AlGDock | AlGDock/IO.py | Python | mit | 14,740 |
import logging
from collections import defaultdict
from itertools import count
from claripy.utils.orderedset import OrderedSet
from ...sim_variable import SimStackVariable, SimMemoryVariable, SimRegisterVariable, SimMemoryVariablePhi, \
SimStackVariablePhi, SimRegisterVariablePhi
from ...keyed_region import Keye... | chubbymaggie/angr | angr/knowledge_plugins/variables/variable_manager.py | Python | bsd-2-clause | 12,737 |
#!/usr/bin/env python
# Tests check_format.py. This must be run in a context where the clang
# version and settings are compatible with the one in the Envoy
# docker. Normally this is run via check_format_test.sh, which
# executes it in under docker.
from __future__ import print_function
import argparse
import loggi... | dnoe/envoy | tools/check_format_test_helper.py | Python | apache-2.0 | 9,849 |
# -*- coding: utf-8 -*-
#
#
# 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 file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys... | hirokihamasaki/irma | docs/conf.py | Python | apache-2.0 | 9,028 |
#! /usr/bin/python
# filename: conserved_positions.py
import os
import time
import glob
import argparse
from Bio import SeqIO
import multiprocessing
from position import position
parser = argparse.ArgumentParser("Identifies Env isolates (from the LANL database) that have glycans at a user-defined position.")
parser... | bryanbriney/env-analysis | glycans/conserved_positions.py | Python | mit | 10,785 |
#!/usr/bin/env python3
import sys
v=str()
f=open(sys.argv[2], 'wb')
string=str()
for i in sys.argv[1].strip():
v = v + i
if len(v) == 2:
v.encode("ascii")
h = int(str(v), base=16)
f.write(chr(h).encode("ISO-8859-1"))
v = str()
| stenbock/rdisasm | script/hexbin.py | Python | gpl-2.0 | 269 |
"""Kuler Sky lights integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .const import DATA_ADDRESSES, DATA_DISCOVERY_SUBSCRIPTION, DOMAIN
PLATFORMS = [Platform.LIGHT]
async def async_setup_entry(hass: HomeAs... | home-assistant/home-assistant | homeassistant/components/kulersky/__init__.py | Python | apache-2.0 | 1,040 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# 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
... | vlegoff/tsunami | src/primaires/joueur/contextes/creation/__init__.py | Python | bsd-3-clause | 1,633 |
# coding=utf-8
# author = 'Gavin'
# project is py_learning
# the file name is print
# date = 2018/7/26
print("Hello python world!") | gavinshaw/py_learning | python_learing/print.py | Python | mit | 131 |
#pylint: disable=C0111
#pylint: disable=W0621
from lettuce import world, step
from common import *
from nose.tools import assert_equal
############### ACTIONS ####################
@step('I have opened a new course section in Studio$')
def i_have_opened_a_new_course_section(step):
open_new_course()
add_secti... | wwj718/edx-video | cms/djangoapps/contentstore/features/subsection.py | Python | agpl-3.0 | 4,511 |
import time
import datetime
from django import forms
from django.forms.util import ErrorDict
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from models import Comment
from django.utils.encoding import force_unicode
from django.utils.hashcompat import sha_constructor
from dj... | chewable/django | django/contrib/comments/forms.py | Python | bsd-3-clause | 6,680 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
test_records = frappe.get_test_records('Employment Type')
| mhbu50/erpnext | erpnext/hr/doctype/employment_type/test_employment_type.py | Python | gpl-3.0 | 201 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation. 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... | wallnerryan/quantum_migrate | quantum/tests/unit/nec/test_trema_driver.py | Python | apache-2.0 | 13,627 |
#!/usr/bin/env python
import sys
from struct import pack
from VariableBiteCode import vb_encode
if len(sys.argv) < 2:
print "usage: %s in.txt > out.txt" % sys.argv[0]
sys.exit(1)
for line in open(sys.argv[1], 'r'):
(tag, id_list) = line.rstrip().split('\t')
bytes = []
pre = 0
for id in id_list... | enfk/hugedatabook-vbcode-python | ch6_encode.py | Python | mit | 528 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | rahulunair/nova | nova/tests/functional/api_sample_tests/test_aggregates.py | Python | apache-2.0 | 5,569 |
#!/usr/bin/env python
""" hg-to-git.py - A Mercurial to GIT converter
Copyright (C)2007 Stelian Pop <stelian@popies.net>
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 versi... | pniebla/test-repo-console | svn/git-1.8.3.3.tar/git-1.8.3.3/git-1.8.3.3/contrib/hg-to-git/hg-to-git.py | Python | mit | 8,052 |
# -*- 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 'DatabaseResize.target_offer'
db.alter_column(u'mainten... | globocom/database-as-a-service | dbaas/maintenance/migrations/0028_auto__chg_field_databaseresize_target_offer__chg_field_databaseresize_.py | Python | bsd-3-clause | 44,593 |
# The MIT License
#
# Copyright (c) 2008 James Piechota
#
# 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... | redpawfx/massiveImporter | python/ns/bridge/io/WReader.py | Python | mit | 2,920 |
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2017 PyMeasure Developers
#
# 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 limit... | TvBMcMaster/pymeasure | pymeasure/instruments/anritsu/__init__.py | Python | mit | 1,243 |
from django import template
register = template.Library()
@register.filter
def drawLight(value):
if value == 1:
return "green.png"
else:
return "red.png"
| UNINETT/nav | python/nav/django/templatetags/portadmin.py | Python | gpl-2.0 | 180 |
"""
These settings are used by the ``manage.py`` command.
With normal tests we want to use the fastest possible way which is an
in-memory sqlite database but if you want to create South migrations you
need a persistant database.
Unfortunately there seems to be an issue with either South or syncdb so that
defining two... | bitmazk/django-enquiry | enquiry/tests/south_settings.py | Python | mit | 575 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2010, Nicolas Clairon
# 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 abov... | goanpeca/mongokit | mongokit/operators.py | Python | bsd-3-clause | 3,264 |
#!/usr/bin/env python
###############################################################################
# vim: tabstop=4:shiftwidth=4:expandtab:
# Copyright (c) 2017-2018 SIOS Technology Corp. All rights reserved.
##############################################################################
"""
This script will spray ev... | siostechcorp/Signal_iQ | python/test/scripts/hw_minigun.py | Python | mit | 2,521 |
import random, time, sys
# key catching code
import sys,tty,termios
class _Getch:
def __call__(self):
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
tty.setraw(sys.stdin.fileno())
ch = sys.stdin.read(1)
fi... | kas/r-DailyProgrammer | weekly/25 Escape the trolls/app.py | Python | mit | 7,148 |
from status.util import SafeHandler
from datetime import datetime
thresholds = {
'HiSeq X': 320,
'RapidHighOutput': 188,
'HighOutput': 143,
'RapidRun': 114,
'MiSeq Version3': 18,
'MiSeq Version2': 10,
'MiSeq Version2Nano': 0.75,
'NovaSeq SP': 325,
'NovaSeq S1': 650,
'NovaSeq S2'... | remiolsen/status | status/flowcell.py | Python | mit | 4,508 |
import re
datapath = "./data/"
outputpath = "./output/"
vectorfile = open(datapath + 'doc2Dep20MWU57k_1000concat2000.tab', 'r')
wordfile = open(datapath + 'doc2Dep20MWU57k_1000concat2000.txt', 'r')
num_lines = sum([1 for line in wordfile])
vecNum = 1000
wordfile.seek(0)
outputfile = open(outputpath + 'dependencyVec... | sidenver/ConstituentRetrofit | parseInput.py | Python | apache-2.0 | 665 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.