repo_name
stringlengths
5
100
path
stringlengths
4
375
copies
stringclasses
991 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
nirvn/QGIS
tests/src/python/test_qgsvectorlayercache.py
22
3911
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsVectorLayerCache. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. "...
gpl-2.0
esakellari/root
interpreter/llvm/src/tools/clang/www/builtins.py
99
6633
#!/usr/bin/env python import sys, fileinput err=0 # Giant associative set of builtin->intrinsic mappings where clang doesn't # implement the builtin since the vector operation works by default. repl_map = { '__builtin_ia32_addps': '_mm_add_ps', '__builtin_ia32_addsd': '_mm_add_sd', '__builtin_ia32_addpd': '_mm_add_...
lgpl-2.1
hamiltont/CouchPotatoServer
couchpotato/core/notifications/email/__init__.py
7
1913
from .main import Email def start(): return Email() config = [{ 'name': 'email', 'groups': [ { 'tab': 'notifications', 'list': 'notification_providers', 'name': 'email', 'options': [ { 'name': 'enabled', ...
gpl-3.0
MartinEnder/erpnext-de
erpnext/setup/setup_wizard/test_setup_data.py
52
159337
from __future__ import unicode_literals args = { "attach_letterhead": "erpnext.jpg,data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
agpl-3.0
pleaseproject/python-for-android
python3-alpha/python3-src/Lib/test/test_structseq.py
57
4010
import os import time import unittest from test import support class StructSeqTest(unittest.TestCase): def test_tuple(self): t = time.gmtime() self.assertIsInstance(t, tuple) astuple = tuple(t) self.assertEqual(len(t), len(astuple)) self.assertEqual(t, astuple) # ...
apache-2.0
dgjustice/ansible
lib/ansible/modules/cloud/ovirt/ovirt_permissions_facts.py
13
4468
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2016 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 #...
gpl-3.0
karlcow/ymir
ymir/utils/make_post.py
1
5023
from datetime import datetime from glob import glob import locale from pprint import pprint import re import sys from textwrap import dedent import mistune from PIL import Image ROOT = '/Users/karl/Sites/la-grange.net' INDENTATION = re.compile(r'\n\s{2,}') META = re.compile(r'^(\w+):([^\n]*)\n') PATH = re.compile(r'...
mit
alsrgv/tensorflow
tensorflow/contrib/distributions/python/ops/vector_laplace_linear_operator.py
21
11027
# 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
xsynergy510x/android_external_chromium_org
tools/telemetry/telemetry/page/page_set_archive_info.py
26
6409
# Copyright 2013 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 logging import os import re import shutil import tempfile from telemetry.util import cloud_storage class PageSetArchiveInfo(object): ...
bsd-3-clause
kzky/python-online-machine-learning-library
pa/passive_aggressive_2.py
1
6472
import numpy as np import scipy as sp import logging as logger import time import pylab as pl from collections import defaultdict from sklearn.metrics import confusion_matrix class PassiveAggressiveII(object): """ Passive Aggressive-II algorithm: squared hinge loss PA. References: - http://jmlr.o...
bsd-3-clause
divergentdave/inspectors-general
inspectors/nea.py
2
6711
#!/usr/bin/env python import datetime import logging import os from urllib.parse import urljoin from utils import utils, inspector, admin # http://arts.gov/oig archive = 2005 # options: # standard since/year options for a year range to fetch from. # report_id: only bother to process a single report # # Notes fo...
cc0-1.0
kiith-sa/QGIS
python/plugins/processing/admintools/httplib2/__init__.py
43
70449
# -*- coding: utf-8 -*- """ *************************************************************************** __init__.py --------------------- Date : November 2006 Copyright : (C) 2012 by Joe Gregorio Email : joe at bitworking dot org ***************************...
gpl-2.0
pulilab/django-collectform
docs/conf.py
1
8195
# -*- coding: utf-8 -*- # # complexity documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # 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 # autogenerated file. # # ...
bsd-3-clause
0x90sled/catapult
third_party/beautifulsoup4/scripts/demonstrate_parser_differences.py
73
2976
"""Demonstrate how different parsers parse the same markup. Beautiful Soup can use any of a number of different parsers. Every parser should behave more or less the same on valid markup, and Beautiful Soup's unit tests make sure this is the case. But every parser handles invalid markup differently. Even different vers...
bsd-3-clause
FallenAngelX/Infinity_MaNGOS
dep/libmpq/bindings/python/mpq.py
501
10430
"""wrapper for libmpq""" # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope th...
gpl-2.0
rlaverde/scorecard_cps
performance_indicators_project/performance_indicators_project/urls.py
1
2366
from django.conf.urls import patterns, include, url from django.conf.urls.static import static from django.conf import settings from django.views.generic import TemplateView # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^...
gpl-3.0
AlMikFox3/Ciphers
VignereCipher/vignere_cipher.py
1
1867
import time import random LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def encrypt(): fname = input('Enter the name/path of the file to be encrypted : ') f = open(fname, 'r') msg = f.read() f.close() #key = input ('Enter Security Key (character string) for encryption :') key = '' kl = random.randint(10,17)...
mit
lamdnhan/osf.io
website/addons/github/views/config.py
37
2946
# -*- coding: utf-8 -*- import httplib as http from flask import request from framework.auth.decorators import must_be_logged_in from framework.exceptions import HTTPError from website.project.decorators import must_have_permission from website.project.decorators import must_not_be_registration from website.project...
apache-2.0
vk-brain/sketal
plugins/outsource/outsource_emotions_detector.py
2
4569
from handler.base_plugin import CommandPlugin import aiohttp, json, time class EmotionsDetectorPlugin(CommandPlugin): __slots__ = ("key", "dirt", "clean_time", "requests_amount", "time_delta") def __init__(self, *commands, prefixes=None, strict=False, key=None, time_delta=60, requests_amount=15): ""...
mit
joerg84/arangodb
3rdParty/V8/v5.7.0.0/tools/gyp/test/mac/gyptest-app.py
34
4074
#!/usr/bin/env python # Copyright (c) 2012 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 that app bundles are built correctly. """ import TestGyp import TestMac import os import plistlib import subprocess import sy...
apache-2.0
georgestarcher/TA-SyncKVStore
bin/ta_synckvstore/solnlib/packages/splunklib/searchcommands/search_command.py
4
38354
# coding=utf-8 # # Copyright © 2011-2015 Splunk, 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 ...
mit
seankelly/buildbot
master/buildbot/test/fake/state.py
10
1108
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
gpl-2.0
pymedusa/Medusa
ext/boto/beanstalk/wrapper.py
153
1078
"""Wraps layer1 api methods and converts layer1 dict responses to objects.""" from boto.beanstalk.layer1 import Layer1 import boto.beanstalk.response from boto.exception import BotoServerError import boto.beanstalk.exception as exception def beanstalk_wrapper(func, name): def _wrapped_low_level_api(*args, **kwarg...
gpl-3.0
SatoshiNXSimudrone/sl4a-damon-clone
python-modules/pybluez/examples/advanced/inquiry-with-rssi.py
20
5076
# performs a simple device inquiry, followed by a remote name request of each # discovered device import os import sys import struct import _bluetooth as bluez def printpacket(pkt): for c in pkt: sys.stdout.write("%02x " % struct.unpack("B",c)[0]) print def read_inquiry_mode(sock): """returns t...
apache-2.0
havt/odoo
openerp/tools/convert.py
205
41282
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 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
james4424/nest-simulator
pynest/nest/tests/test_sp/test_sp_manager.py
8
4250
# -*- coding: utf-8 -*- # # test_sp_manager.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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...
gpl-2.0
tonybaloney/st2contrib
packs/networking_utils/actions/is_valid_ip.py
4
2527
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th...
apache-2.0
XDestination/mongo-connector
mongo_connector/doc_managers/doc_manager_simulator.py
2
6559
# Copyright 2013-2014 MongoDB, 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 agreed to in writin...
apache-2.0
shakamunyi/tensorflow
tensorflow/contrib/distributions/python/kernel_tests/gaussian_test.py
5
5286
# 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
digimarc/django
django/contrib/admin/migrations/0001_initial.py
142
1657
# -*- coding: utf-8 -*- from __future__ import unicode_literals import django.contrib.admin.models from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('conten...
bsd-3-clause
KevinFasusi/supplychainpy
supplychainpy/_helpers/_config_file_paths.py
1
2886
# Copyright (c) 2015-2016, The Authors and Contributors # <see AUTHORS file> # 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 n...
bsd-3-clause
manasi24/tempest
tempest/api_schema/response/compute/v2_1/services.py
23
2372
# Copyright 2014 NEC Corporation. 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 ...
apache-2.0
cryptofun/honey
share/seeds/generate-seeds.py
1
4185
#!/usr/bin/python # Copyright (c) 2014 Wladmir J. van der Laan # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory ...
mit
githubutilities/LeetCode
Python/invert-binary-tree.py
3
2242
# Time: O(n) # Space: O(h) # # Invert a binary tree. # # 4 # / \ # 2 7 # / \ / \ # 1 3 6 9 # to # 4 # / \ # 7 2 # / \ / \ # 9 6 3 1 # # Time: O(n) # Space: O(w), w is the max number of the nodes of the levels. # BFS solution. class Queue: def __init__(self): ...
mit
RachellCalhoun/craftsite
crafts/migrations/0001_initial.py
1
1079
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations ...
gpl-3.0
pombreda/formalchemy
formalchemy/tests/__init__.py
2
13869
# -*- coding: utf-8 -*- import os import glob import logging logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) from BeautifulSoup import BeautifulSoup # required for html prettification from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base loggin...
mit
da4089/simplefix
simplefix/parser.py
1
8483
#! /usr/bin/env python ######################################################################## # SimpleFIX # Copyright (C) 2016-2020, David Arnold. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the S...
mit
ajs-sun/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
hoangminhitvn/flask
flask/lib/python2.7/site-packages/werkzeug/_compat.py
448
6184
import sys import operator import functools try: import builtins except ImportError: import __builtin__ as builtins PY2 = sys.version_info[0] == 2 _identity = lambda x: x if PY2: unichr = unichr text_type = unicode string_types = (str, unicode) integer_types = (int, long) int_to_byte = c...
bsd-3-clause
sogelink/ansible
lib/ansible/modules/network/layer3/net_vrf.py
96
1854
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Ansible by Red Hat, inc # 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
popazerty/e2-gui
lib/python/Plugins/Extensions/MovieBrowser/plugin.py
6
300332
# 2013.06.25 13:29:48 CEST #Embedded file name: /usr/lib/enigma2/python/Plugins/Extensions/MovieBrowser/MovieBrowser.py from Components.ActionMap import ActionMap from Components.config import config, configfile, ConfigDirectory, ConfigSlider, ConfigSubsection, ConfigSelection, getConfigListEntry from Components.Config...
gpl-2.0
AOSP-S4-KK/platform_external_chromium_org
chrome/common/extensions/docs/server2/api_data_source_test.py
23
10290
#!/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 sys import unittest from api_data_source import (_JSCModel, _FormatValue...
bsd-3-clause
jhawkesworth/ansible
lib/ansible/plugins/terminal/slxos.py
177
1962
# # (c) 2018 Extreme Networks 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. # # Ans...
gpl-3.0
LaoZhongGu/kbengine
kbe/res/scripts/common/Lib/ctypes/test/test_memfunctions.py
50
3265
import sys import unittest from ctypes import * class MemFunctionsTest(unittest.TestCase): ## def test_overflow(self): ## # string_at and wstring_at must use the Python calling ## # convention (which acquires the GIL and checks the Python ## # error flag). Provoke an error and catch it; see al...
lgpl-3.0
kawamon/hue
desktop/core/ext-py/eventlet-0.24.1/tests/manual/greenio_memtest.py
10
1872
import eventlet from eventlet import greenio import os __test__ = False _proc_status = '/proc/%d/status' % os.getpid() _scale = {'kB': 1024.0, 'mB': 1024.0 * 1024.0, 'KB': 1024.0, 'MB': 1024.0 * 1024.0} def _VmB(VmKey): '''Private. ''' global _proc_status, _scale # get pseudo file /proc/...
apache-2.0
unseenlaser/python-for-android
python3-alpha/python3-src/Lib/email/test/test_email_codecs.py
50
3394
# Copyright (C) 2002-2006 Python Software Foundation # Contact: email-sig@python.org # email package unit tests for (optional) Asian codecs import unittest from test.support import run_unittest from email.test.test_email import TestEmailBase from email.charset import Charset from email.header import Header, decode_he...
apache-2.0
ryra/Personal
3.secsif/All/cryptopals-solutions-master/set2/12/AES_128.py
4
1929
#! /usr/bin/env python from Crypto.Cipher import AES from binascii import a2b_base64 def pkcs_7_pad(data, final_len = None): if final_len == None: final_len = (len(data)/16 + 1)*16 padding_len = final_len - len(data) return data + chr(padding_len)*padding_len def pkcs_7_unpad(data): padding_len = ord(dat...
agpl-3.0
sathnaga/avocado-vt
selftests/unit/test_installer.py
8
2175
#!/usr/bin/python import unittest import os import sys # simple magic for using scripts within a source tree basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if os.path.isdir(os.path.join(basedir, 'virttest')): sys.path.append(basedir) from virttest import installer from virttest import cart...
gpl-2.0
FedoraScientific/salome-smesh
src/SMESH_SWIG/ex11_grid3partition.py
1
3248
# -*- coding: iso-8859-1 -*- # Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesse...
lgpl-2.1
neumerance/deploy
openstack_dashboard/dashboards/project/firewalls/views.py
4
10365
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013, Big Switch Networks, 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/...
apache-2.0
windskyer/nova
nova/api/openstack/compute/legacy_v2/contrib/instance_usage_audit_log.py
66
5751
# 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...
gpl-2.0
zamattiac/osf.io
framework/flask/__init__.py
22
2444
# -*- coding: utf-8 -*- import os from flask import (Flask, request, jsonify, render_template, # noqa render_template_string, Blueprint, send_file, abort, make_response, redirect as flask_redirect, url_for, send_from_directory, current_app ) import furl from website import settings # Create app app = Flask...
apache-2.0
potsmaster/cinder
cinder/tests/unit/keymgr/test_key.py
18
1908
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory # 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/...
apache-2.0
arpan-chavda/rh_app
libs/venus/planet/vendor/html5lib/sanitizer.py
3
14430
import re from xml.sax.saxutils import escape, unescape from tokenizer import HTMLTokenizer from constants import tokenTypes class HTMLSanitizerMixin(object): """ sanitization of XHTML+MathML+SVG and of inline style attributes.""" acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area', 'art...
gpl-3.0
aeroevan/snakebite
test/commandlineparser_test.py
2
41119
# -*- coding: utf-8 -*- # Copyright (c) 2013 Spotify AB # # 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
texttochange/vusion-backend
vusion/persist/schedule/tests/test_schedule.py
1
1483
"""Tests for vusion.persist.schedule.""" from datetime import timedelta, datetime from twisted.trial.unittest import TestCase from vusion.persist import schedule_generator, DialogueSchedule from tests.utils import ObjectMaker from vusion.utils import time_from_vusion_format, time_to_vusion_format class TestSchedule...
bsd-3-clause
hanlind/nova
nova/tests/unit/api/openstack/compute/test_image_metadata.py
8
17028
# 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/LICENSE-2.0 # # Unless requ...
apache-2.0
miltonruelas/cursotecnico
branch/l10n_pe_ple/__init__.py
8
1479
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com). # # WARNING: This program as such is intended to be used by professional # programmers who take t...
agpl-3.0
Bertrand256/dash-masternode-tool
src/dashd_intf.py
1
69200
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Author: Bertrand256 # Created on: 2017-03 from __future__ import annotations import decimal import functools import json import os import re import socket import ssl import threading import time import datetime import logging from PyQt5.QtCore import QThread from bitcoi...
mit
Ruide/angr-dev
angr/angr/analyses/identifier/functions/atoi.py
5
2123
import random import string from ..func import Func, TestData class atoi(Func): def __init__(self): super(atoi, self).__init__() self.skips_whitespace = False self.allows_negative = True def rand_str(self, length, byte_list=None): #pylint disable=no-self-use if byte_list is ...
bsd-2-clause
hockeybuggy/twitter-sentiment
src/conductor.py
1
3409
#!/usr/bin/env python # File : conductor.py # Author : Douglas Anderson # Description: Simple driver for sentiment analysis implementation import os, sys import tokenize import normalize import labelselect import statsify import wordselection import dictizer import split_dataset from Token import Token fro...
mit
dannyboi104/SickRage
lib/dogpile/cache/util.py
47
5679
from hashlib import sha1 import inspect import re import collections from . import compat def coerce_string_conf(d): result = {} for k, v in d.items(): if not isinstance(v, compat.string_types): result[k] = v continue v = v.strip() if re.match(r'^[-+]?\d+$', v)...
gpl-3.0
pawelmhm/scrapy
tests/test_webclient.py
3
16648
""" from twisted.internet import defer Tests borrowed from the twisted.web.client tests. """ import os import shutil import sys from pkg_resources import parse_version import cryptography import OpenSSL.SSL from twisted.trial import unittest from twisted.web import server, static, util, resource from twisted.internet ...
bsd-3-clause
srippa/nn_deep
assignment1/cs231n/classifiers/softmax.py
3
2307
import numpy as np from random import shuffle def softmax_loss_naive(W, X, y, reg): """ Softmax loss function, naive implementation (with loops) Inputs: - W: C x D array of weights - X: D x N array of data. Data are D-dimensional columns - y: 1-dimensional array of length N with labels 0...K-1, for K class...
mit
opennode/waldur-mastermind
src/waldur_slurm/handlers.py
1
2767
import functools from django.conf import settings from django.db import transaction from django.db.models import Sum from waldur_core.core import utils as core_utils from waldur_freeipa import models as freeipa_models from . import models, tasks, utils def if_plugin_enabled(f): """Calls decorated handler only ...
mit
chris-chambers/llvm
test/CodeGen/SystemZ/Large/spill-01.py
23
1245
# Test cases where MVC is used for spill slots that end up being out of range. # RUN: python %s | llc -mtriple=s390x-linux-gnu | FileCheck %s # There are 8 usable call-saved GPRs, two of which are needed for the base # registers. The first 160 bytes of the frame are needed for the ABI # call frame, and a further 8 by...
gpl-3.0
LuqmanSahaf/kubernetes
third_party/htpasswd/htpasswd.py
897
5219
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2008-2013 Edgewall Software # Copyright (C) 2008 Eli Carter # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://trac.edge...
apache-2.0
Flyingfox646/flyingfox
src/stats/migrations/0008_auto_20151119_2230.py
2
2062
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stats', '0007_object_is_playable'), ] operations = [ migrations.AlterField( model_name='object', nam...
mit
hwuiwon/namebench
nb_third_party/dns/tsig.py
215
7851
# Copyright (C) 2001-2007, 2009, 2010 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED ...
apache-2.0
AltSchool/django
django/contrib/gis/utils/srs.py
45
3041
from django.contrib.gis.gdal import SpatialReference from django.db import DEFAULT_DB_ALIAS, connections def add_srs_entry(srs, auth_name='EPSG', auth_srid=None, ref_sys_name=None, database=None): """ This function takes a GDAL SpatialReference system and adds its information to the `spa...
bsd-3-clause
kaushik94/sympy
sympy/diffgeom/tests/test_hyperbolic_space.py
22
2583
r''' unit test describing the hyperbolic half-plane with the Poincare metric. This is a basic model of hyperbolic geometry on the (positive) half-space {(x,y) \in R^2 | y > 0} with the Riemannian metric ds^2 = (dx^2 + dy^2)/y^2 It has constant negative scalar curvature = -2 https://en.wikipedia.org/wiki/Poincare_h...
bsd-3-clause
Lancey6/redwind
migrations/20141130-eliminate-duplicate-tags.py
3
2273
""" """ import os import json from sqlalchemy import (create_engine, Table, Column, String, Integer, Float, Text, MetaData, select, ForeignKey, bindparam, delete, and_) from config import Configuration engine = create_engine(Configuration.SQLALCHEMY_DATABASE_URI, echo=Tr...
bsd-2-clause
mega-force/osmc
package/mediacenter-skin-osmc/files/usr/share/kodi/addons/script.module.unidecode/lib/unidecode/x078.py
252
4648
data = ( 'Dang ', # 0x00 'Ma ', # 0x01 'Sha ', # 0x02 'Dan ', # 0x03 'Jue ', # 0x04 'Li ', # 0x05 'Fu ', # 0x06 'Min ', # 0x07 'Nuo ', # 0x08 'Huo ', # 0x09 'Kang ', # 0x0a 'Zhi ', # 0x0b 'Qi ', # 0x0c 'Kan ', # 0x0d 'Jie ', # 0x0e 'Fen ', # 0x0f 'E ', # 0x10 'Ya ', ...
gpl-2.0
voodka/ghostbakup
node_modules/testem/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py
1788
1435
#!/usr/bin/env python import re import json # https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae # http://stackoverflow.com/a/13436167/96656 def unisymbol(codePoint): if codePoint >= 0x0000 and codePoint <= 0xFFFF: return unichr(codePoint) elif codePoint >= 0x010000 and codePoint <= 0x10FFFF: ...
mit
sbc100/native_client
src/trusted/validator_ragel/PRESUBMIT.py
12
4775
# Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Documentation on PRESUBMIT.py can be found at: # http://www.chromium.org/developers/how-tos/depottools/presubmit-scripts import json import hashl...
bsd-3-clause
tudorbarascu/QGIS
tests/src/python/test_qgsscalewidget.py
15
2940
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsScaleWidget .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __a...
gpl-2.0
aferr/TemporalPartitioningMemCtl
tests/configs/o3-timing.py
14
2408
# Copyright (c) 2006-2007 The Regents of The University of Michigan # 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 ...
bsd-3-clause
jirikuncar/invenio
invenio/testsuite/test_ext_email.py
16
11033
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2013, 2015 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any...
gpl-2.0
sholtebeck/knarflog
lib/werkzeug/formparser.py
3
21790
# -*- coding: utf-8 -*- """ werkzeug.formparser ~~~~~~~~~~~~~~~~~~~ This module implements the form parsing. It supports url-encoded forms as well as non-nested multipart uploads. :copyright: 2007 Pallets :license: BSD-3-Clause """ import codecs import re from functools import update_wrapper ...
apache-2.0
apark263/tensorflow
tensorflow/contrib/summary/summary.py
23
3781
# 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
rbtcollins/pip
tests/lib/git_submodule_helpers.py
58
2960
from __future__ import absolute_import import textwrap def _create_test_package_submodule(env): env.scratch_path.join("version_pkg_submodule").mkdir() submodule_path = env.scratch_path / 'version_pkg_submodule' env.run('touch', 'testfile', cwd=submodule_path) env.run('git', 'init', cwd=submodule_path...
mit
vicky2135/lucious
oscar/lib/python2.7/site-packages/prompt_toolkit/token.py
23
1420
""" The Token class, interchangeable with ``pygments.token``. A `Token` has some semantics for a piece of text that is given a style through a :class:`~prompt_toolkit.styles.Style` class. A pygments lexer for instance, returns a list of (Token, text) tuples. Each fragment of text has a token assigned, which when combi...
bsd-3-clause
jeffmahoney/crash-python
crash/commands/syscmd.py
1
2069
# -*- coding: utf-8 -*- # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: """ SUMMARY ------- Display system information and configuration data :: sys [config] DESCRIPTION ----------- This command displays system-specific data. If no arguments are entered, the same system data shown during crash in...
gpl-2.0
EmreAtes/spack
var/spack/repos/builtin/packages/startup-notification/package.py
5
1756
############################################################################## # Copyright (c) 2013-2018, 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...
lgpl-2.1
FMCalisto/FMCalisto.github.io
node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py
65
4989
# Copyright (c) 2011 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. import re import os import locale def XmlToString(content, encoding='utf-8', pretty=False): """ Writes the XML content to disk, touching the file only if it ha...
mit
grevutiu-gabriel/sympy
sympy/geometry/tests/test_plane.py
36
7702
from __future__ import division from sympy import (Abs, I, Dummy, Rational, Float, S, Symbol, cos, oo, pi, simplify, sin, sqrt, symbols, Derivative, asin, acos) from sympy.geometry import (Circle, Curve, Ellipse, GeometryError, Line, Point, Polygon, Ray, RegularPolygon, S...
bsd-3-clause
rvalera01/platalist
cloudflare.py
221
2812
import sys,traceback,urllib2,re, urllib,xbmc def createCookie(url,cj=None,agent='Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0'): urlData='' try: import urlparse,cookielib,urllib2 class NoRedirection(urllib2.HTTPErrorProcessor): def http_response(self, reques...
gpl-2.0
dstftw/youtube-dl
youtube_dl/extractor/r7.py
53
4600
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import int_or_none class R7IE(InfoExtractor): _VALID_URL = r'''(?x) https?:// (?: (?:[a-zA-Z]+)\.r7\.com(?:/[^/]+)+/idmedia/| ...
unlicense
jrbl/invenio
modules/webmessage/lib/webmessage.py
20
19732
# -*- coding: utf-8 -*- ## ## This file is part of Invenio. ## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN. ## ## Invenio is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of t...
gpl-2.0
peterlauri/django
django/utils/dateformat.py
7
11927
""" PHP date() style date formatting See http://www.php.net/date for format strings Usage: >>> import datetime >>> d = datetime.datetime.now() >>> df = DateFormat(d) >>> print(df.format('jS F Y H:i')) 7th October 2003 11:39 >>> """ from __future__ import unicode_literals import calendar import datetime import re impo...
bsd-3-clause
triveous/LearnFlask
flask/lib/python2.7/site-packages/flask/templating.py
783
4707
# -*- coding: utf-8 -*- """ flask.templating ~~~~~~~~~~~~~~~~ Implements the bridge to Jinja2. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import posixpath from jinja2 import BaseLoader, Environment as BaseEnvironment, \ TemplateNotFound from .glo...
apache-2.0
kyroskoh/js-test-tool
js_test_tool/tests/test_suite.py
3
26335
import unittest import mock import os import os.path from StringIO import StringIO import yaml import copy from textwrap import dedent from lxml import etree from js_test_tool.tests.helpers import TempWorkspaceTestCase from js_test_tool.suite import SuiteDescription, SuiteDescriptionError, \ SuiteRenderer, SuiteR...
apache-2.0
elpaso/QGIS
tests/src/python/test_qgsxmlutils.py
3
6048
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsXmlUtils. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. """ __aut...
gpl-2.0
mlperf/training_results_v0.7
Google/benchmarks/transformer/implementations/transformer-research-TF-tpu-v3-8192/lingvo/tasks/mt/params/wmt14_en_de.py
3
6670
# Lint as: python2, python3 # Copyright 2018 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 # ...
apache-2.0
NickPresta/sentry
src/sentry/migrations/0020_auto__add_projectdomain__add_unique_projectdomain_project_domain.py
6
12686
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models, transaction class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'ProjectDomain' db.create_table('sentry_projectdomain', ( ('id', self.gf('...
bsd-3-clause
zstackorg/zstack-woodpecker
integrationtest/vm/virtualrouter/vr/test_vr_ha.py
2
1258
''' 1. Create 1 Test VMs with VR. 2. After 1 VM created, Check VR Appliance VM ha status. @author: Quarkonics ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstackwoodpecker.operations.ha_operations as...
apache-2.0
marzique/cs50_finance
sql.py
1
6312
import datetime import decimal import importlib import logging import re import sqlalchemy import sqlparse import sys import warnings class SQL(object): """Wrap SQLAlchemy to provide a simple SQL API.""" def __init__(self, url, **kwargs): """ Create instance of sqlalchemy.engine.Engine. ...
mit
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_importlib/frozen/test_finder.py
17
2105
from .. import abc from .. import util machinery = util.import_importlib('importlib.machinery') import unittest class FindSpecTests(abc.FinderTests): """Test finding frozen modules.""" def find(self, name, path=None): finder = self.machinery.FrozenImporter return finder.find_spec(name, pat...
mit
MediaMath/Diamond
src/collectors/beanstalkd/test/testbeanstalkd.py
2
6503
#!/usr/bin/python # coding=utf-8 ################################################################################ from test import CollectorTestCase from test import get_collector_config from test import unittest from test import run_only from mock import Mock from mock import patch from diamond.collector import Coll...
mit
jtoppins/beaker
SchemaUpgrades/upgrade_0.6.8_system_status_duration.py
2
2652
#!/usr/bin/python import datetime from sqlalchemy import and_ from turbogears.database import session from bkr.server.util import load_config from bkr.server.model import System, SystemStatus, SystemActivity, \ SystemStatusDuration from bkr.server.test.assertions import assert_durations_not_overlapping, \ ...
gpl-2.0