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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
import re
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.views.decorators... | sv1jsb/dwitter | dwitter/main/views.py | Python | bsd-3-clause | 8,546 |
"""
test the different syntaxes to define fields
"""
from . import TestMetaData
from camelot.core.orm import Field, has_field
from sqlalchemy.types import String
class TestFields( TestMetaData ):
def test_attr_syntax(self):
class Person(self.Entity):
firstname = Field(String(30))
... | jeroendierckx/Camelot | test/test_orm/test_fields.py | Python | gpl-2.0 | 1,169 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2007, 2008, 2009, 2010, 2011 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, ... | valkyriesavage/invenio | modules/webstyle/lib/webdoc.py | Python | gpl-2.0 | 36,494 |
# Copyright 2018-20 ForgeFlow S.L. (https://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class StockRule(models.Model):
_inherit = "stock.rule"
def _update_purchase_order_line(
self, product_id, product_qty, product_uom, company_id,... | OCA/stock-logistics-warehouse | stock_orderpoint_purchase_link/models/stock_rule.py | Python | agpl-3.0 | 816 |
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
try: # Python 3
from queue import LifoQueue, Empty, Full
except ImportError:
from Queue import LifoQueue, Empty, Full
import Queue as _ # Platform-specific: Windows
fr... | bendikro/deluge-yarss-plugin | yarss2/lib/requests/packages/urllib3/connectionpool.py | Python | gpl-3.0 | 30,319 |
import pytest
class TestNcftp:
@pytest.mark.complete("ncftp ")
def test_1(self, completion):
assert completion
@pytest.mark.complete("ncftp -", require_cmd=True)
def test_2(self, completion):
assert completion
| algorythmic/bash-completion | test/t/test_ncftp.py | Python | gpl-2.0 | 245 |
import matplotlib.pylab as plt
plt.ion()
import cPickle as pickle
import numpy as np
from scipy.io import loadmat
from sklearn.cross_validation import train_test_split
from activation_funcs import sigmoid_function, tanh_function
from neural_net import NeuralNet
# load standardized data and labels to disk
train_featur... | jvpoulos/cs289-hw6 | code/test_neural_network.py | Python | mit | 1,471 |
# jsb/utils/lazydict.py
#
# thnx to maze
""" a lazydict allows dotted access to a dict .. dict.key. """
## jsb imports
from jsb.utils.locking import lockdec
from jsb.utils.exception import handle_exception
from jsb.lib.errors import PropertyIgnored
from jsb.imports import getjson
json = getjson()
## basic imports
... | melmothx/jsonbot | jsb/utils/lazydict.py | Python | mit | 4,224 |
from django import template
import json
import django.utils.html
import django.utils.safestring
register = template.Library()
@register.simple_tag(takes_context=True)
def json_messages(context):
for m in context.get('json_messages',[]):
m['msg'] = django.utils.html.escapejs(m['msg'])
json_dump = json.dumps(conte... | matiboy/django-json-messages | json_messages/templatetags/json_messages.py | Python | gpl-2.0 | 811 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-11-23 18:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ctdata', '0038_auto_20161123_1227'),
]
operations = [
migrations.AddField(
... | CT-Data-Collaborative/ctdata-wagtail-cms | ctdata/migrations/0039_auto_20161123_1818.py | Python | mit | 1,100 |
"""
Internal hook annotation, representation and calling machinery.
"""
import inspect
import sys
import warnings
class HookspecMarker:
""" Decorator helper class for marking functions as hook specifications.
You can instantiate it with a project_name to get a decorator.
Calling :py:meth:`.PluginManager.... | RonnyPfannschmidt/pluggy | src/pluggy/_hooks.py | Python | mit | 11,521 |
mystring="40523116"
mystring=mystring +" test"
print(mystring)
| s40523116/2016fallcp_hw | w4.py | Python | agpl-3.0 | 66 |
# coding=utf-8
"""Tests for medusa/post_processor.py."""
from medusa.common import Quality
from medusa.name_parser.parser import NameParser
from medusa.post_processor import PostProcessor
import pytest
@pytest.mark.parametrize('p', [
{ # Test file in PP folder root
'file_path': '/media/postprocess/Show.... | fernandog/Medusa | tests/test_postprocessor_parse_info.py | Python | gpl-3.0 | 2,836 |
import unittest
from test import test_support
# The test cases here cover several paths through the function calling
# code. They depend on the METH_XXX flag that is used to define a C
# function, which can't be verified from Python. If the METH_XXX decl
# for a C function changes, these tests may not cover the righ... | mancoast/CPythonPyc_test | cpython/266_test_call.py | Python | gpl-3.0 | 3,290 |
from crank.core.exercise import Exercise
TEST_EXERCISE_LINES = [
'Swing, KB: 28 x 35',
'Squat: 20, 60 x 5, 80, 90 x 3, 91, 105 x 5, 119 x 4',
'- unit: kg',
'- coming off drill weekend, tired and small',
'Curl, ring: 10/5',
'Plate pinch: 15 x 35/30'
]
TEST_EXERCISE_V2_LINES = [
'Swing, KB:... | jad-b/Crank | crank/core/tests/test_exercise.py | Python | mit | 2,120 |
from django.core.urlresolvers import resolve
from django.dispatch import receiver
from django.template import Context
from django.template.loader import get_template
from pretix.base.signals import register_payment_providers
from pretix.presale.signals import html_head
@receiver(register_payment_providers)
def regis... | lab2112/pretix | src/pretix/plugins/stripe/signals.py | Python | apache-2.0 | 899 |
import psutil
_mb_conversion = 1024 * 1024
def cpu_times(*args, **kwargs):
return psutil.cpu_times()
def cpu_count(logical=True, *args, **kwargs):
cores = psutil.cpu_count(logical)
if cores == 1:
word = 'Core'
else:
word = 'Cores'
return '{} CPU {}'.format(cores, word)
def cpu... | benhoff/vexbot | vexbot/extensions/system.py | Python | gpl-3.0 | 1,216 |
# -*- coding: utf-8 -*-
#
# SelfTest/Hash/test_SHA3_512.py: Self-test for the SHA-3/512 hash function
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# e... | chronicwaffle/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/SelfTest/Hash/test_SHA3_512.py | Python | mit | 2,984 |
# Copyright 2011 David Malcolm <dmalcolm@redhat.com>
# Copyright 2011 Red Hat, Inc.
#
# 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 3 of the License, or
# (at your option) a... | jasonxmueller/gcc-python-plugin | test.py | Python | gpl-3.0 | 4,676 |
"""
ManyMan - A Many-core Visualization and Management System
Copyright (C) 2012
University of Amsterdam - Computer Systems Architecture
Jimi van der Woning and Roy Bakker
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
t... | 6366295/ManyMan-for-mgsim | messageprocessor.py | Python | gpl-3.0 | 8,035 |
# -*- coding: utf-8 -*-
"""
Blueprints are the recommended way to implement larger or more
pluggable applications.
"""
from functools import update_wrapper
class Blueprint(object):
"""Represents a blueprint.
"""
def __init__(self, name, url_prefix=None, url_defaults=None):
self.app = None... | zeaphoo/cocopot | cocopot/blueprints.py | Python | mit | 6,866 |
# exchange class for FXBTC - I expect that there will be more arb opportunities
# since chinese and US markets are fundamentally mispriced.
# NOTE: all rates and currencies multiplied by 10^8 to avoid floating point!
# this will be a very important consideration
from Exchange import Exchange
from fxbtc import fx
from... | ericjang/cryptocurrency_arbitrage | FXBTC.py | Python | gpl-3.0 | 3,903 |
"""SCons.Tool.applelink
Tool-specific initialization for the Apple gnu-like linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# Permission is hereby... | fluxer/spm | nuitka/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/applelink.py | Python | gpl-2.0 | 2,796 |
from django.conf.urls import url, include
from django.urls import path
from django.utils.translation import pgettext_lazy
from django.views.generic.base import RedirectView
from ..views import (
delete_draft, claim_draft,
ListRequestView, UserRequestFeedView,
user_calendar
)
from ..filters import FOIREQUES... | stefanw/froide | froide/foirequest/urls/list_requests_urls.py | Python | mit | 3,643 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2014--, tax-credit development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ---------------------... | caporaso-lab/short-read-tax-assignment | tax_credit/tests/test_simulated_communities.py | Python | bsd-3-clause | 2,885 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | poem/cv_mim/models_test.py | Python | apache-2.0 | 5,000 |
from django.contrib.auth.models import User
from django.contrib.sessions.backends.base import SessionBase
from django.test import TestCase
from django.test.client import RequestFactory
from uwsgi_it_api.views import *
from uwsgi_it_api.views_metrics import *
from uwsgi_it_api.views_private import *
import base64
impor... | Mikrobit/uwsgi.it | uwsgi_it_api/uwsgi_it_api/tests.py | Python | mit | 16,887 |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, \
FloatField, RadioField, SelectField, IntegerField
from wtforms.validators import InputRequired, Required, Length, Email, Regexp, EqualTo, DataRequired
from wtforms import ValidationError
from ..models import... | lyhrobin00007/FlaskCTA | app/pyOption/forms.py | Python | mit | 13,561 |
import os
import stat
import pwd
import grp
import logging
from autotest.client import utils
from autotest.client.shared import error
from virttest import utils_selinux
from virttest import virt_vm
from virttest import utils_config
from virttest import utils_libvirtd
from virttest.libvirt_xml.vm_xml import VMXML
de... | waynesun09/tp-libvirt | libvirt/tests/src/svirt/dac_start_destroy.py | Python | gpl-2.0 | 15,257 |
import asyncio
import hmac
import itertools
from bson import objectid
from vj4 import app
from vj4 import error
from vj4.model import builtin
from vj4.model import document
from vj4.model import domain
from vj4.model import fs
from vj4.model import message
from vj4.model import token
from vj4.model import user
from v... | vijos/vj4 | vj4/handler/home.py | Python | agpl-3.0 | 12,558 |
from models import db
from models.Post import Post
class PostFile(db.Model):
__tablename__ = 'PostFile'
Id = db.Column(db.Integer, primary_key = True)
Post = db.Column(db.Integer, db.ForeignKey(Post.Id))
FileName = db.Column(db.String(128))
def __init__(self, post, file):
self.Post = post
self.F... | goors/flask-microblog | models/PostFile.py | Python | apache-2.0 | 335 |
import matplotlib.pyplot as plt
import numpy as np
data = np.loadtxt(open("csv files/GT_T_009991.csv","rb"),delimiter=",",skiprows=0)
# arr=[[1,3],[1,2],[2,3],[1,4]]
arr=[]
for a in range(len(data)):
for b in range(len(data[a])):
if data[a][b] !=0:
arr.append([a+1,b+1,data[a][b]])
# print arr
for x in arr:
... | wyfzeqw/Environmental-Influence-on-Crowd-Dynamics | Project/plotter.py | Python | mit | 413 |
import gdata
import glob, math
from ige.ospace.Const import *
smallStarImgs = None
techImgs = None
bigStarImgs = None
planetImgs = None
cmdInProgressImg = None
loginLogoImg = None
structProblemImg = None
structOffImg = None
icons = {}
def getUnknownName():
return _('[Unknown]')
def getNA():
retur... | mozts2005/OuterSpace | client-msg-wx/lib/res.py | Python | gpl-2.0 | 578 |
"""Configuration of clang-hook."""
from .stage import Str_to_stage
from .config import BaseConfig
from .filter import Filter
class HookConfig(BaseConfig):
"""Configuration of clang-hook."""
__slots__ = ("data", "load", "passes", "link_flags", "error_log", "info_log", "debug_log", "log", "output_file",
... | s-i-newton/clang-hook | lib_hook/hook_config.py | Python | apache-2.0 | 2,224 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | addition-it-solutions/project-all | addons/analytic/wizard/account_analytic_cost_ledger_report.py | Python | agpl-3.0 | 1,959 |
# You have to perform N operations on a queue of the following types: E x : Enqueue x in the queue and
# print the new size of the queue. D : Dequeue from the queue and print the element that is deleted and
# the new size of the queue separated by a space. If there is no element in the queue, then print −1 in
# place o... | OmkarPathak/Python-Programs | CompetitiveProgramming/HackerEarth/DataStructures/Queue/P01_Queue.py | Python | gpl-3.0 | 1,181 |
# Copyright (c) 2015-2018 Mark Hamilton, All rights reserved
"""
Provides general settings for testpool.
"""
import os
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
##
# Location of the test database root directory.
TEST_DBSITE_DIR = os.path.abspath(os.path.join(BASE_DIR, "db"))
PLUGINS = {
'testpool.libe... | testcraftsman/testpool | testpool/settings.py | Python | gpl-3.0 | 447 |
"""
Test that the 'gui' displays long lines/names correctly without overruns.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test.lldbpexpect import PExpectTest
class GuiViewLargeCommandTest(PExpectTest):
mydir = TestBase.compute_mydir(__file__)
... | google/llvm-propeller | lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py | Python | apache-2.0 | 2,891 |
""" Dictionary learning
"""
from __future__ import print_function
# Author: Vlad Niculae, Gael Varoquaux, Alexandre Gramfort
# License: BSD 3 clause
import time
import sys
import itertools
from math import sqrt, floor, ceil
import numpy as np
from scipy import linalg
from numpy.lib.stride_tricks import as_strided
f... | B3AU/waveTree | sklearn/decomposition/dict_learning.py | Python | bsd-3-clause | 40,489 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-17 02:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rvu', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | craighagan/rvumanager | rvusite/rvu/migrations/0002_auto_20160416_2224.py | Python | apache-2.0 | 593 |
import base
import datetime
class info(base.SVNBase):
def __init__(self, argv):
base.SVNBase.__init__(self)
self.path = '.'
self.recurse = False
if len(argv) > 0:
self.path = argv[-1]
def execute(self):
entries = self.client.info2(self.path, recurse=self.r... | ext/svnc | info.py | Python | gpl-3.0 | 2,022 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# * Copyright (C) 2011 TDW
import xbmc, xbmcgui, xbmcplugin, xbmcaddon, os, urllib, time, codecs, httplib
import SelectBox
from KPmenu import *
PLUGIN_NAME = 'KinoPoisk.ru'
siteUrl = 'www.KinoPoisk.ru'
httpSiteUrl = 'http://' + siteUrl
handle = int(sys.argv[1])
addon ... | sshnaidm/ru | plugin.video.KinoPoisk.ru/default.py | Python | gpl-2.0 | 38,625 |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# Modified by Mike Orr for Akhet.
"""
We have a pony and a unicorn.
"""
import base64
import zlib
from pyramid.response import Response
def includem... | knzm/pyramid_pony | pyramid_pony/pony.py | Python | mit | 2,385 |
import theano
import numpy as np
import theano.tensor as T
from random import sample
sigmoid = lambda x: 1 / (1 + T.exp(-x))
class DAE(object):
"""Defines a multi autoencoder.
layer_types can be either 'logistic' or 'linear' at the moment.
"""
def __init__(self, input_dim, layer_sizes, layer_typ... | pbrakel/ksd-theano | autoencoder.py | Python | mit | 2,216 |
#! /usr/bin/env python
import os
import hashlib
import cPickle
import time
import base64
import inspect
__all__ = ["CacheError", "FSCache", "make_digest",
"auto_cache_function", "cache_function", "to_seconds"]
class CacheError(Exception):
pass
class TimeError(CacheError):
pass
class LifetimeError(Ca... | cfairbanks/calibre-comicvine | pyfscache/fscache.py | Python | mit | 15,558 |
"""
/***************************************************************************
Name : ComposerPhotoDatSourceEditor
Description : Widget for specifying data properties for tables in
the document designer.
Date : 5/January/2015
copyright :... | gltn/stdm | stdm/ui/composer/table_data_source.py | Python | gpl-2.0 | 5,385 |
import sublime
from unittest import TestCase
version = sublime.version()
class TestBracketGuard(TestCase):
def setUp(self):
self.view = sublime.active_window().new_file()
self.view.settings().set("is_test", True)
def tearDown(self):
if self.view:
self.view.set_scratch(True)
self.vi... | beni55/Sublime-BracketGuard | tests/testBracketGuard.py | Python | mit | 1,599 |
__author__ = 'kreitz'
| kennethreitz-archive/mead | mead/plugins/sitemap_xml/__init__.py | Python | isc | 22 |
#!/usr/bin/env python3
import rospy
from lg_common import ManagedBrowser, ManagedWindow
from lg_msg_defs.msg import ApplicationState, WindowGeometry
from lg_common.helpers import check_www_dependency, discover_host_from_url, discover_port_from_url
from lg_common.helpers import run_with_influx_exception_handler
from s... | EndPointCorp/lg_ros_nodes | lg_common/scripts/static_browser.py | Python | apache-2.0 | 2,261 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import re
import webapp2
import jinja2
import logging
import StringIO
from markupsafe import Markup, escape # https://pypi.python.org/pypi/MarkupSafe
import parsers
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
from google.ap... | cesarmarinhorj/schemaorg | sdoapp.py | Python | apache-2.0 | 67,019 |
# coding: utf-8
from flask import render_template, Blueprint
bp = Blueprint('site', __name__)
@bp.route('/')
def index():
"""Index page."""
return render_template('site/index/index.html')
@bp.route('/about')
def about():
"""About page."""
return render_template('site/about/about.html')
| hustlzp/Flask-Boost | flask_boost/project/application/controllers/site.py | Python | mit | 308 |
#!/usr/bin/python
import pexpect, argparse, kadmin, ktutil
from subprocess import check_output
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='''
This script create a new mongo user with kerberos principal
''')
parser.add_argument('-n', '--principalName', default=None, help='Principal... | brosander/pentaho-docker | mongo/mongo-kerberos/createUser.py | Python | apache-2.0 | 1,416 |
from django.contrib import admin
from rango.models import Category, Page
class PageAdmin(admin.ModelAdmin):
list_display = ('title', 'category', 'url')
admin.site.register(Category)
admin.site.register(Page, PageAdmin)
| jonellalvi/tango_with_django | rango/admin.py | Python | mit | 227 |
#!/usr/bin/python3
import bottle
import networkx
import networkx.readwrite.json_graph
import json
import os
@bottle.route('/dependencies')
def dependencies():
# In reality, this has do some parsing of Plink Makefiles and
# the Debian package metadata to get a real idea of the dependencies.
pass
@bottl... | ssssam/generic-concourse-ui | demo/server.py | Python | apache-2.0 | 5,271 |
# 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/devtestlabs/azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/aio/_configuration.py | Python | mit | 3,186 |
# -*- coding: utf-8 -*-
"""
Define the global constants for the problem.
"""
import math
import os
q = 0.5
b0 = 0.9
omegad = 2.0 / 3.0
l = 9.8
m = 1.0
g = 9.8
tmax = 1000
theta0_degree = 25.0
theta0 = math.radians(theta0_degree)
dt = 0.05
bstep = 0.05
path = "plots/"
os.system("pause")
| NicovincX2/Python-3.5 | Statistiques/Économétrie/Série temporelle/Damped-driven pendulum/tsa_constants.py | Python | gpl-3.0 | 299 |
# indent with 4 spaces (most editors can be set to
# put 4 spaces when hitting tab)
# if something is unclear, see
# http://wiki.ros.org/PyStyleGuide
# and
# http://legacy.python.org/dev/peps/pep-0008
# its recommended to check if the code follows the
# pep8 formatting with an linter.
# see http://legacy.python.org/de... | andreasBihlmaier/arni | code-examples/SomeClass.py | Python | bsd-2-clause | 2,386 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import url, include
from rest_framework import routers
from shop.forms.checkout import ShippingAddressForm, BillingAddressForm
from shop.views.address import AddressEditView
from shop.views.cart import CartViewSet, WatchViewSet
from... | nimbis/django-shop | shop/urls/rest_api.py | Python | bsd-3-clause | 1,168 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Miniforge3(Package):
"""Miniforge3 is a minimal installer for conda specific to conda-forg... | LLNL/spack | var/spack/repos/builtin/packages/miniforge3/package.py | Python | lgpl-2.1 | 2,134 |
# -*- coding: utf-8 -*-
import os
import re
import json
import pathlib
from lxml import html
from dota import api
from dota.helpers import cached_games
def fetch_new_match_ids(match_ids_path):
"""
Get new match ids from datdota.
Parameters
----------
id_store : path to text file with matches ... | TomAugspurger/dota | dota/scripts/get_pro_matches.py | Python | mit | 2,765 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os
import time
import datetime
import string
import random
import re
from google.appengine.api import mail
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webap... | vofo-no/reisestipend | myapp/views.py | Python | mit | 13,319 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python3-sdk | groupdocs/models/ChangesResponse.py | Python | apache-2.0 | 1,137 |
#
# Candelabra
#
# Copyright Alvaro Saurin 2013 - All right Reserved
#
from logging import getLogger
from candelabra.plugins import CommandPlugin
from candelabra.boxes import boxes_storage_factory
from candelabra.errors import ImportException
logger = getLogger(__name__)
class ImportCommandPlugin(CommandPlugin):
... | inercia/candelabra | candelabra/command/import/command.py | Python | bsd-2-clause | 1,875 |
# -*- coding: utf-8 -*-
import sqlalchemy
POOL_SIZE = 128
MYSQL_DEFAULT_CONFIGS = {
'user': 'wiki_bot',
'pass': '31415',
'host': 'localhost',
'port': '3306',
'database': 'wiki_ua',
}
def create_engine(configs=None):
configs = configs or MYSQL_DEFAULT_CONFIGS
url = u'mysql+pymysql://{u... | Lamzin/wiki-parser | wiki_parser/configs/db.py | Python | gpl-3.0 | 481 |
from django.conf import settings
import elasticsearch
from django.core.exceptions import ImproperlyConfigured
import json
from tastypie.exceptions import BadRequest
try:
ES_PREFIX = settings.ES_PREFIX
except AttributeError:
raise ImproperlyConfigured(
"You must set the index prefix for cbh datastor... | thesgc/cbh_datastore_ws | cbh_datastore_ws/elasticsearch_client.py | Python | mit | 2,821 |
# Copyright (C) 2019 Philipp Hörist <philipp AT hoerist.com>
#
# This file is part of nbxmpp.
#
# 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 opt... | gajim/python-nbxmpp | nbxmpp/modules/http_upload.py | Python | gpl-3.0 | 2,899 |
# Copyright (c) 2013 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 ... | kalrey/swift | test/unit/common/middleware/helpers.py | Python | apache-2.0 | 4,791 |
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
# Quickly and dirtily modified by Mustafa Al-Bassam (mus@musalbas.com) to test
# the Alexa top X.
# Usage example: python ssltest.py top-1m.csv 10
impo... | 1n/heartbleed-masstest | ssltest.py | Python | cc0-1.0 | 5,278 |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | squirrelo/qiita | qiita_db/handlers/tests/test_reference.py | Python | bsd-3-clause | 1,953 |
"""State API tests.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import json
import zlib
import mock
import treadmill.utils
from treadmill.api import state
def _create_zkclient_mock(placemen... | Morgan-Stanley/treadmill | lib/python/treadmill/tests/api/state_test.py | Python | apache-2.0 | 8,703 |
"""
Init file.
"""
from flask import Flask
import flask.ext.uploads as uploads
flask_app = Flask(__name__)
flask_app.config.from_object('app.config')
flask_app.config.from_envvar('FLASKR_SETTINGS', silent = True)
files_uploads = uploads.UploadSet(extensions = uploads.ALL)
uploads.configure_uploads(flask_app, files... | rubikonx9/valvis | app/__init__.py | Python | gpl-2.0 | 361 |
# $Id$
#
# pjsua2 Setup script.
#
# Copyright (C)2012 Teluu Inc. (http://www.teluu.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) a... | pol51/PJSIP-CMake | pjsip-apps/src/swig/python/setup.py | Python | gpl-2.0 | 3,527 |
# start the service
twitter = Runtime.start("twitter","Twitter") | MyRobotLab/pyrobotlab | service/Twitter.py | Python | apache-2.0 | 64 |
__author__ = 'maru'
__copyright__ = "Copyright 2013, ML Lab"
__version__ = "0.1"
__status__ = "Development"
import sys
import os
sys.path.append(os.path.abspath("."))
from experiment_utils import *
import argparse
from sklearn.datasets.base import Bunch
from sklearn import linear_model
import time
from sklearn imp... | mramire8/active | experiment/anytimev2.py | Python | apache-2.0 | 13,575 |
#!/usr/bin/python
import os.path
import unittest
def get_tests():
start_dir = os.path.dirname(__file__)
return unittest.TestLoader().discover(start_dir, pattern="*.py") | kamaxeon/prpg | tests/__init__.py | Python | apache-2.0 | 177 |
## begin license ##
#
# "Digitale Collectie ErfGeo Enrichment" is a service that attempts to automatically create
# geographical enrichments for records in "Digitale Collectie" (http://digitalecollectie.nl)
# by querying the ErfGeo search API (https://erfgeo.nl/search).
# "Digitale Collectie ErfGeo Enrichment" is devel... | seecr/dc-erfgeo-enrich | test/adoptoaisetspecstest.py | Python | gpl-2.0 | 4,711 |
# $Id: setup.py 4429 2007-10-17 22:15:06Z ckuethe $
# Creates build/lib.linux-${arch}-${pyvers}/gpspacket.so,
# where ${arch} is an architecture and ${pyvers} is a Python version.
from distutils.core import setup, Extension
import os
import sys
needed_files = ['packet_names.h', 'gpsfake.1', 'gpsprof.1']
created_file... | gnehzuil/GeoSVR | src/system/lib/gpsd-2.35/setup.py | Python | gpl-2.0 | 1,042 |
""" Class to handle date-parsing and formatting """
# Workaround for http://bugs.python.org/issue8098
import _strptime # pylint: disable=unused-import
from datetime import datetime
import time
class DateUtils(object):
""" Class to handle date-parsing and formatting """
date_format = '%Y-%m-%dT%H:%M:%SZ'
... | sebastian-steinmann/kodi-repo | src/service.library.video/resources/lib/date_utils.py | Python | mit | 1,538 |
# coding: utf-8
"""
MAGE parameter module models and helpers file.
Useful functions (part of the API) are :
- getParam
- setParam
- getMyParams
- setOrCreateParam
@license: Apache License, Version 2.0
@copyright: 2007-2013 Marc-Antoine Gouillart
@author: Marc-Antoin... | marcanpilami/MAGE | ref/models/parameters.py | Python | apache-2.0 | 5,027 |
import theano.tensor as T
import theano
from theano.tensor.nnet import conv
from theano.tensor.signal import pool
import numpy as np
class CNNLayerWithMaxPool(object):
def __init__(self,rng,input,filter_shape,im_shape,pooling=(2,2)):
self.input = input
fin = filter_shape[1]*filter_shape[2]... | raghavgupta0296/Learning-Deep-Learning-Libraries | TheanoCNN/CNNLayer.py | Python | mit | 1,296 |
#encoding:utf-8
__authors__ = ['wei keke']
__version__ = "V0.1"
'''
# ChangeLog:
#---------------------------------------------------------------------------------
# Version Date Desc Author
#-----------------------------------------------------------------------------... | faylau/oVirt3.3WebAPITest | src/TestData/Network/ITC06010401_UpdateNetwork.py | Python | apache-2.0 | 1,115 |
#!/usr/bin/env python
"""A remote data store using HTTP."""
import base64
import binascii
import httplib
import random
import re
import socket
import threading
import time
import urlparse
import logging
from grr.lib import access_control
from grr.lib import config_lib
from grr.lib import data_store
from grr.lib imp... | destijl/grr | grr/lib/data_stores/http_data_store.py | Python | apache-2.0 | 29,623 |
# -*- coding: utf-8 -*-
from openerp import SUPERUSER_ID
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.addons.decimal_precision as dp
class product(osv.osv):
_inherit = "product.product"
def get_product_available(self, cr, uid, ids, context=None):
""" Finds ... | ryepdx/kit_sale | product.py | Python | agpl-3.0 | 1,279 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-16 14:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | tiagoprn/experiments | django/drf_swagger/project/apps/core/migrations/0001_initial.py | Python | mit | 1,415 |
import hmac
import time
from django.conf import settings
from django.db import models
from tastypie.utils import now
try:
from hashlib import sha1
except ImportError:
import sha
sha1 = sha.sha
class ApiAccess(models.Model):
"""A simple model for use with the ``CacheDBThrottle`` behaviors."""
iden... | rtucker-mozilla/WhistlePig | vendor-local/lib/python/tastypie/models.py | Python | bsd-3-clause | 1,994 |
from polynomial import Poly
def LexPoly(*args):
"""Returns a polynomial with lexicographic order of terms. """
return Poly(*args, **{ 'order' : 'lex' })
from algorithms import poly_div, poly_pdiv, poly_groebner, poly_lcm, poly_gcd, \
poly_half_gcdex, poly_gcdex, poly_sqf, poly_resultant, poly_subresultan... | ryanGT/sympy | sympy/polys/wrappers.py | Python | bsd-3-clause | 2,095 |
#!/usr/bin/python3
from sys import argv, dont_write_bytecode
from os import listdir, system, getcwd, path
from re import findall
from json import loads, dumps
dont_write_bytecode = True
def runProject():
if not path.isdir(getcwd()+"/.jpy"):
print("Project not found!")
return Fals... | nauma/Java.py | .java.py/main.py | Python | gpl-2.0 | 5,912 |
# Copyright 2015 Hewlett Packard Development Company, LP
# Copyright 2015 Universidade Federal de Campina Grande
#
# 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://ww... | NaohiroTamura/ironic | ironic/tests/unit/drivers/modules/oneview/test_common.py | Python | apache-2.0 | 17,276 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class ConflictParent(Package):
homepage = 'https://github.com/tgamblin/callpath'
url = 'http... | iulian787/spack | var/spack/repos/builtin.mock/packages/conflict-parent/package.py | Python | lgpl-2.1 | 731 |
from pyblish import api
from pyblish_bumpybox import inventory
class ValidateGroupNode(api.InstancePlugin):
"""Validates group node.
Ensures none of the groups content is locally stored.
"""
order = inventory.get_order(__file__, "ValidateGroupNode")
optional = True
families = ["gizmo", "lut"... | Bumpybox/pyblish-bumpybox | pyblish_bumpybox/plugins/nuke/validate_group_node.py | Python | lgpl-3.0 | 1,217 |
# unpack sequences
a, = 1, ; print(a)
a, b = 2, 3 ; print(a, b)
a, b, c = 1, 2, 3; print(a, b, c)
a, = range(1); print(a)
a, b = range(2); print(a, b)
a, b, c = range(3); print(a, b, c)
(a) = range(1); print(a)
(a,) = range(1); print(a)
(a, b) = range(2); print(a, b)
(a, b, c) = range(3); print(a, b, c)
(a, (b, ... | mhoffma/micropython | tests/basics/unpack1.py | Python | mit | 1,794 |
"""An object-oriented interface to .netrc files."""
# Module and documentation by Eric S. Raymond, 21 Dec 1998
import os, shlex, stat
__all__ = ["netrc", "NetrcParseError"]
class NetrcParseError(Exception):
"""Exception raised on syntax errors in the .netrc file."""
def __init__(self, msg, filen... | Orav/kbengine | kbe/src/lib/python/Lib/netrc.py | Python | lgpl-3.0 | 5,890 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
map_instance = client.sync \... | teoreteetik/api-snippets | sync/rest/maps/retrieve-map/retrieve-map.6.x.py | Python | mit | 441 |
#!/usr/bin/env python
import argparse
import codecs
import logging
from collections import Counter
import unicodecsv as csv
import epitran
import epitran.flite
import panphon
logger = logging.getLogger('epitran')
def normpunc(flite, s):
def norm(c):
if c in flite.puncnorm:
return flite.pun... | dmort27/epitran | epitran/bin/connl2engipaspace.py | Python | mit | 2,078 |
from rest_framework.serializers import SerializerMethodField
from mkt.collections.serializers import (CollectionSerializer,
CollectionMembershipField)
from mkt.search.serializers import SimpleESAppSerializer
from mkt.webapps.serializers import SimpleAppSerializer
class BaseFi... | jinankjain/zamboni | mkt/fireplace/serializers.py | Python | bsd-3-clause | 2,011 |
from __future__ import unicode_literals
import json
import xmltodict
from jinja2 import Template
from six import iteritems
from moto.core.responses import BaseResponse
from .models import redshift_backends
def convert_json_error_to_xml(json_error):
error = json.loads(json_error)
code = error["Error"]["Cod... | william-richard/moto | moto/redshift/responses.py | Python | apache-2.0 | 28,522 |
#!/usr/bin/env python
'''
ArCom Rat Config Decoder
'''
__description__ = 'ArCom Rat Config Extractor'
__author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com'
__version__ = '0.1'
__date__ = '2014/04/10'
#Standard Imports Go Here
import os
import sys
import base64
import string
from optparse import ... | 0x0mar/RATDecoders | TEMPLATE.py | Python | gpl-3.0 | 3,894 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0048_enter_sends_default_to_false'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='pm_content_in_desktop_no... | mahim97/zulip | zerver/migrations/0049_userprofile_pm_content_in_desktop_notifications.py | Python | apache-2.0 | 404 |
"""Prototype-based fuzzy slope positions.
@author : Liangjun Zhu
@changelog:
- 15-03-20 - lj - initial implementation.
- 17-07-30 - lj - reorganize and incorporate with pygeoc.
"""
from __future__ import absolute_import, unicode_literals
import os
import sys
if os.path.abspath(os.path.join(sys.pat... | lreis2415/SEIMS | seims/preprocess/autofuzslppos/main.py | Python | gpl-3.0 | 884 |
import contexts
from unittest import mock
from poll import circuitbreaker, CircuitBrokenError
class WhenAFunctionWithCircuitBreakerDoesNotThrow:
def given_a_call_counter(self):
self.x = 0
self.expected_args = (1, 4, "hello")
self.expected_kwargs = {"blah": "bloh", "bleh": 5}
self.e... | benjamin-hodgson/poll | test/circuit_breaker_tests.py | Python | mit | 8,673 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.