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 |
|---|---|---|---|---|---|
import os
def parse_distributions_h(ffi, inc_dir):
"""
Parse distributions.h located in inc_dir for CFFI, filling in the ffi.cdef
Read the function declarations without the "#define ..." macros that will
be filled in when loading the library.
"""
with open(os.path.join(inc_dir, 'random', 'bi... | WarrenWeckesser/numpy | numpy/random/_examples/cffi/parse.py | Python | bsd-3-clause | 1,515 |
#!/usr/bin/env python
"""
fasta_average_length.py
Author: Tony Papenfuss
Date: Wed Mar 26 15:03:28 EST 2008
"""
import sys
from mungo.fasta import FastaFile
from optparse import OptionParser
usage = "%prog <Input file1> [<Input file2> ...]"
parser = OptionParser(usage=usage, version="%prog - Version 1")
options, ar... | PapenfussLab/Mungo | bin/fasta_average_length.py | Python | artistic-2.0 | 579 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
import re
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
log = logging.getLogger('twitterfeed')
# Size of the ... | gazpachoking/Flexget | flexget/plugins/input/twitterfeed.py | Python | mit | 5,716 |
"""
Expand image metadata
"""
log = None
from imex.config import ConfigManager
from imex.rules import RuleManager
from imex.metadataeditor import MetadataEditor
from imex.logger import SimpleScreenLogger
from imex.metadata import ImageMetadata, Tag
| jdevera/imex | src/imex/__init__.py | Python | mit | 252 |
# Copyright 2016 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/grumpy | testing/complex_test.py | Python | apache-2.0 | 3,248 |
import sys
import socket
from socket import AF_INET, SOCK_STREAM
def make_ip(lan_ip, end_part):
lan_parts = lan_ip.split(".")
parts = lan_parts[: 3] + [end_part]
return ".".join(parts)
def scan_miftp_ip(lan_ip, timeout):
ftp_ips = []
ip_parts = lan_ip.split(".")
for i in range(0, 256):
... | shishusaiwai/miftpclient | miftpclient/scan.py | Python | gpl-3.0 | 799 |
#
# Copyright 2015 Simulmedia, 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... | Simulmedia/pyembedpg | pyembedpg.py | Python | apache-2.0 | 10,244 |
import smtplib
from email.message import EmailMessage
from django.conf import settings
from django.core.mail import send_mail
def send_email(subject, message_body, from_email, to_emails):
'''
Create an email message using pythons smtplib and EmailMessage.
It returns a dictionary, with one entry for each r... | DevMattM/qipr_approver | qipr_approver/approver/utilities/send_email.py | Python | apache-2.0 | 2,211 |
"""winsdk
Tool-specific initialization for Microsoft Windows SDK.
"""
#
# Copyright (c) 2001-2007 The SCons Foundation
# Copyright (c) 2008 Tungsten Graphics, Inc.
# Copyright (c) 2009 VMware, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated docu... | ayoubg/gem5-graphics | Mesa-7.11.2_GPGPU-Sim/scons/winsdk.py | Python | bsd-3-clause | 4,139 |
#!/usr/bin/python
import time
from Adafruit_I2C import Adafruit_I2C
# ===========================================================================
# VCNL4000 Class
# ===========================================================================
# Address of the sensor
VCNL4000_ADDRESS = 0x13
# Commands
VCNL4000_COMMAND... | platenspeler/LamPI-2.0 | rrd/Adafruit-Raspberry-Pi-Python-Code/Adafruit_VCNL4000/Adafruit_VCNL4000.py | Python | gpl-3.0 | 1,302 |
# 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 use ... | apache/libcloud | libcloud/common/providers.py | Python | apache-2.0 | 4,027 |
import RPi.GPIO as GPIO #Importamos la libreria RPi.GPIO
import time #Importamos libreria para el control de tiempos
import numpy as np
GPIO.setmode(GPIO.BOARD) #Ponemos la Raspberry en modo BOARD
GPIO.setup(32,GPIO.OUT) #Ponemos el pin 12 como salida
p = GPIO.PWM(32,50) #Ponemos el pin 1... | UavLabsColombia/pibotballs | src/TestingFiles/ServoAdelante.py | Python | gpl-3.0 | 831 |
from enum import Enum, IntEnum, unique
class OperandType(IntEnum):
All = 0
Integer = 1
Float = 2
class TrigUnit(IntEnum):
Radians = 0
Degrees = 1
Gradients = 2
class Feature(IntEnum):
Symbolic = 1
StringConversion = 2
Rational = 4
class NotEnoughOperandsException(Exception):
... | lainwir3d/sailfish-rpn-calculator | common/python/rpncalc_common.py | Python | gpl-2.0 | 1,855 |
"""
define class Gene
"""
# from random import randint
from autoprover.evaluation import evaluation
# import logging
def random_chromosome(tactics):
"""generate a random chromosome with length of 15.
Args:
tactics (Tactic): a Tactic class instance.
Returns:
list: chromosome, a list of str... | elic-eon/autoprover | autoprover/gp/gene.py | Python | mit | 6,711 |
# -*- 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 o... | sasha-gitg/python-aiplatform | tests/unit/aiplatform/test_models.py | Python | apache-2.0 | 57,744 |
# Copyright 2017 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... | mahak/neutron | neutron/conf/agent/ovsdb_api.py | Python | apache-2.0 | 1,972 |
from server import db
class File(db.Model):
__tablename__ = 'files'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
identifier = db.Column(db.String, unique=True)
filename = db.Column(db.String)
total_size = db.Column(db.Integer)
file_type = db.Column(db.String)
readset = ... | sickkids-ccm/dcc-file-transfer | server/models.py | Python | mit | 3,264 |
#!/usr/bin/env python
# How to build source distribution
# - python setup.py sdist --format bztar
# - python setup.py sdist --format gztar
# - python setup.py sdist --format zip
# - python setup.py bdist_wheel
import os
import sys
from setuptools import setup, find_packages
MAJOR = 0
MINOR = 8
MICRO = 1
V... | pgxcentre/geneparse | setup.py | Python | mit | 2,687 |
# vim:ts=4:sw=4:expandtab
'''Example of event firing.
'''
import time
import random
from diesel import (quickstart, quickstop, sleep,
fire, wait, log, loglevels,
set_log_level)
set_log_level(loglevels.DEBUG)
def gunner():
x = 1
while True:
fire('bam', x)
... | dieseldev/diesel | examples/fire.py | Python | bsd-3-clause | 716 |
import random
import sys
sys.path.append("..") #so other modules can be found in parent dir
from Player import *
from Constants import *
from Construction import CONSTR_STATS
from Ant import UNIT_STATS
from Move import Move
from GameState import *
from AIPlayerUtils import *
##
#AIPlayer
#Description: The responsbili... | sundercode/AI-Homework | AI_done/linds17_sunderla17.py | Python | mit | 11,039 |
#!/usr/bin/python2
import re
import sys
part2 = len(sys.argv) > 1 and sys.argv[1] == '2'
f = open('./input16.txt', 'r')
aunt = []
truth = {
'children': 3,
'cats': 7,
'samoyeds': 2,
'pomeranians': 3,
'akitas': 0,
'vizslas': 0,
'goldfish': 5,
'trees': 3,
'cars': 2,
'perfumes': 1,... | thiagorcdl/AdventOfCode | 2015/adv16.py | Python | gpl-3.0 | 949 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
#
# 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... | spotify/vdisk | vdisk/actions/enter.py | Python | apache-2.0 | 983 |
# 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/.
"""This routine controls which localizable files and entries are
reported and l10n-merged.
This needs to stay in sync wi... | Yukarumya/Yukarum-Redfoxes | mobile/android/locales/filter.py | Python | mpl-2.0 | 1,714 |
import numpy as np
import os
print("--> Loading parameters...")
global par
"""
Independent parameters
"""
par = {
# Setup parameters
'save_dir' : './save_dir/',
'data_dir' : './data_dir/',
'data_filenames' : ['data_even.mat', 'data_odd.mat'],
'debug_model' ... | nmasse/Feed-forward-network | parameters.py | Python | apache-2.0 | 1,088 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_pgjson.fields
class Migration(migrations.Migration):
dependencies = [
('projects', '0010_project_modules_config'),
]
operations = [
migrations.CreateModel(
... | CoolCloud/taiga-back | taiga/projects/migrations/0011_auto_20141028_2057.py | Python | agpl-3.0 | 1,109 |
#!/usr/bin/env python
from database.sqconfig import TUB_Base, TB15_Base, TB16_Base
from sqlalchemy import Column, Integer, Sequence, String, DateTime
class Tuberculose(TUB_Base):
__tablename__ = 'tuberculose'
__table_args__ = {'sqlite_autoincrement': True}
id = Column('id', Integer, Sequence('id_seq'), p... | ricardobergamo/dataGAL | models/tuberculose.py | Python | gpl-3.0 | 14,293 |
#!/usr/bin/env python
# coding=utf-8
"""659. Largest prime
https://projecteuler.net/problem=659
Consider the sequence $n^2+3$ with $n \ge 1$.
If we write down the first terms of this sequence we get:
$4, 7, 12, 19, 28, 39, 52, 67, 84, 103, 124, 147, 172, 199, 228, 259, 292,
327, 364,$... .
We see that the terms... | openqt/algorithms | projecteuler/pe659-largest-prime.py | Python | gpl-3.0 | 651 |
import cloudbridge.cloud.providers.azure.test.helpers as helpers
from cloudbridge.cloud.providers.azure.test.helpers import ProviderTestBase
class AzureKeyPairServiceTestCase(ProviderTestBase):
@helpers.skipIfNoService(['security.key_pairs'])
def test_azure_keypair_create(self):
key_pair_create = self... | ms-azure-cloudbroker/cloudbridge | cloudbridge/cloud/providers/azure/test/test_azure_key_pair_service.py | Python | mit | 2,201 |
import paddle.v2 as paddle
import paddle.v2.framework.layers as layers
import paddle.v2.framework.core as core
import paddle.v2.framework.optimizer as optimizer
from paddle.v2.framework.framework import Program
from paddle.v2.framework.executor import Executor
from paddle.v2.framework.regularizer import L2DecayRegular... | pengli09/Paddle | python/paddle/v2/framework/tests/test_recognize_digits_mlp.py | Python | apache-2.0 | 2,803 |
"""
Project Euler - Problem 6
Copyright (C) 2014 Thomas Vanesse
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
(at your option) any later version.
This program ... | tvanesse/projectEuler | p6.py | Python | gpl-2.0 | 1,413 |
# 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... | dmlc/tvm | python/tvm/topi/vision/ssd/multibox.py | Python | apache-2.0 | 10,269 |
# encoding: utf-8
"""
routerid.py
Created by Thomas Mangin on 2012-07-17.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.protocol.ip import IPv4
# ===================================================================== RouterID
#
class RouterID (IPv4):
@classmethod
def unpack (cls,data):... | lochiiconnectivity/exabgp | lib/exabgp/bgp/message/open/routerid.py | Python | bsd-3-clause | 376 |
import pandas
import numpy
import itertools
import sklearn
import sklearn.tree
import sklearn.svm
from sklearn.ensemble import AdaBoostClassifier
from sklearn.cluster import KMeans
import sklearn.multiclass
import sklearn.metrics
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
start = pandas.T... | BigDataAnalytics2017/ProjectOTA | ClassificationAdaBoostClassifier.py | Python | gpl-3.0 | 6,814 |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 2 16:24:01 2019
@author: Rignak
"""
from urllib import request
from datetime import datetime
from lib.TWRV import ThreadWithReturnValue
from sys import stdout
from PIL import Image
import json
import os
from os.path import join, split, exists
import numpy as np
import re... | Rignak/Scripts-Python | Danbooru/NotDan/lib/Show.py | Python | gpl-3.0 | 7,228 |
# Stub for pre django 1.7 apps.
# ⁻*- coding: utf-8 -*-
from django.db import models
from django.conf import settings
from django.contrib.sessions.models import Session
from .utils import (get_cas_client, get_service_url)
class ProxyError(ValueError):
pass
class ProxyGrantingTicket(models.Model):
class Meta... | IRI-Research/django-cas-ng | django_cas_ng/models.py | Python | mit | 1,863 |
# obsolete.py - obsolete markers handling
#
# Copyright 2012 Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Logilab SA <contact@logilab.fr>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""Obsolete ma... | hekra01/mercurial | mercurial/obsolete.py | Python | gpl-2.0 | 44,237 |
from buildbot import steps
from proteibb.core.builder.step import Step
class ProcessSources(Step):
def __init__(self, project, file_filter):
# Find all files for compilation step.
# Make directories.
# Use different steps?
self._project = project
def setup(self, work_dir, *ar... | simonenkos/proteibb | proteibb/core/builder/steps/process_sources.py | Python | gpl-2.0 | 416 |
#!/usr/bin/env python
# Copyright(c)2012-2013 Internet Archive. Software license AGPL version 3.
#
# This file is part of the `surt` python package.
#
# surt is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Soft... | internetarchive/surt | surt/surt.py | Python | agpl-3.0 | 3,121 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/magic/basics/skyregion.py | Python | mit | 9,929 |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'lbattachment',
'lbattachment.tests',
),
DATABASES={
"default": {
... | vicalloy/django-lbattachment | translations.py | Python | mit | 1,166 |
#! /usr/bin/env python
"""!
-----------------------------------------------------------------------------
File Name : utilities.py
Purpose:
Created: 08-Dec-2015 05:14:14 AEDT
-----------------------------------------------------------------------------
Revision History
---------------------------------------------... | benjohnston24/partyCoin-interface | funds_tracker/utilities.py | Python | mpl-2.0 | 3,696 |
#!/usr/bin/env python
"""Extend an existing chain of nucleotides."""
# Copyright 2012 Kevin Keating
#
# Licensed under the Educational Community 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.o... | jlec/coot | rcrane/extendChain.py | Python | gpl-3.0 | 14,026 |
import datapointbasic.searchtools
import datapointbasic.forecast
from datapointbasic.tools import ApiManager
def placesearch(api_key=None):
"""
Function placesearch creates a new instance of the datapointbasic
LocationSearch class, and returns it. The methods of the LocationSearch can
then be u... | PaleTomato/datapoint-basic | datapointbasic/__init__.py | Python | gpl-3.0 | 1,351 |
#
# 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 ... | protochron/aurora | src/test/python/apache/aurora/client/cli/test_client.py | Python | apache-2.0 | 1,206 |
#coding: utf-8
"""
@Author: Well
@Date: 2014 - 05 - 04
"""
# quick_sort
# 1. 从数列中挑出一个元素,称为 "基准"(pivot),
# 2. 重新排序数列,所有元素比基准值小的摆放在基准前面,所有元素比基准值大的摆在基准的后面(相同的数可以到任一边)。
# 在这个分区退出之后,该基准就处于数列的中间位置。这个称为分区(partition)操作。
# 3. 递归地(recursive)把小于基准值元素的子数列和大于基准值元素的子数列排序.
import sys
import random
lenth = 30
def qsort(arr,left... | neiltest/neil_learn_python | src/learn_python/python_other/neil_18_quick_sort.py | Python | mit | 1,262 |
#-*- coding: utf-8 -*-
#
# Krzysztof „krzykwas” Kwaśniewski
# Gdańsk, 18-07-2012
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | krzykwas/rhqagent | pyagent/settings/configurationFile/Generator.py | Python | gpl-3.0 | 11,200 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/image_classification/cars196_test.py | Python | apache-2.0 | 1,050 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-7 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | scwhitehouse/rose | lib/python/rose/config_editor/valuewidget/combobox.py | Python | gpl-3.0 | 3,038 |
import os
import uuid
DEBUG = False
TESTING = False
SECRET_KEY = str(uuid.uuid4())
USERNAME = str(uuid.uuid4())
PASSWORD = str(uuid.uuid4())
NAME = 'datapusher'
# Webserver host and port
HOST = os.environ.get('DATAPUSHER_HOST', '0.0.0.0')
PORT = os.environ.get('DATAPUSHER_PORT', 8800)
# Database
SQLALCHEMY_DATABA... | ckan/datapusher | deployment/datapusher_settings.py | Python | agpl-3.0 | 876 |
import numpy as np
from track_utils.cell_container import _distance_diff, _totalintensity_difference
from track_utils.cell_calculation import calc_cell_distance, calc_cell_massdiff
try:
from covertrack.cell import CellListMaker
from covertrack.utils.imreg import translation
from covertrack.utils.seg_utils i... | braysia/covertrack | covertrack/tracking/tracking_operations.py | Python | mit | 15,292 |
"""
Tests for dit.multivariate.secret_key_agreement.skar_lower_bounds
"""
import pytest
from dit.example_dists.intrinsic import *
from dit.multivariate import necessary_intrinsic_mutual_information
@pytest.mark.flaky(reruns=5)
@pytest.mark.parametrize('dist', [intrinsic_1, intrinsic_2, intrinsic_3])
def test_nimi_1... | dit/dit | tests/multivariate/secret_key_agreement/test_necessary_intrinsic_mutual_information.py | Python | bsd-3-clause | 531 |
# -*- coding: utf-8 -*-
"""Generic Unit tests for the GDAL provider.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
... | lbartoletti/QGIS | tests/src/python/test_provider_gdal.py | Python | gpl-2.0 | 4,428 |
import logging
from logging import FileHandler, Formatter
from flask import Flask, request
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_wtf.csrf import CSRFProtect
from flask_mail import Mail
from flask_login import LoginManager
from flask_babel import Babel
from buttersalt_saltapi i... | lfzyx/ButterSalt | buttersalt/__init__.py | Python | mit | 1,915 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
i18n_dict = {
'ko': {
'youmustlogin': '로그인을 해야 합니다',
'invalidemail': '잘못된 이메일 주소입니다.',
'invalidusername': '잘못된 사용자명입니다. 사용자명은 최소 4글자여야 합니다.',
'invalidpassword': '잘못된 비밀번호입니다. 비밀번호는 최소 8글자여야 합니다.',
'passwordmismatch': '두 비밀번호가 일치하... | imgtl/imgtl | imgtl/i18n.py | Python | mit | 1,878 |
from setuptools import setup, find_packages
from swift_setup import __version__ as version
from shutil import copytree, move, rmtree
import os
name = "swift-setup"
install_requires = []
try:
import fabric
except ImportError:
install_requires.append("fabric")
data_files = [('/etc/swift-setup', ['etc/swift-set... | btorch/swift-setup | setup.py | Python | apache-2.0 | 1,605 |
from gettext import gettext as _
from pulp.client.commands.repo import cudl, sync_publish, status
from pulp.client.extensions.decorator import priority
from pulp_openstack.common import constants
from pulp_openstack.extensions.admin.cudl import CreateOpenstackRepositoryCommand
from pulp_openstack.extensions.admin.ima... | pulp/pulp_openstack | extensions_admin/pulp_openstack/extensions/admin/pulp_cli.py | Python | gpl-2.0 | 4,537 |
import gevent
import random
import string
from powerpool.clients import StratumClients
import logging
logging.getLogger().addHandler(logging.StreamHandler())
SEED_CLIENTS = 1000
client_id = 0
def rand_str(N):
return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(N))
class DummyC... | simplecrypto/powerpool | bench/share_fuzzer.py | Python | bsd-2-clause | 2,215 |
"""
* Copyright 2008 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 or agreed to in writing, s... | andreyvit/pyjamas | library/pyjamas/Canvas/ImageLoader.py | Python | apache-2.0 | 4,113 |
from rest_framework import renderers
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.six.moves import StringIO
from django.utils.encoding import smart_text
from rest_framework.compat import six
from rest_framework import negotiation
import json
"""
@author: Jon Nordling
@date: 06/19/2016
XFor... | Cadasta/cadasta-geoodk | xforms/renderers.py | Python | agpl-3.0 | 2,727 |
import pytest
import base64
import functools
from unittest import mock
from tests.utils import async
from waterbutler.core import streams
class TestBase64Stream:
@async
def test_doesnt_crash_with_none(self):
stream = streams.Base64EncodeStream(streams.StringStream(b''))
data = yield from st... | icereval/waterbutler | tests/core/streams/test_base64encodestream.py | Python | apache-2.0 | 1,443 |
# -*- coding: utf-8 -*-
"""
Copyright 2013 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 o... | bladebo/1flow | oneflow/settings/snippets/000_nobother.py | Python | agpl-3.0 | 1,544 |
from threading import local
try:
from django.utils.module_loading import import_string as import_func
except ImportError:
from django.utils.module_loading import import_by_path as import_func
from .settings import DATA_BACKEND, DATA_BACKEND_PARAMS
_THREAD_LOCAL = local()
_THREAD_ATTR_LOGGERS = 'logexpose_lo... | idlesign/django-logexpose | logexpose/utils.py | Python | bsd-3-clause | 1,331 |
#!/usr/bin/env 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 requir... | googleads/googleads-python-lib | examples/ad_manager/v202108/report_service/run_inventory_report.py | Python | apache-2.0 | 2,232 |
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.gis.geos import fromstr
from django.utils.translation import ugettext as _
from django.utils.translation import ungettext, string_concat
from shoppleyuser.utils import sms_notify, pretty_date, ... | kwantopia/shoppley-migrate | shoppley.com/shoppley/apps/offer/models.py | Python | mit | 16,256 |
import unittest
from netengine.backends.ssh import OpenWRT
from ..settings import settings
__all__ = ['TestSSHOpenWRT']
class TestSSHOpenWRT(unittest.TestCase):
def setUp(self):
self.host = settings['openwrt-ssh']['host']
self.username = settings['openwrt-ssh']['username']
self.pa... | ninuxorg/netengine | tests/ssh/openwrt.py | Python | mit | 1,774 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Provides a variety of device interactions based on adb.
Eventually, this will be based on adb_wrapper.
"""
# pylint: disable=unused-argument
import cale... | catapult-project/catapult-csm | devil/devil/android/device_utils.py | Python | bsd-3-clause | 103,314 |
# -*- test-case-name: go.apps.jsbox.tests.test_log -*-
# -*- coding: utf-8 -*-
import logging
import datetime
from twisted.internet.defer import inlineCallbacks, returnValue
from vxsandbox import LoggingResource
from vumi import log
from vumi.persist.redis_base import Manager
from vumi.persist.txredis_manager impor... | praekelt/vumi-go | go/apps/jsbox/log.py | Python | bsd-3-clause | 3,171 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
gateway tests - Users
Copyright 2009-2015 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
pytest fixtures used as defined in conftest.py:
- gatewaywrapper
"""
import omero
import pytest
from omero.... | dominikl/openmicroscopy | components/tools/OmeroPy/test/integration/gatewaytest/test_user.py | Python | gpl-2.0 | 8,119 |
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path
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('.'))
def test_field_listing():
lyr = mapnik.Layer('tes... | h4ck3rm1k3/MapNickAutotools | tests/python_tests/datasource_test.py | Python | lgpl-2.1 | 1,512 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... | Micronaet/micronaet-quality | quality_export_report/wizard/export_document.py | Python | agpl-3.0 | 14,444 |
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
from amaascore.tools.generate_party import generate_address, generate_email
class PartyChildrenTest(unittest.TestCase):
def setUp(self):
self.longMessage = True # Print complete error message on failure
... | amaas-fintech/amaas-core-sdk-python | tests/unit/parties/children.py | Python | apache-2.0 | 763 |
# Copyright (c) Amber Brown, 2015
# See LICENSE for details.
from __future__ import absolute_import, division
from textwrap import dedent
import pkg_resources
from twisted.trial.unittest import TestCase
from collections import OrderedDict
from .._builder import render_fragments, split_fragments
class FormatterT... | hawkowl/towncrier | src/towncrier/test/test_format.py | Python | mit | 10,155 |
##########################################################################
#
# Copyright (c) 2019, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | appleseedhq/cortex | test/IECoreScene/MeshAlgoNormalsTest.py | Python | bsd-3-clause | 4,040 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Rastislav Szabo <raszabo@cisco.com>, Lukas Macko <lmacko@cisco.com>"
__copyright__ = "Copyright 2016, Cisco Systems, Inc."
__license__ = "Apache 2.0"
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | morganzhh/sysrepo | swig/python3/tests/SchemasManagementTest.py | Python | apache-2.0 | 7,156 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://wwoods.github.io/2016/06/09/easy-sphinx-documentation-without-the-boilerplate/
# was immensely helpful *and should be the fucking out-of-the-box default experience* when
# turning on autodoc and autosummary
# http://sphinxcontrib-napoleon.readthedocs.io/en/late... | willdeberry/bjarkan | sphinx/conf.py | Python | bsd-3-clause | 2,104 |
import os
import sys
from datetime import datetime
from unittest import TestCase
import tests
import settings
from files import files
import pyunrar
from analyzer.show import ShowAnalyzer
from analyzer.movie import MovieAnalyzer
from models import directory
class ExtractCleanName(TestCase):
def setUp(self):
... | joelbitar/rfinder | tests/extract_clean_name.py | Python | lgpl-3.0 | 3,011 |
"""Config flow for DialogFlow."""
from homeassistant.helpers import config_entry_flow
from .const import DOMAIN
config_entry_flow.register_webhook_flow(
DOMAIN,
"Dialogflow Webhook",
{
"dialogflow_url": "https://dialogflow.com/docs/fulfillment#webhook",
"docs_url": "https://www.home-assist... | fbradyirl/home-assistant | homeassistant/components/dialogflow/config_flow.py | Python | apache-2.0 | 361 |
# Exercise
#
# Improve "Word Jumble" so that each word is paired with a hint. The player should be able to see the hint if he or
# she is stuck. The player should be able to see the hint if he or she is stuck. Add scoring system that rewards
# players who solve a jumble without asking for the hint.
#
# Word Jumble
#
#... | dmartinezgarcia/Python-Programming | Chapter 4 - For loops, strings and tuples/exercise_3.py | Python | gpl-2.0 | 1,932 |
"""Module to help with parsing and generating configuration files."""
from collections import OrderedDict
# pylint: disable=no-name-in-module
from distutils.version import LooseVersion # pylint: disable=import-error
import logging
import os
import re
import shutil
from typing import Any, Tuple, Optional, Dict, Union,... | Cinntax/home-assistant | homeassistant/config.py | Python | apache-2.0 | 28,081 |
# 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, ... | google-research/torchsde | diagnostics/inspection.py | Python | apache-2.0 | 4,759 |
from django.conf.urls import patterns, url
from quenta.storybook import views
urlpatterns = patterns('',
url(r'^(?P<story_id>\d+/)', views.story, name='story'),#+ parametar
url(r'^(?P<story_id>\d+/html/)', views.story_html, name='story_html'),#+ parametar
url(r'^$', views.stories_list, name='stories_list'... | metakermit/quenta | quenta/storybook/urls.py | Python | agpl-3.0 | 325 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Provides an HTML cleaner function with sqalchemy compatible API"""
from HTMLParser import HTMLParser
import bleach
# Set up custom tags/attributes for bleach
BLEACH_TAGS = [
'caption', 'strong', '... | edofic/ggrc-core | src/ggrc/utils/html_cleaner.py | Python | apache-2.0 | 1,534 |
# Copyright (c) 2004-2007 Divmod.
# See LICENSE for details.
"""
Tests for L{nevow.json}.
"""
from zope.interface import implements
from nevow.inevow import IAthenaTransportable
from nevow import json, rend, page, loaders, tags, athena, testutil
from twisted.trial import unittest
TEST_OBJECTS = [
0,
None,
... | UstadMobile/exelearning-ustadmobile-work | nevow/test/test_json.py | Python | gpl-2.0 | 9,209 |
# Copyright 2020 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/protocols/act_on_protocol.py | Python | apache-2.0 | 6,823 |
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
def reload_page(self):
self.driver.refresh()
def print_el(self, element):
print 'tag: ' + e... | fergalmoran/dss | spa/tests/dom_helper.py | Python | bsd-2-clause | 8,159 |
# -*- coding: utf-8 -*-
from openerp.osv import fields, orm
import sys
class DummyModel(orm.Model):
# expect "no access rules" error
_name = 'dummy.model'
_columns = {
'name': fields.char('Dummy', size=100),
}
# printout non-ASCII text to check unicode issues
# (from Monty Python's "Italian... | MeetSCS/test_repo_2 | tests/test_repo/test_module/dummy_model.py | Python | agpl-3.0 | 476 |
#!/usr/bin/env python
#############################################################################
#
# Copyright (C) 2015 The Qt Company Ltd.
# Contact: http://www.qt.io/licensing/
#
# This file is part of the QtWebEngine module of the Qt Toolkit.
#
# $QT_BEGIN_LICENSE:LGPL$
# Commercial License Usage
# Licensees hol... | Tofee/qtwebengine | tools/scripts/init-repository.py | Python | gpl-2.0 | 6,221 |
"""
Based on initial work from django-debug-toolbar
"""
import re
from datetime import datetime
try:
from django.db import connections
except ImportError:
# Django version < 1.2
from django.db import connection
connections = {'default': connection}
try:
from django.db.backends import utils # rena... | chriscauley/django-devserver | devserver/modules/sql.py | Python | bsd-3-clause | 5,470 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 University of Dundee & Open Microscopy Environment
# 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 published by
# the Free Software Foundation; ... | snoopycrimecop/snoopycrimecop | test/unit/test_gitrepository.py | Python | gpl-2.0 | 4,349 |
import json
class InfrastructureUpgradeLevel(object):
name = ''
upgrade_cost = 0
no_of_turns_required = 0
transaction_benefit = 0
def __init__(
self,
name='',
upgrade_cost=0,
no_of_turns_required=0,
transaction_benefit=0
):
self.name = name
... | travisby/kronos2 | hermes_api/base/infrastructure_upgrade_level.py | Python | bsd-2-clause | 1,143 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | JoepDriesen/Rikker | authentication/migrations/0001_initial.py | Python | gpl-2.0 | 2,775 |
# -*- coding: utf-8 -*-
# Scrapy settings for crawler project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest... | ryerh/py-crawler | crawler/settings.py | Python | apache-2.0 | 3,200 |
import imp
import os
from DIRAC import gConfig, gLogger
from DIRAC.Core.Utilities.CFG import CFG
from DIRAC.ConfigurationSystem.Client.Helpers import CSGlobals
BASECS = "WebApp"
def loadWebAppCFGFiles():
"""
Load WebApp/web.cfg definitions
"""
exts = []
for ext in CSGlobals.getCSExtensions():
if ext ==... | zmathe/WebAppDIRAC | Core/ConfMgr.py | Python | gpl-3.0 | 2,674 |
import sys
import argparse
def parseArgument():
# Parse the input
parser=argparse.ArgumentParser(description=\
"Make a script that will convert bedgraph to bigwig files")
parser.add_argument("--fileNamePrefixList", required=True,\
help='Name of file with a list of bedgraph file prefixes that will also be used... | imk1/IMKTFBindingCode | makebedGraphToBigWigScript.py | Python | mit | 2,695 |
#!/usr/bin/env python
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
import socketio
import time
from bridge import Bridge
from conf import conf
sio = socketio.Server(async_mode='gevent')
msgs = []
dbw_enable = False
@sio.on('connect')
def connect(sid, environ):
print("connect ... | vsingla2/Self-Driving-Car-NanoDegree-Udacity | Term3-Path-Planning-Concentrations-and-Systems/Project3-System-Integration-Capstone/ros/src/styx/server.py | Python | mit | 1,277 |
# Copyright (C) 2009 Stijn Cole
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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 require... | rwl/PyDyn | pydyn/Test1.py | Python | apache-2.0 | 4,002 |
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from unittest import mock
from odoo.exceptions import UserError
from odoo.tests.common import TransactionCase
model = "odoo.addons.base_report_to_printer.models.printing_server"
class StopTest(Exception):
pass
... | OCA/report-print-send | base_report_to_printer/tests/test_printing_printer_wizard.py | Python | agpl-3.0 | 3,391 |
#! /usr/bin/env python
# encoding: utf-8
import io
from setuptools import setup, find_packages
NAME = "AnyQt"
VERSION = "0.1.0"
AUTHOR = "Aleš Erjavec"
AUTHOR_EMAIL = "ales.erjavec@fri.uni-lj.si"
URL = "https://github.com/ales-erjavec/anyqt"
PACKAGES = find_packages(".", include="AnyQt*")
DESCRIPTION = "PyQt5/PyQt6 ... | ales-erjavec/anyqt | setup.py | Python | gpl-3.0 | 1,397 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | Thraxis/SickRage | sickbeard/providers/womble.py | Python | gpl-3.0 | 2,381 |
import sys
from models import Company, Tech, Location, setup_db
from parser import parse_directory
def load_company(session, company_data):
company = Company(
name=company_data.get('name'),
website=company_data.get('website'),
description=company_data.get('description'),
size=comp... | Keats/ourstack | bootstrap/main.py | Python | mit | 1,201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.