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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# USAGE
# python -matx -s ESLKJXX gui
import argparse
import functools
import json
import sys
import inspect
from contextlib import contextmanager
import atx.androaxml as apkparse
from atx.cmds import run
from atx.cmds import iosdeveloper
from atx.cmds import install
... | Andy-hpliu/AirtestX | atx/__main__.py | Python | apache-2.0 | 4,930 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import uuid
import zoneinfo
from mock import Mock, patch
from temba_client.v2 import TembaClient
from temba_client.v2.types import (
Contact as TembaContact,
Export as TembaExport,
Field ... | rapidpro/ureport | ureport/tests.py | Python | agpl-3.0 | 13,985 |
"""
Functions that add noise
"""
import csv
import logging
from typing import List
import astropy.units as u
import numpy
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astropy.wcs import WCS
from astropy.wcs.utils import pixel_to_skycoord
from scipy import interpolate
from data_models.me... | SKA-ScienceDataProcessor/algorithm-reference-library | processing_components/simulation/noise.py | Python | apache-2.0 | 4,374 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""This module contains classes and functions to standardize access to
configuration files for Astropy and affiliated packages.
.. note::
The configuration system makes use of the 'configobj' package, which stores
configuration in a text format li... | lpsinger/astropy | astropy/config/configuration.py | Python | bsd-3-clause | 30,618 |
# 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
# distrib... | dtroyer/osc-lib | osc_lib/tests/api/test_utils.py | Python | apache-2.0 | 3,383 |
# This file is part of rhizi, a collaborative knowledge graph editor.
# Copyright (C) 2014-2015 Rhizi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of... | yuvadm/rhizi | src/server-tests/neo4j_test_util.py | Python | agpl-3.0 | 2,935 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-17 Richard Hull and contributors
# See LICENSE.rst for details.
# PYTHON_ARGCOMPLETE_OK
import sys
import time
from demo_opts import get_device
from luma.core.legacy import show_message
from luma.core.legacy.font import proportional, SINCLAIR_FONT
de... | theodric/nsclock | dev/oled/demoled.py | Python | lgpl-3.0 | 650 |
# -*- coding: utf-8 -*-
import imgui
import sys
import math
import os
import itertools
from array import array
# Examples Apps (accessible from the "Examples" menu)
show_app_main_menu_bar = False
show_app_console = False
show_app_log = False
show_app_layout = False
show_app_property_editor = False
show_app_long_text ... | swistakm/pyimgui | doc/examples/testwindow.py | Python | bsd-3-clause | 153,920 |
# -*- encoding: utf-8 -*-
import os
import re
import shutil
from StringIO import StringIO
from django.core import management
from django.test import TestCase
LOCALE='de'
class ExtractorTests(TestCase):
PO_FILE='locale/%s/LC_MESSAGES/django.po' % LOCALE
def setUp(self):
self._cwd = os.getcwd()
... | azurestandard/django | tests/regressiontests/i18n/commands/extraction.py | Python | bsd-3-clause | 13,190 |
# coding: utf-8
# pylint: disable=invalid-name, protected-access, too-many-arguments
# pylint: disable=global-statement, unused-import
"""NDArray configuration API."""
from __future__ import absolute_import as _abs
import ctypes
import sys as _sys
import numpy as np
from ..base import _LIB
from ..base import c_array,... | danithaca/mxnet | python/mxnet/_ctypes/ndarray.py | Python | apache-2.0 | 3,684 |
# coding = utf-8
from tornado.web import UIModule
class FooterModule(UIModule):
def render(self, show_footer = 1):
return self.render_string('common/footer.html') if show_footer else ''
| owlsn/h_crawl | display/display/ui_modules/footer.py | Python | mit | 199 |
#######################################################################
# Copyright (C) 2017 Shangtong Zhang(zhangshangtong.cpp@gmail.com) #
# Permission given to modify the code as long as you keep this #
# declaration at the top #
################################... | ShangtongZhang/DeepRL | deep_rl/component/random_process.py | Python | mit | 1,251 |
# This file is part of Booktype.
# Copyright (c) 2013 Borko Jandras <borko.jandras@sourcefabric.org>
#
# Booktype is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (a... | btat/Booktype | lib/booktype/convert/utils/__init__.py | Python | agpl-3.0 | 1,254 |
from cpgintegrate.column_info_frame import ColumnInfoFrame
import pandas
def test_concat():
assert (pandas
.concat([ColumnInfoFrame({"a": [1, 2, 3]}, column_info={'a': {'position': '1'}}),
ColumnInfoFrame({"a": [4, 5, 6]})])
.get_column_info()) == [{'id': ''}, {'id': '... | PointyShinyBurning/cpgintegrate | test/test_column_info_frame.py | Python | agpl-3.0 | 594 |
import requests
from .session import Session
from .visualization import Visualization, VisualizationLocal
class Lightning(object):
def __init__(self, host="http://localhost:3000", local=False, ipython=False, auth=None, size='medium', quiet=False):
self.quiet = quiet
if not self.quiet:
... | lightning-viz/lightning-python | lightning/main.py | Python | mit | 7,094 |
#!/usr/bin/env python
"""
@file rebuildSchemata.py
@author Michael Behrisch
@date 2011-07-11
@version $Id: rebuildSchemata.py 11671 2012-01-07 20:14:30Z behrisch $
Let all SUMO binarie write the schema for their config
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2011-2012... | smendez-hi/SUMO-hib | tools/xml/rebuildSchemata.py | Python | gpl-3.0 | 848 |
# -*- coding: utf-8 -*-
import re
from unittest import TestCase
from forgery_py.forgery import address
from forgery_py.dictionaries_loader import get_dictionary
class AddressForgeryTestCase(TestCase):
def test_street_name(self):
result = address.street_name()
assert result + '\n' in get_dictiona... | tomekwojcik/ForgeryPy | tests/test_address.py | Python | mit | 1,716 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests Task 02."""
# Import Python libs
import unittest
import hamlet
import task_02
class Task02TestCase(unittest.TestCase):
"""
Test cases for Task 02.
"""
def test_positional_value(self):
"""
Tests that the POSITIONAL constant has ... | ModestoCabrera/is210-week-05-warmup | tests/test_task_02.py | Python | mpl-2.0 | 689 |
import os
import simplejson as json
_querymod_dir = os.path.dirname(os.path.realpath(__file__))
_config_loc = os.path.join(_querymod_dir, "..", "configuration.json")
configuration = json.loads(open(_config_loc, "r").read())
| uwbmrb/BMRB-API | server/wsgi/bmrbapi/utils/configuration.py | Python | gpl-3.0 | 226 |
from django.urls import include, path
from rest_framework import routers
from feeds.viewsets import CategoryViewSet, SubscriptionViewSet, ItemViewSet
router = routers.DefaultRouter()
router.register(r'categories', CategoryViewSet, base_name='category')
router.register(r'subscriptions', SubscriptionViewSet, base_nam... | jochenklar/reader2 | feeds/urls.py | Python | apache-2.0 | 449 |
# Copyright 2019 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | cirq-core/cirq/ops/wait_gate.py | Python | apache-2.0 | 5,691 |
# -*- coding: utf-8 -*-
from . import conf
from django.db import models
from django.conf import settings
from .signals import payment_process
from .signals import payment_completed
from .signals import payment_fail
from .utils import get_uuid
class Payment(models.Model):
class STATUS:
PROCESSED = 'proces... | VladimirFilonov/django-yandex-kassa | yandex_kassa/models.py | Python | mit | 4,982 |
from .most_common import MostCommonHeuristic
from .most_time import MostTimeHeuristic
from collections import defaultdict
from itertools import product
from mosek.fusion import Model, Domain, Expr, ObjectiveSense, AccSolutionStatus
import sys
class BIPModelMosek(object):
'''Reference binary integer program: full m... | ryanjoneil/docker-image-construction | dicp/solvers/bip_model_mosek.py | Python | mit | 4,198 |
class BucketRecord:
def __init__(self, offset):
self.name = 'Some Name%s' % offset
self.size = 123
self.last_modified = "2015-04-%02dT15:16:55Z" % offset
class Key:
def __init__(self, name):
self.name = name
self.data = None
self.metadata = {}
def set_con... | kozyarchuk/NCT-portal | testlib/test_s3.py | Python | gpl-2.0 | 896 |
# Copyright 2016 IBM Corp.
# 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 app... | sebrandon1/tempest | tempest/tests/services/object_storage/test_object_client.py | Python | apache-2.0 | 4,542 |
from __future__ import absolute_import, division, unicode_literals
from six import text_type, binary_type
from six.moves import http_client, urllib
import codecs
import re
import webencodings
from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase
from .constants import ReparseException
from . imp... | mgilson/html5lib-python | html5lib/inputstream.py | Python | mit | 31,483 |
from math import sqrt
class Vector:
def __init__(self, coords):
self.coords = coords
def equals(self, v):
return self.coords == v.coords
def __str__(self):
return str(tuple(self.coords)).replace(" ","")
# must be Vector of same dimension
def add(self, v):
... | SelvorWhim/competitive | Codewars/VectorClass.py | Python | unlicense | 984 |
# Copyright 2017 Ben Walsh
#
# 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, so... | walshb/camog | camog/__init__.py | Python | apache-2.0 | 609 |
# © 2017 Creu Blanca
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
efact_server = fields.Char(string="e.Fact server location")
efact_port = fields.Char(string="e.... | factorlibre/l10n-spain | l10n_es_facturae_efact/models/config.py | Python | agpl-3.0 | 1,706 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014, Paweł Wodnicki
# 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, t... | 32bitmicro/EDA | python/eda/eda/components/Micrel/MIC2920.py | Python | bsd-3-clause | 2,127 |
#! python
#Python Serial Port Extension for Win32, Linux, BSD, Jython
#see __init__.py
#
#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
PARITY_NONE, PARITY_EVEN, PARITY_ODD = 'N', 'E', 'O'
STOPBITS_ONE, STOPBITS_TWO = (1, 2)
FIVEBITS, SIXBITS, SEVEN... | Elleo/rockwatch | deps/serial/serialutil.py | Python | gpl-3.0 | 13,697 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/system/systemglobal_authenticationldappolicy_binding.py | Python | apache-2.0 | 6,911 |
# Copyright 2013 YAMAMOTO Takashi
#
# This file is part of POX.
#
# POX 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.
#
# POX is dist... | 0xdyu/RouteFlow-Exodus | pox/pox/misc/cbench.py | Python | apache-2.0 | 1,332 |
#!/usr/bin/env python
# @@@ NOTE: THIS IS A WORK IN PROGRESS, AS I TRY TO WORK OUT HOW THE FILE
# @@@ FORMAT WORKS.
from cStringIO import StringIO
import struct
import sys
if len(sys.argv) == 2:
TES_FILE = sys.argv[1]
else:
print "usage: %s <tes-file>" % sys.argv[0]
sys.exit(1)
f = open(TES_FILE)
whil... | jtauber/skyrim | tes.py | Python | mit | 2,226 |
"""
predict_actions_cartpole is the cartpole task but where the agent will
get extra reward for saying what its next 5 *actions* will be.
This is a toy problem but the principle is useful -- imagine a household robot
or a self-driving car that accurately tells you what it's going to do before it does it.
This'll inspi... | xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/envs/safety/predict_actions_cartpole.py | Python | mit | 2,176 |
from __future__ import division
import matplotlib.pyplot as plt
import cPickle as pickle
import numpy as np
import os
import sys
import re
"""
File data input example:
# PDB code |Reported in PDB | Calc from NCS | ASU initial | ASU final | Res. | NCS | Solvent | Data | Year | Use | Geo.... | youdar/work | work/NCS/refinement_test/collecting_results_from_queue_v2.py | Python | mit | 43,034 |
"""
Python tests for the Survey models
"""
from collections import OrderedDict
from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from survey.exceptions import SurveyFormNotFound, SurveyFormNameAlreadyExists
from django.core.exceptions import Validation... | peterm-itr/edx-platform | lms/djangoapps/survey/tests/test_models.py | Python | agpl-3.0 | 7,714 |
# Copyright 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | matrix-org/synapse | synapse/replication/slave/storage/_base.py | Python | apache-2.0 | 1,992 |
"""Test cases for traceback module"""
try:
import _testcapi
except ImportError:
_testcapi = None
from io import StringIO
import sys
import unittest
import re
from test.support import run_unittest, Error, captured_output
from test.support import TESTFN, unlink
from test.support import check_impl_detail
import ... | wdv4758h/ZipPy | lib-python/3/test/test_traceback.py | Python | bsd-3-clause | 12,975 |
# Generated by Django 2.2.6 on 2019-12-10 17:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcim', '0086_device_name_nonunique'),
]
operations = [
migrations.AddField(
model_name='devicerole',
name='descripti... | digitalocean/netbox | netbox/dcim/migrations/0087_role_descriptions.py | Python | apache-2.0 | 577 |
import omp
from time import sleep
def omp_for_schedule_guided():
tids = range(1001)
maxiter = 0
result = True
notout = True
if 'omp parallel':
if 'omp single':
threads = omp.get_num_threads()
if threads<2:
print "This test only works with at least two threads"
... | hainm/pythran | pythran/tests/openmp.legacy/omp_for_schedule_guided.py | Python | bsd-3-clause | 2,102 |
#!/usr/bin/python
# This file is part of MANTIS OS, Operating System
# See http://mantis.cs.colorado.edu/
#
# Copyright (C) 2003-2005 University of Colorado, Boulder
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the mos license (see file LICENSE)
import socket, struct... | turon/mantis | src/tools/tenodera/eventGen.py | Python | bsd-3-clause | 954 |
from flask_script import Manager
from redash import models
manager = Manager(help="Organization management commands.")
@manager.option('domains', help="comma separated list of domains to allow")
def set_google_apps_domains(domains):
organization = models.Organization.select().first()
organization.settings[m... | akariv/redash | redash/cli/organization.py | Python | bsd-2-clause | 969 |
from __future__ import division
import numpy as np
from numpy import dot
from dipy.core.geometry import sphere2cart
from dipy.core.geometry import vec2vec_rotmat
# Diffusion coefficients for white matter tracts, in mm^2/s
#
# Based roughly on values from:
#
# Pierpaoli, Basser, "Towards a Quantitative Assessment o... | rfdougherty/dipy | dipy/sims/voxel.py | Python | bsd-3-clause | 28,387 |
# Copyright (c) 2003 David Abrahams.
# Copyright (c) 2005 Vladimir Prus.
# Copyright (c) 2005 Alexey Pakhunov.
# Copyright (c) 2006 Bojan Resnik.
# Copyright (c) 2006 Ilya Sokolov.
# Copyright (c) 2007 Rene Rivera
# Copyright (c) 2008 Jurko Gospodnetic
# Copyright (c) 2011 Juraj Ivancic
#
# Use, modification and distri... | davehorton/drachtio-server | deps/boost_1_77_0/tools/build/src/tools/msvc.py | Python | mit | 59,446 |
import time, copy, pickle
import os, os.path
import sys
import numpy, pylab
import numpy as np
from fcns_generatecompositions import *
sys.path.append('Z:/Documents/PythonCode/JCAP')
from readplatemap import *
modelpath=r'D:\Google Drive\Documents\CaltechWork\platemaps\201608alloy\template.txt'
newpath=r'D:\Google Dri... | johnmgregoire/JCAPGeneratePrintCode | genplatemap_alloyingintotarget_v2.py | Python | bsd-3-clause | 6,205 |
from .flag_type_add import *
from .flag_type_edit import * | vinoth3v/In | In/flag/admin/form/__init__.py | Python | apache-2.0 | 58 |
from unittest import TestCase, main
from gdrivefs.gdtool import Conf
class ConfTestCase(TestCase):
"""Test the Conf class."""
def setUp(self):
pass
def tearDown(self):
pass
def test_config(self):
"""Test for the existence of all configuration keys."""
keys = [ 'auth... | tvierling/GDriveFS | tests/gdtool/Conf.py | Python | gpl-2.0 | 713 |
from bson.objectid import ObjectId
import tornado.testing
from persistence.FieldDaySiteListMongo import PersistentFieldDaySiteList as FieldDaySiteList
from persistence.FieldDaySiteMongo import PersistentFieldDaySite as FieldDaySite
import mongomock
import fieldDayTestData
mongoCollectionFieldDay = mongomock.MongoClie... | pablo-libre/reefwatch-backend | tests/test_FieldDaySitesMongo.py | Python | gpl-3.0 | 2,988 |
import json
from websocket_server import WebsocketServer # pip package, in python 3.5 you may have to do `pip install -U websocket-server`
import http_server
import networktables_client
with open("config.json", "r") as config_file:
config = json.load(config_file)
shared_dict = {
"robot_status": "disconnected"... | RavenRoboticsTeam1288/Remige | server.py | Python | mit | 2,320 |
# Copyright (c) 2015 SnapDisco Pty Ltd, Australia.
# All rights reserved.
#
# This source code is licensed under the terms of the MIT license
# found in the "LICENSE" file in the root directory of this source tree.
import sys
if sys.version_info.major >= 3:
from configparser import RawConfigParser
else:
from ... | jboy/nim-pymod | libpy/UsefulConfigParser.py | Python | mit | 5,807 |
##El arreglo mas y val contienen respectivamente la masa y los valores a asignar
## en cada caso en el caso particular:
##
## -3, 1/3
## 2, 1/6
## 5, 1/2
from random import random
def ud(mas,val):
pro=[sum(mas[:i]) for i in range(1,len(mas))]+[1]
r=random()
return val[[r<i for i in pro].index(True)]
mas=[1.0/... | Darkade/udlap | 9no/simulacion/2010 08 23 practica discreta.py | Python | apache-2.0 | 623 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributi... | bitcraft/pyglet | pyglet/libs/darwin/constants.py | Python | bsd-3-clause | 14,990 |
import collections
import subprocess
import warnings
from . import protocols
from . import transports
from .log import logger
class BaseSubprocessTransport(transports.SubprocessTransport):
def __init__(self, loop, protocol, args, shell,
stdin, stdout, stderr, bufsize,
... | prefetchnta/questlab | bin/x64bin/python/37/Lib/asyncio/base_subprocess.py | Python | lgpl-2.1 | 9,070 |
# -*- encoding: utf-8 -*-
# this script connect to openerp v6.0 server (XMLRPC)
import xmlrpclib
import time
import psycopg2
import json
#~ Use this lines to create a data.sec file with security params
#~ base = {
#~ 'directory': '/home/dbernal/git/audittest/',
#~ 'host': "server ip addrs",
#~ 'port': "data... | juanvmarquezl/audittest | openerp60/openerp_link.py | Python | lgpl-3.0 | 2,540 |
from dialogs.draw_footprint.panel_edit_angle import PanelEditAngle
import math
class EditAngleFrame(PanelEditAngle):
def __init__(self, parent, render, angle):
super(EditAngleFrame, self).__init__(parent)
self.render = render
self.angle = angle
self.ShowAngle()
... | turdusmerula/kipartman | kipartman/frames/frame_draw_footprint/edit_angle_frame.py | Python | gpl-3.0 | 953 |
import random
import time
import datetime
from consts import *
__all__ = ['gen_valid_id', 'gen_list_page', 'log']
def gen_valid_id(collection):
def gen_id():
_id = ''
for i in range(4):
_id += random.choice('0123456789')
return _id
id = gen_id()
while collection.find_... | oyiadin/Songs-Distributor | utils.py | Python | mit | 1,548 |
import os, hashlib
class DiffBuilder :
def __init__(self, iReference, iCompare, iOutput, iScriptFile) :
self.ref = iReference
self.cmp = iCompare
self.out = iOutput
self.spt = iScriptFile
def md5sum(self, iFilepath):
hasher = hashlib.md5()
with open(iFilepath, ... | eplanet/diffbuilder | diffbuilder/diffbuilder.py | Python | gpl-2.0 | 2,653 |
# -*- coding: utf-8 -*-
"""
Demonstrates a way to put multiple axes around a single plot.
(This will eventually become a built-in feature of PlotItem)
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui, QtWidgets
impo... | mylxiaoyi/mypyqtgraph-qt5 | examples/MultiplePlotAxes.py | Python | mit | 1,925 |
import pytest
from pytest import raises
from tinymce.utils import parse_profile, ConfigurationError
def test_convert_urls():
profile = {}
P = parse_profile(profile)
assert 'convert_urls' not in P
profile = {'convert_urls': False}
P = parse_profile(profile)
assert P['convert_urls'] == False
... | kcsry/django-tinymce | tests/test_url.py | Python | mit | 1,553 |
#!/usr/bin/env python3
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgp... | nuclear-wizard/moose | python/peacock/tests/exodus_tab/test_VTKWindowPlugin.py | Python | lgpl-2.1 | 6,061 |
import matplotlib.pyplot as plt
import numpy as np
import logging
import os
from collections import Counter
from apps.recommenders.UserAverage.algorithm.models import (
UserAverage_Recommendations,
UserAverage_Life
)
from apps.CONSTANTS import (
SET_SIZE_LIST,
START_VALIDE_RUN,
INTERVAL,
AT_LIS... | DiegoCorrea/ouvidoMusical | apps/recommenders/UserAverage/analyzer/algorithm.py | Python | mit | 3,124 |
import os
import numpy as np
import matplotlib.pyplot as plt
import ergoPlot
# Get model
model = 'Hopf'
gam = 1.
betaRng = np.arange(0., 2.05, 0.05)
betaRngPlot = np.array([0., 0.25, 0.5])
mu = 0.
eps = 1.
# Grid definition
dim = 2
nx0 = 200
nSTD = 5
# Number of eigenvalues
nev = 21
#nev = 201
nevPlot = 6
# Direct... | atantet/ergoPack | example/numericalFP/vsBeta.py | Python | gpl-3.0 | 6,754 |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------
#
# Sum Lines In Polygons
#
# A QGIS plugin for calculating the total sum of line
# lengths in each polygon of an input vector polygon layer.
#
# Copyright (C) 2008 Carson Farmer
#
# EMAIL: carson.farmer (at) gmail.com
# WEB : www.... | sourcepole/qgis | qgis/python/plugins/fTools/tools/doSumLines.py | Python | gpl-2.0 | 7,282 |
import os
import numpy as np
import sfh_tests
import ResolvedStellarPops as rsp
from TPAGBparams import snap_src
import galaxy_tests
def ms_color_cut():
comp90 = sfh_tests.read_completeness_table(absmag=True)
tri_dir = os.environ['TRILEGAL_ROOT']
# make these simulations by editing a constant sf trilegal f... | philrosenfield/TPAGB-calib | selection_tests.py | Python | bsd-3-clause | 8,573 |
#!/usr/bin/env python
"""
tests.integration_test_tcp
==========================
Integration tests for the TCP clients.
Setup a TCP server to receive metrics from the
TCP clients and assert they are correct.
:license: released under the terms of the MIT license.
For more information see LICENSE or README files, or
ht... | farzadghanei/statsd-metrics | tests/integration_test_tcp.py | Python | mit | 7,266 |
# (C) British Crown Copyright 2013 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | duncanwp/iris | docs/iris/example_tests/test_polar_stereo.py | Python | lgpl-3.0 | 1,541 |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | desbma/glances | glances/exports/glances_export.py | Python | lgpl-3.0 | 5,467 |
# -*- coding: utf-8 -*-
# Copyright 2011 David Malcolm <dmalcolm@redhat.com>
# Copyright 2011 Red Hat, Inc.
#
# This 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, o... | jasonxmueller/gcc-python-plugin | testcpychecker.py | Python | gpl-3.0 | 20,467 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | DavidAndreev/indico | indico/util/rules_test.py | Python | gpl-3.0 | 3,751 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['RelativeDifference'] , ['ConstantTrend'] , ['NoCycle'] , ['LSTM'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_RelativeDifference/model_control_one_enabled_RelativeDifference_ConstantTrend_NoCycle_LSTM.py | Python | bsd-3-clause | 164 |
from poloniex import Poloniex
connection = Poloniex()
BTC_ETH = connection.returnTicker()#['BTC_ETH']
print(type(BTC_ETH))
print(BTC_ETH.keys())
#print(BTC_ETH['high24hr']) | arcyfelix/Machine-Learning-For-Trading | 42_data_from_poloniex.py | Python | apache-2.0 | 174 |
# Copyright 2016 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... | kevin-coder/tensorflow-fork | tensorflow/python/keras/layers/wrappers_test.py | Python | apache-2.0 | 28,470 |
# -insar.py- coding: utf-8 -*-
"""
Created on Fri Sep 3 10:46:50 2010
@author: bosmanoglu
InSAR module. Includes functions for analyzing SAR interferometry with python.
"""
from numpy import *
from pylab import *
from basic import *
import scipy
from scipy import ndimage #scipy.pkgload('ndimage')
from scipy import ... | bosmanoglu/adore-doris | lib/python/insar/__init__.py | Python | gpl-2.0 | 25,698 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__,'_mysql.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| cloud9ers/gurumate | environment/lib/python2.7/site-packages/MySQL_python-1.2.4c1-py2.7-linux-x86_64.egg/_mysql.py | Python | lgpl-3.0 | 276 |
from moviepy.decorators import apply_to_mask
from .crop import crop
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip
#@apply_to_mask
def freeze_region(clip, t=0, region=None, outside_region=None, mask=None):
""" Freezes one region of the clip while the rest remains animated.
Yo... | Vicaris/ModPro | moviepy/video/fx/freeze_region.py | Python | mit | 1,924 |
from __future__ import print_function
from mereo import ORDER
from mereo.inventory import Inventory
from mereo.part import Part
from svgpathtools import parse_path, Path, Line, CubicBezier
def _delta(a, b, step, gaps):
d = float(b - a) / float(gaps)
return a + d * step
def _deltaPoints(a, b, step, gap):
... | JeffreyMFarley/mereo | mereo/in_betweens.py | Python | mit | 2,633 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import TopicNotification
class NotificationForm(forms.ModelForm):
is_active = forms.BooleanField(widget=forms.HiddenInput(), initial=True, required=Fals... | gogobook/Spirit | spirit/topic/notification/forms.py | Python | mit | 1,566 |
# Copyright (c) SPDX Python tools 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 applicable law or agreed to in w... | spdx/tools-python | tests/test_parsers_validation.py | Python | apache-2.0 | 1,361 |
# -*- coding: utf-8 -*-
"""
Exceptions used by django-rules. All internal and rules-specific errors
should extend RulesError class
"""
class RulesError(Exception):
pass
class NonexistentPermission(RulesError):
pass
class NonexistentFieldName(RulesError):
pass
class NotBooleanPermission(RulesError):
... | maraujop/django-rules | django_rules/exceptions.py | Python | bsd-3-clause | 325 |
# coding=utf-8
"""
Created on 10/02/2014
@author: Dani
"""
from lpentities.country import Country
class ParsedCountry(object):
def __init__(self, iso3_official=None,
iso2=None, sname_en=None, sname_es=None, sname_fr=None,
un_code=None, faostat_code=None, lname_en=None,
... | landportal/landbook-importers | CountryReconciler/reconciler/entities/parsed_country.py | Python | mit | 2,150 |
import logging
from django.conf import settings
from django.http import HttpResponse
from django.http.request import validate_host
from django.utils.http import is_safe_url
from httplib import HTTPConnection, HTTPSConnection
from urlparse import urlsplit
from geonode.geoserver.helpers import ogc_server_settings
logger... | state-hiu/rogue_geonode | geoshape/views.py | Python | gpl-3.0 | 3,021 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['PolyTrend'] , ['Seasonal_Hour'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_PolyTrend_Seasonal_Hour_MLP.py | Python | bsd-3-clause | 152 |
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from django.db.utils import IntegrityError
class Command(BaseCommand):
def handle(self, *args, **options):
try:
# Better change the password once it has been created
User.objects.create... | ikhere/rango | rango/management/commands/initadmin.py | Python | apache-2.0 | 621 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... | shootstar/novatest | nova/scheduler/manager.py | Python | apache-2.0 | 12,814 |
from threading import Thread
import atexit
import Pi7SegPy as pi7seg
class DigitalDisplay(Thread):
__initialized_once = False
__EMPTY_DISPLAY = None
def __init__(
self, data_pin=5, clock_pin=13, latch_pin=6,
registers=2, no_of_displays=4,
common_cathode_type=True):
... | tech-time/build-box | src/buildbox/devices/leddigits.py | Python | apache-2.0 | 1,283 |
# Lint as: python3
# Copyright 2018 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
#
# ... | deepmind/acme | acme/utils/async_utils.py | Python | apache-2.0 | 4,130 |
from trashcli.put import TrashDirectoryForPut
from nose.tools import assert_equals
from mock import Mock
class TestHowOriginalLocationIsStored:
def test_for_absolute_paths(self):
fs = Mock()
self.dir = TrashDirectoryForPut('/volume/.Trash', '/volume', fs = fs)
self.dir.store_absolute_paths(... | sein-tao/trash-cli | unit_tests/test_storing_paths.py | Python | gpl-2.0 | 1,446 |
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
"""
A user profile model for tracking additional user metadata.
"""
user = models.OneToOneField(User, related_name='profile')
# Used to enable a user's publicly acce... | zachcalvert/basketball | basketball/accounts/models.py | Python | gpl-3.0 | 849 |
import os
import sqlite3
from flask import request, g, Flask
import json
app = Flask(__name__)
log = app.logger
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'blog.db'),
PORT=8080,
))
@app.route("/posts", methods=['GET'])
def get_posts():
c = get_db().cursor()
data = c.execute("SELECT ... | stormbeta/blogapi-example | app.py | Python | mit | 1,240 |
#!/usr/bin/env python
#coding=utf8
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 versio... | grnet/synnefo | snf-pithos-app/pithos/api/test/util/__init__.py | Python | gpl-3.0 | 3,935 |
'''
byteplay3.py
byteplay is a module supporting the disassembly, modification, and re-assembly
of Python bytecode objects.
Expected use:
from byteplay3 import *
myfunc_code = Code( myfunc.__code__ )
# manipulate myfunc_code
myfunc.__code__ = myfunc_code.to_code()
For full doc... | tallforasmurf/byteplay | byteplay3.py | Python | gpl-3.0 | 67,075 |
"""This file handles parsing the Wix Instance which is key to the security of
this app.
"""
from os import environ
from base64 import urlsafe_b64encode, urlsafe_b64decode
from hmac import new
from hashlib import sha256
from json import loads
if "HEROKU" in environ:
wix_secret = environ["wix_secret"]
else:
fro... | jeffreychan637/fb-cal-tpa-production | app/server/wix_verifications.py | Python | bsd-2-clause | 1,411 |
from django.conf.urls import patterns, url
from manoseimas.mps_v2 import views
urlpatterns = patterns(
'',
url(r'^/?$',
views.mps_list, name='mp_list_all'),
url(r'^fractions/?$',
views.mp_fraction_list, name='mp_fraction_list'),
url(r'^discussion/(?P<statement_id>\d+)$',
views... | ManoSeimas/manoseimas.lt | manoseimas/mps_v2/urls.py | Python | agpl-3.0 | 884 |
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# 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 L... | mruwek/topydo | topydo/lib/AddCommand.py | Python | gpl-3.0 | 4,098 |
from django.contrib.auth.models import User
from django.core.files import File
from gndata_api.baseassets import BaseAssets
from ephys.models import *
from gndata_api.settings import FILE_MEDIA_ROOT
import os
import random
import h5py
import uuid
class Assets(BaseAssets):
"""
Creates test Neo objects.
""... | asobolev/gndata-api | ephys/tests/assets.py | Python | gpl-3.0 | 9,232 |
# -*- coding: utf-8 -*-
"""
Basic SmartyLexer Test
~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import unittest
from pygments.token import Operator, Number, Text, Token
from pygments.lexers import SmartyLexer
cla... | hacksterio/pygments.rb | vendor/pygments-main/tests/test_smarty.py | Python | mit | 1,227 |
"""tf.nn.dropout(x, keep_prob, noise_shape = None, seed = None, name = None)
解释:这个函数的作用是计算神经网络层的dropout。
一个神经元将以概率keep_prob决定是否放电,如果不放电,那么该神经元的输出将是0,
如果该神经元放电,那么该神经元的输出值将被放大到原来的1/keep_prob倍。
这里的放大操作是为了保持神经元输出总个数不变。比如,神经元的值为[1, 2],keep_prob的值是0.5,
并且是第一个神经元是放电的,第二个神经元不放电,那么神经元输出的结果是[2, 0],也就是相当于,
第一个神经元被当做了1/keep_prob个输... | Asurada2015/TFAPI_translation | NeuralNekworks_function/Activefunction/tf_nn_dropout.py | Python | apache-2.0 | 2,296 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from django.contrib.auth import login
from django.contrib.auth.models import User
from django.test.clie... | relicode/auth-chat | django/auth_chat/tests.py | Python | mit | 1,837 |
from django.db import models
# Create your models here.
class Promo(models.Model):
name = models.CharField(max_length=255)
age = models.IntegerField(null=True)
class PromoArea(models.Model):
promo = models.ForeignKey(Promo)
| klem4/panacea | test_project/test_project/test_app/models.py | Python | unlicense | 241 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.