code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
from __future__ import division
from sympy import (Basic, Symbol, sin, cos, exp, sqrt, Rational, Float, re, pi,
sympify, Add, Mul, Pow, Mod, I, log, S, Max, symbols, oo, Integer,
sign, im, nan, Dummy, factorial, comp, refine
)
from sympy.core.compatibility import long, range
from sympy.utilities.iterab... | maniteja123/sympy | sympy/core/tests/test_arit.py | Python | bsd-3-clause | 57,282 |
from django.template.defaultfilters import urlize
from django.test import SimpleTestCase
from django.utils.functional import lazy
from django.utils.safestring import mark_safe
from ..utils import setup
class UrlizeTests(SimpleTestCase):
@setup({'urlize01': '{% autoescape off %}{{ a|urlize }} {{ b|urlize }}{% en... | camilonova/django | tests/template_tests/filter_tests/test_urlize.py | Python | bsd-3-clause | 15,405 |
"""print git versioning info from working directory
written by Travis O'Brien, modified by Timothy W. Hilton
"""
import git
def print_cwd_git_version():
"""print git branch and revision hash from current working directory
"""
try:
_repo = git.Repo(search_parent_directories=True)
_git_sha ... | Timothy-W-Hilton/TimPyUtils | timutils/git_tools.py | Python | mit | 850 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gitmark.config import GitmarkSettings
import qiniu
QINIU_ACCESS_KEY = GitmarkSettings['qiniu']['access_key']
QINIU_SECRET_KEY = GitmarkSettings['qiniu']['secret_key']
QINIU_BUCKET_NAME = GitmarkSettings['qiniu']['bucket_name']
QINIU_URL = GitmarkSettings['qiniu']['b... | GitMarkTeam/gitmark | app/utils/wrap_qiniu.py | Python | gpl-2.0 | 710 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/ocil_2_0/ChoiceQuestionResultElement.py | Python | gpl-3.0 | 947 |
import sys
orig = ('>','<','+','-','.',',','[',']') # Origital set of instructions
new = ('→','←','↑','↓','↘','↙','↗','↖') # New set of instructions
### Verify input
if len(sys.argv) != 3:
print('''Usage:
python3 bf.py <input.bf> <output.bf>''')
sys.exit(0)
inFile = sys.argv[1]
outFile = sys.argv[2]
wit... | abcsds/Brainfuck | translator.py | Python | gpl-3.0 | 820 |
from .workflow_factory import workflow_factory
from noodles import (
schedule, has_scheduled_methods)
@has_scheduled_methods
class A(object):
def __init__(self, x):
super().__init__()
self.x = x
@schedule
def __call__(self, y):
return self.x * y
def __serialize__(self, pa... | NLeSC/noodles | test/workflows/class_methods.py | Python | apache-2.0 | 519 |
default_app_config = "Timeline.util" | Lapeth/timeline | Timeline/util/__init__.py | Python | apache-2.0 | 36 |
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <anki@ichi2.net>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import sre_constants
import cgi
import time
import re
from operator import itemgetter
import anki.hooks
import aqt
import aqt.modelchooser
from anki.lang import ngettext
f... | Stvad/anki | aqt/browser.py | Python | agpl-3.0 | 70,604 |
from pyqrllib.pyqrllib import bin2hstr
from qrl.core.State import State
from qrl.core.StateContainer import StateContainer
from qrl.core.VoteStats import VoteStats
from qrl.core.OptimizedAddressState import OptimizedAddressState
from qrl.core.MultiSigAddressState import MultiSigAddressState
from qrl.core.misc import l... | theQRL/QRL | src/qrl/core/txs/multisig/MultiSigSpend.py | Python | mit | 10,504 |
"""
Provide a mock switch platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.const import STATE_ON, STATE_OFF
from tests.common import MockToggleDevice
DEVICES = []
def init(empty=False):
"""Initialize the platform with devices."""
global DEVICES
DEVICE... | MungoRae/home-assistant | tests/testing_config/custom_components/light/test.py | Python | apache-2.0 | 630 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsAggregateCalculator.
From build dir, run: ctest -R PyQgsAggregateCalculator -V
.. 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 vers... | PeterPetrik/QGIS | tests/src/python/test_qgsaggregatecalculator.py | Python | gpl-2.0 | 23,395 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import os
import datetime
from path import Path
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import A4
from reportlab.platypus import (Paragraph, Table, TableStyle, Image... | yeleman/ramed-desktop | ramed/tools/ramed_form_pdf_export.py | Python | mit | 16,484 |
# -*- coding: utf-8 -*-
#
# Django documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 27 09:06:53 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... | dcroc16/skunk_works | google_appengine/lib/django-1.4/docs/conf.py | Python | mit | 9,063 |
'''Arsenal client hardware_profile command line helpers.
These functions are called directly by args.func() to invoke the
appropriate action. They also handle output formatting to the commmand
line.
'''
#
# Copyright 2015 CityGrid Media, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you... | CityGrid/arsenal | client/arsenalclient/cli/hardware_profile.py | Python | apache-2.0 | 2,867 |
# -*- coding: utf-8 -*-
import os
"""
Illustration d'un exercice de TD visant à montrer l'évolution temporelle de la
densité de probabilité pour la superposition équiprobable d'un état n=1 et
d'un état n quelconque (à fixer) pour le puits quantique infini.
Par souci de simplicité, on se débrouille pour que E_1/hbar... | NicovincX2/Python-3.5 | Physique/Physique quantique/Mécanique quantique/principe_de_superposition_lineaire.py | Python | gpl-3.0 | 1,519 |
from scipy.optimize import minimize, fmin_cobyla, fmin_tnc, fmin_slsqp, fmin_l_bfgs_b
from path_planning_analysis_cost_function import calibration_cost_function
from scipy.optimize import differential_evolution
x0 = [0.23, -0.08]
# print minimize(calibration_cost_function,x0, method='Nelder-Mead')
def c1(x):
# ... | NASLab/GroundROS | src/experimental_results/robot_calibration.py | Python | mit | 1,278 |
#!/usr/bin/env python
# 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... | nathanbjenx/cairis | cairis/bin/configure_cairis_db.py | Python | apache-2.0 | 7,476 |
#!/usr/bin/python3
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2011 - Quentin PARIS
import os, random, sys
import wx, lib.playonlinux as playonlinux
from lib.dpiFetcher import dpiFetcher
# Un ptit check
try:
os.environ["POL_OS"]
except:
print("ERROR ! Please define POL_OS environment var first.... | PlayOnLinux/POL-POM-4 | python/lib/Variables.py | Python | gpl-3.0 | 6,416 |
#!/usr/bin/env python
# Copyright (C) 2001 Jeff Epler <jepler@unpythonic.dhs.org>
# Copyright (C) 2006 Csaba Henk <csaba.henk@creo.hu>
#
# This program can be distributed under the terms of the GNU LGPL.
# See the file COPYING.
#
from __future__ import print_function
import os, sys
from errno import ... | libfuse/python-fuse | example/xmp.py | Python | lgpl-2.1 | 9,213 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Michael Krause ( http://krause-software.com/ ).
# You are free to use this code under the MIT license:
# http://opensource.org/licenses/MIT
"""Show some histograms for a directory a Xcode project files."""
from __future__ import print_function
imp... | mikr/xcodeprojer | examples/gidhistograms.py | Python | mit | 9,342 |
import os
import sys
import math
# The basis of these tests taken from:
# http://alias-i.com/lingpipe/docs/api/com/aliasi/spell/JaroWinklerDistance.html
#
# That page is the discussion of the method and the Java class. The actual tests
# are found in the source code, which I was able to download from
# http://alias-i.... | richmilne/JaroWinkler | jaro/jaro_tests.py | Python | gpl-3.0 | 6,744 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | devdattakulkarni/test-solum | solum/api/controllers/v1/service.py | Python | apache-2.0 | 3,292 |
# Copyright (C) 2011-2017 2ndQuadrant Limited
#
# This file is part of Barman.
#
# Barman 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 versio... | infoxchange/barman | barman/postgres.py | Python | gpl-3.0 | 50,903 |
# -*- coding: utf-8 -*-
from functools import wraps
from flask import abort
from flask_login import current_user
from .models import Permission
'''
如果用户不具有指定权限,则返
回 403 错误码 :HTTP“禁止”错误
'''
#检查常规权限
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwar... | staneyffer/my_blog | app/decorators.py | Python | mit | 764 |
#!/usr/bin/python3
"""
================================================
ABElectronics ADC Pi V2 8-Channel ADC
Version 1.0 Created 29/02/2015
Requires python 3 smbus to be installed
================================================
"""
class ADCPi:
# internal variables
__address = 0x68 # default address for... | cmac4603/Home-Utilities-App | aux_files/ABE_ADCPi.py | Python | gpl-2.0 | 11,057 |
#!/galaxy/home/mgehrin/hiclib/bin/python
"""
Read a maf file from stdin and write out a new maf with only blocks having all
of the required in species, after dropping any other species and removing
columns containing only gaps.
usage: %prog species,species2,... < maf
"""
import psyco_full
import bx.align.maf
import... | bxlab/HiFive_Paper | Scripts/HiCLib/bx-python-0.7.1/build/scripts-2.7/maf_limit_to_species.py | Python | bsd-3-clause | 953 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/cifar/hyperdeepensemble_configs/cifar100_retraining_sweep.py | Python | apache-2.0 | 3,405 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 Contributor
#
# 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... | stdweird/aquilon | lib/python2.6/aquilon/worker/dbwrappers/sandbox.py | Python | apache-2.0 | 1,542 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder Team
#
# 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/l... | Danielweber7624/pybuilder | src/unittest/python/plugins/python/install_dependencies_plugin_tests.py | Python | apache-2.0 | 12,566 |
import requests
import json
from config import DEBUG
def get(url, query_data=None, headers=None, return_json=False):
res = requests.get(url, params=query_data, headers=headers)
if DEBUG:
print res.status_code
if return_json is True:
return res.json()
else:
return res.text
def... | jijoy/ptpc | url_runner.py | Python | mit | 968 |
#!/usr/bin/env python
############################################################################
#
# Copyright (c) 2012-2017 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | diydrones/ardupilot | Tools/scripts/uploader.py | Python | gpl-3.0 | 45,137 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-02 14:39
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reference', '0004_educationinstitution'),
]
operation... | uclouvain/osis | reference/migrations/0005_auto_20160902_1639.py | Python | agpl-3.0 | 5,965 |
from django.forms.util import flatatt
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django import forms
from django.forms import widgets
class GridWidget(widgets.Widget):
pass
class DateIntervalWidget(widgets.MultiWidget):
def __init__(self, attrs=None):
... | mrmuxl/keops | keops/forms/widgets.py | Python | agpl-3.0 | 484 |
import logging
from datetime import date
from app import app
from flask import render_template
log = logging.getLogger(__name__)
year = date.today().year
@app.errorhandler(404)
def page_not_found(e):
log.warning("Request returned error 404")
return render_template('404.html', posts=[], year=year), 404
@ap... | siketh/TRBlog | app/views/errors.py | Python | mit | 479 |
from django.core.exceptions import ValidationError
import mkt.site.tests
from mkt.ratings.validators import validate_rating
class TestValidateRating(mkt.site.tests.TestCase):
def test_valid(self):
for value in [1, 2, 3, 4, 5]:
validate_rating(value)
def test_invalid(self):
for v... | mudithkr/zamboni | mkt/ratings/tests/test_validators.py | Python | bsd-3-clause | 437 |
__author__ = 'civa'
import json
from shared import security
def pass_test():
str = '{"username":"test","password":"testpass"}'
data = json.loads(str)
input_pass = 'disaster'
hashed_pass = '+IOsYZLzXA9n5gbqURCGh7+2wObuZ9GuQgIyv35HtPPGLx7a'
result = security.check_hash(input_pass, hashed_pass, Fal... | Civa/Zenith | src/Backend/Distributed/hubs/auth/tests/utils_tests.py | Python | gpl-3.0 | 528 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | proyectos-analizo-info/pybossa-analizo-info | test/test_cache/__init__.py | Python | agpl-3.0 | 2,254 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module provides widgets to use aptdaemon in a GTK application.
"""
# Copyright (C) 2008-2009 Sebastian Heinlein <devel@glatzor.de>
#
# Licensed under the GNU General Public License Version 2
#
# This program is free software; you can redistribute it and/or modify
#... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/aptdaemon/gtk3widgets.py | Python | mit | 47,931 |
# //////////////////////////////////////////////////////////////////////
# //
# // Copyright (c) 2012 Audiokinetic Inc. / All Rights Reserved
# //
# //////////////////////////////////////////////////////////////////////
import platform
import BuildUtil
from BuildUtil import *
class DeployManager(object):
SupportedPla... | Khoyo/mini_ld_48 | Assets/Code/AkSoundEngine/Common/DeployIntegration.py | Python | gpl-3.0 | 4,595 |
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QVBoxLayout
from addie.rietveld.braggview import BraggView
from addie.rietveld.braggtree import BraggTree
def run(main_window=None):
# frame_graphicsView_bragg
graphicsView_layout = QVBoxLayout()
main_window.rietveld_ui.frame_graphicsView_bragg.setLay... | neutrons/FastGR | addie/initialization/widgets/rietveld_tab.py | Python | mit | 2,725 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | letiangit/802.11ah-ns3 | src/topology-read/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 171,132 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# 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.apach... | subramani95/neutron | neutron/tests/unit/test_dhcp_agent.py | Python | apache-2.0 | 63,931 |
"""Configure an azure search instance
-------------------------------------
How to use
-------------------------------------
python provision_azsearch.py -k <AZURE_SEARCH_ADMIN_KEY> -u <AZURE_SEARCH_URL> -c <SAVED_AZURE_search_resource> -d <DATA_SOURCE_CONFIG> [-b <skip|update|delete>]
"""
import os
import sys
impo... | obsoleted/azsearch_management | provision_azsearch.py | Python | mit | 7,204 |
#!/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 distributed... | emersonsoftware/ansiblefork | lib/ansible/modules/cloud/amazon/lambda.py | Python | gpl-3.0 | 17,176 |
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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... | mozilla/caseconductor-ui | ccui/static/models.py | Python | gpl-3.0 | 2,951 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011-today TaPo-IT (http://tapo-it.at) All Rights Reserved.
# Author: Wolfgang Taferner (w.taferner@tapo.at)
#
# This program is free software... | tapo-it/odoo-addons-worktrail | addons_worktrail/tapoit_hr_project/model/hr_attendance.py | Python | agpl-3.0 | 10,490 |
#!/usr/bin/python2.7 -tt
"""
Copyright (c) 2013, Adel Qodmani
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of con... | adel-qod/zipper | zipper.py | Python | bsd-2-clause | 6,014 |
#!/usr/bin/env python
'''
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")... | arenadata/ambari | ambari-agent/src/test/python/ambari_agent/TestAlertSchedulerHandler.py | Python | apache-2.0 | 10,134 |
import gtk
from uxie.utils import join_to_settings_dir
from uxie.actions import KeyMap
from uxie.floating import Manager as FeedbackManager
from uxie.plugins import Manager as PluginManager
import filelist
import clipboard
import fsutils
keymap = KeyMap(join_to_settings_dir('fmd', 'keys.conf'))
keymap.map_generic('r... | baverman/fmd | fmd/app.py | Python | mit | 2,333 |
"""
********************************************************************************
* Name: forms.py
* Author: Nathan Swain
* Created On: 2014
* Copyright: (c) Brigham Young University 2014
* License: BSD 2-Clause
********************************************************************************
"""
from django import f... | tethysplatform/tethys | tethys_portal/forms.py | Python | bsd-2-clause | 8,528 |
import datetime
from django.conf import settings
from django.db.backends.utils import truncate_name, typecast_date, typecast_timestamp
from django.db.models.sql import compiler
from django.db.models.sql.constants import MULTI
from django.utils import six
from django.utils.six.moves import zip, zip_longest
from django.... | tastynoodle/django | django/contrib/gis/db/models/sql/compiler.py | Python | bsd-3-clause | 14,013 |
#!/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 softwa... | shlomif/PySolFC | pysollib/games/klondike.py | Python | gpl-3.0 | 55,884 |
#!/usr/bin/env python
# Copyright (c) 2010-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 a... | heemanshu/swift_juno | test/unit/proxy/controllers/test_obj.py | Python | apache-2.0 | 25,863 |
#!/usr/bin/env python
from pandas_ml.core.accessor import _AccessorMethods, _attach_methods, _wrap_data_func
class NeighborsMethods(_AccessorMethods):
"""
Accessor to ``sklearn.neighbors``.
"""
_module_name = 'sklearn.neighbors'
_neighbor_methods = ['kneighbors_graph', 'radius_neighbo... | sinhrks/pandas-ml | pandas_ml/skaccessors/neighbors.py | Python | bsd-3-clause | 403 |
#!/usr/bin/env python3
'''
5.5-score_sequences.py
This script scores the rarity for each position in a set of antibody sequences
and identify those qualifying as "extremely rare."
Usage: 5.5-score_sequences.py QVQLVQ... -v IGHV1-2 [ --gssp GSSP.txt ] [options]
5.5-score_sequences.py -f input.fasta [ -v IG... | scharch/zap | mGSSP/5.5-score_sequences.py | Python | gpl-3.0 | 7,004 |
# -*- coding: utf-8 -*-
"""systemd_cleanup command.
@author: Tobias Hunger <tobias.hunger@gmail.com>
"""
from cleanroom.command import Command
from cleanroom.exceptions import GenerateError
from cleanroom.location import Location
from cleanroom.printer import trace
from cleanroom.systemcontext import SystemContext
... | hunger/cleanroom | cleanroom/commands/systemd_cleanup.py | Python | gpl-3.0 | 6,420 |
from hashlib import md5
from base64 import (b64encode, b64decode)
from Crypto.Cipher import DES, DES3
class PBECipher(object):
def pad(self, data):
# pkcs5 padding
n = 8 - (len(data) % 8)
if n == 0:
return data + chr(8) * 8
else:
return data + chr(n) * n
... | danieleandreatta/PyPBE | PyPBE/__init__.py | Python | bsd-2-clause | 1,453 |
# Copyright 2015-present The Scikit Flow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | sachinpro/sachinpro.github.io | tensorflow/examples/skflow/iris_save_restore.py | Python | apache-2.0 | 1,677 |
"""Simple W demo -- shows how to make a window, and bind a function to a "key" event."""
import W
# key callback function
def tester(char, event):
text = "%r\r%d\r%s\r%s" % (char, ord(char), hex(ord(chart)), oct(ord(char)))
window.keys.set(text)
# close callback
def close():
window.close()
# new window
... | xbmc/atv2 | xbmc/lib/libPython/Python/Mac/IDE scripts/Widget demos/KeyTester.py | Python | gpl-2.0 | 819 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('player', '0002_auto_20150221_2333'),
]
operations = [
migrations.AddField(
model_name='playlistitem',
... | crash843/share-fm | backend/share_fm/player/migrations/0003_playlistitem_playlist.py | Python | gpl-2.0 | 484 |
# -*- coding: utf-8 -*-
'''
Set of tools to manage images in base64
@author: Laurent GAY
@organization: sd-libre.fr
@contact: info@sd-libre.fr
@copyright: 2015 sd-libre.fr
@license: This file is part of Lucterios.
Lucterios is free software: you can redistribute it and/or modify
it under the terms of the GNU General ... | Lucterios2/core | lucterios/framework/filetools.py | Python | gpl-3.0 | 5,952 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | awslabs/aws-cfn-templates | aws/services/CloudFormation/MacrosExamples/StackMetrics/lambda/resource.py | Python | apache-2.0 | 2,099 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | eos/eve_obj/effect/warfare_buff/command_info.py | Python | lgpl-3.0 | 1,214 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from lxml import etree
def sustainab... | akvo/akvo-rsr | akvo/iati/exports/elements/sustainability.py | Python | agpl-3.0 | 873 |
#-*- encoding:utf-8 -*-
"""
@author: letian
@homepage: http://www.letiantian.me
@github: https://github.com/someus/
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import networkx as nx
import numpy as np
from . import util
from .Segmentation import... | someus/TextRank4ZH | textrank4zh/TextRank4Keyword.py | Python | mit | 5,710 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_ipv4_arp_oper.py | Python | apache-2.0 | 73,087 |
# Name: nansat_mapper_merisL1
# Purpose: Mapping for Meris-L1 data
# Authors: Anton Korosov
# Licence: This file is part of NANSAT. You can redistribute it or modify
# under the terms of GNU General Public License, v.3
# http://www.gnu.org/licenses/gpl-3.0.html
from vrt... | yuxiaobu/nansat | mappers/mapper_meris_l1.py | Python | gpl-3.0 | 6,729 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009, 2010, 2015, 2017-2018 Rocky Bernstein
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) ... | rocky/python2-trepan | trepan/processor/cmdbreak.py | Python | gpl-3.0 | 5,057 |
#
# Copyright 2012 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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 optio... | translate/translate | docs/_ext/translate_docs.py | Python | gpl-2.0 | 1,016 |
import shutil
import tempfile
from contextlib import contextmanager
import gnupg
from django.apps import AppConfig
from django.conf import settings
from darkknight.signals import key_created
from .models import EncryptedPrivateKey
class DarkKnightGpgConfig(AppConfig):
name = 'darkknight_gpg'
def ready(sel... | fusionbox/django-darkknight | darkknight_gpg/apps.py | Python | bsd-2-clause | 1,101 |
# Copyright 2021 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
class EventTrack(models.Model):
_inherit = 'event.track'
shared_price_event = fields.Boolean(
string='Shared price event', related='event_id.shared_pr... | avanzosc/odoo-addons | event_price_shared/models/event_track.py | Python | agpl-3.0 | 2,043 |
import copy
import json
import subprocess
from os import system
import pyrebase
import requests
import collections
from Firefly import aliases, logging, scheduler
from Firefly.const import API_ALEXA_VIEW, API_FIREBASE_VIEW, FIREFLY_SECURITY_MONITORING, SOURCE_LOCATION, SOURCE_TIME, TYPE_DEVICE, TYPE_ROUTINE
from Fire... | Firefly-Automation/Firefly | Firefly/services/firebase/firebase.py | Python | apache-2.0 | 29,353 |
# Copyright 2013 IBM Corp.
# 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 app... | vedujoshi/os_tempest | tempest/scenario/test_swift_basic_ops.py | Python | apache-2.0 | 4,211 |
# -*- coding: utf-8 -*-
"""
sphinx.writers.latex
~~~~~~~~~~~~~~~~~~~~
Custom docutils writer for LaTeX.
Much of this code is adapted from Dave Kuhlman's "docpy" writer from his
docutils sandbox.
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE fo... | SurfasJones/icecream-info | icecream/lib/python2.7/site-packages/sphinx/writers/latex.py | Python | mit | 58,296 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Aladom SAS & Hosting Dvpt SAS
from django.db.models import BooleanField
__all__ = [
'VariableHelpTextBooleanField',
]
class VariableHelpTextBooleanField(BooleanField):
"""Fixes an issue with help_text depending on a variable.
See https://github.com/Aladom/dja... | Aladom/django-mailing | mailing/models/fields.py | Python | mit | 614 |
from bempy import context_blocks
context_blocks('dropdown', locals())
| svetlyak40wt/bempy | bempy/django/blocks/dropdown/__init__.py | Python | bsd-3-clause | 71 |
#!/usr/bin/env python3
import sys
import os
#sys.path.append(os.path.join(sys.path[0],"..","..","kicad_mod")) # load kicad_mod path
# export PYTHONPATH="${PYTHONPATH}<path to kicad-footprint-generator directory>"
sys.path.append(os.path.join(sys.path[0], "..", "..", "..")) # load parent path of KicadModTree
import a... | SchrodingersGat/kicad-footprint-generator | scripts/Connector/Connector_JST/conn_jst_eh_tht_top.py | Python | gpl-3.0 | 7,412 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: timer.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from contextlib import contextmanager
import time
from collections import defaultdict
import six
import atexit
from .stat import StatCounter
from . import logger
__all__ = ['total_timer', 'timed_operation',
... | czhu95/ternarynet | tensorpack/utils/timer.py | Python | apache-2.0 | 1,714 |
"""
Support for the Microsoft Cognitive Services text-to-speech service.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/tts.microsoft/
"""
from http.client import HTTPException
import logging
import voluptuous as vol
from homeassistant.components.tts ... | jamespcole/home-assistant | homeassistant/components/microsoft/tts.py | Python | apache-2.0 | 3,963 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | FNST-OpenStack/horizon | openstack_dashboard/contrib/sahara/content/data_processing/jobs/tabs.py | Python | apache-2.0 | 1,331 |
import collections
import curses
from visidata import vd, VisiData, BaseSheet, Sheet, ColumnItem, Column, RowColorizer, options, colors, wrmap, clipdraw, ExpectedException, update_attr, MissingAttrFormatter
vd.option('disp_rstatus_fmt', ' {sheet.longname} {sheet.nRows:9d} {sheet.rowtype} {sheet.modifiedStatus} {shee... | saulpw/visidata | visidata/statusbar.py | Python | gpl-3.0 | 7,885 |
TEXT_ALIGN_LEFT = 0
TEXT_ALIGN_CENTER = 1
TEXT_ALIGN_RIGHT = 2
def drawtextcentered(surface, position, font, text="", aa=1, color=(255, 255, 255), alignment=(1, 1)):
surf = font.render(text, aa, color)
rect = surf.get_rect()
newpos = [0, 0]
for i in range(2):
if alignment[i] == TEXT_ALIGN_LEFT... | mousetail/WOAIII-mousetail | textutil.py | Python | mit | 1,167 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.battle.MovieCamera
from panda3d.direct import ShowInterval, WaitInterval
from panda3d.core import Camera, Point3, lookAt
from direct.interval.IntervalGlobal import *
from BattleBase import *
from BattleProps import *
from toontown.toonbase.Toonto... | DedMemez/ODS-August-2017 | battle/MovieCamera.py | Python | apache-2.0 | 38,639 |
#: E101 W191
for a in 'abc':
for b in 'xyz':
print a # indented with 8 spaces
print b # indented with 1 tab
#: E101 E122 W191 W191
if True:
pass
change_2_log = \
"""Change 2 by slamb@testclient on 2006/04/13 21:46:23
creation
"""
p4change = {
2: change_2_log,
}
class TestP4Poller(unittest.Test... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pycodestyle/testsuite/E10.py | Python | mit | 740 |
# coding: utf-8
#
# Copyright 2021 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | kevinlee12/oppia | core/jobs/batch_jobs/exp_recommendation_computation_jobs.py | Python | apache-2.0 | 7,157 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
from pylab import *
import numpy as np
import sys
sys.path.insert(0, '../')
import kicks
params = {'backend': 'pdf',
'figure.figsize': [4.3, 3.0],
'font.family':'serif',
'font.size':10,
'font.serif': '... | orlox/massive_bins_2015 | 2016_ULX/scripts/NSBH/kick_result.py | Python | gpl-3.0 | 4,074 |
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
#############################################################################... | evoskuil/czmq | bindings/python_cffi/czmq_cffi/Zfile.py | Python | mpl-2.0 | 6,377 |
# encoding: UTF-8
#
# Copyright 2012-2013 Alejandro Autalán
#
# This program 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 distributed in the hope that it will be useful, but
#... | mhcrnl/pygubu | pygubudesigner/previewer.py | Python | gpl-3.0 | 20,513 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import Dataset
import numpy as np
class MiniBatches(Dataset):
"""
Convert data into mini-batches.
"""
def __init__(self, dataset, batch_size=20, cache=True):
self.origin = dataset
self.size = batch_size
self._cached_train_s... | zomux/deepy | deepy/dataset/mini_batch.py | Python | mit | 2,262 |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2015, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... | VOLTTRON/volttron-applications | pnnl/deprecated/TCMAgent/setup.py | Python | bsd-3-clause | 3,996 |
from udata.utils import safe_unicode
from udata.forms import Form, fields, validators
from udata.i18n import lazy_gettext as _
from .actions import list_backends
from .models import VALIDATION_STATES, VALIDATION_REFUSED
__all__ = 'HarvestSourceForm', 'HarvestSourceValidationForm'
class HarvestConfigField(fields.Di... | etalab/udata | udata/harvest/forms.py | Python | agpl-3.0 | 3,389 |
class DiffRegion(object):
def __init__(self, id_, sourceFilePath, lineSpan, charSpan, enclosingMethodDefId):
self.id = id_
self.sourceFilePath = sourceFilePath
self.lineSpan = lineSpan
self.charSpan = charSpan
self.enclosingMethodDefId = enclosingMethodDefId
def ... | victorclf/jcc-web | server/src/model/diff_region.py | Python | agpl-3.0 | 448 |
from ldotcommons.sqlalchemy import create_session, declarative
from sqlalchemy import Column, String, Integer
import json
import pickle
from sqlalchemy.orm import exc
_UNDEF = object()
def keyvaluemodel_for_session(name, session, tablename=None):
base = declarative.declarative_base()
base.metadata.bind = ses... | ldotlopez/ldotcommons | ldotcommons/keyvaluestore.py | Python | gpl-2.0 | 4,184 |
'''
Copyright (c) 2011-2015, Agora Games, LLC All rights reserved.
https://github.com/agoragames/haigha/blob/master/LICENSE.txt
'''
from chai import Chai
from haigha.channel import Channel
from haigha.classes import channel_class
from haigha.classes.protocol_class import ProtocolClass
from haigha.classes.channel_cla... | lipixun/haigha | tests/unit/classes/channel_class_test.py | Python | bsd-3-clause | 8,531 |
# coding=utf-8
import time
import os
from selenium import webdriver
from selenium.webdriver.remote.webdriver import WebElement
from selenium.webdriver.common.by import By
UPLOAD_EXE_PATH = os.path.join(os.path.dirname(__file__), 'upload.exe')
def time_check(func):
def wrapper(*args, **kwargs):
t1 = time.... | yuyu1987/pithy-test | pithy/app.py | Python | apache-2.0 | 2,051 |
# -*- coding: utf-8 -*-
def before_related(adminform):
adminform.fieldsets_before = adminform.fieldsets
adminform.fieldsets_after = []
try:
adminform.fieldsets_before = adminform.fieldsets[:adminform.fieldsets.index(('related_go_here', {'fields': []}))]
adminform.fieldsets_after = adminform.... | Depado/starmato-admin | starmato/admin/templatetags/_fieldset_related.py | Python | mit | 976 |
from typing import Tuple
from pyspades.constants import (
BLUE_FLAG, GREEN_FLAG,
CTF_MODE,
BLUE_BASE, GREEN_BASE,
)
from pyspades.entities import Flag, Base
from pyspades.protocol import BaseProtocol
class Team:
score = None
flag = None
base = None
other = None
protocol = None
name... | piqueserver/piqueserver | pyspades/team.py | Python | gpl-3.0 | 3,117 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test... | Diapolo/bitcoin | qa/rpc-tests/p2p-segwit.py | Python | mit | 73,280 |
import cgi
import datetime
import urllib
import webapp2
import logging
import os
import json
import random
# GAE
from google.appengine.ext import ndb
from google.appengine.api import users
# 3rd party
import jinja2
import twitter
import keys
# Templating
jinja_environment = jinja2.Environment(loader=jinja2.FileSystemL... | adamlofting/socialstatstracker | main.py | Python | apache-2.0 | 9,394 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.