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 |
|---|---|---|---|---|---|
mudbungie/NetExplorer | env/share/doc/networkx-1.11/examples/advanced/parallel_betweenness.py | 51 | 2510 | """
Example of parallel implementation of betweenness centrality using the
multiprocessing module from Python Standard Library.
The function betweenness centrality accepts a bunch of nodes and computes
the contribution of those nodes to the betweenness centrality of the whole
network. Here we divide the network in chu... | mit |
vmturbo/nova | nova/cmd/idmapshift.py | 9 | 7512 | # Copyright 2014 Rackspace, Andrew Melton
#
# 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... | apache-2.0 |
gundalow/ansible-modules-extras | cloud/cloudstack/cs_configuration.py | 32 | 8629 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2016, René Moser <mail@renemoser.net>
#
# 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 Lice... | gpl-3.0 |
Intel-bigdata/SSM | supports/integration-test/ssm_generate_test_data.py | 4 | 3241 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script will be used to create test data set. It is also called by:
- test_small_file_rule.py
- test_small_file_actions.py
"""
import sys
import ast
import os
import re
import argparse
from util import *
def create_test_set(file_set_nums, file_size, base_dir, deb... | apache-2.0 |
OpenPIV/openpiv-python | openpiv/pyprocess.py | 2 | 29417 | import numpy.lib.stride_tricks
import numpy as np
from scipy.fft import rfft2, irfft2, fftshift
from numpy import ma
from scipy.signal import convolve2d
from numpy import log
"""This module contains a pure python implementation of the basic
cross-correlation algorithm for PIV image processing."""
__licence_ = """
Cop... | gpl-3.0 |
EvanK/ansible | lib/ansible/modules/network/nxos/nxos_snmp_location.py | 106 | 4000 | #!/usr/bin/python
#
# 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 distribut... | gpl-3.0 |
brandond/ansible | lib/ansible/modules/network/f5/bigip_gtm_datacenter.py | 14 | 14902 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks 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 |
luogangyi/bcec-nova | nova/virt/hyperv/migrationops.py | 3 | 12857 | # Copyright 2013 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 |
petrutlucian94/cinder | cinder/tests/unit/test_ibm_flashsystem_iscsi.py | 18 | 9722 | # Copyright 2015 IBM Corp.
# 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 app... | apache-2.0 |
geodynamics/snac | Snac/pyre/Inlet.py | 5 | 3206 | #!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
class Inlet(object):
def __init__(self):
self._handle = None
return
def impose(sel... | gpl-2.0 |
Yong-Lee/decode-Django | Django-1.5.1/django/contrib/gis/tests/geoapp/models.py | 112 | 1877 | from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
from django.utils.encoding import python_2_unicode_compatible
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
@python_2_unicode_compatible
class Country(models.Model):
name = models.Ch... | gpl-2.0 |
kagayakidan/scikit-learn | sklearn/metrics/setup.py | 299 | 1024 | import os
import os.path
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("metrics", parent_package, top_path)
cblas_libs, blas_info = get_blas_info()
if os.name ==... | bsd-3-clause |
lferr/charm | charm/schemes/ibenc/ibenc_lsw08.py | 3 | 4047 | '''
Allison Lewko, Amit Sahai and Brent Waters (Pairing-based)
| From: "Revocation Systems with Very Small Private Keys"
| Published in: IEEE S&P 2010
| Available from: http://eprint.iacr.org/2008/309.pdf
| Notes: fully secure IBE Construction with revocable keys.
* type: identity-based encryption (public ... | lgpl-3.0 |
Ictp/indico | ez_setup.py | 11 | 10278 | #!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | gpl-3.0 |
ibusybox/pkcs | src/main/python/pkcs/opensslconf.py | 1 | 3420 | #!/usr/bin/env python
# coding=utf8
caOpensslConf = '''
#http://www.phildev.net/ssl/opensslconf.html
[ ca ]
default_ca = CA_default
[CA_default]
caroot = %(caroot)s
certs = $caroot/certsdb
new_certs_dir = $certs
database = $caroot/index.txt
certificate = $caroot/%(cn)s.cer
private_key = $caro... | apache-2.0 |
saisiddhant12/time_management_system | db.py | 1 | 1248 | import time
import datetime
import sqlite3
conn = sqlite3.connect('diary.db')
c = conn.cursor()
c.execute('''CREATE TABLE executive (unid INTEGER PRIMARY KEY,name text,designation text, abs text)''')
no_of_exec = input() #enter the total number of executives
while(no_of_exec):
no_of_exec = no... | gpl-2.0 |
lra/boto | tests/unit/vpc/test_subnet.py | 113 | 5485 | from tests.compat import OrderedDict
from tests.unit import unittest
from tests.unit import AWSMockServiceTestCase
from boto.vpc import VPCConnection, Subnet
class TestDescribeSubnets(AWSMockServiceTestCase):
connection_class = VPCConnection
def default_body(self):
return b"""
<Describe... | mit |
pravsripad/jumeg | jumeg/jumeg_test.py | 3 | 1803 | #!/usr/bin/env python
import jumeg
import os.path
raw_fname = "109925_CAU01A_100715_0842_2_c,rfDC-raw.fif"
if not os.path.isfile(raw_fname):
print("Please find the test file at the below location on the meg_store2 network drive - \
cp /data/meg_store2/fif_data/jumeg_test_data/109925_CAU01A_100715_0842_... | bsd-3-clause |
WoLpH/EventGhost | _build/builder/Logging.py | 1 | 1901 | # -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright © 2005-2016 EventGhost Project <http://www.eventghost.net/>
#
# EventGhost 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 versio... | gpl-2.0 |
jgraham/servo | tests/wpt/web-platform-tests/tools/six/six.py | 426 | 27961 | """Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2014 Benjamin Peterson
#
# 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 with... | mpl-2.0 |
ygenc/onlineLDA | onlineldavb_new/build/scipy/scipy/integrate/_ode.py | 5 | 28343 | # Authors: Pearu Peterson, Pauli Virtanen, John Travers
"""
First-order ODE integrators.
User-friendly interface to various numerical integrators for solving a
system of first order ODEs with prescribed initial conditions::
d y(t)[i]
--------- = f(t,y(t))[i],
d t
y(t=0)[i] = y0[i],
where::
... | gpl-3.0 |
brianmhunt/SIWorldMap | werkzeug/script.py | 89 | 11151 | # -*- coding: utf-8 -*-
r'''
werkzeug.script
~~~~~~~~~~~~~~~
.. admonition:: Deprecated Functionality
``werkzeug.script`` is deprecated without replacement functionality.
Python's command line support improved greatly with :mod:`argparse`
and a bunch of alternative modules.
Most ... | mit |
ner0x652/RElief | elfie.py | 1 | 6773 | #!/usr/bin/env python3
import lief
import sys
import termcolor as tc
def get_typeval_as_str(lief_type):
return str(lief_type).split('.')[1]
def show_name(binary):
print(tc.colored("[::] Name", "blue"))
print(binary.name)
def enum_header(header):
def get_ident_props():
identity = "\n{0:18... | mit |
angstwad/ansible | lib/ansible/galaxy/token.py | 68 | 2167 | #!/usr/bin/env python
########################################################################
#
# (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... | gpl-3.0 |
robbiet480/home-assistant | tests/components/folder_watcher/test_init.py | 3 | 1834 | """The tests for the folder_watcher component."""
import os
from homeassistant.components import folder_watcher
from homeassistant.setup import async_setup_component
from tests.async_mock import Mock, patch
async def test_invalid_path_setup(hass):
"""Test that an invalid path is not set up."""
assert not aw... | apache-2.0 |
bruinfish/cs118-proj2-pox | pox/messenger/__init__.py | 25 | 19645 | # Copyright 2011,2012 James McCauley
#
# This file is part of POX.
#
# POX 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.
#
# POX is d... | gpl-3.0 |
richpsharp/forest_carbon_edge_effects | average_human_use_layers.py | 1 | 8405 | import os
import time
import numpy
import functools
import sys
import codecs
import types
import gdal
import osr
from invest_natcap import raster_utils
GLOBAL_UPPER_LEFT_ROW = 2602195.7925872812047601
GLOBAL_UPPER_LEFT_COL = -11429693.3490753173828125
def average_layers():
base_table_uri = "C:/Users/rich/Desk... | apache-2.0 |
1a1a11a/mimircache | PyMimircache/cache/slru.py | 1 | 3337 | # coding=utf-8
from PyMimircache.cache.lru import LRU
from PyMimircache.cache.abstractCache import Cache
class SLRU(Cache):
def __init__(self, cache_size=1000, ratio=1, **kwargs):
"""
:param cache_size: size of cache
:param args: raio: the ratio of protected/probationary
:return:
... | gpl-3.0 |
UltronAI/Deep-Learning | Pattern-Recognition/hw2-Feature-Selection/skfeature/function/wrapper/svm_backward.py | 1 | 1775 | import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import KFold
from sklearn.metrics import accuracy_score
def svm_backward(X, y, n_selected_features):
"""
This function implements the backward feature selection algorithm based on SVM
Input
-----
X: {numpy arr... | mit |
jalexanderqed/rocksdb | build_tools/precommit_checker.py | 2 | 5638 | #!/usr/local/fbcode/gcc-4.8.1-glibc-2.17-fb/bin/python2.7
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import commands
import subprocess
import sys
import re
import os
import time
#
# Simple logger... | bsd-3-clause |
kastriothaliti/techstitution | venv/lib/python3.5/site-packages/wheel/util.py | 345 | 4890 | """Utility functions."""
import sys
import os
import base64
import json
import hashlib
try:
from collections import OrderedDict
except ImportError:
OrderedDict = dict
__all__ = ['urlsafe_b64encode', 'urlsafe_b64decode', 'utf8',
'to_json', 'from_json', 'matches_requirement']
def urlsafe_b64encode(d... | gpl-3.0 |
kirienko/gourmet | src/gourmet/threadManager.py | 1 | 15304 | # This module is designed to handle all multi-threading processes in
# Gourmet. Separate threads are limited to doing the following things
# with respect to the GUI:
#
# 1. Start a notification dialog with a progress bar
# 2. Update the progress bar
# 3. Finish successfully
# 4. Stop with an error.
#
# If you n... | gpl-2.0 |
ilismal/luhnCompliance | luhn.py | 1 | 1535 | # Luhn algorithm check
# From https://en.wikipedia.org/wiki/Luhn_algorithm
def luhn_checksum(card_number):
def digits_of(n):
return [int(d) for d in str(n)]
digits = digits_of(card_number)
odd_digits = digits[-1::-2]
even_digits = digits[-2::-2]
checksum = 0
checksum += sum(odd_digits)
... | unlicense |
abzaloid/maps | django-project/lib/python2.7/site-packages/django/contrib/sessions/middleware.py | 25 | 2648 | import time
from importlib import import_module
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
class SessionMiddleware(object):
def __init__(self):
engine = import_module(settings.SESSION_ENGINE)
self.SessionStore = eng... | mit |
hjtabisola/final-project | appengine_config.py | 36 | 3078 | # Copyright 2013 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 |
Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/encodings/cp1026.py | 593 | 13369 | """ Python Character Mapping Codec cp1026 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP1026.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,inp... | mit |
GalaxyTab4/twrp_matissevewifi | scripts/rt-tester/rt-tester.py | 11005 | 5307 | #!/usr/bin/python
#
# rt-mutex tester
#
# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import sh... | gpl-2.0 |
MaizerGomes/youtube-dl | test/test_InfoExtractor.py | 104 | 2243 | #!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from test.helper import FakeYDL
from youtube_dl.extractor.common import InfoExtractor
from youtube_dl.extractor i... | unlicense |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7.2/Lib/_LWPCookieJar.py | 267 | 6553 | """Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that ... | mit |
sdklite/gyp | test/win/win-tool/gyptest-win-tool-handles-readonly-files.py | 164 | 1699 | #!/usr/bin/env python
# Copyright (c) 2014 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.
"""
Make sure overwriting read-only files works as expected (via win-tool).
"""
import TestGyp
import filecmp
import os
import stat
import... | bsd-3-clause |
jeandet/meson | mesonbuild/modules/gnome.py | 1 | 77105 | # Copyright 2015-2016 The Meson development team
# 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 agree... | apache-2.0 |
ContinuumIO/topik | topik/vectorizers/tfidf.py | 1 | 1139 | from math import log
from ._registry import register
from vectorizer_output import VectorizerOutput
from .bag_of_words import _count_words_in_docs
def _count_document_occurences(doc_counts, total_words):
return {word_id: sum(1 for doc in doc_counts.values() if word_id in doc)
for word_id in range(tota... | bsd-3-clause |
pk-sam/crosswalk-test-suite | webapi/webapi-resourcetiming-w3c-tests/inst.apk.py | 903 | 3180 | #!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PARAMETERS = None
ADB_CMD = "adb"
def doCMD(cmd):
# Do not need handle timeout in this short script, let tool... | bsd-3-clause |
tumbl3w33d/ansible | lib/ansible/modules/cloud/amazon/ec2_eni.py | 31 | 23840 | #!/usr/bin/python
#
# 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',
'status': ['preview'],
'supporte... | gpl-3.0 |
NeCTAR-RC/nova | nova/virt/libvirt/storage/dmcrypt.py | 47 | 3448 | # Copyright (c) 2014 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/l... | apache-2.0 |
olapaola/olapaola-android-scripting | python-build/python-libs/gdata/src/gdata/analytics/service.py | 213 | 13293 | #!/usr/bin/python
#
# Copyright (C) 2006 Google Inc.
# Refactored in 2009 to work for Google Analytics by Sal Uryasev at Juice 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
#
# ht... | apache-2.0 |
keyurpatel076/MissionPlannerGit | Lib/unittest/case.py | 41 | 42078 | """Test case implementation"""
import collections
import sys
import functools
import difflib
import pprint
import re
import warnings
from . import result
from .util import (
strclass, safe_repr, unorderable_list_difference,
_count_diff_all_purpose, _count_diff_hashable
)
__unittest = True
DIFF_OMITTED = (... | gpl-3.0 |
tensorflow/lucid | tests/misc/io/test_saving.py | 1 | 6630 | import time
import pytest
import numpy as np
from lucid.misc.io.saving import save, CaptureSaveContext, batch_save
from lucid.misc.io.loading import load
from lucid.misc.io.scoping import io_scope, current_io_scopes
from concurrent.futures import ThreadPoolExecutor
import os.path
import io
import tensorflow as tf
dic... | apache-2.0 |
Snake4100/Mon-Site | vendor/doctrine/orm/docs/en/conf.py | 2448 | 6497 | # -*- coding: utf-8 -*-
#
# Doctrine 2 ORM documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 3 18:10:24 2010.
#
# 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.
... | mit |
collinjackson/mojo | nacl_bindings_generator/interface_dsl.py | 5 | 4095 | # Copyright 2014 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.
class Interface(object):
def __init__(self):
self.functions = []
def Func(self, name, return_type):
f = Function(self, len(self.functions), name... | bsd-3-clause |
idea4bsd/idea4bsd | plugins/hg4idea/testData/bin/mercurial/hgweb/hgweb_mod.py | 91 | 15218 | # hgweb/hgweb_mod.py - Web interface for a repository.
#
# Copyright 21 May 2005 - (c) 2005 Jake Edge <jake@edge2.net>
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
... | apache-2.0 |
oconnor663/peru | peru/display.py | 1 | 9334 | import asyncio
import io
import re
import sys
# The display classes deal with output from subprocesses. The FancyDisplay
# gives a multi-line, real-time view of each running process that looks nice in
# the terminal. The VerboseDisplay collects output from each job and prints it
# all when the job is finished, in a wa... | mit |
Cyberjusticelab/JusticeAI | src/ml_service/feature_extraction/post_processing/regex/regex_entity_extraction.py | 1 | 7500 | from feature_extraction.post_processing.regex.regex_lib import RegexLib
import re
import datetime
import time
import unicodedata
from util.log import Log
import math
class EntityExtraction:
regex_bin = None
one_month = 86400 * 30 # unix time for 1 month
month_dict = {
'janvier': 1,
'fevri... | mit |
mollstam/UnrealPy | UnrealPyEmbed/Source/Python/Lib/python27/lib2to3/main.py | 250 | 11605 | """
Main program for 2to3.
"""
from __future__ import with_statement
import sys
import os
import difflib
import logging
import shutil
import optparse
from . import refactor
def diff_texts(a, b, filename):
"""Return a unified diff of two strings."""
a = a.splitlines()
b = b.splitlines()
return diffl... | mit |
jocelynmass/nrf51 | toolchain/arm_cm0_deprecated/arm-none-eabi/share/gdb/python/gdb/frames.py | 68 | 8031 | # Frame-filter commands.
# Copyright (C) 2013-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any late... | gpl-2.0 |
magne4000/festival | app.py | 1 | 1221 | import os
import re
from flask import Flask
from datetime import timedelta
def interval_to_timedelta(interval):
if isinstance(interval, int):
interval = "%ds" % interval
ratios = {
's': 'seconds',
'm': 'minutes',
'h': 'hours',
'd': 'days',
'w': 'weeks'
}
... | mit |
anbasile/flask_sample | flask/lib/python2.7/site-packages/flask/testsuite/blueprints.py | 563 | 28089 | # -*- coding: utf-8 -*-
"""
flask.testsuite.blueprints
~~~~~~~~~~~~~~~~~~~~~~~~~~
Blueprints (and currently modules)
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
import unittest
import warnings
from flask.testsuite import FlaskTestCase, emi... | mit |
amir-qayyum-khan/edx-platform | lms/djangoapps/courseware/tests/test_self_paced_overrides.py | 23 | 6451 | """Tests for self-paced course due date overrides."""
# pylint: disable=missing-docstring
import datetime
import pytz
from django.test.utils import override_settings
from mock import patch
from courseware.tests.factories import BetaTesterFactory
from courseware.access import has_access
from lms.djangoapps.ccx.tests.t... | agpl-3.0 |
Limags/MissionPlanner | LogAnalyzer/tests/TestIMUMatch.py | 61 | 3781 | from LogAnalyzer import Test,TestResult
import DataflashLog
from math import sqrt
class TestIMUMatch(Test):
'''test for empty or near-empty logs'''
def __init__(self):
Test.__init__(self)
self.name = "IMU Mismatch"
def run(self, logdata, verbose):
#tuning parameters:
war... | gpl-3.0 |
jfpla/odoo | openerp/addons/base/ir/ir_model.py | 7 | 60967 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
job/exscript | tests/Exscript/util/interactTest.py | 6 | 2739 | import sys, unittest, re, os.path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..', 'src'))
from tempfile import NamedTemporaryFile
import Exscript.util.interact
from Exscript.util.interact import InputHistory
class InputHistoryTest(unittest.TestCase):
CORRELATE = InputHistory
def ... | gpl-2.0 |
ntt-sic/cinder | cinder/tests/backup/fake_swift_client.py | 5 | 4331 | # Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | apache-2.0 |
sfstpala/Victory-Chat | markdown/extensions/html_tidy.py | 2 | 2089 | #!/usr/bin/env python
"""
HTML Tidy Extension for Python-Markdown
=======================================
Runs [HTML Tidy][] on the output of Python-Markdown using the [uTidylib][]
Python wrapper. Both libtidy and uTidylib must be installed on your system.
Note than any Tidy [options][] can be passed in as extensio... | isc |
lmprice/ansible | lib/ansible/plugins/lookup/aws_service_ip_ranges.py | 102 | 3425 | # (c) 2016 James Turner <turnerjsm@gmail.com>
# (c) 2017 Ansible Project
# 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
DOCUMENTATION = """
lookup: aws_service_ip_ranges
author:
- Jam... | gpl-3.0 |
liuyxpp/blohg | docs/conf.py | 2 | 7298 | # -*- coding: utf-8 -*-
#
# blohg documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 26 23:45:47 2011.
#
# 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.
#
# All c... | gpl-2.0 |
codeforamerica/skillcamp | ENV/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/euckrprober.py | 2931 | 1675 | ######################## 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... | mit |
aallai/pyobfsproxy | obfsproxy/transports/obfs3_dh.py | 1 | 2685 | import binascii
import obfsproxy.common.rand as rand
def int_to_bytes(lvalue, width):
fmt = '%%.%dx' % (2*width)
return binascii.unhexlify(fmt % (lvalue & ((1L<<8*width)-1)))
class UniformDH:
"""
This is a class that implements a DH handshake that uses public
keys that are indistinguishable from ... | bsd-3-clause |
chrisfranzen/django | django/contrib/auth/tokens.py | 296 | 2631 | from datetime import date
from django.conf import settings
from django.utils.http import int_to_base36, base36_to_int
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils import six
class PasswordResetTokenGenerator(object):
"""
Strategy object used to generate and check tokens... | bsd-3-clause |
abhikumar22/MYBLOG | blg/Lib/site-packages/social_core/backends/base.py | 1 | 10025 | import time
from requests import request, ConnectionError
from ..utils import SSLHttpAdapter, module_member, parse_qs, user_agent
from ..exceptions import AuthFailed
class BaseAuth(object):
"""A authentication backend that authenticates the user based on
the provider response"""
name = '' # provider na... | gpl-3.0 |
Reflexe/doc_to_pdf | Windows/program/python-core-3.5.0/lib/crypt.py | 104 | 1879 | """Wrapper to the POSIX crypt library call and associated functionality."""
import _crypt
import string as _string
from random import SystemRandom as _SystemRandom
from collections import namedtuple as _namedtuple
_saltchars = _string.ascii_letters + _string.digits + './'
_sr = _SystemRandom()
class _Method(_named... | mpl-2.0 |
brisad/grec | setup.py | 1 | 2031 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import sys
from setuptools.command.test import test as TestCommand
class Tox(TestCommand):
user_options = [('tox-args=', 'a', 'Arguments to pass to tox')]
def initial... | gpl-3.0 |
resmo/ansible | test/units/module_utils/common/parameters/test_list_no_log_values.py | 22 | 1187 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 Ansible Project
# 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
import pytest
from ansible.module_utils.common.parameters import list_no_log_... | gpl-3.0 |
Exa-Networks/exaproxy | lib/exaproxy/icap/parser.py | 1 | 5875 | #!/usr/bin/env python
# encoding: utf-8
from .request import ICAPRequestFactory
from .response import ICAPResponseFactory
from .header import ICAPResponseHeaderFactory
class ICAPParser (object):
ICAPResponseHeaderFactory = ICAPResponseHeaderFactory
ICAPRequestFactory = ICAPRequestFactory
ICAPResponseFactory = ICAPR... | bsd-2-clause |
alvaroaleman/ansible | lib/ansible/modules/network/nxos/nxos_ntp_auth.py | 12 | 17744 | #!/usr/bin/python
#
# 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 distribut... | gpl-3.0 |
hi2srihari/crab | scikits/crab/metrics/sampling.py | 10 | 3357 | """Utilities for sampling techniques"""
# Author: Marcel Caraciolo <marcel@muricoca.com>
# License: BSD Style.
import numpy as np
from ..utils import check_random_state
from math import ceil
class SplitSampling(object):
""" Random Split Sampling the dataset into two sets.
Parameters
----------
n : ... | bsd-3-clause |
valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/twitter.py | 1 | 18792 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
determine_ext,
dict_get,
ExtractorError,
float_or_none,
int_or_none,
remove_end,
try_get,
xpath_text,
)
from .periscope import PeriscopeIE
class Twi... | gpl-3.0 |
Lujeni/ansible | lib/ansible/modules/cloud/cloudstack/cs_network_acl_rule.py | 13 | 14343 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017, René Moser <mail@renemoser.net>
# 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': '... | gpl-3.0 |
ApuliaSoftware/odoo | addons/account/wizard/account_move_line_unreconcile_select.py | 385 | 1864 | # -*- 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 |
Fusion-Rom/android_external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/inspector_console.py | 27 | 1896 | # 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.
class InspectorConsole(object):
def __init__(self, inspector_backend):
self._inspector_backend = inspector_backend
self._inspector_backend.Registe... | bsd-3-clause |
vabs22/zulip | zerver/migrations/0053_emailchangestatus.py | 19 | 1109 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-23 05:37
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('zerver', '0052_auto_fix_re... | apache-2.0 |
junmin-zhu/chromium-rivertrail | chrome/test/pyautolib/chromeos/suid_actions.py | 70 | 5373 | #!/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.
"""Helper script to perform actions as a super-user on ChromeOS.
Needs to be run with superuser privileges, typically using the
su... | bsd-3-clause |
liangxia/origin | vendor/k8s.io/kubernetes/hack/boilerplate/boilerplate_test.py | 629 | 1362 | #!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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 appli... | apache-2.0 |
pascalchevrel/bedrock | bedrock/pocketfeed/api.py | 4 | 1683 | import datetime
import re
import requests
from sentry_sdk import capture_exception
from django.conf import settings
from django.utils.timezone import make_aware, utc
def get_articles_data(count=8):
payload = {
'consumer_key': settings.POCKET_CONSUMER_KEY,
'access_token': settings.POCKET_ACCESS_T... | mpl-2.0 |
philanthropy-u/edx-platform | openedx/core/djangoapps/embargo/test_utils.py | 13 | 2864 | """Utilities for writing unit tests that involve course embargos. """
import contextlib
import mock
from django.core.cache import cache
from django.urls import reverse
import pygeoip
from .models import Country, CountryAccessRule, RestrictedCourse
@contextlib.contextmanager
def restrict_course(course_key, access_p... | agpl-3.0 |
jswope00/GAI | lms/djangoapps/verify_student/migrations/0002_auto__add_field_softwaresecurephotoverification_window.py | 53 | 6710 | # -*- 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 'SoftwareSecurePhotoVerification.window'
db.add_column('verify_student_softwaresecurephotover... | agpl-3.0 |
musically-ut/statsmodels | statsmodels/graphics/tests/test_regressionplots.py | 20 | 9978 | import numpy as np
import statsmodels.api as sm
from numpy.testing import dec
from statsmodels.graphics.regressionplots import (plot_fit, plot_ccpr,
plot_partregress, plot_regress_exog, abline_plot,
plot_partregress_grid, plot_ccpr_grid, add_lowess,
plot_added_vari... | bsd-3-clause |
HyperBaton/ansible | lib/ansible/modules/network/onyx/onyx_ospf.py | 21 | 8189 | #!/usr/bin/python
#
# Copyright: Ansible Project
# 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',
'status': ['preview'],
... | gpl-3.0 |
vladikoff/fxa-mochitest | tests/mozbase/mozdevice/sut_tests/dmunit.py | 5 | 1720 | # 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 types
import unittest
import mozlog
from mozdevice import devicemanager
from mozdevice import devicemanagerSUT
... | mpl-2.0 |
glyph/E-Max | epywrap.py | 1 | 13586 | # Copyright (C) 2012
# See LICENSE.txt for details.
"""
Epytext (and general Python docstring) wrapper
==============================================
Utility for wrapping docstrings in Python; specifically, docstrings in U{Epytext
<http://epydoc.sourceforge.net/manual-epytext.html>} format, or those that are
close en... | mit |
owlabs/incubator-airflow | tests/contrib/operators/test_dataflow_operator.py | 1 | 10028 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
kasioumis/invenio | invenio/legacy/bibcirculation/utils.py | 13 | 30901 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 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,... | gpl-2.0 |
pchavanne/yatt | tests/test_ticker.py | 1 | 5056 | import datetime
from yatt import BASE_CURRENCY
from yatt.ticker import aapl, agg, amzn, goog, msft, spy, eurusd, eurgbp, eurchf
from yatt.ticker import Ticker, Stock, Index, Future, Fx
from yatt.ticker import Tickers
timestamp = datetime.datetime(2000, 0o1, 0o1)
def test_ticker():
ticker = Ticker(symbol='AAPL',... | mit |
nightpool/CORE-Scouting-Server | views/commit.py | 2 | 2391 | from werkzeug import exceptions as ex
import simplejson as json
import flask
import wtforms_me
import wtforms.fields
import model.commit
import config
"""api used for submitting commits"""
blueprint = flask.Blueprint("commits", __name__, url_prefix="/commit")
MatchForm = wtforms_me.model_form(model.commit.MatchComm... | gpl-3.0 |
giavac/tadhack_paris_2015 | send_email.py | 1 | 4640 | #!/usr/bin/env python
import speech_recognition as sr
import sys
import smtplib
from os.path import basename
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formatdate
import subprocess
import s... | mit |
kuiwei/kuiwei | lms/djangoapps/instructor/tests/test_ecommerce.py | 12 | 15076 | """
Unit tests for Ecommerce feature flag in new instructor dashboard.
"""
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE
from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.django_... | agpl-3.0 |
rail/treeherder | treeherder/autoclassify/management/commands/autoclassify.py | 2 | 2433 | import logging
from collections import defaultdict
from django.core.management.base import BaseCommand, CommandError
from treeherder.autoclassify import matchers
from treeherder.model.models import FailureLine, Matcher, FailureMatch
logger = logging.getLogger(__name__)
# The minimum goodness of match we need to mar... | mpl-2.0 |
SummerLW/Perf-Insight-Report | telemetry/telemetry/internal/util/file_handle.py | 35 | 1976 | # Copyright 2014 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
_next_file_id = 0
class FileHandle(object):
def __init__(self, temp_file=None, absolute_path=None):
"""Constructs a FileHandle object.
... | bsd-3-clause |
amurzeau/streamlink-debian | src/streamlink/session.py | 2 | 19160 | import logging
import pkgutil
from collections import OrderedDict
from functools import lru_cache
from socket import AF_INET, AF_INET6
import requests
import requests.packages.urllib3.util.connection as urllib3_connection
from requests.packages.urllib3.util.connection import allowed_gai_family
from streamlink import ... | bsd-2-clause |
lvmgeo/GISPython | GISPython/PublisherHealper.py | 1 | 20261 | # -*- coding: utf-8 -*-
"""
Deployment publishing operations module
"""
import codecs
import os
import shutil
import hashlib
import datetime
import ZipHelper
import xmlParamsHealper
import JsonParamsHelper
class PublisherHealperConfig:
"""Class for setting up publisher Healper"""
moduleName = "" # name o... | gpl-3.0 |
Exgibichi/statusquo | test/functional/getblocktemplate_longpoll.py | 1 | 3120 | #!/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 longpolling with getblocktemplate."""
from test_framework.test_framework import StatusquoTestFram... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.