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 python3
# Convert flattened JSON back to ncdu-compatible JSON.
#
# Copyright (C) 2018 Marcin Szewczyk, marcin.szewczyk[at]wodny.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundati... | wodny/ncdu-export | unflatten.py | Python | gpl-3.0 | 2,349 |
#! /usr/bin/python
#coding: utf8
# Imports
import sys
import json
import traceback
from os.path import exists as path_exists
from os.path import abspath, dirname
from os import makedirs
from os import sep
from os import getcwd
from shutil import copy as copy_file
from shutil import copytree as copy_dir
from random imp... | AxXxel001/commentCreator_v2 | old/CommentCreator/src/cc_old.py | Python | gpl-3.0 | 8,685 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
import os
import os.path
import sys
import shutil
import logging
import fnmatch
from setuptools import setup, find_packages
from pkg_resources import parse_version
with open('README.rst', encoding='utf-8') as readme_file, \
open('HISTORY.... | starofrainnight/rabird.core | setup.py | Python | apache-2.0 | 2,363 |
"""
Utility classes for parameter scans.
"""
from __future__ import print_function, division
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.collections import PolyCollection
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import LinearLocator, FormatStrForm... | sys-bio/tellurium | tellurium/analysis/parameterscan.py | Python | apache-2.0 | 29,442 |
import itertools
import os.path
import sys
import time
from . import core
from . import file_io
from . import geometry
from . import stringconv
from . import version
#
# Functions
#
def save_output(profileli, opt):
""" Save a summary of results of evaluated profiles
"""
def m(x, pixelwidth):
retu... | maxdl/Synapse.py | synapse/main.py | Python | mit | 24,280 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import webapp2
sys.path.append("third_party")
from handlers.cron_dispatch import CronDispatch
from handlers.index import Index
from handlers.pos... | nicko96/Chrome-Infra | appengine/chromium_try_flakes/main.py | Python | bsd-3-clause | 677 |
## Copyright (c) 2020 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing p... | youtube/cobalt | third_party/libvpx/tools/3D-Reconstruction/MotionEST/Exhaust.py | Python | bsd-3-clause | 8,571 |
import requests
import settings
import json
import logging
import os
import datetime
from time import sleep
logger = settings.get_logger(os.path.realpath(__file__))
def run_collect(company, total_req):
logger.info(company + " started")
# files and vars
today = datetime.date.today()
yesterday = today... | bromjiri/Presto | crawler/server/stwits-all.py | Python | mit | 2,418 |
"""
Simulating Periodic Signals
===========================
Simulate periodic, or oscillatory, signals.
This tutorial covers the ``neurodsp.sim.periodic`` module.
"""
###################################################################################################
# sphinx_gallery_thumbnail_number = 1
# Import s... | voytekresearch/neurodsp | tutorials/sim/plot_SimulatePeriodic.py | Python | apache-2.0 | 6,799 |
"""
Unique user emails.
Revision ID: 00c617174e54
Revises: dea413e13a8a
Create Date: 2021-04-19 12:45:55.439916
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "00c617174e54"
down_revision = "dea413e13a8a"
branch_labels = None
depends_on = None
def upgrade():
op.create_unique_con... | Ouranosinc/Magpie | magpie/alembic/versions/2021-04-19_00c617174e54_unique_user_emails.py | Python | apache-2.0 | 450 |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import ... | BitcoinUnlimited/BitcoinUnlimited | qa/rpc-tests/mempoolsync.py | Python | mit | 1,808 |
# 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/.
import datetime
from email.utils import formatdate
import time
from django.conf import settings
from django.core.except... | sgarrity/bedrock | bedrock/mozorg/middleware.py | Python | mpl-2.0 | 3,595 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py | Python | mit | 18,989 |
'''
Temperature Conversion, Project 0, CIS 210
Authors: Thomas Rowland
Converts celsius temperature to fahrenheit temperature.
'''
def ctemp_to_ftemp_stub(ctemp):
''' (float) -> float
description:
convert ctemp from celsius to fahrenheit
returns:
float
examples:
>>> ctemp_to_fte... | TomRowland/University-of-Oregon | CIS_210/winter_2016/project_0/temperature.py | Python | gpl-2.0 | 748 |
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
#
# Authors : Roberto Majadas <roberto.majadas@openshine.com>
# Oier Blasco <oierblasco@gmail.com>
# Alvaro Peña <alvaro.pena@openshine.com>
#
# Copyright (c) 2003-2008, Telefonica Móviles España S.A.U.
#
# This program is free software; you can redist... | openshine/mobile-manager | src/MobileController.py | Python | gpl-2.0 | 13,417 |
from django.shortcuts import render
from django.views.generic import ListView, DetailView
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.utils.decorators import method_decorator
from contest.models import Contest
from django.http import Http404, Http... | BUPT-OJ-V4/BOJ-V4 | cheat/views.py | Python | mit | 2,509 |
from passlib.context import CryptContext
"""
Set up crypto for storing passwords in the database
"""
pass_context = CryptContext(
# use bcrypt for password hashes
schemes = ['bcrypt_sha256'],
default = 'bcrypt_sha256',
all__vary_rounds = 0.1,
bcrypt_sha256__default_rounds = 13,
)
class ... | CapstoneGrader/codeta | codeta/models/security.py | Python | mit | 1,102 |
"""
This module deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=[0, 0], mask=None, ismask=False):
""" Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``... | kerimlcr/ab2017-dpyo | ornek/moviepy/moviepy-0.2.2.12/moviepy/video/tools/drawing.py | Python | gpl-3.0 | 8,604 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2008 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Implementation of a view server for functions written in Python."""
from c... | karacos/karacos-wsgi | lib/couchdb/view.py | Python | lgpl-3.0 | 7,167 |
from django.test import override_settings
from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework_simplejwt.authentication import JWTAuthentication
from social_core.utils import parse_qs
from .base import BaseFacebookAPITestCase, BaseTwitterApiTestCase
jwt_simple_override_sett... | st4lk/django-rest-social-auth | tests/test_simple_jwt.py | Python | mit | 4,480 |
from flask.ext.wtf import Form
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import Required, Length, Email, Regexp, EqualTo
from wtforms import ValidationError
from ..models import User
class LoginForm(Form):
email = StringField('Email', validators=[Required(),... | davidtimmons/python-study | flasky/app/auth/forms.py | Python | mit | 3,139 |
from app import latinToAscii
from app.config.cplog import CPLog
from app.config.db import Movie, Session as Db, History
from app.lib.cron.base import cronBase
from app.lib.provider.rss import rss
from app.lib.qualities import Qualities
from sqlalchemy.sql.expression import or_
from app.lib import xbmc
from app.lib impo... | CouchPotato/CouchPotatoV1 | app/lib/cron/yarr.py | Python | gpl-3.0 | 12,076 |
"""Integration admin models."""
from __future__ import absolute_import
from django.contrib import admin
from django.core import urlresolvers
from django.utils.safestring import mark_safe
from pygments.formatters import HtmlFormatter
from .models import Integration, HttpExchange
def pretty_json_field(field, descript... | safwanrahman/readthedocs.org | readthedocs/integrations/admin.py | Python | mit | 3,182 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
# Instanciate one distribution object
distribution = Logistic(-0.5, 1.5)
print "Distribution ", repr(distribution)
print "Distribution ", distribution
# Is this distribution elliptical ?
print "Elli... | sofianehaddad/ot-svn | python/test/t_Logistic_std.py | Python | mit | 5,187 |
# We're still on Django 1.4 and use django-setuptest. Use this as a starting
# point for your test settings. Typically copy this file as test_settings.py
# and replace myapp with your app name.
from os.path import expanduser
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql... | praekelt/jmbo-superhero | test_settings.py | Python | bsd-3-clause | 1,830 |
"""
kombu.transport.virtual
=======================
Virtual transport implementation.
Emulates the AMQ API for non-AMQ transports.
:copyright: (c) 2009, 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
import base64
import socket
from itertools import count
from time import sleep, time
from Queu... | pantheon-systems/kombu | kombu/transport/virtual/__init__.py | Python | bsd-3-clause | 21,724 |
"""
Second quantization operators and states for bosons.
This follow the formulation of Fetter and Welecka, "Quantum Theory
of Many-Particle Systems."
"""
from sympy import (
Basic, Expr, Function, Mul, sympify, Integer, Add, sqrt,
zeros, Pow, I, S, Symbol, Tuple, Dummy
)
from sympy.utilities import iff
from... | tarballs-are-good/sympy | sympy/physics/secondquant.py | Python | bsd-3-clause | 92,018 |
#range = xrange
#input = raw_input
def read_list(t): return [t(x) for x in input().split()]
def read_line(t): return t(input())
def read_lines(t, N): return [t(input().split()) for _ in range(N)]
N, L = read_list(int)
rabbits = [input().split() for _ in range(N)]
rabbits = [(-1, 'R'), (0, 'L')] + [(int(x), d) for x, ... | knuu/competitive-programming | atcoder/arc/arc041_c.py | Python | mit | 1,689 |
import persistable
from unittest import TestCase
from pathlib import Path
from persistable.persistload import PersistLoad, PersistLoadBasic, PersistLoadWithParameters
from copy import deepcopy
TESTDATAPATH = Path(persistable.__path__[0]) / "testdata"
TMPTESTDATAPATH = Path(persistable.__path__[0]) / "testdata_tmp" / ... | DataReply/persistable | tests/test_persistload.py | Python | gpl-3.0 | 5,723 |
# Copyright 2010-2012 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.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; version 3 or... | detrout/pykolab | pykolab/auth/ldap/cache.py | Python | gpl-3.0 | 5,296 |
from django.http import HttpResponse
from django.conf.urls import url
from project import project, projects
from case import case
from run import run
from result import result, reason
from tag import tag
def index(request):
return HttpResponse('Hello, world. You\'re at the wrt index.\n'
'... | klrmn/well-rested-tests | well-rested-tests-server/wrt/views.py | Python | mpl-2.0 | 877 |
## Breadth-first search algorithm to determine degree of friendship. Choose
## a source node and move outwards, labeling adjacent nodes with distance
## 1. Repeat to label friends of friends distance 2, etc.
import queue
# Feature 1: warn user if transaction partner is not a friend (k > 1)
# Feature 2: warn user if... | chuckinator0/Projects | paymoFraud/breadthFirst.py | Python | gpl-3.0 | 1,282 |
#!/usr/bin/env python3
#
# Distributed under terms of the MIT license.
#
# Copyright (c) 2017 Olaf Lessenich
#
import argparse
import email
import email.policy
import json
import logging
import nntplib
import pymysql
import pytz
import time
import traceback
""" Logging setup """
logging.basicConfig(filename='nntp2db... | xai/nntp2db | nntp2db.py | Python | mit | 14,199 |
import os
import tempfile
import numpy
import math
import random
import time
from weka_utilities import test_file_creation, feature_selection, Test_result
from data_mining.PrintOutput import PrintOutput
#loads system variables
path = os... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/data_mining/models/weka_num_model.py | Python | gpl-2.0 | 10,146 |
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from petition.models import Organization, Petition, PytitionUser, SlugModel
class SlugModelTest(TestCase):
def setUp(self):
User = get_user_model()
u = User.objects.create_user('julia', ... | fallen/Pytition | pytition/petition/tests/tests_SlugModel.py | Python | bsd-3-clause | 2,030 |
# -*- coding: utf-8 -*-
import sys, logging
import numpy as np
from math import ceil
from gseapy.stats import multiple_testing_correction
from joblib import delayed, Parallel
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1,
nperm=1000, seed=None, single=False, sca... | BioNinja/gseapy | gseapy/algorithm.py | Python | mit | 31,007 |
"""a module for parsing email response text
this file is a candidate for publishing as an independent module
"""
import re
import sys
#Regexes for quote separators
#add more via variables ending with _QUOTE_RE
#These regexes do not contain any trailing:
#* newline chars,
#* lines starting with | or >
#* lines consisti... | erichegt/askbot-devel | askbot/mail/parsing.py | Python | gpl-3.0 | 3,037 |
import wx
class Provision(object):
def __init__(self,notify_window):
self.notify_window=notify_window
def run(self,event):
logger.debug("Running Provisioning")
| jhgoebbert/cvl-fabric-launcher | Provision.py | Python | gpl-3.0 | 185 |
import os
import tempfile
import unittest
from . import profile
from . import test_helper
from . import util
class TestRecursiveScandir(unittest.TestCase):
def setUp(self):
self.dir = tempfile.TemporaryDirectory()
# Make a tree with:
# * Dir with 1 file: /single-file
# * Dir with 1 dir: /single-... | dseomn/cohydra | cohydra/test_util.py | Python | apache-2.0 | 2,981 |
"""
Extremely basic tests for the gen_cert_report command
"""
import pytest
from django.core.management import call_command
def test_cert_report_help(capsys):
"""
Basic test to see if the command will parse and get args
"""
with pytest.raises(SystemExit):
call_command('gen_cert_report', '--h... | edx-solutions/edx-platform | lms/djangoapps/certificates/management/commands/tests/test_gen_cert_report.py | Python | agpl-3.0 | 427 |
"""handles rendering activities."""
import datetime
from django.core.exceptions import ObjectDoesNotExist
from django.db import IntegrityError
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib import messages
from apps.widgets.smartgrid_play_tester.forms imp... | yongwen/makahiki | makahiki/apps/widgets/smartgrid_play_tester/view_test_activities.py | Python | mit | 3,392 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def vec_slicing():
iris = h2o.import_file(path=pyunit_utils.locate("smalldata/iris/iris_wheader.csv"))
iris.show()
###################################################################
# H2OVec[int]
re... | YzPaul3/h2o-3 | h2o-py/tests/testdir_munging/slice/pyunit_vec_slicing.py | Python | apache-2.0 | 750 |
import unittest
from pycoin.networks.registry import network_for_netcode
def make_tests_for_netcode(netcode):
network = network_for_netcode(netcode)
address_for_script = network.address.for_script
script_for_p2pkh = network.contract.for_p2pkh
script_for_p2pk = network.contract.for_p2pk
script_fo... | richardkiss/pycoin | tests/address_for_script_test.py | Python | mit | 3,532 |
class ParametrizedError(Exception):
def __init__(self, problem, invalid):
self.problem = str(problem)
self.invalid = str(invalid)
def __str__(self):
print('--- Error: {0}\n--- Caused by: {1}'.format(self.problem, self.invalid))
class InvalidToken(ParametrizedError):
pass
class ToneError(Parametri... | gribvirus74/Bee-per | Error.py | Python | gpl-3.0 | 534 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crm', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Candidate',
fields=[
... | ocwc/ocwc-members | members/elections/migrations/0001_initial.py | Python | mit | 6,279 |
SUCCESS = 0
FAILURE = 1 # NOTE: click.abort() uses this
# for when tests are already running
ALREADY_RUNNING = 2
| naphatkrit/easyci | easyci/exit_codes.py | Python | mit | 115 |
#!/usr/bin/env python
"""Unit tests run as PYTHONPATH=.. python3 ./test_valve.py."""
# Copyright (C) 2015 Research and Innovation Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2018 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | wackerly/faucet | tests/test_valve.py | Python | apache-2.0 | 68,073 |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | hguemar/cinder | cinder/backup/drivers/swift.py | Python | apache-2.0 | 28,180 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | tests/unit/bokeh/io/test_state.py | Python | bsd-3-clause | 4,466 |
def write_gs(file_name, zero_point, lgs_return_per_watt, zenith_angle):
"""Write (append) guide stars parameters to file for YAO
Args:
file_name : (str) : name of the file to append the parameter to
zero_point : (float) : flux for magnitude 0 (ph/m²/s)
lgs_return_per_watt : (float) :... | ANR-COMPASS/shesha | shesha/util/writers/yao/gs.py | Python | gpl-3.0 | 894 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | fbsder/openthread | tests/scripts/thread-cert/message.py | Python | bsd-3-clause | 14,051 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from problems.models import Problem, TestCase
from django.contrib.auth.models import User
from django.db.models import signals
from django.dispatch import Signal
import os, re
from contests.models import Score, Contest
import d... | cs251-eclipse/EclipseOJ | EclipseOJ/judge/models.py | Python | mit | 9,515 |
# coding: utf-8
from .suite import BaseSuite
class TestUser(BaseSuite):
def test_users(self):
rv = self.client.get('/user/')
assert '<title>Users' in rv.data
rv = self.client.get('/user/?page=s')
assert rv.status_code == 404
def test_city(self):
rv = self.client.get(... | beni55/june | tests/test_user.py | Python | bsd-3-clause | 798 |
#! /usr/bin/env python
#-------------------------------------#
# Edit By: Andy.Zhao
# This is a test python
#-------------------------------------#
if __name__ == '__main__':
pass | zhaoace/codecraft | python/python_notes/template.py | Python | unlicense | 201 |
lanchonete = {"Salgado" : 4.5, "Lanche" : 16.5, "Suco" : 3, "Refrigerante" : 3.5, "Doce" : 1}
for item in lanchonete:
print("{0:20} {1:6.2f}".format(item, lanchonete[item]))
#https://pt.stackoverflow.com/q/341156/101
| bigown/SOpt | Python/Collection/DictKeyValue.py | Python | mit | 226 |
"""
Django settings for gravel project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
from gravel.pri... | austinhartzheim/gravel | gravel/settings.py | Python | gpl-3.0 | 2,104 |
#!/usr/bin/env python
# This file is part of gl3w, hosted at https://github.com/skaslev/gl3w
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# ... | glampert/reverse-engineering-darkstone | src/thirdparty/gl3w/gl3w_gen.py | Python | mit | 9,384 |
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'django_inlines_tests.db'
ROOT_URLCONF = 'django_inlines.admin_urls'
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'core',
'django_inlines',
]
TEMPLATE_LOADERS = (
'django.template.lo... | artscoop/django_inlines | tests/settings.py | Python | bsd-3-clause | 430 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# 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 copyri... | tecan/xchat-rt | plugins/scripts/Supybot-0.83.4.1-bitcoinotc-bot/plugins/Channel/test.py | Python | gpl-2.0 | 10,243 |
import os
import sys
from tarfile import is_tarfile
from zipfile import is_zipfile
from ase.atoms import Atoms
from ase.units import Bohr, Hartree
from ase.io.trajectory import PickleTrajectory
from ase.io.bundletrajectory import BundleTrajectory
from ase.calculators.singlepoint import SinglePointDFTCalculator
from as... | alexei-matveev/ase-local | ase/io/__init__.py | Python | gpl-2.0 | 22,525 |
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | thonkify/thonkify | src/lib/gcloud/datastore/test_query.py | Python | mit | 25,807 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from . import system, manage, template_zhouzx
import api
urlpatterns = [
url(r'^system/$', system.index, name='monitor'),
url(r'^manage/del/all/$', manage.drop_sys_info, name='drop_all'),
url(r'^manage/del/range/(?P<t... | zhixingchou/Adminset_Zabbix | monitor/urls.py | Python | apache-2.0 | 1,087 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import itertools
import random
import warnings
import numpy as np
from .gd import GradientDescent
from .bfgs import Lbfgs
from .cg import NonlinearConjugateGradient
from .rprop import Rprop
from .rmsprop import RmsProp
from .adadelta impo... | gabobert/climin | climin/util.py | Python | bsd-3-clause | 11,486 |
#encoding:UTF-8
import requests
import time
import datetime
import sys
from bs4 import BeautifulSoup
import re
def getInfo(soup):
print('in get info.')
result = ''
a = soup.findAll('dl')
for b in a:
c = b.find('a',{'class':'title'})
d = c.string
print(d)
result += d + '\... | felixzhao/BookDigger | GetBookList/queryBookListByTag.py | Python | apache-2.0 | 1,587 |
# -*- coding: utf-8 -*-
u"""
Copyright 2013-2014 Olivier Cortès <oc@1flow.io>.
This file is part of the 1flow project.
1flow 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... | 1flow/1flow | oneflow/core/admin/__init__.py | Python | agpl-3.0 | 2,818 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 Justin Santa Barbara
#
# 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/L... | tylertian/Openstack | openstack F/cinder/cinder/tests/integrated/__init__.py | Python | apache-2.0 | 885 |
import os
from distutils.core import setup
def find_packages(srcdir):
package_list = []
badnames=["__pycache__",]
for root, dirs, files in os.walk(srcdir):
if not any(bad in root for bad in badnames):
if "__init__.py" in files:
package_list.append( root.replac... | Semprini/cbe | cbe/setup.py | Python | apache-2.0 | 505 |
# adapted from https://stackoverflow.com/a/1517652
import sys
import subprocess
# Note: This doesn't handle @-prefixed library paths like @loader_path/...
def otool(s):
print(s)
o = subprocess.Popen(['/usr/bin/otool', '-L', s], stdout=subprocess.PIPE, universal_newlines=True)
for l in o.stdout:
if... | neothemachine/lensfunpy | .github/scripts/otooltree.py | Python | mit | 745 |
from datetime import datetime
import urlparse
import logging
from BeautifulSoup import BeautifulSoup
from consts.event_type import EventType
from datafeeds.parser_base import ParserBase
from helpers.event_helper import EventHelper
class UsfirstEventOffseasonListParser(ParserBase):
@classmethod
def parse(se... | bvisness/the-blue-alliance | datafeeds/usfirst_event_offseason_list_parser.py | Python | mit | 2,125 |
# The plot server must be running
# Go to http://localhost:5006/bokeh to view this plot
from numpy.random import random
from bokeh.plotting import *
def mscatter(p, x, y, typestr):
p.scatter(x, y, marker=typestr,
line_color="#6666ee", fill_color="#ee6666", fill_alpha=0.5, size=12)
def mtext(p, x, y,... | zrhans/python | exemplos/Examples.lnk/bokeh/plotting/server/markers.py | Python | gpl-2.0 | 1,590 |
#!/usr/bin/python
print "Hola Mundo" # Esto imprime la cadena "Hola mundo"
| psicobyte/ejemplos-python | cap4/p45b.py | Python | gpl-3.0 | 76 |
import xbmcaddon
xbmcAddon = xbmcaddon.Addon()
def get(settingId, default=None, isInt=False, lower=False, valueList=None):
setting = xbmcAddon.getSetting(settingId)
if setting == '':
return default
if isInt:
return int(setting)
if valueList:
setting = int(setting)
... | SportySpice/Collections | src/tools/addonSettings.py | Python | gpl-2.0 | 636 |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from kernel.config import DATA_DIR
from flask import session
Base = declarative_base()
user_engine = create_engine('sqlite:///' + DATA_DIR + 'users/' + str(session['id']) + '.sqlite')
s... | Mimalef/paasta | src/kernel/models/users.py | Python | mit | 998 |
import copy
import re
class Node:
def __init__(self, data=None):
self.data = data
self.next = None
def __str__(self):
if self.next:
return str(self.next)
return ""
def __len__(self):
if self.next:
return len(self.next)
return 0
class ... | bruntonspall/regex-builder | builder.py | Python | bsd-3-clause | 7,078 |
import unittest
import tethys_gizmos.gizmo_options.google_map_view as gizmo_google_map_view
class TestGoogleMapView(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_GoogleMapView(self):
height = '600px'
width = '80%'
maps_api_key = 'api-... | CI-WATER/tethys | tests/unit_tests/test_tethys_gizmos/test_gizmo_options/test_google_map_view.py | Python | bsd-2-clause | 1,994 |
#!/usr/bin/python
# -*-coding: utf-8 -*-
# decode.py
#
# Copyright 2008 François Magimel, aka Linkid <cucumania@gmail.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 ... | Linkid/lapyrinthe | lapyrinthe/decode.py | Python | gpl-3.0 | 7,793 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import pytest
from RPLCD.gpio import CharLCD
try:
unichr = unichr
except NameError: # Python 3
unichr = chr
SP = 32 # Space
@pytest.fixture
def get_lcd(mocker, charlcd_kwargs):
def _func(cols... | dbrgn/RPLCD | tests/test_auto_linebreaks.py | Python | mit | 2,610 |
def auth(request):
"""
Returns context variables required by apps that use Django's authentication
system.
If there is no 'user' attribute in the request, uses AnonymousUser (from
django.contrib.auth).
"""
if hasattr(request, 'user'):
user = request.user
else:
from seahu... | miurahr/seahub | seahub/auth/context_processors.py | Python | apache-2.0 | 451 |
__author__ = """Hossein Noroozpour"""
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GLib
from time import time
class ProfilerWindow(Gtk.ScrolledWindow):
"""Scrolled Window for profiler page in side tab in main window"""
def __init__(s... | Hossein-Noroozpour/PyHGEE | ui/HGEProfilerWindow.py | Python | mit | 1,637 |
import os
import sys
import argparse
import argcomplete
from .Exceptions import AbortException, UserException, WorkExistsException, RepositoryException
from .Database import Database
from .TermOutput import msg
from .Commands import *
from .Commands.Command import Registry
from .Cache import RequestCache
def main():... | tmearnest/sbd | pdfs/Main.py | Python | mit | 2,168 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 16:33:44 2017
Create the wavelength grid that samples the overall spectral energy distribution
@author: ishort
"""
import math
def lamgrid(numLams, lamSetup):
lambdaScale = []
logLambda = 0.0
#// Space lambdas logarithmically:
... | sevenian3/ChromaStarPy | LamGrid.py | Python | mit | 660 |
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route("/")
def index():
name = request.args.get('name', 'Nobody')
if name:
greeting = f"Hello, {name}"
else:
greeting = "Hello World"
return render_template("index.html", gr... | zedshaw/learn-python3-thw-code | ex51/gothonweb/form_test.py | Python | mit | 379 |
"""
This contains a simple view for rendering the webclient
page and serve it eventual static content.
"""
from __future__ import print_function
from django.shortcuts import render
from evennia.players.models import PlayerDB
def webclient(request):
"""
Webclient page template loading.
"""
# analyz... | shollen/evennia | evennia/web/webclient/views.py | Python | bsd-3-clause | 822 |
PROGRAM_PREFIX = 'docker-credential-'
DEFAULT_LINUX_STORE = 'secretservice'
DEFAULT_OSX_STORE = 'osxkeychain'
DEFAULT_WIN32_STORE = 'wincred'
| shin-/dockerpy-creds | dockerpycreds/constants.py | Python | apache-2.0 | 142 |
import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import RobustScaler
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import GridSearchCV
# classifiers
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neighbors import RadiusNeighborsClassifier
fr... | alod83/osiris | srp/train.py | Python | mit | 10,250 |
import numpy as np
import pickle, gzip
import theano
import theano.tensor as T
class Pegasos_zeroInit:
"""
A symbolic implementation of pegasos for multiple classification
"""
def __init__(self, rng, input, n_in, n_out, weight_decay, loss):
self.W = theano.shared(
value=np.zeros(
... | zhenxuan00/mmdgm | conv-mmdgm/layer/Pegasos_zeroInit.py | Python | mit | 2,765 |
class Solution(object):
def maximumProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
largest_three = [-1003,-1002,-1001]
smallest_three = [1003,1002,1001]
for i in nums:
if i > largest_three[0]:
largest_three[0... | danielsunzhongyuan/my_leetcode_in_python | maximum_product_of_three_numbers_628.py | Python | apache-2.0 | 1,200 |
from django.shortcuts import render
from django.core.context_processors import request
from ourplatform.models import *
from django.http import *
from urllib2 import Request
import json
from datetime import datetime, date
from ourplatform import CJsonEncoder
from django.core.serializers.json import DjangoJSONEncoder
fr... | redduck3/CodeRush | ourplatform/views.py | Python | apache-2.0 | 11,651 |
import os, re, csv, string
import cPickle as pickle
import numpy as np
import sys
from sklearn import metrics, preprocessing, cross_validation
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier, LogisticRegression
from nltk.tokenize import WhitespaceTokenizer
de... | yoonkim/kdd_2014 | kdd_2014_data_model2.py | Python | gpl-3.0 | 11,196 |
"""
resolveurl Kodi Addon
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed ... | felipenaselva/felipe.repository | script.module.resolveurl/lib/resolveurl/plugins/alldebrid.py | Python | gpl-2.0 | 7,225 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class DeliveryCarrier(models.Model):
_name = 'delivery.carrier'
_inherit = ['delivery.carrier', 'website.published.mixin']
website_description = fields.Text(related='product... | chienlieu2017/it_management | odoo/addons/website_sale_delivery/models/delivery.py | Python | gpl-3.0 | 441 |
SQLALCHEMY_DATABASE_URI = 'mysql+mysqldb://radius:radius@localhost/radius?charset=utf8'
DEBUG = True
SECRET_KEY = 'secret-key'
SERVER_NAME = 'localhost:5000'
MAIL_ENABLE = False
MAIL_SERVER = 'localhost'
MAIL_PORT = 25
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_USERNAME = ''
MAIL_PASSWORD = ''
MAIL_DEFAULT_SENDER ... | ustclug/lug-vpn-web | config/example.py | Python | agpl-3.0 | 425 |
#!/usr/bin/python -tt
list = ['larry', 'curly', 'moe']
print "code: list = ['larry', 'curly', 'moe']"
print list
print '----------------------------------------------------'
list.append('shemp') ## append elem at end
print "code: list.append('shemp')" ## append elem at end
print list
print '-----------------------... | davislg/Google-s-Python-Class | basic/davis_solution/stooge_list.py | Python | apache-2.0 | 1,539 |
import gribdoctor
import click, json, numpy as np
def upwrap_raster(inputRaster, outputRaster, bidx, bandtags):
import rasterio
with rasterio.drivers():
with rasterio.open(inputRaster, 'r') as src:
if bidx == 'all':
bandNos = np.arange(src.count) + 1
else:
... | mapbox/grib-doctor | gribdoctor/scripts/cut_splice_globewrap.py | Python | mit | 2,079 |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2014 Ruben Pollan <meskio@sindominio.net>
# Copyright (C) 2014 tele <tele@rhizomatica.org>
#
# RCCN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public L... | Rhizomatica/rccn | rccn/rrc.py | Python | agpl-3.0 | 10,788 |
import Vars # Модуль переменных
class CTile: # Класс тайла карты
Land = True # Земля или вода
Country = Vars.VoidCountry # Принадлежность государству
City = '' # Город, находящийся на тайле
Defence = 1 # Защита тайла
Army = 0 # Армия, находящаяся на тайле
Char = '#' # Отображаемый символ
def get_cha... | Brounredo/Revolution | Map.py | Python | gpl-2.0 | 637 |
# This file is part of Gajim.
#
# Gajim 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; version 3 only.
#
# Gajim is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | gajim/gajim | gajim/common/filetransfer.py | Python | gpl-3.0 | 3,238 |
print(len({a**b for a in range(2,101) for b in range(2,101)}))
| piohhmy/euler | p029.py | Python | mit | 63 |
# 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 requ... | JioCloud/python-novaclient | novaclient/tests/v1_1/test_flavor_access.py | Python | apache-2.0 | 2,342 |
import numpy as np
import ndhist
h = ndhist.ndhist((np.array([0,1,2,3,4,5,6,7,8,9,11], dtype=np.dtype(np.float64)),
)
, dtype=np.dtype(np.float64))
h.fill([-0.1, 0, 0.9, 1, 3.3, 9.9, 10, 11.1])
print(h.bc)
class V(object):
def __init__(self, v=0):
self._v = v
def _... | martwo/ndhist | examples/python/fill_1d_generic_axis.py | Python | bsd-2-clause | 790 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.