code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
# Copyright (c) 2015 RIPE NCC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the h...
danielquinn/ripe-atlas-tools
tests/renderers/raw.py
Python
gpl-3.0
7,387
from . import chd_product_configurator
gfcapalbo/website_chd
website_chd_product_configurator/models/__init__.py
Python
agpl-3.0
38
from django.apps import AppConfig class ProfilesConfig(AppConfig): name = 'apps.profiles' verbose_name = 'Profiles' def ready(self): super(ProfilesConfig, self).ready() from reversion import revisions as reversion from apps.profiles.models import Privacy reversion.regis...
dotKom/onlineweb4
apps/profiles/appconfig.py
Python
mit
333
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('practice', '0021_auto_20160305_1458'), ] operations = [ migrations.AlterField( model_name='studentmodel', ...
effa/flocs
practice/migrations/0022_auto_20160305_1514.py
Python
gpl-2.0
491
# coding: utf-8 # (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2021 from __future__ import absolute_import import wrapt import opentracing import types from ..log import logger from ..singletons import tracer from ..util.traceutils import get_active_tracer try: import pika def _extract_broke...
instana/python-sensor
instana/instrumentation/pika.py
Python
mit
7,368
#!/usr/bin/env python # # Copyright 2010 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
akbertram/appengine-mapreduce
python/test/mapreduce/operation/counters_test.py
Python
apache-2.0
1,244
import numpy as np import matplotlib.pyplot as plt from cs224d.data_utils import * from q3_sgd import load_saved_params, sgd from q4_softmaxreg import softmaxRegression, getSentenceFeature, accuracy, softmax_wrapper import seaborn as sns sns.set(style='whitegrid', context='talk') # Try different regularizations and...
kingtaurus/cs224d
assignment1/q4_sentiment.py
Python
mit
3,997
# 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/. from __future__ import absolute_import import os import signal import subprocess import sys import threading import tim...
cstipkovic/spidermonkey-research
testing/mozbase/mozprocess/mozprocess/processhandler.py
Python
mpl-2.0
47,345
import sys from craystack import cf if len(sys.argv) < 4: print "Usage: %s <key> <subkey> <path>" % sys.argv[0] sys.exit(2) _, key, subkey, filename = sys.argv with open(filename) as f: content = f.read() cf.insert(key, {subkey: content}) print "Uploaded %s to %s/%s (%s bytes)" % (filename, key,...
rbranson/craystack
upload.py
Python
bsd-3-clause
343
# # line segment intersection using vectors # see Computer Graphics by F.S. Hill # from numpy import * import sys def perp( a ) : b = empty_like(a) b[0] = -a[1] b[1] = a[0] return b # line segment a given by endpoints a1, a2 # line segment b given by endpoints b1, b2 # return def intersectPoint( a1,a...
Extent421/bladeBench
software/logReader/intersect.py
Python
mit
1,840
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008-2009 Zuza Software Foundation # # This file is part of Pootle. # # 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...
lehmannro/pootle
pootle/i18n/gettext_live.py
Python
gpl-2.0
2,938
import pytest from .package_builder import UniversePackageBuilder from .package import Package def test_non_existent_input_dir_raises_exception(): with pytest.raises(Exception) as e: UniversePackageBuilder(None, None, '__SHOULD_NOT_EXIST__', '.', []) assert "Provided package path is not a directory: ...
vishnu2kmohan/dcos-commons
tools/universe/test_package_builder.py
Python
apache-2.0
1,241
TEMPLATE = """Copyright {year} - {author} 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, merge, publish, distr...
pyrelease/pyrelease
pyrelease/licenses/MIT.py
Python
mit
1,074
from __future__ import print_function, division from collections import defaultdict from itertools import combinations, permutations, product, product as cartes import random from operator import gt from sympy.core.decorators import deprecated from sympy.core import Basic, C # this is the logical location of these f...
hrashk/sympy
sympy/utilities/iterables.py
Python
bsd-3-clause
57,188
from invoke import task from ..config import ( INITIAL_VERSION, GIT_LFS_TARGETS, VERSION, ) ## Constants VCS_RELEASE_TAG_TEMPLATE = "v{}" @task def lfs_track(cx): """Update all the files that need tracking via git-lfs.""" for lfs_target in GIT_LFS_TARGETS: cx.run("git lfs track {}".form...
ADicksonLab/wepy
tasks/modules/git.py
Python
mit
945
from math import pi, sin, cos, atan2 grid = 21 c = grid / 2 points = grid**3 filename = "tgv.vtk" print(filename) f = open(filename, "w") class VectorField: def __init__(self, x, y, z): self.x = x self.y = y self.z = z vf = [] for i in range(points): ix = i % grid iy = (i / grid...
kaityo256/paraview-sample
glyph/tgv.py
Python
mit
956
# -*- coding: utf-8 -*- import socket import struct import errno import json from binascii import hexlify, unhexlify from django.db import models try: from django.utils.timezone import now as dt_now except ImportError: import datetime dt_now = datetime.datetime.now from django_fields.fields import Encryp...
nautilebleu/django-ios-notifications
ios_notifications/models.py
Python
bsd-3-clause
14,356
""" Entrypoint module, in case you use `python -mclient`. Why does this file exist, and why __main__? For more info, read: - https://www.python.org/dev/peps/pep-0338/ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ import sys from jcsclient.cl...
jiocloudservices/jcsclient
src/jcsclient/__main__.py
Python
apache-2.0
390
# -*- coding: utf-8 -*- """ unit test for various things ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2007 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import gc from py.test import raises from jinja2 import escape from jinja2.exceptions import TemplateSyntaxError UNPACKING = '''{%...
minixalpha/SourceLearning
jinja2/jinja2-2.0/tests/test_various.py
Python
apache-2.0
2,565
""" Visualization for structures using chemview. """ import numpy as np from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.analysis.molecule_structure_comparator import CovalentRadius from monty.dev import requires try: from chemview import MolecularViewer from chemview.utils import get_a...
gVallverdu/pymatgen
pymatgen/vis/structure_chemview.py
Python
mit
3,234
import sys import os import json from glob import glob class JsonschemaToModelsV2(object): def __init__(self): URL_PREFIX = "" URL_SUFFIX = ".json" INPUT_FILE = "schema.json" schema_org_url = "http://schema.org" fin_obj = open(INPUT_FILE, "r") self.json_schema = eval(fin_obj.read(), {"null": None, "t...
varundeboss/varundeboss
varundeboss/apis/schema_org/scripts/jsonschema_to_models_v2.py
Python
apache-2.0
3,683
from textwrap import dedent from unittest import TestCase from pcs_test.tools.misc import get_test_resource as rc import pcs.lib.corosync.config_facade as lib from pcs.lib.corosync.config_parser import Parser def _read_file(name): with open(rc(name)) as a_file: return a_file.read() def _get_facade(con...
feist/pcs
pcs_test/tier0/lib/corosync/test_config_facade_quorum.py
Python
gpl-2.0
9,210
# Copyright (c) 2010-2015 Bo Lin # Copyright (c) 2010-2015 Yanhong Annie Liu # Copyright (c) 2010-2015 Stony Brook University # Copyright (c) 2010-2015 The Research Foundation of SUNY # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files #...
sghosh1991/distalgo
da/compiler/utils.py
Python
mit
3,234
#!/usr/bin/env python import os import sys # Edit this if necessary or override the variable in your environment. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dragnet.settings') # Add a temporary path so that we can import the funfactory tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ...
mozilla/dragnet
manage.py
Python
bsd-3-clause
668
""" test_tuple_params.py -- source test pattern for formal parameters of type tuple This source is part of the decompyle test suite. decompyle is a Python byte-code decompiler See http://www.goebel-consult.de/decompyle/ for download and for further information """ def A(a, b, (x, y, z), c): pass def B(a, b = 42...
mancoast/pycdc
tests/25_test_tuple_params.ref.py
Python
gpl-3.0
434
"""Entity and System Managers.""" import six from ecs.exceptions import ( NonexistentComponentTypeForEntity, DuplicateSystemTypeError, SystemAlreadyAddedToManagerError) from ecs.models import Entity class EntityManager(object): """Provide database-like access to components based on an entity key.""" ...
seanfisk/ecs
ecs/managers.py
Python
mit
8,344
################################################################################ # 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...
ueshin/apache-flink
flink-libraries/flink-streaming-python/src/test/python/org/apache/flink/streaming/python/api/test_window_apply.py
Python
apache-2.0
2,230
#!/usr/bin/python # # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
richardfergie/googleads-python-lib
examples/dfp/v201508/inventory_service/get_all_ad_units.py
Python
apache-2.0
1,843
# -*- coding: utf-8 -*- # # Copyright © 2009-2010 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) """ Object Editor Dialog based on Qt """ from __future__ import print_function from spyderlib.qt.QtCore import QObject, SIGNAL # Local imports from spyderlib.py3co...
kenshay/ImageScript
ProgramData/SystemFiles/Python/Lib/site-packages/spyderlib/widgets/objecteditor.py
Python
gpl-3.0
5,609
from __future__ import absolute_import from ipyvolume._version import __version__ # noqa: F401 from ipyvolume import styles # noqa: F401 from ipyvolume import examples # noqa: F401 from ipyvolume import datasets # noqa: F401 from ipyvolume import embed # noqa: F401 from ipyvolume.widgets import * # noqa: F401, F...
maartenbreddels/ipyvolume
ipyvolume/__init__.py
Python
mit
1,123
# -*- coding: utf-8 -*- ## @package ivf.core.sparse_interpolation.image_features # # ivf.core.sparse_interpolation.image_features utility package. # @author tody # @date 2016/02/03 import numpy as np from ivf.cv.image import to32F, alpha, rgb2Lab, rgb2hsv def alphaFeatures(image): h, w = image....
tody411/ImageViewerFramework
ivf/core/image_features/image_features.py
Python
mit
1,562
# -*- coding: utf-8 -*- import os,math from qgis.core import NULL from mole3 import oeq_global from mole3.project import config from mole3.extensions import OeQExtension from mole3.stat_corr import rb_contemporary_base_uvalue_by_building_age_lookup def calculation(self=None, parameters={},feature = None): from sc...
UdK-VPT/Open_eQuarter
mole3x/extensions/eval_present_heritage/oeq_AHDPH.py
Python
gpl-2.0
1,504
# Copyright 2000 by Jeffrey Chang. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Collection of modules for dealing with biological data in Python. The Biopython Project is ...
Ambuj-UF/ConCat-1.0
src/Utils/Bio/__init__.py
Python
gpl-2.0
3,764
#!/usr/bin/python # -*- coding: utf-8 -*- import time from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * class FSplashScreen(QSplashScreen): def __init__(self, t, splash_image): if not isinstance(splash_image, QPixmap): image = QPixmap(splash_image) el...
dragondjf/musicplayer
qframer/fsplashscreen.py
Python
gpl-2.0
1,262
# # Copyright (C) 2005, Giovanni Bajo # # Based on previous work under copyright (c) 2002 McMillan Enterprises, 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 2 # of the L...
pdubroy/kurt
build/MacOS/PyInstaller/pyinstaller-svn-r812/mf.py
Python
gpl-2.0
37,752
import re import os import time import debug from subprocess import Popen, PIPE def get_execution_time(err): time = 0.0 with open(err, 'r') as f: for line in f: if line.startswith("user") or line.startswith("sys"): lexemes = re.findall("\d+\.\d+|\d+", line) a...
chandangreddy/autotuner
cluster.py
Python
mit
1,575
import os import sys import time import traceback from optparse import make_option import six from django.conf import settings from django.core.management.base import NoArgsCommand from django_extensions.management.shells import import_objects from django_extensions.management.utils import signalcommand class Comma...
barseghyanartur/django-extensions
django_extensions/management/commands/shell_plus.py
Python
mit
15,982
# coding=utf-8 from bottle import Bottle, HTTPError, request from sqlalchemy.orm.exc import NoResultFound import model from utils import jsonplugin import auth app = Bottle() app.install(model.plugin) app.install(jsonplugin) @app.get('/') @auth.optional_login def read_all(db, user): is_admin = user and user.ad...
spktklr/kansalaisrajoite
python/news.py
Python
agpl-3.0
891
#!/bin/env python3 """Graph a family of level surfaces for a function of three variables. Example function: f(x,y,z)=z/sqrt(x**2+y**2)""" import sys import numpy as np import sympy from sympy.abc import x, y, z, C from matplotlib import cm, pyplot as plt from mpl_toolkits.mplot3d import Axes3D def repeat(an_object):...
cheeseywhiz/cheeseywhiz
apcsp/graph.py
Python
mit
4,106
import tensorflow as tf from ..attention import attention_please from ..dynamic_length import id_vector_to_length from ..rnn import rnn from ..util import static_rank, func_scope @func_scope() def embeddings_to_embedding(embeddings, *, context_vector_size, ...
raviqqe/tensorflow-extenteten
extenteten/embedding/unidirectional.py
Python
unlicense
1,146
from collections import defaultdict import hashlib import os import random import asyncio import json import logging from . import exceptions from . import room from . import presence from . import contacts from .configuration import config class LocalPresenceRegister(presence.PresenceRegister): def __init__(se...
simonwittber/netwrok-server
src/netwrok/client.py
Python
mit
4,112
from django.template import Context, Template from lbworkflow.models import Process, ProcessInstance def get_event_transitions(process_instance): from lbworkflow.models import Event events = Event.objects.filter(instance=process_instance).order_by( "-created_on", "-id" ) transitions = [] ...
vicalloy/django-lb-workflow
lbworkflow/views/flowchart.py
Python
mit
2,492
from testproject.core import pool pool.register('extensions', 'package')
ojii/django-load
testproject/package/extensions/__init__.py
Python
bsd-3-clause
73
#!/usr/bin/env python # -*- coding: utf-8 -*- # import os print "no" #custom hw # print "96" #ram # print "yes" #touchscreen # print "yes" #trackball # print "yes" #keyboard # print "yes" #dpad # print "yes" #gsm # print "yes" #camera # print "640" #max h # print "480" #max v # print "yes" #gps...
gianina-ingenuity/titanium-branch-deep-linking
testbed/x/mobilesdk/osx/5.5.1.GA/android/input.py
Python
mit
502
from django import forms from .models import ObjectSet def objectset_form_factory(Model, queryset=None): """Takes an ObjectSet subclass and defines a base form class. In addition, an optional queryset can be supplied to limit the choices for the objects. This uses the generic `objects` field rather ...
chop-dbhi/django-objectset
objectset/forms.py
Python
bsd-2-clause
2,097
import threading import time from . import _impl from .common import * from .connection import * from .networktablenode import NetworkTableNode from .type import NetworkTableEntryTypeManager import logging logger = logging.getLogger('nt') __all__ = ["NetworkTableServer"] class ServerConnectionState: """Represen...
schmirob000/2016-Stronghold
src/org/usfirst/frc/team4915/stronghold/vision/jetson/imgExplore2/networktables2/server.py
Python
mit
10,070
from django.conf import settings from django.core.urlresolvers import reverse from django.template import TemplateDoesNotExist from django.test import TestCase from .api import UserFactory from ...core.models import Image __all__ = ['CreateImageTest'] class CreateImageTest(TestCase): def setUp(self): s...
QLGu/pinry
pinry/core/tests/views.py
Python
bsd-2-clause
1,344
# encoding: utf-8 # Copyright 2013 maker # License 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 model 'ContactField' db.create_table('identities_contactfield',...
alejo8591/maker
identities/migrations/0001_initial.py
Python
mit
14,218
# -*- coding: utf-8 -*- # Authors: Y. Jia <ytjia.zju@gmail.com> import unittest from .. import SearchinRotatedSortedArray class test_SearchinRotatedSortedArray(unittest.TestCase): solution = SearchinRotatedSortedArray.Solution() def test_search(self): self.assertEqual(self.solution.search([4, 5, 6...
ytjia/coding-practice
algorithms/python/leetcode/tests/test_SearchinRotatedSortedArray.py
Python
mit
682
import os import sys import string import math def encrypt(key,inputfile,outputfile): #Prova classica con apertura file binario keyfile = open(key,"wb") infile = open(inputfile,"rb") outfile = open(outputfile,"wb") # reading tga content content = infile.read() header = content[:18] body = content[18:] # ge...
michaelgenesini/spli
07 MASSEY-OMURA/Pedro/encrypt_file.py
Python
mit
1,071
from operator import methodcaller # Used in sorted() def add_eqcost_linkage_order(original_class): """ Decorate the parse method of class Sentence (to be given as argument) with a new parse function, defined below, so equal-cost linkages will be in a deterministic order. Usage: lg_testutils.add_eqc...
ampli/link-grammar
bindings/python-examples/lg_testutils.py
Python
lgpl-2.1
3,784
# Copyright 2013-2015 Massachusetts Open Cloud Contributors # # 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 applicab...
kylehogan/haas
setup.py
Python
apache-2.0
4,566
# # @BEGIN LICENSE # # Psi4: an open-source quantum chemistry software package # # Copyright (c) 2007-2017 The Psi4 Developers. # # The copyrights for code used from other parties are included in # the corresponding files. # # This program is free software; you can redistribute it and/or modify # it under the terms of ...
kratman/psi4public
psi4/header.py
Python
gpl-2.0
2,628
# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
queria/my-tempest
tempest/api/compute/servers/test_server_metadata_negative.py
Python
apache-2.0
6,866
import bokeh.sampledata import os, pickle, pyDate from bokeh.plotting import figure, output_file, show def file_len(fname): with open(fname) as f: for i, l in enumerate(f): pass return i + 1 if __name__ == '__main__': # with open('count.pickle') as f: # count = pickle.load(f)[...
softwarespartan/AGT
insight/test.py
Python
mit
1,703
from datetime import datetime as dt, date as d, time as t, timedelta as td import pytest from gfitpy.utils.date_range import DateRange def test_create_date_range(): obj = DateRange(1, 2) assert obj.start == 1 assert obj.end == 2 @pytest.mark.parametrize( 'start, end, other_start, other_end', ...
leohemsted/gfitpy
tests/utils/test_date_range.py
Python
bsd-2-clause
6,501
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
wooga/airflow
airflow/providers/microsoft/azure/hooks/azure_fileshare.py
Python
apache-2.0
8,400
# Lint as: python3 """Tests for fairness_indicators.remediation.weight_utils.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections # Standard imports from fairness_indicators.remediation import weight_utils import tensorflow.compat.v1 as t...
tensorflow/fairness-indicators
fairness_indicators/remediation/weight_utils_test.py
Python
apache-2.0
7,758
import signal import subprocess class Timeout: """Timeout class using ALARM signal. source: http://stackoverflow.com/questions/8464391/what-should-i-do-if-socket-setdefaulttimeout-is-not-working Usage example: try: with Timeout(3): # some statments that may time out except Timeou...
mmihaltz/trendminer-hunlp
pytimeout.py
Python
gpl-2.0
675
from will.plugin import WillPlugin from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings from will import settings ON_CALL_USERS = { "mon": "hilliary", "tue": "hilliary", "wed": "hilliary", "thu": "hilliary", "fri": "steven", "sat": "brian...
buddyup/our-will
plugins/culture/oncall.py
Python
mit
1,796
""" Support for Irish Rail RTPI information. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.irish_rail_transport/ """ import logging from datetime import timedelta import voluptuous as vol import homeassistant.helpers.config_validation as cv fro...
PetePriority/home-assistant
homeassistant/components/sensor/irish_rail_transport.py
Python
apache-2.0
6,356
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import json import os import random import numpy as np import ray from ray.tune import Trainable, run, Experiment, sample_from from ray.tune.schedulers import HyperBandS...
ujvl/ray-ng
python/ray/tune/examples/hyperband_example.py
Python
apache-2.0
2,247
#!/usr/bin/env python3 import sys, os if len(sys.argv) != 3: print("Wrong amount of parameters.") assert(os.path.exists(sys.argv[1])) with open(sys.argv[2], 'w') as ofile: ofile.write("#define ZERO_RESULT 0\n")
centricular/meson
test cases/common/16 configure file/generator.py
Python
apache-2.0
223
import logging import os from autotest.client.shared import error, utils from virttest import data_dir, utils_test def umount_fs(mountpoint): if os.path.ismount(mountpoint): result = utils.run("umount -l %s" % mountpoint, ignore_status=True) if result.exit_status: logging.debug("Umount...
kylazhang/virt-test
libguestfs/tests/guestmount.py
Python
gpl-2.0
2,277
### @author Rishi Jatia import json import re import string def decode_unicode(data, replace_boo=True): # dictionary which direct maps unicode values to its letters dictionary = {'0030':'0','0031':'1','0032':'2','0033':'3','0034':'4','0035':'5','0036':'6','0037':'7','0038':'8','0039':'9','0024':'$','0040':'@',...
usc-isi-i2/etk
etk/data_extractors/htiExtractors/unicode_decoder.py
Python
mit
22,630
''' Created on Jun 21, 2013 @author: Yubin Bai All rights reserved. ''' from collections import namedtuple from math import atan2 from random import randrange from matplotlib import pyplot Point = namedtuple('Point', ['x', 'y']) def ccw(p, q, r): ''' CCW (Counter Clockwise) Test ''' def turn(p, q, r)...
baiyubin/python_practice
grahamScan/convexHull.py
Python
apache-2.0
2,844
# -*- coding: UTF-8 -*- ####################################################################### # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # @Daddy_Blamo wrote this file. As long as you retain this notice you # can do whatever you want wi...
RuiNascimento/krepo
script.module.lambdascrapers/lib/lambdascrapers/sources_placenta/en_placenta-1.7.8/sunmovies.py
Python
gpl-2.0
6,072
# Copyright (c) 2010-2012 OpenStack Foundation # # 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...
JioCloud/swift
swift/common/swob.py
Python
apache-2.0
46,204
# Copyright (c) 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 mojom import sys import traceback # Support for writing mojom test cases. # RunTest(fn) will execute fn, catching any exceptions. fn should retur...
cvsuser-chromium/chromium
mojo/public/bindings/generators/mojom_test.py
Python
bsd-3-clause
6,103
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
denny820909/builder
lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/test/__init__.py
Python
mit
2,076
# -*- coding:utf-8 -*- from django.contrib import admin from .models import Summary, StatsCSV, Detail # Register your models here. class SummaryModelAdmin(admin.ModelAdmin): """ 执行摘要管理Model """ list_display = ('id', 'execute', 'user_count', 'total_rps', 'add_time') list_display_links = ('execute'...
codelieche/webpts
projects/webptspy/apps/tresult/admin.py
Python
mit
788
import urlparse class PaginatedResultSet(object): """ Class to iterate result pages when searching for entities by query. :param manager EntityManager of Entity queried. :param data json data to populate class with entities and previous/next :raises """ def __init__(self, ...
getanewsletter/api-python
ganapi/helpers.py
Python
mit
2,697
import os from pip import main as pip_main from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='UCLDC Harvester', ...
mredar/harvester
setup.py
Python
bsd-3-clause
3,034
import datetime from sqlalchemy import desc from core.db import db from core.forms import BookInfoForm, CommentForm from core.tables import Books, Common, Comments, CommentsDetailed from core.utils import get_page_info from flask import render_template, Blueprint, redirect, url_for, request from flask_login import c...
Ignotus/bookclub
routes/books.py
Python
mit
3,720
# The MIT License (MIT) # # Copyright (c) 2016 Paul Watkins, National Institutes of Health / NINDS # # 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 lim...
elhuhdron/emdrp
neon3/data/parseEMdata.py
Python
mit
111,041
# coding=utf-8 # # Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
F5Networks/f5-common-python
f5/bigip/tm/ltm/node.py
Python
apache-2.0
5,397
import threading _conf = threading.local() def get_id_mapping(): return _conf.id_mapping def set_id_mapping(value): _conf.id_mapping = value def get_doc_view(): return _conf.doc_view def set_doc_view(value): _conf.doc_view = value def get_desc_view(): return _conf.desc_view def set_desc_view(val...
ox-it/humfrey
humfrey/linkeddata/mappingconf.py
Python
bsd-3-clause
488
"""This module provides base classes for a card and a deck of cards""" import abc from random import shuffle __all__ = ["Deck", "Card", "PlayingCard", "create_playing_card_deck"] """The base class for a card.""" class Card: __metaclass__ = abc.ABCMeta """This method should return a str that contains the nam...
dragonrider7225/PythonGames
cards/cards.py
Python
apache-2.0
2,693
# -*- coding: utf-8 -*- """ smoothing.py contains the main smoothing function, which works by convolving a signal with a smoothing kernel, a signals function which acts as a cache for kernels, as well as the hamming_smooth function, which is the only one currently used by external files, providing a simplified interfac...
modsim/molyso
molyso/generic/smoothing.py
Python
bsd-2-clause
3,339
#!/usr/bin/env python # Copyright (c) 2016 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. """Downloads SVGs into a specified directory.""" import optparse import os import sys import urllib PARENT_DIR = os.path.dirnam...
rubenvb/skia
tools/svg/svg_downloader.py
Python
bsd-3-clause
1,416
""" Mixins for setting up particular course structures (such as split tests or cohorted content) """ from datetime import datetime from pytz import UTC from openedx.core.djangoapps.course_groups.models import CourseUserGroupPartitionGroup from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory...
stvstnfrd/edx-platform
openedx/core/djangoapps/util/testing.py
Python
agpl-3.0
9,591
# -*- coding: utf-8; mode: python; indent-tabs-mode: t; tab-width:4 -*- from ..Qt import QtGui, QtCore from ..templates import ui_plot2Template as plotTemplate from ..utilities.expeyesWidgetsNew import expeyesWidgets import pyqtgraph as pg from ..expeyes import eyemath17 as eyemath import sys,time,functools,os import...
csparkresearch/ExpEYES17-Qt
SPARK17/experiments/fourier-test.py
Python
mit
6,363
#!/usr/bin/env python3 # Copyright 2021 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. from io import StringIO import os import sys from typing import Dict import unittest import tempfile from generate_framework_tests_an...
ric2b/Vivaldi-browser
chromium/chrome/test/webapps/generate_framework_tests_and_coverage_unittest.py
Python
bsd-3-clause
3,391
import models.helpers as helpers import os import struct import sys import math schema = "{http://www.collada.org/2005/11/COLLADASchema}" x = 0 y = 1 z = 2 def normalise(v): m = 0 for i in range(0, len(v)): m += v[i] * v[i] mag = math.sqrt(m) vr = [] for i in range(0, len(v)): if m...
polymonster/pmtech
tools/pmbuild_ext/models/parse_obj.py
Python
mit
11,022
#!/usr/bin/env python # -*- coding: UTF8 -*- # # Alsa hwdep. # Copyright (C) 2010 Josiah Gordon <josiahg@gmail.com> # # 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...
zepto/musio-python2
musio/alsa/hwdep.py
Python
gpl-3.0
14,214
#!/usr/bin/env python import pytest from ansibullbot.utils.extractors import extract_pr_number_from_comment @pytest.mark.parametrize('test_input,expected', [ ('resolved_by_pr 5136', 5136), ('resolved_by_pr: 5136', 5136), ('resolved_by_pr #5136', 5136), ('resolved_by_pr: #5136', 5136), ('resolved...
jctanner/ansibullbot
tests/unit/utils/test_extractors_pr_number.py
Python
gpl-3.0
1,026
# Copyright 2015 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...
allenlavoie/tensorflow
tensorflow/python/keras/_impl/keras/preprocessing/sequence.py
Python
apache-2.0
13,811
# -*- coding: utf-8 -*- import importlib import json import os def has_installed(dependency): try: importlib.import_module(dependency) return True except ImportError: return False def is_tox_env(env): if 'VIRTUAL_ENV' in os.environ: return env in os.environ['VIRTUAL_ENV']...
python-thumbnails/python-thumbnails
tests/utils.py
Python
mit
814
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py
Python
mit
15,848
# Copyright 2016 by MPI-SWS and Data-Ken Research. # Licensed under the Apache 2.0 License. """Run a subscriber that blocks in its send call. It gets a separate dedicated thread. """ import unittest import asyncio import time from antevents.base import BlockingSubscriber, Scheduler from utils import make_test_publishe...
mpi-sws-rse/antevents-python
tests/test_blocking_subscriber.py
Python
apache-2.0
2,032
# -*- coding: utf-8 -*- # *************************************************************************** # # Iterate through layers in the ToC and export the canvas as PNG # # Copyright (C) 2016 Germán Carrillo (geotux_tuxman@linuxmail.org) # # *************************************************************************** #...
gacarrillor/pyqgis_scripts
iterate_layers_export_png_qgis2.py
Python
gpl-2.0
3,385
""" .. topic:: Levinson module .. autosummary:: LEVINSON .. codeauthor:: Thomas Cokelaer, 2011 """ import numpy __all__ = ["LEVINSON", "rlevinson"] def LEVINSON(r, order=None, allow_singularity=False): r"""Levinson-Durbin recursion. Find the coefficients of a length(r)-1 order autoregres...
cokelaer/spectrum
src/spectrum/levinson.py
Python
bsd-3-clause
9,469
#!/usr/bin/python from mock import Mock import unittest import sys sys.path.insert(0,"../") import softwarecenter.paths from softwarecenter.db.application import Application from softwarecenter.distro import get_distro from softwarecenter.testutils import ( get_test_db, get_test_gtk3_icon_cache, do_events) from ...
armikhael/software-center
test/gtk3/test_appmanager.py
Python
gpl-3.0
2,671
#!/usr/bin/python from macaroon.playback import * import utils sequence = MacroSequence() sequence.append(PauseAction(3000)) sequence.append(KeyComboAction("F10")) sequence.append(KeyComboAction("Tab")) sequence.append(KeyComboAction("Tab")) sequence.append(KeyComboAction("Tab")) sequence.append(KeyComboAction("Tab"...
GNOME/orca
test/keystrokes/gnome-clocks/timer_flat_review.py
Python
lgpl-2.1
3,398
# vim:fileencoding=utf8 """ Copyright © 2011 Pádraig Brady <P@draigBrady.com> <!--Exclude from bashfeed--> 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 (a...
rezapx/private
nano_nano/scripts/scripts/comments/comments.py
Python
apache-2.0
6,594
"""Single slice vgg with normalised scale. """ import functools import lasagne as nn import numpy as np import theano import theano.tensor as T import data_loader import deep_learning_layers import image_transform import layers import preprocess import postprocess import objectives import theano_printer import update...
317070/kaggle-heart
configurations/j6_2ch_gauss.py
Python
mit
9,569
# -*- coding: utf-8 -*- # Copyright 2018 Objectif Libre # # 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 ...
openstack/python-cloudkittyclient
cloudkittyclient/tests/unit/v1/test_pyscripts.py
Python
apache-2.0
2,884
"""Tornado handlers for the tree view.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from tornado import web from ..base.handlers import IPythonHandler, path_regex from ..utils import url_path_join, url_escape class TreeHandler(IPythonHandler): """Render...
bdh1011/wau
venv/lib/python2.7/site-packages/notebook/tree/handlers.py
Python
mit
2,626
"""Dynamic Programming algorithms for general usage. This module contains classes which implement Dynamic Programming algorithms that can be used generally. """ class AbstractDPAlgorithms: """An abstract class to calculate forward and backward probabiliies. This class should not be instantiated directly, but...
dbmi-pitt/DIKB-Micropublication
scripts/mp-scripts/Bio/HMM/DynamicProgramming.py
Python
apache-2.0
12,658
from bottle import route, post, static_file, request, run from php_querystring import php_querystring from w2lib import w2Grid import sqlite3, json def here(path=''): import os return os.path.abspath(os.path.join(os.path.dirname(__file__),path)) conn = sqlite3.connect(here('users.sqlite3')) @route('/') def index...
fosfozol/w2ui
server/python/bottle/app.py
Python
mit
1,332