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
google/timesketch
api_client/python/timesketch_api_client/searchtemplate.py
1
8044
# Copyright 2021 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
raccoongang/edx-platform
lms/djangoapps/grades/management/commands/compute_grades.py
5
5469
""" Command to compute all grades for specified courses. """ from __future__ import absolute_import, division, print_function, unicode_literals import hashlib import logging import six from django.core.management.base import BaseCommand from lms.djangoapps.grades.config.models import ComputeGradesSetting from opene...
agpl-3.0
freenas/samba
buildtools/wafsamba/samba_conftests.py
7
16410
# a set of config tests that use the samba_autoconf functions # to test for commonly needed configuration options import os, shutil, re import Build, Configure, Utils, Options, Logs from Configure import conf from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH def add_option(self, *k, **kw): '''syntax help: pro...
gpl-3.0
EliotBerriot/django
tests/user_commands/tests.py
205
7165
import os from django.apps import apps from django.core import management from django.core.management import BaseCommand, CommandError, find_commands from django.core.management.utils import find_command, popen_wrapper from django.db import connection from django.test import SimpleTestCase, ignore_warnings, override_s...
bsd-3-clause
CuonDeveloper/cuon
cuon_server/src/cuon/Finances.py
1
14964
import random import xmlrpclib from twisted.web import xmlrpc from basics import basics import Database class Finances(xmlrpc.XMLRPC, basics): def __init__(self): basics.__init__(self) self.oDatabase = Database.Database() self.debugFinances = 1 def getCashAccountBook(se...
gpl-3.0
HopeFOAM/HopeFOAM
ThirdParty-0.1/ParaView-5.0.1/VTK/ThirdParty/Twisted/twisted/test/test_banana.py
39
10248
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. import StringIO import sys # Twisted Imports from twisted.trial import unittest from twisted.spread import banana from twisted.python import failure from twisted.internet import protocol, main class MathTestCase(unittest.TestCase): def test...
gpl-3.0
AlexHill/django
tests/test_utils/tests.py
4
24201
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unittest from django.db import connection from django.forms import EmailField, IntegerField from django.http import HttpResponse from django.template.loader import render_to_string from django.test import SimpleTestCase, TestCase, skipIfDBFeature,...
bsd-3-clause
HiroIshikawa/21playground
thumblelog/myproject/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/util/retry.py
699
9924
import time import logging from ..exceptions import ( ConnectTimeoutError, MaxRetryError, ProtocolError, ReadTimeoutError, ResponseError, ) from ..packages import six log = logging.getLogger(__name__) class Retry(object): """ Retry configuration. Each retry attempt will create a new Re...
mit
oberlin/django
django/db/backends/oracle/features.py
356
2345
from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import InterfaceError try: import pytz except ImportError: pytz = None class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () interprets_empty_strings_as_nulls = True uses_savepoints = True ...
bsd-3-clause
erasmospunk/electrum-nvc-server
backends/irc/__init__.py
6
7237
import socket import sys import threading import time import traceback from processor import Processor from utils import Hash, print_log from version import VERSION class IrcThread(threading.Thread): def __init__(self, processor, config): threading.Thread.__init__(self) self.processor = process...
agpl-3.0
MapsPy/MapsPy
maps_monitor.py
1
10537
''' Created on Jun 6, 2013 @author: Mirna Lerotic, 2nd Look Consulting http://www.2ndlookconsulting.com/ Copyright (c) 2013, Stefan Vogt, Argonne National Laboratory All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the ...
bsd-2-clause
AKST/CatFacts
lib/twilio/rest/resources/applications.py
14
4103
from twilio.rest.resources import InstanceResource, ListResource class Application(InstanceResource): """ An application resource """ def update(self, **kwargs): """ Update this application """ return self.parent.update(self.sid, **kwargs) def delete(self): """ ...
mit
josh-willis/pycbc
pycbc/psd/variation.py
4
8566
""" PSD Variation """ import numpy from numpy.fft import rfft, irfft import scipy.signal as sig import pycbc.psd from pycbc.types import TimeSeries from pycbc.filter import resample_to_delta_t def mean_square(data, delta_t, srate, short_stride, stride): """ Calculate mean square of given time series once per s...
gpl-3.0
janczak10/incubator-airflow
airflow/utils/log/logging_mixin.py
6
1948
# -*- 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
golden1232004/kissfft
test/fft.py
67
4794
#!/usr/bin/env python import math import sys import random pi=math.pi e=math.e j=complex(0,1) def fft(f,inv): n=len(f) if n==1: return f for p in 2,3,5: if n%p==0: break else: raise Exception('%s not factorable ' % n) m = n/p Fout=[] for q in range(p)...
bsd-3-clause
kr41/ggrc-core
src/ggrc/fulltext/recordbuilder.py
3
2364
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from ggrc.models.reflection import AttributeInfo from . import Record class RecordBuilder(object): def __init__(self, tgt_class): self._fulltext_attrs = AttributeInfo.gather_attrs( tgt_clas...
apache-2.0
tsdmgz/ansible
test/units/plugins/action/test_action.py
7
26596
# -*- coding: utf-8 -*- # (c) 2015, Florian Apolloner <florian@apolloner.eu> # # 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
dan1/horizon-x509
openstack_dashboard/dashboards/identity/projects/urls.py
59
1373
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
apache-2.0
hnakamur/django
tests/template_tests/filter_tests/test_rjust.py
521
1030
from django.template.defaultfilters import rjust from django.test import SimpleTestCase from django.utils.safestring import mark_safe from ..utils import setup class RjustTests(SimpleTestCase): @setup({'rjust01': '{% autoescape off %}.{{ a|rjust:"5" }}. .{{ b|rjust:"5" }}.{% endautoescape %}'}) def test_rju...
bsd-3-clause
anistark/mozillians
vendor-local/lib/python/django_browserid/auth.py
10
4704
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import base64 import hashlib import logging from django.conf import settings from django.db import IntegrityError try: ...
bsd-3-clause
RachitKansal/scikit-learn
sklearn/utils/linear_assignment_.py
76
9523
""" Solve the unique lowest-cost assignment problem using the Hungarian algorithm (also known as Munkres algorithm). """ # Based on original code by Brain Clapper, adapted to NumPy by Gael Varoquaux. # Heavily refactored by Lars Buitinck. # # TODO: a version of this algorithm has been incorporated in SciPy; use that #...
bsd-3-clause
pyghassen/zerorpc-python
zerorpc/__init__.py
56
1534
# -*- coding: utf-8 -*- # Open Source Initiative OSI - The MIT License (MIT):Licensing # # The MIT License (MIT) # Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Softwa...
mit
OpenERPJeff/gooderp_addons
ir_sequence_autoreset/ir_sequence.py
6
3669
# -*- coding: utf-8 -*- ############################################################################## # # Auto reset sequence by year,month,day # Copyright 2013 wangbuke <wangbuke@gmail.com> # Copyright 2017 开阖软件 <www.osbzr.com> port to GoodERP v11 # # This program is free software: you can redist...
agpl-3.0
alangwansui/mtl_ordercenter
openerp/addons/delivery/delivery.py
31
11986
# -*- 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
mhielscher/simplebot
irclib.py
1
48749
# Copyright (C) 1999--2002 Joel Rosdahl # # This library 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 2.1 of the License, or (at your option) any later version. # # This library is ...
lgpl-2.1
googleapis/googleapis-gen
google/ads/googleads/v8/googleads-py/google/ads/googleads/v8/services/services/mobile_device_constant_service/client.py
1
18151
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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
rcomer/iris
lib/iris/tests/unit/coord_systems/test_VerticalPerspective.py
3
3236
# Copyright Iris contributors # # This file is part of Iris and is released under the LGPL license. # See COPYING and COPYING.LESSER in the root of the repository for full # licensing details. """Unit tests for the :class:`iris.coord_systems.VerticalPerspective` class.""" # Import iris.tests first so that some things ...
lgpl-3.0
agateau/qyok
queries.py
1
5142
# -*- coding: UTF-8 -*- from datetime import datetime from operator import attrgetter from PyQt4.QtCore import QCoreApplication from sqlobject import AND, OR, LIKE, IN from sqlobject.sqlbuilder import Select import yaml from yokadi.db import Task, Project def formatDate(date): """ strftime may return a str...
gpl-3.0
qrkourier/ansible
lib/ansible/modules/network/junos/junos_rpc.py
21
4723
#!/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
svn2github/django
django/contrib/gis/geoip/tests.py
80
4670
import os from django.conf import settings from django.contrib.gis.geos import GEOSGeometry from django.contrib.gis.geoip import GeoIP, GeoIPException from django.utils import unittest # Note: Requires use of both the GeoIP country and city datasets. # The GEOIP_DATA path should be the only setting set (the directory ...
bsd-3-clause
damienmg/bazel
tools/android/aar_native_libs_zip_creator.py
3
3096
# pylint: disable=g-direct-third-party-import # Copyright 2016 The Bazel 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/LI...
apache-2.0
ricxsar/ardupilot
Tools/LogAnalyzer/tests/TestMotorBalance.py
215
2265
from LogAnalyzer import Test,TestResult import DataflashLog class TestBalanceTwist(Test): '''test for badly unbalanced copter, including yaw twist''' def __init__(self): Test.__init__(self) self.name = "Motor Balance" def run(self, logdata, verbose): self.result = TestResult() ...
gpl-3.0
tersmitten/ansible
test/units/plugins/connection/test_ssh.py
45
31100
# -*- coding: utf-8 -*- # (c) 2015, Toshio Kuratomi <tkuratomi@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 Foundation, either version 3 of the License, or # (a...
gpl-3.0
Sorsly/subtle
google-cloud-sdk/lib/third_party/docker/docker/api/image.py
21
9415
import logging import six import warnings from ..auth import auth from ..constants import INSECURE_REGISTRY_DEPRECATION_WARNING from .. import utils from .. import errors log = logging.getLogger(__name__) class ImageApiMixin(object): @utils.check_resource def get_image(self, image): res = self._get...
mit
segwitcoin/SegwitCoin
test/functional/mempool_packages.py
30
10591
#!/usr/bin/env python3 # Copyright (c) 2014-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test descendant package tracking code.""" from test_framework.test_framework import BitcoinTestFramewo...
mit
amenonsen/ansible
lib/ansible/modules/network/fortios/fortios_log_syslogd3_filter.py
14
13745
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, 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 Lic...
gpl-3.0
l-hedgehog/bedrock
bedrock/mozorg/helpers/misc.py
9
14865
from __future__ import unicode_literals from os.path import splitext import random import urlparse from os import path from django.conf import settings from django.contrib.staticfiles.finders import find as find_static from django.template.defaultfilters import slugify as django_slugify import bleach import jingo im...
mpl-2.0
batxes/4Cin
Six_mouse_models/Six_mouse_models_final_output_0.2_-0.1_11000/Six_mouse_models25517.py
2
18205
import _surface import chimera try: import chimera.runCommand except: pass from VolumePath import markerset as ms try: from VolumePath import Marker_Set, Link new_marker_set=Marker_Set except: from VolumePath import volume_path_dialog d= volume_path_dialog(True) new_marker_set= d.new_marker_set marker_set...
gpl-3.0
revmischa/boto
tests/db/test_lists.py
136
3474
# Copyright (c) 2010 Chris Moyer http://coredumped.org/ # # 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 Software without restriction, including # without limitation the rights to use, copy, modify, ...
mit
zaina/nova
nova/api/openstack/compute/plugins/v3/shelve.py
36
3900
# Copyright 2013 Rackspace Hosting # # 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 agre...
apache-2.0
lgarren/spack
var/spack/repos/builtin/packages/meson/package.py
3
1872
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
lgpl-2.1
Djabx/mgd
mgdpck/mgd_main.py
1
8718
#! /usr/bin/python # -*- coding: utf-8 -*- import os import sys import argparse import logging import operator import itertools import webbrowser from mgdpck import logging_util # init logger first logging_util.init_logger() logging_util.add_except_name('run_script') logger = logging.getLogger(__name__) logger.addHan...
apache-2.0
jmchilton/pulsar
pulsar/client/util.py
2
5605
from threading import Lock, Event from weakref import WeakValueDictionary from os import walk from os import curdir from os.path import relpath from os.path import join import os.path import hashlib import shutil import json import base64 def unique_path_prefix(path): m = hashlib.md5() m.update(path) retu...
apache-2.0
rolandmansilla/microblog
flask/lib/python2.7/site-packages/whoosh/lang/snowball/german.py
96
5347
from .bases import _StandardStemmer from whoosh.compat import u class GermanStemmer(_StandardStemmer): """ The German Snowball stemmer. :cvar __vowels: The German vowels. :type __vowels: unicode :cvar __s_ending: Letters that may directly appear before a word final 's'. :type __s_ending: un...
bsd-3-clause
boehm-s/dotfiles
.emacs.d/elpy/rpc-venv/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py
5
5876
"""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 import sys # ipaddress has been backported to 2.6+ in pypi. If it is installed on the # s...
gpl-3.0
chadelofson/vbs2py3
venv/Lib/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py
2927
4793
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
gpl-3.0
maartenq/ansible
lib/ansible/module_utils/netapp.py
18
9888
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
gpl-3.0
Lekanich/intellij-community
python/lib/Lib/site-packages/django/db/models/aggregates.py
521
2101
""" Classes to represent the definitions of aggregate functions. """ class Aggregate(object): """ Default Aggregate definition. """ def __init__(self, lookup, **extra): """Instantiate a new aggregate. * lookup is the field on which the aggregate operates. * extra is a diction...
apache-2.0
DepthDeluxe/ansible
lib/ansible/utils/unicode.py
83
2238
# (c) 2012-2014, Toshio Kuratomi <a.badger@gmail.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 Foundation, either version 3 of the License, or # (at your option) any lat...
gpl-3.0
textbook/atmdb
atmdb/utils.py
1
4517
"""Utilities for working with TMDb models.""" async def overlapping_movies(people, client=None): """Find movies that the same people have been in. Arguments: people (:py:class:`collections.abc.Sequence`): The :py:class:`~.Person` objects to find overlapping movies for. client (:py:class:`...
isc
thomasgibson/tabula-rasa
verification/LDGH/LDGH.py
1
14704
""" This module runs a convergence history for a hybridized-DG discretization of a model elliptic problem (detailed in the main function). The method used is the LDG-H method. """ from firedrake import * from firedrake.petsc import PETSc from firedrake import COMM_WORLD import numpy as np import pandas as pd def run...
mit
cycotech/WAR-app
env/lib/python3.5/site-packages/django/core/management/base.py
58
20482
# -*- coding: utf-8 -*- """ Base classes for writing management commands (named commands which can be executed through ``django-admin`` or ``manage.py``). """ from __future__ import unicode_literals import os import sys from argparse import ArgumentParser import django from django.core import checks from django.core....
mit
adykstra/mne-python
mne/io/ctf/res4.py
5
6747
"""Read .res4 files.""" # Author: Eric Larson <larson.eric.d<gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np from ...utils import logger from .constants import CTF def _make_ctf_name(directory, extra, raise_error=True): """Make a CTF name.""" fname = op.join(directory, op.ba...
bsd-3-clause
SMatsushi/RAMCloud
scripts/colorize.py
18
4525
#!/usr/bin/env python # Copyright (c) 2012 Stanford University # # Permission to use, copy, modify, and distribute this software 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 "AS IS" AND T...
isc
birkelbach/python-canfix
tests/utils.py
1
2198
# Copyright (c) 2018 Phil Birkelbach # # 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 distrib...
gpl-2.0
ak72ti/Whynot
bot/vgstation/common/plugin.py
2
2159
''' Created on Aug 26, 2012 @author: Rob ''' # print 'Loading '+__file__ import logging, os, glob, yaml def DefinePlugin(): registry = {} def handler(_class): packageID = _class.__module__ + "." + _class.__name__ registry[packageID] = { 'name':_class.Name, 'class':_clas...
gpl-3.0
hjanime/VisTrails
contrib/itk/SmoothingFilters.py
6
20234
############################################################################ ## ## Copyright (C) 2006-2007 University of Utah. All rights reserved. ## ## This file is part of VisTrails. ## ## This file may be used under the terms of the GNU General Public ## License version 2.0 as published by the Free Software Foundat...
bsd-3-clause
graingert/pip
pip/_vendor/requests/packages/chardet/constants.py
3008
1335
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
mit
skoppisetty/secret-bugfixes
lib/cherrypy/test/test_tutorials.py
42
7190
import sys import cherrypy from cherrypy.test import helper class TutorialTest(helper.CPWebCase): def setup_server(cls): conf = cherrypy.config.copy() def load_tut_module(name): """Import or reload tutorial module as needed.""" cherrypy.config.reset() ...
gpl-3.0
submitconsulting/backengo
apps/utils/forms.py
2
3689
# _*_ coding: utf-8 _*_ """ @copyright Copyright (c) 2014 Submit Consulting @author Angel Sullon (@asullom) @package utils Descripcion: Personaliza formularios como botones """ from django.utils.translation import ugettext from django.conf import settings from django.template import Template from django....
bsd-3-clause
mshafiq9/django
tests/expressions_case/tests.py
162
49567
from __future__ import unicode_literals import unittest from datetime import date, datetime, time, timedelta from decimal import Decimal from operator import attrgetter, itemgetter from uuid import UUID from django.core.exceptions import FieldError from django.db import connection, models from django.db.models import...
bsd-3-clause
CYBAI/servo
tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py
5
5909
import os import subprocess import tempfile from mozprocess import ProcessHandler from tools.serve.serve import make_hosts_file from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser from .base import get_timeout_multiplier # noqa: F401 from ..executors import executor_kwargs as ba...
mpl-2.0
landscapeio/prospector
prospector2/formatters/text.py
1
3108
from prospector2.formatters.base import Formatter __all__ = ( 'TextFormatter', ) # pylint: disable=unnecessary-lambda class TextFormatter(Formatter): summary_labels = ( ('started', 'Started'), ('completed', 'Finished'), ('time_taken', 'Time Taken', lambda x: '%s seconds' % x), ...
gpl-2.0
alexm92/sentry
src/sentry/south_migrations/0048_migrate_project_keys.py
36
19436
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): from sentry.db.models import update for pm in orm['sentry.ProjectMember'].objects.all(): orm['sentry.Proje...
bsd-3-clause
google-research/episodic-curiosity
third_party/baselines/common/misc_util.py
1
7608
# coding=utf-8 import gym import numpy as np import os import pickle import random import tempfile import zipfile def zipsame(*seqs): L = len(seqs[0]) assert all(len(seq) == L for seq in seqs[1:]) return zip(*seqs) def unpack(seq, sizes): """ Unpack 'seq' into a sequence of lists, with lengths s...
apache-2.0
Southpaw-TACTIC/Team
src/python/Lib/whichdb.py
60
3470
# !/usr/bin/env python """Guess which db package to use to open a db file.""" import os import struct import sys try: import dbm _dbmerror = dbm.error except ImportError: dbm = None # just some sort of valid exception which might be raised in the # dbm test _dbmerror = IOError ...
epl-1.0
kaichogami/sympy
sympy/printing/tests/test_octave.py
52
12233
from sympy.core import (S, pi, oo, symbols, Function, Rational, Integer, Tuple, Symbol) from sympy.core import EulerGamma, GoldenRatio, Catalan, Lambda from sympy.functions import Piecewise, sqrt, ceiling, exp, sin, cos from sympy.utilities.pytest import raises from sympy.utilities.lambdify impo...
bsd-3-clause
rooshilp/CMPUT410Lab6
virt_env/virt1/lib/python2.7/site-packages/django/conf/locale/ml/formats.py
394
1815
# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # from __future__ import unicode_literals # The *_FORMAT strings use the Django date format syntax, # see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date DATE_FORMAT = 'N j, Y' TIME_FORMAT = 'P' DATETIM...
apache-2.0
molly24Huang/Cents_trip
Recommendation/attr_food_distance.py
1
2978
import pandas as pd from math import sin, cos, sqrt, asin, radians #import ibm_db def cal_dist(lon1, lat1, lon2, lat2): lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2 c = 2 * a...
apache-2.0
pigworlds/asuswrttest
release/src/router/samba-3.5.8/source3/stf/spoolss.py
137
18558
#!/usr/bin/python import re import comfychair, stf from samba import spoolss class PrintServerTest(comfychair.TestCase): """An abstract class requiring a print server.""" def setUp(self): # TODO: create a test printer self.server = stf.get_server(platform = "nt") self.require(self.serv...
gpl-2.0
YOTOV-LIMITED/kuma
vendor/packages/translate/convert/test_po2ical.py
24
2525
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest pytest.importorskip("vobject") from translate.convert import po2ical, test_convert from translate.misc import wStringIO from translate.storage import po icalboiler = '''BEGIN:VCALENDAR VERSION:2.0 PRODID:-//hacksw/handcal//NONSGML v1.0//EN BEGIN:VEVENT UID...
mpl-2.0
youdonghai/intellij-community
python/lib/Lib/zlib.py
82
5921
""" The functions in this module allow compression and decompression using the zlib library, which is based on GNU zip. adler32(string[, start]) -- Compute an Adler-32 checksum. compress(string[, level]) -- Compress string, with compression level in 1-9. compressobj([level]) -- Return a compressor object. crc32(string...
apache-2.0
mjhennig/dyn-python
dyn/tm/services/httpredirect.py
1
5031
# -*- coding: utf-8 -*- """This module contains API Wrapper implementations of the HTTP Redirect service """ import logging from ..session import DynectSession from ...compat import force_unicode __author__ = 'xorg' __all__ = ['HTTPRedirect'] class HTTPRedirect(object): """HTTPRedirect is a service which sets u...
bsd-3-clause
dcroc16/skunk_works
google_appengine/lib/django-1.2/django/contrib/localflavor/it/forms.py
273
3027
""" IT-specific Form helpers """ from django.core.validators import EMPTY_VALUES from django.forms import ValidationError from django.forms.fields import Field, RegexField, Select from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode from django.contrib.localflavor.it....
mit
davekennewell/geonode
geonode/upload/tests/__init__.py
32
6498
######################################################################### # # Copyright (C) 2012 OpenPlans # # 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 #...
gpl-3.0
zlatinski/omap-android-drm-kms
tools/perf/python/twatch.py
7370
1334
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # # This application is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License...
gpl-2.0
nbschool/ecommerce_api
tests/test_case.py
2
1108
""" Test case for setup and teardown methods """ import pytest from peewee import SqliteDatabase from app import app from models import Address, Item, Order, OrderItem, Picture, User, Favorite TABLES = [Address, Item, Order, OrderItem, Picture, User, Favorite] """ TABLES = list(BaseModel) All the tables that the t...
gpl-3.0
tjsavage/full_nonrel_starter
django/contrib/gis/tests/layermap/tests.py
152
12640
import os from decimal import Decimal from django.utils.copycompat import copy from django.utils.unittest import TestCase from django.contrib.gis.gdal import DataSource, OGRException from django.contrib.gis.tests.utils import mysql from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, Invalid...
bsd-3-clause
SUSE/DeepSea
tests/unit/runners/test_populate.py
2
2028
from mock import patch, MagicMock, mock from srv.modules.runners import populate class TestCephRoles(): """ A class for checking Role methods """ @patch('salt.client.LocalClient') def test_publicnetwork_is_ipv6(self, client): client.return_value.cmd.return_value = { 'minion1': {'public_ne...
gpl-3.0
JorgeCoock/django
django/core/checks/messages.py
319
2383
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.utils.encoding import force_str, python_2_unicode_compatible # Levels DEBUG = 10 INFO = 20 WARNING = 30 ERROR = 40 CRITICAL = 50 @python_2_unicode_compatible class CheckMessage(object): def __init__(self, level, msg, hint=None, obj=Non...
bsd-3-clause
wuhengzhi/chromium-crosswalk
ppapi/native_client/tools/browser_tester/browsertester/browserlauncher.py
81
11818
#!/usr/bin/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 os.path import re import shutil import sys import tempfile import time import urlparse import browserprocess class LaunchFailu...
bsd-3-clause
camagenta/youtube-dl
youtube_dl/extractor/airmozilla.py
78
3097
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( int_or_none, parse_duration, parse_iso8601, ) class AirMozillaIE(InfoExtractor): _VALID_URL = r'https?://air\.mozilla\.org/(?P<id>[0-9a-z-]+)/?' _TEST = { 'url': 'htt...
unlicense
san-mate/python-social-auth
social/backends/yahoo.py
70
6000
""" Yahoo OpenId, OAuth1 and OAuth2 backends, docs at: http://psa.matiasaguirre.net/docs/backends/yahoo.html """ from requests.auth import HTTPBasicAuth from social.utils import handle_http_errors from social.backends.open_id import OpenIdAuth from social.backends.oauth import BaseOAuth2, BaseOAuth1 class YahooO...
bsd-3-clause
emvarun/followup-and-location
Sky_Patch.py
1
4646
#!/usr/bin/python import os, re import numpy as np import healpy as hp import astropy.units as u from astropy.coordinates import SkyCoord, EarthLocation, AltAz, get_sun from astropy.time import Time from astropy.io import fits import ephem from ephem import * from params import Observatory_Locations def Patch(fitsfile...
gpl-3.0
40223151/2014c2g9
exts/wsgi/static/Brython2.1.0-20140419-113919/Lib/difflib.py
737
82544
#! /usr/bin/env python3 """ Module difflib -- helpers for computing deltas between objects. Function get_close_matches(word, possibilities, n=3, cutoff=0.6): Use SequenceMatcher to return list of the best "good enough" matches. Function context_diff(a, b): For two lists of strings, return a delta in context ...
gpl-2.0
delinhabit/django-rest-framework
tests/utils.py
84
2061
from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import NoReverseMatch class UsingURLPatterns(object): """ Isolates URL patterns used during testing on the test class itself. For example: class MyTestCase(UsingURLPatterns, TestCase): urlpatterns = [ ...
bsd-2-clause
tjyang/psp
9.1addon/sbutils-1.3.1/sbutils/lib/baseclass/depotbase.py
4
26671
# Copyright (C) 2001, 2003-2004, 2006, 2008-2010 The Written Word, Inc. # Copyright (C) 2000-2001 The Written Word, LLC # # 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, or (at...
gpl-2.0
mozilla/socorro
webapp-django/crashstats/crashstats/tests/test_bugassociations.py
1
4928
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import io import requests_mock import pytest from django.core.management import call_command from crashstats.crashsta...
mpl-2.0
telefonicaid/fiware-pep-steelskin
test/acceptance/integration/access_control_errors/steps.py
32
1455
# -*- coding: utf-8 -*- """ Copyright 2014 Telefonica Investigación y Desarrollo, S.A.U This file is part of fiware-pep-steelskin fiware-pep-steelskin 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, eithe...
agpl-3.0
andfoy/margffoy-tuay-server
env/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/escprober.py
2936
3187
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
gpl-2.0
mezz64/home-assistant
tests/components/rpi_power/test_config_flow.py
6
2199
"""Tests for rpi_power config flow.""" from homeassistant.components.rpi_power.const import DOMAIN from homeassistant.config_entries import SOURCE_USER from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import ( RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY, RESULT_TYPE_FORM, ) f...
apache-2.0
ZhuPeng/kubernetes
hack/verify-flags-underscore.py
83
8826
#!/usr/bin/env python # Copyright 2015 The Kubernetes 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 # # Unle...
apache-2.0
all-out/lightswitch
lightswitch/main/migrations/0002_auto__del_members__del_ships__add_ship__add_member.py
1
3070
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Deleting model 'Members' db.delete_table(u'main_members') # De...
mit
n6151h/pyconau2016
zkpylons/tests/functional/test_rego_room.py
3
1973
from .crud_helper import CrudHelper from .fixtures import RegoRoomFactory, CompletePersonFactory, RegistrationFactory class TestRegoRoom(CrudHelper): def test_new(self, app, db_session): peeps = [CompletePersonFactory() for i in range(10)] regos = [RegistrationFactory() for i in range(10)] ...
gpl-2.0
dparks1134/STAMP
stamp/plugins/samples/plots/configGUI/multCompCorrectionUI.py
1
12647
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'multCompCorrection.ui' # # Created: Sat Apr 16 13:41:52 2011 # by: PyQt4 UI code generator 4.6.2 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui class Ui_MultCompCorrectionDialog(object): d...
gpl-3.0
RoboticsURJC/JdeRobot
src/libs/comm_py/comm/ros/publisherCmdVel.py
5
4391
import rospy from geometry_msgs.msg import TwistStamped import threading from math import pi as PI from jderobotTypes import CMDVel from .threadPublisher import ThreadPublisher def cmdvel2Twist(vel): ''' Translates from JderobotTypes CMDVel to ROS Twist. @param vel: JderobotTypes CMDVel to translate ...
gpl-3.0
Eliminater74/temp-kernel
scripts/build-all.py
329
10325
#! /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
xsynergy510x/android_external_chromium_org
build/android/buildbot/bb_host_steps.py
45
4630
#!/usr/bin/env python # 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 os import sys import bb_utils import bb_annotations sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from pylib ...
bsd-3-clause
rh-s/heat
heat/engine/resources/openstack/manila/security_service.py
1
3666
# # 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
tlatzko/spmcluster
.tox/docs/lib/python2.7/site-packages/docutils/languages/ja.py
148
1942
# -*- coding: utf-8 -*- # $Id: ja.py 4564 2006-05-21 20:44:42Z wiemann $ # Author: Hisashi Morita <hisashim@kt.rim.or.jp> # 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>. Tw...
bsd-2-clause