code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: UTF-8 -*-
from django import forms
from models import *
import re
from django.utils.translation import ugettext, ugettext_lazy as _
class MiembrosInstForm(forms.ModelForm):
class Meta:
model = MiembrosdeInstituciones
fields = ('institucion','miembros','estatu')
... | desarrollosimagos/svidb | administrativo/actores/forms.py | Python | gpl-3.0 | 6,041 |
# 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... | DCSaunders/tensorflow | tensorflow/python/kernel_tests/embedding_ops_test.py | Python | apache-2.0 | 27,359 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import copy
import glob
import json
import os
import unittest
from pymatgen import Molecule
from pymatgen.io.qchem import QcTask, QcInput, QcOutput
from pymatgen.util.t... | aykol/pymatgen | pymatgen/io/tests/test_qchem.py | Python | mit | 81,842 |
import os
config = {
"buildbot_json_path": "buildprops.json",
"host_utils_url": "http://talos-remote.pvt.build.mozilla.org/tegra/tegra-host-utils.Linux.742597.zip",
"robocop_package_name": "org.mozilla.roboexample.test",
"device_ip": "127.0.0.1",
"default_sut_port1": "20701",
"default_sut_port2... | kartikgupta0909/build-mozharness | configs/android/androidx86.py | Python | mpl-2.0 | 5,532 |
"""Tasks we perform on the master server.
See `askmaster.py` for tasks that are run on minions."""
import os, time
import cfn, buildvars, utils
from buildercore.command import remote_sudo, local
from buildercore import core, bootstrap, config, keypair, project, cfngen, context_handler
from buildercore.utils import lm... | elifesciences/builder | src/master.py | Python | mit | 8,407 |
import commands
from dataservice.DDM import ddm
#print ddm.DQ2ProductionClient.generateUUID()
#print ddm.DQ2.getFilesFromCatalog('aho.xml')
#print ddm.DQ2ProductionClient.dq2_makeblocks('input.data')
ids=['pandatest.000003.dd.input._00047.junk','09801b0a-9fd0-4237-8caf-a37932c26e39',
'pandatest.000003.dd.input._... | RRCKI/panda-server | pandaserver/test/testDQ.py | Python | apache-2.0 | 6,730 |
# -*- coding: utf-8 -*-
"""
xkbgroup
~~~~~~~~
Use this library to change the keyboard layout through XKB extension
(subsystem) of the X server system.
:copyright: (c) 2016 by Nguyen Duc My.
:license: MIT, see LICENSE for more details.
"""
from .core import XKeyboard, X11Error
| hcpl/xkbgroup | xkbgroup/__init__.py | Python | mit | 305 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 10 11:29:03 2016
@author: Bram
"""
import pandas as pan
import codecs
import numpy as np
import os
#Find computer user
user=os.getlogin()
#Fine last session version
fileList=os.listdir("C:/Users/%s/Desktop/QuestionHistCrit/saves" %user)
fileList=sorted(fileList)
lastFi... | Beramos/QuestionHistCrit | Questioner.py | Python | cc0-1.0 | 3,231 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ===============================================================
#
# Filename: setup.py
#
# Author: Oxnz
# Email: yunxinyi@gmail.com
# Created: 2015-12-28 09:46:31 CST
# Last-update: 2015-12-28 09:46:31 CST
# Description: ANCHOR
#
# Version: 0.0.1
# Revision: [None]
# ... | oxnz/work-stuff | logparse/setup.py | Python | mit | 935 |
from __future__ import print_function
import numpy, plots, math, operator, copy
COPY = copy.deepcopy
# define a post-processing operation that always remembers the last data set and
# computes statistical differences between that one and the next data set.
# After that, the new data set becomes the last one.
# Pur... | haavee/jiveplot | postprocessing/compare_data.py | Python | gpl-3.0 | 3,436 |
import random
BOARD = ['a1', 'a2', 'a3', 'b1', 'b2', 'b3', 'c1', 'c2', 'c3']
def play_turn(
player_role,
owned_by_x,
owned_by_zero
):
available_squares = list( set(BOARD) - set(owned_by_x) - set(owned_by_zero) )
return random.choice(available_squares)
| rosedu/I.GameBot | tictactoe/game_bots/random_bot_02_python/tictactoe_play_turn.py | Python | agpl-3.0 | 293 |
from __future__ import annotations
def test_run(dials_regression, run_in_tmpdir):
from os.path import join
from dxtbx.model.experiment_list import ExperimentListFactory
from dials.array_family import flex
from dials.command_line.export import phil_scope
from dials.util.nexus import dump, load
... | dials/dials | tests/util/test_nexus.py | Python | bsd-3-clause | 4,907 |
'''
Created on Sep 27, 2013
@author: leal
Default JSON MESSAGES
'''
import ast
import logging
import config.config
logger = logging.getLogger(__name__)
class Messages(object):
'''
classdocs
'''
messageTemplate = """{
'success' : '%r',
'message' : '%s',
'details' : %r
... | ricleal/reductionServer | src/data/messages.py | Python | gpl-3.0 | 1,661 |
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 java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | agry/NGECore2 | scripts/mobiles/endor/merek_harvester.py | Python | lgpl-3.0 | 1,557 |
# DataviewMappingColumn.py
#
# Copyright 2019 OSIsoft, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# <http://www.apache.org/licenses/LICENSE-2.0>
#
# Unless required by applicable l... | osisoft/Qi-Samples | ocs_samples/library_samples/Python3/ocs_sample_library_preview/Dataview/DataviewMappingColumn.py | Python | apache-2.0 | 2,497 |
import logging
import os
import simplejson as json
from tempfile import mkstemp
import unittest
from auslib.global_state import dbo, cache
from auslib.web.admin.base import app
from auslib.blobs.base import createBlob
def setUpModule():
# Silence SQLAlchemy-Migrate's debugging logger
logging.getLogger('migra... | aksareen/balrog | auslib/test/admin/views/base.py | Python | mpl-2.0 | 10,366 |
""" Module for I/O
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from builtins import super
import numpy as np
from astropy.table import Table
from scipy.interpolate import CubicSpline
from . import __path__
DATA_PATH = os.path... | benbaror/ne2001 | src/ne2001/ne_io.py | Python | bsd-2-clause | 6,520 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
... | alexandrul-ci/robotframework | src/robot/writer/__init__.py | Python | apache-2.0 | 1,065 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, 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 program is free software: you can redistribute it and/or modify
# it unde... | mrcslws/nupic.research | projects/imagenet/create_imagenet_hdf5.py | Python | agpl-3.0 | 3,040 |
'''
PyDMET: a python implementation of density matrix embedding theory
Copyright (C) 2014, 2015 Sebastian Wouters
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... | SebWouters/PyDMET | oldstuff/HubbardDMETshiwei.py | Python | gpl-2.0 | 12,673 |
# -*- encoding: utf-8 -*-
from supriya.tools.ugentools.MultiOutUGen import MultiOutUGen
class DecodeB2(MultiOutUGen):
r'''
::
>>> decode_b_2 = ugentools.DecodeB2.ar(
... channel_count=channel_count,
... orientation=0.5,
... w=w,
... x=x,
... ... | andrewyoung1991/supriya | supriya/tools/pendingugentools/DecodeB2.py | Python | mit | 5,473 |
# 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... | tornadozou/tensorflow | tensorflow/contrib/__init__.py | Python | apache-2.0 | 3,590 |
from tornado import web
from handlers.BaseHandler import BaseHandler, wrap_async_rpc, wrap_catch
from core import FM
class LogoutHandler(BaseHandler):
def data_received(self, chunk):
pass
@wrap_async_rpc
@wrap_catch
@web.authenticated
def post(self):
action = self.get_action(nam... | f-andrey/sprutio | app/handlers/actions/main/LogoutHandler.py | Python | gpl-3.0 | 424 |
import logging
import urllib2
import urlparse
from django.conf import settings
from django.core.files.storage import Storage
from django.core.files.base import ContentFile
from django.core.exceptions import ImproperlyConfigured
from django.utils.http import urlquote
from django.core.cache import cache
from storages.b... | seanbell/opensurfaces | server/common/backends.py | Python | mit | 7,686 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google/ml-fairness-gym | spaces/multinomial_test.py | Python | apache-2.0 | 3,523 |
import math
def f(n):
solutions = []
for a in xrange(1, n / 2):
aa = a**2
for b in xrange(a, n / 2):
bb = b**2
sqrt = math.sqrt(aa ++ bb)
if a + b + sqrt == n and sqrt == int(sqrt):
solutions.append([a, b, int(sqrt)])
return len(solutions... | ericdahl/project-euler | python/p039.py | Python | bsd-3-clause | 412 |
import numpy as np
import matplotlib.pyplot as plt
import scipy.optimize as opt
# Definirajmo funkcijo, ki jo fitamo
f = lambda x, A, B: A * np.exp(B * x)
data = np.loadtxt('../data/boltz.dat', skiprows=1, delimiter=',')
# Klicemo curve_fit, kjer je
# - sigma: seznam napak y koordinate
# - p0: zacetni priblizki pa... | ntadej/racorodja | python/fit.py | Python | mit | 711 |
"""Tests for distutils.command.register."""
# -*- encoding: utf8 -*-
import sys
import os
import unittest
import getpass
import urllib2
import warnings
from test.test_support import check_warnings, run_unittest
from distutils.command import register as register_module
from distutils.command.register impor... | ktan2020/legacy-automation | win/Lib/distutils/tests/test_register.py | Python | mit | 7,870 |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: ProxyHandler.py
Description :
Author : JHao
date: 2016/12/3
-------------------------------------------------
Change Activity:
2016/12/03:
2020/05/26: 区分http和h... | jhao104/proxy_pool | handler/proxyHandler.py | Python | mit | 2,079 |
import os
import sys
import subprocess
import shutil
import requests
import utils
#try to hide it
SERVICE_NAME = "Win32"
if getattr(sys, 'frozen', False):
EXECUTABLE_PATH = sys.executable
elif __file__:
EXECUTABLE_PATH = __file__
else:
EXECUTABLE_PATH = ''
EXECUTABLE_NAME = os.path.basename(EXECUTABLE_PA... | EzLucky/Wares | client/modules/persistence.py | Python | mit | 1,886 |
# -*- coding: utf-8 -*-
from pymongo import MongoClient
import numpy as np
import gensim, cython, codecs, os, logging, re, json, time
from gensim import models, corpora
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
# from nltk.corpus import stopword
# from nltk.stem import *
# f... | kgyl/twitter-data-analysis | scripts/not_used/process_data.py | Python | gpl-3.0 | 4,274 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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',
'status': ['preview'],
... | veger/ansible | lib/ansible/modules/network/aci/aci_ap.py | Python | gpl-3.0 | 6,984 |
"""Test that GOEnrichmentStudy fails elegantly given incorrect stimulus.
python test_goea_errors.py
"""
__copyright__ = "Copyright (C) 2016-2017, DV Klopfenstein, H Tang. All rights reserved."
__author__ = "DV Klopfenstein"
import sys
import os
from goatools.base import get_godag
from goatools.go_enrichment ... | lileiting/goatools | tests/test_goea_errors.py | Python | bsd-2-clause | 2,261 |
# coding=UTF-8
from django.db import models
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext as _
from django.template import loader, Context
from django.core.urlresolvers import reve... | bithinalangot/ecidadania-dev | src/apps/thirdparty/userprofile/models.py | Python | gpl-3.0 | 5,338 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 0, transform = "BoxCox", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_BoxCox/trend_PolyTrend/cycle_0/ar_12/test_artificial_128_BoxCox_PolyTrend_0_12_100.py | Python | bsd-3-clause | 263 |
from biicode.common.test import model_creator as mother, testfileutils
from biicode.common.edition.processors.cpp_implementation import CPPImplementationsProcessor
from biicode.common.model.cells import SimpleCell
from biicode.common.model.bii_type import BiiType, CPP
from nose_parameterized import parameterized
from b... | zhangf911/common | test/edition/processors/cpp_implementation_test.py | Python | mit | 9,113 |
# -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
... | AbsentMoniker/ECE463Honors | web2py/applications/welcome/models/db.py | Python | gpl-2.0 | 3,619 |
import logging
import re
import numpy
logger = logging.getLogger(__name__)
from hyo2.soundspeed.formats.readers.abstract import AbstractTextReader
from hyo2.soundspeed.profile.dicts import Dicts
from hyo2.soundspeed.base.callbacks.cli_callbacks import CliCallbacks
from hyo2.soundspeed.temp import coordinates
from h... | hydroffice/hyo_soundspeed | hyo2/soundspeed/formats/readers/simrad.py | Python | lgpl-2.1 | 8,879 |
# -*- coding: utf-8 -*-
"""
Created on Mon May 23 13:15:10 2016
@author: nn31
"""
import pandas as pd
import pickle
import re
import numpy as np
#read in cmmi data
cmmi = pd.read_csv("/Volumes/DCCRP_projects/CMMI/data/QDACT 05-03-2016.csv",
parse_dates=['AssessmentDate','AdmissionDate','Discharge... | benneely/qdact-basic-analysis | notebooks/python_scripts/06_phenotype_algorithms.py | Python | gpl-3.0 | 1,722 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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 t... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/dashboards/project/stacks/tabs.py | Python | apache-2.0 | 3,774 |
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
from setuptools import find_packages
from setuptools import setup
def get_long_description():
with open('README.md') as readme_file:
return readme_file.read()
setup(
name='jsonapi... | socialwifi/jsonapi-requests | setup.py | Python | bsd-3-clause | 1,500 |
from direct.actor import Actor
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import Sequence, Func
from toontown.hood import InteractiveAnimatedProp
from toontown.hood import GenericAnimatedProp
from toontown.toonbase import ToontownGlobals, ToontownBattleGlobals, TTLocalizer
c... | ksmit799/Toontown-Source | toontown/hood/MailboxInteractiveProp.py | Python | mit | 10,805 |
from telebot import types
from tululbot.utils import TululBot
class TestTululBot:
def test_user_property(self, mocker, fake_user):
bot = TululBot('TOKEN')
mock_get_me = mocker.patch.object(bot, 'get_me', autospec=True,
return_value=fake_user)
rv... | tulul/tululbot | tests/test_utils.py | Python | apache-2.0 | 1,184 |
# Copyright (c) 2013, Nathan Dunsworth - NFXPlugins
# 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 list... | ndunsworth/python-shotgunorm | ShotgunORM/SgQueryEngine.py | Python | bsd-3-clause | 12,533 |
class NotFound(Exception):
"""
This Exception should be raised, when the user queries an API and gets a
404 response.
"""
pass
class MultipleItemsReturned(Exception):
"""
This Exception should be raised, when the user queries an API for one
Resource, but more than one are returned.
... | sourcelair/jason | jason/exceptions.py | Python | mit | 469 |
def lmgtfy(message):
m = bot.send_message(message.chat.id, "Please send the query you want to be LMGTFY'ed in your next message")
zigzag.nextstep(m, "lmgtfyquery")
def lmgtfyquery(message):
textl = message.text.replace("/lmgtfy ","", 1).replace("/Lmgtfy ", "", 1).replace("+","%2B")
rez = urllib.urlopen("http:/... | WebShark025/ZigZag-v2 | plugins/lmgtfy.py | Python | mit | 1,560 |
import os
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('directory', type=str)
parser.add_argument('--output_file', type=str, default=None)
parser.add_argument('--recursive', action='store_true')
args = parser.parse_args()
root_dir = args.directory
img_exts = ['.jpg', '.png']
img... | phg1024/MultilinearReconstruction | create_setting_file.py | Python | mit | 1,493 |
from time import strftime
class API_efaBeta(object):
def __init__( self ):
self.name = 'efaBeta'
self.baseurl = 'https://www3.vvs.de/mngvvs/XML_DM_REQUEST'
def convert_station_id( self, station_id ):
"""
convert station id that is given to the api specific
repre... | jhertfe/vvs-delay | crawler/crawlerhelpers/efa_beta.py | Python | mit | 4,703 |
from django.core.management.base import BaseCommand
from danceschool.financial.helpers import (
createExpenseItemsForEvents, createExpenseItemsForVenueRental, createRevenueItemsForRegistrations
)
from danceschool.core.constants import getConstant
class Command(BaseCommand):
help = 'Create expense items for r... | django-danceschool/django-danceschool | danceschool/financial/management/commands/create_financial_items.py | Python | bsd-3-clause | 1,459 |
import os
import sys
import glob
import shutil
import errno
import logging
from contextlib import contextmanager
from plumbum.lib import _setdoc, IS_WIN32
from plumbum.path.base import Path, FSUser
from plumbum.path.remote import RemotePath
try:
from pwd import getpwuid, getpwnam
from grp import getgrgid, getgr... | weka-io/plumbum | plumbum/path/local.py | Python | mit | 10,605 |
# coding=utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import os
import django.utils.translation.trans_real
from . import parser
class TranslationsLoader(object):
def __init__(self, locale_paths=(), locales=()):
self.locale_pat... | kmichel/po-localization | po_localization/translations_loader.py | Python | mit | 1,328 |
# -*- encoding: utf-8 -*_
def zip_sequences(sequences, cyclic=False, truncate=True):
r'''Zips `sequences`.
.. container:: example
Zips two `sequences` cyclically:
::
>>> sequences = [[1, 2, 3], ['a', 'b']]
>>> sequencetools.zip_sequences(sequences, cyclic=True)
... | mscuthbert/abjad | abjad/tools/sequencetools/zip_sequences.py | Python | gpl-3.0 | 2,167 |
# oppia/profile/forms.py
import hashlib
import urllib
from django import forms
from django.conf import settings
from django.contrib.auth import (authenticate, login, views)
from django.core.urlresolvers import reverse
from django.core.validators import validate_email
from django.contrib.auth.models import User
from dj... | DigitalCampus/django-instrat-oppia | oppia/profile/forms.py | Python | gpl-3.0 | 13,649 |
import pytest
import watchmaker
@pytest.fixture
def setup_object():
pass
def test_main():
"""Placeholder for tests"""
# Placeholder
assert watchmaker.__version__ == watchmaker.__version__
| MarionTheBull/watchmaker | tests/test_watchmaker.py | Python | apache-2.0 | 209 |
import unittest
import numpy
import pytest
import cupy
from cupy import testing
from cupy.cuda import runtime
from cupy.cuda.texture import (ChannelFormatDescriptor, CUDAarray,
ResourceDescriptor, TextureDescriptor,
TextureObject,)
class TestUserkernel(u... | cupy/cupy | tests/cupy_tests/core_tests/test_userkernel.py | Python | mit | 12,653 |
__author__ = 'Yunxi Lin'
from pages.BasePage import BasePage
class ApprovalPage(BasePage):
def print_display(self):
self.logger.info('Approved Page displayed') | jchen7960/python_framework | pages/ApprovalPage.py | Python | mit | 172 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# This module is Copyright (c) 2009-2013 General Solutions (http://gscom.vn) All Rights Reserved.
{
"name" : "Vietnam Chart of Accounts",
"version" : "1.0",
"author" : "General Solutions",
'website': 'ht... | tvtsoft/odoo8 | addons/l10n_vn/__openerp__.py | Python | agpl-3.0 | 853 |
import sys
from django import http
from django.core import signals
from django.utils.encoding import force_unicode
from django.utils.importlib import import_module
from django.utils.log import getLogger
logger = getLogger('django.request')
class BaseHandler(object):
# Changes that are always applied to a respon... | lzw120/django | django/core/handlers/base.py | Python | bsd-3-clause | 11,893 |
# Copyright (C) 2013 Cardiff University
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is d... | jongiddy/balcazapy | python/balcaza/t2flow.py | Python | lgpl-2.1 | 16,002 |
#!/usr/bin/env python
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
parameter_list=[[traindat,testdat, 1.3],[traindat,testdat, 1.4]]
def kernel_gaussian_modular (train_fname=traindat,test_fname=testdat, width=1.3):
from modshogun import RealFeatures, GaussianKernel, CSVFile
feats_trai... | AzamYahya/shogun | examples/undocumented/python_modular/kernel_gaussian_modular.py | Python | gpl-3.0 | 695 |
import json
import re
import requests
from requests.auth import HTTPBasicAuth
from django.conf import settings
from django.http import HttpResponse, Http404
from django.contrib.auth.decorators import login_required
from django.core.signing import Signer
from planbox_data.models import Project
from shareabouts_integrati... | civiclaboratories/planbox | src/shareabouts_integration/views.py | Python | gpl-3.0 | 8,376 |
# -*- coding: utf-8 -*-
'''Core plugins unit tests'''
import os
import tempfile
import unittest
import time
from contextlib import contextmanager
from tempfile import mkdtemp
from shutil import rmtree
from hashlib import md5
import gzip_cache
@contextmanager
def temporary_folder():
"""creates a temporary folder... | mikitex70/pelican-plugins | gzip_cache/test_gzip_cache.py | Python | agpl-3.0 | 4,627 |
#
# Copyright 2014 Rackspace, 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 ... | redhat-openstack/ironic | ironic/tests/common/test_pxe_utils.py | Python | apache-2.0 | 22,973 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#############################################
# Flask & werkzeug HTTP Proxy Sample code.
# - Code by Jioh L. Jung (ziozzang@gmail.com)
#############################################
import ConfigParser
import os
import docker
from docker.utils import kwargs_from_env
import time... | kbaseIncubator/kbrouter | kbservices.py | Python | mit | 7,353 |
import base64
from io import BytesIO
import os
from PIL import Image
class ImageProcessor:
def __init__(self,request):
img64 = request.POST.get('imgUrl')
img64 = img64[img64.find(',')+1:]
self.img = Image.open(BytesIO(base64.b64decode(img64)))
self.initDim = (int(request.POST.get('imgInitW')), int(request.P... | knoopr/ShotForTheHeart | ShotForTheHeart/models/ImageProcessor.py | Python | gpl-2.0 | 1,458 |
##############################################################################
#
# Copyright (c) 2001, 2002 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.
# T... | Donkyhotay/MoonPy | zope/app/publisher/interfaces/xmlrpc.py | Python | gpl-3.0 | 973 |
""" (disabled by default) support for testing pytest and pytest plugins. """
import gc
import sys
import traceback
import os
import codecs
import re
import time
import platform
from fnmatch import fnmatch
import subprocess
import py
import pytest
from py.builtin import print_
from _pytest.main import Session, EXIT_OK... | Akasurde/pytest | _pytest/pytester.py | Python | mit | 38,056 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from unittest import mock
except ImportError:
import mock
from django.test import TestCase
from hooks.viewhook import HookBase, HookProxy, Hook
class HookBaseTest(TestCase):
def setUp(self):
pass
def test_instance(self)... | nitely/django-hooks | hooks/tests/tests_viewhook.py | Python | mit | 4,892 |
import datetime
import time
import hlib.tests
import tests
class AbstractWait(object):
DEFAULT_TIMEOUT = 10
DEFAULT_DELAY = 0.5
def __init__(self, cond, timeout = None, delay = None):
super(AbstractWait, self).__init__()
self.cond = cond
self.timeout = timeout or AbstractWait.DEFAULT_TIMEOUT
s... | happz/settlers | tests/web/conditions/__init__.py | Python | mit | 1,964 |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202111/inventory_service/update_ad_units.py | Python | apache-2.0 | 2,750 |
from django.conf.urls import patterns, include, url
from .views import BandwidthHomeView
bandwidth_urls = patterns('',
url(
r'^$',
BandwidthHomeView.as_view(),
name='list'
),
# url(
# r'bandwidth/(?P<pk>[0-9]+)/$',
# BandwidthTestDetail.as_view(),
# name='r... | hellsgate1001/graphs | bandwidthtest/urls.py | Python | mit | 450 |
#!/usr/bin/env python3
# imports go here
from gevent import monkey
monkey.patch_all()
import time
from threading import Thread
import urllib
from flask import Flask, render_template
from flask.ext.socketio import SocketIO
from flask_debugtoolbar import DebugToolbarExtension
#
# Free Coding session for 2015-02-12
# W... | mfwarren/FreeCoding | 2015/02/fc_2015_02_12.py | Python | mit | 1,492 |
"""Ttk Frame with rounded corners.
Based on an example by Bryan Oakley, found at: http://wiki.tcl.tk/20152"""
import Tkinter
import ttk
root = Tkinter.Tk()
img1 = Tkinter.PhotoImage("frameFocusBorder", data="""
R0lGODlhQABAAPcAAHx+fMTCxKSipOTi5JSSlNTS1LSytPTy9IyKjMzKzKyq
rOzq7JyanNza3Ly6vPz6/ISChMTGxKSmpOTm5JSWlNTW1... | teeple/pns_server | work/install/Python-2.7.4/Demo/tkinter/ttk/roundframe.py | Python | gpl-2.0 | 5,601 |
# -*- coding: utf-8 -*-
# This file is part of Pate, Kate' Python scripting plugin.
#
# Copyright (C) 2013 Alex Turbov <i.zaufi@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundatio... | hlamer/kate | addons/kate/pate/src/kate/document/decorators.py | Python | lgpl-2.1 | 4,321 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('bufftracker', '0007_auto_20150530_0053'),
]
operations = [
migrations.AlterModelOptions(
name='casterlevelformul... | Ernir/bufftracker | bufftracker/migrations/0008_auto_20150829_1933.py | Python | mit | 399 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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',
'status': ['preview'],
... | tsdmgz/ansible | lib/ansible/modules/cloud/profitbricks/profitbricks_volume_attachments.py | Python | gpl-3.0 | 7,795 |
import nltk, os, sys
from nltk.corpus import PlaintextCorpusReader
class ASOIFGenerator:
def __init__(self):
curr_dir = os.getcwd()
# didn't include self folder in git,
# because i'm not looking to get a cease and desist notice
wordlists = PlaintextCorpusReader(curr_dir+"/ASOIAF/",... | rharriso/nltk-workspace | ASOIF_trigram_gen.py | Python | apache-2.0 | 1,336 |
#!/usr/bin/env python3
import math
def multinomial(n, digits=7):
n=str(n).zfill(digits)
temp={}
for i in n:
if not i in temp:
temp[i]=0
temp[i]+=1
out=math.factorial(digits)
for i in temp:
out//=math.factorial(temp[i])
return out
def Memoize(func):
cach... | Bolt64/my_code | euler/square_digit_chain.py | Python | mit | 1,255 |
#!/bin/env python
# -*- coding: utf-8; -*-
#
# (c) 2016 FABtotum, http://www.fabtotum.com
#
# This file is part of FABUI.
#
# FABUI 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 Licen... | FABtotum/colibri-fabui | fabui/ext/py/FabtotumServices.py | Python | gpl-2.0 | 9,501 |
from settings.base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, '..', 'test.sqlite3'),
}
}
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorag... | monty5811/elvanto_subgroups | settings/test.py | Python | mit | 354 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
r"""Minimal Flask application example for development with github handler.
SPHINX-ST... | tiborsimko/invenio-oauthclient | examples/github_app.py | Python | mit | 4,239 |
# -*- coding: utf-8 -*-
"""Clustering utility functions."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
from copy import deepcopy
from ._history import History
from ...utils import Bunch, _a... | nsteinme/phy | phy/cluster/manual/_utils.py | Python | bsd-3-clause | 5,749 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | Tan0/ironic | ironic/tests/drivers/ilo/test_inspect.py | Python | apache-2.0 | 19,077 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
from utils.benchmark import get_value, get_matrix, parse_node_coords
# Generate a json-formatted problem from a tsplib file.
TSP_FIELDS = ["NAME", "TYPE", "COMMENT", "DIMENSION", "EDGE_WEIGHT_TYPE"]
def parse_tsp(input_file):
with open(input_f... | VROOM-Project/vroom-scripts | src/tsplib_to_json.py | Python | bsd-2-clause | 2,243 |
from pyx import *
text.set(text.LatexRunner)
text.preamble(r"\renewcommand{\familydefault}{\ttdefault}")
c = canvas.canvas()
# positioning is quite ugly ... but it works at the moment
x = 0
y = 0
dx = 6
dy = -0.65
length = 0.8
def drawstyle(name, showpath=0, default=0):
global x,y
p = path.path(path.moveto(x... | mjg/PyX-svn | manual/pathstyles.py | Python | gpl-2.0 | 2,061 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
'''
Developer Navdeep Ghai
Email navdeep@korecent.com
'''
import frappe
import bcommerce
from frappe.utils import cint, cstr, flt, nowdate
from frappe import _, msgprint, throw
'''
Order status
'''
def get_order_status(status_id):
status = {
0:... | navdeepghai/bcommerce | bcommerce/utils/status.py | Python | mit | 1,445 |
#!/usr/bin/env python
import pgi
pgi.install_as_gi()
#from gi.repository import Gtk, GObject
from gi.repository import Gtk
class UI:
def __init__(self):
builder = Gtk.Builder()
builder.add_from_file("gui.glade")
window = builder.get_object('window1')
window.connect("delete-event",... | chrisspen/homebot | src/test/head_io/test_gtk.py | Python | mit | 1,346 |
from optparse import OptionParser
from elementtree.ElementTree import Element, SubElement, dump, XML, parse, dump
from bisect import bisect_left, bisect
import re
from os import listdir
import os
import os.path
import sys
pictures_ext = []
verbose = False
def trace(message):
if verbose:
... | Sjith/geotagger-1 | py/geotagger.py | Python | gpl-3.0 | 10,087 |
from google.appengine.ext import db
import datetime
import webapp2
class Player(db.Model):
name = db.StringProperty()
class Guild(db.Model):
name = db.StringProperty()
class GuildMembership(db.Model):
player = db.ReferenceProperty(Player, collection_name='guild_memberships')
guild = db.ReferencePrope... | jscontreras/learning-gae | pgae-examples-master/2e/python/ext_db/relationshipslinkmodel/main.py | Python | lgpl-3.0 | 1,837 |
# 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 ... | balajikris/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyComplex/autorestcomplextestservice/models/long_wrapper.py | Python | mit | 899 |
# Some of the code are from the TUM evaluation toolkit:
# https://vision.in.tum.de/data/datasets/rgbd-dataset/tools#absolute_trajectory_error_ate
import math
import numpy as np
def compute_ate(gtruth_file, pred_file):
gtruth_list = read_file_list(gtruth_file)
pred_list = read_file_list(pred_file)
matches ... | tinghuiz/SfMLearner | kitti_eval/pose_evaluation_utils.py | Python | mit | 13,592 |
# $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:
#
... | DLR-SC/DataFinder | src/datafinder/persistence/common/base_factory.py | Python | bsd-3-clause | 8,251 |
# coding: utf-8
from rest_framework_extensions.routers import ExtendedDefaultRouter
from kobo.apps.hook.views.v2.hook import HookViewSet
from kobo.apps.hook.views.v2.hook_log import HookLogViewSet
from kobo.apps.hook.views.v2.hook_signal import HookSignalViewSet
from kpi.views.v2.asset import AssetViewSet
from kpi.vie... | kobotoolbox/kpi | kpi/urls/router_api_v2.py | Python | agpl-3.0 | 4,029 |
from datetime import datetime, timedelta
def get_total_seconds(td):
if hasattr(timedelta, 'total_seconds'):
return td.total_seconds()
else:
return int(
(td.microseconds + (td.seconds + td.days * 24 * 3600) * 10 ** 6) / 10 ** 6)
class Spy:
def __init__(self):
self.eve... | AlexAkulov/worker | moira/metrics/spy.py | Python | gpl-3.0 | 1,530 |
"""
let's just graph mean and mode with time.
also graph variance with time.
as mode moves around mean, it shows EPSC/IPSC balance.
Could the ratio be multiplied by the variance to return it to original magnitude?
"""
import os
import sys
sys.path.append("../../../../")
import swhlab
import matplotlib.pyplot as plt... | swharden/SWHLab | doc/uses/EPSCs-and-IPSCs/variance method/2016-12-18 01 curve fit.py | Python | mit | 4,194 |
# Copyright 2012 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 req... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/glanceclient/tests/unit/v2/test_metadefs_properties.py | Python | mit | 10,072 |
#!/usr/bin/env python
#
# Copyright 2004,2007,2010,2012,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, blocks
class test_add_mult_div_sub(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.t... | jdemel/gnuradio | gr-blocks/python/blocks/qa_add_mult_div_sub.py | Python | gpl-3.0 | 8,995 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# account_analytic_project_id
# Copyright (c) 2015 Acsone SA/NV (http://www.acsone.eu)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Ge... | acsone/acsone-addons | account_analytic_project_id/post_install.py | Python | agpl-3.0 | 1,398 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2014-2015 Zewei Song
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 optio... | nextgenusfs/ufits | amptk/Guilds.py | Python | bsd-2-clause | 16,269 |
import numpy as np
from stingray.pulse.modeling import fit_sinc, fit_gaussian, SincSquareModel
np.random.seed(0)
def test_sinc_function():
x = np.linspace(-5., 5., 200)
y = 2 * (np.sin(x)/x)**2
y += np.random.normal(0., 0.1, x.shape)
s = fit_sinc(x, y)
assert np.abs(s.mean) < 0.1
assert np.... | StingraySoftware/stingray | stingray/pulse/tests/test_modeling.py | Python | mit | 2,534 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.