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 |
|---|---|---|---|---|---|
ctiller/grpc | examples/python/multiplex/helloworld_pb2.py | 146 | 3912 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: helloworld.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _re... | apache-2.0 |
KyleAMoore/KanjiNani | Android/.buildozer/android/platform/build/build/other_builds/kivy-python3crystax-sdl2/armeabi-v7a/kivy/examples/canvas/lines.py | 16 | 6324 | '''
Line (SmoothLine) Experiment
============================
This demonstrates the experimental and unfinished SmoothLine feature
for fast line drawing. You should see a multi-segment
path at the top of the screen, and sliders and buttons along the bottom.
You can click to add new points to the segment, change the tr... | gpl-3.0 |
baidu/Paddle | python/paddle/fluid/tests/unittests/test_split_and_merge_lod_tensor_op.py | 3 | 6585 | # Copyright (c) 2018 PaddlePaddle 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 app... | apache-2.0 |
DrDub/icsisumm | icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk_contrib/classifier/oner.py | 9 | 2417 | # Natural Language Toolkit - OneR
# Capable of classifying the test or gold data using the OneR algorithm
#
# Author: Sumukh Ghodke <sumukh dot ghodke at gmail dot com>
#
# URL: <http://nltk.sf.net>
# This software is distributed under GPL, for license information see LICENSE.TXT
from nltk_contrib.classifier import i... | gpl-3.0 |
madd-games/apocalypse | scripts/kernel.py | 1 | 1708 | # kernel.py
# Embeds the OpenCL code as a string inside the Apocalypse binary
# when the OpenCL functionality is enabled.
import sys, os
# Does some pre-processing
class KernelProcessor:
def __init__(self):
self.imported = []
apocMain = None
gameMain = ""
try:
f = open("Apoc/Kernels/ApocMain.cl")
apocM... | bsd-2-clause |
AICP/kernel_yu_msm8916 | 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 |
barbagroup/pygbe | pygbe/util/semi_analytical.py | 1 | 7124 | """
It contains the functions needed to compute the near singular integrals in
python. For big problems these functions were written in C++ and we call them
through the pycuda interface. At the end you have a commented test to compare
both types.
"""
import numpy
from pygbe.util.semi_analyticalwrap import SA_wrap_arr
... | bsd-3-clause |
willprice/arduino-sphere-project | scripts/example_direction_finder/temboo/Library/Twitter/FriendsAndFollowers/CreateFriendship.py | 5 | 4901 | # -*- coding: utf-8 -*-
###############################################################################
#
# CreateFriendship
# Allows you to follow another Twitter user by specifying a Twitter user id or screen name.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache Licens... | gpl-2.0 |
ClearingHouse/clearinghoused | lib/config.py | 1 | 3846 | import sys
import os
"""Variables prefixed with `DEFAULT` should be able to be overridden by
configuration file and command‐line arguments."""
UNIT = 100000000 # The same across assets.
# Versions
VERSION_MAJOR = 9
VERSION_MINOR = 47
VERSION_REVISION = 0
VERSION_STRING = str(VERSION_MAJOR) + '.' + str(VERSIO... | mit |
mrunge/horizon_lib | tools/install_venv_common.py | 166 | 5958 | # Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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 ... | apache-2.0 |
Paul-Ezell/cinder-1 | cinder/volume/drivers/lvm.py | 4 | 33306 | # 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
# d... | apache-2.0 |
moyogo/robofontmechanic | src/lib/site-packages/requests/packages/chardet/cp949prober.py | 2801 | 1782 | ######################## 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 |
MrSurly/micropython-esp32 | tests/basics/namedtuple1.py | 18 | 1495 | try:
try:
from collections import namedtuple
except ImportError:
from ucollections import namedtuple
except ImportError:
print("SKIP")
raise SystemExit
T = namedtuple("Tup", ["foo", "bar"])
# CPython prints fully qualified name, what we don't bother to do so far
#print(T)
for t in T(1, ... | mit |
StefanRijnhart/OpenUpgrade | addons/website_certification/__init__.py | 385 | 1030 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... | agpl-3.0 |
TurkuNLP/CAFA3 | learning/submit.py | 1 | 3231 | import os, shutil
import subprocess
SLURMJobTemplate = """#!/bin/bash -l
##execution shell environment
## name of your job
#SBATCH -J %job
## system error message output file
#SBATCH -e %outDir/stderr.txt
## system message output file
#SBATCH -o %outDir/stdout.txt
## a per-process (soft) memory limit
## limit is sp... | lgpl-3.0 |
arleighdickerson/HomeworkODE | problem5.py | 1 | 1626 | from pylab import *
import numpy as np
import scipy.optimize as op
from scipy.integrate import odeint
from mpl_toolkits.mplot3d.axes3d import Axes3D
epsilon = 0.9
# Initial position in space
r0 = [0.0, 1-epsilon, np.sqrt((1+epsilon)/(1-epsilon)), 0.0]
def f(t, r):
(w, x, y, z) = r
dw_dt = -x/(... | unlicense |
tscohen/chainer | cupy/manipulation/join.py | 17 | 4074 | import numpy
import six
import cupy
def column_stack(tup):
"""Stacks 1-D and 2-D arrays as columns into a 2-D array.
A 1-D array is first converted to a 2-D column array. Then, the 2-D arrays
are concatenated along the second axis.
Args:
tup (sequence of arrays): 1-D or 2-D arrays to be sta... | mit |
trew/monlog | monlog/log/api/authentication.py | 2 | 2770 | from django.contrib.auth.models import User
from tastypie.models import ApiKey
from tastypie.http import HttpUnauthorized
from tastypie.authentication import Authentication
class CookieAuthentication(Authentication):
"""
Handles auth from Session cookie provided by the user.
"""
def _unauthorized(self... | mit |
bdfoster/blumate | blumate/components/statsd.py | 1 | 1768 | """
A component which allows you to send data to StatsD.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/statsd/
"""
import logging
import blumate.util as util
from blumate.const import EVENT_STATE_CHANGED
from blumate.helpers import state as state_help... | mit |
kartikgupta0909/build-mozharness | mozharness/base/config.py | 4 | 20281 | #!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
"""Generic config parsing and dum... | mpl-2.0 |
donavoncade/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 |
tensorflow/tensorflow | tensorflow/lite/experimental/mlir/testing/op_tests/cumsum.py | 6 | 2030 | # Copyright 2020 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 |
HellerCommaA/flask-angular | lib/python2.7/site-packages/pip/vendor/distlib/wheel.py | 79 | 23490 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import unicode_literals
import base64
import codecs
import datetime
import distutils.util
from email import message_from_file... | mit |
Eureka22/ASM_xf | PythonD/site_python/twisted/conch/ssh/service.py | 2 | 1933 | # Twisted, the Framework of Your Internet
# Copyright (C) 2001-2002 Matthew W. Lefkowitz
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed... | gpl-2.0 |
kensoc/kendroid_kernel | scripts/gdb/linux/lists.py | 630 | 2897 | #
# gdb helper commands and functions for Linux kernel debugging
#
# list tools
#
# Copyright (c) Thiebaud Weksteen, 2015
#
# Authors:
# Thiebaud Weksteen <thiebaud@weksteen.fr>
#
# This work is licensed under the terms of the GNU GPL version 2.
#
import gdb
from linux import utils
list_head = utils.CachedType("st... | gpl-2.0 |
lenovor/scikit-learn | sklearn/decomposition/pca.py | 192 | 23117 | """ Principal Component Analysis
"""
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Denis A. Engemann <d.engemann@fz-juelich.de>
# Michael Eickenberg <michael.eickenberg@inria.fr>
#
# Lice... | bsd-3-clause |
Anonymouslemming/ansible | lib/ansible/modules/windows/win_wakeonlan.py | 18 | 2191 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Dag Wieers <dag@wieers.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, ... | gpl-3.0 |
ddy88958620/lib | Python/scrapy/naturebest/healthspan.py | 2 | 2536 | import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from urllib import urlencode
import hashlib
import csv
from product_spiders.item... | apache-2.0 |
topxiaoke/myedx | common/djangoapps/user_api/middleware.py | 9 | 1651 | """
Middleware for user api.
Adds user's tags to tracking event context.
"""
from track.contexts import COURSE_REGEX
from eventtracking import tracker
from user_api.models import UserCourseTag
from opaque_keys.edx.locations import SlashSeparatedCourseKey
class UserTagsEventContextMiddleware(object):
"""Middleware... | agpl-3.0 |
ospaceteam/outerspace | tests/common.py | 2 | 6754 | #!/usr/bin/env python2
#
# Copyright 2001 - 2016 Ludek Smid [http://www.ospace.net/]
#
# This file is part of Outer Space.
#
# Outer Space 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... | gpl-2.0 |
rghe/ansible | lib/ansible/modules/cloud/scaleway/scaleway_server_facts.py | 6 | 6064 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
# 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 |
autrilla/servo | tests/wpt/harness/wptrunner/wptmanifest/node.py | 190 | 4304 | # 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/.
class NodeVisitor(object):
def visit(self, node):
# This is ugly as hell, but we don't have multimethods and... | mpl-2.0 |
LabMagUBO/StoneX | concepts/1Dfunction.py | 1 | 1470 | #!/usr/bin/ipython-2.7 --pylab
# -*- coding: utf-8 -*-
import numpy as np
import pylab as pl
from scipy import optimize
from time import sleep
#function to plot
def plot_state():
pl.close()
pl.plot(x, f(x), 'b-', linewidth=2)
pl.grid()
pl.plot(r_pos, f(r_pos), 'ro')
pl.show()
def print_state():
... | gpl-3.0 |
Balannen/LSMASOMM | atom3/Kernel/ButtonsModels/createButtons.py | 1 | 2506 | # _ createButtons.py ____________________________________________________________________________
# createButtons : a class that subclasifies GraphGrammar. File generated automatically by ATOM3.
# ___________________________________________________________________________________________
from GraphGrammar import *
... | gpl-3.0 |
Frouk/zulip | zproject/local_settings_template.py | 1 | 15172 | # Settings for Zulip Voyager
### MANDATORY SETTINGS
#
# These settings MUST be set in production. In a development environment,
# sensible default values will be used.
# The user-accessible Zulip hostname for this installation, e.g.
# zulip.example.com
EXTERNAL_HOST = 'zulip.example.com'
# The email address for the ... | apache-2.0 |
nicfit/mishmash | tests/conftest.py | 1 | 2839 | import uuid
import shutil
import tempfile
import pytest
import sqlalchemy_utils
from uuid import uuid4
from pathlib import Path
from collections import namedtuple
from tempfile import NamedTemporaryFile
import mishmash.orm
import mishmash.database
from mishmash.__main__ import MishMash
from .factories import Mp3AudioF... | gpl-3.0 |
kevinr/750book-web | 750book-web-env/lib/python2.7/site-packages/django/db/models/expressions.py | 81 | 3283 | from datetime import datetime
from django.utils import tree
from django.utils.copycompat import deepcopy
class ExpressionNode(tree.Node):
"""
Base class for all query expressions.
"""
# Arithmetic connectors
ADD = '+'
SUB = '-'
MUL = '*'
DIV = '/'
MOD = '%%' # This is a quoted % o... | mit |
edwann13/weatherscript | python-weather-api-read-only/examples/get-weather.py | 29 | 3351 | #!/usr/bin/env python3
#Copyright (c) 2010 Dimitris Leventeas <mydimle@gmail.com>
#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 ... | mit |
NexusIS/tempest | tempest/api/compute/admin/test_instance_usage_audit_log.py | 17 | 2319 | # Copyright 2013 IBM 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 |
Stefan-Korner/SpacePyLibrary | CS/CNCclient.py | 1 | 7170 | #******************************************************************************
# (C) 2018, Stefan Korner, Austria *
# *
# The Space Python Library is free software; you can redistribute it and/or *
... | mit |
ceramos/micropython | tests/bytecode/pylib-tests/dummy_threading.py | 210 | 2815 | """Faux ``threading`` version using ``dummy_thread`` instead of ``thread``.
The module ``_dummy_threading`` is added to ``sys.modules`` in order
to not have ``threading`` considered imported. Had ``threading`` been
directly imported it would have made all subsequent imports succeed
regardless of whether ``_thread`` w... | mit |
mmcdermo/helpinghand | server/venv/lib/python2.7/site-packages/django/contrib/admindocs/views.py | 106 | 15138 | import inspect
import os
import re
from django import template
from django.template import RequestContext
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.db import models
from django.shortcuts import render_to_response
from django.core.exceptions imp... | mit |
darina/omim | tools/python/maps_generator/generator/stages_declaration.py | 2 | 14605 | """"
This file contains possible stages that maps_generator can run.
Some algorithms suppose a maps genration processes looks like:
stage1, ..., stage_mwm[country_stage_1, ..., country_stage_M], ..., stageN
Only stage_mwm can contain country_
"""
import datetime
import json
import logging
import multiprocessing
imp... | apache-2.0 |
matslindh/4096 | 4096/engine.py | 1 | 4159 | import random
class Engine:
def __init__(self):
self.board = [[0 for i in range(4)] for i in range(4)]
self.score = 0
self.add_random_block()
self.add_random_block()
def left(self):
self.next(1)
def right(self):
self.next(3)
def up(self):
self.... | mit |
emdyp/bl_pass | blockchainpassport/wsgi/blockchainpassport/blockchainpassport/urls.py | 3 | 1320 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib.auth.decorators import login_required
from registers.views import idvi... | gpl-2.0 |
rintoj/ai | demo/reinforcement/featureExtractors.py | 5 | 2981 | # featureExtractors.py
# --------------------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and ... | mit |
shennushi/electron | script/lib/github.py | 200 | 2214 | #!/usr/bin/env python
import json
import os
import re
import sys
REQUESTS_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..',
'vendor', 'requests'))
sys.path.append(os.path.join(REQUESTS_DIR, 'build', 'lib'))
sys.path.append(os.path.join(REQUESTS_DIR, 'build', 'l... | mit |
MrNuggles/HeyBoet-Telegram-Bot | temboo/Library/Google/Picasa/DeleteTag.py | 5 | 5429 | # -*- coding: utf-8 -*-
###############################################################################
#
# DeleteTag
# Removes a tag from a specified photo in Google Picasa.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may ... | gpl-3.0 |
pavelchristof/gomoku-ai | tensorflow/contrib/labeled_tensor/python/ops/sugar_test.py | 157 | 4205 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
jvkops/django | tests/template_tests/filter_tests/test_escape.py | 324 | 1495 | from django.template.defaultfilters import escape
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class EscapeTests(SimpleTestCase):
"""
The "escape" filter works the same whether autoescape is on or off,
but it has no effect on strings alrea... | bsd-3-clause |
jjmleiro/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/flatpages/tests/test_csrf.py | 106 | 3433 | import os
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase, Client
from django.test.utils import override_settings
@override_settings(
LOGIN_URL='/accounts/login/',
MIDDLEWARE_CLASSES=(
'django.middleware.common.C... | apache-2.0 |
xztor/EulerProject | problems/common/utils.py | 1 | 1303 | # Common routines to deal with primes, factors et al.
import operator
import itertools
def isqrt(n):
x = n
y = (x + 1) // 2
while y < x:
x = y
y = (x + n // x) // 2
return x
def static_vars(**kwargs):
def decorate(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func... | mit |
SantosDevelopers/sborganicos | venv/lib/python3.5/site-packages/pip/_vendor/html5lib/_trie/datrie.py | 1301 | 1178 | from __future__ import absolute_import, division, unicode_literals
from datrie import Trie as DATrie
from pip._vendor.six import text_type
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
def __init__(self, data):
chars = set()
for key in data.keys():
if not isinstance(key, te... | mit |
mozilla/MozDef | tests/mq/plugins/test_ldap_fixup.py | 1 | 4316 | # 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 https://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from mq.plugins.ldap_fixup import message
class TestLdapFixupPlugin():
d... | mpl-2.0 |
mgit-at/ansible | lib/ansible/modules/cloud/openstack/os_security_group_rule.py | 26 | 12013 | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2013, Benno Joy <benno@ansible.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSI... | gpl-3.0 |
phenix3443/shadowsocks | shadowsocks/udprelay.py | 924 | 11154 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 |
Belxjander/Kirito | Python-3.5.0-main/Tools/pybench/Lookups.py | 92 | 15254 | from pybench import Test
class SpecialClassAttribute(Test):
version = 2.0
operations = 5*(12 + 12)
rounds = 100000
def test(self):
class c:
pass
for i in range(self.rounds):
c.__a = 2
c.__b = 3
c.__c = 4
c.__a = 2
... | gpl-3.0 |
ReganBell/QReview | networkx/algorithms/approximation/clustering_coefficient.py | 41 | 1992 | # -*- coding: utf-8 -*-
# Copyright (C) 2013 by
# Fred Morstatter <fred.morstatter@asu.edu>
# Jordi Torrents <jtorrents@milnou.net>
# All rights reserved.
# BSD license.
import random
from networkx.utils import not_implemented_for
__all__ = ['average_clustering']
__author__ = """\n""".join(['Fred Morstatter ... | bsd-3-clause |
willingc/oh-mainline | vendor/packages/twisted/twisted/persisted/journal/picklelog.py | 19 | 1189 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
# -*- test-case-name: twisted.test.test_journal -*-
"""Logging that uses pickles.
TODO: add log that logs to a file.
"""
# twisted imports
from twisted.persisted import dirdbm
from twisted.internet import defer
from zope.interface import imp... | agpl-3.0 |
chrsrds/scikit-learn | sklearn/svm/tests/test_bounds.py | 3 | 2279 | import numpy as np
from scipy import sparse as sp
import pytest
from sklearn.svm.bounds import l1_min_c
from sklearn.svm import LinearSVC
from sklearn.linear_model.logistic import LogisticRegression
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_raise_message
dense_X = [[-... | bsd-3-clause |
examachine/pisi | setup.py | 1 | 4204 | #!/usr/bin/env python
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# Please... | gpl-3.0 |
NL66278/odoo | addons/l10n_ca/__openerp__.py | 161 | 3167 | # -*- encoding: 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 G... | agpl-3.0 |
shikhardb/scikit-learn | examples/neighbors/plot_approximate_nearest_neighbors_hyperparameters.py | 227 | 5170 | """
=================================================
Hyper-parameters of Approximate Nearest Neighbors
=================================================
This example demonstrates the behaviour of the
accuracy of the nearest neighbor queries of Locality Sensitive Hashing
Forest as the number of candidates and the numb... | bsd-3-clause |
astaff/ansible | lib/ansible/utils/module_docs_fragments/openstack.py | 118 | 4021 | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | gpl-3.0 |
hurricup/intellij-community | python/lib/Lib/glob.py | 92 | 2010 | """Filename globbing utility."""
import os
import fnmatch
import re
__all__ = ["glob", "iglob"]
def glob(pathname):
"""Return a list of paths matching a pathname pattern.
The pattern may contain simple shell-style wildcards a la fnmatch.
"""
return list(iglob(pathname))
def iglob(pathname):
""... | apache-2.0 |
stelligent/ansible-modules-core | cloud/rackspace/rax.py | 133 | 32841 | #!/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 distributed... | gpl-3.0 |
sajuptpm/manila | contrib/tempest/tempest/api/share/test_shares_actions_negative.py | 2 | 5001 | # Copyright 2015 Mirantis 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... | apache-2.0 |
cjlee112/socraticqs2 | mysite/fsm/views.py | 1 | 3313 | from django.urls import reverse
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from fsm.models import (
FSMState,
FSMBadUserError,
FSMStackResumeError,
)
from ct.views import PageData
from ct.forms import (
set_crispy_action,
CancelForm,
L... | apache-2.0 |
fnouama/intellij-community | plugins/hg4idea/testData/bin/mercurial/pvec.py | 94 | 5989 | # pvec.py - probabilistic vector clocks for Mercurial
#
# Copyright 2012 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.
'''
A "pvec" is a changeset property based on the theory of vector clocks
that... | apache-2.0 |
sysalexis/kbengine | kbe/res/scripts/common/Lib/test/test_json/test_scanstring.py | 88 | 4645 | import sys
from test.test_json import PyTest, CTest
class TestScanstring:
def test_scanstring(self):
scanstring = self.json.decoder.scanstring
self.assertEqual(
scanstring('"z\U0001d120x"', 1, True),
('z\U0001d120x', 5))
self.assertEqual(
scanstring('"\... | lgpl-3.0 |
aleju/imgaug | test/augmenters/test_edges.py | 2 | 28288 | from __future__ import print_function, division, absolute_import
import itertools
import sys
# unittest only added in 3.4 self.subTest()
if sys.version_info[0] < 3 or sys.version_info[1] < 4:
import unittest2 as unittest
else:
import unittest
# unittest.mock is not available in 2.7 (though unittest2 might cont... | mit |
JimCircadian/ansible | test/utils/shippable/tools/download.py | 124 | 10149 | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
# (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
# (at yo... | gpl-3.0 |
Nowheresly/odoo | addons/account/wizard/account_report_aged_partner_balance.py | 378 | 4012 | # -*- 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 |
TianpeiLuke/GPy | GPy/inference/latent_function_inference/fitc.py | 4 | 3029 | # Copyright (c) 2012, James Hensman
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from posterior import Posterior
from ...util.linalg import jitchol, tdot, dtrtrs, dpotri, pdinv
from ...util import diag
import numpy as np
from . import LatentFunctionInference
log_2_pi = np.log(2*np.pi)
class FITC(Latent... | bsd-3-clause |
rdnelson/Libra | lib/gtest-1.6.0/scripts/pump.py | 603 | 23316 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... | gpl-3.0 |
MrNuggles/HeyBoet-Telegram-Bot | temboo/Library/RunKeeper/CommentThreads/PostComment.py | 4 | 3446 | # -*- coding: utf-8 -*-
###############################################################################
#
# PostComment
# Posts a comment about a user's activity.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this... | gpl-3.0 |
ltilve/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/glacier/test_concurrent.py | 88 | 7261 | #!/usr/bin/env python
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | bsd-3-clause |
bikong2/django | tests/sitemaps_tests/base.py | 380 | 1079 | from django.apps import apps
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.test import TestCase, modify_settings, override_settings
from .models import I18nTestModel, TestModel
@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sitemaps'})
@override_settings(ROO... | bsd-3-clause |
xavfernandez/pip | src/pip/_internal/wheel_builder.py | 1 | 9857 | """Orchestrator for building wheels from InstallRequirements.
"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import logging
import os.path
import re
import shutil
from pip._internal.models.link import Link
from pip._internal.operations.build.wheel import buil... | mit |
lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/idna/codec.py | 426 | 3299 | from .core import encode, decode, alabel, ulabel, IDNAError
import codecs
import re
_unicode_dots_re = re.compile(u'[\u002e\u3002\uff0e\uff61]')
class Codec(codecs.Codec):
def encode(self, data, errors='strict'):
if errors != 'strict':
raise IDNAError("Unsupported error handling \"{0}\"".for... | mit |
fernandopso/python_koans | python2/koans/about_packages.py | 63 | 2143 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
#
# Package hierarchy of Python Koans project:
#
# contemplate_koans.py
# koans/
# __init__.py
# about_asserts.py... | mit |
disqus/kombu | kombu/utils/compat.py | 1 | 7887 | import sys
############## __builtin__.all ##############################################
try:
all([True])
all = all
except NameError:
def all(iterable):
for item in iterable:
if not item:
return False
return True
############## __builtin__.any #################... | bsd-3-clause |
longyangking/ML | keras/GAN.py | 1 | 7748 | '''
Learn Gaussian Distribution
'''
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten, Reshape
from keras.layers import Conv2D, Conv2DTranspose, UpSampling2D
from keras.layers import LeakyReLU, Dropout
from keras.layers import BatchNormalization
from keras.opti... | lgpl-3.0 |
edfungus/Crouton-Python-Example | env/lib/python2.7/site-packages/pip/_vendor/progress/helpers.py | 404 | 2894 | # Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
#
# 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 THE A... | mit |
cwoodruf/ygnews | ygpurge.py | 1 | 2187 | #!/usr/bin/env python
"""
author: Cal Woodruff, cwoodruf@sfu.ca
remove old data from various tables
should be run daily to ensure the db runs optimally
"""
import ygdb
import time
start = time.time()
conn = ygdb.conn()
cleanup = conn.cursor()
print "purging features"
cleanup.execute("delete from features where created... | gpl-3.0 |
skyportsystems/vitess | py/vtdb/sql_builder.py | 7 | 31542 | """Helper classes for building queries.
Helper classes and fucntions for building queries.
"""
import itertools
import pprint
import time
# TODO(dumbunny): integration with SQL Alchemy ?
class DBRow(object):
"""An object with an attr for every column returned by a query."""
def __init__(self, column_names=Non... | bsd-3-clause |
dangra/scrapy | scrapy/utils/console.py | 6 | 3431 | from functools import wraps
from collections import OrderedDict
def _embed_ipython_shell(namespace={}, banner=''):
"""Start an IPython Shell"""
try:
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.terminal.ipapp import load_default_config
except ImportError:
f... | bsd-3-clause |
tensorflow/model-analysis | tensorflow_model_analysis/eval_saved_model/util_test.py | 1 | 12546 | # Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
easmetz/inasafe | safe/metadata/property/dictionary_property.py | 4 | 1715 | # -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**metadata module.**
Contact : ole.moller.nielsen@gmail.com
.. 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 Sof... | gpl-3.0 |
rjhd2/HadISD_v2 | mk_netcdf_files.py | 1 | 92608 | #!/usr/local/sci/bin/python
#************************************************************************
# SVN Info
#$Rev:: 112 $: Revision of last commit
#$Author:: rdunn $: Author of last commit
#$Date:: 2017-01-13 14:47:... | bsd-3-clause |
AndKe/ardupilot | libraries/SITL/examples/Morse/rover_skid.py | 22 | 2201 | '''
This is an example builder script that sets up a rover in Morse to
be driven by ArduPilot.
The rover has the basic set of sensors that ArduPilot needs
To start the simulation use this:
morse run rover_skid.py
Then connect with ArduPilot like this:
sim_vehicle.py --model morse --console --map
This model as... | gpl-3.0 |
LonamiWebs/Telethon | readthedocs/custom_roles.py | 2 | 2096 | from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes
def make_link_node(rawtext, app, name, options):
"""
Create a link to the TL reference.
:param rawtext: Text being replaced with link node.
:param app: Sphinx application context
:param name: Name of the object t... | mit |
jmdejong/Asciifarm | asciifarm/common/messages.py | 1 | 4086 |
import re
import unicodedata
import json
class InvalidMessageError(Exception):
errType = "invalidmessage"
description = ""
def __init__(self, description="", errType=None):
self.description = description
if errType is not None:
self.errType = errType
def toMessage... | gpl-3.0 |
GaetanCambier/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/hdtrailers.py | 64 | 4275 | from string import digits, ascii_letters
import re
from bs4 import SoupStrainer, BeautifulSoup
from couchpotato.core.helpers.encoding import tryUrlencode
from couchpotato.core.helpers.variable import mergeDicts, getTitle, getIdentifier
from couchpotato.core.logger import CPLog
from couchpotato.core.media.movie.provide... | gpl-3.0 |
pedro2d10/SickRage-FR | sickbeard/providers/freshontv.py | 1 | 10398 | # coding=utf-8
# Author: Idan Gutman
#
# URL: https://sickrage.github.io
#
# This file is part of SickRage.
#
# SickRage 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 |
customcommander/selenium | py/selenium/webdriver/remote/errorhandler.py | 50 | 8394 | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
eduNEXT/edunext-platform | openedx/core/djangoapps/credit/tasks.py | 4 | 5234 | """
This file contains celery tasks for credit course views.
"""
import six
from celery import task
from celery.utils.log import get_task_logger
from django.conf import settings
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey, UsageKey
from openedx.core.djangoapps.credit.api import... | agpl-3.0 |
mozilla/build-mozharness | external_tools/mouse_and_screen_resolution.py | 12 | 5541 | #! /usr/bin/env python
# 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/.
#
# Script name: mouse_and_screen_resolution.py
# Purpose: Sets mouse position and screen... | mpl-2.0 |
JocelynDelalande/xhtml2pdf | demo/cherrypy/demo-cherrypy.py | 154 | 2187 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
#############################################
## (C)opyright by Dirk Holtwick, 2008 ##
## All rights reserved ##
#############################################
import cherrypy as cp
import sx.pisa3 as pisa
import cStringIO as StringIO
try:
im... | apache-2.0 |
vitaly-krugl/nupic | examples/opf/experiments/multistep/base/permutations_simple_3.py | 10 | 4041 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.