repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringlengths
1
5
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
alphagov/notifications-delivery
tests/clients/test_aws_ses.py
1
1062
from moto import mock_ses from notifications_delivery.clients.email.aws_ses import (AwsSesClient, AwsSesClientException) @mock_ses def test_send_email(ses_client): aws_ses_client = AwsSesClient(region='eu-west-1') source = "source@notify.gov.uk" to_address = "random@random.com" subject = "Email subjec...
mit
pyQode/pyqode.python
pyqode/python/modes/sh.py
2
9816
""" This module contains a native python syntax highlighter, strongly inspired from spyderlib.widgets.source_code.syntax_higlighter.PythonSH but modified to highlight docstrings with a different color than the string color and to highlight decorators and self parameters. It is approximately 3 time faster then :class:`...
mit
cocrawler/cocrawler
cocrawler/fetcher.py
1
10249
''' async fetching of urls. Assumes robots checks have already been done. Success returns response object and response bytes (which were already read in order to shake out all potential network-related exceptions.) Failure returns enough details for the caller to do something smart: 503, other 5xx, DNS fail, connect...
apache-2.0
AndroidOpenDevelopment/android_external_chromium_org
chrome/tools/build/win/sln_deps.py
170
3936
#!/usr/bin/env python # Copyright (c) 2011 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 copy import optparse __version__ = "1.0" # Constants used by Visual Studio. UNKNOWN_GUID = "{00000000-0000-0000-0000-00000...
bsd-3-clause
gormanb/mtools
mtools/util/parse_sourcecode.py
8
10129
import os import re import sys import commands import subprocess import cPickle from collections import defaultdict from mtools.util.logcodeline import LogCodeLine from pymongo import MongoClient from pymongo.errors import ConnectionFailure mongodb_path = "/Users/tr/Documents/code/mongo/" git_path = "/usr/bin/git" ...
apache-2.0
norayr/unisubs
apps/videos/migrations/0023_auto__add_field_videocaptionversion_finished__add_field_translationver.py
5
17134
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'VideoCaptionVersion.finished' db.add_column('videos_videocaptionversion', 'finished', ...
agpl-3.0
Insight-book/data-science-from-scratch
first-edition/code/gradient_descent.py
53
5895
from __future__ import division from collections import Counter from linear_algebra import distance, vector_subtract, scalar_multiply import math, random def sum_of_squares(v): """computes the sum of squared elements in v""" return sum(v_i ** 2 for v_i in v) def difference_quotient(f, x, h): return (f(x +...
unlicense
inspyration/odoo
addons/website_sale/models/product.py
12
10144
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
peterlei/fboss
fboss/system_tests/system_tests.py
1
6328
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import importlib import logging import os import sys import unittest user_requested_tags = [] Defaults = { "test_dirs": ['tests'], "config": 'te...
bsd-3-clause
caphrim007/ansible
lib/ansible/modules/cloud/azure/azure_rm_postgresqldatabase_facts.py
14
6074
#!/usr/bin/python # # Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.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': '1.1', ...
gpl-3.0
lukaszkoczwara/presence-analyzer-lkoczwara
src/presence_analyzer/helpers.py
1
1777
# -*- coding: utf-8 -*- """ Helper functions used in views. """ from json import dumps from functools import wraps from flask import Response def jsonify(function): """ Creates a response with the JSON representation of wrapped function result. """ @wraps(function) def inner(*args,...
mit
opencloudinfra/orchestrator
venv/Lib/site-packages/django/contrib/staticfiles/views.py
581
1329
""" Views and functions for serving static files. These are only to be used during development, and SHOULD NOT be used in a production setting. """ import os import posixpath from django.conf import settings from django.contrib.staticfiles import finders from django.http import Http404 from django.utils.six.moves.url...
gpl-3.0
ahmedaljazzar/edx-platform
common/lib/xmodule/xmodule/exceptions.py
22
1266
class InvalidDefinitionError(Exception): pass class NotFoundError(Exception): pass class ProcessingError(Exception): ''' An error occurred while processing a request to the XModule. For example: if an exception occurs while checking a capa problem. ''' pass class InvalidVersionError(Ex...
agpl-3.0
charles1018/kernel_msm
scripts/build-all.py
1474
10189
#! /usr/bin/env python # Copyright (c) 2009-2013, The Linux Foundation. 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 # ...
gpl-2.0
CompSci17/Survey-System
survey_system_files/results.py
1
11810
from .models import Answers, RadioResults, SelectResults, ImportanceOrderResults, CheckboxResults from chartit import DataPool, Chart class Results( ): def render_results( self, questions, survey ): """ Sorts out logic behind how we present our answers. @param questions QuerySet Questions we're working with...
mit
luckielordie/conan
conans/model/info.py
1
13408
import os from conans.client.build.cppstd_flags import cppstd_default from conans.errors import ConanException from conans.model.env_info import EnvValues from conans.model.options import OptionsValues from conans.model.ref import PackageReference from conans.model.values import Values from conans.paths import CONANIN...
mit
dongguangming/pattern
pattern/text/fr/__init__.py
21
9083
#### PATTERN | FR ################################################################################## # -*- coding: utf-8 -*- # Copyright (c) 2013 University of Antwerp, Belgium # Copyright (c) 2013 St. Lucas University College of Art & Design, Antwerp. # Author: Tom De Smedt <tom@organisms.be> # License: BSD (see LICEN...
bsd-3-clause
KeviGary/shadowsocks
shadowsocks/daemon.py
386
5602
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2014-2015 clowwindy # # 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...
apache-2.0
h4ck3rm1k3/binutils-gdb
gdb/contrib/excheck.py
13
11670
# Copyright 2011-2016 Free Software Foundation, Inc. # # This is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This prog...
gpl-2.0
zycdragonball/tensorflow
tensorflow/python/kernel_tests/reduction_ops_test.py
41
31060
# Copyright 2015 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...
apache-2.0
JVenberg/PokemonGo-Bot-Desktop
pywin/Lib/compiler/misc.py
278
1794
def flatten(tup): elts = [] for elt in tup: if isinstance(elt, tuple): elts = elts + flatten(elt) else: elts.append(elt) return elts class Set: def __init__(self): self.elts = {} def __len__(self): return len(self.elts) def __contains__(s...
mit
HewlettPackard/oneview-ansible
library/oneview_network_set_facts.py
1
4474
#!/usr/bin/python # -*- coding: utf-8 -*- ### # Copyright (2016-2020) Hewlett Packard Enterprise Development LP # # 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/licen...
apache-2.0
VigTech/Vigtech-Services
env/lib/python2.7/site-packages/django/core/management/commands/dbshell.py
467
1192
from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, connections class Command(BaseCommand): help = ("Runs the command-line client for specified database, or the " "default database if none is provided.") requires_system_checks = False def add...
lgpl-3.0
anntzer/scikit-learn
sklearn/utils/_estimator_html_repr.py
1
9497
from contextlib import closing from contextlib import suppress from io import StringIO from string import Template import uuid import html from sklearn import config_context class _VisualBlock: """HTML Representation of Estimator Parameters ---------- kind : {'serial', 'parallel', 'single'} ...
bsd-3-clause
tommo/gii
test/host/waf-tools/emcc.py
2
1879
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import os,sys from waflib import Configure,Options,Utils from waflib.Tools import ccroot,ar from waflib.Configure import conf @conf def find_emcc(conf): cc=conf.fin...
mit
robdennis/sideboard
tests/plugins/simple/one/env/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/vcs/bazaar.py
165
4945
import os import tempfile import re from pip.backwardcompat import urlparse from pip.log import logger from pip.util import rmtree, display_path, call_subprocess from pip.vcs import vcs, VersionControl from pip.download import path_to_url2 class Bazaar(VersionControl): name = 'bzr' dirname = '.bzr' repo_n...
bsd-3-clause
shey/zbar-patched
test/barcodetest.py
2
11447
#!/usr/bin/env python import sys, re, unittest as UT, xml.etree.ElementTree as ET from os import path, getcwd from errno import EISDIR, EINVAL, EACCES from StringIO import StringIO from subprocess import Popen, PIPE from urllib2 import urlopen, HTTPError from urlparse import urljoin, urlunparse from traceback import f...
lgpl-2.1
luca3m/urllib3
test/test_retry.py
16
7746
import unittest from urllib3.response import HTTPResponse from urllib3.packages.six.moves import xrange from urllib3.util.retry import Retry from urllib3.exceptions import ( ConnectTimeoutError, MaxRetryError, ReadTimeoutError, ResponseError, ) class RetryTest(unittest.TestCase): def test_string...
mit
Hitechverma/zamboni
scripts/crontab/gen-cron.py
32
1270
#!/usr/bin/env python import os from optparse import OptionParser TEMPLATE = open(os.path.join(os.path.dirname(__file__), 'crontab.tpl')).read() def main(): parser = OptionParser() parser.add_option("-z", "--zamboni", help="Location of zamboni (required)") parser.add_option("-u", "...
bsd-3-clause
finch0219/linux
tools/perf/scripts/python/sctop.py
1996
2102
# system call top # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Periodically displays system-wide system call totals, broken down by # syscall. If a [comm] arg is specified, only syscalls called by # [comm] are displayed. If an [interval] arg is specified,...
gpl-2.0
schinzelh/dash
qa/rpc-tests/getchaintips.py
66
2133
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Exercise the getchaintips API. We introduce a network split, work # on chains of different lengths, an...
mit
Bysmyyr/chromium-crosswalk
native_client_sdk/src/tools/tests/create_nmf_test.py
2
24325
#!/usr/bin/env python # 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. import json import os import posixpath import shutil import subprocess import sys import tempfile import unittest SCRIPT_DIR = os.p...
bsd-3-clause
zack3241/incubator-airflow
airflow/operators/docker_operator.py
1
9407
# -*- coding: utf-8 -*- # # 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 ...
apache-2.0
openstack/yaql
yaql/language/conventions.py
1
1410
# Copyright (c) 2015 Mirantis, 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
apache-2.0
henry0312/LightGBM
python-package/lightgbm/basic.py
1
150238
# coding: utf-8 """Wrapper for C API of LightGBM.""" import ctypes import json import os import warnings from collections import OrderedDict from copy import deepcopy from functools import wraps from logging import Logger from tempfile import NamedTemporaryFile from typing import Any, Dict, List, Set, Union import num...
mit
richardbx/django-storages
tests/test_s3boto.py
7
11178
import unittest try: from unittest import mock except ImportError: # Python 3.2 and below import mock import datetime from django.test import TestCase from django.core.files.base import ContentFile import django from boto.s3.key import Key from boto.utils import parse_ts, ISO8601 from storag...
bsd-3-clause
sgubianpm/gensabench
sdaopt/benchmark/go_benchmark_functions/go_funcs_A.py
47
8059
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import from numpy import abs, cos, exp, pi, prod, sin, sqrt, sum from .go_benchmark import Benchmark class Ackley01(Benchmark): r""" Ackley01 objective function. The Ackley01 [1]_ global optimization problem is a multimod...
bsd-2-clause
ariestiyansyah/python-social-auth
social/tests/backends/open_id.py
67
8219
# -*- coding: utf-8 -*- from calendar import timegm import sys import json import datetime import requests import jwt from openid import oidutil PY3 = sys.version_info[0] == 3 if PY3: from html.parser import HTMLParser HTMLParser # placate pyflakes else: from HTMLParser import HTMLParser from httpre...
bsd-3-clause
llvm/llvm-zorg
zorg/buildbot/builders/AnnotatedBuilder.py
1
3401
from buildbot.process.properties import WithProperties from buildbot.steps.shell import SetProperty from zorg.buildbot.commands.AnnotatedCommand import AnnotatedCommand from zorg.buildbot.process.factory import LLVMBuildFactory def getAnnotatedBuildFactory( script, clean=False, depends_on_projects=None, ...
apache-2.0
rsvip/Django
django/db/backends/mysql/validation.py
368
1336
from django.core import checks from django.db.backends.base.validation import BaseDatabaseValidation class DatabaseValidation(BaseDatabaseValidation): def check_field(self, field, **kwargs): """ MySQL has the following field length restriction: No character (varchar) fields can have a leng...
bsd-3-clause
vismartltd/edx-platform
common/djangoapps/student/migrations/0013_auto__chg_field_userprofile_meta.py
188
10346
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'UserProfile.meta' db.alter_column('auth_userprofile', 'meta', self.gf('django.db.models.f...
agpl-3.0
kotamat/pyspotify
spotify/playlist.py
2
29224
from __future__ import unicode_literals import collections import logging import spotify from spotify import ffi, lib, serialized, utils __all__ = [ 'Playlist', 'PlaylistEvent', 'PlaylistOfflineStatus', ] logger = logging.getLogger(__name__) class Playlist(utils.EventEmitter): """A Spotify playl...
apache-2.0
stephentyrone/swift
utils/swift_build_support/tests/products/test_llvm.py
26
5468
# tests/products/test_llvm.py -----------------------------------*- python -*- # # This source file is part of the LLVM.org open source project # # Copyright (c) 2014 - 2017 Apple Inc. and the LLVM project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt ...
apache-2.0
collects/VTK
Filters/Core/Testing/Python/multipleIso.py
20
2127
#!/usr/bin/env python import math import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Graphics stuff # Create the RenderWindow, Renderer and both Actors # ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer(ren1) iren = vtk.vtkRende...
bsd-3-clause
MenZil/kuma
vendor/packages/logilab/astng/test/unittest_scoped_nodes.py
24
25005
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This file is part of logilab-astng. # # logilab-astng is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as publis...
mpl-2.0
sserrot/champion_relationships
venv/Lib/site-packages/cassiopeia/core/staticdata/languagestrings.py
4
2198
from typing import Dict, Union from merakicommons.cache import lazy_property from merakicommons.container import searchable from ...data import Region, Platform from ..common import CoreData, CassiopeiaGhost, get_latest_version, provide_default_region, ghost_load_on from ...dto.staticdata import realm as dto ######...
mit
cbitterfield/JobCard
archive/bulkvideosize.py
1
3578
#!/opt/local/bin/python # encoding: utf-8 ''' bulkvideosize -- shortdesc bulkvideosize is a description It defines classes_and_methods @author: user_name @copyright: 2017 organization_name. All rights reserved. @license: license @contact: user_email @deffield updated: Updated ''' import sys import ...
gpl-3.0
ligo-cbc/pycbc-glue
pycbc_glue/utils.py
4
1881
# Copyright (C) 2010 Peter Couvares # # 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 i...
gpl-3.0
fxia22/ASM_xf
PythonD/lib/python2.4/encodings/cp1254.py
15
2757
""" Python Character Mapping Codec generated from 'CP1254.TXT' with gencodec.py. Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. (c) Copyright 2000 Guido van Rossum. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,erro...
gpl-2.0
antaril/AGK
tools/perf/scripts/python/syscall-counts.py
11181
1522
# system call counts # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os import sys sys.path.append(os.envir...
gpl-2.0
longfin/sider
sider/hash.py
2
12701
""":mod:`sider.hash` --- Hash objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. seealso:: `Redis Data Types <http://redis.io/topics/data-types>`_ The Redis documentation that explains about its data types: strings, lists, sets, sorted sets and hashes. """ import collections from .session import Sess...
mit
kennedyshead/home-assistant
tests/components/ezviz/__init__.py
2
2716
"""Tests for the Ezviz integration.""" from unittest.mock import patch from homeassistant.components.ezviz.const import ( ATTR_SERIAL, ATTR_TYPE_CAMERA, ATTR_TYPE_CLOUD, CONF_CAMERAS, CONF_FFMPEG_ARGUMENTS, DEFAULT_FFMPEG_ARGUMENTS, DEFAULT_TIMEOUT, DOMAIN, ) from homeassistant.const im...
apache-2.0
laperry1/android_external_chromium_org
tools/telemetry/third_party/pyserial/serial/serialutil.py
143
20191
#! python # Python Serial Port Extension for Win32, Linux, BSD, Jython # see __init__.py # # (C) 2001-2010 Chris Liechti <cliechti@gmx.net> # this is distributed under a free software license, see license.txt # compatibility for older Python < 2.6 try: bytes bytearray except (NameError, AttributeError): # ...
bsd-3-clause
sanguinariojoe/FreeCAD
src/Mod/PartDesign/SprocketFeature.py
11
11674
#*************************************************************************** #* Copyright (c) 2020 Adam Spontarelli <adam@vector-space.org> * #* * #* This program is free software; you can redistribute it and/or modify * #* it unde...
lgpl-2.1
djprmf/AK-OnePone
Documentation/target/tcm_mod_builder.py
4981
41422
#!/usr/bin/python # The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD # # Copyright (c) 2010 Rising Tide Systems # Copyright (c) 2010 Linux-iSCSI.org # # Author: nab@kernel.org # import os, sys import subprocess as sub import string import re import optparse tcm_dir = "" fabric_ops...
gpl-2.0
dweinstein/elsim
elsim/similarity/simhash.py
44
2143
""" Implementation of Charikar similarity hashes in Python. Most useful for creating 'fingerprints' of documents or metadata so you can quickly find duplicates or cluster items. Part of python-hashes by sangelone. See README and LICENSE. """ from hashtype import hashtype class simhash(hashtype): def create_hash...
gpl-3.0
MadanThangavelu/restblog
python/docutils/languages/nl.py
200
1865
# $Id: nl.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: Martijn Pieters <mjpieters@users.sourceforge.net> # Copyright: This module has been placed in the public domain. # New language mappings are welcome. Before doing a new translation, please # read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must ...
bsd-3-clause
Dapid/pywt
demo/dwt_signal_decomposition.py
1
1789
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import numpy as np import matplotlib.pyplot as plt import pywt ecg = np.load(os.path.join('data', 'ecg.npy')) data1 = np.concatenate((np.arange(1, 400), np.arange(398, 600), np.arange(601, 1024))) x = np.linspa...
mit
felipenaselva/felipe.repository
plugin.video.streamhub/resources/lib/sources/en/phdmovies.py
8
6537
# -*- coding: utf-8 -*- ''' Covenant Add-on 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. This prog...
gpl-2.0
simar7/build-mozharness
configs/single_locale/mozilla-aurora_android-api-11.py
2
5014
BRANCH = "mozilla-aurora" MOZ_UPDATE_CHANNEL = "aurora" MOZILLA_DIR = BRANCH OBJDIR = "obj-l10n" EN_US_BINARY_URL = "http://stage.mozilla.org/pub/mozilla.org/mobile/nightly/latest-%s-android-api-11/en-US" % (BRANCH) #STAGE_SERVER = "dev-stage01.srv.releng.scl3.mozilla.com" STAGE_SERVER = "stage.mozilla.org" STAGE_USER ...
mpl-2.0
pbrazdil/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/postdiff.py
132
2433
# Copyright (C) 2010 Google Inc. 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 conditions and th...
bsd-3-clause
huiyi1990/grab
grab/spider/cache_backend/mysql.py
12
6207
""" CacheItem interface: '_id': string, 'url': string, 'response_url': string, 'body': string, 'head': string, 'response_code': int, 'cookies': None,#grab.response.cookies, TODO: WTF with cookies??? """ from hashlib import sha1 import zlib import logging import MySQLdb import marshal import time from weblib.encoding i...
mit
grevutiu-gabriel/sympy
sympy/ntheory/egyptian_fraction.py
63
6082
from __future__ import print_function, division import sympy.polys from sympy import Integer from sympy.core.compatibility import range from fractions import gcd def egyptian_fraction(r, algorithm="Greedy"): """ Return the list of denominators of an Egyptian fraction expansion [1]_ of the said rational `...
bsd-3-clause
medallia/aurora
src/main/python/apache/thermos/cli/commands/run.py
13
3115
# # 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 ...
apache-2.0
SnappleCap/oh-mainline
vendor/packages/twisted/doc/core/examples/ftpserver.py
22
2052
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ An example FTP server with minimal user authentication. """ from twisted.protocols.ftp import FTPFactory, FTPRealm from twisted.cred.portal import Portal from twisted.cred.checkers import AllowAnonymousAccess, FilePasswordDB from twisted.inte...
agpl-3.0
Fl0rianFischer/sme_odoo
openerp/tools/yaml_tag.py
78
6188
import yaml import logging class YamlTag(object): """ Superclass for constructors of custom tags defined in yaml file. __str__ is overriden in subclass and used for serialization in module recorder. """ def __init__(self, **kwargs): self.__dict__.update(kwargs) def __getitem__(self, key...
gpl-3.0
haowu4682/gem5
src/mem/slicc/generate/html.py
91
3325
# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood # Copyright (c) 2009 The Hewlett-Packard Development Company # 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 co...
bsd-3-clause
francesconistri/p2ptv-pi
acestream/ACEStream/Core/BitTornado/piecebuffer.py
4
2836
#Embedded file name: ACEStream\Core\BitTornado\piecebuffer.pyo from array import array from threading import Lock try: True except: True = 1 False = 0 DEBUG = False if DEBUG: import sys from traceback import print_stack class SingleBuffer: def __init__(self, pool): self.pool = pool ...
mit
jmmease/pandas
pandas/conftest.py
7
2021
import pytest import numpy import pandas import pandas.util.testing as tm def pytest_addoption(parser): parser.addoption("--skip-slow", action="store_true", help="skip slow tests") parser.addoption("--skip-network", action="store_true", help="skip network tests") ...
bsd-3-clause
abcdefg30/OpenRA
packaging/linux/gtk-dialog.py
16
1748
#!/usr/bin/python """A simple GTK3 graphical dialog helper that can be used as a fallback if zenity is not available Compatible with python 2 or 3 with the gi bindings. Three modes are available: test: accepts no arguments, returns 0 if the python dependencies are available, or 1 if not error: show...
gpl-3.0
FenceAtMHacks/flaskbackend
fence-api/flask/lib/python2.7/site-packages/setuptools/tests/test_find_packages.py
43
6005
"""Tests for setuptools.find_packages().""" import os import sys import shutil import tempfile import unittest import platform import setuptools from setuptools import find_packages from setuptools.tests.py26compat import skipIf find_420_packages = setuptools.PEP420PackageFinder.find # modeled after CPython's test.s...
mit
OpenUpgrade-dev/OpenUpgrade
addons/hr/res_config.py
377
3452
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms o...
agpl-3.0
keflavich/APEX_CMZ_H2CO
plot_codes/parameter_comparisons.py
2
20997
import matplotlib import paths matplotlib.rc_file(paths.pcpath('pubfiguresrc')) import os import pylab as pl from astropy import table from paths import analysispath import numpy as np from astropy import coordinates from astropy import units as u import heating pcfittable = table.Table.read(os.path.join(analysispath,...
bsd-3-clause
pombreda/pyicqt
src/tlib/langcodes.py
5
1490
# Description: Language codes from the licq source code. # License: GNU GPLv2 (see COPYING for details) # (c) Copyright 2004 Daniel Henninger <jadestorm@nc.rr.com> langCodes = { 0:"", 55:"Afrikaans", 58:"Albanian", 1:"Arabic", 59:"Armenian", 68:"Azerbaijani", 72:"Belorussian", 2:"Bhojpu...
gpl-2.0
borisroman/vdsm
tests/netconfpersistenceTests.py
4
3904
# # Copyright 2013 Red Hat, Inc. # # 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 th...
gpl-2.0
ilastikdev/opengm
src/interfaces/python/examples/potts_gui.py
14
1100
import numpy import opengm import vigra import matplotlib.pyplot as plt import matplotlib.cm as cm gradScale = 0.1 energyNotEqual = 0.2 sigma=0.2 resizeFactor=2 img=vigra.impex.readImage('lena.bmp') shape=img.shape imgLab=vigra.colors.transform_RGB2Lab(img) shape=(shape[0]*resizeFactor,shape[1]*resizeFactor) ...
mit
danrg/RGT-tool
src/RGT/XML/SVG/Attribs/xlinkAttributes.py
1
4217
from RGT.XML.SVG.Attribs.basicSvgAttribute import BasicSvgAttribute from types import StringType class XlinkAttributes(BasicSvgAttribute): ATTRIBUTE_XLINK_HREF = 'xlink:href' ATTRIBUTE_XLINK_SHOW = 'xlink:show' ATTRIBUTE_XLINK_ACTUATE = 'xlink:actuate' ATTRIBUTE_XLINK_TYPE = 'xlink:type' ...
mit
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/numpy/core/tests/test_ufunc.py
32
51281
from __future__ import division, absolute_import, print_function import numpy as np import numpy.core.umath_tests as umt import numpy.core.operand_flag_tests as opflag_tests from numpy.compat import asbytes from numpy.core.test_rational import rational, test_add, test_add_rationals from numpy.testing import ( Test...
gpl-3.0
hsnr-gamera/gamera
gamera/gui/gaoptimizer/StopCriteriaPanel.py
1
4654
# # Copyright (C) 2012 Tobias Bolten # # 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 i...
gpl-2.0
miguelfervi/SSBW-Restaurantes
restaurantes/lib/python2.7/site-packages/rest_framework/pagination.py
2
25574
# coding: utf-8 """ Pagination serializers determine the structure of the output that should be used for paginated responses. """ from __future__ import unicode_literals from base64 import b64decode, b64encode from collections import OrderedDict, namedtuple from django.core.paginator import Paginator as DjangoPaginat...
gpl-3.0
cwmat/flasky
migrations/versions/38c4e85512a9_initial_migration.py
182
1163
"""initial migration Revision ID: 38c4e85512a9 Revises: None Create Date: 2013-12-27 01:23:59.392801 """ # revision identifiers, used by Alembic. revision = '38c4e85512a9' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust!...
mit
jkkm/binutils-gdb
gdb/python/lib/gdb/command/pretty_printers.py
126
14474
# Pretty-printer commands. # Copyright (C) 2010-2014 Free Software Foundation, Inc. # 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 la...
gpl-2.0
mkieszek/odoo
addons/im_livechat/models/im_livechat_channel.py
3
11253
# -*- coding: utf-8 -*- import openerp import random import re from openerp import api, fields, models from openerp import tools class ImLivechatChannel(models.Model): """ Livechat Channel Define a communication channel, which can be accessed with 'script_external' (script tag to put on external ...
agpl-3.0
BenKaehler/q2-feature-classifier
q2_feature_classifier/tests/__init__.py
1
1162
# ---------------------------------------------------------------------------- # Copyright (c) 2016-2019, QIIME 2 development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
bsd-3-clause
kalyan02/dayone
do/lib.py
1
2300
from BeautifulSoup import BeautifulSoup as Soupify import urllib, re import settings import oauth2, urlparse, json from do import settings class DropboxAPI(object): def __init__(self, user): self.user = user dinfo = self.user.social_auth.get(provider='dropbox') access_token = urlparse.parse_qs( dinfo.extra_da...
gpl-2.0
yufengg/tensorflow
tensorflow/contrib/distributions/python/ops/vector_exponential_linear_operator.py
29
10509
# Copyright 2017 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...
apache-2.0
softak/webfaction_demo
vendor-local/lib/python/django/contrib/sessions/backends/file.py
160
5367
import errno import os import tempfile from django.conf import settings from django.contrib.sessions.backends.base import SessionBase, CreateError from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured class SessionStore(SessionBase): """ Implements a file based session store. """ ...
bsd-3-clause
kylelwm/ponus
venv/Lib/site-packages/pip/commands/completion.py
538
1838
import sys from pip.basecommand import Command BASE_COMPLETION = """ # pip %(shell)s completion start%(script)s# pip %(shell)s completion end """ COMPLETION_SCRIPTS = { 'bash': """ _pip_completion() { COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ COMP_CWORD=$COMP_CWORD \\ ...
mit
cfobel/sconspiracy
Python/racy/plugins/qt/sconstools/qt4.py
1
21143
# ***** BEGIN LICENSE BLOCK ***** # Sconspiracy - Copyright (C) IRCAD, 2004-2010. # Distributed under the terms of the BSD Licence as # published by the Open Source Initiative. # ****** END LICENSE BLOCK ****** """SCons.Tool.qt Tool-specific initialization for Qt. There normally shouldn't be any need to import th...
bsd-3-clause
terrelln/python-zstandard
tests/test_train_dictionary.py
1
2899
import sys import unittest import zstandard as zstd from . common import ( make_cffi, ) if sys.version_info[0] >= 3: int_type = int else: int_type = long def generate_samples(): samples = [] for i in range(128): samples.append(b'foo' * 64) samples.append(b'bar' * 64) sam...
bsd-3-clause
jpopelka/fabric8-analytics-worker
f8a_worker/solver.py
1
37059
"""Classes for resolving dependencies as specified in each ecosystem.""" import anymarkup from bs4 import BeautifulSoup from collections import defaultdict from functools import cmp_to_key import logging from lxml import etree from operator import itemgetter from pip._internal.req.req_file import parse_requirements fr...
gpl-3.0
walliski/tf-info
manager/views.py
2
1742
from django.shortcuts import render from django.http import HttpResponse, HttpResponseNotFound from django.shortcuts import get_object_or_404 import json, urllib from models import Page from django.shortcuts import render_to_response from django.template import RequestContext def index(request): return render(requ...
bsd-3-clause
skycucumber/xuemc
python/venv/lib/python2.7/site-packages/whoosh/lang/__init__.py
71
4308
# coding=utf-8 # Copyright 2012 Matt Chaput. 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. Redistributions of source code must retain the above copyright notice, # this list of co...
gpl-2.0
sbidoul/pip
src/pip/_vendor/packaging/version.py
27
15974
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import collections import itertools import re import warnings from ._stru...
mit
w1ll1am23/python-wink
src/pywink/test/devices/siren_test.py
4
2894
import json import os import unittest from unittest.mock import MagicMock from pywink.api import get_devices_from_response_dict from pywink.devices import types as device_types class SirenTests(unittest.TestCase): def setUp(self): super(SirenTests, self).setUp() self.api_interface = MagicMock()...
mit
chylli/phantomjs
src/breakpad/src/tools/gyp/test/configurations/inheritance/gyptest-inheritance.py
430
1047
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies build of an executable in three different configurations. """ import TestGyp test = TestGyp.TestGyp() test.run_gyp('configur...
bsd-3-clause
maxsocl/django
django/contrib/staticfiles/finders.py
103
9860
import os from collections import OrderedDict from django.apps import apps from django.conf import settings from django.contrib.staticfiles import utils from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import ( FileSystemStorage, Storage, default_storage, ) from django.utils i...
bsd-3-clause
WeichenXu123/spark
resource-managers/kubernetes/integration-tests/tests/worker_memory_check.py
35
1624
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
lupyuen/RaspberryPiImage
home/pi/GrovePi/Software/Python/others/temboo/Library/Kiva/Teams/SearchTeams.py
5
4392
# -*- coding: utf-8 -*- ############################################################################### # # SearchTeams # Returns a keyword search of all lending teams using multiple criteria. # # Python versions 2.6, 2.7, 3.x # # Copyright 2014, Temboo Inc. # # Licensed under the Apache License, Version 2.0 (the "Lic...
apache-2.0
nuagenetworks/tempest
tempest/api/compute/flavors/test_flavors.py
8
5804
# 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.apache.org/licenses/LICENSE-2.0 # # Unless requ...
apache-2.0