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 |
|---|---|---|---|---|---|
"""
connects database and establishes Models
"""
import secrets
import os
from flask import Flask
from peewee import *
from playhouse.flask_utils import FlaskDB
from playhouse.db_url import connect
dbUrl = 'mysql://{0}:{1}@{2}:{3}/{4}'.format(
os.environ['DB_USER'],
os.environ['DB_PW'],
os.environ['DB_HOS... | niole/gotea | dbConnection.py | Python | unlicense | 705 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api
from debug... | barct/odoo-coop | infocoop/models/ingresos_member.py | Python | gpl-3.0 | 3,065 |
# -*- coding: utf-8 -*-
import base64
import csv
import functools
import glob
import itertools
import jinja2
import logging
import operator
import datetime
import hashlib
import os
import re
import json
import sys
import time
import urllib2
import zlib
from xml.etree import ElementTree
from cStringIO import StringIO
... | LiveZenLK/CeygateERP | addons/web/controllers/main.py | Python | gpl-3.0 | 65,553 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import werkzeug.urls
from odoo import fields
from odoo import http
from odoo.http import request
from odoo.addons.website.models.website import unslug
from odoo.tools.translate import _
class WebsiteMembership(http.C... | chienlieu2017/it_management | odoo/addons/website_membership/controllers/main.py | Python | gpl-3.0 | 8,355 |
#!/usr/bin/env python
# coding:utf-8
# sname + birth rule
"""
Copyright (c) 2016-2017 LandGrey (https://github.com/LandGrey/pydictor)
License: GNU GENERAL PUBLIC LICENSE Version 3
"""
from __future__ import unicode_literals
from rules.SDrule import SDrule
from lib.data.data import pyoptions
def SB(sname, birth):
... | LandGrey/pydictor | rules/SB.py | Python | gpl-3.0 | 936 |
TThostFtdcTraderIDType = "string"
TThostFtdcInvestorIDType = "string"
TThostFtdcBrokerIDType = "string"
TThostFtdcBrokerAbbrType = "string"
TThostFtdcBrokerNameType = "string"
TThostFtdcExchangeInstIDType = "string"
TThostFtdcOrderRefType = "string"
TThostFtdcParticipantIDType = "string"
TThostFtdcUserIDType = "string"... | andrewchenshx/vnpy | vnpy/api/ctp/generator/ctp_typedef.py | Python | mit | 28,738 |
#!/usr/bin/env python
"""
moveit_ik_demo.py - Version 0.1 2014-01-14
Use inverse kinemtatics to move the end effector to a specified pose
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2014 Patrick Goebel. All rights reserved.
This program is free software; you c... | peterheim1/robbie_ros | robbie_moveit/nodes/get_box.py | Python | bsd-3-clause | 3,864 |
from django.conf.urls import patterns, url
from .views import EmailAlternativeView
urlpatterns = patterns(
'',
url(r'^email_alternative/(?P<pk>\d+)/$',
EmailAlternativeView.as_view(),
name='email_alternative'),
) | bigmassa/django_mail_save | mail_save/urls.py | Python | mit | 238 |
#!/usr/bin/python
#
# 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 distribut... | kvar/ansible | lib/ansible/modules/network/cloudengine/ce_eth_trunk.py | Python | gpl-3.0 | 23,015 |
"""Parse (absolute and relative) URLs.
urlparse module is based upon the following RFC specifications.
RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
and L. Masinter, January 2005.
RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
and L.Masinter, Decemb... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/urlparse.py | Python | gpl-2.0 | 14,414 |
from bibliopixel.animation.strip import Strip
from bibliopixel.colors import COLORS
from bibliopixel.colors.arithmetic import color_scale
class ColorFade(Strip):
"""Fill the dots progressively along the strip."""
COLOR_DEFAULTS = ('colors', [COLORS.Red]),
def wave_range(self, start, peak, step):
... | ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/strip/ColorFade.py | Python | mit | 973 |
from unittest import TestCase
import re
from scrapy.http import Response, Request
from scrapy.spider import Spider
from scrapy.contrib.downloadermiddleware.cookies import CookiesMiddleware
class CookiesMiddlewareTest(TestCase):
def assertCookieValEqual(self, first, second, msg=None):
cookievaleq = lambd... | scrapinghub/scrapy | tests/test_downloadermiddleware_cookies.py | Python | bsd-3-clause | 6,842 |
#pylint: disable=invalid-name,too-many-branches
"""A script for generating DataCite DOI's for Mantid releases, to be called by
a Jenkins job during the release process. When given a major, minor and patch
release number along with username and password credentials, it will build a
DOI of the form "10.5286/Software/Man... | wdzhou/mantid | tools/DOI/doi.py | Python | gpl-3.0 | 22,271 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor 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 applicable... | tensorflow/tensor2tensor | tensor2tensor/models/video/emily_test.py | Python | apache-2.0 | 1,125 |
#!/usr/bin/env python
from data.hdf5 import taxi_it
from visualizer import Vlist, Point
_sample_size = 5000
if __name__ == '__main__':
points = Vlist(cluster=True)
for line in taxi_it('train'):
if len(line['latitude'])>0:
points.append(Point(line['latitude'][-1], line['longitude'][-1]))
... | Saumya-Suvarna/machine-learning | Route_prediction/visualizer/extractor/destinations.py | Python | apache-2.0 | 521 |
"""Tests for the data_helper.check module"""
import sys, unittest
from BaseTest import BaseTestWrapper
class IsBoolTestCase(BaseTestWrapper.BaseTest):
"""check.is_bool() test cases"""
def test_string(self):
"""Test if string is False"""
x = 'y'
self.assertFalse(self._bt['func'](x))
... | qevo/py_data_helper | tests/check.py | Python | mit | 6,291 |
class Calculator(object):
def add(self, operanda, operandb):
return operanda + operandb
| donlee888/JsObjects | Python/PythonTest02/src/calc/calculator.py | Python | mit | 123 |
# Copyright (c) 2011 Amit Levy <amit@amitlevy.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
# modify, merge,... | alevy/Dunbarify | handlers/circles.py | Python | mit | 1,739 |
# -*- coding: utf-8 -*-
#
# 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) any later version.
#
# This program is distributed in the hope ... | Farthen/OTFBot | otfbot/lib/pyniall.py | Python | gpl-2.0 | 7,446 |
# -*- coding:utf-8 -*-
from datetime import datetime
import time
from bson.objectid import ObjectId
from pymongo import ASCENDING, DESCENDING
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# todo change name
import turbo.model
import turbo.util
import turbo_motor.mode... | wecatch/app-turbo | demos/models/base.py | Python | apache-2.0 | 1,195 |
"""
Music loading.
"""
import os
import re
import time
import configobj
import taglib
from pisak import res, dirs, utils, logger
from pisak.audio import db_manager
_LOG = logger.get_logger(__name__)
_LIBRARY_DIR = dirs.get_user_dir("music")
_COVER_EXTENSIONS = [
".jpg", ".jpeg", ".png", ".bmp"]
_LOAD_TRACKE... | BrainTech/pisak | pisak/audio/data_loader.py | Python | gpl-3.0 | 4,509 |
# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
# Copyright (C) 2005 XenSource Ltd
# This file is subject to the terms and conditions of the GNU General
# Public License. See the file "COPYING" in the main directory of
# this archive for more details.
import threading
from xen.xend.xenstore.x... | andreiw/xen3-arm-tegra | tools/python/xen/xend/xenstore/xswatch.py | Python | gpl-2.0 | 2,161 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = '40523138'
SITENAME = '2016Fall CPA 課程網誌 (虎尾科大MDE)'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_LANG = 'en'
# Feed generation is usually no... | s40523138/2016fallcp_hw | pelicanconf.py | Python | agpl-3.0 | 1,952 |
#!/usr/bin/env python
# Copyright (c) 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Certificate chain where the intermediate restricts the extended key usage to
clientAuth, and the target asserts serverAuth + cli... | nwjs/chromium.src | net/data/verify_certificate_chain_unittest/intermediate-eku-clientauth/generate-chains.py | Python | bsd-3-clause | 1,005 |
from unittest import TestCase
from similarityPy.algorithms.find_nearest import FindNearest
from tests import test_logger
__author__ = 'cenk'
class FindNearestTest(TestCase):
def setUp(self):
pass
def test_algorithm(self):
test_logger.debug("FindNearestTest - test_algorithm Starts")
... | pombredanne/similarityPy | tests/algorihtm_tests/find_nearest_test.py | Python | mit | 651 |
# Copyright (C) 2016 Intel Corporation
# Released under the MIT license (see COPYING.MIT)
from time import sleep
from oeqa.core.case import OETestCase
from oeqa.core.decorator.oetimeout import OETimeout
class TimeoutTest(OETestCase):
@OETimeout(1)
def testTimeoutPass(self):
self.assertTrue(True, msg... | schleichdi2/OPENNFR-6.1-CORE | opennfr-openembedded-core/meta/lib/oeqa/core/tests/cases/timeout.py | Python | gpl-2.0 | 472 |
from core.vectors import PhpCode, ShellCmd, ModuleExec, Os
from core.module import Module
from core.loggers import log
from core import messages
import urlparse
import telnetlib
import time
class Tcp(Module):
"""Spawn a shell on a TCP port."""
def init(self):
self.register_info(
{
... | marrocamp/weevely3 | modules/backdoor/tcp.py | Python | gpl-3.0 | 3,520 |
"""Settings of Zinnia"""
from django.conf import settings
MEDIA_URL = getattr(settings, 'BLOGQUINTET_MEDIA_URL', '/blogquintet/')
| franckbret/django-blog-quintet | blogquintet/settings.py | Python | mit | 131 |
# encoding: utf-8
"""
encapsulation.py
Created by Thomas Mangin on 2014-06-20.
Copyright (c) 2014-2015 Orange. All rights reserved.
Copyright (c) 2014-2015 Exa Networks. All rights reserved.
"""
from struct import pack
from struct import unpack
from exabgp.bgp.message.update.attribute.community.extended import Exten... | lochiiconnectivity/exabgp | lib/exabgp/bgp/message/update/attribute/community/extended/encapsulation.py | Python | bsd-3-clause | 1,758 |
"""
Listens events:
forget (string)
Given string can be task name, remembered field (url, imdb_url) or a title. If given value is a
task name then everything in that task will be forgotten. With title all learned fields from it and the
title will be forgotten. With field value only that particular field i... | X-dark/Flexget | flexget/plugins/filter/seen.py | Python | mit | 11,743 |
from __future__ import absolute_import
from django.db import models
from sentry.db.models import BaseManager, FlexibleForeignKey
from . import AvatarBase
class UserAvatar(AvatarBase):
"""
A UserAvatar associates a User with their avatar photo File
and contains their preferences for avatar type.
"""... | beeftornado/sentry | src/sentry/models/useravatar.py | Python | bsd-3-clause | 820 |
"""Functions to plot epochs data
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Jaakko Leppakangas <jaeilepp@student.jyu.f... | cmoutard/mne-python | mne/viz/epochs.py | Python | bsd-3-clause | 62,694 |
#!/usr/bin/env python3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Meta checkout dependency manager for Git."""
# Files
# .gclient : Current client configuration, written by 'config' comm... | CoherentLabs/depot_tools | gclient.py | Python | bsd-3-clause | 121,375 |
#!/usr/bin/env python
'''
===============================================================================
Interactive Image Segmentation using GrabCut algorithm.
This sample shows interactive image segmentation using grabcut algorithm.
USAGE :
python grabcut.py <filename>
README FIRST:
Two windows will show ... | grace-/opencv-3.0.0-cvpr | opencv/samples/python2/grabcut.py | Python | bsd-3-clause | 6,057 |
from tempfile import gettempdir
from os.path import join, dirname
import example_project
ADMINS = (
)
MANAGERS = ADMINS
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DISABLE_CACHE_TEMPLATE = DEBUG
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = join(gettempdir(), 'django_ratings_example_project.db')
TEST_DATABASE_NAME =join(ge... | ella/django-ratings | tests/example_project/settings/config.py | Python | bsd-3-clause | 1,465 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-22 13:40
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0005_user_resume'),
]
operations = [
... | TexasLAN/texaslan.org | texaslan/users/migrations/0006_auto_20160822_0840.py | Python | mit | 745 |
#!/usr/bin/env python2
import dropbox, sys, os
prefix = "travis-kernel-ci"
d = os.getenv("TRAVIS_BUILD_ID")
if not d:
d = "trash"
n = os.getenv("KNAME")
if not n:
n = "undef"
access_token = os.getenv("DROPBOX_TOKEN")
client = dropbox.client.DropboxClient(access_token)
f = open(sys.argv[1])
fname = os.pa... | 0x7f454c46/travis-kernel-ci | dropbox_upload.py | Python | gpl-2.0 | 642 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from shoop.admin.module_registry import replace_modules
from s... | jorge-marques/shoop | shoop_tests/admin/test_product_module.py | Python | agpl-3.0 | 2,947 |
# -*- coding: utf-8 -*-
# This code is part of Amoco
# Copyright (C) 2006-2011 Axel Tillequin (bdcht3@gmail.com)
# published under GPLv2 license
"""
render.py
=========
This module implements amoco's pygments interface to allow pretty printed
outputs of tables of tokens built from amoco's expressions and instruction... | bdcht/amoco | amoco/ui/render.py | Python | gpl-2.0 | 18,256 |
# coding=utf-8
"""Dialog test.
.. note:: 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) any later version.
"""
__author__ = 'pna... | pnakis/qgis_vector_transform | test/test_vector_transform_dialog.py | Python | gpl-3.0 | 1,563 |
#############################################################################
# local_volume.py
# this file is part of GEOCUBIT #
# #
# Created by Emanuele Casarotti ... | casarotti/GEOCUBIT--experimental | geocubitlib/local_volume.py | Python | gpl-3.0 | 9,241 |
"""empty message
Revision ID: a9cb6e2602a8
Revises: 347c8c1b97d6
Create Date: 2016-03-24 17:26:15.753303
"""
# revision identifiers, used by Alembic.
revision = 'a9cb6e2602a8'
down_revision = '347c8c1b97d6'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | itsankoff/wordrunner | migrations/versions/a9cb6e2602a8_.py | Python | gpl-3.0 | 622 |
import os
import pwd
class NoSuchUser(Exception):
pass
class User:
def __init__(self, uid, gid, username, homedir):
self.uid = uid
self.gid = gid
self.username = username
self.homedir = homedir
def get_pegasus_dir(self):
return os.path.join(self.homedir, ".pegasu... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/user.py | Python | apache-2.0 | 1,084 |
from flask import g, jsonify
def register_token_endpoint(app, auth):
@app.route('/generate_token')
@auth.login_required
def get_auth_token():
token = g.user.generate_auth_token()
return jsonify({'token': token.decode('ascii')})
| totokaka/Powerfulperms-web | backend/backend/token_endpoint.py | Python | gpl-3.0 | 258 |
#!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | lociii/googleads-python-lib | examples/adspygoogle/dfp/v201306/get_all_cities.py | Python | apache-2.0 | 2,215 |
#!/usr/bin/env python
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
fro... | kk9599/osquery | tools/tests/test_release.py | Python | bsd-3-clause | 2,527 |
# -*- coding: ibm850 -*-
template_typed = """
#ifdef TYPED_METHOD_BIND
template<class T $ifret ,class R$ $ifargs ,$ $arg, class P@$>
class MethodBind$argc$$ifret R$$ifconst C$ : public MethodBind {
public:
$ifret R$ $ifnoret void$ (T::*method)($arg, P@$) $ifconst const$;
#ifdef DEBUG_METHODS_ENABLED
virtual Variant... | Paulloz/godot | core/make_binders.py | Python | mit | 12,675 |
# Copyright 2014: Intel Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | pandeyop/rally | tests/unit/benchmark/scenarios/neutron/test_network.py | Python | apache-2.0 | 24,839 |
# reverse the list in place
mylist = [1,2,3]
mylist.reverse()
print mylist
# [3,2,1]
# iterate in reverse
for e in reversed([1,2,3]):
print e,
# 3 2 1
| jabbalaci/PrimCom | data/python/my_reverse.py | Python | gpl-2.0 | 156 |
# some examples on views and copies from the NumPy tutorial
import numpy as np
a = np.arange(12)
# assignments
print "assignments"
b = a # no new object is created -- b and a point to the same object
print b is a
b.shape = 3,4 # changes the shape of a too
print a.shape
print " "
print a
print b
print " ... | bt3gl/Numerical-Methods-for-Physics | others/python/numpy-basics/numpy-copying.py | Python | apache-2.0 | 667 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from math import sin, cos, pi, trunc, modf, floor, sqrt, atan2
from json import load
GRID_SIZE_LON=0.0001
GRID_SIZE_LAT=0.0001
GRID_ORIG_LON=0
GRID_ORIG_LAT=0
class DegreesToMeter(object):
def __init__(self, filename):
f = open(filename)
self.data = load(f)
... | JeroenDeDauw/a4g | gridcalc/gridcalc.py | Python | gpl-3.0 | 5,278 |
# This file is part of browser, and contains classes for embeding windows,
# using the XEmbed protocol, in a gtk Socket.
#
# Copyright (C) 2009-2010 Josiah Gordon <josiahg@gmail.com>
#
# browser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | zepto/webbrowser | webbrowser/embed_sock.py | Python | gpl-3.0 | 8,423 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2011, 2012 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any... | jmacmahon/invenio | modules/bibauthorid/lib/bibauthorid_scheduler.py | Python | gpl-2.0 | 5,558 |
import datetime
import json
import discord
import os
from discord.ext import commands
from discord.ext.commands.converter import *
class CassandraContext(commands.Context):
def is_float(self, argument):
"""Checks if the argument is a float."""
try:
return float(string) # T... | NCPlayz/CassBotPy | cassandra/bot.py | Python | mit | 4,014 |
# -*- coding: utf-8 -*-
"""
Tests for tipfy.i18n
"""
from __future__ import with_statement
import datetime
import gettext as gettext_stdlib
import os
import unittest
from babel.numbers import NumberFormatError
from pytz.gae import pytz
from tipfy.app import App, Request, Response
from tipfy.handler import Reque... | pombreda/tipfy | tests/i18n_test.py | Python | bsd-3-clause | 20,797 |
#!/usr/bin/python
from Adafruit_CharLCD import Adafruit_CharLCD
lcd = Adafruit_CharLCD()
lcd.begin(16, 1)
lcd.clear()
lcd.message('Hello World\n')
lcd.message('From Me')
| CurtisIreland/electronics | RPi-CharDisp/HelloWorldLCD.py | Python | cc0-1.0 | 175 |
default_app_config = "test_custom_user_subclass.apps.CustomUserSubclassConfig"
| jcugat/django-custom-user | test_custom_user_subclass/__init__.py | Python | bsd-3-clause | 79 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from cristianismo_app import facade
from routes.cristianis... | RoAbreu/AulaJavaScripts | PROJETO/backend/appengine/routes/cristianismos/admin/new.py | Python | mit | 863 |
import json
from django.contrib.gis.geos import Point
from django.core.urlresolvers import resolve
from django.test import RequestFactory, TestCase
from mixer.backend.django import mixer
from .. import views
class IssueListViewTestCase(TestCase):
def setUp(self):
self.view = views.issue_list
se... | erickgnavar/saywiti | saywiti/api_v1/tests/test_views.py | Python | mit | 1,226 |
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello Franziska!"
if __name__ == "__main__":
app.run(port=8080)
| LK-data-analytics/tutorial | main/app.py | Python | apache-2.0 | 158 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Tftp(A10BaseClass):
"""Class Description::
NAT64 TFTP ALG (default: disabled).
Class tftp supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param tftp_enable: {"op... | amwelch/a10sdk-python | a10sdk/core/cgnv6/cgnv6_nat64_alg_tftp.py | Python | apache-2.0 | 1,186 |
# -*- coding: utf-8 -*-
"""
werkzeug.contrib.wrappers
~~~~~~~~~~~~~~~~~~~~~~~~~
Extra wrappers or mixins contributed by the community. These wrappers can
be mixed in into request objects to add extra functionality.
Example::
from werkzeug.wrappers import Request as RequestBase
... | jeremydane/Info3180-Project4 | server/lib/werkzeug/contrib/wrappers.py | Python | apache-2.0 | 10,609 |
#!/usr/bin/env python
"""
GeneOntology class specific tests
The database must be up and running for these tests to pass
See /htsint/database/HOWTO
"""
import sys,os,unittest,time,re,time
import matplotlib as mpl
if mpl.get_backend() != 'agg':
mpl.use('agg')
from htsint.database import ask_upass
from htsint import... | ajrichards/htsint | unittests/GeneOntologyTest.py | Python | bsd-3-clause | 1,983 |
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import re
class JSChecker(object):
def __init__(self, input_api, file_filter=None):
self.input_api = input_api
if file_fil... | guorendong/iridium-browser-ubuntu | third_party/trace-viewer/hooks/js_checks.py | Python | bsd-3-clause | 5,418 |
# Copyright 2015-2018 Capital One Services, 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 ... | FireballDWF/cloud-custodian | tools/c7n_azure/tests/test_cognitive_service.py | Python | apache-2.0 | 1,581 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... | 0xkag/tornado | tornado/httputil.py | Python | apache-2.0 | 27,943 |
#!/usr/bin/env python
"""This module contains tests for user API renderers."""
from grr.gui import api_test_lib
from grr.gui.api_plugins import user as user_plugin
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import hunts
from grr.lib im... | pombredanne/grr | gui/api_plugins/user_test.py | Python | apache-2.0 | 7,857 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Gregory Shulov (gregory.shulov@gmail.com)
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '... | photoninger/ansible | lib/ansible/modules/storage/infinidat/infini_host.py | Python | gpl-3.0 | 3,806 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import timedelta
from odoo import fields
from odoo.addons.stock.tests.common2 import TestStockCommon
class TestSaleStockLeadTime(TestStockCommon):
@classmethod
def setUpClass(cls):
super... | ddico/odoo | addons/sale_stock/tests/test_sale_stock_lead_time.py | Python | agpl-3.0 | 14,131 |
from google.appengine.ext import ndb
from google.appengine.ext import blobstore
class Likes(ndb.Model):
post = ndb.KeyProperty(kind='Post')
user_id = ndb.IntegerProperty(repeated=True)
like_count = ndb.IntegerProperty(default=0)
| ghoshabhi/Multi-User-Blog | models/likes_model.py | Python | mit | 242 |
from django.conf import settings
from django.contrib.sites.models import RequestSite
from django.contrib.sites.models import Site
from user_registration import signals
from user_registration.forms import RegistrationForm
from user_registration.models import RegistrationProfile
class DefaultBackend(object):
"""
... | commtrack/commtrack-core | apps/user_registration/backends/default/__init__.py | Python | bsd-3-clause | 5,410 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
requirements = [
'Click>=6.7',
'bioblend==0.16.0',
'wrapt',
'pyyaml',
'justbackoff',
'xunit-wrapper>=0.12... | galaxy-iuc/parsec | setup.py | Python | apache-2.0 | 1,747 |
from django.contrib import admin
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from waldur_core.core import admin as core_admin
from waldur_core.structure import admin as structure_admin
from . import executors, models
class JiraPropertyAdmin(
core_ad... | opennode/nodeconductor-assembly-waldur | src/waldur_jira/admin.py | Python | mit | 1,868 |
import os
import os.path
import sys
EXTRA_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__)))
if EXTRA_DIR not in sys.path:
sys.path.append(EXTRA_DIR)
import mapillary
import dao
class ListService:
def __init__(self, mysql_dao):
self.mysql_dao = mysql_dao
def ensure_list(self, user, l... | simonmikkelsen/mapillary-browser | api/services.py | Python | mit | 951 |
#!/usr/bin/python3
# Copyright 2020 Timothy Trippel
#
# 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 o... | googleinterns/hw-fuzzing | infra/base-sim/hwfutils/hwfutils/extract_kcov.py | Python | apache-2.0 | 2,676 |
# Copyright 2013-2016 Tom Eulenfeld, MIT license
import unittest
import warnings
import h5py
import numpy as np
from obspy import read
from obspy.core import UTCDateTime as UTC
from obspy.core.util import NamedTemporaryFile
from obspyh5 import readh5, writeh5, trace2group, iterh5, set_index
import obspyh5
class HDF5... | trichter/obspyh5 | test_obspyh5.py | Python | mit | 8,782 |
# -*- 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/v8/services/types/reach_plan_service.py | Python | apache-2.0 | 27,983 |
#!/usr/bin/python
#
# 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 distribut... | alxgu/ansible | lib/ansible/modules/network/fortimanager/fmgr_secprof_profile_group.py | Python | gpl-3.0 | 8,605 |
import re
from pathlib import Path
from shared import *
# Represent a Python 3 float losslessly as an SMT-LIBv2 Real of minimal length
def real_repr(f):
s = repr(float(f))
m1 = re.search(r'\.([0-9]+)', s)
prec = 0 if m1 is None else len(m1.group(1))
m2 = re.search(r'[Ee]([+-][0-9]+)', s)
prec -= 0... | martinjos/nn-circle | nn_smt2.py | Python | apache-2.0 | 5,455 |
import os
import uuid
from ..tools import row2dict, xls_reader
from datetime import datetime
from sqlalchemy import not_, func
from pyramid.view import (
view_config,
)
from pyramid.httpexceptions import (
HTTPFound,
)
import colander
from deform import (
Form,
widget,
ValidationFailure,
... | aagusti/e-gaji | egaji/views/m_group.py | Python | gpl-2.0 | 7,251 |
def binary(x):
return int(bin(x)[2:])
T = input()
while(T):
T -= 1
s1 = raw_input()
s2 = raw_input()
s1 = int(s1,2)
s2 = int(s2,2)
summ = s1+s2
con = binary(summ)
print con
print (s1+s2)%1000000007
| Dawny33/Code | HackerEarth/CodeCrunch/bin.py | Python | gpl-3.0 | 243 |
"""
@package mi.instrument.satlantic.ocr_507_icsw.ooicore.driver
@file marine-integrations/mi/instrument/satlantic/ocr_507_icsw/ooicore/driver.py
@author Godfrey Duke
@brief Instrument driver classes that provide structure towards interaction
with the Satlantic OCR507 ICSW w/ Midrange Bioshutter
"""
import time
import... | rmanoni/mi-instrument | mi/instrument/satlantic/ocr_507_icsw/ooicore/driver.py | Python | bsd-2-clause | 47,671 |
#!/bin/env python
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# logging_utils.py
''' Utility functions and objects for logging.
'''
import logging
import sys
class StdoutStderrHandler(loggi... | Crystalnix/house-of-life-chromium | tools/python/google/logging_utils.py | Python | bsd-3-clause | 2,700 |
from __future__ import division, print_function
import sys
sys.path.append("../lib")
import logging
import theano
import theano.tensor as T
from theano import tensor
from blocks.bricks.base import application, lazy
from blocks.bricks.recurrent import BaseRecurrent, recurrent
from blocks.bricks import Random, Initia... | drewlinsley/draw_classify | draw/draw_backup.py | Python | mit | 12,934 |
from nose.tools import assert_true
import numpy as np
import numpy.testing as npt
from dipy.data import get_data
from dipy.core.gradients import (gradient_table, GradientTable,
gradient_table_from_bvals_bvecs)
from dipy.io.gradients import read_bvals_bvecs
def test_btable_prepare():
... | samuelstjean/dipy | dipy/core/tests/test_gradients.py | Python | bsd-3-clause | 5,975 |
o = object()
if callable(o):
o(42, 3.14)
<warning descr="'o' is not callable">o(-1)</warning>
| ivan-fedorov/intellij-community | python/testData/inspections/PyCallingNonCallableInspection/callableCheck.py | Python | apache-2.0 | 98 |
import os
import sys
from distutils.core import setup
from distutils.sysconfig import get_python_lib
# Warn if we are installing over top of an existing installation. This can
# cause issues where files that were deleted from a more recent Django are
# still present in site-packages. See #18115.
overlay_warning = Fal... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/setup.py | Python | bsd-3-clause | 4,542 |
"""Database module, including the SQLAlchemy database object and DB-related
utilities.
"""
from sqlalchemy.orm import relationship
import datetime
from .extensions import db
from .compat import basestring
# Alias common SQLAlchemy names
Column = db.Column
class CRUDMixin(object):
"""Mixin that adds convenience ... | tyler274/Recruitment-App | recruit_app/database.py | Python | bsd-3-clause | 2,879 |
import os
import unittest
import yaml
from pyvcloud.vcd.client import BasicLoginCredentials
from pyvcloud.vcd.client import Client
from pyvcloud.vcd.org import Org
from pyvcloud.vcd.test import TestCase
class UpdateCatalog(TestCase):
def test_create_catalog(self):
logged_in_org = self.client.get_org()
... | pacogomez/pyvcloud | tests/vcd_catalog_update.py | Python | apache-2.0 | 993 |
from kalibro_client.base import attributes_class_constructor, \
entity_name_decorator
from kalibro_client.processor.base import Base
from kalibro_client.miscellaneous import NativeMetric
from kalibro_client.errors import KalibroClientNotFoundError, KalibroClientRequestError
@entity_name_decorator
class MetricColle... | mezuro/kalibro_client_py | kalibro_client/processor/metric_collector_details.py | Python | lgpl-3.0 | 2,205 |
def score(arr):
return (sum(x*0.8**i for i,x in enumerate(arr))/5)
def main():
n = int(input())
scores = [int(input()) for _ in range(n)]
print('%.6f' % score(scores))
print('%.6f' % (sum(score(scores[:i]+scores[i+1:]) for i in range(n))/n))
if __name__ == "__main__":
main() | JonSteinn/Kattis-Solutions | src/School Spirit/Python 3/main.py | Python | gpl-3.0 | 301 |
import codecs
import math
import sys
tupl = [];
lista = [];
fileName = sys.argv[1]
outputFile = codecs.open(fileName, encoding='utf-8', mode='r')
data = ""
while True:
c = outputFile.read(1)
if c is None or len(c) == 0:
break;
index = ord(c)
if index == 0:
index = 0
size = 0
elif index % 2 == 1:
ind... | hpanago/LZ77-LZ78 | lz77/unlz77.py | Python | gpl-2.0 | 791 |
"""AMQP Connections"""
# Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# 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) ... | DESHRAJ/fjord | vendor/packages/amqp/amqp/connection.py | Python | bsd-3-clause | 34,121 |
"""Knuth-Morris-Pratt finds the 1st occurrence of a pattern in a text string wo/backing-up."""
import collections as cx
class KMP(object): # O ~ txtlen + patlen * alphabet-size (wc)
"""finds the first occurrence of a pattern string in a text string."""
def __init__(self, pat):
"""Preprocesses the pat string.... | dvklopfenstein/PrincetonAlgorithms | py/AlgsSedgewickWayne/KMP.py | Python | gpl-2.0 | 1,775 |
"""
Use this plugin to activate coverage report.
To install this plugin, you need to activate ``coverage-plugin``
with extra requirements :
::
$ pip install nose2[coverage-plugin]
Next, you can enable coverage reporting with :
::
$ nose2 --with-coverage
Or with this lines in ``unittest.cfg`` :
::
... | drnextgis/QGIS | python/ext-libs/nose2/plugins/coverage.py | Python | gpl-2.0 | 2,893 |
from django.core.management.base import BaseCommand
import logging
import sys
DEFAULT_VERBOSITY = 1
VERBOSITY_LOG_MAP = {
0: logging.WARN,
1: logging.INFO,
2: logging.DEBUG,
3: logging.DEBUG,
}
class CustomBaseCommand(BaseCommand):
'''
Management command with a convenient self.log.info shortc... | danosaure/Django-facebook | django_facebook/management/commands/base.py | Python | bsd-3-clause | 1,339 |
#! /usr/bin/python
# encoding: utf-8
d1 = dict(a=1, b=[1,2,3], c=tuple([1,2,3]))
d2 = {'a':1, 'b':[1,2,3], 'c':tuple([1,2,3])}
print d1, '\n', d2
print d1 == d2
print d1 is d2
d3 = d2
print d2 is d3
t1 = tuple([1,2,3])
t2 = tuple([1,2,3])
t3 = t2
print '\n'
print t1==t2
print t3==t2
print t1 is t2
print t3 is t2
| kumalee/python-101 | part-2/collect/dicts.py | Python | mit | 316 |
"""
pyexcel.internal.source_plugin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Second level abstraction
:copyright: (c) 2015-2020 by Onni Software Ltd.
:license: New BSD License
"""
from pyexcel import constants as constants
from pyexcel import exceptions as exceptions
from lml.plugin import PluginManager
fro... | chfw/pyexcel | pyexcel/internal/source_plugin.py | Python | bsd-3-clause | 5,534 |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from users.api import UserViewSet
router = DefaultRouter()
router.register('user', UserViewSet, base_name='user')
urlpatterns = [
url(r'1.0/', include(router.urls)), # include de las url's router
]
| krainet/Wordplease | users/api_urls.py | Python | mit | 320 |
## Administrator interface for BibIndex
## This file is part of Invenio.
## Copyright (C) 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
## Licen... | valkyriesavage/invenio | modules/bibharvest/lib/oai_harvest_admin.py | Python | gpl-2.0 | 65,264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.