code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf8 -*-
grl = False
m_or_d = 0
import numpy as np
from progressbar import ProgressBar
from ROOT import gRandom
Nevts = 100000
scores = []
for i in xrange(2):
gRandom.SetSeed(i)
backgrounds = []
signals = []
for j in xrange(Nevts):
s_or_b = gRandom.Binomial(1,0.5)
... | pseyfert/transfer-learning | toy/apply_advanced.py | Python | mit | 3,608 |
import os
from env import (
DJANGO_DEV,
)
if DJANGO_DEV:
from dev import *
else:
from live import *
| ginabythebay/iddocs | mysite/settings/__init__.py | Python | apache-2.0 | 117 |
# Copyright 2013: Mirantis 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... | vishnu-kumar/PeformanceFramework | rally_os/cli/cliutils.py | Python | apache-2.0 | 21,850 |
from Tkinter import *
import tkFileDialog as tkfd
import os
class Picker:
def __init__(self, app, parent, dir_type):
self.directorylist = []
self.shortnames = []
self.initdir = None
if os.path.isfile(app.config):
with open(app.config) as e:
for line in e:
splitline = line.split("=")
if spl... | TApicella/photosorter | picker_widget.py | Python | mit | 4,355 |
from __future__ import absolute_import
from . import envs
from . import run
| Abugbilla/wallpaperpy | wallpaperpy/__init__.py | Python | mit | 76 |
"""
Copyright 2012 Jan Demter <jan@demter.de>
This file is part of LODStats.
LODStats 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.
LODS... | jandemter/lodstats | lodstats/stats/RDFSyntax.py | Python | gpl-3.0 | 1,025 |
import base64
import iso8601
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_bytes, force_str
from lepo.apidef.parameter.base import NO_VALUE
from lepo.excs import ErroneousParameters, MissingParameter
def cast_primitive_value(type, format, value):
if type == 'boo... | akx/lepo | lepo/parameter_utils.py | Python | mit | 2,238 |
#Run this on the mergedtags.txt file generated from the merge_script.py file
from mrjob.job import MRJob
fh = open("tagsMP.txt","w+")
count = 0
class MRmyjob(MRJob):
def mapper(self, _, line):
global count
wordlist = line.split(" ")
count += 1
for word in wordlist:
yield word, count
def reducer(self, ... | rayxke/Redshift-Project | data/map_reduce_tags.py | Python | mit | 548 |
def f():
x1: int = <warning descr="Expected type 'int', got 'str' instead">'foo'</warning>
x2: str = 'bar'
x3: int = 0
x4: str = <warning descr="Expected type 'str', got 'int' instead">1</warning>
| siosio/intellij-community | python/testData/inspections/PyTypeCheckerInspection/Assignment.py | Python | apache-2.0 | 213 |
# -*- coding:utf-8 -*-
"""
/***************************************************************************
Python Console for QGIS
-------------------
begin : 2012-09-10
copyright : (C) 2012 by Salvatore Larosa
email : lrssvtml (at) gmail (dot) com
***... | olivierdalang/QGIS | python/console/console_sci.py | Python | gpl-2.0 | 30,240 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Difference'] , ['PolyTrend'] , ['NoCycle'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Difference/model_control_one_enabled_Difference_PolyTrend_NoCycle_AR.py | Python | bsd-3-clause | 150 |
import pkgutil
import logging
from cifsdk.constants import LOG_FORMAT, RUNTIME_PATH, LOGLEVEL, VERSION
from argparse import ArgumentParser
import signal
import yaml
import os
def read_config(args):
options = {}
if os.path.isfile(args.config):
with open(args.config) as f:
config = yaml.saf... | csirtgadgets/bearded-avenger-sdk-py | cifsdk/utils/__init__.py | Python | mpl-2.0 | 2,198 |
import random
def d6():
result = random.randint(1,6)
if result == 6:
result = 6 + random.randint(1,6)
print("The result is: " + str(result))
| tarzenda/pyrus | assn4/ex14.py | Python | bsd-2-clause | 162 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
import importlib
from PyQt5.Qt import QToolButton
from calibre import print... | sharad/calibre | src/calibre/gui2/tweak_book/plugin.py | Python | gpl-3.0 | 7,426 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import a... | letoosh/techfugees | techfugees/techfugees/urls.py | Python | bsd-3-clause | 635 |
import os
import sys
import copy
import AutoGemmParameters
import Common
import KernelParameters
def indent(il):
returnTabs = ""
for i in range(0, il):
returnTabs += " "
return returnTabs
def tileInRange( tileMin, tileMax, rangeMin, rangeMax):
if ( tileMax < 0 or (tileMax >= rangeMax and rangeMax>0) ) a... | ghisvail/clBLAS | src/library/blas/AutoGemm/KernelSelection.py | Python | apache-2.0 | 28,193 |
def file_from_tar(context, tar, member):
return tar.extractfile(member).read()
def static_file(context, path):
with open(path, 'rb') as fobj:
return fobj.read()
| akheron/stango | stango/views.py | Python | mit | 178 |
# -*- coding: utf-8 -*-
#
"""
ORCA Open Remote Control Application
Copyright (C) 2013-2020 Carsten Thielepape
Please contact me by : http://www.orca-remote.org/
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pu... | thica/ORCA-Remote | src/scripts/helper/helper_gettvlogo/script.py | Python | gpl-3.0 | 18,571 |
# Search for lines that start with 'Details: rev='
# followed by numbers and '.'
# Then print the number if it is greater than zero
import re
hand = open('mbox-short.txt')
for line in hand:
line = line.rstrip()
x = re.findall('^Details:.*rev=([0-9.]+)', line)
if len(x) > 0:
print(x)
| mkhuthir/learnPython | Book_pythonlearn_com/18_regex/re12.py | Python | mit | 306 |
# Copyright 2020 DeepMind Technologies Limited. 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 ... | deepmind/dm-haiku | haiku/_src/lift.py | Python | apache-2.0 | 10,617 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/network/f5/bigip_apm_policy_fetch.py | Python | gpl-3.0 | 15,623 |
import os
import sys
class CommandLine():
def __inti__(self):
self.data = " "
def QUIT(self):
sys.exit()
def MKDIR(self,newpath):
""" Creates a directory using filename or path """
if not os.path.exists(newpath):
os.makedirs(newpath)
return "Created {0}.".format(newpath)
els... | Hellrungj/CSC-412-Networking | Retry_Resend/CommandLine.py | Python | gpl-3.0 | 2,798 |
# Copyright David Abrahams 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
'''
# Try to reproduce a Numeric interaction bug if Numeric is installed.
>>> from bienstman1_ext import *
>>> try: from Numeric i... | alexa-infra/negine | thirdparty/boost-python/libs/python/test/bienstman1.py | Python | mit | 675 |
"""!@package grass.script.vector
@brief GRASS Python scripting module (vector functions)
Vector related functions to be used in Python scripts.
Usage:
@code
from grass.script import vector as grass
grass.vector_db(map)
...
@endcode
(C) 2008-2010 by the GRASS Development Team
This program is free software under th... | AsherBond/MondocosmOS | grass_trunk/lib/python/vector.py | Python | agpl-3.0 | 11,025 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notic... | turon/openthread | tools/harness-automation/cases/leader_5_5_1.py | Python | bsd-3-clause | 2,313 |
from __future__ import absolute_import
from celery import shared_task
import datetime
from api.rds_api import RdsApi
import log.log as log
from account.models import Account
from .models import Rds
def sync_rds_north():
try:
account_data = Account.objects.all()
for account in account_data:
... | hyperwd/hwcram | rds/tasks.py | Python | mit | 6,135 |
import sys
import MySQLdb
import rospy
import config_database
## Database class
class SensorsInDatabase(object):
## Constructor
def __init__(self):
# Get the parameters from the config file
self._sensorTable = config_database.database['mysql_sensor_table_name']
self._sensorTypesTable = config_database.databas... | robertjacobs/zuros | zuros_sequencer/zuros_zwave_poller/src/include/database.py | Python | mit | 2,346 |
# -*- coding: utf-8 -*-
"""
Created on Tue May 23 17:11:23 2017
@author: Jak
"""
import math
import mathutils
import bgeDisp
def makeLeg(L1, L2, L3, resting1, resting2, resting3, label="%s", origin=mathutils.Vector([0, 0, 0])):
"""
make a leg like:
/
/
... | Jak-o-Shadows/flexspine | simulation/makeRobot.py | Python | mit | 2,050 |
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
from setuptools import setup
sys.path.append(os.path.join('doc', 'common'))
try:
from doctools import build_doc, test_doc
except ImportError:
build_doc = test_doc = None
from distutils.cmd import Command
class import_cldr(Command):
descrip... | regisb/babel | setup.py | Python | bsd-3-clause | 2,969 |
DEBUG = True
TEMPLATE_DEBUG = True
API_LIMIT_PER_PAGE = 10000
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'local.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
| timothypage/etor | etor/etor/local_settings.py | Python | mit | 212 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 B1 Systems GmbH
#
# 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
#... | tuskar/tuskar-ui | openstack_dashboard/dashboards/admin/hypervisors/views.py | Python | apache-2.0 | 1,366 |
#!/usr/bin/env python2.7
#
# Copyright 2019 OpenGEE Contributors
#
# 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 app... | tst-eclamar/earthenterprise | earth_enterprise/src/server/wsgi/common/geAbstractionFetcher.py | Python | apache-2.0 | 2,044 |
# Part of Patient Flow.
# See LICENSE file for full copyright and licensing details.
import test_shift_management
| NeovaHealth/patientflow | nh_shift_management/tests/__init__.py | Python | agpl-3.0 | 114 |
# flake8: noqa
# -*- 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):
# Adding model 'PrivacyLevelTranslation'
db.create_table(u... | bitmazk/django-privacy | privacy/migrations/0001_initial.py | Python | mit | 4,822 |
"""
Numerical matrix multiplication for path integrals.
"""
from itertools import product
import numpy as np
from .constants import HBAR
from .tools import cached
class PIMM:
"""
Path Integrals via Matrix Multiplication
Base class for various kinds of path integral implementations.
"""
def __... | 0/pathintmatmult | pathintmatmult/nmm.py | Python | mit | 15,390 |
# Natural Language Toolkit: Sequential Backoff Taggers
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# Steven Bird <sb@csse.unimelb.edu.au> (minor additions)
# Tiago Tresoldi <tresoldi@users.sf.net> (original affix tagger)
# URL: <http://n... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/tag/sequential.py | Python | apache-2.0 | 15,593 |
import unittest
from pydl.hyperopt.components import *
class ComponentsTestCase(unittest.TestCase):
def test_hp_choice(self):
self.assertRaises(AssertionError, hp_choice, 1)
self.assertRaises(AssertionError, hp_choice, [])
x = hp_choice([1, 2, 3])
self.assertEqual(x.size, 1)
... | rafaeltg/pydl | pydl/hyperopt/unittests/test_components.py | Python | mit | 4,919 |
import sys
from mrjob.job import MRJob
from mrjob.protocol import JSONProtocol
from mrjob.step import MRStep
from GlobalHeader import *
class ShiftGModMat(MRJob):
"""
Shift generalized modularity matrix
"""
INPUT_PROTOCOL = JSONProtocol
OUTPUT_PROTOCOL = JSONProtocol
def mapper_align_by... | oraclechang/CommunityDetection | ShiftGModMat.py | Python | gpl-2.0 | 1,188 |
# 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 u... | muntasirraihan/apache-cassandra-1.2.4-src | pylib/cqlshlib/test/test_cqlsh_output.py | Python | apache-2.0 | 36,622 |
from __future__ import unicode_literals
from django.db.models.query_utils import InvalidQuery
from django.test import TestCase
from .models import (
BigChild, Child, ChildProxy, Primary, RefreshPrimaryProxy, Secondary,
)
class AssertionMixin(object):
def assert_delayed(self, obj, num):
"""
I... | baylee/django | tests/defer/tests.py | Python | bsd-3-clause | 11,390 |
name="Ada Lovelace"
print(name.title())
| ClicksThroughScience/New-Creations | name.py | Python | mit | 40 |
import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as la
import sys
sys.path.append('..')
import uncompiled_floq.helpers as h
import uncompiled_floq.blockmatrix as bm
import uncompiled_floq.fixed_system as fs
import uncompiled_floq.errors as errors
import itertools
import copy
import cmath
def ge... | sirmarcel/floq | benchmark/museum_of_evolution/p3/evolution.py | Python | mit | 7,423 |
from functools import wraps
import brewer2mpl
import numpy as np
import matplotlib as mpl
from matplotlib import cm
# Get Set2 from ColorBrewer, a set of colors deemed colorblind-safe and
# pleasant to look at by Drs. Cynthia Brewer and Mark Harrower of Pennsylvania
# State University. These colors look lovely toge... | olgabot/prettyplotlib | prettyplotlib/colors.py | Python | mit | 2,394 |
#!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for analyzer
"""
import json
import TestGyp
found = 'Found dependency'
found_all = 'Found dependency (all)'
not_found = 'No depend... | pnigos/gyp | test/analyzer/gyptest-analyzer.py | Python | bsd-3-clause | 13,761 |
# Copyright (c) 2015 OpenStack Foundation
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# 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:/... | openstack/python-glanceclient | glanceclient/tests/unit/v2/test_client_requests.py | Python | apache-2.0 | 3,930 |
# coding: utf-8
from . import pos_order
| grap/odoo-addons-it | intercompany_trade_point_of_sale/models/__init__.py | Python | agpl-3.0 | 40 |
import numpy as np
from PIL import Image
data = np.fromfile('data/float32.dat', dtype=np.float32)
data = data.reshape((360,720))
Image.fromarray(data*10**7).show()
| jsheedy/velotronheavyindustries.com | intro-to-d3-grid-map/bin/load_data.py | Python | mit | 165 |
import os
from django.core.exceptions import ImproperlyConfigured
from unipath import Path
def get_env_variable(var_name):
try:
return os.environ[var_name]
except KeyError:
error_msg = "Set the {} environment variable".format(var_name)
raise ImproperlyConfigured(error_msg)
BASE_DIR... | shazadan/mood-map | config/settings/base.py | Python | gpl-2.0 | 2,641 |
from setuptools import find_packages, setup
VERSION = "4.0.0"
LONG_DESCRIPTION = """
.. image:: http://pinaxproject.com/pinax-design/patches/pinax-announcements.svg
:target: https://pypi.python.org/pypi/pinax-announcements/
===================
Pinax Announcements
===================
.. image:: https://img.shield... | pinax/django-announcements | setup.py | Python | mit | 3,593 |
# -*- coding: utf-8 -*-
import sys, re, subprocess, os
from os.path import join as pjoin
from pyLibQMC import parseCML, paths, misc
try:
import DCVizWrapper as viz
canViz = True
except:
print "Displaying results not available: No DCViz installation found."
canViz = False
def initRun(n_p, path, name,... | jorgehog/QMC2 | tools/reCalcDist.py | Python | gpl-3.0 | 2,222 |
# -*- coding: utf-8 -*-
import sys
import os
dirname = os.path.dirname(__file__)
class ChallengeAlreadyExist(Exception): pass
if __name__ == '__main__':
if len(sys.argv) == 2:
ch_name = sys.argv[1]
newdir = os.path.join(dirname, ch_name)
if not os.path.exists(newdir):
os.... | NQysit/pybwap | pybwap/newchallenge.py | Python | mit | 1,519 |
#!/usr/bin/python3
from __future__ import print_function
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import sys
import scipy
from tqdm import tqdm
import django
from django.utils imp... | fzenke/morla | scripts/compute_feature_vectors.py | Python | mit | 1,674 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from resources.datatables import FactionStatus
from java.util import Vector
def addTemplate(co... | agry/NGECore2 | scripts/mobiles/generic/faction/imperial/crackdown_stormtrooper_captain.py | Python | lgpl-3.0 | 1,634 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-07 17:05:11
import os
import json
import time
import logging
import itertools
from six.moves import queue as Queue
from collections import deque
... | scrollpointclick/pyspider | pyspider/scheduler/scheduler.py | Python | apache-2.0 | 33,344 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (C) 2016 University of Dundee & Open Microscopy Environment.
All Rights Reserved.
Copyright 2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
pytest fixtures used as def... | joansmith/openmicroscopy | components/tools/OmeroPy/test/integration/gatewaytest/test_config_service.py | Python | gpl-2.0 | 1,266 |
"""
This bootstrap module should be used to setup parts of the admin plugin
that need to exist before all controllers are loaded. It is best used to
define/register hooks, setup namespaces, and the like.
"""
from pkg_resources import get_distribution
from cement.core.namespace import CementNamespace, register_nam... | iuscommunity/ius-tools | src/iustools.admin/iustools/bootstrap/admin.py | Python | gpl-2.0 | 2,964 |
# 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... | ychfan/tensorflow | tensorflow/python/layers/base_test.py | Python | apache-2.0 | 33,604 |
import json
import logging
import requests
from appr.client import ApprClient
from appr.auth import ApprAuth
import kpm
__all__ = ['Registry']
logger = logging.getLogger(__name__)
DEFAULT_REGISTRY = 'http://localhost:5000'
API_PREFIX = '/api/v1'
DEFAULT_PREFIX = "/cnr"
class Registry(ApprClient):
def __init_... | kubespray/kpm | kpm/registry.py | Python | apache-2.0 | 1,196 |
# vec2d.py -- written by Andrej Karpathy
import operator
import math
class vec2d(object):
"""2d vector class, supports vector and scalar operators,
and also provides a bunch of high level functions
"""
__slots__ = ['x', 'y']
def __init__(self, x_or_pair, y = None):
if y == None:
... | AjayMT/game-of-life | vec2d.py | Python | mit | 10,362 |
import copy
import logging
import platform
import os
from termcolor import colored
try:
# This import has side effects and is needed to make input() behave nicely
import readline # pylint: disable=unused-import
except ImportError: # pragma: no cover
pass
from coalib.misc.DictUtilities import inverse_di... | nemaniarjun/coala | coalib/output/ConsoleInteraction.py | Python | agpl-3.0 | 42,987 |
from django.contrib import admin
from concerns.models import Concern
class ConcernAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'reporter', 'status', 'resolved', 'created')
admin.site.register(Concern, ConcernAdmin)
| chop-dbhi/django-concerns | concerns/admin.py | Python | bsd-2-clause | 233 |
#######################################
# Code coded by Mike Doty
#
# If you want trackball checking, you will
# have to code it yourself. Sorry!
#
# Oh, and it just grabs the first joystick.
# Yes, that makes me lazy.
#
# Released February 8, 2008.
#######################################
import pygame
from pygame... | carlfsmith/LunaBot | 2013/Control/joystick_example.py | Python | apache-2.0 | 5,043 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
# compatibilidade entre Python2 e 3.
"""
Django settings for sigsis project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of... | amilcarsimm/sigsis-tcc | sigsis/settings.py | Python | gpl-3.0 | 5,488 |
from aldryn_client import forms
class Form(forms.BaseForm):
def to_settings(self, data, settings):
return settings
| aldryn/aldryn-snake | aldryn_config.py | Python | bsd-2-clause | 129 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Server side functions for tagging.
- Tags can be added to any record (doctype, name) in the system.
- Items are filtered by tags
- Top tags are shown in the sidebar (?)
- ... | geo-poland/frappe | frappe/widgets/tags.py | Python | mit | 2,808 |
# coding: utf-8
# # Multiclass Support Vector Machine exercise
#
# *Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignment... | DavidQiuChao/CS231nHomeWorks | assignment1/svm.py | Python | mit | 14,717 |
#!/usr/bin/env python
#
# Copyright 2015 Google 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 applic... | GoogleCloudPlatformTraining/cp100-appengine-memcache-python | guestbook.py | Python | apache-2.0 | 1,998 |
import locale
_localecharset = locale.getpreferredencoding()
def encode(string):
return string.encode(_localecharset, "replace")
def decode(_bytes):
return _bytes.decode(_localecharset, "replace")
| joerg-lehmann/PyTone | src/encoding.py | Python | gpl-2.0 | 208 |
## This is a dummy router for now
##
## In the future, it will route read replica calls to the right place
import logging
log=logging.getLogger(__name__)
class MITxRouter(object):
"""
A router to control all database operations on models in the
auth application.
"""
def db_for_read(self, model, **... | edx/edxanalytics | src/edxanalytics/edxanalytics/mitxrouter.py | Python | agpl-3.0 | 1,694 |
# distinfo.py - provide meta information for distro repositories
#
# Copyright (c) 2005 Gustavo Noronha Silva <kov@debian.org>
# Copyright (c) 2006-2007 Sebastian Heinlein <glatzor@ubuntu.com>
#
# Authors: Gustavo Noronha Silva <kov@debian.org>
# Sebastian Heinlein <glatzor@ubuntu.com>
#
# This program i... | 2ndy/RaspIM | usr/share/pyshared/aptsources/distinfo.py | Python | gpl-2.0 | 11,567 |
#!/usr/bin/env python
# mainly for sys.argv[], sys.argv[0] is the name of the program
import sys
def sqroot(anum):
"""
Compute square root of a number via Newton's method
Newton's method is to approximate z = Sqrt(x) by picking a starting point z and then repeating:
z = z - (z*z - x)/(2*z)
"""
... | ketancmaheshwari/hello-goog | src/python/sqroot.py | Python | apache-2.0 | 805 |
"""
Python 3.7 で 辞書の挿入順序が保持されることを確認するサンプルです。
REFERENCES:: http://bit.ly/2VIggXP
http://bit.ly/2VySRIe
http://bit.ly/2VFhjI4
http://bit.ly/2VEq058
http://bit.ly/2VBKrzK
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
... | devlights/try-python | trypython/basic/dict_/dict_preserved_insert_order_py37.py | Python | mit | 1,231 |
# -*- coding: UTF-8 -*-
# Copyright (C) 2017 Alexandre Bonny <alexandre.bonny@protonmail.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 Foundation, either version 3 of the License, or
# (at your opt... | bepatient-fr/itools | test/test_dispatcher.py | Python | gpl-3.0 | 6,186 |
# This file is part of sydpy.
#
# Copyright (C) 2014-2015 Bogdan Vukobratovic
#
# sydpy 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 option)... | bogdanvuk/sydpy | sydpy/extens/simprog.py | Python | lgpl-2.1 | 1,325 |
from discord import Embed, Color
description = "Help"
CMDMAP = None
async def ex(message, client):
await client.send_message(message.author, embed=Embed(
color=Color.green(),
title="knechtBot - Help",
description="**[Here](https://docs.google.com/spreadsheets/d/e/2PACX-1vR_XkUXIhCNhnpqF... | zekroTJA/regiusBot | commands/cmd_help.py | Python | mit | 609 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from biffy import views
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'biffy.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', include('floweditor.urls')),
url(r'^floweditor/', include('... | PeterCloudyWillmott/biffy | biffy/urls.py | Python | mit | 519 |
from django.test import TestCase
from django.core.exceptions import ValidationError
from ...models import Validator
class ValidatorModelTest(TestCase):
def test_creation(self):
validator = Validator(name="name", regex=r"[a-zA-Z]+")
validator.save()
def test_invalid(self):
validator = ... | ConstellationApps/Forms | constellation_forms/tests/models/testValidator.py | Python | isc | 534 |
# Copyright (c) 2013 OpenStack Foundation
#
# 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 ... | huaweiswitch/neutron | neutron/plugins/ml2/drivers/huawei/config.py | Python | apache-2.0 | 1,533 |
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
'{{last_name}} {{company_suffix}}',
'{{first_name}} {{last_name}} s.p.',
)
company_suffixes = (
'd.o.o.', 'd.d.',
)
| danhuss/faker | faker/providers/company/sl_SI/__init__.py | Python | mit | 247 |
"""Base Treehopper API for Python.
This module provides digital and analog I/O, hardware and software PWM, I2C, SPI, and UART support.
"""
## @namespace treehopper.api
from treehopper.api.interfaces import *
from treehopper.api.pin import Pin, PinMode, ReferenceLevel
from treehopper.api.device_commands import DeviceC... | treehopper-electronics/treehopper-sdk | Python/treehopper/api/__init__.py | Python | mit | 976 |
# =============================================================================
# OWSLib. Copyright (C) 2005 Sean C. Gillies
#
# Contact email: sgillies@frii.com
#
# $Id: wfs.py 503 2006-02-01 17:09:12Z dokai $
# =============================================================================
#owslib imports:
from owslib... | rbejar/odrl-ogc-cache-policies | owslib/feature/wfs200.py | Python | mit | 17,661 |
#!/usr/bin/python
# Copyright 2018 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 required by ... | deepmind/pysc2 | pysc2/lib/replay.py | Python | apache-2.0 | 1,345 |
import copy
from functools import partial
from collections import defaultdict
from django.db import models
from django.conf import settings
from django.db.models.options import DEFAULT_NAMES as ALL_META_OPTIONS
from utils import *
from storage import *
from constants import *
from history_model_methods import get_his... | mivanov/editkit | editkit/versionutils/versioning/models.py | Python | gpl-2.0 | 28,965 |
import numpy as np
class mymesh(np.ndarray):
def __new__(cls, init, val=0.0):
"""
Instantiates new datatype. This ensures that even when manipulating data, the result is still a mesh.
Args:
init: either another mesh or a tuple containing the dimensions, the communicator and t... | Parallel-in-Time/pySDC | pySDC/playgrounds/other/parallel_rhs_mesh.py | Python | bsd-2-clause | 1,490 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
class KMultiTabBar(__PyQt4_Qt... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyKDE4/kdeui/KMultiTabBar.py | Python | gpl-2.0 | 1,780 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
from ggrc import db
from sqlalchemy.orm import validates
from .mixins import d... | hyperNURb/ggrc-core | src/ggrc/models/product.py | Python | apache-2.0 | 1,890 |
import pyexcel as p
from nose.tools import eq_
def test_a_dictionary_of_sheet():
test_data = [["a", "b"]]
book_dict = {"test": p.Sheet(test_data)}
book = p.Book(book_dict)
eq_(book.test.array, test_data)
def test_book_len():
test_data = [["a", "b"]]
book_dict = {"test": p.Sheet(test_data... | chfw/pyexcel | tests/test_book.py | Python | bsd-3-clause | 609 |
#import json
#import csv
class Series():
def __init__(self, games=None):
self.games = games or []
def from_json(self):
pass
def to_json(self):
pass
def from_csv(self):
pass
def to_csv(self):
pass
def avg_score(self):
scores = [g.score() for... | matthiaseisen/bowlingstats | bowling/series.py | Python | mit | 474 |
from __future__ import print_function
import os
from ants.utils.job import job_dir
from ants.utils.request import request_fingerprint
from ants.utils import log
class BaseDupeFilter(object):
@classmethod
def from_settings(cls, settings):
return cls()
def request_seen(self, request):
retu... | wcong/ants | ants/utils/dupefilter.py | Python | bsd-3-clause | 2,083 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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... | keyru/hdl-make | hdlmake/action/list_modules.py | Python | gpl-3.0 | 2,363 |
from __future__ import absolute_import
from typing import Any, Callable, Generator, Iterable, Tuple
from django.test import TestCase
from django.template import loader
from zerver.lib.initial_password import initial_password
from zerver.lib.db import TimeTrackingCursor
from zerver.lib.handlers import allocate_handler... | peiwei/zulip | zerver/lib/test_helpers.py | Python | apache-2.0 | 14,518 |
import asyncio
from asyncio import ensure_future
from smartlink import Node, NodeServer
import sys
from pathlib import Path # if you haven't already done so
root = str(Path(__file__).resolve().parents[1])
sys.path.append(root)
from devices import alicat
def main():
node = Node("Flow Control Comupter")
# po... | sgsdxzy/smartlink | bin/FlowControl.py | Python | gpl-3.0 | 707 |
from django.shortcuts import render_to_response
from models import *
from utils import *
import time
import pprint
import urllib2
import simplejson as json
def test(request):
return renderTextResponse("abc")
"""
-> mywalk.com/subscribe?guid=[string]&uri=[string]&extra=[string]
"""
def subscribe(request):
... | lugia/Python-MyWalk | base/views.py | Python | apache-2.0 | 6,682 |
import unittest
from worldengine.drawing_functions import draw_ancientmap, gradient, draw_rivers_on_image
from worldengine.world import World
from tests.draw_test import TestBase, PixelCollector
class TestDrawingFunctions(TestBase):
def setUp(self):
super(TestDrawingFunctions, self).setUp()
self... | tmfoltz/worldengine | tests/drawing_functions_test.py | Python | mit | 1,681 |
# run tests with
# python -m unittest
# this file only exists to make this directory discoverable by unittest
# you must have MongoDB installed locally to run Mango's tests
| JoshKarpel/mango | tests/__init__.py | Python | mit | 175 |
import io
import re
import base64 as b64
import datetime
from typing import List
from typing import Optional
from typing import Callable
from typing import Generic
from collections import OrderedDict
import numpy as np
from django.urls import reverse
from django.conf import settings
from django.core.mail import send_ma... | efce/voltPy | manager/helpers/functions.py | Python | gpl-3.0 | 14,859 |
from gwt.ui.FocusListener import (
DOM,
Event,
FOCUS_EVENTS,
FocusHandler,
fireFocusEvent,
)
| anandology/pyjamas | library/pyjamas/ui/FocusListener.py | Python | apache-2.0 | 113 |
import unittest
from context import html2md
from assertions import assertEq
class PreTest(unittest.TestCase):
def test_default(self):
in_html = u'''
<pre>
def getText(self, separator=u""):
if not len(self.contents):
return u""
stopNode = self._lastRecursiveChild().next
strings = []
... | al3xandru/html2md | tests/test_pre.py | Python | bsd-2-clause | 6,782 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='iotly',
version='0.1.0',
description='IOT node based on Raspberry Pi GPIO',
long_description=readme,
author='Sim... | nottix/iotly | setup.py | Python | bsd-2-clause | 503 |
import struct
from Ensemble.Ensemble import Ensemble
from log import logger
from datetime import datetime
class EnsembleData:
"""
Ensemble Data DataSet.
Integer values that give details about the ensemble.
"""
def __init__(self, num_elements, element_multiplier):
self.ds_type = 10
... | ricorx7/rti-python | Ensemble/EnsembleData.py | Python | bsd-3-clause | 4,924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.