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 |
|---|---|---|---|---|---|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | klmitch/nova | nova/tests/unit/policies/test_lock_server.py | Python | apache-2.0 | 10,320 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-03-07 10:46
from __future__ import unicode_literals
import jsonfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("motions", "0006_submitter_model")]
operations = [
migrations.AddField(
... | FinnStutzenstein/OpenSlides | server/openslides/motions/migrations/0007_motionversion_amendment_data.py | Python | mit | 473 |
#!/usr/bin/env python
import urllib
import json
import os
import gdata.service
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=... | rossinyolks/test-sales-322-Open-app-More- | app.py | Python | apache-2.0 | 1,091 |
from django.test import TestCase
from django.contrib.auth.models import User
from ..models import OpenidUserMigration
class ModelTestCase(TestCase):
def setUp(self):
self.old_user = User.objects.create_user('abc',
email='abc@example.com',
... | wettenhj/mytardis | tardis/apps/openid_migration/tests/test_models.py | Python | gpl-3.0 | 1,169 |
#!/usr/bin/env python
"""Implementation of filters, which run host data through a chain of parsers."""
import collections
from grr.lib import objectfilter
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib.rdfvalues import structs
class Error(Exception):
"""Base error class."""
class Definiti... | wandec/grr | lib/checks/filters.py | Python | apache-2.0 | 8,008 |
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor 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 o... | mozilla/caseconductor-ui | ccui/manage/views.py | Python | gpl-3.0 | 26,165 |
from __future__ import print_function
__authors__ = "Heng Luo"
from pylearn2.testing.skip import skip_if_no_gpu
skip_if_no_gpu()
import numpy as np
from theano.compat.six.moves import xrange
from theano import shared
from theano.tensor import grad, constant
from pylearn2.sandbox.cuda_convnet.filter_acts import Filter... | fyffyt/pylearn2 | pylearn2/sandbox/cuda_convnet/tests/test_image_acts_strided.py | Python | bsd-3-clause | 6,169 |
# Copyright 2012 Alyseo.
# 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... | jumpstarter-io/cinder | cinder/volume/drivers/coraid.py | Python | apache-2.0 | 21,417 |
# Benchmark the calculation of a distance in a PDB file
# The distance is the closest distance between any atoms of residues 50 and 60
# of chain A in 1AKE
import time
from Bio.PDB import PDBParser
pdb_filepath = "data/1AKE.pdb"
parser = PDBParser()
struc = parser.get_structure("", pdb_filepath)
def distance():
... | jgreener64/pdb-benchmarks | Biopython/distance.py | Python | mit | 600 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base, fs, db, plugin, media as med, theme
from base import wp
import os, sys, ntpath, datetime
from fabpress import utils
from fabric.contrib import console
from fabric.api import warn_only
class SyncMediaTask(object):
"""A task that involve media synchronisat... | EliotBerriot/fabpress | fabpress/tasks/main.py | Python | bsd-3-clause | 5,188 |
###
# Copyright (c) 2005, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... | kg-bot/SupyBot | plugins/Freenode/test.py | Python | gpl-3.0 | 1,743 |
import pytest
import datetime as dt
import pandas as pd
from pandas.api.types import is_datetime64_dtype
from dtocean_core.utils.maintenance import (update_comp_table,
update_onsite_tables,
update_replacement_tables,
... | DTOcean/dtocean-core | tests/test_utils_maintenance.py | Python | gpl-3.0 | 43,025 |
# -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub 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 Softwar... | andresriancho/PyGithub | github/Hook.py | Python | gpl-3.0 | 6,675 |
import requests
import copy
class Agdistis(object):
agdistisApi = 'http://akswnc9.informatik.uni-leipzig.de:8113/AGDISTIS'
defaultAgdistisParams = {
'text': '<entity>Leipzig</entity> is the capital of the world!',
'type': 'agdistis'
}
def __init__(self):
... | earthquakesan/agdistispy | agdistispy/agdistis.py | Python | apache-2.0 | 1,416 |
from common.methods import set_progress
from resourcehandlers.aws.models import AWSHandler
from resources.models import Resource, ResourceType
from infrastructure.models import CustomField
def create_resource_type_if_needed():
rt, created = ResourceType.objects.get_or_create(
name="cloud_file_object",
... | CloudBoltSoftware/cloudbolt-forge | blueprints/aws_s3_bucket/management/list_s3_objects.py | Python | apache-2.0 | 2,575 |
# coding=utf-8
# Copyright 2019 The Google UDA Team 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/ssl_detection | third_party/auto_augment/auto_augment/shake_drop.py | Python | apache-2.0 | 6,158 |
# Copyright (C) 2013 Statoil ASA, Norway.
#
# The file 'ert_impl_type_enum.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 ... | iLoop2/ResInsight | ThirdParty/Ert/devel/python/python/ert/enkf/enums/ert_impl_type_enum.py | Python | gpl-3.0 | 1,653 |
# 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, software
# distributed under the... | google/BIG-bench | bigbench/benchmark_tasks/convinceme/task.py | Python | apache-2.0 | 25,789 |
import functools
import registration.views
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.conf import settings
import forms
def register(request):
'''Registration page for SSL auth without CA'''
next = request.GET.get(REDIRECT_FIELD_NAME, settings.LOGIN_REDIRECT_URL)
return registration.... | adieu/authentic2 | authentic2/auth2_auth/auth2_ssl/views.py | Python | agpl-3.0 | 462 |
# Author: Alexander Sosedkin, (c) 2019
# Released under Gnu GPL v2.0, see LICENSE file for details
from __future__ import print_function
import traceback
import sys
import getopt
from itertools import chain
from random import sample
from tlsfuzzer.runner import Runner
from tlsfuzzer.messages import Connect, ClientHel... | tomato42/tlsfuzzer | scripts/test-encrypt-then-mac.py | Python | gpl-2.0 | 10,436 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Collection of several utility functions."""
from __future__ import print_function
import sys
from math import floor, sqrt
import numpy as np
import pygimli as pg
class ProgressBar(object):
"""Animated text-based progressbar.
Animated text-based progressbar f... | gimli-org/gimli | pygimli/utils/utils.py | Python | apache-2.0 | 22,192 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:jinxiu89@163.com on web
# create time: 2017/8/23
from datetime import datetime
from app import db
from werkzeug.security import check_password_hash
# 权限和角色的中间表
# 包括
# 权限ID
# 角色ID
role_permission = db.Table('role_permission',
db.Column('ro... | jinxiu89/flask_star | app/models/system.py | Python | gpl-3.0 | 12,801 |
import ocl
import camvtk
import time
import vtk
import datetime
import math
# 2018.08: Weave not wrapped..
def generateRange(zmin,zmax,zNmax):
if zNmax>1:
dz = (float(zmax)-float(zmin))/(zNmax-1)
else:
dz = 0
zvals=[]
for n in range(0,zNmax):
zvals.append(zmin+n*dz)
return ... | aewallin/opencamlib | examples/python/fiber/fiber_10_offsets.py | Python | lgpl-2.1 | 3,803 |
import datetime as dt
import numpy as np
from holoviews.core.overlay import NdOverlay
from holoviews.element import Image, Points, Dataset, Histogram
from holoviews.operation import histogram
from bokeh.models import DatetimeAxis, CategoricalColorMapper, LinearColorMapper
from ...utils import LoggingComparisonTestC... | ioam/holoviews | holoviews/tests/plotting/bokeh/test_histogramplot.py | Python | bsd-3-clause | 13,101 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2013 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | eneldoserrata/marcos_openerp | addons/l10n_in_packing_invoice/__openerp__.py | Python | agpl-3.0 | 1,532 |
#!/usr/bin/env python3
#
# This file is part of m.css.
#
# Copyright © 2017, 2018, 2019, 2020 Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2020 Yuri Edward <nicolas1.fraysse@epitech.eu>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated doc... | SedFoam/sedfoam | doc/doxygen.py | Python | gpl-2.0 | 183,402 |
from __future__ import print_function, absolute_import, division, unicode_literals
# This file is part of the ISIS IBEX application.
# Copyright (C) 2012-2016 Science & Technology Facilities Council.
# All rights reserved.
#
# This program is distributed in the hope that it will be useful.
# This program and the accomp... | ISISComputingGroup/EPICS-inst_servers | DatabaseServer/mocks/mock_procserv_utils.py | Python | bsd-3-clause | 2,227 |
n = int(input())
arr = input().split()
print(all([int(num) > 0 for num in arr]) and any([num[::-1] == num for num in arr]))
| nifannn/HackerRank | Practice/Python/BuiltIns/any_or_all.py | Python | mit | 124 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2015 PyBuilder 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/l... | elkingtonmcb/pybuilder | src/main/python/pybuilder/plugins/python/core_plugin.py | Python | apache-2.0 | 4,916 |
# Import the library
import h2o
from h2o.estimators.deeplearning import H2ODeepLearningEstimator
# Initialize the instance for h2o
h2o.init()
# Just specifiying the mother folder where the data sits
data_path = '../data/'
# Import the data using h2o's import_file function
data = h2o.import_file(data_path + 'iris_whe... | eneskemalergin/MachineLearning_Beyond | H2O/iris_dnn.py | Python | mit | 921 |
test = {
'name': 'Completion',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> i_finished_the_lab
True
""",
'hidden': False,
'locked': False
},
],
'scored': True,
'setup': '',
... | DS-100/sp17-materials | sp17/labs/lab14/ok_tests/qcompleted.py | Python | gpl-3.0 | 377 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (t... | gspilio/nova | nova/network/linux_net.py | Python | apache-2.0 | 70,161 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Adrián Bernardi, Mario Puntin
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gen... | hidext/oemedical | oemedical_invoice/models/wizard_create_lab_invoice.py | Python | agpl-3.0 | 7,273 |
# Copyright 2018 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-google/cirq_google/devices/xmon_device.py | Python | apache-2.0 | 9,433 |
#!/usr/bin/env python
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of conditions and t... | JianfengXu/crosswalk-test-suite | apptools/apptools-android-tests/apptools/create_version.py | Python | bsd-3-clause | 2,284 |
import trueskill
from powerr.models import Player, Rating
def update_trueskill_ratings(region_id, winner=None, loser=None):
winner_ratings_dict = winner.ratings
loser_ratings_dict = loser.ratings
new_winner_rating, new_loser_rating = trueskill.rate_1vs1(
Rating.objects.filter(id=winner_ratings_di... | Sciguymjm/power-rankings | powerr/skill_util.py | Python | mit | 1,059 |
from datetime import datetime
from hashlib import md5
from airy.core.db import *
class PasswordResetToken(Document):
expired = DateTimeField()
token = StringField(max_length=128)
class User(Document):
username = StringField(max_length=30)
password = StringField(max_length=128)
first_name = Stri... | letolab/airy | airy/skeleton/project/users/models.py | Python | bsd-2-clause | 2,143 |
# Copyright 2019 The Kubeflow 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 or agreed to in... | kubeflow/pipelines | samples/core/resource_ops/resource_ops.py | Python | apache-2.0 | 1,733 |
"""
DS18x20 temperature sensor driver for MicroPython.
This driver uses the OneWire driver to control DS18S20 and DS18B20
temperature sensors. It supports multiple devices on the same 1-wire bus.
The following example assumes the ground of your DS18x20 is connected to
Y11, vcc is connected to Y9 and the data pin is ... | mhoffma/micropython | drivers/onewire/ds18x20.py | Python | mit | 3,162 |
# encoding: utf-8
"""Tests for code execution (%run and related), which is particularly tricky.
Because of how %run manages namespaces, and the fact that we are trying here to
verify subtle object deletion and reference counting issues, the %run tests
will be kept in this separate file. This makes it easier to aggreg... | mattvonrocketstein/smash | smashlib/ipy3x/core/tests/test_run.py | Python | mit | 15,855 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Diffuses to 26 neighbors if difference is below threshold.
# Image pipeline
reader = vtk.vtkImageReader()
reader.SetDataByteOrderToLittleEndian()
reader.SetDataExtent(0,63... | hlzz/dotfiles | graphics/VTK-7.0.0/Imaging/Core/Testing/Python/TestAnisotropicDiffusion3D.py | Python | bsd-3-clause | 967 |
"""
WSGI config for maoaberta 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | nixware/maoaberta | maoaberta/maoaberta/wsgi.py | Python | gpl-2.0 | 395 |
"""Support for Google - Calendar Event Devices."""
from datetime import timedelta, datetime
import logging
import os
import yaml
import voluptuous as vol
from voluptuous.error import Error as VoluptuousError
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery
from homeassi... | fbradyirl/home-assistant | homeassistant/components/google/__init__.py | Python | apache-2.0 | 12,968 |
# Animal is-a object
class Animal(object):
pass
# Dog is-a Animal
class Dog(Animal):
def __init__(self, name):
# Dog has-a name
self.name = name
# Cat is-a Animal
class Cat(Animal):
def __init__(self, name):
# Cat has-a name
self.name = name
# Person is-a object
class Person(object):
def __init__(sel... | michsien/Learning_python | exercises _1-44/ex42.py | Python | mit | 1,165 |
"""
led.py
TEST SCRIPT !
Changes the LEDs status status
"""
#!/usr/bin/python3.5
#-*- coding: utf-8 -*-
#Standard imports :
import time
#Specific imports :
from robotBasics.constants import gpiodef as GPIODEF
import Adafruit_BBIO.GPIO as GPIO
"""
####################################################
#... | gbwebdev/PFE-VA_Dev | unit-tests/fl/led.py | Python | gpl-3.0 | 1,707 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-swiftbrowser',
version='0.3.0',
packages=['swiftbro... | cschwede/django-swiftbrowser | setup.py | Python | apache-2.0 | 1,185 |
import os
from twisted.internet.defer import inlineCallbacks
from txzookeeper import ZookeeperClient
from juju.state.initialize import StateHierarchy
def configure_subparser(subparsers):
sub_parser = subparsers.add_parser("initialize", help=command.__doc__)
sub_parser.add_argument(
"--instance-id",... | mcclurmc/juju | juju/control/initialize.py | Python | agpl-3.0 | 1,145 |
from rest_framework import serializers
from feder.letters.models import Letter, Attachment
from feder.main.utils import get_full_url_for_context
class NestedAttachmentSerializer(serializers.HyperlinkedModelSerializer):
filename = serializers.SerializerMethodField()
url = serializers.SerializerMethodField()
... | watchdogpolska/feder | feder/letters/serializers.py | Python | mit | 1,948 |
# Part of the testing suite. Checks the extension insert feature.
import xml.etree.ElementTree as ET
from test_import1.test_import2.import_file2 import test_libraries
def cookies(envi, insert=[]):
cookie = envi.get_cookie('test_cookie')
if not cookie:
envi.append_header('Set-Cookie', 'test_cookie=blah... | leechy9/Crumple | crumple/extensions/test.py | Python | gpl-3.0 | 1,285 |
# 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 appl... | TakayukiSakai/tensorflow | tensorflow/examples/skflow/iris.py | Python | apache-2.0 | 1,299 |
3.1415
x = 10
(3)
((True))
(
7
)
print(False, ( ( True ) ))
...
| pyta-uoft/pyta | examples/ending_locations/const.py | Python | gpl-3.0 | 68 |
from bs4 import BeautifulSoup
import requests
def lineBreaks(defin):
string = ''
ignore = False
for x in range(0, len(defin)-4):
if defin[x] == '<':
ignore = True
if ignore == False:
string += defin[x]
if defin[x]+defin[x+1]+defin[x+2]+defin[x+3]+defin[x+4] =... | bhagirathbhard/redbot | RedDefineBot/BS4Scrapper.py | Python | mit | 907 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Modified from 'The Python Standard Library'
13.1. csv — CSV File Reading and Writing
http://docs.python.org/2/library/csv.html
"""
import csv, codecs
from io import StringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input ... | baali/TopicModellingExperiments | pipeline/utf8_utils.py | Python | bsd-3-clause | 2,092 |
"""
Advanced Examples
=================
In this section, we demonstrate how to go from the inner product to the
discrete approximation for some special cases. We also show how all
necessary operators are constructed for each case.
"""
####################################################
#
# Import Packages
# -... | simpeg/discretize | tutorials/inner_products/4_advanced.py | Python | mit | 6,674 |
from execution_trace.record import record
@record(10) # 1
def f(): # 2
"""Fn with a try that does not raise.""" # 3
x = 3 # 4
try: # 5
x = x + 1 # 6
except: # 7
y = 2 # 8
args = ()
expected_trace = [{u'data': [{u'lineno': 3, u'state': {}},
{u'line... | mihneadb/python-execution-trace | execution_trace/tests/functions/f_try_ok.py | Python | mit | 493 |
#
# Copyright © 2012–2022 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# 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 Licens... | nijel/weblate | weblate/trans/views/changes.py | Python | gpl-3.0 | 10,811 |
from django.contrib import admin
from .models import (
Customfield,
CustomfieldValue,
Queue,
TicketCustomfieldValue,
Ticket,
)
admin.site.register(Customfield)
admin.site.register(CustomfieldValue)
admin.site.register(Queue)
admin.site.register(TicketCustomfieldValue)
admin.site.register(Ticket)
| UNINETT/django-rtdb | src/rtdb/admin.py | Python | mit | 319 |
# Generated by Django 3.0.8 on 2020-08-04 03:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0009_auto_20200727_2346'),
migrations.swappable_dependency(settings.AUT... | stencila/hub | manager/jobs/migrations/0005_auto_20200804_0354.py | Python | apache-2.0 | 1,248 |
#! /usr/bin/env python3
from functools import partial
import paho.mqtt.client as mqtt
import config
import ev3dev.ev3 as ev3
from Sensors.sensors import publishable_names_dict, items_to_publish, addSensorDevices
import time
import ev3control.master as master
import ev3control.slave as slave
from ev3control.messages im... | yhalk/vw_challenge_ECR | src/ev3/iris_heart.py | Python | apache-2.0 | 2,813 |
import logging
from os.path import expanduser, exists
from argparse import ArgumentParser, ArgumentTypeError, FileType
from configparser import ConfigParser
from .constants import LANG_ISO, LANG_DEFAULT, CONFIG_FILE_NAME
logger = logging.getLogger("addic7ed.config")
RENAME_MODES = ("none", "sub", "video")
DEFAULT = ... | Jesus-21/addic7ed | addic7ed/config.py | Python | mit | 5,218 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import itertools
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.convolution.utils import discretize_model
from astropy.modeling.functional_models import (Box1D, Box2D, Gaussian1D, Gaussian2D,
... | pllim/astropy | astropy/convolution/tests/test_discretize.py | Python | bsd-3-clause | 7,107 |
#!/usr/bin/env python
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
'''
The following code requires python-stix v1.1.1.0 or greater installed.
For installation instructions, please refer to https://github.com/STIXProject/python-stix.
'''
from stix.core import ... | johnwunder/johnwunder.github.io | documentation/idioms/incident-vs-indicator/incident-consumer.py | Python | bsd-3-clause | 1,081 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from sweettooth.extensions.models import Extension
def update_icons(apps, schema_editor):
Extension.objects.filter(icon__startswith="/").update(icon="")
class Migration(migrations.Migration):
dependencies = [
... | GNOME/extensions-web | sweettooth/extensions/migrations/0004_auto_20181216_2102.py | Python | agpl-3.0 | 446 |
import mykde
class ActionPackage(mykde.ActionPackage):
author = 'Victor Varvaryuk <victor.varvariuc@gmail.com>'
version = 2
description = """
TODO:
xnview - unpack to ~/apps/ and create .desktop file in Graphics category
clip2net
galaxy icons libreoffice, enter key behavior in calc
"""
| warvariuc/mykde | packages/__init__.py | Python | bsd-3-clause | 301 |
# -*- coding: utf-8 -*-
"""Tests for account creation"""
import json
import unittest
from datetime import datetime
from importlib import import_module
import ddt
import mock
import pytz
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.core.urlresolvers import reve... | miptliot/edx-platform | common/djangoapps/student/tests/test_create_account.py | Python | agpl-3.0 | 32,651 |
#
# Copyright 2013 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | pkilambi/ceilometer | ceilometer/network/statistics/opendaylight/driver.py | Python | apache-2.0 | 17,706 |
import os
from pyfaidx import Faidx, Fasta, FetchError
from nose.tools import raises
from unittest import TestCase
path = os.path.dirname(__file__)
os.chdir(path)
class TestFeatureBoundsCheck:
def setUp(self):
pass
def tearDown(self):
try:
os.remove('data/genes.fasta.fai')
... | mattions/pyfaidx | tests/test_feature_bounds_check.py | Python | bsd-3-clause | 4,016 |
#! /usr/bin/env python
# encoding: utf-8
import sys
import Utils,ar
from Configure import conftest
def find_dmd(conf):
conf.find_program(['dmd','ldc'],var='D_COMPILER',mandatory=True)
def common_flags_ldc(conf):
v=conf.env
v['DFLAGS']=['-d-version=Posix']
v['DLINKFLAGS']=[]
v['D_shlib_DFLAGS']=['-relocation-model... | SiderZhang/p2pns3 | src/applications/.waf-1.5.16-e6d03192b5ddfa5ef2c8d65308e48e42/wafadmin/Tools/dmd.py | Python | gpl-2.0 | 1,112 |
"""
Generate a Weather Central Formatted file of ASOS/AWOS Precip
"""
import os
import subprocess
import datetime
import psycopg2.extras
from pyiem.util import get_dbconn
from pyiem.network import Table as NetworkTable
IEM = get_dbconn("iem", user="nobody")
icursor = IEM.cursor(cursor_factory=psycopg2.extras.DictCu... | akrherz/iem | scripts/outgoing/wxc_azos_prec.py | Python | mit | 2,603 |
# Copyright (c) 2016, the GPyOpt Authors
# Licensed under the BSD 3-clause license (see LICENSE.txt)
from ...models import GPModel
import numpy as np
class CostModel(object):
"""
Class to handle the cost of evaluating the function.
param cost_withGradients: function that returns the cost of evaluating ... | SheffieldML/GPyOpt | GPyOpt/core/task/cost.py | Python | bsd-3-clause | 2,686 |
from unittest import TestCase
class TestNothing(TestCase):
def nothing_test(self):
fish = 'cake'
print 'hello' | landscape-test/all-messages | tests/test_nothing.py | Python | unlicense | 133 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | wbrefvem/openshift-ansible | roles/lib_openshift/library/oc_pvc.py | Python | apache-2.0 | 63,902 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'SocialAccount.uid'
db.alter_column(u'socialaccount_soc... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/socialaccount/south_migrations/0013_auto__chg_field_socialaccount_uid__chg_field_socialapp_secret__chg_fie.py | Python | gpl-3.0 | 7,605 |
from ImportDependence import *
from CustomClass import *
class ZirconTiTemp(AppForm):
reference = 'Ferry J M, Watson E B. New thermodynamic models and revised calibrations for the Ti-in-zircon and Zr-[J]. Contributions to Mineralogy & Petrology, 2007, 154(4):429-437.'
Calced = ['Temperature']
DataCalced... | chinageology/GeoPython | geopytool/Temp.py | Python | gpl-3.0 | 7,007 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-03 16:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0004_auto_20160711_1824'),
]
operations = [
... | lvoinea/recipicon-backend | api/migrations/0005_auto_20161003_1830.py | Python | agpl-3.0 | 1,980 |
from unittest import TestCase
from trollbox.image_picker import ImagePicker, ImageSearcher
from PySide.QtGui import QApplication
from PySide.QtCore import Qt
import json, tempfile, os, subprocess
app = None
class Test_ImageSearcher(TestCase):
def setUp(self):
global app
if not app:
#a... | jfoote/trollbox | trollbox/test/test_image_picker.py | Python | mit | 1,459 |
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from views.logout import LogoutView
from views.oauth import OAuthLogin, OAuthCallback
urlpatterns = [
url(r'authorize/$', OAuthLogin.as_view(), name='authorize'),
url(r'auth-callback/$', OAuthCallback.as_view(), name='a... | Qubad786/pr-code-review | web/user/urls.py | Python | mit | 413 |
#!/usr/bin/python3
# Included code
from flask import Flask
from flask import render_template
from flask import request
from flask import redirect
from flask import url_for
from flask import session
from flask import flash
import bcrypt
import sqlite3
# Define the flask application
app = Flask(__name__)
# The SQL con... | roguefalcon/rpi_docker_images | hello_world/hello.py | Python | gpl-3.0 | 4,599 |
from setuptools import setup, find_packages
setup(
name='helmetico',
version="0.1.0",
license='BSD',
packages=find_packages(),
include_package_data=True,
entry_points={'console_scripts': [
'helmetico = helmetico.commands.cli:cli',
]},
description='A AWS Secure Tool')
| i4specete/helmetico | setup.py | Python | gpl-3.0 | 310 |
# #
# Copyright 2012-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | valtandor/easybuild-framework | test/framework/variables.py | Python | gpl-2.0 | 3,243 |
import os
from flask.helpers import get_debug_flag
from dockerStarter import create_app
from dockerStarter.settings import DevConfig, ProdConfig
#CONFIG = DevConfig if get_debug_flag() else ProdConfig
CONFIG = DevConfig
# app = create_app(CONFIG)
# app.run(host=os.getenv('IP', '0.0.0.0'),port=int(os.getenv('PORT', 8... | odsj/docker-starter | server.py | Python | apache-2.0 | 585 |
# This is a sample quisk_conf.py configuration file for a SoftRock Rx Ensemble II or
# other SoftRock that has receive only capability. No Tx. The single sound card
# is used for radio sample capture, and playing radio sound. Of course, if you have
# two sound cards, you can play radio sound on the other one, prefer... | gonesurfing/Quisk_rpi_remote | softrock/conf_rx_ensemble2.py | Python | gpl-2.0 | 1,607 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/njvack/masterfile
# Copyright (c) 2020 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released ... | njvack/masterfile | tests/validators/test_dictionary_format.py | Python | mit | 788 |
'''
Created on Aug 29, 2015
@author: kevinchien
'''
from tornado.gen import coroutine
from src.core.tornadoutil import BaseHandler, route, HTTP_METHOD
from src.common.logutil import get_logger
_logger = get_logger(__name__)
class UserHandler(BaseHandler):
def initialize(self):
super(UserHandler, s... | cchienhao/data_collector | src/user/handler.py | Python | apache-2.0 | 835 |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2014-2017 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | nexdatas/selector | nxsselector/Data.py | Python | gpl-3.0 | 3,391 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Manfred Roiger <manfred.roiger@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or... | manfred-roiger/jss-static-groups | mvc2c.py | Python | gpl-3.0 | 6,168 |
#
# MythBox for XBMC
#
# Copyright (C) 2011 analogue@yahoo.com
# http://mythbox.googlecode.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at... | aplicatii-romanesti/allinclusive-kodi-pi | .kodi/addons/script.mythbox/default.py | Python | apache-2.0 | 1,555 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | virtuald/exaile | xl/migrations/database/__init__.py | Python | gpl-2.0 | 1,730 |
import dataclasses
from typing import Optional
from urllib.parse import urlparse
import ipfshttpclient
import requests
from ipwb import util
@dataclasses.dataclass(frozen=True)
class BackendError(Exception):
backend_name: str
def __str__(self):
return 'Cannot load index file from {self.backend_name... | oduwsdl/ipwb | ipwb/backends.py | Python | mit | 2,716 |
"""
# Copyright (C) 2007 Rob King (rob@e-mu.org)
#
# 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.
#
# ... | derivativeinc/liveapi | src/LiveTelnet/__init__.py | Python | lgpl-2.1 | 1,576 |
from ..style import use
use("km3pipe-notebook")
| tamasgal/km3pipe | km3pipe/style/km3pipe_notebook.py | Python | mit | 49 |
# Copyright 2016 - Wipro Limited
#
# 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... | WiproOpenSourcePractice/galaxia | galaxia/gdata/common/sql_helper.py | Python | apache-2.0 | 1,253 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from automergetool.amt_analyser import *
CFA_PATH = 'tests/data/analyser/{0}.txt'
class ConflictedFileAnalyserTest(unittest.TestCase):
def test_file_without_conflicts(self):
# Given
analyser = ConflictedFileAnalyser()
file_p... | xgouchet/ArachneMergeTool | tests/_amt_analyser_test.py | Python | apache-2.0 | 1,136 |
#! /usr/bin/env python
"""
Sample script that illustrates card connection decorators.
__author__ = "http://www.gemalto.com"
Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it u... | mixja/eap-sim-lab | lib/pyscard-1.6.16/smartcard/Examples/framework/sample_CardConnectionDecorator.py | Python | mit | 3,840 |
#!/usr/bin/python
# Discovered By : zAx
# Download Application : http://www.download.com/Triologic-Media-Player/3000-2139_4-10601848.html?tag=mncol
print "**************************************************************************"
print " Triologic Media Player 7 (.m3u) Local Heap Buffer Overflow PoC\n"
print " Discov... | knightmare2600/d4rkc0de | exploits/090113.py | Python | gpl-2.0 | 769 |
#
# 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
# ... | openstack/nova | nova/tests/unit/virt/vmwareapi/test_ds_util_datastore_selection.py | Python | apache-2.0 | 7,338 |
#!/usr/bin/env/python
import sys
import os
from photogallery.generator import gallerygenerator
if __name__ == '__main__':
"""
Main function for the whole application.
"""
generator = gallerygenerator.create_gallery_generator(sys.argv[1:],
os.getcwd())
generator.run()
| rahulraj/web_projects | assignment2/src/create_photo_gallery.py | Python | mit | 285 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Handles the "FITS" unit format.
"""
import numpy as np
import copy
import keyword
import operator
from . import core, generic, utils
class Fits(generic.Generic):
"""
The FITS standard unit format.
This supports the format defined in... | DougBurke/astropy | astropy/units/format/fits.py | Python | bsd-3-clause | 5,264 |
# -*- coding: utf-8 -*-
from django.template import Library
from django.contrib.humanize.templatetags.humanize import intcomma
from datetime import date, timedelta
import pytz
register = Library()
@register.filter
def is_false(arg):
return arg is False
@register.filter
def comma(arg):
return "%s" % intcomma(... | uiandwe/dfxp | dfxp/templatetags/template_function.py | Python | mit | 2,262 |
'''
Created on 16 Jul 2015
@author: navjotkukreja
'''
from random import shuffle
class cv:
def __init__(self, data, n_fold_cv):
shuffle(data)
n_folds = self.__chunks_(data, n_fold_cv)
labels = []
train_paths = []
test_paths = []
selected_fold = 1
for i in ra... | navjotk/diabetic-dissert | crossvalidation.py | Python | apache-2.0 | 682 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.