repo_name
stringlengths
5
100
path
stringlengths
4
294
copies
stringclasses
990 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
FusionSP/android_external_chromium_org
third_party/tlslite/tlslite/utils/openssl_rsakey.py
200
4670
# Author: Trevor Perrin # See the LICENSE file for legal information regarding use of this file. """OpenSSL/M2Crypto RSA implementation.""" from .cryptomath import * from .rsakey import * from .python_rsakey import Python_RSAKey #copied from M2Crypto.util.py, so when we load the local copy of m2 #we can still use i...
bsd-3-clause
guschmue/tensorflow
tensorflow/contrib/gan/python/eval/python/summaries.py
63
1174
# 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
alephu5/Soundbyte
environment/lib/python3.3/site-packages/numpy/distutils/command/install.py
16
3064
from __future__ import division, absolute_import, print_function import sys if 'setuptools' in sys.modules: import setuptools.command.install as old_install_mod have_setuptools = True else: import distutils.command.install as old_install_mod have_setuptools = False old_install = old_install_mod.install...
gpl-3.0
warner83/micropython
tools/tinytest-codegen.py
47
2299
#! /usr/bin/env python3 import os, sys from glob import glob from re import sub def escape(s): lookup = { '\0': '\\0', '\t': '\\t', '\n': '\\n\"\n\"', '\r': '\\r', '\\': '\\\\', '\"': '\\\"', } return "\"\"\n\"{}\"".format(''.join([lookup[x] if x in lookup else x for x in s])) def chew_...
mit
MehdiSfr/tensor-flow
tensorflow/python/summary/impl/reservoir_test.py
5
7403
# Copyright 2015 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...
apache-2.0
wolfskaempf/ga_statistics
lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/filepost.py
1009
2281
import codecs from uuid import uuid4 from io import BytesIO from .packages import six from .packages.six import b from .fields import RequestField writer = codecs.lookup('utf-8')[3] def choose_boundary(): """ Our embarassingly-simple replacement for mimetools.choose_boundary. """ return uuid4().hex...
mit
nrwahl2/ansible
lib/ansible/modules/network/f5/bigip_gtm_virtual_server.py
16
8532
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, Michael Perzel # # 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 you...
gpl-3.0
craigderington/studentloan5
studentloan5/Lib/site-packages/setuptools/command/sdist.py
385
7079
from glob import glob from distutils import log import distutils.command.sdist as orig import os import sys from setuptools.compat import PY3 from setuptools.utils import cs_path_exists import pkg_resources READMES = 'README', 'README.rst', 'README.txt' _default_revctrl = list def walk_revctrl(dirname=''): """...
bsd-3-clause
factorlibre/OCB
addons/l10n_fr_rib/bank.py
335
4952
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero Genera...
agpl-3.0
diagramsoftware/odoo
addons/anonymization/anonymization.py
23
28730
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify # ...
agpl-3.0
CENDARI/editorsnotes
editorsnotes/djotero/views.py
1
7554
import json from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect from django.shortcuts import get_object_or_404 from editorsnotes.main.models.auth import User from .models import CachedArchive from . import utils #@login_require...
agpl-3.0
james-jz-zheng/jjzz
ml/stock_prediction.py
1
7279
import yahoo_finance as yhf from sklearn import * import os.path, os, sys import pickle import numpy as np import datetime as dt # import pandas as pd def next_biz_day(d): nd = d+dt.timedelta(days=1) return nd if nd.weekday() in range(5) else next_biz_day(nd) def prev_biz_day(d): pd = d-dt.timedelta(days=...
gpl-3.0
mancoast/CPythonPyc_test
crash/271_test_argparse.py
3
141317
# Author: Steven J. Bethard <steven.bethard@gmail.com>. import codecs import inspect import os import shutil import sys import textwrap import tempfile import unittest import argparse from StringIO import StringIO class StdIOBuffer(StringIO): pass from test import test_support class TestCase(unittest.TestCase)...
gpl-3.0
MSM8226-Samsung/kernel_samsung_msm8226
arch/ia64/scripts/unwcheck.py
13143
1714
#!/usr/bin/python # # Usage: unwcheck.py FILE # # This script checks the unwind info of each function in file FILE # and verifies that the sum of the region-lengths matches the total # length of the function. # # Based on a shell/awk script originally written by Harish Patil, # which was converted to Perl by Matthew Ch...
gpl-2.0
MyRookie/SentimentAnalyse
venv/lib/python2.7/site-packages/nltk/tokenize/treebank.py
3
4749
# Natural Language Toolkit: Tokenizers # # Copyright (C) 2001-2015 NLTK Project # Author: Edward Loper <edloper@gmail.com> # Michael Heilman <mheilman@cmu.edu> (re-port from http://www.cis.upenn.edu/~treebank/tokenizer.sed) # # URL: <http://nltk.sourceforge.net> # For license information, see LICENSE.TXT...
mit
fbradyirl/home-assistant
homeassistant/components/lcn/sensor.py
7
3835
"""Support for LCN sensors.""" import pypck from homeassistant.const import CONF_ADDRESS, CONF_UNIT_OF_MEASUREMENT from . import LcnDevice from .const import ( CONF_CONNECTIONS, CONF_SOURCE, DATA_LCN, LED_PORTS, S0_INPUTS, SETPOINTS, THRESHOLDS, VARIABLES, ) from .helpers import get_co...
apache-2.0
htautau/hhntup
higgstautau/filters.py
1
29573
import ROOT from rootpy.tree.filtering import * from rootpy.extern.hep import pdg from rootpy import stl VectorTLorentzVector = stl.vector("TLorentzVector") Vector = stl.vector('float') from itertools import ifilter from math import * from array import array as carray from xaod import TOOLS from . import datasets # f...
gpl-3.0
renesugar/arrow
python/pyarrow/tests/test_strategies.py
3
1609
# 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 u...
apache-2.0
johnbachman/belpy
indra/explanation/model_checker/model_checker.py
1
24407
import logging import textwrap from copy import deepcopy import numpy as np import networkx as nx from indra.explanation.pathfinding import get_path_iter, find_sources try: import paths_graph as pg has_pg = True except ImportError: has_pg = False logger = logging.getLogger(__name__) class PathMetric(...
mit
brentp/pedagree
peddy/king.py
2
3278
from .utils import which import os import subprocess def run_king(vcf_path, ped_obj): king = which('king') if king is None: raise Exception("requested king analysis, but king executable not found") plink = which('plink') if plink is None: raise Exception("requested king analysis, but p...
mit
Maccimo/intellij-community
python/helpers/py3only/docutils/parsers/rst/directives/images.py
44
6933
# $Id: images.py 7753 2014-06-24 14:52:59Z milde $ # Author: David Goodger <goodger@python.org> # Copyright: This module has been placed in the public domain. """ Directives for figures and simple images. """ __docformat__ = 'reStructuredText' import sys import urllib.error import urllib.parse import urllib.request...
apache-2.0
wildjan/Flask
Work/TriviaMVA/TriviaMVA/env/Lib/site-packages/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
2360
3778
"""The match_hostname() function from Python 3.3.3, essential when using SSL.""" # Note: This file is under the PSF license as the code comes from the python # stdlib. http://docs.python.org/3/license.html import re __version__ = '3.4.0.2' class CertificateError(ValueError): pass def _dnsname_match(dn, host...
apache-2.0
40023255/w16b_test
static/Brython3.1.3-20150514-095342/Lib/_sre.py
622
51369
# NOT_RPYTHON """ A pure Python reimplementation of the _sre module from CPython 2.4 Copyright 2005 Nik Haldimann, licensed under the MIT license This code is based on material licensed under CNRI's Python 1.6 license and copyrighted by: Copyright (c) 1997-2001 by Secret Labs AB """ MAXREPEAT = 2147483648 #import ar...
agpl-3.0
helldorado/ansible
test/units/modules/packaging/os/test_rhn_channel.py
101
5661
# -*- coding: utf-8 -*- # Copyright (c) 2017 Pierre-Louis Bonicoli <pierre-louis@libregerbil.fr> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from itertools import product import json from ansible.modules.packaging.os import rhn_channel import pytest pytestmark = pyt...
gpl-3.0
andreh7/deap
deap/creator.py
9
6598
# This file is part of DEAP. # # DEAP is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # DEAP is distributed ...
lgpl-3.0
yfried/ansible
test/units/modules/network/dellos10/test_dellos10_facts.py
56
4738
# (c) 2016 Red Hat Inc. # # (c) 2017 Dell EMC. # # 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 vers...
gpl-3.0
unreal666/youtube-dl
youtube_dl/extractor/mgoon.py
64
2696
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, qualities, unified_strdate, ) class MgoonIE(InfoExtractor): _VALID_URL = r'''(?x)https?://(?:www\.)? (?:(:?m\.)?mgoon\.com/(?:ch/(?:.+)/v|play/view)| ...
unlicense
HomuHomu/Kernel-SM-G935D-MM
tools/perf/scripts/python/check-perf-trace.py
1997
2539
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
gpl-2.0
vaginessa/pyload
module/gui/AccountEdit.py
41
3152
# -*- coding: utf-8 -*- """ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in ...
gpl-3.0
keedio/hue
desktop/core/ext-py/Pygments-1.3.1/pygments/style.py
75
3745
# -*- coding: utf-8 -*- """ pygments.style ~~~~~~~~~~~~~~ Basic style object. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pygments.token import Token, STANDARD_TYPES class StyleMeta(type): def __new__(mcs, name, bases,...
apache-2.0
Glyfina-Fernando/pymtl
pisa/pisa_inst_or_test.py
4
5460
#========================================================================= # pisa_or_test.py #========================================================================= import pytest import random import pisa_encoding from pymtl import Bits from PisaSim import PisaSim from pisa_inst_test_utils import * #----------...
bsd-3-clause
bjodah/chempy
chempy/tests/test_chemistry.py
1
20158
# -*- coding: utf-8 -*- from functools import reduce from operator import attrgetter, add import sys import pytest from ..util.arithmeticdict import ArithmeticDict from ..util.testing import requires from ..util.parsing import parsing_library from ..units import default_units, units_library, to_unitless, allclose fr...
bsd-2-clause
jvansteirteghem/twunnel
twunnel/dns_resolver.py
1
8895
# Copyright (c) Jeroen Van Steirteghem # See LICENSE from twisted.internet import error, defer, protocol, reactor from twisted.names import common, dns, hosts, resolve from twisted.python import failure import socket import twunnel.logger import twunnel.proxy_server def setDefaultConfiguration(configuration, keys): ...
mit
sahilshekhawat/sympy
sympy/geometry/ellipse.py
7
41167
"""Elliptical geometrical entities. Contains * Ellipse * Circle """ from __future__ import print_function, division from sympy.core import S, sympify, pi from sympy.core.logic import fuzzy_bool from sympy.core.numbers import oo, Rational from sympy.core.compatibility import range from sympy.core.symbol import Dummy...
bsd-3-clause
shinyChen/browserscope
categories/richtext/handlers.py
9
2481
#!/usr/bin/python2.5 # # Copyright 2009 Google 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 or ...
apache-2.0
niceguydave/cmsplugin-filer
cmsplugin_filer_file/migrations/0002_auto__add_field_filerfile_target_blank.py
14
9411
# -*- 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): # Adding field 'FilerFile.target_blank' db.add_column('cmsplugin_filerfile', 'target_blank', ...
bsd-3-clause
michaelhogg/SublimeTextXdebug
main.py
3
24300
import sublime import sublime_plugin import os import sys import threading # Load modules try: from .xdebug import * except: from xdebug import * # Set Python libraries from system installation python_path = config.get_value(S.KEY_PYTHON_PATH) if python_path: python_path = os.path.normpath(python_path.re...
mit
lthurlow/Network-Grapher
proj/external/matplotlib-1.2.1/lib/mpl_examples/event_handling/pick_event_demo.py
4
6436
#!/usr/bin/env python """ You can enable picking by setting the "picker" property of an artist (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, etc...) There are a variety of meanings of the picker property None - picking is disabled for this artist (default) boolean - if True then pick...
mit
JakeLowey/HackRPI2
django/conf/locale/lv/formats.py
316
1490
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = r'Y. \g\a\d\a j. F' TIME_FORMAT = 'H:i:s' DATETIME_FORMAT = r'Y. \g\a\d\a ...
mit
DarthThanatos/citySimNG
citySimNGView/extra/scrollable_wx_matplotlib.py
1
2647
from numpy import arange, sin, pi import matplotlib matplotlib.use('WXAgg') from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg from matplotlib.figure import Figure import wx class MyFrame(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, id, 'scrollable plot', ...
apache-2.0
uclouvain/osis_louvain
cms/enums/entity_name.py
1
1447
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
agpl-3.0
calebfoss/tensorflow
tensorflow/contrib/learn/python/learn/estimators/run_config_test.py
16
7847
# 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...
apache-2.0
pombreda/iris-panel
iris/packagedb/tests/test_apiviews.py
7
12682
# -*- coding: utf-8 -*- #This file is part of IRIS: Infrastructure and Release Information System # # Copyright (C) 2013 Intel Corporation # # IRIS is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # version 2.0 as published by the Free Software Foundation. "...
gpl-2.0
garrettcap/Bulletproof-Backup
wx/lib/dragscroller.py
7
2580
#----------------------------------------------------------------------------- # Name: dragscroller.py # Purpose: Scrolls a wx.ScrollWindow by dragging # # Author: Riaan Booysen # # Created: 2006/09/05 # Copyright: (c) 2006 # Licence: wxPython #-------------------------------------------------...
gpl-2.0
Pexego/odoo
addons/l10n_us/__init__.py
893
1045
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
agpl-3.0
glmcdona/meddle
examples/base/Lib/sndhdr.py
257
5973
"""Routines to help recognizing sound files. Function whathdr() recognizes various types of sound file headers. It understands almost all headers that SOX can decode. The return tuple contains the following items, in this order: - file type (as SOX understands it) - sampling rate (0 if unknown or hard to decode) - nu...
mit
toshywoshy/ansible
lib/ansible/modules/network/netscaler/netscaler_cs_policy.py
124
9505
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2017 Citrix Systems # 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
3nids/QGIS
python/plugins/processing/script/AddScriptFromTemplateAction.py
45
1877
# -*- coding: utf-8 -*- """ *************************************************************************** AddScriptFromTemplateAction.py --------------------- Date : August 2012 Copyright : (C) 2018 by Matteo Ghetta Email : matteo dot ghetta at gmail dot com ...
gpl-2.0
ambitioninc/django-localized-recurrence
localized_recurrence/tests/models_tests.py
1
23235
from datetime import datetime, timedelta from django.test import TestCase from django_dynamic_fixture import G import pytz from ..models import LocalizedRecurrence, LocalizedRecurrenceQuerySet from ..models import _replace_with_offset, _update_schedule class LocalizedRecurrenceUpdateTest(TestCase): """ Test...
mit
robjohnson189/home-assistant
homeassistant/util/__init__.py
20
9523
"""Helper methods for various modules.""" from collections.abc import MutableSet from itertools import chain import threading from datetime import datetime import re import enum import socket import random import string from functools import wraps from types import MappingProxyType from unicodedata import normalize fr...
mit
GinnyN/towerofdimensions-django
ifz/build/pip/build/lib/pip/download.py
17
17565
import cgi import getpass import hashlib import mimetypes import os import re import shutil import sys import tempfile from pip.backwardcompat import (xmlrpclib, urllib, urllib2, urlparse, string_types) from pip.exceptions import InstallationError from pip.util import (splitext, rmtree, ...
bsd-3-clause
Zord13appdesa/python-for-android
python3-alpha/python3-src/Lib/encodings/cp1251.py
272
13361
""" Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,in...
apache-2.0
auduny/home-assistant
homeassistant/components/coinbase/__init__.py
7
3122
"""Support for Coinbase.""" from datetime import timedelta import logging import voluptuous as vol from homeassistant.const import CONF_API_KEY import homeassistant.helpers.config_validation as cv from homeassistant.helpers.discovery import load_platform from homeassistant.util import Throttle _LOGGER = logging.getL...
apache-2.0
apechimp/servo
tests/wpt/web-platform-tests/tools/html5lib/html5lib/tests/test_treewalkers.py
429
13692
from __future__ import absolute_import, division, unicode_literals import os import sys import unittest import warnings from difflib import unified_diff try: unittest.TestCase.assertEqual except AttributeError: unittest.TestCase.assertEqual = unittest.TestCase.assertEquals from .support import get_data_files...
mpl-2.0
liam821/e46fanatics
crawler.py
1
4142
#!/usr/bin/env python import cgi import cgitb import re import string # https://pypi.python.org/pypi/urllib3 import urllib3 ''' e46 page crawler Please see http://forum.e46fanatics.com/showthread.php?t=1049600 for help By Liam Slusser / lslusser at gmail.com / 8/22/2014 ''' cgitb.enable() class urlFetcher: de...
gpl-2.0
wouwei/PiLapse
picam/picamEnv/Lib/site-packages/click/_textwrap.py
282
1198
import textwrap from contextlib import contextmanager class TextWrapper(textwrap.TextWrapper): def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): space_left = max(width - cur_len, 1) if self.break_long_words: last = reversed_chunks[-1] cut = last[:spa...
apache-2.0
brianjgeiger/osf.io
website/preprints/tasks.py
3
8862
from django.apps import apps import logging from future.moves.urllib.parse import urljoin import random import requests from framework.exceptions import HTTPError from framework.celery_tasks import app as celery_app from framework.postcommit_tasks.handlers import enqueue_postcommit_task, get_task_from_postcommit_queu...
apache-2.0
cpollard1001/FreeCAD_sf_master
src/Tools/updatefromcrowdin.py
6
11247
#!/usr/bin/python #*************************************************************************** #* * #* Copyright (c) 2009 Yorik van Havre <yorik@uncreated.net> * #* ...
lgpl-2.1
ccarouge/cwsl-ctools
utils/extract_timeseries.py
3
2708
#!/usr/bin/env python """ Extract a JSON time series from a netCDF file. Returns a JSON object with an array of numerical data and a corresponding array of ISO strings. """ import argparse import re import json import sys import datetime as dt import scipy.io.netcdf as nc def main(args): """ Extract a JSON ti...
apache-2.0
homework/nox
src/nox/lib/packet/t/dns_parse_test.py
10
5255
# Copyright 2008 (C) Nicira, Inc. # # This file is part of NOX. # # NOX 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. # # NOX is d...
gpl-3.0
yongshengwang/hue
build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/contrib/gis/sitemaps/georss.py
314
2134
from django.core import urlresolvers from django.contrib.sitemaps import Sitemap class GeoRSSSitemap(Sitemap): """ A minimal hook to produce sitemaps for GeoRSS feeds. """ def __init__(self, feed_dict, slug_dict=None): """ This sitemap object initializes on a feed dictionary (as would b...
apache-2.0
ovnicraft/server-tools
auth_dynamic_groups/model/res_groups.py
23
2540
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Therp BV (<http://therp.nl>). # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
agpl-3.0
basiccoin/basiccoin
contrib/testgen/base58.py
2139
2818
''' Bitcoin base58 encoding and decoding. Based on https://bitcointalk.org/index.php?topic=1026.0 (public domain) ''' import hashlib # for compatibility with following code... class SHA256: new = hashlib.sha256 if str != bytes: # Python 3.x def ord(c): return c def chr(n): return byte...
mit
jeffknupp/sandman
tests/test_foreign_keys.py
5
1692
"""Test foreign key edge cases.""" import os import shutil import json from sandman import app class TestSandmanForeignKeysBase(object): """Class to test edge-case foreign key conditions, using a database explicitly built to contain these cases.""" DB_LOCATION = os.path.join(os.getcwd(), 'tests', 'forei...
apache-2.0
mollstam/UnrealPy
UnrealPyEmbed/Source/Python/Lib/python27/test/test_nntplib.py
45
1652
import socket import nntplib import time import unittest try: import threading except ImportError: threading = None from unittest import TestCase from test import test_support HOST = test_support.HOST def server(evt, serv, evil=False): serv.listen(5) try: conn, addr = serv.accept() exc...
mit
hlkline/SU2
SU2_PY/set_ffd_design_var.py
2
9784
#!/usr/bin/env python ## \file set_ffd_design_var.py # \brief Python script for automatically generating a list of FFD variables. # \author T. Economon, F. Palacios # \version 6.1.0 "Falcon" # # The current SU2 release has been coordinated by the # SU2 International Developers Society <www.su2devsociety.org> # with...
lgpl-2.1
dlazz/ansible
lib/ansible/galaxy/login.py
2
4573
######################################################################## # # (C) 2015, Chris Houseknecht <chouse@ansible.com> # # 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 Fo...
gpl-3.0
anryko/ansible
test/units/modules/network/edgeswitch/test_edgeswitch_facts.py
23
3092
# (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...
gpl-3.0
ajdavis/asyncio
examples/child_process.py
10
3769
""" Example of asynchronous interaction with a child python process. This example shows how to attach an existing Popen object and use the low level transport-protocol API. See shell.py and subprocess_shell.py for higher level examples. """ import os import sys try: import asyncio except ImportError: # async...
apache-2.0
tuxfux-hlp-notes/python-batches
archieves/Batch-63/14-files/myenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree_lxml.py
384
6309
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from lxml import etree from ..treebuilders.etree import tag_regexp from . import base from .. import _ihatexml def ensure_str(s): if s is None: return None elif isinstance(s, text_type): ...
gpl-3.0
peeyush-tm/check_mk
web/plugins/views/webservice.py
1
6788
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ /...
gpl-2.0
TalShafir/ansible
lib/ansible/modules/network/netscaler/netscaler_lb_vserver.py
101
72334
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (c) 2017 Citrix Systems # 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
leansoft/edx-platform
openedx/core/djangoapps/credit/tasks.py
14
7285
""" This file contains celery tasks for credit course views. """ import datetime from pytz import UTC from django.conf import settings from celery import task from celery.utils.log import get_task_logger from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from .api import set_credit_r...
agpl-3.0
tomakant/data-science-from-scratch
code/decision_trees.py
60
5866
from __future__ import division from collections import Counter, defaultdict from functools import partial import math, random def entropy(class_probabilities): """given a list of class probabilities, compute the entropy""" return sum(-p * math.log(p, 2) for p in class_probabilities if p) def class_probabilit...
unlicense
nivertech/duktape
util/filter_test262_log.py
12
2355
#!/usr/bin/python import os import sys import json import yaml def main(): with open(sys.argv[1], 'rb') as f: known_issues = yaml.load(f.read()) skipstrings = [ 'passed in strict mode', 'passed in non-strict mode', 'failed in strict mode as expected', 'failed in non-strict mode as expected' ] in_faile...
mit
timothyclemansinsea/smc
src/dev/project/util.py
1
1250
from __future__ import print_function import os, json, socket join = os.path.join def cmd(s): print(s) if os.system(s): raise RuntimeError def chdir(): os.chdir(os.path.split(os.path.abspath(__file__))[0]) def base_url(): info_file = join(os.environ['SMC'], 'info.json') info = json.load...
gpl-3.0
kenshay/ImageScripter
ProgramData/SystemFiles/Python/Lib/site-packages/PyQt4/examples/tools/i18n/i18n_rc3.py
5
48804
# -*- coding: utf-8 -*- # Resource object code # # Created: Wed Mar 20 13:49:41 2013 # by: The Resource Compiler for PyQt (Qt v4.8.4) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = b"\ \x00\x00\x03\x4c\ \x3c\ \xb8\x64\x18\xca\xef\x9c\x95\xcd\x21\x1c\xbf\x60\...
gpl-3.0
an7oine/WinVHS
Cygwin/lib/python2.7/wsgiref/simple_server.py
19
4768
"""BaseHTTPServer that implements the Python WSGI protocol (PEP 333, rev 1.21) This is both an example of how WSGI can be implemented, and a basis for running simple web applications on a local machine, such as might be done when testing or debugging an application. It has not been reviewed for security issues, howev...
gpl-3.0
Marcusz97/CILP_Facilitatore_Audacity
lib-src/lv2/lv2/plugins/eg03-metro.lv2/waflib/Tools/kde4.py
275
2007
#! /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,re from waflib import Options,TaskGen,Task,Utils from waflib.TaskGen import feature,after_method @feature('msgfmt') def apply_msgfmt(self): for lang in self.to_...
gpl-2.0
d-lee/airflow
airflow/macros/hive.py
29
4204
# -*- 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
amarian12/zetacoin_p2pool
nattraverso/pynupnp/__init__.py
288
1088
""" This package offers ways to retreive ip addresses of the machine, and map ports through UPnP devices. @author: Raphael Slinckx @copyright: Copyright 2005 @license: LGPL @contact: U{raphael@slinckx.net<mailto:raphael@slinckx.net>} @version: 0.1.0 """ __revision__ = "$id" from nattraverso.pynupnp.upnp import search...
gpl-3.0
perezg/infoxchange
BASE/lib/python2.7/site-packages/django/core/cache/backends/base.py
99
7900
"Base Cache class." from __future__ import unicode_literals import warnings from django.core.exceptions import ImproperlyConfigured, DjangoRuntimeWarning from django.utils.importlib import import_module class InvalidCacheBackendError(ImproperlyConfigured): pass class CacheKeyWarning(DjangoRuntimeWarning): p...
apache-2.0
encukou/freeipa
ipatests/test_ipalib/test_crud.py
8
7143
# Authors: # Jason Gerard DeRose <jderose@redhat.com> # # Copyright (C) 2008 Red Hat # see file 'COPYING' for use and warranty information # # 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, ei...
gpl-3.0
liuzcgithub/chef-repo
cookbooks/CLM_E1_APP_COOKBOOK/files/default/WASCommon/BeforeConvertCert.py
2
5432
def AddCustomProperties(appserver,appnode): print "----- Add custom properties ----------------" serverid = AdminConfig.getid("/Cell:" + cellName + "/Node:" + appnode + "/Server:" + appserver +"/") pp = AdminConfig.list('PluginProperties',serverid) for propname in properties.keys(): if propname.find("ppc...
apache-2.0
JohannesBuchner/regulargrid
regulargrid/test/test_regulargrid.py
1
1252
from regulargrid.regulargrid import RegularGrid import numpy def test_regular_grid(): rg = RegularGrid([(0,1), (0,1)], numpy.array([[], []]), numpy.array([[1, 2], [3, 4]])) for x in [0, 1, 0.5]: for y in [0, 1, 0.5]: print x, y, rg([x,y]) if __name__ == '__main__': numpy.random.seed(0) limits = [(-10,10), (...
bsd-2-clause
jmgc/myhdl-numeric
example/cookbook/sinecomp/test_SineComputer.py
6
2266
from math import pi, sin, cos, log import random from myhdl import * from SineComputer import SineComputer, SineComputer_v def bench(fractionSize, errorMargin, nrTests=100): """ Test bench for SineComputer. fractionSize: number of bits after the point errorMargin: margin for rounding errors on res...
lgpl-2.1
minhphung171093/OpenERP_V8
openerp/addons/hr_attendance/__init__.py
434
1122
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
agpl-3.0
chys87/scripts
sys-init/user_init.py
1
5845
from __future__ import absolute_import, print_function import os import shutil from . import utils class Skel(utils.Task): def run(self): skel = '/etc/skel' if not os.path.isdir(skel): return for name in os.listdir(skel): if not name.startswith('.'): ...
bsd-3-clause
wwj718/murp-edx
common/lib/xmodule/xmodule/capa_module.py
18
7645
"""Implements basics of Capa, including class CapaModule.""" import json import logging import sys from pkg_resources import resource_string from .capa_base import CapaMixin, CapaFields, ComplexEncoder from .progress import Progress from xmodule.x_module import XModule, module_attr from xmodule.raw_module import RawD...
agpl-3.0
breznak/nupic
src/nupic/swarming/HypersearchV2.py
31
169327
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
agpl-3.0
Alwnikrotikz/visvis
functions/polarplot.py
3
7019
# -*- coding: utf-8 -*- # Copyright (C) 2012, Keith Smith # # Visvis is distributed under the terms of the (new) BSD License. # The full license can be found in 'license.txt'. # # Thanks to Keith Smith for implementing the polar plot functionality. import numpy as np import visvis as vv from visvis.utils.pypoints imp...
bsd-3-clause
garrettcap/Bulletproof-Backup
Python2.7/lib/python2.7/site-packages/pip/vendor/html5lib/treewalkers/pulldom.py
1729
2302
from __future__ import absolute_import, division, unicode_literals from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ COMMENT, IGNORABLE_WHITESPACE, CHARACTERS from . import _base from ..constants import voidElements class TreeWalker(_base.TreeWalker): def __iter__(self): ignore_until = None...
gpl-2.0
cypresskr/linux
tools/perf/util/setup.py
2079
1438
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_optio...
gpl-2.0
ramanajee/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/common/watchlist/watchlistparser_unittest.py
121
11443
# Copyright (C) 2011 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 the f...
bsd-3-clause
pchaigno/grreat
lib/checks/filters_test.py
4
3125
#!/usr/bin/env python """Tests for grr.lib.rdfvalues.checks.""" import collections from grr.lib import flags from grr.lib import rdfvalue from grr.lib import test_lib from grr.lib.checks import filters from grr.lib.rdfvalues import checks # Just a named tuple that can be used to test objectfilter expressions. Sample ...
apache-2.0
Krossom/python-for-android
python-build/python-libs/gdata/tests/gdata_tests/codesearch_test.py
133
1930
#!/usr/bin/python # # Copyright (C) 2007 Google 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
tvwenger/galfacts
channel.py
1
1516
""" channel.py Channel object for GALFACTS transient search 02 June 2014 - Trey Wenger - creation """ import os import sys import numpy as np class Channel(object): """Channel object for GALFACTS transient search""" def __init__(self, chan_num, beam_num, **options): """Initialize the channel object""" ...
mit
jjmiranda/edx-platform
lms/djangoapps/instructor_task/tests/test_models.py
4
4163
""" Tests for instructor_task/models.py. """ import copy from cStringIO import StringIO import time import boto from django.conf import settings from django.test import SimpleTestCase, override_settings from mock import patch from common.test.utils import MockS3Mixin from instructor_task.models import ReportStore fro...
agpl-3.0
indradhanush/filesync-server
src/backends/db/tests/test_dbwatcher.py
6
10712
# Copyright 2008-2015 Canonical # # 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 version. # # This program is distributed...
agpl-3.0
zooko/ogresvpixies
HexBoard.py
1
16946
CVS_ID = '$Id: HexBoard.py,v 1.3 2002/02/09 22:46:13 zooko Exp $' import java from java.awt import * from java.awt.event import * from java.awt.geom import * from javax.swing import * from javax.swing.text import * import math from types import * from util import * true = 1 false = 0 LINEWIDTH=2 # ??? # Hex insta...
gpl-2.0