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 |
|---|---|---|---|---|---|
from django.shortcuts import render, redirect, Http404
from django.core.urlresolvers import reverse
from dashboard.models import PagePos
from .forms import MessageForm, ApplicantForm
def index(request):
return render(request, 'home/index.html')
def customized_page(request, slug):
page = PagePos.objects.get_... | Ma233/beijingteach | home/views.py | Python | mit | 929 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
vector_selectbypoint
A QGIS plugin
Select vector features, point and click.
-------------------
begin : 2014-04-07
copy... | OregonWalks/qgis_vector_selectbypoint | vector_selectbypoint.py | Python | gpl-3.0 | 4,244 |
#!/usr/bin/env python
import os
import sys
import shutil
import numpy as np
import warnings
from astropy.io import fits
from astropy.utils.exceptions import AstropyWarning
from astropy.table import Table
from dlnpyutils import utils as dln, coords, job_daemon as jd
from astropy import units as u
from astropy.coordinat... | dnidever/noaosourcecatalog | python/nsc_instcal_combine_main.py | Python | mit | 9,633 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import cms.models.pluginmodel
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CssBackground',
fields=[
... | alexmalykh/cmsplugin-css-background | cmsplugin_css_background/migrations/0001_initial.py | Python | mit | 1,409 |
# simple tests
import justify
def test_line_width():
text = 'Lorem ipsum dolor sit amet. consectetur adipiscing elit.'
result = justify.justify(text, 60)
line = result.split('\n')[0]
assert len(line) == 60, 'Incorrect line width'
def test_justify():
text = (
'Fusce id tincidunt arcu. Pel... | hgenru/tsc-challenge | tests.py | Python | gpl-3.0 | 1,065 |
from .main import PLCRemote
| baryon5/plc-remote | plcpi/__init__.py | Python | gpl-3.0 | 30 |
#!/usr/bin/python
#
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# arch-tag: 52e0c871-49a3-4186-beb8-9817d02d5465
import unittest
import apt_pkg
from lp.archiveuploader.tagfiles import (
parse_tagfile,
TagFile... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/archiveuploader/tests/test_tagfiles.py | Python | agpl-3.0 | 6,196 |
from __future__ import absolute_import
import numpy as nm
from sfepy.base.base import output, assert_, get_default, Struct
from sfepy.homogenization.coefs_base import CoefOne, \
TCorrectorsViaPressureEVP, CoefFMSym, CoefFMOne, CorrMiniApp
from sfepy.discrete.fem.meshio import HDF5MeshIO
from sfepy.solvers.ts impo... | lokik/sfepy | sfepy/homogenization/coefs_elastic.py | Python | bsd-3-clause | 8,391 |
from django.test import TestCase
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test.client import Client
from milkman.dairy import milkman
from userroles.models import set_user_role, UserRole
from userroles.utils import SettingsTestCase
from userroles import roles, Roles, R... | laginha/django-user-roles | src/userroles/tests.py | Python | mit | 4,224 |
"""
This test logging module configures test case logging to print
debug messages to stdout.
"""
import os
from qiutil.logging import (configure, logger)
LOG_FILE = os.path.dirname(__file__) + '/../results/log/qixnat.log'
configure(app='qixnat', filename=LOG_FILE, level='DEBUG')
| ohsu-qin/qixnat | test/helpers/logging.py | Python | bsd-2-clause | 284 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
'''Handling of the <message> element.
'''
import re
import types
from grit.node import base
import grit.format.rc_header
import ... | JoKaWare/WTL-DUI | tools/grit/grit/node/message.py | Python | bsd-3-clause | 10,287 |
""" define one class to control the spider
"""
class Controler(object):
exitflag = 0
msg = ''
@staticmethod
def getExitCode():
return Controler.exitflag
@staticmethod
def setExitCode(flag, msg=''):
Controler.exitflag = flag
Controler.msg = msg
@staticmethod
def g... | mavarick/spider-python | webspider/core/controler.py | Python | gpl-2.0 | 365 |
import sys
import cv2
import pywt
import numpy as np
from cdf import fwt97_2d, iwt97_2d
from coding import huffman
from matplotlib import pyplot as plt
def print_file(img, h, w, name):
f = open(name, "w")
for i in range(0, h):
for j in range(0, w):
f.write(str(img[i][j])+"\n")
f.wr... | CoderSherlock/jls_555 | src/jp2/main.py | Python | gpl-3.0 | 5,899 |
#!/bin/python
"""
foregrounds.py
jlazear
1/20/15
Tools for constructing CMB foregrounds.
Long description
Example:
<example code here>
"""
__version__ = 20150120
__releasestatus__ = 'beta'
import inspect
import os
import numpy as np
from astropy.io import fits
import healpy as hp
import lib
# Path to the cmb/... | jlazear/cmb | lib/foregrounds.py | Python | apache-2.0 | 7,013 |
from test.fixture import *
from hypothesis import given
from hypothesis.strategies import text
from astropy.io import fits
import utils.dave_reader as DaveReader
from utils.dave_reader import save_to_intermediate_file, load_dataset_from_intermediate_file
import utils.file_utils as FileUtils
from stingray.events impor... | StingraySoftware/dave | src/test/python/test/utils/test_dave_reader.py | Python | apache-2.0 | 4,412 |
def agts(queue):
al = queue.add('al.py', ncpus=8, walltime=12 * 60)
queue.add('al.agts.py', deps=[al],
creates=['Al_conv_ecut.png', 'Al_conv_k.png'])
if __name__ == '__main__':
import pylab as plt
from ase.utils.eos import EquationOfState
from ase.io import read
def fit(filename)... | robwarm/gpaw-symm | doc/tutorials/lattice_constants/al.agts.py | Python | gpl-3.0 | 1,167 |
#! /usr/bin/python3
# pw.py - An insecure password locker program.
PASSWORDS = { 'email': 'FghjhgduY&^%34$98',
'blog': 'djhgjdhg7678adhb',
'luggage': 'eytuey4174e35'
}
import sys, pyperclip
if len(sys.argv) < 2:
print('Usage: python pw.py [account] - copy account password')
sys.exit()... | JasonMDev/automate-boring-stuff | CH06/pw.py | Python | cc0-1.0 | 517 |
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | jcsp/manila | manila/tests/scheduler/test_scheduler_options.py | Python | apache-2.0 | 5,197 |
import pprint
from django.contrib import admin
from django.contrib.auth.models import User
from ietf.person.models import Person
def merge_persons(source,target,stream):
# merge emails
for email in source.email_set.all():
print >>stream, "Merging email: {}".format(email.address)
email.pe... | wpjesus/codematch | ietf/person/utils.py | Python | bsd-3-clause | 3,013 |
# Copyright (C) 2007-2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 you... | hcs/mailman | src/mailman/model/listmanager.py | Python | gpl-3.0 | 4,122 |
import json
from google.appengine.ext import ndb
from api.apiv3.api_base_controller import ApiBaseController
from api.apiv3.model_properties import filter_match_properties
from database.match_query import MatchQuery
class ApiMatchController(ApiBaseController):
CACHE_VERSION = 0
CACHE_HEADER_LENGTH = 61
... | the-blue-alliance/the-blue-alliance | old_py2/api/apiv3/api_match_controller.py | Python | mit | 853 |
"""Ban logic for HTTP component."""
from collections import defaultdict
from datetime import datetime
from ipaddress import ip_address
import logging
from socket import gethostbyaddr, herror
from typing import List, Optional
from aiohttp.web import middleware
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnaut... | tboyce021/home-assistant | homeassistant/components/http/ban.py | Python | apache-2.0 | 6,635 |
from ase import *
from espresso import espresso
from ase.lattice import bulk
import matplotlib
matplotlib.use('Agg') #turn off screen output so we can plot from the cluster
import matplotlib.pyplot as plt
import numpy as np
metal = 'Pt'
metal2 = None # if you have an alloy, specify the second metal
name = metal
if... | CBE544/CBE544.github.io | ASE/Getting_Started/run_sp.py | Python | gpl-2.0 | 2,085 |
""" Bunch of utilility functions needed for import jobs """
import logging
from datetime import datetime
from typing import Optional
from listenbrainz_spark.exceptions import PathNotFoundException
from listenbrainz_spark.ftp import DumpType
from listenbrainz_spark.path import IMPORT_METADATA
from listenbrainz_spark.sc... | metabrainz/listenbrainz-server | listenbrainz_spark/request_consumer/jobs/utils.py | Python | gpl-2.0 | 2,692 |
# -*- coding: utf-8 -*-
from .processor import QueryProcessor
class MySqlQueryProcessor(QueryProcessor):
def process_insert_get_id(self, query, sql, values, sequence=None):
"""
Process an "insert get ID" query.
:param query: A QueryBuilder instance
:type query: QueryBuilder
... | MakarenaLabs/Orator-Google-App-Engine | orator/query/processors/mysql_processor.py | Python | mit | 1,785 |
import socket
from PIL import Image
import io
import os
def string_to_byte(hex_input):
return bytearray.fromhex(hex_input)
def serve():
host = ""
port = 5001
my_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
my_socket.bind((host, port))
my_socket.listen(1)
conn, address = ... | kiwicampus/kiwix | server.py | Python | mit | 2,463 |
import httplib
import sys
import time
def poke_it(ip,k):
conn = httplib.HTTPConnection(ip)
conn.request("GET", "/A?n=%s"%k)
r1 = conn.getresponse()
return r1.read()
def sequential_pokes(ip, number_of_pokes):
times = []
for k in range(3,4):
for x in range(0, number_of_pokes):
... | kantai/libvirt-vfork | server/time-poke-k.py | Python | lgpl-2.1 | 625 |
import datetime
print(datetime.datetime.today().strftime('%Y%m%d'))
| jgstew/tools | Python/yyyymmdd.py | Python | mit | 68 |
import MySQLdb
import requests
##Connect to the database
conn = MySQLdb.connect(host= "db-address",
user="db-user",
passwd="db-pass",
db="db-name")
x = conn.cursor()
x.execute("SELECT * FROM switch_information")
returned_info = x.fetchall()
for info_line in returned... | LukeCSmith0/hyperspeed-tester | Server-Script/switch_information_check.py | Python | gpl-3.0 | 1,526 |
#!/usr/bin/env python
from box import Box, Item
# create new box
# create new version
b = Box('/tmp/foo')
v = b.addVersion()
# add new item to version and save
i = Item.from_path(b, '/Users/rsgalloway/Desktop/snow.jpg')
v.addItems([i])
print v.items()
print v.tree
v.save('teesting add version, adding snow.jpg')
pri... | pombredanne/box | test/test.py | Python | bsd-3-clause | 403 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
def execute():
frappe.db.sql("""
update
`tabPurchase Taxes and Charges`
set
tax_amount_after_discount_amount = tax_amount,
base_tax_amount_after_discount_amount =... | mahabuber/erpnext | erpnext/patches/v5_0/update_tax_amount_after_discount_in_purchase_cycle.py | Python | agpl-3.0 | 463 |
'''test_measureobjectradialdistribution.py
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rights reserved.
Please see the AUTHORS file for credit... | sstoma/CellProfiler | cellprofiler/modules/tests/test_measureobjectradialdistribution.py | Python | gpl-2.0 | 35,011 |
import logging
import pathlib
import sys
import sysconfig
from typing import List, Optional
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
from . import _distutils, _sysconfig
from .base import (
USER_CACHE_DIR,
get_major_minor_version,
get_src_prefix,
site_packages,
user_site,
)
__a... | google/material-design-icons | update/venv/lib/python3.9/site-packages/pip/_internal/locations/__init__.py | Python | apache-2.0 | 4,826 |
"""Command Line Interface"""
import os
import re
import codecs
import logging
from holland.core.exceptions import BackupError
from holland.lib.compression import open_stream, lookup_compression
from holland.lib.mysql import MySQLSchema, connect, MySQLError
from holland.lib.mysql import include_glob, exclude_glob, \
... | m00dawg/holland | plugins/holland.backup.mysqldump/holland/backup/mysqldump/plugin.py | Python | bsd-3-clause | 21,830 |
#!/usr/bin/python3
from twisted.internet import reactor
from twisted.internet.protocol import Factory
from twisted.internet.protocol import Protocol
from ..server.server_session import *
from ..server.users import *
class ServerConversation(object):
def __init__(self, conversation_id):
self.id = convers... | Abraxos/hermes | hermes-api/hermeslib/hermeslib/server/hermes_server.py | Python | gpl-3.0 | 5,634 |
from collections import defaultdict
from dateutil.parser import parse
import pickle
import os
import sys
import tempfile
import shutil
from .corpus_doc_manager import CorpusDocListMgr, CorpusDocFileMgr
class Corpus:
def __init__(self, lang='en', docs=[], big_ass_data=True, corpus_dir=""):
# We ignore "lan... | ASethi77/StateOfTheMedia | src/preprocess_text/corpus.py | Python | apache-2.0 | 1,607 |
# Virtual memory analysis scripts.
# Developed 2012-2014 by Peter Hornyack, pjh@cs.washington.edu
# Copyright (c) 2012-2014 Peter Hornyack and University of Washington
# Automation script for Firefox and Chrome. For now, just opens some
# number of web pages in one or many windows; no interaction with the
# pages is p... | pjh/vm-analyze | app_scripts/app_browser.py | Python | bsd-3-clause | 41,628 |
import numpy, sys, os, pylab, astropy, astropy.io.fits as pyfits, ldac, math
def open_and_get_shearcat(filename, tablename):
#
# for opening and retrieving shear cat.
#
return ldac.openObjectFile(filename, tablename)
#class ello
def avg_shear(g1array, g2array):
avg1 = numpy.mean(g1array)... | deapplegate/wtgpipeline | quality_studies_psf.py | Python | mit | 15,321 |
#!/usr/bin/env python
"""
Launch a Docker image with Ubuntu and LXDE window manager, and
automatically open up the URL in the default web browser.
"""
# Author: Xiangmin Jiao <xmjiao@gmail.com>
from __future__ import print_function # Only Python 2.x
import sys
import subprocess
import time
APP = "docker"
def pa... | x11vnc/docker-desktop | docker_desktop.py | Python | apache-2.0 | 13,419 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import HttpResponseError
from azure.digitaltwins.core import DigitalTwinsClient
#... | Azure/azure-sdk-for-python | sdk/digitaltwins/azure-digitaltwins-core/samples/dt_models_lifecycle.py | Python | mit | 3,774 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-15 17:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('list', '0004_auto_20170614_1736'),
]
operations = [
migrations.AlterField(
... | jovanpacheco/todo-eureka | eureka/list/migrations/0005_auto_20170615_1312.py | Python | gpl-3.0 | 1,067 |
#!/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
# ... | turon/openthread | tests/scripts/thread-cert/Cert_5_5_03_SplitMergeChildren.py | Python | bsd-3-clause | 5,459 |
# Copyright 2018 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... | chemelnucfin/tensorflow | tensorflow/python/keras/optimizer_v2/optimizer_v2.py | Python | apache-2.0 | 42,844 |
# -*- coding: utf-8 -*-
import six
import threading
import json
import os
import time
import collections
import logging
from random import shuffle
from stf_utils.common.stfapi import SmartphoneTestingFarmAPI
from stf_utils.common import adb
log = logging.getLogger(__name__)
class Device:
serial = None
read... | 2gis/stf-utils | stf_utils/stf_connect/client.py | Python | mit | 14,093 |
#!/usr/bin/python
#
# Requires that djs writes the number of Z3 queries in out/num-queries.txt
import os, re, sys, time, math
benchdir = '/tests/djs/oopsla12'
djsdir = os.getenv('DJS_DIR')
latexfile = '/src/out/runningtime-sep2012.tex'
benchmarks = {
'prototypal': '',
'pseudoclassical': '',
'functional': '',
... | ravichugh/djs | scripts/gen-benchmark-time-sep2012.py | Python | bsd-3-clause | 1,989 |
def update_attributes(obj, dictionary, keys):
if not dictionary:
return
for key in keys:
if key not in dictionary:
continue
value = dictionary[key]
if getattr(obj, key) is not None and value is None:
continue
if type(value) is dict... | timbooo/traktforalfred | trakt/objects/core/helpers.py | Python | mit | 391 |
""" Dataframe optimizations """
from .io import dataframe_from_ctable
from ..optimize import cull, fuse_getitem, fuse_selections
from .. import core
def fuse_castra_index(dsk):
from castra import Castra
def merge(a, b):
return (Castra.load_index, b[1], b[2]) if a[2] == 'index' else a
return fuse_... | PhE/dask | dask/dataframe/optimize.py | Python | bsd-3-clause | 823 |
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing unit tests for build_failure_message."""
from __future__ import print_function
import sys
from chromite.li... | endlessm/chromium-browser | third_party/chromite/lib/build_failure_message_unittest.py | Python | bsd-3-clause | 6,764 |
from flow_difference import FlowDifference
from seasonal_decomposition import SeasonalDecomposition
from seasonal_decomposition_ensemble import SeasonalDecompositionEnsemble
from tukeys_filter import TukeysFilter
| trademob/anna-molly | lib/plugins/__init__.py | Python | mit | 213 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# CChatServer daemon
#
# Server for CChat.
# ----------------------------------------------------------------
# copyright (c) 2014 - Domen Ipavec
# ---------------------------------------------------------... | matematik7/CChatServer | daemon.py | Python | mit | 974 |
# -*- coding: latin-1 -*-
import re
import math
import urllib
from string import join
import traceback, sys
class JsUnwiser:
def unwiseAll(self, data):
try:
in_data=data
sPattern = 'eval\\(function\\(w,i,s,e\\).*?}\\((.*?)\\)'
wise_data=re.compile(sPattern).findall(in_... | siouka/dmind | plugin.video.tvpor/resources/lib/unwise.py | Python | gpl-2.0 | 2,506 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from azure.identity import DefaultAzureCredential
from azure.keyvault.certificates import AdministratorContact, CertificateClient
from azure.core.exceptions im... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-certificates/samples/issuers.py | Python | mit | 3,642 |
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distributed in the hope that ... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/facts/hardware/base.py | Python | bsd-3-clause | 1,746 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
'''
# This file is part of Matching Pursuit Python program (python-MP).
#
# python-MP 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 ... | tspus/python-matchingPursuit | data/signalGenerator.py | Python | gpl-3.0 | 6,621 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | GabrielBrascher/cloudstack | test/integration/component/test_vpn_service.py | Python | apache-2.0 | 8,653 |
"""
These test the method maybe_promote from core/dtypes/cast.py
"""
import datetime
import numpy as np
import pytest
from pandas._libs.tslibs import NaT
from pandas.core.dtypes.cast import maybe_promote
from pandas.core.dtypes.common import (
is_complex_dtype,
is_datetime64_dtype,
is_datetime_or_timede... | jreback/pandas | pandas/tests/dtypes/cast/test_promote.py | Python | bsd-3-clause | 23,511 |
from django.contrib import admin
from StackSmash.apps.blog.models import Post, Comment
class PostAdmin(admin.ModelAdmin):
list_display = ['title']
list_filter = ['listed', 'pub_date']
search_fields = ['title', 'content']
date_heirachy = 'pub_date'
save_on_top = True
prepopulated_fields = {"slu... | Justasic/StackSmash | StackSmash/apps/blog/admin.py | Python | bsd-2-clause | 509 |
#import shared
#import time
#from multiprocessing import Pool, cpu_count
import hashlib
from struct import unpack, pack
import sys
from debug import logger
from shared import config, frozen, codePath, shutdown, safeConfigGetBoolean, UISignalQueue
import openclpow
import tr
import os
import ctypes
bitmsglib = 'bitmsgha... | lightrabbit/PyBitmessage | src/proofofwork.py | Python | mit | 5,893 |
from django.contrib import admin
from scoring.models import Event, Score, EggDropScore, PreRegistration, DrillingMudScore, GravityCarScore, SkyscraperScore, PastaBridgeScore, ChemicalCarScore, WeightLiftingScore, IndoorCatapultsScore
from registration.models import Team
from django import forms
from django.contrib.admi... | hgrimberg01/esc | scoring/admin.py | Python | bsd-3-clause | 22,724 |
import functools
from rapt.rapt import Rapt
from rapt.transformers.sql import sql_translator
from rapt.treebrd.grammars import CoreGrammar
from rapt.treebrd.grammars.extended_grammar import ExtendedGrammar
from rapt.treebrd.treebrd import TreeBRD
from tests.transformers.test_transfomer import TestTransformer
class ... | pyrapt/rapt | tests/transformers/sql_translator/test_translation_sequence.py | Python | mit | 10,145 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import json
from lib import commons
from config import settings
CURRENT_USER_INFO = {'is_authenticated': False, 'current_user': None}
def init():
"""
初始化管理员信息
:return:
"""
dic = {'username': 'admin', 'password': commons.md5('123')}
json.... | smartczm/python-learn | Old-day01-10/s13-day5/get/day5/Atm/src/admin.py | Python | gpl-2.0 | 2,982 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
from urllib import urlopen
from lp.services.config import config
from lp.testing import TestCase
from lp.testing.keyserver import KeyServerTac
from lp.t... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/testing/keyserver/tests/test_harness.py | Python | agpl-3.0 | 970 |
#!/usr/bin/env python
# Copyright (c) 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.
# Disable the lint error for too-long lines for the URL below.
# pylint: disable=C0301
"""Fix Chrome App manifest.json files for u... | chromium/chromium | native_client_sdk/src/tools/fix_manifest.py | Python | bsd-3-clause | 3,626 |
from FeedItem import *
class MovieFeedItem(FeedItem):
type = 'movie'
| nativecode-dev/nas-scripts | rssarchiver/feeds/MovieFeedItem.py | Python | gpl-2.0 | 74 |
"""
Django settings for CL_Project project.
Generated by 'django-admin startproject' using Django 1.9.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | pmakahmann/CL_Project | CL_Project/settings.py | Python | mit | 3,282 |
"""Tests for acme.jws."""
import unittest
import josepy as jose
import test_util
KEY = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
class HeaderTest(unittest.TestCase):
"""Tests for acme.jws.Header."""
good_nonce = jose.encode_b64jose(b'foo')
wrong_nonce = u'F'
# Following just makes ... | letsencrypt/letsencrypt | acme/tests/jws_test.py | Python | apache-2.0 | 2,060 |
# Copyright (C) 2020, 2021, Hitachi, 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 ... | mahak/cinder | cinder/volume/drivers/hitachi/hbsd_rest_fc.py | Python | apache-2.0 | 12,268 |
COUNTRY_APP = 'nigeria'
OPTIONAL_APPS = ['pombola.spinner']
TWITTER_USERNAME = 'NGShineyoureye'
TWITTER_WIDGET_ID = '354909651910918144'
BLOG_RSS_FEED = 'http://eienigeria.org/rss.xml'
MAP_BOUNDING_BOX_NORTH = 14.1
MAP_BOUNDING_BOX_EAST = 14.7
MAP_BOUNDING_BOX_SOUTH = 4
MAP_BOUNDING_BOX_WEST = 2.5
MAPIT_COUNTRY = ... | patricmutwiri/pombola | pombola/settings/nigeria_base.py | Python | agpl-3.0 | 524 |
#Taken from https://wiki.python.org/moin/Distutils/Tutorial
from setuptools import setup
import ananke
setup(name='ananke',
version=ananke.__version__,
description='Ananke: Clustering of time-series marker gene data',
url='https://github.com/beiko-lab/ananke',
author='Michael Hall',
author_email='hallm2533... | beiko-lab/ananke | setup.py | Python | mit | 889 |
import rooms
import screen
import session
import utils
def render_battle_1():
session.monster_name = "Ugly Orc"
turn = "player"
player_defense = 0
monster_defense = 0
time_to_battle = session.monster_hp > 0 and session.player_hp > 0
while time_to_battle:
screen.clear_screen()
sc... | brunitto/dungeons-and-pythons | battles.py | Python | mit | 4,152 |
import unittest
from monty.multiprocessing import imap_tqdm
from math import sqrt
class FuncCase(unittest.TestCase):
def test_imap_tqdm(self):
results = imap_tqdm(4, sqrt, range(10000))
self.assertEqual(len(results), 10000)
self.assertEqual(results[0], 0)
self.assertEqual(results[... | davidwaroquiers/monty | tests/test_multiprocessing.py | Python | mit | 635 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio 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... | CERNDocumentServer/invenio | modules/miscutil/lib/recommender.py | Python | gpl-2.0 | 5,638 |
# -*- coding: utf-8 -*-
""" Tests used to check whether assigned actions really do what they're supposed to do. Events are
not supported by gc and scvmm providers. Tests are uncollected for these
providers. When the support will be implemented these tests can enabled for them.
Required YAML keys:
* Provider must h... | dajohnso/cfme_tests | cfme/tests/control/test_actions.py | Python | gpl-2.0 | 26,677 |
def adder():
sum = 0
def f(x):
nonlocal sum
sum = sum + x
return sum
return f
a = adder()
b = adder()
for i in range(10):
print(a(i), b(-2*i)) | nimblecode/nimblecode | server/library/prompts/py/13-closure.py | Python | mit | 184 |
"""TMY3 data set library: thin wrapper around TMY csv files.
Examples:
>>> sum([int(i['GHI (W/m^2)']) for i in data('724666')])/365./1000.
4.438213698630137
>>> round(total('724666', 'DNI (W/m^2)')/365.,2)
5.11
"""
import csv
# Copyright (C) 2015 Nathan Charles
#
# This program is free software. See ... | nrcharles/caelum | caelum/tmy3.py | Python | lgpl-3.0 | 3,808 |
import json
import os
import zipfile
from packaging.version import parse as parse_version
from devpi_server.log import threadlog
def extract_metadata_from_wheel_file(wheel_filename):
with zipfile.ZipFile(wheel_filename) as zf:
for meta in zf.namelist():
if meta.endswith('.dist-info/metadata.... | Polyconseil/devpi-metawheel | devpi_metawheel/main.py | Python | mit | 2,224 |
#!/usr/bin/env python
""" Converts a ADSBibTeX config file to a BibTeX file
Usage:
adsbibtex [<config_file>]
Options:
config config file location
"""
import docopt
import adsbibtex
def run():
arguments = docopt.docopt(__doc__)
config_path = arguments['<config_file>']
if config_path is None: ... | ryanvarley/adsbibtex | adsbibtex/bibcode_to_bibtex.py | Python | mit | 453 |
from src import tensorflow as tf
# Import MINST data
from src.tensorflow import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
# Parameters
learning_rate = 0.01
training_epochs = 25
batch_size = 100
display_step = 1
# tf Graph Input
x = tf.placeholder(tf.float32, [None, 784]) # mnist data im... | xinghalo/DMInAction | src/tensorflow/LR.py | Python | apache-2.0 | 2,054 |
#!/usr/bin/env python3
#
# Computer Networks
# Olin College
# Lab 1
# Alethea Butler <alethea@aletheabutler.com>
#
import time
import threading
import queue
class Transmitter:
def __init__(self, pin):
self.pin = pin
self.queue = queue.Queue()
self.running = True
self.worker = Tran... | alethea/telegraph | transmitter.py | Python | apache-2.0 | 1,164 |
from dilap.geometry.vec3 import vec3
from dilap.geometry.quat import quat
from dilap.geometry.tform import tform
import dilap.geometry.tools as dpr
import matplotlib.pyplot as plt
import unittest,numpy,math
import pdb
#python3 -m unittest discover -v ./ "*tests.py"
class test_tform(unittest.TestCase):
def s... | ctogle/dilapidator | test/geometry/tform_tests.py | Python | mit | 1,264 |
'''
Author: Peter Chip (furamail001@gmail.com)
Date: 2015 03 25
Given: Positive integers n≤100 and m≤20.
Return: The total number of pairs of rabbits that will remain after the n-th month if all rabbits live for m months.
Theory: The standard fibonacci series : 1 1 2 3 5 8 13
fn = fn-1 + fn-2
In re... | amidoimidazol/bio_info | Rosalind.info Problems/Mortal Fibonacci Rabbits.py | Python | mit | 1,178 |
import datetime
import pytz
from newebe.config import CONFIG
utc = pytz.utc
timezone = pytz.timezone(CONFIG.main.timezone)
DB_DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
URL_DATETIME_FORMAT = "%Y-%m-%d-%H-%M-%S"
DISPLAY_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
def get_date_from_db_date(date):
'''
Convert string da... | gelnior/newebe | newebe/lib/date_util.py | Python | agpl-3.0 | 1,862 |
import cntk
from cntk import Trainer
from cntk.learners import sgd
from cntk.ops import *
from cntk.io import *
from cntk.layers import *
from cntk.initializer import *
from cntk.device import *
import pylab
from sklearn.preprocessing import StandardScaler, MinMaxScaler
import pandas as pd
from CNTK import config_cntk... | BEugen/AI | CNTK/cntk-5.py | Python | gpl-3.0 | 4,428 |
"""
The :mod:`sklearn.covariance` module includes methods and algorithms to
robustly estimate the covariance of features given a set of points. The
precision matrix defined as the inverse of the covariance is also estimated.
Covariance estimation is closely related to the theory of Gaussian Graphical
Models.
"""
from ... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/sklearn/covariance/__init__.py | Python | mit | 1,157 |
# -*- coding: UTF-8 -*-
"""
Copyright (C) 2014 smokdpi
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.
... | koditraquinas/koditraquinas.repository | script.module.urlresolver/lib/urlresolver/plugins/uptobox.py | Python | gpl-2.0 | 3,745 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@package pyssw
@brief Python standalone program for ssw alignment using the C library
Complete-Striped-Smith-Waterman-Library
Biopython module is require for fastq/fastq parsing
@copyright [The MIT licence](http://opensource.org/licenses/MIT)
@author Adrien Leger ... | philres/nextgenmap-lr | lib/Complete-Striped-Smith-Waterman-Library/src/pyssw.py | Python | gpl-3.0 | 10,946 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehuman.org/
**Code Home Page:** http://code.google.com/p/makehuman/
**Authors:** Thomas Larsson
**Copyright(c):** MakeHuman Team 2001-2014
**Licensing:** AGPL3 (see also ht... | jemandez/creaturas-magicas | Configuraciones básicas/scripts/addons/blendertools-1.0.0/makeclothes/error.py | Python | gpl-3.0 | 1,999 |
import os
import re
from steps.abstractstep import *
from reporters.bufferedreporter import *
from util import *
#--------------------------------------------------------------------
class CheckUnversionedFilesStep( AbstractStep ):
def __init__( self, baseDir ):
AbstractStep.__init__( self, "Check Unversio... | webbers/dongle.net | bld/libs/builder/src/steps/checkunversionedfilesstep.py | Python | mit | 845 |
# -*- 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, Version 2.0 (the "Lice... | bbc/kamaelia | Sketches/DL/modules/DL_Util.py | Python | apache-2.0 | 1,725 |
from django.dispatch import Signal
user_email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_unsubscribed = Signal() # args: ['email', 'reference']
| fin/froide | froide/bounce/signals.py | Python | mit | 236 |
import os
import operator
import sys
import contextlib
import itertools
from distutils.errors import DistutilsError, DistutilsOptionError
from distutils import log
from unittest import TestLoader
from setuptools.extern import six
from setuptools.extern.six.moves import map, filter
from pkg_resources import (resource_... | wildchildyn/autism-website | yanni_env/lib/python3.6/site-packages/setuptools/command/test.py | Python | gpl-3.0 | 9,044 |
"""
The :mod:`numpy <scisalt.numpy>` module contains a few convenience functions mostly designed to make evaluating functions easier for plotting.
"""
__all__ = [
'frexp10',
'gaussian',
'linspaceborders',
'linspacestep',
'piecewise',
]
__all__.sort()
from .frexp10 import *
from .functions impo... | joelfrederico/SciSalt | scisalt/numpy/__init__.py | Python | mit | 424 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/IEC61970/Dynamics/ExcitationSystems/ExcAC5A.py | Python | mit | 4,559 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2017 Adrián López Tejedor <adrianlzt@gmail.com>
# Óscar García Amor <ogarcia@connectical.com>
#
# Distributed under terms of the GNU GPLv3 license.
class Vault(object):
"""
Class representing a Vault
"""
de... | Telefonica/vaultier-cli | vaultcli/vault.py | Python | gpl-3.0 | 754 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | mitya57/debian-buildbot | buildbot/process/metrics.py | Python | gpl-2.0 | 15,391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 C Sommer, C Straehle, U Koethe, FA Hamprecht. 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. Redistribu... | ilastik/ilastik-0.5 | ilastik/gui/iconMgr.py | Python | bsd-2-clause | 4,204 |
# interaction_iterator.py
#
# Copyright 2017 Daniel Mende <mail@c0decafe.de>
#
# 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 ab... | ernw/dizzy | dizzy/interaction_iterator.py | Python | bsd-3-clause | 7,669 |
import sys, os
from setuptools import setup, find_packages
import pyherd
long_description = open('README.md').read()
setup_args = dict(
name="pyherd",
version=pyherd.__version__,
description='Python herd parsing command-line tool',
long_description=long_description,
author="Alice Ferrazzi",
... | aliceinwire/pyherd | setup.py | Python | gpl-2.0 | 997 |
"""Legacy device tracker classes."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import hashlib
from types import ModuleType
from typing import Any, Callable, Sequence, final
import attr
import voluptuous as vol
from homeassistant import util
from homeassistant.components import ... | adrienbrault/home-assistant | homeassistant/components/device_tracker/legacy.py | Python | apache-2.0 | 27,122 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See a... | christianbrodbeck/nipype | doc/sphinxext/numpydoc.py | Python | bsd-3-clause | 4,168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.