code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (C) 2010 Red Hat, Inc.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This so... | colloquium/rhevm-api | python/host-nics-test.py | Python | lgpl-2.1 | 1,769 |
"""SCons.Tool.FortranCommon
Stuff for processing Fortran, common to all fortran dialects.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# 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 So... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/FortranCommon.py | Python | lgpl-2.1 | 10,707 |
# Unit test for the FEM module
#***************************************************************************
#* Copyright (c) 2015 - FreeCAD Developers *
#* Author: Przemo Firszt <przemo@firszt.eu> *
#* ... | cypsun/FreeCAD | src/Mod/Fem/TestFem.py | Python | lgpl-2.1 | 4,603 |
'''simpler & deprecated python script controllers'''
import Sofa
import inspect
def deprecated(cls):
# TODO maybe we should print a backtrace to locate the origin?
# or even better, use: https://docs.python.org/2/library/warnings.html#warnings.warn
line = '''class `{0}` from module `{1}` is deprecated. Y... | Anatoscope/sofa | applications/plugins/SofaPython/python/SofaPython/script.py | Python | lgpl-2.1 | 2,609 |
# -*- coding: utf-8 -*-
from django.core import exceptions
from django.conf import settings
from django.db.models import fields
class BigAutoField(fields.AutoField):
def db_type(self, connection=None):
for item in settings.DATABASES:
if settings.DATABASES[item]['ENGINE'] == 'django.db.... | rubydhash/webradius | webradius-project/webradius/util.py | Python | lgpl-2.1 | 783 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/xphelloworld/package.py | Python | lgpl-2.1 | 2,024 |
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2015
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | steve-ord/daliuge | daliuge-engine/dlg/manager/composite_manager.py | Python | lgpl-2.1 | 19,989 |
# GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your opti... | airelil/pywinauto-64 | pywinauto/controls/HwndWrapper.py | Python | lgpl-2.1 | 65,743 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2010 by the FIFE team
# http://www.fifengine.net
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General ... | mgeorgehansen/FIFE_Technomage | demos/shooter/scripts/common/baseobject.py | Python | lgpl-2.1 | 7,040 |
'''
Interfaces required for using the parameter estimation methods
@author: Jerker Nordh
'''
import abc
import numpy
import scipy.optimize
class ParamEst(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def maximize(self, straj):
pass
class ParamEstIntFullTraj(object):
__metaclass__ ... | jerkern/pyParticleEst | pyparticleest/paramest/interfaces.py | Python | lgpl-3.0 | 10,506 |
from pymongo import MongoClient
client = MongoClient()
| WING-NUS/corpSearch | mongo.py | Python | lgpl-3.0 | 56 |
from GridCal.Engine.basic_structures import Logger
from GridCal.Engine.Core.multi_circuit import MultiCircuit
from GridCal.Engine.basic_structures import BranchImpedanceMode
from GridCal.Engine.basic_structures import BusMode
from GridCal.Engine.Devices.enumerations import ConverterControlType, TransformerControlType
f... | SanPen/GridCal | src/GridCal/Engine/Core/Compilers/circuit_to_data.py | Python | lgpl-3.0 | 28,064 |
#!/usr/bin/env python
import os
import logging
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import pickle
def setLogger(fname,loglevel):
""" Function to handle error logging """
logging.basicConfig(filename=fname, filemode='w', level=loglevel, format='%(asctime)s - %(levelname)s - ... | McIntyre-Lab/papers | fear_sem_sd_2015/scripts/ggm_graph_network_neighborhoods.py | Python | lgpl-3.0 | 7,295 |
import pytest
from .utils import *
import psi4
pytestmark = [pytest.mark.quick, pytest.mark.mp2]
_ref_h2o_ccpvdz = {
'df': {
'HF TOTAL ENERGY': -76.0167614256151865,
'MP2 SAME-SPIN CORRELATION ENERGY': -0.0527406422061238,
'MP2 OPPOSITE-SPIN CORRELATION ENERGY'... | CDSherrill/psi4 | tests/pytests/test_mp2.py | Python | lgpl-3.0 | 21,931 |
#-------------------------------------------------------------------------------
# Copyright (c) 2013 Alten AB.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://www.g... | AltenSesto/linx4py | src/test/async_receiver_test.py | Python | lgpl-3.0 | 2,889 |
import logging
import re
from OpenSSL import SSL
from twisted.python.failure import Failure
from twisted.internet.ssl import Certificate, VerificationError
from twisted.internet._sslverify import ClientTLSOptions, OpenSSLCertificateOptions, verifyHostname
log = logging.getLogger(__name__)
def optionsForC... | aronbierbaum/txsuds | suds/transport/sslverify.py | Python | lgpl-3.0 | 2,858 |
# -*- coding: utf-8 -*-
# wasp_general/network/web.py
#
# Copyright (C) 2016 the wasp-general authors and contributors
# <see AUTHORS file>
#
# This file is part of wasp-general.
#
# Wasp-general is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as pub... | a1ezzz/wasp-general | wasp_general/network/web/request.py | Python | lgpl-3.0 | 4,630 |
from distutils.core import setup
setup(name = "pycann",
version = "0.01",
description = "A Python/C hybrid for fast neural networks",
author = "Janosch Gräf",
author_email = "janosch.graef@gmx.net",
py_modules = ["pycann"],
license = "GNU LGPL v3")
| jgraef/pycann | setup.py | Python | lgpl-3.0 | 287 |
# -*- coding: utf-8 -*-
"""The common module of dolfin"""
from dolfin.common import globalparameters
from dolfin.common import constants
from dolfin.common import plotting
from dolfin.common import time
from dolfin.common import memory
from dolfin.common import math
from dolfin.common import timer
from .globalparamete... | FEniCS/dolfin | site-packages/dolfin/common/__init__.py | Python | lgpl-3.0 | 799 |
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Quartile Limted
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
class StockMove(models.Model):
_inherit = "stock.move"
pick_partner_id = fields.Many2one(
related='picking_id.partner_id',
... | rfhk/awo-custom | sale_line_quant_extended/models/stock_move.py | Python | lgpl-3.0 | 10,584 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import support
from . import res_users
# vi... | bmya/odoo-support | web_support_client/models/__init__.py | Python | lgpl-3.0 | 382 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pdb
import time
import cx_Oracle
import multiprocessing
ipList = ("192.168.7.121",
"192.168.7.122",
"192.168.7.123",
"192.168.7.124",
"192.168.7.125",
"192.168.7.126",
"192.168.7.127",
"192.168.7... | wbvalid/python2 | aioSqlQuery.py | Python | unlicense | 1,328 |
# CTCI 1.3
# URLify
import unittest
# My Solution
#-------------------------------------------------------------------------------
# CTCI Solution
def urlify(string, length):
'''function replaces single spaces with %20 and removes trailing spaces'''
new_index = len(string)
for i in reversed(range(leng... | kyle8998/Practice-Coding-Questions | CTCI/Chapter1/1.3-URLify.py | Python | unlicense | 1,208 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-30 08:44
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 = [
migrations.swappable_depende... | duozhilin/Blog | blogs/migrations/0009_topic_owner.py | Python | unlicense | 685 |
# Some utilities for running full tests
#
# Eli Bendersky (C) 2008-2010
#
import os, imp
from lib.commonlib.portability import exec_function
from lib.asmlib.assembler import Assembler
from lib.asmlib.linker import Linker
from lib.commonlib.luz_defs import (
USER_MEMORY_START, USER_MEMORY_SIZE)
def s... | 8l/luz-cpu | luz_asm_sim/tests_full/testrun_utils.py | Python | unlicense | 1,514 |
def binarySearch(someList, target):
lo = 0
hi = len(someList)
while lo+1 < hi:
test = (lo + hi) / 2
if someList[test] > target:
hi = test
else:
lo = test
if someList[lo] == target:
return lo
else:
return -1
import random
def quickSort(someList):
listSize = len(someList)
... | KingSpork/sporklib | algorithms/binarySearch.py | Python | unlicense | 670 |
"""
Worker which simulate hard work. Work with durable queue.
Using pika https://github.com/pika/pika.
"""
import time
import pika
def callback(channel, method, properties, body):
print " [x] Received {0}".format(body)
time.sleep(float(body.count('second'))/20)
print " [x] Done"
channel.basic_ack(deli... | OlegPshenichniy/RabbitMQ-Python | with_pika/2/durable/worker_durable_ack.py | Python | unlicense | 770 |
__author__ = 'Nathen'
# get min and max bounds
a, b = map(lambda i: int(i), input('Nums: ').split(' '))
# create generator of all odd nums
nums = [x for x in range(a, b + 1) if x % 2 == 1]
# sum nums
ans = sum(nums)
# print answer
print(ans) | nadrees/PyRosalind | Python Village/INI4.py | Python | unlicense | 243 |
import pygame, random, sys, math
import constants
from bullet import Bullet
pygame.init()
laserSound = pygame.mixer.Sound("resources/laser.wav")
class Player:
def __init__(self, x, y):
self.facing = "up"
try:
image = pygame.image.load("resources/ship.png")
image = pygame.transform.scale(image, (40, 40))
... | xianc78/Asteroids | player.py | Python | unlicense | 2,498 |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from djforms.music.theatre.summer_camp import BCC, TO_LIST, REG_FEE
from djforms.processors.models import Contact, Order
from djforms.processors.forms import TrustCommerceForm
from djfor... | carthagecollege/django-djforms | djforms/music/theatre/summer_camp/views.py | Python | unlicense | 3,884 |
"""
.. math.py
Simple math movers.
"""
## Inheritance
import base
# import library.movers.pushqueue as pq
## Inifinity definition
inf = float("inf")
#########################################
## ----- Special data containers ----- ##
#########################################
class MovingMax(base.Mover):
""" Co... | pelegm/movers | math.py | Python | unlicense | 9,322 |
import re, urllib2
class WhatBase:
# Some utility functions and constants that I am very lazily bunging into a base class
_sitename = "what.cd"
def debugMessage(self, message, messagecallback = None):
if messagecallback:
messagecallback(message)
else:
print message
def downloadResource(self, url, path... | lapsed/whatbot | whatbase.py | Python | unlicense | 1,735 |
import bpy
def forceupdate(nodes):
for node in nodes:
if node.inputs:
for inpt in node.inputs:
try:
inpt.default_value = inpt.default_value # set value to itself to force update
return True
except:
pas... | Chasvortex/caffe-gui-tool | CGTArrangeHelper.py | Python | unlicense | 10,580 |
"""
Copyright 2018-present Airbnb, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | airbnb/streamalert | tests/unit/streamalert/apps/test_apps/test_aliyun.py | Python | apache-2.0 | 7,474 |
#
# 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... | apache/dispatch | tests/system_tests_tcp_adaptor.py | Python | apache-2.0 | 50,963 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | GoogleCloudPlatform/ml-on-gcp | example_zoo/tensorflow/models/ncf_main/official/recommendation/ncf_main.py | Python | apache-2.0 | 17,012 |
# Copyright 2012 NetApp
# Copyright 2015 Chuck Fouts
# 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
#
#... | sniperganso/python-manilaclient | manilaclient/v1/shares.py | Python | apache-2.0 | 1,210 |
# 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
# distributed under t... | stackforge/python-openstacksdk | openstack/identity/v3/service.py | Python | apache-2.0 | 1,798 |
import abc
class HGVSTestService(object):
@abc.abstractmethod
def info(self):
"""returns dictionary of package info
"""
pass
@abc.abstractmethod
def project_t_to_g(self, hgvs_string, ac):
"""projects transcript (c. or n.) variant hgvs_string onto genomic
seque... | biocommons/hgvs-eval | hgvseval/testservice/interface.py | Python | apache-2.0 | 1,686 |
import json
from theExceptions import (CreationError, DeletionError, UpdateError)
class Index(object) :
def __init__(self, collection, infos = None, creationData = None) :
"""An index on a collection's fields. Indexes have a .infos dictionnary that stores all the infos about the index"""
self.collection = col... | christiano/pyArango | pyArango/index.py | Python | apache-2.0 | 1,257 |
from models import User
from google.appengine.ext import ndb
from datetime import timedelta, datetime
import logging
import urllib
import urllib2
import socket
import os
import json
import config
from shared import config
import socket
isDevEnv = True if 'localhost' in socket.gethostname() else False
# Get AT from ca... | dstrockis/outlook-autocategories | shared/auth.py | Python | apache-2.0 | 5,109 |
#!/usr/bin/python
import argparse
import boto.sqs
import boto.ec2.cloudwatch
import os
import csv
from datetime import datetime, timedelta
from collections import defaultdict
import pandas as pd
import matplotlib.pyplot as plt
import StringIO
class SqsMetrics:
default_metrics= ["ApproximateNumberOfMessagesVisible... | agilefall/aws-tools | sqs_metrics.py | Python | apache-2.0 | 3,242 |
import os
import time
import pandas as pd
import pytest
import requests
from botocore.session import Session
from great_expectations.datasource.batch_kwargs_generator import (
S3SubdirReaderBatchKwargsGenerator,
)
port = 5555
url_host = os.getenv("GE_TEST_LOCALHOST_URL", "127.0.0.1")
endpoint_uri = f"http://{url... | great-expectations/great_expectations | tests/datasource/batch_kwarg_generator/test_s3_subdir_reader_generator.py | Python | apache-2.0 | 3,834 |
"""
Copyright (c) 2017 SONATA-NFV and Paderborn University
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 ap... | stevenvanrossem/son-emu | src/emuvim/api/openstack/openstack_dummies/neutron_dummy_api.py | Python | apache-2.0 | 44,105 |
#!/usr/bin/env python3
import argparse
import json
import logging
import os
import re
import sys
import time
import urllib.parse
import urllib.request
from processors import processor
from subway_io import (
dump_yaml,
load_xml,
make_geojson,
read_recovery_data,
write_recovery_data,
)
from subway_st... | mapsme/subways | process_subways.py | Python | apache-2.0 | 12,971 |
# Copyright 2021 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleapis/python-recaptcha-enterprise | samples/snippets/migrate_site_key.py | Python | apache-2.0 | 1,870 |
# Copyright 2018 SAS Project 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 requ... | Wireless-Innovation-Forum/Spectrum-Access-System | src/harness/reference_models/geo/zones_test.py | Python | apache-2.0 | 4,052 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/services/types/keyword_plan_campaign_service.py | Python | apache-2.0 | 6,083 |
#
# 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
# distributed under t... | noironetworks/heat | heat/tests/openstack/senlin/test_receiver.py | Python | apache-2.0 | 4,398 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | examples/pipeline/hetero_feature_binning/pipeline-hetero-binning-sparse-optimal-chi-square.py | Python | apache-2.0 | 2,362 |
from Sensor import Sensor
import cv2
class Camera(Sensor):
def __init__(self):
self._cap = cv2.VideoCapture(0)
def read(self):
return self._cap.read()
| paulydboy/Quad-Vision | DroneControl/Camera.py | Python | apache-2.0 | 177 |
#!/bin/python
from datetime import timedelta
from pprint import pprint as pp
import json
import Monstr.Core.Utils as Utils
import Monstr.Core.DB as DB
import Monstr.Core.BaseModule as BaseModule
import pytz
from Monstr.Core.DB import Column, Integer, String, DateTime, UniqueConstraint, func
class CMSJobStatus(Bas... | tier-one-monitoring/monstr | Monstr/Modules/CMSJobStatus/CMSJobStatus.py | Python | apache-2.0 | 9,424 |
# Copyright 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 a... | eharney/cinder | cinder/api/contrib/volume_image_metadata.py | Python | apache-2.0 | 6,636 |
# Copyright (c) 2014 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 agreed to ... | ekasitk/sahara | sahara/service/edp/oozie/engine.py | Python | apache-2.0 | 11,739 |
# Copyright 2018 The TensorFlow Probability 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 applicable law o... | tensorflow/probability | tensorflow_probability/python/distributions/finite_discrete.py | Python | apache-2.0 | 14,488 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''
NAME='wu4'
SPELL='wù'
CN='戊'
SEQ='5'
if __name__=='__main__':
pass
| sinotradition/sinoera | sinoera/tiangan/wu4.py | Python | apache-2.0 | 217 |
#!/usr/bin/env python
"""A daemon that relies on self.logger to be usable"""
from __future__ import print_function, absolute_import, division
import os
import sys
import time
from succubus import Daemon
class MyDaemon(Daemon):
def run(self):
while True:
self.logger.error("succubus test runni... | ImmobilienScout24/succubus | src/integrationtest/python/logging_daemon.py | Python | apache-2.0 | 490 |
"""
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_query_set)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES ... | greggian/TapdIn | django/core/serializers/__init__.py | Python | apache-2.0 | 3,648 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/covid-19-open-data | src/pipelines/epidemiology/us_nyt_covid.py | Python | apache-2.0 | 3,093 |
from salesking.tests.base import SalesKingBaseTestCase
class MockCollectionContactResponse(object):
def __init__(self):
self.status_code = 200
self.content = u'''
{"contacts":
[{"contact":{"id":"a55-akQyir5ld2abxfpGMl","parent_id":null,"type":"Client","is_employee":false,"number":"K-2015-1286","... | salesking/salesking_python_sdk | salesking/tests/test_contacts_collection_mock.py | Python | apache-2.0 | 24,848 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# 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/... | tylertian/Openstack | openstack F/glance/glance/common/animation.py | Python | apache-2.0 | 6,628 |
"""
Django settings for km_api project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Build pa... | knowmetools/km-api | km_api/km_api/settings.py | Python | apache-2.0 | 10,854 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src/rogerthat/api/location.py | Python | apache-2.0 | 2,005 |
import random, inspect
from sched import scheduler
from time import time, sleep
from datetime import datetime
####################################################################################################
# Minimal implementation of the signaling library
class Signal(object):
def __init__(self, name):
... | dstcontrols/osisoftpy | examples/mini_signal_example.py | Python | apache-2.0 | 5,723 |
# -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... | prmtl/fuel-web | nailgun/nailgun/test/unit/test_objects.py | Python | apache-2.0 | 27,637 |
# Copyright 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | cloudbau/nova | nova/tests/api/openstack/compute/test_limits.py | Python | apache-2.0 | 35,992 |
# Copyright (c) 2016 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 applic... | baidu/Paddle | python/paddle/dataset/mnist.py | Python | apache-2.0 | 4,900 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | kubeflow/kfp-tekton-backend | sdk/python/kfp/components_tests/test_structure_model_base.py | Python | apache-2.0 | 9,140 |
# Copyright 2013-2016 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | BriData/DBus | dbus-mongo-extractor/tests/test_rollbacks.py | Python | apache-2.0 | 12,580 |
#!/usr/bin/env python3
# Copyright 2014-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... | winksaville/meson | mesonbuild/mconf.py | Python | apache-2.0 | 9,662 |
# -*- coding: utf-8 -*-
'''
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use sendgrid to send emails
- Use MEMCACHIER on Heroku
'''
from configurations import values
# See: http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html#settings... | aschn/goodtechgigs | goodtechgigs/config/production.py | Python | apache-2.0 | 4,647 |
"""gazette_files
Revision ID: 1986f3e16316
Revises: 4c8a62ba844a
Create Date: 2015-03-18 09:05:57.232651
"""
# revision identifiers, used by Alembic.
revision = '1986f3e16316'
down_revision = '4c8a62ba844a'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
##... | Code4SA/pmg-cms-2 | migrations/versions/1986f3e16316_gazette_files.py | Python | apache-2.0 | 1,527 |
# Copyright 2013 Vaughan Kitchen <v.kitchen@gnoms.org>
#
# 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 ... | vkitchen/ah | libah/cli/shortopts.py | Python | apache-2.0 | 1,053 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/services/types/keyword_plan_campaign_service.py | Python | apache-2.0 | 5,624 |
import logging
import os
import sqlalchemy as sql
from config import db_credentials
# Localhost
HOST = db_credentials['host']
USERNAME = db_credentials['username']
PASSWORD = db_credentials['password']
DB_NAME = db_credentials['db_name']
connection_string = \
"mysql://{user}:{password}@{host}/{db}?charset=utf8".... | pascalc/narrative-roulette | src/db/__init__.py | Python | apache-2.0 | 1,164 |
#!/usr/bin/env python
'''
Project: Geothon (https://github.com/MBoustani/Geothon)
File: Vector/create_shp_polygon.py
Description: This code creates a polygon shapefile from multi-points.
Author: Maziyar Boustani (github.com/MBoustani)
'''
import os
try:
import ogr
except ImportError:
... | MBoustani/Geothon | Create Spatial File/Vector/create_shp_polygon.py | Python | apache-2.0 | 2,048 |
# -*- coding: utf-8 -*-
from .api import get_artifactory_config_from_url, update_ldapSettings_from_dict, update_artifactory_config, cr_repository, update_password, get_repo_configs, get_repo_list
| brain461/ar_too | ar_too/__init__.py | Python | apache-2.0 | 197 |
from . import views
from django.conf.urls import include, url
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# index page
url(r'^$', views.site().index, name = 'index'),
# login form
url(r'^login/$', views.site().login, name = 'login'),
url(r'^logout/$', ... | XcomConvent/xcom40k-shades | xcom40k/app/urls.py | Python | apache-2.0 | 3,601 |
from setuptools import setup,find_packages
with open('src/hermes/version.py') as fin: exec(fin.read())
setup(
name='esri-hermes',
version=__version__,
package_dir={'':'src'},
packages=find_packages('src'),
include_package_data=True,
# PyPI MetaData
author='achapkowski',
author_email... | Esri/hermes | setup.py | Python | apache-2.0 | 1,045 |
import os
from PIL import Image
import numpy
from utils import ensure_dir
DRAWABLE = 'drawable'
class ImageTypeException(Exception):
pass
class Density(object):
LDPI = 'ldpi'
MDPI = 'mdpi'
HDPI = 'hdpi'
XHDPI = 'xhdpi'
XXHDPI = 'xxhdpi'
XXXHDPI = 'xxxhdpi'
RATIOS = {
LDPI: ... | dimagi/commcare-android | images/dpi_manager.py | Python | apache-2.0 | 4,399 |
# -*- coding: utf-8 -*-
"""
pycclib
library for accessing the cloudControl API using Python
Copyright 2010 cloudControl UG (haftungsbeschraenkt)
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... | cloudControl/pycclib | pycclib/cclib.py | Python | apache-2.0 | 33,766 |
# Copyright 2018 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... | google/citest | tests/base/journal_navigator_test.py | Python | apache-2.0 | 2,737 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-access-approval | google/cloud/accessapproval_v1/services/access_approval/__init__.py | Python | apache-2.0 | 769 |
def my_function(a, b):
"""Returns a*b
"""
return a * b
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_developer_tools/doctest_in_help.py | Python | apache-2.0 | 67 |
from typing import Any, Dict, Mapping, Union
from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import get_client
from zerver.lib.push_notifications import get_apns_badge_count
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Subscription... | synicalsyntax/zulip | zerver/tests/test_message_edit_notifications.py | Python | apache-2.0 | 21,406 |
import numpy as np
from imreg_dph import AffineTransform
from nose.tools import *
def test_translation():
"""make sure tranlation works"""
# AffineTransform Tests
af1 = AffineTransform(translation=(1, 2))
af2 = AffineTransform(translation=(5, 3))
af3 = af1 @ af2
assert np.array_equal(af3.trans... | david-hoffman/scripts | test_imreg_dph.py | Python | apache-2.0 | 575 |
# 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
# distrib... | dtroyer/osc-lib | osc_lib/tests/api/test_utils.py | Python | apache-2.0 | 3,383 |
from Crypto.Cipher import AES
from Crypto import Random
from . import CryptoMaterialsCacheEntry
def test_pycrypto():
key = b'Sixteen byte key'
iv = Random.new().read(AES.block_size)
cipher = pycrypto_arc2.new(key, AES.MODE_CFB, iv)
factory = CryptoMaterialsCacheEntry()
| chair6/bandit | examples/pycrypto.py | Python | apache-2.0 | 289 |
#!/usr/bin/env python
class Tower(object):
def __init__(self, n, tower_name):
if n < 0:
raise ValueError("n must be 0 or greater")
self.stack = [x + 1 for x in range(n)][::-1]
self.tower_name = tower_name
def size(self):
return len(self.stack)
def add(self... | davjohnst/fundamentals | fundamentals/recursion/hanoi/tower.py | Python | apache-2.0 | 1,102 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... | usc-isi/extra-specs | nova/tests/rpc/test_dispatcher.py | Python | apache-2.0 | 3,730 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import pyro.distributions.torch_patch # noqa F403
from pyro.distributions.torch import * # noqa F403
# isort: split
from pyro.distributions.affine_beta import AffineBeta
from pyro.distributions.asymmetriclaplace import (
As... | uber/pyro | pyro/distributions/__init__.py | Python | apache-2.0 | 5,185 |
# Copyright 2019 Microsoft Corporation
#
# 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... | Azure/WALinuxAgent | tests/common/osutil/test_clearlinux.py | Python | apache-2.0 | 1,180 |
import tensorflow as tf
import numpy as np
import pandas as pd
import time
def get_step_indexes(step, batch_size, n):
start = (step * batch_size) % n
stop = start + batch_size
if stop > n:
stop = n
return (start, stop)
ratio = 0.7
batch_size = 1000
n_features = 784
label_index = 0
feature_ind... | thoolihan/KaggleMNIST | Python/nn.py | Python | apache-2.0 | 4,805 |
from __future__ import absolute_import
import unittest
import responses
import requests
from .requests_patch import patched_extract_cookies_to_jar
from terminalone import T1
mock_credentials = {
'username': 'user',
'password': 'password',
'api_key': 'api_key',
}
API_BASE = 'api.mediamath.com'
requests.se... | MediaMath/t1-python | tests/test_budgetflights.py | Python | apache-2.0 | 3,209 |
# 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... | petewarden/tensorflow | tensorflow/python/keras/layers/__init__.py | Python | apache-2.0 | 13,826 |
#!/usr/bin/env python
############################################################
# ConfigScanner - A buildbot config scanner and updater #
# Also does ReviewBoard (and at some point Bugzilla?) #
# Built for Python 3, works with 2.7 with a few tweaks #
#####################################################... | chtyim/infrastructure-puppet | modules/buildbot_asf/files/configscanner.py | Python | apache-2.0 | 12,920 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# al... | mcruger/GooglePythonCourse | basic/list2.py | Python | apache-2.0 | 2,316 |
# -*- coding: utf-8 -*-
'''
fantastic Add-on
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 pro... | TheWardoctor/Wardoctors-repo | script.module.fantastic/lib/resources/lib/sources/en/rlsbb.py | Python | apache-2.0 | 5,587 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: Patrick Bos
# @Date: 2016-11-16 16:23:55
# @Last Modified by: E. G. Patrick Bos
# @Last Modified time: 2017-09-05 17:27:17
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from pathlib import Path
import itertool... | roofit-dev/parallel-roofit-scripts | profiling/vincemark/analyze_g.py | Python | apache-2.0 | 13,421 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_job_service_list_custom_jobs_sync.py | Python | apache-2.0 | 1,526 |