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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Ryan Brown <sb@ryansb.com>
#
# This file is part of ipylogue.
#
# ipylogue 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 ver... | ryansb/ipylogue | ipylogue/__init__.py | Python | agpl-3.0 | 898 |
# -*- coding: utf-8 -*-
# Copyright 2011 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.apache.org/licenses/LICE... | harlowja/fasteners | fasteners/process_lock.py | Python | apache-2.0 | 15,792 |
# Generated by Django 2.2.12 on 2020-05-24 10:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ebooks', '0105_auto_20200517_1141'),
]
operations = [
migrations.AddField(
model_name='chapter',
name='new',
... | flavoi/diventi | diventi/ebooks/migrations/0106_auto_20200524_1227.py | Python | apache-2.0 | 585 |
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Albert SHENOUDA <albert.shenouda@efrei.net>
#
# The licence is in the file __manifest__.py
#
############... | CompassionCH/compassion-modules | crm_compassion/tests/test_crm_compassion.py | Python | agpl-3.0 | 4,236 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
import os
from glumpy... | duyuan11/glumpy | glumpy/data/__init__.py | Python | bsd-3-clause | 5,100 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | test/test_unversioned_status.py | Python | apache-2.0 | 1,300 |
# This file is part of Beneath a Binary Sky.
# Copyright (C) 2016, Aidin Gharibnavaz <aidin@aidinhut.com>
#
# Beneath a Binary Sky 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
# Lice... | aidin36/beneath-a-binary-sky | src/world/square_iterator.py | Python | gpl-3.0 | 3,416 |
"""
2013 Paul Logston
This class defines methods for returning then next available Image instance for
use in a pestering. It also manages call the image APIs in the event that more
ImageDatas are necessary.
"""
from django.db.utils import IntegrityError
import simplejson
from pester.models import API, APICall, Imag... | logston/pester | pesterutils/imagemanager.py | Python | gpl-2.0 | 4,984 |
# Copyright (C) 2006, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
#
# 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 ... | puneetgkaur/backup_sugar_shell_for_cordova | src/jarabe/journal/journalactivity.py | Python | gpl-2.0 | 15,976 |
from PIL import Image
from os import system, remove
def extractor(name):
"""Goes through the captcha image and lines up
the individual numbers to increase the chance
of extracting the numbers"""
im = Image.open(name)
# prepare new cleaned image surface
im2 = Image.new("P", im.size,... | thenewcoder/Acesse-iRewards-Automation-Tools | modules/captchas.py | Python | mit | 4,019 |
ID = "rank"
permission = 1
def execute(self, name, params, channel, userdata, rank):
if len(params) == 0:
rank = self.userGetRankNum(channel, name)
print rank
self.sendChatMessage(self.send, channel, "You "+{2 : "are OP", 1 : "are voiced", 0 : "do not have a special rank", 3 : "are... | NightKev/Renol-IRC | commands/showRank.py | Python | mit | 837 |
import os
from celery import Celery
import ente_common as E
# monkeypatch threadpool threads
import threadpool
from __main__ import bootstrap_thread
try:
threadpool._WorkerThread
except AttributeError:
threadpool._WorkerThread = threadpool.WorkerThread
class WorkerThread(threadpool._WorkerThread):
def r... | diresi/docker | ente/ente/src/tasks/tasks/tasks.py | Python | apache-2.0 | 1,931 |
#!/usr/bin/env python
import sys
import hyperdex.client
from hyperdex.client import LessEqual, GreaterEqual, Range, Regex, LengthEquals, LengthLessEqual, LengthGreaterEqual
c = hyperdex.client.Client(sys.argv[1], int(sys.argv[2]))
def to_objectset(xs):
return set([frozenset(x.items()) for x in xs])
assert c.put('kv... | hyc/HyperDex | test/python/DataTypeInt.py | Python | bsd-3-clause | 842 |
'''
cfn_manage
create, update, delete aws cloudformation stacks
pass parameters
enforce personal configuration conventions
'''
__version__ = '0.1.0'
| quagly/cfn-manage | cfn_manage/__init__.py | Python | apache-2.0 | 166 |
"""
Component that performs TensorFlow classification on images.
For a quick start, pick a pre-trained COCO model from:
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
For more details about this platform, please refer to the documentation at
https://home-assist... | skalavala/smarthome | custom_components/image_processing/tensorflow.py | Python | mit | 13,028 |
# Written by John Hoffman
# derived from NATPortMapping.py by Yejun Yang
# and from example code by Myers Carpenter
# see LICENSE.txt for license information
import socket
from random import random
from hashlib import sha1
from traceback import print_exc
from subnetparse import IP_List
from clock import clock
try:
... | NecromancerLev0001/LightingFury | LF/natpunch.py | Python | mit | 7,898 |
from app.models.user import User
from app import login_manager
from flask import current_app
# Python module which helps securely sign cookies
from itsdangerous import URLSafeTimedSerializer
@login_manager.user_loader
def load_user(user_id):
'''
Flask-Login user_loader callback.
The user_loader function as... | benjaminhuanghuang/math_clone | app/permission_control/falsk_login_helper.py | Python | mit | 2,166 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('advertisements', '0006_auto_20151115_1408'),
]
operations = [
migrations.AlterField(
model_name='advertisement',... | mdsafwan/Deal-My-Stuff | advertisements/migrations/0007_auto_20151115_1859.py | Python | apache-2.0 | 1,758 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
psutil test suite. Run it with:
$ make test
If you're on Python < 2.7 unittest2 module must be installe... | packages/psutil | test/test_psutil.py | Python | bsd-3-clause | 100,023 |
#!/usr/bin/env python3
import os
import sys
import json
import time
import functools
import contextlib
import subprocess
@contextlib.contextmanager
def change_dir(dirname):
curdir = os.getcwd()
try:
os.chdir(dirname)
yield
finally:
os.chdir(curdir)
def merge_dicts(a, b):
ret... | pablojorge/brainfuck | run.py | Python | mit | 10,250 |
"""
test_universe contains the unit tests for the universe class
To run all test, go to the the main ./portfolioFactory directory and run
>> python -m unittest discover
Author: Peter Li
"""
import unittest
import portfolioFactory.universe.universe as universe
from ..utils import customExceptions as customExceptio... | pli1988/portfolioFactory | portfolioFactory/universe/test_universe.py | Python | mit | 1,498 |
#!/usr/bin/env python
import os
import unittest
import sys
from test_common import TestCommon
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'library'))
from fastly_service import FastlyConfiguration
class TestFastlyHealthchecks(TestCommon):
@TestCommon.vcr.use_cassette()
def test_fastly_heal... | Jimdo/ansible-fastly | tests/test_fastly_healthchecks.py | Python | mit | 2,816 |
from jsonrpcclient.log import _trim_message, _trim_string, _trim_values
def test_trim_string():
message = _trim_string("foo" * 100)
assert "..." in message
def test_trim_values():
message = _trim_values({"list": [0] * 100})
assert "..." in message["list"]
def test_trim_values_nested():
message... | bcb/jsonrpcclient | tests/test_log.py | Python | mit | 652 |
from django.shortcuts import render
from django.contrib.admin.views.decorators import staff_member_required
@staff_member_required
def pipstatus(request):
return render(request, 'pipstatus_standalone.html')
| soerenbe/django-pipstatus | pipstatus/views.py | Python | gpl-2.0 | 213 |
"""aws-orgs setup"""
from awsorgs import __version__
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='aws-orgs',
ver... | ashleygould/aws-orgs | setup.py | Python | mit | 1,633 |
#
# SecureDrop whistleblower submission system
# Copyright (C) 2017 Loic Dachary <loic@dachary.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | ehartsuyker/securedrop | securedrop/tests/pageslayout/test_source.py | Python | agpl-3.0 | 5,984 |
#!/usr/bin/env python
# DOENDO - A Python-Based Fortran Refactoring Tool
# Copyright (C) 2011 Felipe H. da Jornada <jornada@civet.berkeley.edu>
#
# 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 Found... | jornada/DOENDO | doendo.py | Python | gpl-3.0 | 5,149 |
"""Configuration options for the main app"""
from django.utils.translation import ugettext_lazy as _
from smart_settings.api import register_setting
register_setting(
namespace=u'main',
module=u'main.settings',
name=u'SIDE_BAR_SEARCH',
global_name=u'MAIN_SIDE_BAR_SEARCH',
default=False,
descr... | rosarior/rua | rua/apps/main/settings.py | Python | gpl-3.0 | 753 |
# -*- coding: utf-8 -*-
#
# Cherokee-admin
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
# Taher Shihadeh <taher@octality.com>
#
# Copyright (C) 2001-2011 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General ... | nuxleus/cherokee-webserver | admin/PageNewConfig.py | Python | gpl-2.0 | 5,998 |
# 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 PyTestrepository(PythonPackage):
"""A repository of test results."""
homepage = "http... | iulian787/spack | var/spack/repos/builtin/packages/py-testrepository/package.py | Python | lgpl-2.1 | 1,122 |
from bs4 import BeautifulSoup
import urllib
import requests
def createFilename(url, name, folder):
dotSplit = url.split('.')
if name == None:
# use the same as the url
slashSplit = dotSplit[-2].split('/')
name = slashSplit[-1]
ext = dotSplit[-1]
file = '{}{}.{}'.format(folder, n... | wolfdale/Alphacoder | Alphacoder.py | Python | mit | 2,168 |
#!/usr/bin/python
import sys
sys.path.append('/homes/gws/aritter/twitter_nlp/python')
from twokenize import tokenize
from LdaFeatures import LdaFeatures
from Vocab import Vocab
from Dictionaries import Dictionaries
entityDocs = {}
prevText = None
for line in sys.stdin:
line = line.rstrip('\n')
fields = lin... | adarshlx/twitter_nlp | hbc/python/tweets2entityDocs.py | Python | gpl-3.0 | 2,087 |
"Test editor, coverage 35%."
from idlelib import editor
import unittest
from test.support import requires
from tkinter import Tk
Editor = editor.EditorWindow
class EditorWindowTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
requires('gui')
cls.root = Tk()
cls.root.withdra... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/idlelib/idle_test/test_editor.py | Python | gpl-2.0 | 1,141 |
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return '''
<h1>Welcome to silly project of Samuka!</h1>
<p>Avaliable endpoints:</p>
<ul>
<li><b>/</b> - this page</li>
<li><b>/ping</b> - example of rest api with json response</li>
<li><b>/modal</b> - exemple of html divs</li... | samukasmk/grupy-flask-jenkins | app.py | Python | apache-2.0 | 1,035 |
from django.db import models, connection
def generateDataCube(owner_name=None, subject=None, timing=None, start_date=None, end_date=None):
assert timing in [False, 'year', 'week', 'month']
dbquery = "SELECT {0}, {1}, {2}, count(*) FROM images {4} GROUP BY {3} {5};"
zero = "owner_name" if owner_name e... | jcairo/391_project | project_391/main/datacube.py | Python | mit | 2,332 |
from datetime import timedelta
from urllib2 import URLError
import json
import os
import traceback
from couchpotato.core._base.downloader.main import DownloaderBase, ReleaseDownloadList
from couchpotato.core.helpers.encoding import tryUrlencode, ss, sp
from couchpotato.core.helpers.variable import cleanHost, mergeDict... | mattesno1/CouchPotatoServer | couchpotato/core/downloaders/sabnzbd.py | Python | gpl-3.0 | 10,799 |
#!/usr/bin/env python
import os
import sys
import unittest
from rclpy.node import Node
from std_srvs.srv import SetBool
from twisted.python import log
sys.path.append(os.path.dirname(__file__)) # enable importing from common.py in this directory
import common # noqa: E402
from common import expect_messages, websoc... | RobotWebTools/rosbridge_suite | rosbridge_server/test/websocket/advertise_service.test.py | Python | bsd-3-clause | 2,612 |
############################################################################
##
## Copyright (c) 2000-2015 BalaBit IT Ltd, Budapest, Hungary
## Copyright (c) 2015-2018 BalaSys IT Ltd, Budapest, Hungary
##
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General... | mochrul/zorp | zorpctl/ZorpctlConf.py | Python | gpl-2.0 | 5,339 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# We need data in a different format for this guy
from LOTlib.DataAndObjects import *
# The arguments are [concept,object]
data = [
FunctionData(['A', Obj(shape='square', color='red')], True),
FunctionData(['A', Obj(shape='squ... | moverlan/LOTlib | LOTlib/Examples/RationalRules/TwoConcepts/Data.py | Python | gpl-3.0 | 814 |
# Copyright (C) 2017 Alexander Kuvaev (alexander@kuvaev.me)
# 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) any later version.
... | Vinatorul/Codpled | src/cursor.py | Python | gpl-3.0 | 2,074 |
#!/usr/bin/env python
class Solution:
def majorityElement(self, nums: list) -> int:
from collections import defaultdict
numCount, length = defaultdict(int), len(nums)
for n in nums:
numCount[n] += 1
if numCount[n] > length/2:
return n
sol = Solution(... | eroicaleo/LearningPython | interview/leet/169_Majority_Element.py | Python | mit | 393 |
#this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok, that *args is actually pointless, we can just do
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
# this just takes one argument
def print_one(arg1):
... | mshcruz/LearnPythonTheHardWay | ex18.py | Python | gpl-2.0 | 513 |
# Copyright 2016 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 by applicable law or a... | jaivasanth-google/deploymentmanager-samples | examples/v2/common/python/container_helper.py | Python | apache-2.0 | 1,754 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.forms.models import (
inlineformset_factory,
ModelForm, ModelFormMetaclass,
)
from django.utils import six
class InlineModelFormMetaclass(ModelFormMetaclass):
def __new__(cls, name, bases, attrs):
options = attrs.get('Me... | samuelmaudo/yepes | yepes/forms/inline_model.py | Python | bsd-3-clause | 2,021 |
"""
conference_helper.py -- Udacity conference server-side Python App Engine
HTTP controller handlers for memcache & task queue access
created by @Robert_Avram on 2015 June 6
"""
import endpoints
from google.appengine.ext import ndb
from google.appengine.api import search
from google.appengine.api i... | robertavram/ConferenceAPI | conference_helper.py | Python | apache-2.0 | 30,790 |
# pylint: disable=unused-variable,expression-not-assigned,misplaced-comparison-constant,singleton-comparison
from pathlib import Path
import pytest
from expecter import expect
from memegen.domain import Font
def describe_font():
@pytest.fixture
def font():
return Font(Path('mock_dir', 'FooBar.otf'... | DanLindeman/memegen | memegen/tests/test_domain_font.py | Python | mit | 841 |
"""
WSGI config for Banker project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... | christopher-henderson/Banker | Banker/Banker/wsgi.py | Python | mit | 389 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/webhooks/serializers.py | Python | agpl-3.0 | 15,461 |
# Copyright 2018 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.
from benchmarks import memory
from core import perf_benchmark
from contrib.cluster_telemetry import ct_benchmarks_util
from contrib.cluster_telemetry import... | endlessm/chromium-browser | tools/perf/contrib/cluster_telemetry/memory_ct.py | Python | bsd-3-clause | 2,525 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
thisAlgorithmBecomingSkynetCost = 99999999999
from .source import ectools, wrdslib, static, sas
from .source import wrds_loop, get_wrds, find_wrds, setup_wrds_key
from .source import user_info | jbrockmendel/pywrds | __init__.py | Python | bsd-3-clause | 238 |
"""
WSGI config for blog3 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import sys
sys.path.insert(0, '/home/daniilr/upravd/')
import os
os.environ.setdefault("DJANGO_SETT... | dan4ik95dv/housemanagement | tsj/wsgi.py | Python | mit | 482 |
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# 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... | rdo-management/neutron | neutron/tests/unit/agent/l2population_rpc_base.py | Python | apache-2.0 | 6,121 |
"""
Script to do SVD on the covariance matrix of the voxel by time matrix.
Run with:
python pca_script.py
"""
from __future__ import absolute_import, division, print_function
import numpy as np
import numpy.linalg as npl
import nibabel as nib
import os
import sys
import pandas as pd
import matplotlib.pyplot as ... | berkeley-stat159/project-alpha | code/utils/scripts/pca_script.py | Python | bsd-3-clause | 5,106 |
class CampbellRobertsonSequence(DefaultSequence) :
def boot(self, frameRateDivisor=1):
super().boot( frameRateDivisor=frameRateDivisor )
| szecsi/Gears | GearsPy/Project/Experiments/8_Patterns/8_CampbellRobertson/CampbellRobertsonExperimentExperiment.py | Python | gpl-2.0 | 150 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate... | ProjectSWGCore/NGECore2 | scripts/mobiles/endor/vile_korga_battlelord.py | Python | lgpl-3.0 | 1,773 |
# -*- coding: utf-8 -*-
"""
edacc.web
---------
In this module the flask application instance is defined and configured
according to the settings in config.py.
:copyright: (c) 2010 by Daniel Diepold.
:license: MIT, see LICENSE for details.
"""
import uuid, datetime, os
from jinja2 import Fil... | EDACC/edacc_web | edacc/web.py | Python | mit | 4,224 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Tripoli documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 12 11:05:04 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... | TheBB/tripoli | docs/source/conf.py | Python | gpl-3.0 | 9,843 |
# coding=utf-8
"""
This module, problem_019.py, solves the nineteenth project euler problem.
"""
from project_euler_problems.problem import Problem
from datetime import date
'''
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Thirty days has Se... | utarsuno/urbtek | project_euler_problems/problems/problem_019.py | Python | apache-2.0 | 1,284 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# hunger_games.py
# this makes an arena map for minecraft
import os
import sys
import minecraft_builder
import castle_maker
import clear_area
import math
style_stone = {'roof':'planks 1', 'walls':'minecraft:stone 0', 'floor':'minecraft:stone 4', 'posts':'minecraft:stone 3'}
... | acutesoftware/worldbuild | scripts/minecraft/hunger_games.py | Python | gpl-2.0 | 1,412 |
# Copyright 2017 Bracket Computing, 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.
# A copy of the License is located at
#
# https://github.com/brkt/brkt-cli/blob/master/LICENSE
#
# or in the "license" file... | brkt/brkt-cli | brkt_cli/esx/update_encrypted_vmdk_args.py | Python | apache-2.0 | 2,864 |
# tests/products/test_ninja.py ----------------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2021 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for l... | rudkx/swift | utils/swift_build_support/tests/products/test_cmark.py | Python | apache-2.0 | 4,913 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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
#
# Unle... | technige/py2neo | test/unit/test_storage.py | Python | apache-2.0 | 15,510 |
# -*- coding: utf-8 -*-
# Copyright 2016-2017 Nate Bogdanowicz
import datetime
__distname__ = "Instrumental-lib"
__version__ = "0.6"
__author__ = "Nate Bogdanowicz"
__email__ = "natezb@gmail.com"
__url__ = 'https://github.com/mabuchilab/Instrumental'
__license__ = "GPLv3"
__copyright__ = "Copyright 2013-{}... | mabuchilab/Instrumental | instrumental/__about__.py | Python | gpl-3.0 | 374 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_gridlines04.py | Python | bsd-2-clause | 1,652 |
"""
Tests for the django-reversion API.
These tests require Python 2.5 to run.
"""
from __future__ import unicode_literals
import datetime, os
from unittest import skipUnless
from django.db import models
from django.test import TestCase
from django.core.management import call_command
from django.core.exceptions imp... | lutoma/django-reversion | src/tests/test_reversion/tests.py | Python | bsd-3-clause | 40,796 |
# Copyright (c) 2014 Cisco Systems, 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 r... | rishabh1jain1/schedwise | nova/scheduler/solvers/linearconstraints/all_hosts_constraint.py | Python | apache-2.0 | 3,558 |
# This file is part of tofbot, a friendly IRC bot.
# You may redistribute it under the Simplified BSD License.
# If we meet some day, and you think this stuff is worth it,
# you can buy us a beer in return.
#
# Copyright (c) 2011 Etienne Millon <etienne.millon@gmail.com>
from toflib import Plugin
class PluginRick(Plu... | martinkirch/tofbot | plugins/rick.py | Python | bsd-2-clause | 620 |
# 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 RRsnns(RPackage):
"""Neural Networks using the Stuttgart Neural Network Simulator (SNNS)
... | LLNL/spack | var/spack/repos/builtin/packages/r-rsnns/package.py | Python | lgpl-2.1 | 1,542 |
from __future__ import absolute_import
from . import mpl
from . import io
__version__ = "1.0.0"
| goerz/mgplottools | mgplottools/__init__.py | Python | gpl-3.0 | 98 |
#!/usr/bin/python
#
# This file is part of DynaMiFLiC
#
# Copyright (C) 2012 slacknux <slacknux@gmail.com>
# http://www.slacknux.net
#
# 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... | slacknux/DynaMiFLiC | server/cgi-bin/loadArticle.py | Python | gpl-3.0 | 1,123 |
"""
Views for the User model.
"""
import functools
from flask import Blueprint, render_template, url_for, redirect
from flask_oauthlib.client import OAuth
from flask_oauthlib.contrib.apps import github
from flask_login import login_required, current_user, login_user, logout_user
from codegolf import login_manager, app
... | UQComputingSociety/codegolf | codegolf/user/views.py | Python | mit | 2,567 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import rapidsms
import re
class App(rapidsms.app.App):
prefix = re.compile(r'^echo\s+',re.I)
def handle(self, message):
self.debug("got message %s", message.text)
if self.prefix.search(message.text):
response = self.prefix.sub("",m... | takinbo/rapidsms-borno | apps/echo/app.py | Python | lgpl-3.0 | 443 |
"""
Created on 15 Feb 2015
@author: Ronny Andersson (ronny@andersson.tk)
@copyright: (c) 2015 Ronny Andersson
@license: MIT
"""
# Standard library
import logging
import warnings
from abc import ABCMeta, abstractmethod
# Third party
import numpy as np
# Internal
from zignal import Audio, Noise
try:
import pyaud... | ronnyandersson/zignal | zignal/sndcard.py | Python | mit | 21,899 |
"""Next-gen alignments with BWA (http://bio-bwa.sourceforge.net/)
"""
import os
import subprocess
import toolz as tz
from bcbio.pipeline import config_utils
from bcbio import bam, utils
from bcbio.distributed.transaction import file_transaction, tx_tmpdir
from bcbio.ngsalign import alignprep, novoalign, postalign
fro... | SciLifeLab/bcbio-nextgen | bcbio/ngsalign/bwa.py | Python | mit | 8,435 |
#!/usr/bin/env python
from sys import argv, exit, stdout, stderr
from random import randint
method = 0
global n
global dataset_filename
subset_filename = ""
rest_filename = ""
def exit_with_help():
print("""\
Usage: %s [options] dataset number [output1] [output2]
This script selects a subset of the given dataset.
... | KaiXin93/Text2 | tools/subset.py | Python | apache-2.0 | 2,987 |
import datetime
import json
import matplotlib.dates as mdates
from matplotlib.axes import Subplot
from matplotlib.figure import Figure
from PySide import QtGui, QtCore
from backend_pysideagg import FigureCanvasQTAgg as FigureCanvas
from DatePlot import DatetimeCollection, KenLocator, KenFormatter
from SignalWidget im... | CalSol/Impulse | Telemetry/viewer/LiveGraph.py | Python | apache-2.0 | 18,513 |
import codecs
import yaml
import operator
import os
import tempfile
import textwrap
import re
import ast
from mako.template import Template
from .. import Messages, blocks
from ..Constants import TOP_BLOCK_FILE_MODE
from .FlowGraphProxy import FlowGraphProxy
from ..utils import expr_utils
from .top_block import TopBl... | mrjacobagilbert/gnuradio | grc/core/generator/cpp_top_block.py | Python | gpl-3.0 | 17,872 |
from flask import Flask
app = Flask(__name__)
from media import Movie
from flask import render_template
import re
@app.route('/')
def index():
'''View function for index page.'''
toy_story = Movie(title = "Toy Story 3", trailer_youtube_url ="https://www.youtube.com/watch?v=QW0sjQFpXTU",
poster_image_url="https... | mr-karan/Udacity-FullStack-ND004 | Project1/projects/movieServer/app.py | Python | mit | 2,980 |
# (c) 2018 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | ptisserand/ansible | test/units/modules/network/edgeos/test_edgeos_facts.py | Python | gpl-3.0 | 3,270 |
from mount import Plugin, command_basic
class MyPlugin(Plugin):
"""Example plugin. You can declare your commands in __server_commands__ or __host_commands__"""
def __init__(self):
"""This function is called when the plugin is loaded"""
print("Test plugin loaded!")
@command_basic
def he... | panagiks/reverse_shell | Server/Plugins/template.py | Python | mit | 469 |
'''The problem is not specified for python, I didn't noticed that yet made a solution for it in python. It C++ solution is also available here.'''
def sumOfSq(n):
if n==1:
return 1
else:
return n**2+sumOfSq(n-1)
while True:
no=input()
if no==0:
break
else:
print sumO... | ProgDan/maratona | SPOJ/SAMER08F.py | Python | gpl-3.0 | 327 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | coufon/neon-distributed | tests/test_roipooling_layer.py | Python | apache-2.0 | 13,940 |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2016
#
# 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/licens... | ibm-cds-labs/simple-data-pipe-connector-flightstats | pixiedust_flightpredict/pixiedust_flightpredict/running/flightHistory.py | Python | apache-2.0 | 4,263 |
"""Support for Z-Wave door locks."""
import logging
import voluptuous as vol
from homeassistant.components.lock import DOMAIN, LockEntity
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import ZW... | tchellomello/home-assistant | homeassistant/components/zwave/lock.py | Python | apache-2.0 | 13,338 |
import fauxfactory
import pytest
from riggerlib import recursive_update
from widgetastic.utils import partial_match
from cfme import test_requirements
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.services.service_catalogs import ServiceCatalogs
from cfme.utils.appliance import ViaSSUI
from cfm... | izapolsk/integration_tests | cfme/tests/cloud/test_quota_tagging.py | Python | gpl-2.0 | 10,743 |
"""Ensure credentials are preserved through the authorization.
The Authorization Code Grant will need to preserve state as well as redirect
uri and the Implicit Grant will need to preserve state.
"""
from __future__ import absolute_import, unicode_literals
import json
import mock
from .test_utils import get_query_cre... | nirmeshk/oh-mainline | vendor/packages/oauthlib/tests/oauth2/rfc6749/endpoints/test_credentials_preservation.py | Python | agpl-3.0 | 4,860 |
from __future__ import print_function
import os, json, zipfile
import sublime, sublime_plugin
"""
Copyright (C) 2015 Justin Decker
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 ... | justind000/ionode_sublime_plugin | ion.py | Python | gpl-3.0 | 6,012 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20151201_1922'),
]
operations = [
migrations.AlterField(
model_name='post',
name='... | I-prefer-the-front-end/I-prefer-the-front-end | iptfe/blog/migrations/0006_auto_20151201_1923.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
"""
Xlsx xml-parser for Reporting Services.
Converts text to formulae, eg. '=SUM(A1:A10)'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notice: Only Reporting Services 2012 (or higher) is supporting export reports to
xlsx-format.
"""... | marat-/python-reporting-services | parse_xlsx_xml.py | Python | apache-2.0 | 13,350 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, api, models
from math ... | sysadminmatmoz/ingadhoc | stock_voucher/wizard/stock_print_remit.py | Python | agpl-3.0 | 2,589 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_06_01/aio/operations/_load_balancer_frontend_ip_configurations_operations.py | Python | mit | 8,931 |
import nltk
import filemanager
import multiprocessing
import os
import ConfigParser
from assistant import Assistant, Messenger
from nltk.corpus import wordnet
resources_dir = 'resources\\'
login_creds = ConfigParser.SafeConfigParser()
if os.path.isfile(resources_dir + 'login_creds.cfg'):
login_creds.read(resour... | omn0mn0m/JARVIS | jarvis/jarvis.py | Python | mit | 3,867 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Cisco and/or its affiliates.
# 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
# l
# Unless requir... | muharif/vpp | vpp-api/java/jvpp/gen/jvpp_c_gen.py | Python | apache-2.0 | 18,185 |
import datetime
import logging
import discord
from discord.ext import commands
from alexBot.classes import GuildData
from alexBot.tools import Cog
log = logging.getLogger(__name__)
class VoiceStats(Cog):
@Cog.listener()
async def on_voice_state_update(
self, member: discord.Member, before: discord.... | mralext20/alex-bot | alexBot/cogs/voiceStats.py | Python | mit | 3,833 |
# Copyright 2016 The TensorFlow 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 required by applica... | girving/tensorflow | tensorflow/python/autograph/impl/conversion.py | Python | apache-2.0 | 14,250 |
from os.path import join
import pytest
from cobra.io import load_json_model, write_sbml_model
def test_load_json_model_valid(data_directory, tmp_path):
"""Test loading a valid annotation from JSON."""
path_to_file = join(data_directory, "valid_annotation_format.json")
model = load_json_model(path_to_fil... | opencobra/cobrapy | src/cobra/test/test_io/test_annotation_format.py | Python | gpl-2.0 | 944 |
import json
DMCA_ERROR = '''
<div class="alert alert-info" role="alert">
This file has been the subject of a DMCA take down
and is unable to be rendered by the Open Science Framework
</div>
<style>.file-download{{display: none;}}</style>
'''
# Note: the style is for disabling download buttons
STATUS_CODE_ERROR_MAP =... | GaryKriebel/osf.io | framework/render/exceptions.py | Python | apache-2.0 | 1,252 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | lib/spack/spack/cmd/blame.py | Python | lgpl-2.1 | 4,597 |
from genast.nodes import *
def expr(val, tail):
if isinstance(val, SumNode):
return val
else:
return SumNode(mult(val, []), *tail)
def mult(val, tail):
if isinstance(val, MultNode):
return val
else:
return MultNode(power(val), *tail)
def sign(s):
if isinstance(s... | dasdy/genexpr | genast/wrappers.py | Python | mit | 1,045 |
pytest_plugins = [
"tests.fixtures",
]
| andreroggeri/pynubank | tests/conftest.py | Python | mit | 43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.