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 uuid
from unittest import mock
from django.conf import settings
from olympia import amo, core
from olympia.activity.models import ActivityLog
from olympia.addons.models import Addon
from olympia.amo.tests import addon_factory, TestCase
from olympia.bandwagon.models import Collection
from olympia.users.models i... | eviljeff/olympia | src/olympia/bandwagon/tests/test_models.py | Python | bsd-3-clause | 6,034 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 Stas Zytkiewicz stas.zytkiewicz@schoolsplay.org
#
# quiz_sayings.py
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 3 of the GNU General Public License
# as published by the Free Software Foundation. A copy o... | childsplay-mobi/cp-pygame | lib/quiz_sayings.py | Python | gpl-3.0 | 4,761 |
"""Tests of openedx.features.discounts.applicability"""
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import ddt
import pytz
from django.contrib.sites.models import Site
from django.utils.timezone import now
from enterprise.models import EnterpriseCustomer, EnterpriseCustomerUser
from mock import ... | appsembler/edx-platform | openedx/features/discounts/tests/test_applicability.py | Python | agpl-3.0 | 7,268 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Set up paths for Fast R-CNN."""
import os.path as osp
import sys
d... | yxliang/fast-rcnn | tools/_init_paths.py | Python | mit | 637 |
"""
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 this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/ADH/1.0/services/HDFS/package/scripts/params_windows.py | Python | apache-2.0 | 2,748 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This file is part of MoaT, the Master of all Things.
##
## MoaT is Copyright © 2007-2016 by Matthias Urlichs <matthias@urlichs.de>,
## it is licensed under the GPLv3. See the file `README.rst` for details... | smurfix/MoaT | irrigation/rainman/utils.py | Python | gpl-3.0 | 6,217 |
# -*- coding: utf-8 -*-
#
# This file is based upon the file generated by sphinx-quickstart. However,
# where sphinx-quickstart hardcodes values in this file that you input, this
# file has been changed to pull from your module's metadata module.
#
# This file is execfile()d with the current directory set to its contai... | Alymantara/maelstorm | docs/source/conf.py | Python | mit | 8,701 |
"""get leadfields from upper and lower sensor coils"""
from meg import pos, leadfield
class getlf():
def __init__(self, grid):
"give grid points and return leadfields"
self.channels=pos.sensors()
chup=self.channels.chu #upper ch position
chlp=self.channels.chl #lower ch position
... | badbytes/pymeg | meg/arch_getleadfields.py | Python | gpl-3.0 | 665 |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | jumpstarter-io/nova | nova/objects/base.py | Python | apache-2.0 | 28,219 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | nii-cloud/dodai-compute | nova/vnc/auth.py | Python | apache-2.0 | 4,423 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yoer/hue | apps/beeswax/src/beeswax/views.py | Python | apache-2.0 | 35,296 |
# -*- coding: utf-8 -*-
#
# Trak Lathe Quick Start Guide documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 10 09:32:16 2016.
#
# 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... | StudentShop/Trak-Lathe-Guide | source/conf.py | Python | bsd-3-clause | 10,127 |
"""
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 this ... | radicalbit/ambari | contrib/management-packs/odpi-ambari-mpack/src/main/resources/stacks/ODPi/2.0/services/YARN/package/scripts/nodemanager_upgrade.py | Python | apache-2.0 | 2,792 |
#
# Copyright Ericsson AB 2013. All rights reserved
#
# Authors: Ildiko Vancsa <ildiko.vancsa@ericsson.com>
# Balazs Gibizer <balazs.gibizer@ericsson.com>
#
# 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 co... | ChinaMassClouds/copenstack-server | openstack/src/ceilometer-2014.2.2/ceilometer/alarm/storage/pymongo_base.py | Python | gpl-2.0 | 11,291 |
#!/usr/bin/env python
# Copyright 2008, Google 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list ... | CPB9/mcc | thirdparty/libkml/examples/python/parse_point_placemark.py | Python | mpl-2.0 | 2,673 |
#!/usr/bin/env python
# Display a runtext with double-buffering.
from samplebase import SampleBase
from rgbmatrix import graphics
import time
class RunText(SampleBase):
def __init__(self, *args, **kwargs):
super(RunText, self).__init__(*args, **kwargs)
def Run(self):
offscreenCanvas = self.mat... | Saij/rpi-rgb-led-matrix | python/samples/runtext.py | Python | gpl-2.0 | 1,006 |
from django.conf import settings
from django.views.generic.simple import direct_to_template
from snapboard.models import is_ip_banned, IPBan, is_user_banned, UserBan
class IPBanMiddleware(object):
"""
Bans based on IP address.
This middleware attempts to grab SNAP_BANNED_IPS from the settings module.
... | DuVale/snapboard | snapboard/middleware/ban.py | Python | bsd-3-clause | 1,376 |
#!/usr/bin/env python
from signal import SIGINT, SIGKILL
import os
import re
from servicemanager import subprocess
def kill_pid(context, pid, force=False):
if _is_system_or_smserver_or_test_process(pid):
return "Not allowed to kill system, test or smserver process (pid = %d)" % pid
try:
if ... | alphagov/hmrc-service-manager | servicemanager/smprocess.py | Python | apache-2.0 | 5,676 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["HDFBackend", "TempHDFBackend"]
import os
from tempfile import NamedTemporaryFile
import numpy as np
try:
import h5py
except ImportError:
h5py = None
from .backend import Backend
from .. import __version__
class HDFBacken... | farr/emcee | emcee/backends/hdf.py | Python | mit | 6,656 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - Frank Lin
from skr_cpp_builder.cpp_variable import VarType
from skrutil import string_utils
from skrutil import skr_logger
class JniVariable:
"""JNI variable that provides JNI related method.
"""
def __init__(self, name, var_type_str... | DaYeSquad/worktilerwdemo | model-builder/skr_jni_builder/jni_variable.py | Python | mit | 11,685 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | attribution/models/attribution_charge_new.py | Python | agpl-3.0 | 3,684 |
from itertools import permutations
arrange_of_ten = permutations('0123456789')
num = 0
for item in arrange_of_ten:
will_be_div_by_11111 = int(''.join(item))
if will_be_div_by_11111 % 11111 is 0:
num += 1
print num
| zhao-ji/scripts | how_many.py | Python | gpl-2.0 | 234 |
import subprocess
import git
# from git import Repo
# TODO: raise exception if command failed
# def system(cmd):
# print(">>>", cmd)
# out_text = subprocess.getoutput(cmd)
# return out_text.split(r"\n")
def list_source_files(project_dir):
g = git.Git(project_dir)
rval = g.ls_files("*.py", "*.c"... | johntellsall/shotglass | clean/makeindex.py | Python | mit | 716 |
from werkzeug.datastructures import Headers
from server import EXPIRE
def test_401_with_invalid_access_token(client, refresh_token):
headers = Headers()
headers.set('Authorization', 'Bearer invalid-token')
response = client.post('/token/revoke', headers=headers, data={'token': refresh_token})
assert... | Turbo87/flask-oauth2-test | test_token_revocation.py | Python | mit | 1,840 |
#!/usr/bin/env python
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
from os.path import splitext
import json
import os
... | andrewpx1/apiai-weather-webhook-sample-master | lovepx.py | Python | apache-2.0 | 1,716 |
# Copyright 2013 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... | tianweizhang/nova | nova/tests/virt/xenapi/image/test_utils.py | Python | apache-2.0 | 8,134 |
from principal.models import Proyecto
from principal.models import Usuario
from principal.models import Fase
from principal.views import is_logged
from django.http.response import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response, render, redirect
from django.core.urlresolvers import re... | SantiagoValdez/hpm | src/hpm/app_fase/views.py | Python | gpl-2.0 | 8,485 |
"""Support for the Nissan Leaf Carwings/Nissan Connect API."""
from datetime import datetime, timedelta
import asyncio
import logging
import sys
import voluptuous as vol
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import callback
import homeassistant.helpers.config_validation ... | Cinntax/home-assistant | homeassistant/components/nissan_leaf/__init__.py | Python | apache-2.0 | 17,749 |
#!/bin/env python3
import re
from readers import CodeReader
from enum import Enum
class Token:
""" A token
Token is a meaningful code unit, which can be further
structured (have sub-tokens).
Token does NOT neccessarily represent a whole statement.
Args:
value (str): a piece of the source code the Token is ... | naro/sdscp | tokens.py | Python | gpl-2.0 | 26,322 |
from .vecmath import Vec2D, Vec3D, Plane3D, Line3D, fuzzyEqual, DEFAULT_GEOMETRY_EPSILON, crossProduct3DFromThreePoints
from enum import IntEnum
class EdgeIntersectionType(IntEnum):
NONE = -1
BEGINNING = 0
MIDDLE = 1
END = 2
def getEdgeIntersectionType(t, line):
intersectionPoint = line.pointOnLine(t)
beginning... | x6herbius/afterburner | tools/bsp/libbsp/polygons.py | Python | gpl-3.0 | 8,778 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/bgp/peer_groups/peer_group/config/__init__.py | Python | apache-2.0 | 81,985 |
import bubblesort
print bubblesort.sort([10,9,8,7,6,5,4,3,2,1])
print bubblesort.sort([1,2,3,4,5,6,7,8,9,10])
print bubblesort.sort([6,7,8,9,10,1,2,3,4,5])
print bubblesort.sort(12323123)
print bubblesort.sort("thisshouldn'twork") # need to implement error checking
| AeroNotix/algostructure | CPython/bubblesort/bubbletest.py | Python | bsd-3-clause | 268 |
#!/usr/bin/python
import sys
input = ' '.join(sys.argv[1:])
chefSpeak = {'a': 'e', 'f': 'ff', 'i': 'ee', 'o': 'u', 'u': 'oo',\
'v': 'f', 'w': 'v'}
output = ''
for i in input:
if i in chefSpeak.keys():
output += chefSpeak[i]
else:
output += i
print output
| bpurgaso/hydra-ircbot | hydra/bin/swedish.py | Python | apache-2.0 | 295 |
#! /usr/bin/env python
#
# Copyright (c) 2011 Red Hat, Inc.
#
# This software is licensed to you under the GNU Lesser General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (LGPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express... | splice/gofer | test/unit/theadpool.py | Python | lgpl-2.1 | 2,188 |
"""Functions for extracting harmonic groups from a power spectrum.
harmonic_groups(): detect peaks in a power spectrum and groups them
according to their harmonic structure.
extract_fundamentals(): collect harmonic groups from lists of power spectrum peaks.
threshold_estimate(): estimates threshold... | jfsehuanes/thunderfish | thunderfish/harmonicgroups.py | Python | gpl-3.0 | 53,719 |
import time
import numpy.random as npr
from hypergrad.odyssey import omap
objects = [1, (3,4), 1.04, "hello", "it's \n a hard string \\\''\to parse", ((1,'a'), 3)]
def identity(x):
time.sleep(npr.randint(5))
print x
return x
def check_omap():
# This won't work with nosetest. Needs to be run from the ... | bigaidream-projects/drmad | cpu_ver/tests/test_odyssey.py | Python | mit | 531 |
# encoding: UTF-8
"""
一个ATR-RSI指标结合的交易策略,适合用在股指的1分钟和5分钟线上。
注意事项:
1. 作者不对交易盈利做任何保证,策略代码仅供参考
2. 本策略需要用到talib,没有安装的用户请先参考www.vnpy.org上的教程安装
3. 将IF0000_1min.csv用ctaHistoryData.py导入MongoDB后,直接运行本文件即可回测策略
"""
import numpy as np
import talib
from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate
from vnpy.trader... | cmbclh/vnpy1.7 | vnpy/trader/app/ctaStrategy/strategy/strategyAtrRsi.py | Python | mit | 9,724 |
#!/usr/bin/env python2.5
#
# Copyright 2010 the Melange 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 applic... | adviti/melange | app/soc/views/helper/templatetags/filters.py | Python | apache-2.0 | 969 |
# -*- coding: utf-8 -*-
#
# test_threads.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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, o... | obreitwi/nest-simulator | pynest/nest/tests/test_threads.py | Python | gpl-2.0 | 3,684 |
from fabric.api import *
from fabric.contrib.files import sed
import random
import string
# Custom Code Enigma modules
import common.Utils
# Needed to get variables set in modules back into the main script
from common.Utils import *
from Symfony import *
@task
@roles('app_primary')
def initial_config(repo, buildtype,... | codeenigma/deployments | symfony/InitialBuild.py | Python | mit | 1,153 |
expected = [
{
"type": "author",
"equal-contrib": "yes",
"id": "author-23",
"surname": "Alegado",
"given-names": "Rosanna A",
"suffix": "Jnr",
"references": {
"affiliation": ["aff1", "aff2"],
"equal-contrib": ["equal-contrib"],
... | elifesciences/elife-tools | tests/fixtures/test_contributors/content_01_expected.py | Python | mit | 5,491 |
from __future__ import division, absolute_import, print_function
from os.path import join, sep, dirname
from numpy.distutils.misc_util import (
appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info
)
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal
)
ajoin = lambda *... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/distutils/tests/test_misc_util.py | Python | mit | 3,326 |
'''
Functions and classes to observe or add ground statements.
Examples
--------
The following example shows how to add a fact to a program via the backend and
observe the corresponding rule passed to the backend:
>>> from clingo.symbol import Function
>>> from clingo.control import Control
>>>
>>> cl... | potassco/clingo | libpyclingo/clingo/backend.py | Python | mit | 22,608 |
"""
URLs for track app
"""
from django.conf import settings
from django.conf.urls import url
import track.views
import track.views.segmentio
urlpatterns = [
url(r'^event$', track.views.user_track),
url(r'^segmentio/event$', track.views.segmentio.segmentio_event),
]
| edx-solutions/edx-platform | common/djangoapps/track/urls.py | Python | agpl-3.0 | 278 |
#------------------------------------------------------------------------------
# Module: dpa.ptasks.views
# Author: Gina Guerrero (gguerre), Josh Tomlinson (jtomlin)
#------------------------------------------------------------------------------
""" Defines all views for dpa ptasks.
Classes
-------
PTaskDetailView
... | Clemson-DPA/dpa-pipe-backend | dpa/ptasks/views.py | Python | mit | 5,426 |
from ....common.db.sql import VARCHAR, Numeric as NUMBER, DateTime as DATETIME, Column, BaseModel, CLOB, DATE
VARCHAR2 = VARCHAR
class CFuturescontpro(BaseModel):
"""
4.178 中国期货标准合约属性
Attributes
----------
object_id: VARCHAR2(100)
对象ID
s_info_windcode: VARCHAR2(40)
Wind代码 ... | SnowWalkerJ/quantlib | quant/data/wind/tables/cfuturescontpro.py | Python | gpl-3.0 | 3,482 |
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'biohub.accounts'
label = 'accounts'
| lsj1292/Abacus | biohub/accounts/apps.py | Python | mit | 121 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Inspiration Forge documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 14 19:55:39 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in... | FarmCodeGary/InspirationForge | docs/conf.py | Python | mit | 9,307 |
from collections import namedtuple
fields = ["x", "y"]
nt = namedtuple("name", fields) | asedunov/intellij-community | python/testData/stubs/NamedTupleFieldsReference.py | Python | apache-2.0 | 87 |
# -*- coding: utf-8 -*-
import pytest
import sys
import cPickle as pickle
from test_base_class import TestBaseClass
aerospike = pytest.importorskip("aerospike")
try:
from aerospike.exception import *
except:
print "Please install aerospike python client."
sys.exit(1)
class SomeClass(object):
pass
... | arthurprs/aerospike-client-python | test/test_exists.py | Python | apache-2.0 | 10,903 |
# 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... | cloudbase/neutron-virtualbox | neutron/tests/unit/hacking/test_checks.py | Python | apache-2.0 | 4,948 |
# 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 is distributed in the hope that it will be useful,
# bu... | autotest/arc | arc/config.py | Python | gpl-2.0 | 3,643 |
from mesos_collectd import MesosCollectd
import collectd
class MesosSlave(MesosCollectd):
def __init__(self, config):
super(MesosSlave, self).__init__(config)
self.name = self.__class__.__name__
self.log_info('Configured {} plugin.'.format(self.name))
#
# mesos master metrics collector p... | maier/cadvisor-collectd | src/mesos/python/mesos-slave.py | Python | apache-2.0 | 1,611 |
# #
# Copyright 2013-2016 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://www.vscentrum.be),
# Flemish Research Foundation (... | wpoely86/easybuild-framework | test/framework/include.py | Python | gpl-2.0 | 10,598 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
#A hypergraph representation for amr.
#author: Chuan Wang
#since: 2013-11-20
from collections import defaultdict
from util import *
import re,sys
from optparse import OptionParser
from DependencyGraph import *
# Error definitions
class LexerError(Exception):
pass
class ... | didzis/AMRParsing | common/AMRGraph.py | Python | gpl-2.0 | 32,135 |
# -*- encoding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class Group(models.Model):
name = models.CharField(_(u'Nombre del grupo'), max_length=40, blank=True)
adverse_reaction = models.CharField(_(u'Reacciones Adversas'),... | frhumanes/consulting | web/src/medicament/models.py | Python | apache-2.0 | 1,064 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | ovnicraft/odoo_addons | smile_base/tests/test_base.py | Python | agpl-3.0 | 3,699 |
# logging module
#
# This file is part of thesubnetwork
#
# thesubnetwork 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 of the License, or (at your
# option) any later version.
#
# th... | Horrendus/thesubnetwork | thesubnetwork/log.py | Python | agpl-3.0 | 811 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 12, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_ConstantTrend/cycle_12/ar_/test_artificial_32_Integration_ConstantTrend_12__20.py | Python | bsd-3-clause | 270 |
""" Newton polynomial basis CACG """
| sclc/NAEF | src/newton_polynomial_basis_cacg.py | Python | gpl-3.0 | 37 |
#!/usr/bin/env python
# Created by Pearu Peterson, June 2003
import warnings
from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal, \
assert_array_almost_equal, assert_allclose, TestCase, run_module_suite
from numpy.testing.utils import WarningManager
from numpy import array, diff, li... | teoliphant/scipy | scipy/interpolate/tests/test_fitpack2.py | Python | bsd-3-clause | 11,260 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-08-28 20:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrati... | ESOedX/edx-platform | openedx/core/djangoapps/content_libraries/migrations/0001_initial.py | Python | agpl-3.0 | 2,964 |
"""
WE'RE USING MIGRATIONS!
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py schemamigration instructor_task --auto description_of_your_change
3. Add the migration file cr... | c0710204/edx-platform | lms/djangoapps/instructor_task/models.py | Python | agpl-3.0 | 16,755 |
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | helinwang/Paddle | python/paddle/trainer_config_helpers/evaluators.py | Python | apache-2.0 | 19,587 |
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2007 Alberto Ruiz <aruiz@gnome.org>
#
# unpack.py: helper functions for unpacking compressed packages
#
# 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 ... | rpavlik/jhbuild-vrjuggler | jhbuild/utils/unpack.py | Python | gpl-2.0 | 5,855 |
#!/usr/bin/env python
#
# Copyright (c) 2011 anatanokeitai.com(sakurai_youhei)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the right... | mschon314/pyamazonclouddrive | bin/acdsession.py | Python | mit | 3,367 |
# Copyright 2016 Rackspace
# Copyright 2013 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | rajalokan/glance | glance/db/sqlalchemy/alembic_migrations/add_tasks_tables.py | Python | apache-2.0 | 2,859 |
"""
Tests for Site object
"""
import os
import unittest
# Setup global test data location
from werkzeug.exceptions import NotFound
TEST_DATA_ROOT = os.path.join('tests', 'testdata', 'site')
# pass the root of the test data to the app via environment variable
os.environ['TEST_DATA_ROOT'] = TEST_DATA_ROOT
from website... | nfletton/froid | tests/test_site.py | Python | mit | 5,724 |
### Errors ###################################################################
class ZincError(object):
def __init__(self, code, message):
self.code = code
self.message = message
# TODO: might be worst python ever
class ZincErrors(object):
OK = ZincError(0, "OK")
INCORRECT_SHA = ZincError... | mindsnacks/Zinc | src/zinc/errors.py | Python | mit | 398 |
import os, json
from slackmonitorworker import SlackMonitorWorker
def main():
if os.path.isfile('orbnotifier.config'):
with open('orbnotifier.config', 'r') as f:
conf = json.load(f)
else:
conf = {'token':'','mac':''}
with open('orbnotifier.config', 'w') as f:
jso... | baalansellers/OrbNotifier | orbnotifier.py | Python | mit | 1,740 |
#!/usr/bin/python2
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Post-process Oprofile logs for x86-64 nexes running under sel_ldr.
Maps event counts in the "anon" region, to the appropriat... | Lind-Project/native_client | tools/process_oprofile_x86_64.py | Python | bsd-3-clause | 17,098 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/operations/network_watchers_operations.py | Python | mit | 76,668 |
# -*- coding:utf-8 -*-
# Author: Kei Choi(hanul93@gmail.com)
import os
import re
import glob
import shutil
import tempfile
# import psutil
# ---------------------------------------------------------------------
# K2Tempfile 클래스
# ---------------------------------------------------------------------
class K2Tempfile... | hanul93/kicomav | Engine/kavcore/k2file.py | Python | gpl-2.0 | 10,886 |
from collections import Counter
from typing import Union, List, Callable, Tuple
import torch
import penman
from penman import Graph
from hanlp.common.dataset import TransformableDataset
from hanlp.components.amr.seq2seq.dataset.IO import read_raw_amr_data
from hanlp.components.amr.seq2seq.dataset.penman import role_is_... | hankcs/HanLP | hanlp/components/amr/seq2seq/dataset/dataset.py | Python | apache-2.0 | 9,017 |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | eswartz/RenderPipeline | rpcore/pynative/rp_light.py | Python | mit | 6,142 |
"""
Tests for the Shopping Cart Models
"""
import smtplib
import StringIO
from textwrap import dedent
from boto.exception import BotoServerError # this is a super-class of SESError and catches connection errors
from mock import patch, MagicMock, sentinel
from django.core import mail
from django.conf import settings
f... | pelikanchik/edx-platform | lms/djangoapps/shoppingcart/tests/test_models.py | Python | agpl-3.0 | 22,461 |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorList
from django.template.loader import render_to_string
from django.utils.html... | iansprice/wagtail | wagtail/wagtailcore/blocks/list_block.py | Python | bsd-3-clause | 6,798 |
# 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, ... | google/burst-denoising | kpn_data_provider.py | Python | apache-2.0 | 21,051 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | NeCTAR-RC/nova | nova/tests/unit/cells/test_cells_scheduler.py | Python | apache-2.0 | 24,103 |
from typing import List
from ruamel import yaml
import great_expectations as ge
from great_expectations.core.batch import Batch, BatchRequest, RuntimeBatchRequest
from great_expectations.data_context import BaseDataContext
from great_expectations.data_context.types.base import (
DataContextConfig,
InMemorySto... | great-expectations/great_expectations | tests/integration/docusaurus/connecting_to_your_data/cloud/gcs/spark/inferred_and_runtime_yaml_example.py | Python | apache-2.0 | 4,602 |
import _plotly_utils.basevalidators
class ColorbarValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="colorbar", parent_name="scatter.marker", **kwargs):
super(ColorbarValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/marker/_colorbar.py | Python | mit | 12,777 |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | joerideturck/gcloud-python-bigtable | gcloud_bigtable/_helpers.py | Python | apache-2.0 | 12,957 |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/pbc/df/fft_ao2mo.py | Python | apache-2.0 | 18,456 |
# -*- coding: UTF-8 -*-
"""
Based on ``behave tutorial``
"""
# @mark.steps
# ----------------------------------------------------------------------------
# STEPS:
# ----------------------------------------------------------------------------
from behave import given, when, then
@given('we have behave installed')
def ... | raulpush/monitorizare-site | bin/features/steps/step_tutorial01.py | Python | apache-2.0 | 529 |
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
rfcom = SchLib(tool=SKIDL).add_parts(*[
Part(name='BL652',dest=TEMPLATE,tool=SKIDL,keywords='Bluetooth Nordic nRF52',description='Bluetooth module',ref_prefix='U',num_units=1,fplist=['Laird*BL652*'],do_erc=True,pins=[
... | xesscorp/skidl | skidl/libs/rfcom_sklib.py | Python | mit | 39,046 |
# (C) William W. Cohen and Carnegie Mellon University, 2016
#
# learning methods for Tensorlog
#
import sys
import time
import math
import numpy as NP
import scipy.sparse as SS
import collections
from tensorlog import config
from tensorlog import dataset
from tensorlog import declare
from tensorlog import funs
from t... | TeamCohen/TensorLog | tensorlog/learn.py | Python | apache-2.0 | 21,908 |
#!/usr/bin/env python
__author__ = 'Rolf Jagerman'
from PySide import QtGui
import os
from authentication import AuthenticationListener, AuthenticationClient
from loadui import loadUi
from config import UI_DIRECTORY
from drawers import Drawers
from users import User
from locations import Location
class AddDelivery(Q... | MartienLagerweij/aidu | aidu_gui/src/aidu_gui/add_delivery.py | Python | mit | 3,609 |
# =================================================================
#
# Authors: Ricardo Garcia Silva <ricardo.garcia.silva@gmail.com>
#
# Copyright (c) 2017 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the... | tomkralidis/pycsw | tests/unittests/test_util.py | Python | mit | 10,871 |
from unittest import TestCase
import netrc
from niconico import NicoVideoArgs
from nico_tools.mylist import MyList
import tests
class TestGetMyList(TestCase):
def setUp(self):
# ログイン情報はnetrcから取る
auth = netrc.netrc()
self.username, _, self.password = auth.authenticators("nicovideo")
d... | Sakaki/pyniconico | tests/test_get_mylist.py | Python | lgpl-3.0 | 1,002 |
from __future__ import division
from collections import Iterable, defaultdict
import copy
import os
import pickle
import itertools
from numbers import Integral, Real
from xml.etree import ElementTree as ET
import sys
import numpy as np
from openmc import Mesh, Filter, Trigger, Nuclide
from openmc.cross import CrossS... | mjlong/openmc | openmc/tallies.py | Python | mit | 100,934 |
# code courtesy of https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b
import hashlib as hasher
import datetime as date
class Block:
def __init__(self, index, timestamp, data, previous_hash):
self.index = index
self.timestamp = timestamp
self.data = data
self.previous_hash = pre... | HoussemCharf/FunUtils | Blockchain/blockchain.py | Python | mit | 1,274 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from pycket.values import W_Symbol, w_false, w_true
from pycket.error import SchemeException
from pycket.prims.linklet import W_LinkletInstance, w_uninitialized
from pycket.test.testhelper import (make_linklet, inst, get_val, defines, variables, get_var_val... | samth/pycket | pycket/test/test_linklet.py | Python | mit | 28,951 |
from libcloud.dns.base import Zone
from libcloud.dns.providers import get_driver
from libcloud.dns.types import Provider
CREDENTIALS_ZERIGO = ('email', 'api key')
ZONE_ID = 'example.myzone.com'
Cls = get_driver(Provider.ZERIGO)
driver = Cls(*CREDENTIALS_ZERIGO)
zone = Zone(ZONE_ID, domain=None, type=None, ttl=None,
... | illfelder/libcloud | docs/examples/dns/list_zone_records_manual_instantiation.py | Python | apache-2.0 | 388 |
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | virtualopensystems/neutron | neutron/db/migration/alembic_migrations/versions/5ac1c354a051_n1kv_segment_alloc.py | Python | apache-2.0 | 2,680 |
import builtins
import getpass
import sys
from datetime import date
from io import StringIO
from unittest import mock
from django.apps import apps
from django.contrib.auth import management
from django.contrib.auth.management import (
create_permissions, get_default_username,
)
from django.contrib.auth.management.... | frankvdp/django | tests/auth_tests/test_management.py | Python | bsd-3-clause | 35,534 |
from preparation.lang_utils.morphology import get_initial_forms
from preparation.lang_utils.cognates import _cognates_base
__author__ = 'Oktosha'
def get_roots(word):
"""
Returns list of root-words which are titles of dictionary articles containing the given word.
If the dictionary doesn't contain the gi... | hatbot-team/hatbot_resources | preparation/lang_utils/cognates/cognates.py | Python | mit | 2,061 |
# __version__ = "1.0"
from . import data_processing
from . import plotly_usmap
from . import UI_setup
# from .data_processing import *
# from .plotly_usmap import *
# from .UI_setup import *
| UWSEDS-aut17/uwseds-group-city-fynders | cityfynders/__init__.py | Python | mit | 193 |
from datetime import datetime, timedelta, tzinfo
class UTC10(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=10) + self.dst(dt)
def dst(self, dt):
"""
this function is for daylight saving time, Brisbane don't have a dst, so we can directly return 0.
"""
return... | leglars/ThinkingofYou | AM-flask/app/timezone_handler.py | Python | mit | 2,517 |
from Renderers.utils import *
class BlocksManager:
blocks = None
blocksDimensions = None
def __init__(self, pygame):
self.blocksDimensions = (16,16)
self.blocks = (
Block(0, None, "Air"),
Block(1, Image(pygame.image.load("assets/blocks/stone.png"), self.... | bcwadsworth/Minecraft-2D | Minecraft 2D/Renderers/Block.py | Python | lgpl-3.0 | 4,089 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
import os
from typing import Optional
# this class is a global configuration class that holds
# values... | sqall01/alertR | alertClientKodi/lib/globalData/globalData.py | Python | agpl-3.0 | 1,761 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.