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 |
|---|---|---|---|---|---|
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Converts data from external to internal indexing.
"""
import sys
from numpy import arange, concatenate
from scipy.sparse import issparse, vstack, hstack
fro... | praba230890/PYPOWER | pypower/e2i_data.py | Python | bsd-3-clause | 3,601 |
import os
import sys
import skybase.schemas
from skybase.utils.schema import read_yaml_from_file
from skybase.utils import simple_error_format
from skybase.exceptions import SkyBaseConfigurationError
from yaml.scanner import ScannerError
from yaml.parser import ParserError
# Application CONSTANTS
# Configuration
DEF... | lithiumtech/skybase.io | skybase/config/__init__.py | Python | apache-2.0 | 3,382 |
# encoding: utf-8
from distutils.core import setup
import codecs
from swatch import __version__ as VERSION
README = codecs.open('README.rst', encoding='utf-8').read()
LICENSE = codecs.open('LICENSE', encoding='utf-8').read()
setup(
name='swatch',
version=VERSION,
author='Marcos A Ojeda',
author_email... | nsfmc/swatch | setup.py | Python | mit | 1,011 |
""" basic collect and runtest protocol implementations """
from __future__ import absolute_import, division, print_function
import bdb
import os
import sys
from time import time
import py
from _pytest._code.code import TerminalRepr, ExceptionInfo
from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
#
# pytest pl... | tareqalayan/pytest | _pytest/runner.py | Python | mit | 16,205 |
import unittest
from test import test_support
from itertools import *
from weakref import proxy
from decimal import Decimal
from fractions import Fraction
import sys
import operator
import random
import copy
import pickle
from functools import reduce
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize... | 2uller/LotF | App/Lib/test/test_itertools.py | Python | gpl-2.0 | 69,023 |
print(10)
| mjpatter88/mjpython | test/acc/scripts/print_ten.py | Python | mit | 10 |
# -*- coding: utf-8 -*-
# Copyright 2013 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of AnotherPyGraphvizAgain. http://jacquev6.github.com/AnotherPyGraphvizAgain
# AnotherPyGraphvizAgain is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public ... | Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/AnotherPyGraphvizAgain/tests/__main__.py | Python | mit | 964 |
# Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.
from django.conf.urls import url
from awx.api.views import (
RoleList,
RoleDetail,
RoleUsersList,
RoleTeamsList,
RoleParentsList,
RoleChildrenList,
)
urls = [
url(r'^$', RoleList.as_view(), name='role_list'),
url(r'^(?P<pk>[0-... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/api/urls/role.py | Python | apache-2.0 | 753 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8638")
else:
access = Ser... | dzsmining/GingerCoin | contrib/bitrpc/bitrpc.py | Python | mit | 7,842 |
"""Class to perform under-sampling based on one-sided selection method."""
# Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com>
# Christos Aridas
# License: MIT
from collections import Counter
import numpy as np
from sklearn.base import clone
from sklearn.neighbors import KNeighborsClassifier
from sklear... | scikit-learn-contrib/imbalanced-learn | imblearn/under_sampling/_prototype_selection/_one_sided_selection.py | Python | mit | 7,093 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import formatdate
from erpnext.controllers.website_list_for_contact import (get_customers_suppliers... | Zlash65/erpnext | erpnext/templates/pages/rfq.py | Python | gpl-3.0 | 2,809 |
#!/usr/bin/env python
#==========================================================================
#
# Copyright NumFOCUS
#
# 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
#
# ... | InsightSoftwareConsortium/ITKIOOpenSlide | examples/StreamProcessing.py | Python | apache-2.0 | 1,655 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2013 Star2Billing S.L.
#
# The Initia... | berinhard/newfies-dialer | newfies/dialer_cdr/views.py | Python | mpl-2.0 | 10,337 |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __fu... | klahnakoski/Bugzilla-ETL | bugzilla_etl/bz_etl.py | Python | mpl-2.0 | 20,680 |
import abc
import six
import time
import random
import itertools
from functools import wraps
from ..translators import DefaultTranslator
from modularodm.exceptions import KeyExistsException
class Logger(object):
def __init__(self):
self.listening = False
self.events = []
self.xtra = []
... | chrisseto/modular-odm | modularodm/storage/base.py | Python | apache-2.0 | 6,109 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pandas as pd
left = pd.DataFrame({'A': ['A0', 'A1', 'A2'],
'B': ['B0', 'B1', 'B2']},
index=['K0', 'K1', 'K2'])
right = pd.DataFrame({'C': ['C0', 'C2', 'C3'],
'D': ['D0', 'D2', 'D3']},
... | davidam/python-examples | pandas/pandas-join.py | Python | gpl-3.0 | 4,244 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/BehaviouralCharacteristicsDialog.py | Python | apache-2.0 | 5,061 |
# -*- coding: utf-8 -*-
#Copyright (C) 2011 Seán Hayes
#Python imports
from datetime import datetime
#Django imports
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.client import Client
#App imports
from ..models import Feedback
#Test imports
from .util impo... | SeanHayes/django-basic-feedback | django_basic_feedback/tests/test_urls.py | Python | bsd-3-clause | 1,010 |
"""APyCON URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | stefaniapazabarca/APYCON | APyCON/APyCON/urls.py | Python | gpl-3.0 | 929 |
# Orca
#
# Copyright 2005-2009 Sun Microsystems Inc.
#
# 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... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/orca/scripts/apps/packagemanager/__init__.py | Python | gpl-3.0 | 850 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/JL/Slideshows/Chooser_jlei.py | Python | apache-2.0 | 11,189 |
from flask import Flask, redirect, abort, url_for
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return redirect(url_for('login'))
@app.route('/login')
def login():
abort(401)
this_is_never_executed()
if __name__ == '__main__':
app.run()
| schanezon/webapp | test.py | Python | apache-2.0 | 278 |
########################################
# Read radiosonde files from Integrated Global RadiosondeArchive
#, separate soundings and save in python
#
# http://www1.ncdc.noaa.gov/pub/data/igra
# Created by: Peter Willetts
# Created on: 25/06/2014
#
########################################
#
#
############################... | peterwilletts24/Python-Scripts | Radiosonde_Data/Rough_Station_Variable_Plot.py | Python | mit | 479 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/labservices/azure-mgmt-labservices/setup.py | Python | mit | 2,668 |
from base.decorators import anonymous_required
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.contrib.auth.password_validation import password_validators_help_texts
from django.utils.decorators import method_decorator
from django.views.generic impor... | iPablo/starter-python-sevilla | python_sevilla/users/views.py | Python | mit | 1,604 |
# -*- coding: utf-8 -*-
INBOUND_POST_REQUEST = {
'text': '',
'html': '',
'from': '',
'to': '',
'cc': '',
'subject': '',
'dkim': '',
'SPF': '',
'envelopeemail': '',
'charsets': '',
'spam_score': '',
'spam_report': '',
'attachments': '',
'attachment-info': '',
'... | rosscdh/django-sendgrid | dj_sendgrid/tests/__init__.py | Python | mit | 870 |
#!/usr/bin/env python
"""
A toolkit for identifying and advertising service resources.
Uses a specific naming convention for the Task Definition of services. If you
name the Task Definition ending with "-service", no configuration is needed.
This also requires that you not use that naming convention for task definiti... | simonluijk/aws-ecs-service-discovery | register.py | Python | mit | 6,803 |
from typing_extensions import Final
class A:
def __init__(self):
self.a: Final[int] = 1
class B:
b: Final[int]
def __init__(self):
self.b = 1 | smmribeiro/intellij-community | python/testData/inspections/PyFinalInspection/ImportedInstanceFinalReassignment/b.py | Python | apache-2.0 | 172 |
import sys
def get_time_stamp():
return datetime.datetime.now().strftime("%Y%m%d%H%M%S")
def is_number(s):
try:
float(s)
return True
except ValueError:
return False
| bahamoot/Association-Study | python/pana/mylib.py | Python | artistic-2.0 | 204 |
import errno
import json.decoder as json_decoder
import logging
import os
import platform
import random
import re
import socket
import sys
import tempfile
import time
from dateutil import tz
from .exceptions import PatroniException
from .version import __version__
tzutc = tz.tzutc()
logger = logging.getLogger(__nam... | zalando/patroni | patroni/utils.py | Python | mit | 17,617 |
#-*- coding: UTF-8 -*-
from numpy import *
import operator
def classifyPerson():
resultList = ['not at all','in small doses','in large doses']
percentTats = float(raw_input("percentage of time spent playing video games?"))
ffMiles = float(raw_input("frequent filter miles earned per year?"))
iceCream = float(raw_in... | xinghalo/DMInAction | src/mlearning/chap02-knn/dating/knn.py | Python | apache-2.0 | 2,943 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_REASON,
MagicMock,
patch)
from... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/unit/modules/varnish_test.py | Python | apache-2.0 | 2,828 |
import time
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import (
QFileDialog,
QFontDialog,
QMessageBox,
)
from wcwidth import wcwidth
from plover import system
from plover.gui_qt.paper_tape_ui import Ui_PaperTape
from plover.gui_qt.i18n import get_gettext
from plover.... | nimble0/plover | plover/gui_qt/paper_tape.py | Python | gpl-2.0 | 5,775 |
"""
.. todo::
WRITEME
"""
import numpy as np
from pylearn2.datasets import dense_design_matrix
from pylearn2.utils.serial import load
from pylearn2.utils.rng import make_np_rng
from pylearn2.utils import contains_nan
class TFD(dense_design_matrix.DenseDesignMatrix):
"""
Pylearn2 wrapper for the Toronto ... | JazzeYoung/VeryDeepAutoEncoder | pylearn2/pylearn2/datasets/tfd.py | Python | bsd-3-clause | 4,912 |
# encoding:utf-8
__author__ = 'Hope6537'
# 单元测试
import unittest
class Dict(dict):
def __init__(self, **kw):
super(Dict, self).__init__(**kw)
def __getattr__(self, key):
try:
return self[key]
except KeyError:
raise AttributeError(r"'Dict' object has no attribu... | Hope6537/hope-tactical-equipment | hope-note-module/hope-python-2.7-note/Chapter5.py | Python | apache-2.0 | 2,880 |
import logging
import registration.backends.default.urls
import registration.views
from django.conf import settings
from django.conf.urls import url
from django.contrib.auth.models import User
from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView
from django.contrib.sites.requests import Reque... | sio2project/oioioi | oioioi/base/registration_backend.py | Python | gpl-3.0 | 2,955 |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.conf import settings
from django.urls import reverse
# here will be defined models for home directories,
# info about sharing directories and item-model
class CustomUserManager(BaseUserManager):
def c... | bshishov/Memorandum | main/models.py | Python | gpl-3.0 | 4,408 |
# projet: User Folder specialise pour Zope
class ScoUserFolder(BasicUserFolder):
"""ScoDoc User Folder
"""
id ='acl_users'
title ='ScoDoc User Folder'
def __init__(self):
pass # should create db connexion ???
def getUserNames(self):
"""Return a list of usernames... | denys-duchier/Scolar | ZScoUF.py | Python | gpl-2.0 | 1,098 |
# harness_beaker.py
#
# Copyright (C) 2011 Jan Stancek <jstancek@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later ve... | uni-peter-zheng/autotest | client/harness_beaker.py | Python | gpl-2.0 | 22,692 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import threading
import time
import unittest
import warnings
from datetime import datetime, timedelta
from django.core.cache import cache
from django.core.exceptions import SuspiciousFileOpe... | abhattad4/Digi-Menu | tests/file_storage/tests.py | Python | bsd-3-clause | 30,670 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
"""
Post GitHub Issues
------------------
Take the stdout and stderr passed to the catch_output_email and create an issue
on GitHub that uses a tag corresponding to the s... | nicholsn/ncanda-data-integration | scripts/crond/post_github_issues.py | Python | bsd-3-clause | 7,944 |
#!/usr/bin/python
# This file is part of pulseaudio-dlna.
# pulseaudio-dlna 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.
# pulsea... | super7ramp/pulseaudio-dlna | pulseaudio_dlna/plugins/dlna/__init__.py | Python | gpl-3.0 | 3,522 |
import logging
log = logging.getLogger(__name__)
import botologist.plugin
class TestPlugin(botologist.plugin.Plugin):
@botologist.plugin.command('ping')
def ping(self, cmd):
return 'pong!'
@botologist.plugin.command('test_err')
def test_err(self, cmd):
raise RuntimeError('test exception')
@botologist.plug... | moopie/botologist | plugins/test.py | Python | mit | 538 |
# 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... | Kongsea/tensorflow | tensorflow/contrib/opt/python/training/elastic_average_optimizer.py | Python | apache-2.0 | 14,340 |
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 = "Lag1Trend", cycle_length = 5, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_None/trend_Lag1Trend/cycle_5/ar_/test_artificial_128_None_Lag1Trend_5__100.py | Python | bsd-3-clause | 260 |
input = """
c num blocks = 1
c num vars = 100
c minblockids[0] = 1
c maxblockids[0] = 100
p cnf 100 405
15 -27 78 0
97 -3 87 0
-100 -13 60 0
-25 -97 -83 0
-92 -40 28 0
71 -96 -30 0
4 -61 36 0
-44 100 7 0
-91 43 -52 0
89 -70 -97 0
11 59 60 0
82 -51 -16 0
-94 55 42 0
68 -86 -20 0
79 -40 15 0
71 -4 -54 0
-33 -87 -61 0
54 ... | alviano/aspino | tests/sat/Models/c405.100.SAT.dimacs.test.py | Python | apache-2.0 | 5,091 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# 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; version 2 dated June... | rwl/openpowersystem | dynamics/dynamics/excitation_systems/exc_dc1_a.py | Python | agpl-3.0 | 3,021 |
# import the libraries that you need
import requests
import csv
# make a GET request to the OneSearch X-Service API
response = requests.get('http://onesearch.cuny.edu/PrimoWebServices'
'/xservice/search/brief?'
'&institution=KB'
'&query=any,contai... | MarkEEaton/api-workshop | 4-json-to-csv.py | Python | mit | 1,093 |
# 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... | girving/tensorflow | tensorflow/python/keras/layers/convolutional.py | Python | apache-2.0 | 115,802 |
"""
pybench2.py: Test speed of one or more Pythons on a set of simple
code-string benchmarks. A function, to allow stmts to vary.
This system itself runs on both 2.X and 3.X, and may spawn both.
Version 2: adds setup statement support, with extra stmts list slot.
Uses timeit to test either the Python running... | simontakite/sysadmin | pythonscripts/learningPython/pybench2.py | Python | gpl-2.0 | 2,909 |
# -----------------------------------------------------------------------------
# Vakhshour - Event and Message layer application
# Copyright (C) 2012 Yellowen
#
# 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
# ... | Yellowen/Vakhshour | vakhshour/application.py | Python | gpl-2.0 | 3,748 |
import ctypes
import os
import types
from platform_utils import paths
def load_library(libname):
if paths.is_frozen():
libfile = os.path.join(paths.embedded_data_path(), 'accessible_output2', 'lib', libname)
else:
libfile = os.path.join(paths.module_path(), 'lib', libname)
return ctypes.windll[libfile]
def get... | codeofdusk/ProjectMagenta | src/accessible_output2/__init__.py | Python | gpl-2.0 | 885 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | jbonofre/beam | sdks/python/apache_beam/runners/runner_test.py | Python | apache-2.0 | 4,894 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'legal',
)
AUTH_USER_MODEL = 'auth.User'
SECRET_KEY = 'abcde12345'
ROOT_URLCONF = 'test_urls' | Kyruus/django-legal | test_settings.py | Python | mit | 299 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2022-02-17 23:04
from __future__ import unicode_literals
from django.db import migrations, models
import theme.utils
class Migration(migrations.Migration):
dependencies = [
('hs_access_control', '0032_auto_20210607_2027'),
]
operations = ... | hydroshare/hydroshare | hs_access_control/migrations/0033_auto_20220217_2304.py | Python | bsd-3-clause | 756 |
import os
import os.path
import pytest
pytest_plugins = ['helpers_namespace']
@pytest.helpers.register
def data_path(fn):
return os.path.join(os.path.abspath(os.path.dirname(__file__)),
'seqlib/tests/data/' + fn)
@pytest.helpers.register
def check_file(test_file, result_file):
'''
... | kepbod/seqlib | conftest.py | Python | mit | 796 |
# -*- coding: utf-8 -*-
# Copyright 2019 Juca Crispim <juca@poraodojuca.net>
# This file is part of toxicbulid.
# toxicbulid 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 Lic... | jucacrispim/toxicbuild | tests/integrations_functional/steps/bitbucket_steps.py | Python | agpl-3.0 | 2,423 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
import numpy as np
import gym
import logging
import pickle
import ray
from ray.rllib.env.atari_wrappers import wrap_deepmind, is_atari
from ray.rllib.env.base_env import BaseEnv
from ray.rllib.en... | ujvl/ray-ng | rllib/evaluation/rollout_worker.py | Python | apache-2.0 | 35,580 |
import numpy as np
class Chart(object):
def __init__(self) -> None:
self.plot = None
self.curve = None
self.downsampling = 'peak'
self.clipToView = True
self.line_color = 'r'
self.ptr = 0
self.x = np.zeros(9000)
self.y = np.zeros(9000)
self.... | Canicio/graphtiny | graphtiny/domain.py | Python | mit | 701 |
#!/usr/bin/env python
# Generate overlay images in PNG format with transparancy which can be
# used to label Splotch frames. This script can be called as a
# standalone program, see below for details. To label an entire
# directory of Splotch frames, use the driver script <splotchLabelFrames.sh>.
#
# ... | deusconsortium/splotch | labeltool/splotchColormap.py | Python | gpl-2.0 | 5,402 |
"""Trivial test program."""
def helloworld():
print "hello world"
| pombredanne/pytype | pytype/test_data/simple.py | Python | apache-2.0 | 70 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from wtforms.fields import TextAreaField
from wtforms.fields.html... | mic4ael/indico | indico/modules/legal/forms.py | Python | mit | 1,387 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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... | isralopez/geonode | geonode/services/views.py | Python | gpl-3.0 | 49,300 |
# -*- coding: utf-8 -*-
"""Pibooth picture regeneration module.
"""
import os
from os import path as osp
from PIL import Image
from pibooth.utils import LOGGER, configure_logging
from pibooth.config import PiConfigParser
from pibooth.pictures import get_picture_factory
def get_captures(images_folder):
"""Get ... | werdeil/pibooth | pibooth/scripts/regenerate.py | Python | mit | 3,045 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | python/federatedml/ensemble/basic_algorithms/decision_tree/tree_core/loss/regression_loss.py | Python | apache-2.0 | 8,346 |
from marshmallow_jsonapi import Schema, fields
from marshmallow import validate
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.exc import SQLAlchemyError
db = SQLAlchemy(session_options={"autoflush": False})
class CRUD():
def add(self, resource):
db.session.add(resource)
return db... | konstantinKim/vd-backend | app/materials/models.py | Python | mit | 2,427 |
import os
inputs = ["","input1.txt","input2.txt","input3.txt","input4.txt","input5.txt","input6.txt","input7.txt","input8.txt","input9.txt","input10.txt","input11.txt"]
outputs = ["","output1.txt","output2.txt","output3.txt","output4.txt","output5.txt","output6.txt","output7.txt","output8.txt","output9.txt","output10.... | NeillGiraldo/QB64-Lexer | judge.py | Python | mit | 1,018 |
from weppy import response
from weppy_mvc_demo import app, auth
@app.route("/")
def welcome():
response.meta.title = "Weppy Mvc Demo"
return dict()
@app.route("/health-check")
def health_check():
return "Status OK"
@app.route('/account(/<str:f>)?(/<str:k>)?')
def account(f, k):
response.meta.titl... | mijdavis2/weppy-mvc-demo | weppy_mvc_demo/controllers/main.py | Python | mit | 585 |
"""
Serialize data to/from JSON
"""
from django.utils import simplejson
from python import Serializer as PythonSerializer
from django.core.serializers.json import Deserializer as JSONDeserializer, \
DjangoJSONEncoder
class Serializer(PythonSerializer):
"""
Convert a queryset to JSON.
"""
def end_ser... | mjtorn/wadofstuff-django-serializers | wadofstuff/django/serializers/json.py | Python | bsd-3-clause | 773 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QDesktopServices(): # skipped bases: <class 'sip.simplewrapper'>
"""
QDesktopServices()
QDesktopServ... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QDesktopServices.py | Python | gpl-2.0 | 1,974 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from cms.toolbar_base import CMSToolbar
from . import request_post_identifier
from .models import Post
@toolbar_pool.register
class BlogToolbar(CMSTo... | mikemitr/business_directory | business_directory/aldryn_blog/cms_toolbar.py | Python | bsd-3-clause | 969 |
"""Test flop calculation"""
import tvm
import numpy as np
from tvm.autotvm.task.task import compute_flop
def test_conv():
for i in range(5):
N, H, W, CO, CI, KH, KW = [np.random.randint(10, 32) for _ in range(7)]
D = tvm.placeholder((N, CI, H, W))
K = tvm.placeholder((CO, CI, KH, KW))
... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/tests/python/unittest/test_autotvm_flop_calculator.py | Python | apache-2.0 | 2,244 |
"""
IPTables configuration
======================
Module for processing output of the ``iptables-save`` and ``ip6tables-save``
commands. Parsers included are:
IPTables - command ``iptables-save``
------------------------------------
IP6Tables - command ``ip6tables-save``
--------------------------------------
IPTa... | RedHatInsights/insights-core | insights/parsers/iptables.py | Python | apache-2.0 | 8,316 |
#!/usr/bin/env python
"""
@file binary2plain.py
@author Michael Behrisch
@date 2012-03-11
@version $Id: binary2plain.py 13811 2013-05-01 20:31:43Z behrisch $
Converter between SUMO's binary XML and plain XML
SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
Copyright (C) 2012-2013 DLR (http:... | rudhir-upretee/Sumo17_With_Netsim | tools/xml/binary2plain.py | Python | gpl-3.0 | 5,415 |
# file existdb/db.py
#
# Copyright 2010 Emory University General Library
#
# 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
#
# Unl... | emory-libraries/eulcore-history | src/eulcore/existdb/db.py | Python | apache-2.0 | 23,396 |
def set_direction(self):
if self.direction == 'left' and self.tower['tower_id'] == 't2' and self.tower['current_pos'] == 'left':
if self.steps == 3:
self.tower['tower_id'] = 't4'
self.tower['current_pos'] = "right"
if self.steps == 2:
self.tower['tower_id'] = 't1'... | daniellinye/HRINFG3 | euromast/components/t2.py | Python | mit | 2,527 |
from django.test import TestCase
from ..models import Contact, Consent, Locator
class TestContat(TestCase):
def setUp(self):
self.consent = Consent.objects.create(
subject_identifier='12345',
first_name='test_firstname',
last_name='test_surname')
self.locator ... | botswana-harvard/edc-sms | edc_sms/tests/test_create_contact.py | Python | gpl-2.0 | 667 |
from core import Machine, Node
from core.conditions import Condition as C
from pprint import pprint
class A(Node):
on = False
foo = 'Wibble'
def get_conditions(self):
conds = [
# No state provided defaults State.CHANGED
C('B', 'on', True),
# Also condition shou... | Strangemother/python-state-machine | scratch/machine/demo/example.py | Python | mit | 3,087 |
import sys, os
project = u'phpDocumentor'
copyright = u'2013, Mike van Riel'
version = '2.1'
release = '2.1.0'
sys.path.append(os.path.abspath('../../.exts'))
extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.ifconfig', 'plantuml']
templates_path = ['.']
source_suffix = '.rst'
master_doc = 'index'
e... | Targoniy/-json-schema-for-trip-api | vendor/phpdocumentor/phpdocumentor/docs/.templates/bare/conf.py | Python | mit | 2,977 |
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2019 Jonathan Dent, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
#... | dictoon/blenderseed | ui/scene.py | Python | mit | 4,201 |
# Copyright (c) 2016-2017 Rocky Bernstein
# Copyright (c) 2000-2002 by hartmut Goebel <hartmut@goebel.noris.de>
# Copyright (c) 1999 John Aycock
from spark_parser import DEFAULT_DEBUG as PARSER_DEFAULT_DEBUG
from uncompyle6.parser import PythonParserSingle
from uncompyle6.parsers.parse24 import Python24Parser
clas... | moagstar/python-uncompyle6 | uncompyle6/parsers/parse23.py | Python | mit | 2,672 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2017 University of Oxford
#
# This file is part of msprime.
#
# msprime 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 ... | ashander/msprime | msprime/trees.py | Python | gpl-3.0 | 89,405 |
# Copyright (c) 2018 PaddlePaddle 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 app... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_detection_map_op.py | Python | apache-2.0 | 11,509 |
"""
Support for the Tuya light.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.tuya/
"""
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, ENTITY_ID_FORMAT,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR_TEMP,... | persandstrom/home-assistant | homeassistant/components/light/tuya.py | Python | apache-2.0 | 3,246 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import unittest
from unittest import skipUnless
from django.conf import settings
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.geoip import HAS_GEOIP
from django.utils import six
if HAS_GEOIP:
from . import GeoIP, G... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/geoip/tests.py | Python | gpl-2.0 | 4,734 |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 The HyperSpyUI developers
#
# This file is part of HyperSpyUI.
#
# HyperSpyUI 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
#... | vidartf/hyperspyUI | hyperspyui/plugins/rebin.py | Python | gpl-3.0 | 5,330 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from autoupgrade import Package, ver_to_tuple
class TestFunctions(TestCase):
def test_ver_to_tuple(self):
self.assertGreater(
ver_to_tuple('0.1.2'),
ver_to_tuple('0.1.1'))
self.assertGreater(
ver_to_tuple(... | vuolter/autoupgrade | tests/test_autoupgrade.py | Python | mit | 1,078 |
#!python
#
# The Python Imaging Library
# $Id$
#
# split an animation into a number of frame files
#
from __future__ import print_function
from PIL import Image
import os
import sys
class Interval(object):
def __init__(self, interval="0"):
self.setinterval(interval)
def setinterval(self, interval... | jojoriveraa/titulacion-NFCOW | venv/bin/explode.py | Python | apache-2.0 | 2,428 |
# Copyright (C) 2007-2012 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.com>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU Gen... | BryanQuigley/sos | sos/report/plugins/sysvipc.py | Python | gpl-2.0 | 932 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | mxm/incubator-beam | sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py | Python | apache-2.0 | 3,995 |
# astronomy.py 12.10.3
from math import *
G = 6.673e-11
c = 2.998e8
H = 80 # km/s/Mpc
v = 0
relg = 1/(sqrt(1-((v/c)**2)))
def gforce(m1, m2, r):
''' (int, int, int) -> int
Calculates gravitational force between masses m1 and m2 (kg) at a separation of r (m).
'''
global G
return str((G*m1*m2)/(r**2)) + ' N'
... | lithiumoxide/scical | astronomy.py | Python | gpl-3.0 | 1,465 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-01 09:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
... | yaniv14/OpenCommunity | src/users/migrations/0016_auto_20160801_1241.py | Python | bsd-3-clause | 4,026 |
import pytest
from ray.tests.test_autoscaler import MockProvider, MockProcessRunner
from ray.autoscaler._private.command_runner import CommandRunnerInterface, \
SSHCommandRunner, _with_environment_variables, DockerCommandRunner, \
KubernetesCommandRunner
from ray.autoscaler._private.docker import DOCKER_MOUNT_P... | robertnishihara/ray | python/ray/tests/test_command_runner.py | Python | apache-2.0 | 11,023 |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
import configparser
from enum import Enum
import logging
import argpars... | peercoin/peercoin | test/functional/test_framework/test_framework.py | Python | mit | 26,817 |
from django.conf.urls import url
from . import views
from Grundgeruest.views import DetailMitMenue
from .models import Veranstaltung
app_name = 'Veranstaltungen'
veranstaltungen_urls = ([
url(r'^$',
views.ListeAlle.as_view(),
name='liste_alle'),
url(r'^(?P<slug>[-\w]+)/$',
... | wmles/scholarium.at | Veranstaltungen/urls.py | Python | mit | 1,190 |
"""
More generic ML and DL tools
ML part could contain
- cluster
- decomposition, e.g. SVD, PCA, NMF
- other unmixing (e.g., nonlinear unmixing, tensor factorization, etc.)
- gaussian mixture modelling
Dl part could contain
- cleaning / denoising
- autoencoders
Submodules
----------
.. autosummary::
:toctree: _a... | pycroscopy/pycroscopy | pycroscopy/learn/__init__.py | Python | mit | 532 |
# -*- coding: utf-8 -*-
"""
Started on wed, jun 4th, 2018
@author: carlos.arana
"""
# Librerias utilizadas
import pandas as pd
import sys
module_path = r'D:\PCCS\01_Dmine\Scripts'
if module_path not in sys.path:
sys.path.append(module_path)
from VarInt.VarInt import VarInt
from classes.Meta import Meta
from Compi... | Caranarq/01_Dmine | 08_Habitabilidad/P0812/P0812.py | Python | gpl-3.0 | 2,972 |
# coding=utf-8
import unittest
"""741. Cherry Pickup
https://leetcode.com/problems/cherry-pickup/description/
In a N x N `grid` representing a field of cherries, each cell is one of three
possible integers.
* 0 means the cell is empty, so you can pass through;
* 1 means the cell contains a cherry, that you can pick ... | openqt/algorithms | leetcode/python/lc741-cherry-pickup.py | Python | gpl-3.0 | 1,968 |
from sklearn.tree import DecisionTreeClassifier
# weak classifier
# decision tree (max depth = 2) using scikit-learn
class WeakClassifier:
# initialize
def __init__(self):
self.clf = DecisionTreeClassifier(max_depth = 2)
# train on dataset (X, y) with distribution weight w
def fit(self, X, y, w):
se... | huangshenno1/algo | ml/iris/ada_MO/weakclassifier.py | Python | mit | 425 |
from flask import current_app, Markup, render_template, request
from werkzeug.exceptions import default_exceptions, HTTPException
def error_handler(error):
msg = "Request resulted in {}".format(error)
current_app.logger.warning(msg, exc_info=error)
if isinstance(error, HTTPException):
description... | Rassilion/ProjectC | web/app/errors.py | Python | gpl-3.0 | 1,459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.