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 |
|---|---|---|---|---|---|
"""
Views file for the Darklang Django App
"""
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.utils.translation import LANGUAGE_SESSION_KEY
from django.utils.translation import ugettext as _
from django.views.generic.base import View
from edxma... | naresh21/synergetics-edx-platform | openedx/core/djangoapps/dark_lang/views.py | Python | agpl-3.0 | 6,246 |
import json
from mock import patch
from django.test import TestCase
class ViewsPreambleTests(TestCase):
def test_invalid_json(self):
"""Only accepts valid JSON"""
response = self.client.put(
'/preamble/id_here', content_type='application/json',
data='{Invalid}')
se... | cmc333333/regulations-core | regcore_write/tests/views_preamble_tests.py | Python | cc0-1.0 | 940 |
"""
Lightweight schema migrations.
NOTE: Currently tested with SQLite and Postgresql. MySQL may be missing some
features.
Example Usage
-------------
Instantiate a migrator:
# Postgres example:
my_db = PostgresqlDatabase(...)
migrator = PostgresqlMigrator(my_db)
# SQLite example:
my_db = Sqlite... | Dipsomaniac/peewee | playhouse/migrate.py | Python | mit | 20,132 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from bottle import request, abort
def make_view(robot):
"""
为一个 BaseRoBot 生成 Flask view。
Usage ::
from werobot import WeRoBot
robot = WeRoBot(token='token')
@robot.handler
def hello(message):
r... | weberwang/WeRoBot | werobot/contrib/bottle.py | Python | mit | 1,353 |
# coding: utf-8
# Back to the main [Index](../index.ipynb)
# ### SED-ML L1V2 specification example
# Repressilator example which demonstrates the use of phrasedml with URN examples.
#
# The examples are the reference examples from the SED-ML specification document available from http://sed-ml.sourceforge.net/docum... | kirichoi/tellurium | examples/notebooks-py/phrasedmlExample.py | Python | apache-2.0 | 13,778 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('utils', '0011_auto_20150922_0857'),
]
operations = [
migrations.CreateModel(
name='Aggre... | Upande/MaMaSe | apps/utils/migrations/0012_aggregatedailyfeed_aggregatemonthlyfeed.py | Python | apache-2.0 | 1,349 |
#!/usr/bin/env python
import sys
import glob
import os
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# batch_rename.py
# Rename a huge amount of files in a given folder with a given file ending.
# Author: Fabian Schneider
# eMail: fabian(at)fabianschneider.org
# GitHub: fschneider1509.... | fschneider1509/python_batch_rename | batch_rename.py | Python | gpl-2.0 | 3,214 |
from django.shortcuts import render_to_response
from testdb import models
from testdb import builds
class ProductView(object):
def __init__(self, product):
"""Contruct a product view. """
self.product = product
def id(self):
""" Return the name of the product. """
return str(se... | testbed/testbed | testbed/db/branch/views/index.py | Python | gpl-3.0 | 1,339 |
import mne
from mne.minimum_norm import read_inverse_operator, compute_source_psd_epochs
import sys
import cPickle as pickle
from my_settings import (mne_folder, conditions, source_folder, epochs_folder)
subject = sys.argv[1]
labels = mne.read_labels_from_annot(
subject=subject, parc="PALS_B12_Brodmann", regexp=... | MadsJensen/RP_scripts | psd_source_epo.py | Python | bsd-3-clause | 1,507 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from QStyleOptionDockWidget import QStyleOptionDockWidget
class QStyleOptionDockWidgetV2(QStyleOptionDockWidget):
"""
QStyleOptionDockWi... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyQt4/QtGui/__init__/QStyleOptionDockWidgetV2.py | Python | gpl-2.0 | 686 |
from Meter import *
from PostProvider import *
class PopularityMeter(Meter):
"""Class to calculate the popularity"""
def __init__(self, tvShow, initialDate, finalDate, decision):
self._initialDate = initialDate
self._finalDate = finalDate
self._decision = decision
super(Populari... | mincem/ing2-grupo9 | tp1/src/PopularityMeter.py | Python | gpl-3.0 | 952 |
import subprocess
import os
from SimpleCV import *
import picamera
import config
def diff_img():
if(os.path.exists('prev.jpg') & os.path.exists('current.jpg')):
img_before = Image("prev.jpg")
img_after = Image("current.jpg")
diff = img_after - img_before
return diff
else:
... | lizhuoli1126/EyeLink | RaspberryPi/simpleCV.py | Python | bsd-2-clause | 559 |
"""
Group of cpuid tests for X86 CPU
"""
import re
import sys
import os
import string
from autotest.client.shared import error, utils
from autotest.client.shared import test as test_module
from virttest import utils_misc, env_process, virt_vm
import logging
logger = logging.getLogger(__name__)
dbg = logger.debug
info ... | spiceqa/virt-test | qemu/tests/cpuid.py | Python | gpl-2.0 | 22,383 |
# -*- coding: utf-8 -*-
"""weblinkchecker test module."""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
import datetime
from pywikibot.tools import PY2
if not PY2:
from urllib.parse import urlparse... | icyflame/batman | tests/weblinkchecker_tests.py | Python | mit | 2,506 |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Test suite for variable assigns.
#
# AUTHOR Michal Bukovsky <michal.bukovsky@trilogic.cz>
#
import pytest, re
from functools import wraps
from callgraph.builder import CallGraphBuilder
from tests.helpers import dfs_node_names
def test_generators_... | burlog/py-callgraph | tests/generators.py | Python | mit | 7,317 |
# (c) 2016 Red Hat Inc.
#
# 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 dis... | Tatsh-ansible/ansible | test/units/modules/network/nxos/test_nxos_bgp.py | Python | gpl-3.0 | 3,956 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1204280002.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1204280002 | MODEL1204280002/model.py | Python | cc0-1.0 | 427 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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... | googleads/google-ads-python | google/ads/googleads/v10/services/services/customer_label_service/client.py | Python | apache-2.0 | 21,110 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Include URLs from converse/urls.py
url(r'^', include('discuss.converse.urls')),
# Enable the built-in django admin page
url(r'^admin/', include(admin.site.urls)),
)
| siggame/discuss | discuss/discuss/urls.py | Python | bsd-3-clause | 297 |
import urllib
from django.conf import settings
import urllib2
from corehq.apps.sms.mixin import SMSBackend
from dimagi.ext.couchdbkit import *
from corehq.apps.mach.forms import MachBackendForm
MACH_URL = "http://smsgw.a2p.mme.syniverse.com/sms.php"
class MachBackend(SMSBackend):
account_id = StringProperty()
... | puttarajubr/commcare-hq | corehq/apps/mach/api.py | Python | bsd-3-clause | 1,569 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
from __future__ import print_function
from builtins import str
import os
import re
import tempfile
import shutil
from sibispy import sibislogger as slog
from sibispy impo... | sibis-platform/ncanda-data-integration | scripts/redcap/import_mr_sessions_stroop.py | Python | bsd-3-clause | 5,597 |
from formalizr.tests.forms import SimpleForm, SimpleModelForm
from formalizr.tests.models import SimpleModel
from formalizr.views import AjaxFormView, AjaxCreateView, AjaxUpdateView
class SimpleFormView(AjaxFormView):
form_class = SimpleForm
template_name = 'base.html'
success_url = "/"
class SimpleCrea... | krasnoperov/django-formalizr | formalizr/tests/views.py | Python | bsd-3-clause | 882 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | houshengbo/nova_vmware_compute_driver | nova/cells/rpcapi.py | Python | apache-2.0 | 5,843 |
# template tags package
| buchuki/programming_lab | programming_lab/chat/templatetags/__init__.py | Python | gpl-3.0 | 24 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... | rbramwell/pulp | bindings/pulp/bindings/content.py | Python | gpl-2.0 | 4,630 |
from flask_assets import Bundle
less = Bundle(
'bootstrap-less/bootstrap.less',
'less/style.less',
depends='bootstrap-less/*',
filters='less',
output='dist/style.css'
)
css = Bundle(
less,
filters='cssmin',
output='dist/style.min.css'
)
js = Bundle(
'js/jquery-3.2.1.min.js',
... | g4b1nagy/flask-boilerplate | app/assets.py | Python | unlicense | 418 |
#Plots the pmfs of binomial distributions with varying probability of success parameter
import superimport
from scipy.stats import binom
import numpy as np
import matplotlib.pyplot as plt
import pyprobml_utils as pml
N = 10
thetas = [.25, .5, .75, .9]
X = np.arange(0, N + 1)
for th in thetas:
probs = binom... | probml/pyprobml | scripts/binom_dist_plot.py | Python | mit | 606 |
from __future__ import print_function
import os
import sys
import subprocess
import pkg_resources
try:
import pkg_resources
_has_pkg_resources = True
except:
_has_pkg_resources = False
try:
import svn.local
_has_svn_local = True
except:
_has_svn_local = False
def test_helper():
return... | MetaPlot/MetaPlot | metaplot/helpers.py | Python | mit | 4,900 |
'''
===============================
XMODEM file transfer protocol
===============================
.. $Id$
This is a literal implementation of XMODEM.TXT_, XMODEM1K.TXT_ and
XMODMCRC.TXT_, support for YMODEM and ZMODEM is pending. YMODEM should
be fairly easy to implement as it is a hack on top of the XMODEM
protocol... | hathach/tinyusb | hw/mcu/sony/cxd56/tools/xmodem.py | Python | mit | 20,422 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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 requi... | sasha-gitg/python-aiplatform | schema/predict/prediction/scripts/fixup_prediction_v1beta1_keywords.py | Python | apache-2.0 | 5,910 |
from config import config
if config.IMPORT_PYSAM_PRIMER3:
import pysam
# VCF query
def vcf_query(chrom=None, pos=None, ref=None, alt=None, variant_str=None, individual=None, verbose=False, limit=100, release='mainset_July2016'):
if variant_str:
variant_str=str(variant_str).strip().replace('_','-')
... | logust79/phenopolis | vcf/__init__.py | Python | mit | 12,599 |
#!/usr/bin/env python
#--------------------------------------------------------------------------
#
# list2_pid.py
# Rick Kauffman a.k.a. Chewie
#
# Hewlett Packard Company Revision: 1.0
# ~~~~~~~~~ WookieWare ~~~~~~~~~~~~~
# Change hist... | xod442/sample_scripts | list2_pid.py | Python | gpl-2.0 | 6,949 |
from wptserve.utils import isomorphic_encode
def main(request, response):
def fail(message):
response.content = b"FAIL " + isomorphic_encode(request.method) + b": " + message
def getState(token):
server_state = request.server.stash.take(token)
if not server_state:
return b"... | chromium/chromium | third_party/blink/web_tests/external/wpt/xhr/resources/access-control-basic-preflight-cache-invalidation.py | Python | bsd-3-clause | 1,863 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/Vectors/F9.py | Python | lgpl-2.1 | 3,248 |
# Copyright 2012 OpenStack Foundation
#
# 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... | jamielennox/keystone | keystone/assignment/core.py | Python | apache-2.0 | 54,508 |
#! /usr/bin/python
# this script converts the output of HierBayes into a segmented text
# example usage can be seen in runwphb.sh
# @author: lucien@discurs.us
import re, os, sys
hboutdir = '../wpeos_hb-em'
wpdir = '../wpeos_hb'
outdir = '../wpeos_hb-em_fix'
hboutdir, wpdir, outdir = sys.argv[1:]
print hboutdir, wpdir... | serapio/EvalHDS | eval/hb-out-convert.py | Python | mit | 1,712 |
__author__ = "Alex Baranov"
from inequalities import chernikov as c
from permutations import *
import numpy as np
def find_minimum(goal_func,
constraints_system,
combinatorial_set,
add_constraints=True,
series_count=3,
e... | stonelake/pyoptimization | pyopt/discrete/randomsearch.py | Python | apache-2.0 | 6,894 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Ponzoni, Nelson"
__copyright__ = "Copyright 2015"
__credits__ = ["Ponzoni Nelson"]
__maintainer__ = "Ponzoni Nelson"
__contact__ = "npcuadra@gmail.com"
__email__ = "npcuadra@gmail.com"
__license__ = "GPL"
__version__ = "1.0.0"
_... | lerker/cupydle | cupydle/dnn/gridSearch.py | Python | apache-2.0 | 4,741 |
from flask import Blueprint
matgirl = Blueprint('matgirl', __name__)
from . import views
| bobcolner/material-girl | app/matgirl/__init__.py | Python | mit | 91 |
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
import netaddr
name ... | ashmastaflash/gwdetect | dependencies/netaddr-0.7.10/release.py | Python | mit | 5,263 |
import inspect
import os
import sys
def find_lldb_root():
lldb_root = os.path.realpath(
os.path.dirname(inspect.getfile(inspect.currentframe())))
while True:
parent = os.path.dirname(lldb_root)
if parent == lldb_root: # dirname('/') == '/'
raise Exception("use_lldb_suite_ro... | google/llvm-propeller | lldb/test/API/use_lldb_suite.py | Python | apache-2.0 | 725 |
import datetime
import logging
import os
import json
import time
from twisted.internet import threads, reactor, defer, task
from twisted.python.failure import Failure
from twisted.enterprise import adbapi
from collections import defaultdict, deque
from zope.interface import implements
from decimal import Decimal
imp... | zestyr/lbry | lbrynet/core/Wallet.py | Python | mit | 63,881 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from marshmallow import EXCLUDE, ValidationError, fields
from marshmallow_enum import EnumField
from marsh... | pferreir/indico | indico/modules/search/result_schemas.py | Python | mit | 10,538 |
# ====================================================================
# 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 re... | romanchyla/pylucene-trunk | samples/LuceneInAction/lia/indexing/FSversusRAMDirectoryTest.py | Python | apache-2.0 | 3,150 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 3 as published by the Free
# Software Foundation.
#
# This program is... | hmpf/nav | python/nav/web/webfront/forms.py | Python | gpl-3.0 | 5,510 |
from __future__ import print_function
try:
# python2
input = raw_input
basestring = basestring
def encode(s):
return s.encode('utf8')
PY2 = True
except:
# python3
basestring = str
input = input
def encode(s):
return s
PY2 = False
import sys
if not PY2 and... | BenoitZugmeyer/addic7ed-cli | addic7ed_cli/compat.py | Python | mit | 515 |
# coding=utf-8
import json
from bottle import Bottle, template, static_file, request
from model import retrieve_data
app = Bottle()
@app.route('/build/<filename:path>')
def doc_server(filename):
return static_file(filename, root='build')
@app.route('/')
def index():
return template('index')
@app.route(... | m19t12/simpleARS-Playground | routes.py | Python | gpl-3.0 | 466 |
import math
class ZigZag:
"""
An n-dimensional zig-zag curve - it snakes through the n-cube, with
each point differing from the previous point by exactly one. Not
useful, but it's a good counterpoint to other space-filling curves.
"""
def __init__(self, dimension, size):
"""... | butterworth1492/Visualizing-Cavity-Viruses | scurve/scurve/zigzag.py | Python | bsd-2-clause | 1,922 |
"""empty message
Revision ID: 41a93799080
Revises: 1a9765a646b
Create Date: 2015-07-02 14:38:39.418104
"""
# revision identifiers, used by Alembic.
revision = '41a93799080'
down_revision = '1a9765a646b'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### comm... | sunze/py_flask | migrations/versions/41a93799080_.py | Python | mit | 2,207 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
def main():
print("Type bot.py -h to check extra arguments")
res = parser.parse_args()
if res.initial_config:
from chunsabot.configmaker import make_initial_config
make_initial_config()
else:
print("Usage : ./telegram-cli -Z bot.py")
... | susemeee/Chunsabot-framework | bot.legacy.py | Python | mit | 4,110 |
"""
Utility functions for command line argument parsing
"""
import types
import argparse
def convert_to_list(value):
"""
Converts the given value into a list. If the value is a dictionary the key and value of the
dictionary will be parsed into a string with the format key=value. Any other type will be
... | brian-bason/docker-build-tool | docker_build/utils/argparser.py | Python | mit | 2,378 |
import Adafruit_GPIO.I2C as I2C
class DS1803(object):
CMD_WRITE_POT0 = 0xA9
CMD_WRITE_POT1 = 0xAA
CMD_WRITE_BOTH_POTS = 0xAF
VARIANT_10K = 10000
VARIANT_50K = 50000
VARIANT_100K = 100000
VARIANTS = [VARIANT_10K, VARIANT_50K, VARIANT_100K]
def __init__(self, i2c=None, i2c_busnum=None... | andycavatorta/oratio | Roles/avl-voice-3/ada_example.py | Python | mit | 3,805 |
#!/usr/bin/env python
"""Create streams and receive packets"""
# pylint: disable=E1101
import inspect
import pprint
import sys
import time
import ipaddress
import netaddr
from ostinato.core import ost_pb, DroneProxy
from ostinato.protocols.mac_pb2 import mac, Mac
from ostinato.protocols.eth2_pb2 import eth2
from ostin... | lunn/dsa-tests | tests/traffic.py | Python | gpl-3.0 | 23,253 |
"""
Socket server forwarding request to internal server
"""
import logging
try:
# we prefer to use bundles asyncio version, otherwise fallback to trollius
import asyncio
except ImportError:
import trollius as asyncio
from opcua import ua
from opcua.server.uaprocessor import UAProcessor
logger = logging.g... | alkor/python-opcua | opcua/server/binary_server_asyncio.py | Python | lgpl-3.0 | 3,853 |
# This file is part of Bika LIMS
#
# Copyright 2011-2016 by it's authors.
# Some rights reserved. See LICENSE.txt, AUTHORS.txt.
from AccessControl import ClassSecurityInfo
from Products.Archetypes.Registry import registerWidget
from Products.Archetypes.Widget import TypesWidget
from Products.CMFCore.utils import getTo... | rockfruit/bika.lims | bika/lims/browser/widgets/referenceresultswidget.py | Python | agpl-3.0 | 9,685 |
# MiniLight Python : minimal global illumination renderer
#
# Harrison Ainsworth / HXA7241 and Juraj Sukop : 2007-2008, 2013.
# http://www.hxa.name/minilight
from camera import Camera
from image import Image
from scene import Scene
from random import Random
from sys import argv, stdout
from time import time
BANN... | hxa7241/minilight-python | minilight.py | Python | cc0-1.0 | 2,622 |
i = 1
while i<=5:
'''
#从键盘中输入一个值,这个值用来控制这行中*的个数
num = int(input("请输入这个行里的*的个数:"))
j = 1
while j<=num:
print("*", end="")
j+=1
'''
j = 1
while j<=i:
print("*", end="")
j+=1
print("")
i+=1
| jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/if、while、for/13-打印三角形.py | Python | gpl-2.0 | 334 |
import io
import time
from datetime import datetime
from http import HTTPStatus
from urllib.parse import urljoin
import aiohttp
from talkbot.reactor import MessageReactor
from .logger import log
class TelegramBot:
BASE_URI = "https://api.telegram.org/bot{0.token}/"
FILE_URI = "https://api.telegram.org/file... | nimnull/talkbot | talkbot/api_client.py | Python | bsd-3-clause | 3,687 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | oesteban/fmriprep | fmriprep/cli/tests/test_parser.py | Python | bsd-3-clause | 6,798 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from email.message import EmailMessage
from email.utils import make_msgid
import datetime
import email
import email.policy
import logging
import re
import smtplib
import sys
import threading
import html2text
from odoo ... | ygol/odoo | odoo/addons/base/models/ir_mail_server.py | Python | agpl-3.0 | 24,248 |
# 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 use ... | Scalr/libcloud | libcloud/test/common/test_openstack_identity.py | Python | apache-2.0 | 37,442 |
import logging
from entrypoint2 import entrypoint
import psidialogs
log = logging.getLogger(__name__)
g_backend = ""
def testdata(title, dialogtype):
return dict(
message="This is the 'message'! (%s,%s) \u20ac" % (g_backend, dialogtype),
choices=["1 \u20ac", "Two", "Three,\"' "],
# te... | ponty/psidialogs | psidialogs/examples/demo.py | Python | bsd-2-clause | 1,690 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh
##
## This program is free ... | TrevorLowing/PyGames | pysollib/customgame.py | Python | gpl-2.0 | 12,399 |
# Class definition file, version 1
VERSION = 1
# Name is the class name that is displayed to the player
NAME = "Fighter"
# Stats
MOVE = 6
JUMP = 6
HP_BASE = 72
HP_GROWTH = 7.2
HP_MULT = 1.1
SP_BASE = 12
SP_GROWTH = 1.2
SP_MULT = 0.9
WATK_BASE = 24
WATK_GROWTH = 2.4
WATK_MULT = 1.1
... | jemofthewest/GalaxyMage | data/core/classes/fighter.py | Python | gpl-2.0 | 645 |
import io
import os
import lxml.html
import subprocess
import requests
import youtube_dl
import longpoll
class Plugin:
help = """/pony - присылает в ответ случайную картинку с поняшкой, /котик - c котиком"""
@staticmethod
def get_pony():
random_id_req = requests.get("https://trixiebooru.org/sea... | hdk5/cosinus | plugins/pone.py | Python | mit | 4,359 |
from django.contrib import admin
from .models import LDAPGatherHistory
admin.site.register(LDAPGatherHistory)
| alzeih/ava | ava_core/gather/gather_ldap/admin.py | Python | gpl-3.0 | 112 |
# pylint: disable=missing-docstring
from openshift_checks import OpenShiftCheck, get_var
from openshift_checks.mixins import NotContainerizedMixin
class PackageAvailability(NotContainerizedMixin, OpenShiftCheck):
"""Check that required RPM packages are available."""
name = "package_availability"
tags = [... | brenton/openshift-ansible | roles/openshift_health_checker/openshift_checks/package_availability.py | Python | apache-2.0 | 2,100 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_prefixes = ('San', 'Borgo', 'Sesto', 'Quarto', 'Settimo')
city_suffixes = ('a mare', 'lido', 'ligure', 'del friuli', 'salentino',
'calabro', 'veneto', 'n... | deanishe/alfred-fakeum | src/libs/faker/providers/address/it_IT/__init__.py | Python | mit | 8,069 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2019 NIWA & British Crown (Met Office) & Contributors.
#
# 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... | matthewrmshin/cylc | lib/cylc/suite_events.py | Python | gpl-3.0 | 7,548 |
class MulticastDelegate(object):
def __init__(self):
self.delegates = []
def __iadd__(self, delegate):
self.add(delegate)
return self
def add(self, delegate):
self.delegates.append(delegate)
def __isub__(self, delegate):
self.delegates.remove(delegate)
... | ericgriffin/fflock | web2py/gluon/contrib/pg8000/util.py | Python | apache-2.0 | 440 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='emergency_na... | javierwilson/resilienciacafe | forocacao/users/migrations/0002_auto_20160805_1435.py | Python | bsd-3-clause | 730 |
#!/usr/bin/python
import math
class Position :
def __init__(self, lat, lon) :
self.lat = lat
self.lon = lon
def __str__(self):
return str(self.lat) + ", " + str(self.lon)
def __repr__(self):
return str(self.lat) + ", " + str(self.lon)
class City :
def __init__(self, id, name, position) :
s... | kindasimple/play | python/search/Cities.py | Python | mit | 770 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | snehasi/servo | python/servo/devenv_commands.py | Python | mpl-2.0 | 7,682 |
from plotly.graph_objs import Sankey
| plotly/python-api | packages/python/plotly/plotly/graph_objs/layout/template/data/_sankey.py | Python | mit | 37 |
#!/usr/bin/python
# This file is part of Osgende
# Copyright (C) 2012 Sarah Hoffmann
#
# This is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or any later version.
#
# This p... | lonvia/osgende | setup.py | Python | gpl-3.0 | 1,367 |
"""
example_b.py
by Ted Morin
contains example code for model b from
10.1161/STROKEAHA.113.004506
2014 Intracranial Hemorrhage Among Patients With Atrial Fibrillation Anticoagulated With Warfarin or Rivaroxaban
"""
from model_b import model
# inputs: ['Age', 'Diastolic Blood Pressure', 'Platelets','Albumin','History... | doirisks/dori | models/10.1161:STROKEAHA.113.004506/example_b.py | Python | gpl-3.0 | 1,561 |
#!/usr/bin/python
import sys
sys.path.append("/sdcard/files/modules/")
from keyseed import *
# pop up win8 elevated cmd
win8cmd_elevated()
# open up payload file
f = open("/sdcard/files/rev-tcp", "rb")
try:
byte = f.read(1)
while byte != "":
byte = f.read(1)
findinlist(byte)
finally:
f.close()
... | rcoscali/kali-nethunter | utils/hid/rev-tcp-elevated-win8.py | Python | gpl-2.0 | 343 |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | dhermes/gcloud-python | oslogin/tests/unit/gapic/v1/test_os_login_service_client_v1.py | Python | apache-2.0 | 10,755 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | kevhill/luigi | test/helpers.py | Python | apache-2.0 | 5,988 |
#!/urs/bin/env python
# -*- coding: utf-8 -*-
"""Change value of alias in Logan to Wolverine"""
import data
data.SUPERHEROES['Logan']['alias'] = 'Wolverine'
| ModestoCabrera/is210-week-10-warmup | task_05.py | Python | mpl-2.0 | 159 |
# Copyright 2016 United States Government as represented by the Administrator
# of the National Aeronautics and Space Administration. All Rights Reserved.
#
# Portion of this code is Copyright Geoscience Australia, Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this file
# except in c... | ceos-seo/data_cube_ui | apps/dc_algorithm/management/commands/band_math_app/admin.py | Python | apache-2.0 | 1,178 |
# Copyright (c) 2010-2016 OpenStack Foundation
#
# 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 agree... | openstack/swift | test/unit/container/test_sync_store.py | Python | apache-2.0 | 15,743 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Pretty-prints the contents of a GYP file."""
import sys
import re
# Regex to remove comments when we're counting braces.
COMMENT_RE = ... | migua1204/jikexueyuan | 极客学院/BusStopBoard/node_modules/.3.4.0@node-gyp/gyp/tools/pretty_gyp.py | Python | apache-2.0 | 4,756 |
# coding=utf-8
from __future__ import unicode_literals
from .. import Provider as InternetProvider
class Provider(InternetProvider):
free_email_domains = (
'chello.at', 'gmail.com', 'gmx.at', 'kabsi.at',
)
tlds = ('at', 'co.at', 'com', 'net', 'org', )
replacements = (
('ä', 'ae'), (... | Nebucatnetzer/tamagotchi | pygame/lib/python3.4/site-packages/faker/providers/internet/de_AT/__init__.py | Python | gpl-2.0 | 434 |
from django.conf import settings
from django.shortcuts import render, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404, resolve_url
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.cache import never_cache
... | vivianbuan/cs3240-s15-team20 | SecureWitness/accounts/views.py | Python | mit | 26,070 |
import numpy as np
from scipy.stats import skewnorm
import opiniongame.stopping as og_stop
def pick_topic(nTopics):
"""
Pick a topic from n possible topics. Just a wrapper around NumPy randint.
"""
return np.random.randint(nTopics)
def interaction_update(oldS, oldH, speaker_potential, hearer_potentia... | HNoorazar/PyOpinionGame | opiniongame/core.py | Python | gpl-3.0 | 9,403 |
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from __future__ import absolute_import
import stix
import stix.utils as utils
import stix.bindings.stix_common as common_binding
from .confidence import Confidence
from .structured_text import StructuredTextList
f... | chriskiehl/python-stix | stix/common/statement.py | Python | bsd-3-clause | 5,395 |
# -*- coding: utf-8 -*-
import os
from flask import g, request
from oar.lib import db
def register_hooks(app):
"""Declare all flask application hooks."""
# 0.9 and later
if hasattr(app, 'teardown_appcontext'):
teardown = app.teardown_appcontext
# 0.7 to 0.8
elif hasattr(app, 'teardown_requ... | fr0uty/oartm | oar/rest_api/hooks.py | Python | bsd-3-clause | 958 |
import Pyro5.api
uri = input("Enter the uri of the restricted server: ")
restricted = Pyro5.api.Proxy(uri)
print("server is running as:", restricted.who_is_server())
print("attempting to write a file:")
try:
restricted.write_file()
print("???? this should fail!")
except OSError as x:
print("ERROR (expecte... | irmen/Pyro5 | examples/privilege-separation/drop_privs_client.py | Python | mit | 329 |
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import UserCreationForm
from .models import *
from .form import *
from django.core import serializers
from django.core.serializers import json
from django.core.urlresolvers import reverse_lazy
from django.db import transaction
fro... | Edwineverth/Parque-Inteligente-SD- | SmartPark/AppPrincipal/views.py | Python | cc0-1.0 | 16,078 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The migrate command-line tool."""
import sys
import inspect
import logging
from optparse import OptionParser, BadOptionError
from migrate.versioning import api, exceptions
from migrate.versioning.config import *
from migrate.versioning.util import asbool
alias = dic... | evensonbryan/yocto-autobuilder | lib/python2.7/site-packages/sqlalchemy_migrate-0.6-py2.6.egg/migrate/versioning/shell.py | Python | gpl-2.0 | 6,390 |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2014 Bitcraze AB
#
# Cr... | ISUCTQuadcopterTeam/CrazyFlieClient | examples/basicparam.py | Python | gpl-2.0 | 7,109 |
from .pyvatebin import app
| yossarianirving/pyvatebin | pyvatebin/__init__.py | Python | mit | 27 |
"""
Tests for the modified MultinonialNB that checks if it is correctly trained
using labeled features.
"""
import unittest
import numpy as np
from featmultinomial import FeatMultinomalNB
from copy import deepcopy
from math import log
from sklearn import tree
# I should use random numbers here!
X = np.array([
[... | mit0110/activepipe | test_featmultinomial.py | Python | mit | 5,694 |
### ToDo
# Set more things NOT NULL
import sqlite3 as sql
import pandas as pd
import sys
db_filename = sys.argv[1] if len(sys.argv) > 1 else 'my-budget-default.sqlite'
db = sql.connect(db_filename)
print('Creating an an empty database as "{}"'.format(db_filename))
# create table list of all places where money can ... | maxkoe/budgeter | database_setup.py | Python | gpl-3.0 | 7,716 |
SCHEMA_NAME = None
"""Force a schema name when using a database.
Hacky solution to not finding a place to inject a schema name
into migrations.
"""
ADDITIONAL_SCHEMAS = []
"""When forcing a schema, include additional search schemas.
Adds to the hacky solution of migrating across multiple schemas. This
allows the c... | ryannjohnson/django-schemas | django_schemas/backends/conf.py | Python | gpl-3.0 | 655 |
"""
These functions allows set and get value of a dict with a "dot noted" key.
The `key_string_set` functions allow `int` type as key part.
The key part converted to int if can. Empty key part converted to next int key.
When in the current level no keys - next key is '0'
When in the current level no int keys (may just ... | palankai/xadrpy | src/xadrpy/utils/key_string.py | Python | lgpl-3.0 | 2,306 |
# 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/appplatform/azure-mgmt-appplatform/azure/mgmt/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py | Python | mit | 26,351 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from gi.repository import GLib
from gi.repository import Gio
import logging
from common import BASE_PATH, BASE_KEY
class Logger:
def __init__(self, path="brss.log", name="BRss"):
self.logger = logging.getLogger(name)
self.logger.setLevel(loggi... | bidossessi/brss | brss/logger.py | Python | gpl-2.0 | 1,651 |
# -*- coding: utf-8 -*-
"""Video is ungraded Xmodule for support video content.
It's new improved video module, which support additional feature:
- Can play non-YouTube video sources via in-browser HTML5 video player.
- YouTube defaults to HTML5 mode from the start.
- Speed changes in both YouTube and non-YouTube video... | ESOedX/edx-platform | common/lib/xmodule/xmodule/video_module/video_module.py | Python | agpl-3.0 | 51,311 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.