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
# -*- coding: utf-8 -*-
from nose.tools import eq_,assert_almost_equal,raises
from utilities import execution_path, run_all
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'... | rouault/mapnik | tests/python_tests/ogr_test.py | Python | lgpl-2.1 | 4,110 |
from img_list import Img_List
from image_control import Image_Control
from browser import *
class Wnd(gtk.Window):
def __init__(self):
super(Wnd, self).__init__(gtk.WINDOW_TOPLEVEL)
self.set_size_request(width=1200, height=768)
self.set_title('IMGeotagger revived')
self.realize()
... | nicolasbrailo/IMGeotaggerV2 | imgeotagger.py | Python | lgpl-2.1 | 3,219 |
#!/usr/bin/env python
import fluidity.diagnostics.annulus_mesh as mesh
import fluidity.diagnostics.triangletools as tt
div = mesh.SliceCoordsConstant(0.0, 1.0, 3)
m = mesh.GenerateRectangleMesh(div, div)
tt.WriteTriangle(m, "square-structured-linear")
| FluidityProject/multifluids | tests/square-convection-parallel-trivial/src/genmesh.py | Python | lgpl-2.1 | 254 |
import string, warnings
from ldaptor import md4, config
lower='abcdefghijklmnopqrstuvwxyz'
upper=lower.upper()
toupper=string.maketrans(lower, upper)
def nthash(password=''):
"""Generates nt md4 password hash for a given password."""
password=password[:128]
password=''.join([c+'\000' for c in password])
... | antong/ldaptor | ldaptor/samba/smbpassword.py | Python | lgpl-2.1 | 2,466 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Example of using Iterator Operations to retrieve instances from a
WBEM Server. This example executes the IterEnumerateInstances and the
corresponding IterEnumeratePaths operations.
It:
Creates a connection
Opens an enumeration session w... | zenoss/pywbem | examples/enumerator_generator.py | Python | lgpl-2.1 | 10,193 |
'''
This library offers an API to use LatchAuth in a python environment.
Copyright (C) 2013 Eleven Paths
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, ... | maxssestepa/latchwake | latchapp.py | Python | lgpl-2.1 | 3,750 |
# Copyright (C) 2010-2014 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library ... | FedoraScientific/salome-paravis | test/VisuPrs/GaussPoints/C1.py | Python | lgpl-2.1 | 2,013 |
"""http://git.kernel.org/cgit/linux/kernel/git/jberg/iw.git/tree/scan.c?id=v3.17.
Copyright (c) 2015 Robert Pooley
Copyright (c) 2007, 2008 Johannes Berg
Copyright (c) 2007 Andy Lutomirski
Copyright (c) 2007 Mike Kershaw
Copyright (c) 2008-2009 Luis R. Rodriguez
Permission to use, copy, modify, and/or distribute ... | Robpol86/libnl | libnl/nl80211/iw_scan.py | Python | lgpl-2.1 | 29,804 |
#
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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 3 of the License, or
# (at your... | IvarsKarpics/mxcube | gui/bricks/TaskToolBoxBrick.py | Python | lgpl-3.0 | 8,196 |
import os
import imp
util = imp.load_source("__pyblish_util", os.path.join(__file__, "..", "..", "__pyblish_util.py"))
util.wrap_module(__name__, "pyblish-base")
| pyblish/pyblish-win | pythonpath/pyblish/__init__.py | Python | lgpl-3.0 | 163 |
import autocomplete_light
from association.models import Word
from django.utils.translation import ugettext as _
class WordAutocomplete(autocomplete_light.AutocompleteModelBase):
search_fields=['name']
choice_html_format = '<span class="block os" data-value="%s">%s (%s)</span>'
attrs={
'placeholde... | Tima-Is-My-Association/TIMA | association/autocomplete_light_registry.py | Python | lgpl-3.0 | 694 |
# -*- coding: utf-8 -*-
{
'name': 'SaaS Portal Asynchronous database creation',
'version': '1.0.0',
'author': 'IT-Projects LLC',
"support": "apps@it-projects.info",
'website': "https://it-projects.info",
'license': 'GPL-3',
'category': 'SaaS',
'depends': [
'base',
'saas_p... | thinkopensolutions/odoo-saas-tools | saas_portal_async/__openerp__.py | Python | lgpl-3.0 | 459 |
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.core.context_processors import csrf
from django.views.generic.base import View, TemplateView
from django.views import generic
from django.shortcuts import render_to_response
from django.template import RequestContext, load... | awalin/rwis | views.py | Python | lgpl-3.0 | 4,395 |
from RMPY.rig import rigSingleJoint
from RMPY.rig import rigBase
import pymel.core as pm
class RigPropModel(rigBase.BaseModel):
def __init__(self):
super(RigPropModel, self).__init__()
self.single_joints = []
class RigProp(rigBase.RigBase):
def __init__(self, *args, **kwargs):
kwargs... | rendermotion/RMPY | rig/rigProp.py | Python | lgpl-3.0 | 2,842 |
''' Helpers functions and classes for sequence manipulation.
'''
__author__ = "Juan Palacios <juan.palacios@nikhef.nl>"
__all__ = ('isiterable',
'flattenList')
def isIterable(obj) :
'''
Test if an object is iterable but not a string type.
'''
return hasattr(obj, "__iter__") and not isinstanc... | juanchopanza/pyhistuples | pyhistuples/pysequence.py | Python | lgpl-3.0 | 763 |
from django.db import models
from django.contrib import admin
# Create your models here.
class BlogPost(models.Model):
title = models.CharField(max_length=150)
body = models.TextField()
timestamp = models.DateTimeField()
class Meta:
ordering = ('-timestamp',)
class BlogPostAdmin(admin.ModelAd... | Podolyakofs/django | learning_django/base/models.py | Python | lgpl-3.0 | 790 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import os
import re
import sys
import importlib
import pytest
import pytest_flake8
from nbconvert.exporters import PythonExporter
import nbconvert.filters
from mpi4py import MPI
try:
impo... | mathLab/RBniCS | tutorials/conftest.py | Python | lgpl-3.0 | 4,763 |
"""
WSGI config for patchwatcher2 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO... | LuyaoHuang/patchwatcher | patchwatcher2/patchwatcher2/wsgi.py | Python | lgpl-3.0 | 403 |
#!/bin/python
# -*- coding: utf-8 -*-
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
import os, struct, sys, pty, tty, termios, shlex, signal, pyte, time, fcntl ,getpass
from select import select
from fenrirscreenreader.core import debug
from fenrirscreenreader.core.eventData import fenrirEven... | chrys87/fenrir | src/fenrirscreenreader/screenDriver/ptyDriver.py | Python | lgpl-3.0 | 9,221 |
#-*-coding:utf-8-*-
"""
@package bit.tests.test_bundler
@brief tests for bit.bundler
@author Sebastian Thiel
@copyright [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl.html)
"""
__all__ = []
from bit.tests import ITTestCaseBase
from bit.bundler import *
import sys
import os
from sqlalchemy imp... | Byron/bit | src/python/bit/tests/test_bundler.py | Python | lgpl-3.0 | 5,905 |
'''
@package gradientutils
gradientutils was writen by Giuseppe Marco Randazzo <gmrandazzo@gmail.com>
Geneve May 2016
gradientutils contains function which are used to estimate:
- get_lss_peak_width: get the peak width according to the lss theory
- get_lss_gradient_critical_rs: critical couples with their resolutio... | gmrandazzo/PyLSS | pylss/gradientutils.py | Python | lgpl-3.0 | 10,797 |
import math, M2Crypto, base64
from lostexhaust.models.carpool import Carpool
from lostexhaust.models.household import Household
def geo_distance(latitude, longitude, other_latitude, other_longitude):
lat = math.radians(latitude)
lon = math.radians(longitude)
lat2 = math.radians(other_latitude)
lon2 = m... | jakespringer/lostexhaust-v2 | api/lostexhaust/util.py | Python | lgpl-3.0 | 1,265 |
import solving
import backend
if backend.__name__ == "dolfin":
import backend.fem.projection
import misc
import libadjoint
import adjglobals
import adjlinalg
import utils
def project_dolfin(v, V=None, bcs=None, mesh=None, solver_type="cg", preconditioner_type="default", form_compiler_parameters=None, annotate=None... | pf4d/dolfin-adjoint | dolfin_adjoint/projection.py | Python | lgpl-3.0 | 3,054 |
import os
import sys
import logging
class UserEntity(object):
def __init__(self, user_id):
self.user_id = user_id
#self.prefs = {"locale": "zh_CN"}
self.prefs = {}
def load(self, entity):
self.nickname = entity.nickname
self.prefs['locale'] = entity.language
sel... | xiangcai/todother | module/user.py | Python | lgpl-3.0 | 344 |
#!/usr/bin/env python
# =============================================================================
# 2013+ Copyright (c) Kirill Smorodinnikov <shaitkir@gmail.com>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | ijon/elliptics | tests/pytests/test_session_monitor_and_statistics.py | Python | lgpl-3.0 | 1,299 |
'''Acquisition module
This module provides an acquisition interface for existing devices
.. autosummary::
:toctree:
lima
motor
musst
p201
'''
| tiagocoutinho/bliss | bliss/scanning/acquisition/__init__.py | Python | lgpl-3.0 | 161 |
"""Retrieves the Source and Destination station pairs for APSRTC buses
"""
import scraperwiki
import lxml.html
base_url = 'http://www.apsrtconline.in/'
sources = dict()
def get_sources():
html = scraperwiki.scrape(base_url)
assert 'APSRTC Official Website' in html
root = lxml.html.fromstring(html)
for... | sramana/rtc-schedule | andhra_source_destination_pairs.py | Python | unlicense | 1,493 |
"""
This signature contains test to see if the site is running on OpenText Web Site Management.
"""
__author__ = "Steven Brent"
__copyright__ = "CM Fieldguide"
__credits__ = ["Steven Brent","Markus Giesen"]
__license__ = "Unlicense"
__version__ = "0.1"
__maintainer__ = "Steven Brent"
__email__ = "scbrent@gmail.com"
__s... | sggottlieb/cmfieldguide | cmfieldguide/cmsdetector/signatures/opentext.py | Python | unlicense | 2,215 |
import unittest
from music_app.post import Post
class TestPost(unittest.TestCase):
"""Class to test the Post Class"""
def test_object_creation(self):
p = Post('Promises', 'Dreamers', 'rock', '2014', 8, 'http://example.com', 146666666.66, 'https://www.youtube.com')
self.assertEqual(p.title,... | Mester/demo-day-vikings | tests/test_post.py | Python | unlicense | 671 |
"team peggle specific commands"
from util import hook, http
def format_server(server):
return "\x02%-16s\x02 steam://connect/%s" % (server.get('name')[0:16], server.get('host'))
@hook.command('server', autohelp=False)
@hook.command(autohelp=False)
def servers(inp, chan='', nick='', reply=None):
servers = http.get_... | TeamPeggle/ppp-helpdesk | plugins/teampeggle.py | Python | unlicense | 607 |
from mws.parsers.base import first_element, BaseElementWrapper, BaseResponseMixin
from mws._mws import InboundShipments
namespaces = {
'a': 'http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/'
}
class Member(BaseElementWrapper):
def __init__(self, element):
BaseElementWrapper.__init__(... | ziplokk1/python-amazon-mws | mws/parsers/fulfillment/listinboundshipmentitems.py | Python | unlicense | 2,481 |
# Copyright 2019 The Dreamer 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 applicabl... | google-research/dreamer | dreamer/control/dummy_env.py | Python | apache-2.0 | 1,560 |
from django.db import models
class Store(models.Model):
name = models.CharField(max_length=200, unique=True)
desc = models.TextField('description')
link = models.URLField()
slug = models.SlugField(max_length=200, unique=True)
status = models.BooleanField(default=True)
ishot = models.BooleanFiel... | leoliuabc/Colpon | br_colpon/models.py | Python | apache-2.0 | 1,170 |
#
# 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
# ... | Hybrid-Cloud/conveyor | conveyor/conveyorheat/engine/resources/aws/cfn/wait_condition_handle.py | Python | apache-2.0 | 2,385 |
import sys
from functions import *
word_counts = count_words(sys.stdin)
for word, count in word_counts.iteritems():
print '%s,%i' % (word, count)
| benjaminwilson/word2vec-norm-experiments | count_words.py | Python | apache-2.0 | 151 |
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | biosustain/memote | src/memote/support/consistency_helpers.py | Python | apache-2.0 | 11,239 |
class Solution:
def convertToTitle(self, n):
"""
:type n: int
:rtype: str
"""
ret = ''
while n / 26 > 1:
temp = n % 26
n = n // 26
print(n)
print(temp)
#考虑z的情况
if temp == 0:
temp =... | MingfeiPan/leetcode | math/168.py | Python | apache-2.0 | 448 |
#!/usr/bin/python
import json
import subprocess
import unicodedata
def execute(cmd):
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
p.wait()
return (p.stdout.readlines(), p.returncode)
def runcmd(cmd):
obj = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
... | rcbau/hacks | utils.py | Python | apache-2.0 | 933 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import urllib
import zlib
import zipfile
import math
import sys
from subprocess import *
import subprocess
# This script will:
# 1. Download the public database from the broad institute
# 2. Generate random vcf files thanks to the previous file thanks... | jpoullet2000/cgs-benchmarks | highlander-benchmarks/vcf_import.py | Python | apache-2.0 | 7,545 |
# 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 the... | wolverineav/horizon-bsn | horizon_bsn/content/connections/reachability_tests/tables.py | Python | apache-2.0 | 3,821 |
# coding=utf-8
from flask import g
from mongoengine.connection import get_db
from .model_document import ModelDocument, ModelQuerySet
################################################################################
__all__ = ('MultipleDatabaseModelDocument',)
#######################################################... | SlideAtlas/SlideAtlas-Server | slideatlas/models/common/multiple_database_model_document.py | Python | apache-2.0 | 5,469 |
# Copyright 2015-2016 Yelp 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... | Yelp/paasta | tests/api/test_client.py | Python | apache-2.0 | 1,486 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | OpenDaisy/daisy-api | daisy/search/api/v0_1/search.py | Python | apache-2.0 | 13,617 |
"""This exists only as a test harness for examining slightly non-trivial coverage output."""
import sys
from collections import defaultdict
def calculate_answer(a, b):
return a * b
def the_answer():
return calculate_answer(
6,
7,
)
| thought-machine/please | test/python_rules/python_coverage.py | Python | apache-2.0 | 265 |
#!/usr/bin/env python
from subprocess import Popen, PIPE
from sys import argv
__autor__ = "Jose Jiménez"
__email__ = "jjimenezlopez@gmail.com"
__date__ = "2012/05/03"
if len(argv) == 1 or len(argv) > 2:
print 'Wrong execution format.'
print 'Correct format: any2utf /path/to/the/files'
exit(0)
path = argv... | jjimenezlopez/pyutils | srt/any2utf.py | Python | apache-2.0 | 2,015 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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... | facebook/fbthrift | thrift/lib/py3/test/interactions/interaction_test.py | Python | apache-2.0 | 4,625 |
# Copyright 2017 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... | cshallue/models | research/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py | Python | apache-2.0 | 17,423 |
# -*- 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/campaign_asset_service.py | Python | apache-2.0 | 6,424 |
__author__ = 'Dzmitry'
def test_login(app):
app.session.login("administrator", "root")
assert app.session.is_logged_in_as("administrator") | duskat/python_training_mantis | test/test_login.py | Python | apache-2.0 | 147 |
# Copyright 2021 The Pigweed 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pigweed | pw_software_update/py/metadata_test.py | Python | apache-2.0 | 1,922 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import urlparse
from scrapy import log
from scrapy.http import Request
from base.base_wolf import Base_Wolf
class Wolf(Base_Wolf):
def __init__(self, *args, **kwargs):
super(Wolf, self).__init__(*args, **kwargs)
self.name = 'henbt'
... | pczhaoyun/wolf | wolf/spiders/wolves/henbt.py | Python | apache-2.0 | 1,085 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: toontown.battle.MovieSound
from panda3d.core import Camera, Point3, Vec3
from direct.interval.IntervalGlobal import *
from BattleBase import *
from BattleProps import *
from BattleSounds import *
import BattleParticles
from RewardPanel import *
import M... | DedMemez/ODS-August-2017 | battle/MovieSound.py | Python | apache-2.0 | 27,323 |
#
# 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... | dhuang/incubator-airflow | airflow/providers/amazon/aws/operators/ecs.py | Python | apache-2.0 | 17,123 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from elasticsearch import ConnectionError
import gc
import logging
import mock
from multiprocessing import Process, Queue
import os
import sys
from shellbot import Context, Engine
from shellbot.events import Message
from shellbot.updaters import Elasticsea... | bernard357/shellbot | tests/updaters/test_elastic.py | Python | apache-2.0 | 2,830 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2011 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you m... | sacharya/nova | nova/virt/firewall.py | Python | apache-2.0 | 21,771 |
# -*- coding: utf-8 -*-
from openerp import fields, models
class Partner(models.Model):
_inherit = 'res.partner'
# Le agrego una nueva columna al modelo res.partner, por defecto los partner
# no son instructores
instructor = fields.Boolean("Instructor", default=False)
session_ids = fields.Many2many('op... | colorisa/openacademy-proyect | openacademy/model/partner.py | Python | apache-2.0 | 392 |
# Copyright 2020 Google
#
# 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, soft... | quantumlib/ReCirq | recirq/quantum_chess/bit_utils.py | Python | apache-2.0 | 2,765 |
# -*- coding:utf-8 -*-
import os
import random
import sys
import importlib
importlib.reload(sys)
UNK_ID = 3
train_encode_file = 'data/middle_data/train.enc'
train_decode_file = 'data/middle_data/train.dec'
test_encode_file = 'data/middle_data/test.enc'
test_decode_file = 'data/middle_data/test.dec'
train_encode_vo... | xinruobingqing/robotChat | vector.py | Python | apache-2.0 | 1,599 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | kayhayen/Nuitka | nuitka/utils/StaticLibraries.py | Python | apache-2.0 | 5,115 |
def makeDrink | angusgbishop/biast | makeDrink.py | Python | apache-2.0 | 13 |
# Copyright (c) 2014 Rackspace, 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 wr... | Vaidyanath/tempest | tempest/api/messaging/test_claims.py | Python | apache-2.0 | 4,171 |
from django.contrib.auth.models import User
from django.conf import settings
from django.conf.urls.defaults import url
from django.shortcuts import get_object_or_404
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authorization import Authorization
from utils import DjangoAuthent... | bne/hortee | hortee/tracktor/api/resources.py | Python | apache-2.0 | 4,323 |
# Copyright (c) 2017 Huawei Technologies India Pvt.Limited.
# 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-... | huntxu/python-neutronclient | neutronclient/osc/v2/sfc/sfc_port_chain.py | Python | apache-2.0 | 14,745 |
from __future__ import unicode_literals
from django.apps import AppConfig
class DirtyDriveConfig(AppConfig):
name = 'DirtyDrive'
| Superchicken1/DirtyDrive | DirtyDrive/apps.py | Python | apache-2.0 | 136 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | tf3d/object_detection/box_utils/np_box_list_ops.py | Python | apache-2.0 | 21,691 |
#!/usr/bin/env python
import optparse
from os import system
class ReplicationData:
tableList = [{'database':'xgds_basalt',
'tables':[
'xgds_video_videosegment',
'xgds_video_videoepisode',
'xgds_core_constant',
... | xgds/xgds_basalt | apps/basaltApp/scripts/setReplicationFilters.py | Python | apache-2.0 | 4,119 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 João Pedro Rodrigues
#
# 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
#
# Unl... | JoaoRodrigues/pdb-tools | pdbtools/pdb_keepcoord.py | Python | apache-2.0 | 3,212 |
class dstat_plugin(dstat):
def __init__(self):
self.name = 'snooze'
self.vars = ('snooze',)
self.type = 's'
self.width = 6
self.scale = 0
self.before = time.time()
def extract(self):
now = time.time()
if loop != 0:
self.val['snooze'] =... | dongyoungy/dbseer_middleware | rs-sysmon2/plugins/dstat_snooze.py | Python | apache-2.0 | 737 |
# 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 u... | Huyuwei/tvm | tests/python/relay/test_vm.py | Python | apache-2.0 | 17,272 |
# 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, ... | tseaver/gcloud-python | firestore/tests/unit/gapic/v1beta1/test_firestore_client_v1beta1.py | Python | apache-2.0 | 20,576 |
"""A torture test to ferret out problems with multi-threading."""
import sys
import threading
from ndb import tasklets
from ndb import eventloop
def main():
##sys.stdout.write('_State.__bases__ = %r\n' % (eventloop._State.__bases__,))
num = 10
try:
num = int(sys.argv[1])
except Exception:
pass
thr... | bslatkin/8-bits | appengine-ndb/mttest.py | Python | apache-2.0 | 947 |
import unittest
from robot.errors import DataError
from robot.model import Keywords
from robot.running.userkeyword import (EmbeddedArgs, EmbeddedArgsTemplate,
UserKeywordHandler)
from robot.running.arguments import EmbeddedArguments, UserKeywordArgumentParser
from robot.utils.ass... | synsun/robotframework | utest/running/test_userhandlers.py | Python | apache-2.0 | 6,437 |
#-*- coding: utf-8 -*-
import utils
import signals
import config
import error
from CreateDialog import CreateDialog
from ui.Ui_CreateUdpClientForm import Ui_CreateUdpClientForm
from PyQt4 import QtGui
from PyQt4 import QtCore
class CreateUdpClientDialog(CreateDialog):
def __init__(self, parent=None):
Cre... | uname/PySockDebuger | form/CreateUdpClientDialog.py | Python | apache-2.0 | 2,370 |
import time # about 60 s
def countBinOnes(x):
cnt = 0
while x != 0:
cnt += 1
x &= x - 1
return cnt
def isSpecialSumSet(A):
N = ( 1 << len(A) ) - 1
subset = N * [None]
for i in range(1, N):
subset[i] = 0
for j in range(len(A)):
if (i >> j) & 1 == 1:
... | wandering007/ProjectEuler | src/103.py | Python | apache-2.0 | 1,733 |
# 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 the... | openstack/designate | api-ref/source/conf.py | Python | apache-2.0 | 6,722 |
#!/usr/bin/env python3
from functools import partial
import rospy
import sys
from lg_mirror.touch_router import TouchRouter
from lg_common.helpers import on_new_scene, load_director_message
from lg_msg_defs.msg import EvdevEvents, RoutedEvdevEvents, StringArray
from lg_common.helpers import handle_initial_state
from ... | EndPointCorp/lg_ros_nodes | lg_mirror/scripts/touch_router_node.py | Python | apache-2.0 | 1,992 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import (Task, Epic, Project)
admin.site.register(Task)
admin.site.register(Epic)
admin.site.register(Project)
| raghuraju/Simple-Project-Management | src/tasks/admin.py | Python | apache-2.0 | 223 |
'''
Download URA data.
Update log: (date / version / author : comments)
2020-06-10 / 1.0.0 / Du Jiang : Creation
'''
from com.djs.learn.ura import DownloadData
__data_type = 0
__base_file_name = "URA_CondoEcTrans_M"
argv = ["-d", __data_type]
DownloadData.main(argv)
'''
Or run:
python DownloadData.py -d 0
'''
if... | djsilenceboy/LearnTest | Python_Test/PyDataMiningSample/com/djs/learn/test/ura/TestDownloadTransactionData2.py | Python | apache-2.0 | 354 |
# coding: utf-8
#!/usr/bin/env python
from setuptools import setup, find_packages
readme = open('README.rst').read()
setup(
name='wecha',
version='${version}',
description='',
long_description=readme,
author='the5fire',
author_email='thefivefire@gmail.com',
url='http://chat.the5fire.com',... | the5fire/wechat | setup.py | Python | apache-2.0 | 542 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ursa_rest_sqlserver.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensu... | LowerSilesians/ursa-rest-sqlserver | ursa_rest_sqlserver/manage.py | Python | apache-2.0 | 817 |
from flyingpigeon.nc_utils import get_values, get_coordinates, get_index_lat, get_variable
from os.path import basename, join
from datetime import datetime as dt
from shutil import copyfile
from netCDF4 import Dataset
import numpy as np
import logging
LOGGER = logging.getLogger("PYWPS")
def fieldmean(resource):
... | bird-house/flyingpigeon | flyingpigeon/nc_statistic.py | Python | apache-2.0 | 10,385 |
from __future__ import unicode_literals
import uuid
from random import randint, random
from moto.core import BaseBackend
from moto.ec2 import ec2_backends
from copy import copy
class BaseObject(object):
def camelCase(self, key):
words = []
for i, word in enumerate(key.split('_')):
if ... | silveregg/moto | moto/ecs/models.py | Python | apache-2.0 | 23,919 |
# -*- coding: utf-8 -*-
def command():
return "stop-all-instance"
def init_argument(parser):
parser.add_argument("--farm-no", required=True)
def execute(requester, args):
farm_no = args.farm_no
parameters = {}
parameters["FarmNo"] = farm_no
return requester.execute("/StopAllInstance", param... | primecloud-controller-org/pcc-cli | src/pcc/api/instance/stop_all_instance.py | Python | apache-2.0 | 327 |
# Copyright 2018 Dgraph Labs, 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 writ... | dgraph-io/pydgraph | pydgraph/__init__.py | Python | apache-2.0 | 849 |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2020, Arm Limited and 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
#
# ... | ARM-software/lisa | lisa/tests/staging/utilclamp.py | Python | apache-2.0 | 14,119 |
import unittest
import numpy as np
from pypvcell.transfer_matrix_optics import TMLayers
class TMCase(unittest.TestCase):
def test_something(self):
layers = ['Air', 'SiO2_2', 'TiO2_2', 'GaAs_2']
thicknesses = [0, 170, 135, 300]
tm_layer = TMLayers(layers, thicknesses, wl_range=np.arange(40... | kanhua/pypvcell | tests/test_transfer_matrix.py | Python | apache-2.0 | 415 |
# Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This file is ... | awsdocs/aws-doc-sdk-examples | python/example_code/iot/thing_performance.py | Python | apache-2.0 | 5,845 |
from ruamel import yaml
import logging
import sys
from pandaserver.workflow.workflow_utils import get_node_id_map, dump_nodes, set_workflow_outputs, \
convert_nodes_to_workflow
from pandaserver.workflow.pcwl_utils import parse_workflow_file, resolve_nodes
logging.basicConfig(format='%(asctime)s - %(levelname)s - ... | PanDAWMS/panda-server | pandaserver/workflow/pcwl_test.py | Python | apache-2.0 | 5,846 |
# Copyright (c) 2011-2015 Rackspace US, 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... | samstav/simpl | simpl/incubator/rest.py | Python | apache-2.0 | 7,797 |
#!/usr/bin/env python
#
# Copyright 2007 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... | gauribhoite/personfinder | env/google_appengine/google/appengine/ext/db/__init__.py | Python | apache-2.0 | 124,459 |
#!/usr/bin/python
from setuptools import setup, find_packages
setup(
name="taskmaster",
license='Apache License 2.0',
version="0.5.2",
description="",
author="David Cramer",
author_email="dcramer@gmail.com",
url="https://github.com/dcramer/taskmaster",
packages=find_packages("src"),
... | alex/taskmaster | setup.py | Python | apache-2.0 | 977 |
import ovlib
from ovlib.eventslib import event_waiter, EventsCode
mac_pool = context.macpools.get("Default")
try:
dc = context.datacenters.get(host_name)
except ovlib.OVLibErrorNotFound:
dc = context.datacenters.add(data_center={'name': host_name, 'local': True, 'storage_format': 'V4', 'mac_pool': mac_pool})
... | fbacchella/ovirtcmd | samples/single_node_cluster.py | Python | apache-2.0 | 3,574 |
import requests
import json
ip = '127.0.0.1'
port = 80
payload = {'key1': 'value1', 'key2': {'key2_1': 'value2_1', 'key2_2': 'value2_2'}}
req_url = 'http://' + str(ip) + ':' + str(port) + '/v1/recovery/start'
headers = {'Content-type': 'application/json'}
req = requests.post(req_url, data=json.dumps(payload), headers... | fs714/drcontroller | drcontroller/test/recovery_url_test.py | Python | apache-2.0 | 345 |
# Copyright 2017 ETH Zurich
#
# 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... | FR4NK-W/osourced-scion | python/lib/rev_cache.py | Python | apache-2.0 | 5,118 |
import os.path as op
import logging
import shutil
from subprocess import check_output
from tempfile import mkdtemp
import click
from ob_pipelines.s3 import (
s3, download_file_or_folder, remove_file_or_folder, SCRATCH_DIR, path_to_bucket_and_key
)
logger = logging.getLogger('ob-pipelines')
@click.command()
@cl... | outlierbio/ob-pipelines | ob_pipelines/apps/fastqc/fastqc.py | Python | apache-2.0 | 1,841 |
# -*- coding: utf-8 -*-
import codecs
all_tables = {
'ktgg': ['main'],
'zgcpwsw': ['title', 'casecode'],
#
# # 'ktgg',
# # 'cdfy_sfgk',
# # 'newktgg',
# # 'zyktgg',
# # 'zgcpwsw',
# # 'itslaw',
# # 'qyxg_zgcpwsw',
# # 'qyxg_wscpws',
#
'zhixing': ['pname', 'case_co... | mefly2012/platform | test/test.py | Python | apache-2.0 | 3,173 |
import struct
from ryu.lib.pack_utils import msg_pack_into
from ryu.lib import type_desc
# enum ofp_oxs_class
OFPXSC_OPENFLOW_BASIC = 0x8002 # Basic stats class for OpenFlow
OFPXSC_EXPERIMENTER = 0xFFFF # Experimenter class
# enum oxs_ofb_stat_fields
OFPXST_OFB_DURATION = 0 # Time flow entry has been alive.
OFPX... | jalilm/ryu | ryu/ofproto/oxs_fields.py | Python | apache-2.0 | 8,706 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# quorra documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... | bprinty/quorra | docs/conf.py | Python | apache-2.0 | 8,593 |
# Copyright 2018 PerfKitBenchmarker 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... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/data/edw/spectrum/provider_specific_script_driver.py | Python | apache-2.0 | 1,798 |
'''This is the main zarkov event server. It uses gevent for a fast event loop in
a single thread. It should typically be invoked with the zarkov-server script.'''
import sys
import time
import logging
from datetime import datetime, timedelta
import bson
import gevent
from gevent_zeromq import zmq
from zarkov import... | joeywen/zarkov | zarkov/server.py | Python | apache-2.0 | 4,751 |