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 distutils.core import setup
import os
setup(
name='ms3',
version = os.environ.get('RELEASE_VERSION', '99.0.0.dev0'),
author='Skoobe',
packages=['ms3'],
url='https://github.com/skoobe/ms3',
description='A fake s3 server for testing',
install_requires=[
"tornado == 2.4",
... | irccloud/ms3 | setup.py | Python | mit | 339 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 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... | prometheanfire/openstack-guest-agents-unix | commands/kms.py | Python | apache-2.0 | 1,790 |
import sqlite3
import os
from Crypto.Hash import SHA512
class Database():
def __init__(self, name):
self.name = name
if os.path.exists('config'):
with open('config', 'r') as tmp:
HASHED_DB_KEY = tmp.read()[:-1]
self.key = input('Password >> ')
h = SHA512.new(data = self.key.encode('utf8')).hexdi... | leVirve/AccountManager | Database.py | Python | gpl-2.0 | 1,881 |
import asyncio
import functools
import traceback
import typing
import unittest
from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError, HTTPRequest
from tornado.locks import Event
from tornado.log import gen_log, app_log
from tornado.simple_httpclient import SimpleAsyncHT... | lilydjwg/tornado | tornado/test/websocket_test.py | Python | apache-2.0 | 28,211 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
import os
#Functions for manipulating datetime objects
#CCYY-MM-DDThh:mm:ssZ
def parseDateClass(s):
year, month, day = s.split("-")
day, tail = day[:2], day[2:]
hour, minute, second = tail[1:].split(... | rebolinho/liveit.repository | script.video.F4mProxy/lib/f4mUtils/datefuncs.py | Python | gpl-2.0 | 2,355 |
#!/usr/bin/env python
import sys
import os
import re
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.phonon import Phonon
from time import sleep
import MainWindow
import logging
import random
logging.basicConfig(format='%(levelname)s:%(message)s',level=logging.DEBUG)
logging.debug("Started")
try:
_fro... | BAXTER001/VideoNurd | videonurd.py | Python | gpl-3.0 | 23,810 |
"""
Helpers for embarrassingly parallel code.
"""
# Author: Gael Varoquaux < gael dot varoquaux at normalesup dot org >
# Copyright: 2010, Gael Varoquaux
# License: BSD 3 clause
from __future__ import division
import os
import sys
from math import sqrt
import functools
import time
import threading
import itertools
fr... | karandesai-96/joblib | joblib/parallel.py | Python | bsd-3-clause | 32,867 |
#!/usr/bin/env python
# encoding: utf-8
# Hans-Martin von Gaudecker, 2012
"""
Run a Stata do-script in the directory specified by **ctx.bldnode**. The
first and only argument will be the name of the do-script (no extension),
which can be accessed inside the do-script by the local macro `1'. Useful
for keeping a log fi... | drobilla/pugl | waflib/extras/run_do_script.py | Python | isc | 4,989 |
# -*- coding: utf-8 -*-
import re
__author__ = 'ido'
RE_MAT = re.compile(u'(fuck|asshole|putin)',re.I)
def censoreFilter(tweet):
if re.search(RE_MAT, tweet.text.encode('utf8')):
return True
return False
| MicroWorldwide/tweeria | system/parser_modules/censore_filter.py | Python | mit | 229 |
from enum import IntEnum;
from struct import unpack_from;
try:
from OgreHardwareBuffer import OgreFakeHardwareBuffer
except ImportError as e:
directory = os.path.dirname(os.path.realpath(__file__));
print("Import error: " + str(e) + " manual compilation" );
srcfile="OgreHardwareBuffer.py"; exec(compile... | lamogui/ogre_blender_importer | OgreVertexBuffer.py | Python | mit | 18,766 |
#coding: utf-8
from google.appengine.api import images
from django import forms
from app.models.upload import UploadModel
class UploadForm(forms.ModelForm):
class Meta:
model = UploadModel
# resize max to 512 x 512
def clean_file(self):
img = self.cleaned_data['file']
retur... | pistatium/houkago_app | server_appengine/app/forms/uploadform.py | Python | apache-2.0 | 422 |
#coding:utf8
import httplib2
import urllib
from connutils import HTTP
import json
import re
import bs4
import MySQLdb
aa={"name":"wuhaifeng","age":11}
# in 可以判断map中是否包含某个key
print aa["wu"] | oaksharks/BBS | main/test.py | Python | gpl-3.0 | 211 |
from django.core.urlresolvers import reverse
from copy import copy
class Icon():
"""
Represents a Bootstrap icon (<i>) tag.
"""
def __init__(self, icon, *css):
self.icon = icon
self.css = css
def render(self, extra_css=[]):
html = '<i class="%s' % self.icon
if ... | alexhayes/django-toolkit | django_toolkit/font_awesome.py | Python | mit | 5,598 |
#! /usr/bin/env python
import os
import boto3
import yaml
from brome.core.utils import DbSessionContext
from brome.model.testinstance import Testinstance
from brome.model.testcrash import Testcrash
from brome.model.testresult import Testresult
HERE = os.path.abspath(os.path.dirname(__file__))
ROOT = os.path.join(HE... | brome-hq/brome | example/scripts/upload_video_to_s3_and_sync.py | Python | isc | 2,713 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-18 11:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
mig... | andela-engmkwalusimbi/Picha | api/migrations/0002_effectsmodel.py | Python | mit | 800 |
from collections.abc import Iterable
from functools import update_wrapper
import inspect
from pyknow import watchers
from pyknow.conditionalelement import ConditionalElement
class Rule(ConditionalElement):
"""
Base ``CE``, all ``CE`` are to derive from this class.
This class is used as a decorator, thus... | buguroo/pyknow | pyknow/rule.py | Python | lgpl-3.0 | 3,195 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Ramon de la Fuente <ramon@delafuente.nl>
#
# 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 ... | hostmaster/ansible-modules-extras | notification/slack.py | Python | gpl-3.0 | 5,612 |
# encoding=utf-8
## SOLVED 2013/12/23
## 4179871
# A perfect number is a number for which the sum of its proper divisors is
# exactly equal to the number. For example, the sum of the proper divisors of 28
# would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
# A number n is called deficient if ... | 6112/project-euler | problems/023.py | Python | mit | 2,388 |
"""
GeoRef
Python Offline Georeferencer
by Karim Bahgat, 2014
Unfinished alpha version
"""
from helpers import timetaker,messages
from downloader import *
from datamanager import *
# FOR ADVANCED INSPIRATION AND ALGORITHM,
# SEE: https://github.com/mapbox/carmen/tree/master/test
#INTERNAL USE ONLY
class Geocode... | karimbahgat/GeoRef | georef/(old)/main.py | Python | mit | 1,378 |
# Copyright (C) 2005, Giovanni Bajo
# Based on previous work under copyright (c) 2001, 2002 McMillan Enterprises, Inc.
#
# 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... | supercheetah/diceroller | pyinstaller/PyInstaller/hooks/hook-xml.etree.cElementTree.py | Python | artistic-2.0 | 934 |
import string
def is_pangram(s):
return set(string.ascii_lowercase).difference(set(s.lower())) == set()
| VladKha/CodeWars | 6 kyu/Detect Pangram/solve.py | Python | gpl-3.0 | 110 |
import sys, os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
packages = [
'scrapy_rabbitmq_link'
]
requires = [
'pika',
'Scrapy>=1.3'
]
setup(
name='scrapy-ra... | mbriliauskas/scrapy-rabbitmq-link | setup.py | Python | mit | 617 |
import bpy
def crear_slot():
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.uv_texture_add() # agregando slot de mapa uv (por defecto de nombre UVMap)
bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=True, use_subsurf_data=False, margin=0.001)
#bpy.ops.uv.unwrap(method='... | zebus3d/UvProjection | unwrap.py | Python | gpl-3.0 | 2,852 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# plotVMstat.py
#
# Copyright 2014 Carlos "casep" Sepulveda <casep@alumnos.inf.utfsm.cl>
#
# 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... | casep/Molido | isc/plotVMstat.py | Python | gpl-2.0 | 3,668 |
import itertools
from time import time
# This module contains helpers for test cases
def get(iterable, n):
"""get
Yields n items from iterable, then breaks
:param iterable: Iterable from which items should be yielded
:param n: Number of items to yield
"""
for i, x in enumerate(itertools.cycle... | benjaminbrent/YCSB-runner | tests/helpers.py | Python | apache-2.0 | 1,519 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Based on Adafruit_I2C.py created by Kevin Townsend.
#
# 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, inc... | jutako/raspi | thingspeak/kasvuboksi/I2C.py | Python | mit | 8,426 |
#encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
import zmq, sys, json
import token
import detoken
import datautils
def _translate_core(jsond):
sock = zmq.Context().socket(zmq.REQ)
sock.connect("tcp://127.0.0.1:5556")
sock.send(jsond)
return sock.recv()
def _translate(srctext):
return... | anoidgit/NMTServer | translate.py | Python | apache-2.0 | 667 |
import itchat, time, random
# 群发内容(随机选一条)
SINCERE_WISH = [u'祝中秋快乐',u'中秋快乐呀',u'中秋快乐哟',u'中秋节快乐呀~',u'中秋节快乐!',u'中秋国庆快乐!']
itchat.auto_login(True)
i=1
friendList = itchat.get_friends(update=True)[i:]
print('即将给',len(friendList),'个好友发送中秋祝福,祝福内容为以下随机挑一个:\n',SINCERE_WISH)
for friend in friendList:
# 祝福语中随机选一条
SEND_WISH=ran... | xiaoxiaoyao/MyApp | PythonApplication1/自己的小练习/Happy-Mid-Autumn-Festival.py | Python | unlicense | 1,045 |
# -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | stormi/tsunami | src/secondaires/route/commandes/__init__.py | Python | bsd-3-clause | 1,638 |
from accounts.models import UserProfile
def reset_eula(sender, instance, created, **kwargs):
'''
Resets all user's EULA agreement when it changes.
'''
if instance.url.lower() == '/eula/':
UserProfile.objects.update(eula=False)
| chop-dbhi/biorepo-portal | accounts/handlers.py | Python | bsd-2-clause | 253 |
"""create applications tables
Revision ID: b74ca08cfd9a
Revises: 2f1507bf6dc1
Create Date: 2017-10-19 21:26:19.927682
"""
from alembic import op
import sqlalchemy as sa
import commandment.dbtypes
from alembic import context
# revision identifiers, used by Alembic.
revision = 'b74ca08cfd9a'
down_revision = '2f1507bf... | jessepeterson/commandment | commandment/alembic/versions/b74ca08cfd9a_create_applications_tables.py | Python | mit | 3,212 |
import logging
from django.http import HttpResponse
from django.conf import settings
from django.utils.functional import SimpleLazyObject
from django.contrib.auth import load_backend
from django.contrib.auth.models import AnonymousUser
from django.utils.crypto import constant_time_compare
from authclient import (
... | PyPila/auth-client | authclient/middleware.py | Python | gpl-3.0 | 2,635 |
'''
python-lambda-local: Main module
Copyright 2015-2020 HENNGE K.K. (formerly known as HDE, Inc.)
Licensed under MIT.
'''
from __future__ import print_function
import argparse
import pkg_resources
from .main import run
__version__ = pkg_resources.require("python-lambda-local")[0].version
def main():
args = p... | HDE/python-lambda-local | lambda_local/__init__.py | Python | mit | 2,094 |
# Copyright 2019 Google 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 by applicable law or a... | google-research/federated | utils/optimizers/lars_test.py | Python | apache-2.0 | 5,729 |
import os.path
import os
import random
def rename(src, dst):
"Atomic rename on windows."
# This is taken from mercurial
try:
os.rename(src, dst)
except OSError, err:
# If dst exists, rename will fail on windows, and we cannot
# unlink an opened file. Instead, the destination is ... | abadger/Bento | bento/compat/rename.py | Python | bsd-3-clause | 1,100 |
from __future__ import print_function
from base import TestBase
from mock import sentinel, patch, MagicMock
from threading import Lock
from virtwho.datastore import Datastore
class TestDatastore(TestBase):
def setUp(self):
copy_patcher = patch('virtwho.datastore.copy')
self.mock_copy = copy_patch... | candlepin/virt-who | tests/test_datastore.py | Python | gpl-2.0 | 6,363 |
# Test program for ultra sonic sensor HC-SR04
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
TRIG = 23
ECHO = 24
GPIO.setup(TRIG, GPIO.OUT)
GPIO.setup(ECHO, GPIO.IN)
#test made on raspberry
def distMeas():
# ensure that the Trigger pin is set low
# and gives the sensor ti... | hanshenrikjeppesen/ITEK_01_network | hcsr04.py | Python | gpl-3.0 | 1,115 |
# -------------------------------------------------------------
#
# 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 unde... | apache/incubator-systemml | src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py | Python | apache-2.0 | 1,723 |
"""
This module provides some useful functions for working with
scrapy.http.Request objects
"""
import hashlib
import weakref
from urllib.parse import urlunparse
from w3lib.http import basic_auth_header
from w3lib.url import canonicalize_url
from scrapy.utils.httpobj import urlparse_cached
from scrapy.utils.python i... | dangra/scrapy | scrapy/utils/request.py | Python | bsd-3-clause | 3,751 |
# -*- coding: utf-8 -*-
from nfe.pysped.xml_sped import *
from nfe.pysped.nfe.manual_401 import ESQUEMA_ATUAL
import os
DIRNAME = os.path.dirname(__file__)
CONDICAO_USO = u'A Carta de Correcao e disciplinada pelo paragrafo 1o-A do art. 7o do Convenio S/N, de 15 de dezembro de 1970 e pode ser utilizada para regulari... | annacarol/Recursos-NFE-em-Python | nfe/pysped/nfe/manual_401/carta_correcao.py | Python | lgpl-2.1 | 13,699 |
import numpy as np
from collections import defaultdict
import statsmodels.base.model as base
from statsmodels.genmod import families
from statsmodels.genmod.generalized_linear_model import GLM
from statsmodels.genmod.families import links
from statsmodels.genmod.families import varfuncs
import statsmodels.regression.li... | statsmodels/statsmodels | statsmodels/genmod/qif.py | Python | bsd-3-clause | 16,374 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | mdsitton/fofix | fofix/core/Config.py | Python | gpl-2.0 | 10,871 |
def capitalizar(nombre):
capitalizarActual = True
listaNombre = list(nombre)
for indice,letra in enumerate(listaNombre):
if (capitalizarActual and listaNombre[indice] != " "):
listaNombre[indice] = listaNombre[indice].upper()
capitalizarActual = False
if (listaNombre[... | clinoge/primer-semestre-udone | src/06-funciones/funciones.py | Python | mit | 548 |
"""Test nbformat.validator"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from .base import TestsBase
from jsonschema import ValidationError
from IPython.nbformat import read
from ..validator import isvalid, validate
class TestValidator(TestsBase):... | mattvonrocketstein/smash | smashlib/ipy3x/nbformat/tests/test_validator.py | Python | mit | 1,914 |
"""Module to access all emailing campagins."""
import datetime
from typing import Any, Dict
from urllib import parse
from bob_emploi.frontend.api import job_pb2
from bob_emploi.frontend.api import project_pb2
from bob_emploi.frontend.api import user_pb2
from bob_emploi.frontend.server import auth
from bob_emploi.fron... | bayesimpact/bob-emploi | frontend/server/mail/all_campaigns.py | Python | gpl-3.0 | 25,058 |
# 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 re
import time
from .config import Config, config_lock
CLOCK_REGEX = re.compile(
r"^The current time is (?P<... | nstockton/tintin-mume | mapperproxy/mapper/clock.py | Python | gpl-2.0 | 10,730 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
"""assign/unassign to ToDo"""
import webnotes
@webnotes.whitelist()
def get(args=None):
"""get assigned to"""
if not args:
args = webnotes.local.form_dict
return webnot... | XWARIOSWX/wnframework | webnotes/widgets/form/assign_to.py | Python | mit | 4,459 |
def pytest_generate_tests(metafunc):
for scenario in metafunc.cls.scenarios:
metafunc.addcall(id=scenario[0], funcargs=scenario[1])
scenario1 = ('basic', {'attribute': 'value'})
scenario2 = ('advanced', {'attribute': 'value2'})
class Foo(object):
pass
class TestSampleWithScenarios(Foo):
scenari... | MateuszG/django_auth | examples/test_scenario_generators_5.py | Python | mit | 427 |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2015 Dustin Schoenbrun. All rights reserved.
# 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 Licens... | tlakshman26/cinder-https-changes | cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_7mode.py | Python | apache-2.0 | 28,538 |
# -*- coding: utf-8 -*-
u"""
:copyright: Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
def gen_private_key():
"""Generate 32 byte random private key"""
import base64
im... | radiasoft/sirepo | sirepo/pkcli/auth.py | Python | apache-2.0 | 434 |
# -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub 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 Softwar... | azumimuo/family-xbmc-addon | plugin.video.dragon.sports/lib/utils/github/GitCommit.py | Python | gpl-2.0 | 4,236 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Freshermeat - An open source software directory and release tracker.
# Copyright (C) 2017-2020 Cédric Bonhomme - https://www.cedricbonhomme.org
#
# For more information: https://sr.ht/~cedric/freshermeat
#
# This program is free software: you can redistribute it and/or ... | cedricbonhomme/services | freshermeat/web/views/api/v1/language.py | Python | agpl-3.0 | 1,163 |
from .mixins import *
from .flexi import *
class FlexiBulkModel(FlexiModel,EasyBulkModel,StockModelHelpers):
class Meta:
abstract = True
| ajparsons/useful_inkleby | useful_inkleby/useful_django/models/__init__.py | Python | mit | 162 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example for MRS inversion"""
from .mrs import MRS # change to pygimli.physics.mrs
if __name__ == "__main__":
datafile = 'example.mrsi' # MRSmatlab inversion (data+kernel) file
mrs = MRS(datafile) # initialize and read file
print(mrs) # displa... | KristoferHellman/gimli | python/pygimli/physics/sNMR/example.py | Python | gpl-3.0 | 552 |
# This file is a part of zone_normalize: A package to parse, normalize
# and show DNS zone data
#
# Copyright (C) 2016 Max R.D. Parmer
#
# 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, ei... | maxrp/zone_normalize | zone_normalize/__main__.py | Python | agpl-3.0 | 3,259 |
"""Tests for the auth models."""
from homeassistant.auth import models, permissions
def test_owner_fetching_owner_permissions():
"""Test we fetch the owner permissions for an owner user."""
group = models.Group(name="Test Group", policy={})
owner = models.User(
name="Test User",
perm_looku... | PetePriority/home-assistant | tests/auth/test_models.py | Python | apache-2.0 | 1,277 |
from django.contrib.sites.models import Site
def current_site(request):
try:
current_site = Site.objects.get_current()
except Site.DoesNotExist:
current_site = ''
return {'current_site': current_site}
| bhrutledge/debugged-django | debugged/core/context_processors.py | Python | mit | 231 |
"""Store the answers to the problems at https://projecteuler.net."""
PROBLEM_ANSWERS = {'problem_1': 233168,
'problem_2': 4613732,
'problem_3': 6857,
'problem_4': 906609,
'problem_5': 232792560,
'problem_6': 25164150,
... | heathy/ProjectEuler | projecteuler/tests/answers.py | Python | mit | 1,969 |
import contextlib
import numpy as np
import os
import shutil
import tempfile
import unittest
# <Path to>/ABRAID-MP/python must be in your PYTHONPATH.
from src import machine_weighting_predictor as mwp
DFE = 'distanceFromExtent'
ES = 'environmentalSuitability'
FEED = 'feedId'
EW = 'expertWeighting'
PICKLES_SUBFOLDER_... | SEEG-Oxford/ABRAID-MP | python/test/mwp_unit_tests.py | Python | apache-2.0 | 6,619 |
""" This agent syncs CS and pilot files to a web server of your choice
.. literalinclude:: ../ConfigTemplate.cfg
:start-after: ##BEGIN PilotSyncAgent
:end-before: ##END
:dedent: 2
:caption: PilotsSyncAgent options
"""
import os
import json
import shutil
import hashlib
import requests
from DIRAC import S_OK
f... | DIRACGrid/DIRAC | src/DIRAC/WorkloadManagementSystem/Agent/PilotSyncAgent.py | Python | gpl-3.0 | 4,751 |
import os
import string
import random
from fabric.api import env
from fabric.colors import green
from literals import (DEFAULT_INSTALL_PATH, DEFAULT_VIRTUALENV_NAME,
DEFAULT_REPOSITORY_NAME, DEFAULT_OS, OS_CHOICES,
DEFAULT_DATABASE_MANAGER, DB_CHOICES, DEFAULT_DATABASE_NAME,
DEFAULT_WEBSERVER, WEB_CHOIC... | appsembler/mayan_appsembler | fabfile/conf.py | Python | gpl-3.0 | 2,675 |
#!/usr/bin/python
import os
import sys
import time
import termios
import fcntl
from Adafruit_PWM_Servo_Driver import PWM
# Terminal init stuff found on stackoverflow (SlashV)
fd = sys.stdin.fileno()
oldterm = termios.tcgetattr(fd)
newattr = termios.tcgetattr(fd)
newattr[3] = newattr[3] & ~termios.ICANON & ~termios.ECH... | locked/4stability | servo_manual.py | Python | bsd-3-clause | 1,011 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : TopoViewer plugin for DB Manager
Description : Create a project to display topology schema on QGis
Date : Sep 23, 2011
copyright : (C) 2011 by Giuseppe Suc... | kiith-sa/QGIS | python/plugins/db_manager/db_plugins/postgis/plugins/qgis_topoview/__init__.py | Python | gpl-2.0 | 12,788 |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | google/makani | avionics/motor/monitors/motor_si7021.py | Python | apache-2.0 | 1,283 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/tests/unit/network/v2/test_qos_minimum_bandwidth_rule.py | Python | apache-2.0 | 1,806 |
# L1 reg
with tf.name_scope('train'):
train_step = tf.train.FtrlOptimizer(learning_rate=0.001,l1_regularization_strength=0.3).minimize(error)
init = tf.global_variables_initializer()
| nishgaba-ai/Machine-Learning | Regularization/L1-Reg.py | Python | gpl-3.0 | 192 |
import check_var_pygrib_vs_uvcdat
import cmp_pygrib_uvcdat_vars
import generate_idx_ctl_files
import make_all_ctl_files_list
| arulalant/mmDiagnosis | diagnosis1/extra/gribfiles/__init__.py | Python | gpl-3.0 | 125 |
#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | naparuba/shinken | test/test_bad_notification_period.py | Python | agpl-3.0 | 1,255 |
# Stubs
class ABCMeta:
pass
def abstractmethod(foo):
pass
def abstractproperty(foo):
pass | asedunov/intellij-community | python/testData/MockSdk2.7/Lib/abc.py | Python | apache-2.0 | 106 |
import logging
import urllib
from django.http import JsonResponse
from oidc_provider.lib.errors import *
from oidc_provider.lib.utils.params import *
from oidc_provider.lib.utils.token import *
from oidc_provider.models import *
from oidc_provider import settings
logger = logging.getLogger(__name__)
class TokenEndp... | django-py/django-openid-provider | oidc_provider/lib/endpoints/token.py | Python | mit | 3,645 |
from sklearn import svm
import matplotlib.pyplot as plt
import json
import numpy as np
training_length = 0.60
with open("../Output-files/features.json", "r") as features_file:
data = json.load( features_file )
X = []
Y = []
index_feat = data["Index Features"]
features_key = [
"Moving Average", ... | Chinmoy07/ML-Term-Project-Team-Pikachu | Python-PHP-Codes/svm_classifier.py | Python | mit | 1,555 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from network import NeuralNetwork
from deepy.utils import FLOATX, EPSILON, CrossEntropyCost
import theano.tensor as T
class NeuralClassifier(NeuralNetwork):
"""
Classifier network.
"""
def __init__(self, input_dim, config=None, input_tensor=None):
... | ZhangAustin/deepy | deepy/networks/classifier.py | Python | mit | 2,107 |
import copy
from corehq.pillows.case import CasePillow
from corehq.pillows.mappings.reportcase_mapping import REPORT_CASE_MAPPING, REPORT_CASE_INDEX
from django.conf import settings
from .base import convert_property_dict
class ReportCasePillow(CasePillow):
"""
Simple/Common Case properties Indexer
an ext... | gmimano/commcaretest | corehq/pillows/reportcase.py | Python | bsd-3-clause | 1,006 |
# Copyright (c) 2015 Institute of the Czech National Corpus
# Copyright (c) 2015 Martin Stepan <martin.stepan@ff.cuni.cz>,
# Tomas Machalek <tomas.machalek@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 pub... | tomachalek/kontext | lib/plugins/ucnk_subcmixer/metadata_model.py | Python | gpl-2.0 | 7,554 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | smiller171/ansible | lib/ansible/inventory/__init__.py | Python | gpl-3.0 | 28,458 |
from django.conf.urls.defaults import *
urlpatterns = patterns('transaction.views',
(r'^create/(?P<pid>.*)$', 'create'),
(r'^edit/(?P<tid>.*)$', 'edit'),
)
| rimbalinux/LMD3 | transaction/urls.py | Python | bsd-3-clause | 171 |
# -*- coding: utf-8 -*-
class BedFormattingError(Exception):
pass
| robinandeer/chanjo | chanjo/exc.py | Python | mit | 72 |
"""SCons.Job
This module defines the Serial and Parallel classes that execute tasks to
complete a build. The Jobs class provides a higher level interface to start,
stop, and wait on jobs.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby gr... | xifle/greensc | tools/scons/scons-local-2.0.1/SCons/Job.py | Python | gpl-3.0 | 16,113 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 1 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from calibre.gui2.store.basic_co... | jelly/calibre | src/calibre/gui2/store/stores/pragmatic_bookshelf_plugin.py | Python | gpl-3.0 | 942 |
"""
WSGI config for users project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
import site
# Add the site-packages of the chosen virtualenv to work with
sit... | rememerme/games-api | config/wsgi.py | Python | apache-2.0 | 982 |
"""jwzthreading.py
Contains an implementation of an algorithm for threading mail
messages, as described at http://www.jwz.org/doc/threading.html.
To use:
Create a bunch of Message instances, one per message to be threaded,
filling in the .subject, .message_id, and .references attributes.
You can use the .messa... | txsl/mail-trends | jwzthreading.py | Python | apache-2.0 | 10,294 |
from matplotlib.colors import ListedColormap
from numpy import nan, inf
# Used to reconstruct the colormap in pycam02ucs.cm.viscm
parameters = {'xp': [-0.039688657870597055, -1.9058661328602291],
'yp': [-0.11498367904144047, -0.3865272391038701],
'min_Jp': 0.0267022696929,
'm... | kthyng/cmocean | cmocean/rgb/gray.py | Python | mit | 17,393 |
# Copyright 2018 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | ros2/system_tests | test_cli_remapping/test/test_cli_remapping.py | Python | apache-2.0 | 6,164 |
# -*- python -*-
# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
#
# 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) an... | CirrusComputing/EnterpriseLibre | c4/storage/Email_Create/template/etc/mailman/mm_cfg.py | Python | gpl-3.0 | 4,408 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import web
import urllib2,urllib
web.config.debug = False
from post import postSite
from post import publish58
from post import publishAnjuke
from post import publishAnjuke1
from log.dubug import *
urls = (
'/check_account', 'check_account',
'/post_data', 'p... | ptphp/PyLib | src/webpy1/src/code.py | Python | apache-2.0 | 1,875 |
# Generated by Django 2.2.20 on 2021-12-03 13:52
from django.conf import settings
import django.core.files.storage
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | City-of-Helsinki/kerrokantasi | democracy/migrations/0055_add_deletion_details.py | Python | mit | 9,105 |
"""
flask_generic_views._compat
===========================
Some py2/py3 compatibility support based on a stripped down version of six
so we don't have to depend on a specific version of it.
:copyright: (c) 2015 Daniel Knell
:license: BSD, see LICENSE for more information.
"""
import sys
PY3... | artisanofcode/flask-generic-views | flask_generic_views/_compat.py | Python | mit | 780 |
from ..thing import Thing
from ..children import ChildGenerator
from ..person import ClothingSet, Person
# medieval people
class MedievalClothingSet(ClothingSet):
child_generators = [
ChildGenerator("medieval hat", probability=30),
ChildGenerator("medieval pants", probability=98),
ChildGe... | d2emon/generator-pack | src/genesys/generator/_unknown/nested/medieval/person.py | Python | gpl-3.0 | 4,150 |
__author__ = 'thor'
import itertools
from collections import OrderedDict
import numpy as np
import pandas as pd
from numpy import array
from matplotlib.colors import rgb2hex
from matplotlib import cm
from bokeh.plotting import figure, output_file
from bokeh.models import HoverTool, ColumnDataSource
from scipy.c... | thorwhalen/ut | pplot/ubokeh.py | Python | mit | 7,098 |
#!/usr/bin/env python
class Manager(object):
def __init__(self, machine):
self._machine = machine
def get_updates(self):
raise NotImplementedError
def count_updates(self):
raise NotImplementedError
def update_machine(self):
raise NotImplementedError
def downloa... | lightcode/nuagectl | nuagectl/updatemanagers/manager.py | Python | mit | 631 |
#!/usr/bin/env python
# Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project
# All rights reserved.
#
# This file is part of NeuroM <https://github.com/BlueBrain/NeuroM>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... | wizmer/NeuroM | examples/nl_fst_compat.py | Python | bsd-3-clause | 3,025 |
from conans.model import Generator
from conans.paths import BUILD_INFO_QBS
class DepsCppQbs(object):
def __init__(self, cpp_info):
delimiter = ",\n "
self.include_paths = delimiter.join('"%s"' % p.replace("\\", "/")
for p in cpp_info.inclu... | birsoyo/conan | conans/client/generators/qbs.py | Python | mit | 2,877 |
from __future__ import unicode_literals
import swapper
from accelerator_abstract.models import BaseOrganization
class Organization(BaseOrganization):
class Meta(BaseOrganization.Meta):
swappable = swapper.swappable_setting(BaseOrganization.Meta.app_label,
'O... | masschallenge/django-accelerator | accelerator/models/organization.py | Python | mit | 334 |
from __future__ import absolute_import
from changes.buildsteps.default import DefaultBuildStep
class LXCBuildStep(DefaultBuildStep):
"""
Similar to the default build step, except that it runs the client using
the LXC adapter.
"""
def can_snapshot(self):
return True
def get_label(self... | dropbox/changes | changes/buildsteps/lxc.py | Python | apache-2.0 | 828 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/frontend_ip_configuration.py | Python | mit | 4,557 |
import random
from pico2d import *
class FixedBackground:
def __init__(self):
self.image = load_image('KPU_GROUND.png')
self.speed = 0
self.canvas_width = get_canvas_width()
self.canvas_height = get_canvas_height()
self.w = self.image.w
self.h = self.image.h
... | whehdduq/2D_TermProject | Homework/2DGP/background.py | Python | gpl-3.0 | 3,549 |
from django.template import Library
register = Library()
def filer_actions(context):
"""
Track the number of times the action field has been rendered on the page,
so we know which value to use.
"""
context['action_index'] = context.get('action_index', -1) + 1
return context
filer_actions = reg... | croepha/django-filer | filer/templatetags/filer_admin_tags.py | Python | mit | 403 |
#-----------------------------------------------------------------------------
# Copyright (c) 2015-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | etherkit/OpenBeacon2 | client/win/venv/Lib/site-packages/PyInstaller/loader/rthooks/pyi_rth_gio.py | Python | gpl-3.0 | 504 |
LOGIN_URL = '/user/login'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
AUTHENTICATION_BACKENDS = [
'user.backend.AuthenticationBackend',
'user.backend.EmailBackend',
]
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
... | ava-project/ava-website | website/core/settings/common/auth.py | Python | mit | 608 |
#!/usr/bin/env python
# @author Stefano Borini
from distutils.core import setup
setup(name='Chestnut',
version='2.2.1',
author="Stefano Borini",
author_email="moc.liamg@tuntsehc+inirob.onafets",
url="http://chestnut.sourceforge.net",
maintainer="Stefano Borini",
maintainer_email="... | stefanoborini/chestnut | setup.py | Python | lgpl-3.0 | 570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.