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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
import pytest
import networkx as nx
class TestFloyd:
@classmethod
def setup_class(cls):
pass
def test_floyd_warshall_predecessor_and_distance(self):
XG = nx.DiGraph()
XG.add_weighted_edges_from([('s', 'u', 10), ('s', 'x', 5),
... | sserrot/champion_relationships | venv/Lib/site-packages/networkx/algorithms/shortest_paths/tests/test_dense.py | Python | mit | 6,513 |
import openpnm as op
import scipy as sp
from numpy.testing import assert_approx_equal
class ThermalConductivityTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[3, 3, 3])
self.phase = op.phases.GenericPhase(network=self.net)
self.phase['pore.temperature'] = 298.0 # K
... | TomTranter/OpenPNM | tests/unit/models/phase/ThermalConductivityTest.py | Python | mit | 1,985 |
# -*- coding: utf-8 -*-
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3
from . import account_invoice
from . import purchase_expense_type
from . import purchase_cost_distribution
from . import purchase_order
from . import stock_picking
| rosenvladimirov/addons | purchase_landed_cost_bg/models/__init__.py | Python | agpl-3.0 | 247 |
'''misc.py contains untested subroutines: use at your own risk'''
def eps_corr_drude(wl,w_p,gamma_inf,vf,r):
'''computation of the drude dielectric function correction
for spherical particles of finite size as in:
Kreibig Vollmer "Optical properties of metal clusters"
Parameters
----------
'w... | gevero/py_matrix | py_matrix/misc.py | Python | gpl-3.0 | 934 |
# -*- coding: utf-8 -*-
"""
#########################################################################
Author: Vijay Dhameliya, Madhav Khakhar
Project: DNA Cloud
Graduate Mentor: Dixita Limbachya
Mentor: Prof. Manish K Gupta
Date: 25 July 2014
Website: www.guptalab.org/dnacloud
This module contains encoding scheme which... | guptalab/dnacloud | source/encodeGolay.py | Python | mit | 6,543 |
#!/usr/bin/env python
# CPIP is a C/C++ Preprocessor implemented in Python.
# Copyright (C) 2008-2017 Paul Ross
#
# 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... | paulross/cpip | src/cpip/__init__.py | Python | gpl-2.0 | 2,006 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-13 16:02
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('membership', '0004_auto_20... | PairMhai/Backend | membership/migrations/0005_admin.py | Python | agpl-3.0 | 825 |
import re
def test_phones_on_home_page(app):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_edit_from_page(0)
assert contact_from_home_page.all_phones_from_home_page == merge_phones_like_on_home_page(contact_from_edit_page)
def test_phon... | IgorGolubenkov/python_training | test/test_for_phones.py | Python | apache-2.0 | 1,141 |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that .d files and all.deps are properly generated.
"""
import os
import TestGyp
# .d files are only used by the make build.
t... | nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gyp/test/make/gyptest-dependencies.py | Python | lgpl-3.0 | 812 |
# Copyright 2015 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, s... | tseaver/google-cloud-python | bigtable/tests/unit/test_instance.py | Python | apache-2.0 | 37,126 |
#
# IAImage.py
from objc import *
from Foundation import *
from AppKit import *
from math import log
class Quantizer(object):
def qualityLabel(self):
return "Colors"
def supportsIeMode(self):
return False
def preferredDithering(self):
return True
def numberOfColorsToQuality(... | pornel/ImageAlpha | IAImage.py | Python | gpl-2.0 | 8,185 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * ... | bblacey/FreeCAD-MacOS-CI | src/Mod/Path/PathScripts/PathFacePocket.py | Python | lgpl-2.1 | 10,063 |
import numpy as np
import pytest
from sklearn.datasets import load_boston
from sklearn.datasets import fetch_mldata
from sklearn.preprocessing import StandardScaler
from sklearn.utils import shuffle
from lasagne.layers import Conv2DLayer
from lasagne.layers import DenseLayer
from lasagne.layers import MaxPool2DLayer
f... | williford/nolearn | nolearn/lasagne/tests/conftest.py | Python | mit | 3,365 |
#!/usr/bin/env python
'''
Exercise 5 - Class 8 - Connect to each device onthe database
Gleydson Mazioli <gleydsonmazioli@gmail.com>
'''
from net_system.models import NetworkDevice
import netmiko
import django
import time
def get_cred_type(l_credentials, l_type):
'''
Get the associated credential from the data... | gleydsonm/pynet_ex | class8/exercise5.py | Python | apache-2.0 | 2,032 |
from django.conf.urls import url, include
from . import views as core_views
from .category.urls import urlpatterns as category_urls
from .customer.urls import urlpatterns as customer_urls
from .order.urls import urlpatterns as order_urls
from .payments.urls import urlpatterns as payments_urls
from .product.urls import... | car3oon/saleor | saleor/dashboard/urls.py | Python | bsd-3-clause | 1,052 |
from nodes import Node
import string
class KillOne(Node):
char = "K"
args = 1
results = 0
contents = string.printable
def func(self, _):
"""Kill the first item on the stack"""
return [] | muddyfish/PYKE | node/kill_one.py | Python | mit | 223 |
"""
Copyright 2017 Oliver Smith
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap ... | lawl/pmbootstrap | test/test_repo.py | Python | gpl-3.0 | 3,298 |
#encoding:utf-8
subreddit = 'ikeahacks'
t_channel = '@r_IKEAhacks'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_ikeahacks/app.py | Python | mit | 141 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | nzlosh/st2 | st2common/st2common/services/config.py | Python | apache-2.0 | 3,026 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields
class ProductTemplate(... | cgstudiomap/cgstudiomap | main/parts/product-attribute/product_supplierinfo_for_customer/models/product_template.py | Python | agpl-3.0 | 722 |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
User = settings.AUTH_USER_MODEL
@python_2_unicode_compatible
class UserProfile(models.Model):
"""
Model used to store more infor... | moshthepitt/product.co.ke | users/models.py | Python | mit | 678 |
#!/usr/bin/env python
#
# Copyright (c) 2016 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementatio... | nilmini20s/gem5-2016-08-13 | tests/testing/helpers.py | Python | bsd-3-clause | 6,457 |
import os
import subprocess
import sys
import signal
from ..debug import dbprint, db_exec_info
from .syntaxhi import color_line
from .syntaxhi import mline_string
from .tester import runWithInput
# TODO: Handle infinite loops
print_src_msg = '''
+------------------------+
| Printing File Contents |... | ludvi025/graid | lib/runner/runner.py | Python | mit | 3,446 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'fileSelectionDialog.ui'
#
# Created: Thu Mar 19 02:56:18 2015
# by: PyQt4 UI code generator 4.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
e... | jaeilepp/eggie | ui/ui_FileSelectionDialog.py | Python | bsd-2-clause | 6,583 |
#!/usr/bin/env python
"""
geopy
"""
import sys
from setuptools import find_packages, setup
if sys.version_info < (3, 5):
raise RuntimeError(
"geopy 2 supports Python 3.5 and above. "
"Use geopy 1.x if you need Python 2.7 or 3.4 support."
)
# This import must be below the above `sys.version_i... | geopy/geopy | setup.py | Python | mit | 3,338 |
# -*- coding: utf-8 -*-
###############################################################################
#
# LikesPage
# Determines whether or not someone likes a Facebook Page.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you ma... | jordanemedlock/psychtruths | temboo/core/Library/Facebook/Reading/LikesPage.py | Python | apache-2.0 | 4,149 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "scrumtools.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| acidjunk/django-scrumboard | manage.py | Python | gpl-3.0 | 253 |
#-*- coding: utf-8 -*-
from resources.lib.config import cConfig
import sys
import os
class cPluginHandler:
def getPluginHandle(self):
try:
return int( sys.argv[ 1 ] )
except:
return 0
def getPluginPath(self):
try:
return sys.argv[0]
except:... | Brahimbaz/venom-xbmc-addons-beta | plugin.video.vstream/resources/lib/handler/pluginHandler.py | Python | gpl-2.0 | 3,548 |
# (c) Copyright Cameron Conn 2015
# Licensed AGPLv3 or later
# See `LICENSE` for full details
"""
Functions to be attached to bottle object
"""
from bottle import template, Bottle, request, static_file, abort, response
from wrapper import SpigotData
from os.path import join
from time import sleep
import spigot
from ... | camconn/spigot-monitor | webapp.py | Python | agpl-3.0 | 2,904 |
"""Code coverage utilities."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import os
import re
import time
from xml.etree.ElementTree import (
Comment,
Element,
SubElement,
tostring,
)
from xml.dom import (
minidom,
)
from . import types as... | amenonsen/ansible | test/lib/ansible_test/_internal/cover.py | Python | gpl-3.0 | 25,367 |
import pytest
import owslib
from owslib.etree import etree
from owslib.wfs import WebFeatureService
from tests.utils import service_ok
WFS_SERVICE_URL = 'https://www.dov.vlaanderen.be/geoserver/wfs?request=GetCapabilities'
@pytest.fixture
def mp_wfs_110(monkeypatch):
"""Monkeypatch the call to the remote GetCap... | geopython/OWSLib | tests/test_wfs_schema.py | Python | bsd-3-clause | 6,111 |
# https://www.codewars.com/kata/sudoku-solver/train/python
def sudoku(puzzle):
import collections
print('=== in sudoku ===')
# Print arguments
print_board(puzzle)
# Count the numbers that are currently populated on the sudoku board
number_count = collections.Counter(number for row in puzzle for number in row)... | pcampese/codewars | sudoku_solver_level_3_1.py | Python | gpl-3.0 | 6,456 |
import logging
import sys
import traceback
from typing import Any, Optional
from aiohttp import web
from ai.backend.common.logging import BraceStyleAdapter
from ai.backend.common.types import (
AgentId
)
from ..models import error_logs, LogSeverity
log = BraceStyleAdapter(logging.getLogger('ai.backend.gateway.se... | lablup/sorna-manager | src/ai/backend/manager/plugin/error_monitor.py | Python | lgpl-3.0 | 2,445 |
"""
This module implements the CASA kat7 data container format.
"""
import logging
from casacore.tables import table as casacore_table
from tkp.accessors.casaimage import CasaImage
logger = logging.getLogger(__name__)
class Kat7CasaImage(CasaImage):
"""
Use casacore to pull image data out of a CASA table as... | transientskp/tkp | tkp/accessors/kat7casaimage.py | Python | bsd-2-clause | 1,135 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Eltra CS - 2000
"""
from datetime import datetime
from lims.exportimport.instruments.resultsimport import \
AnalysisResultsImporter, InstrumentCSVResultsFileParser
from lims import bikaMessageFactory as _
class EltraCSTSVParser(InstrumentCSVResultsFileParser):
... | sciCloud/OLiMS | lims/exportimport/instruments/eltra/cs/__init__.py | Python | agpl-3.0 | 2,392 |
from __future__ import absolute_import
from sentry.utils.rust import merge_rust_info_frames, starts_with, strip_symbol
STACKTRACE = """
stacktrace: stack backtrace:
0: 0x111e51cf4 - backtrace::backtrace::trace::h38e3b1de9f341e04
at /.cargo/registry/src/github.com-1ecc6299db9ec823/ba... | mvaled/sentry | tests/sentry/utils/test_rust.py | Python | bsd-3-clause | 6,705 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import errno
import logging
import os
import posix
from functools import reduce
from typing import Optional, Set
logger = logging.getLogger(__name__)
OS_ALIASES = {
"darwin": {"maco... | benjyw/pants | src/python/pants/util/osutil.py | Python | apache-2.0 | 2,336 |
from PCV.geometry import camera
from numpy import array, loadtxt, genfromtxt
from PIL import Image
# load some images
im1 = array(Image.open('dataset_merton/images/001.jpg'))
im2 = array(Image.open('dataset_merton/images/002.jpg'))
# load 2D points for each view to a list
points2D = [loadtxt('dataset_merton/2D/00... | hunter-87/binocular-dense-stereo | test/load_vggdata.py | Python | gpl-2.0 | 656 |
# Taken from here: https://stackoverflow.com/questions/50566934/why-is-this-singleton-implementation-not-thread-safe
import functools
import threading
lock = threading.Lock()
def synchronized(lock):
""" Synchronization decorator """
def wrapper(f):
@functools.wraps(f)
def inner_wrapper(*args... | cinepost/Copperfield_FX | copper/core/utils/singleton.py | Python | unlicense | 849 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | joshua-cogliati-inl/raven | tests/framework/ensembleModelTests/EM_A_dummy.py | Python | apache-2.0 | 681 |
#
# Copyright (C) 2000-2005 by Yasushi Saito (yasushi.saito@gmail.com)
#
# Jockey 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.
#
# Jockey is distr... | ShaolongHu/lpts | site-packages/pychart/axis.py | Python | gpl-2.0 | 9,119 |
#
# Copyright (C) 2014-
# Sean Poyser (seanpoyser@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 2, or (at your option)
# any later version.
... | LouKingGood/LouKingGood | plugin.program.super.favourites/capture.py | Python | gpl-2.0 | 14,631 |
import uuid
from app.notify_client.billing_api_client import BillingAPIClient
def test_get_billing_units_calls_correct_endpoint(mocker, api_user_active):
service_id = uuid.uuid4()
expected_url = '/service/{}/billing/monthly-usage'.format(service_id)
client = BillingAPIClient()
mock_get = mocker.pat... | gov-cjwaszczuk/notifications-admin | tests/app/notify_client/test_billing_client.py | Python | mit | 2,716 |
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pigweed | pw_env_setup/py/pw_env_setup/__init__.py | Python | apache-2.0 | 617 |
from planigale_flask import app
if __name__ == "__main__":
app.run()
| linbug/planigale | wsgi.py | Python | mit | 74 |
"""
RNN Vocal Generation Model
Blizzard, Music, and Huckleberry Finn data feeders.
"""
import numpy
np = numpy
#import scikits.audiolab
import random
import time
import os
import glob
__base = [
('Local', 'datasets/'),
('Kundan_Local', '/data/lisatmp4/kumarkun/Sounds'),
('Soroush_Local', '/Tmp/mehris'),... | soroushmehr/sampleRNN_ICLR2017 | datasets/dataset.py | Python | mit | 16,802 |
#!/usr/bin/env python
import roslib
import rospy
from nav_msgs.msg import Odometry
from geometry_msgs.msg import Point, Pose, Quaternion, Twist, Vector3
import tf
import math
class TfBroadcaster(object):
initialize_localizer=True
#the cg of robot when firstly launched wrt to map frame
cg_origin=[-0.21... | reinaldomaslim/Project_Bixi | bixi_description/nodes/tf_broadcaster.py | Python | gpl-3.0 | 3,551 |
#!/usr/bin/env python
###############################################################################
# #
# bam2fpkc.py #
# ... | minillinim/bam2fpkc | bam2fpkc/bam2fpkc.py | Python | gpl-3.0 | 16,165 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2017 Maarten de Vries <maarten@de-vri.es>
#
# 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) ... | qguv/config | weechat/plugins/python/autosort.py | Python | gpl-3.0 | 38,198 |
# coding=utf-8
__author__ = 'ivan'
import re
import sys
from helpers import crawler
from helpers import ip_helper
class SiteExtractor:
def __init__(self, ip):
self.url = 'http://ip138.com/ips138.asp?ip=' + ip + '&action=2'
self.encoding = 'gb18030'
def extract(self, content):
m = re.... | ivan-lou/crawler | src/extractors/ip138.py | Python | gpl-2.0 | 855 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | daniel-hou0/horizon | django-openstack/django_openstack/tests/view_tests/dash/network_tests.py | Python | apache-2.0 | 7,728 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 9.5 from Kane 1985."""
from __future__ import division
from sympy import sin, cos, pi, solve, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dynamicsymbols
from util import msprint, subs, partial_velocities... | nouiz/pydy | examples/Kane1985/Chapter5/Ex9.5.py | Python | bsd-3-clause | 2,089 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 liangzy
#
# 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... | vliangzy/sillypool | sillypool/server.py | Python | apache-2.0 | 4,068 |
BOT_TOKEN = "123456789:ABCDEFGHIJKLMNOPQURSTUVWXYZABCDEFGHI"
LOG_GROUP_ID = -1001234567890
| jeffffc/wwstatsbot | configEXAMPLE.py | Python | gpl-3.0 | 91 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2015 Roberto Alsina, Chris Warrick and others.
# 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... | JohnTroony/nikola | nikola/plugins/command/orphans.py | Python | mit | 1,764 |
# Django settings for example_project project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DIRNAME = os.path.dirname(__file__)
PROJECT_ROOT = os.path.normpath(os.path.join(DIRNAME,'..'))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' o... | ahmbas/yawd-admin | example_project/example_project/settings.py | Python | bsd-3-clause | 2,328 |
from .bpemb import BPEmb
| bheinzerling/bpemb | bpemb/__init__.py | Python | mit | 25 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/tassel/package.py | Python | lgpl-2.1 | 1,985 |
"""Build factory instances."""
import collections
from . import declarations, enums, errors, utils
DeclarationWithContext = collections.namedtuple(
'DeclarationWithContext',
['name', 'declaration', 'context'],
)
class DeclarationSet:
"""A set of declarations, including the recursive parameters.
At... | FactoryBoy/factory_boy | factory/builder.py | Python | mit | 12,488 |
#!/usr/bin/env python
# encoding: utf-8
import ansible.runner
import ansible.constants
import os
import sys
import urllib2
from urllib2 import URLError
from datetime import datetime
import logging
import json
from logging.handlers import TimedRotatingFileHandler
import time
import functools
import jinja2
import command... | mingjian2049/zstack-utility | zstacklib/ansible/zstacklib.py | Python | apache-2.0 | 80,421 |
import copy
import math
from pymio.material.material_list import MaterialList
from pymio.material.phong_material import PhongMaterial
from pymio.material.textured_phong_material import TexturedPhongMaterial
from pymio.material.by_polygon_material_mapping import ByPolygonMaterialMapping
from pymio.geometry.ind... | esetomo/mio | script/pymio/mmd/pmd/pmd_model.py | Python | gpl-3.0 | 28,845 |
from django.http import (
HttpResponse, HttpResponseBadRequest, HttpResponseNotFound,
)
from django.views.decorators.http import require_POST
from .fieldsetup import fieldsetups
from .forms import SendForm
from .utils import send_code
@require_POST
def send(request, fieldsetup_id):
try:
fieldsetup = ... | misli/django-verified-email-field | verified_email_field/views.py | Python | bsd-3-clause | 593 |
# Copyright (c) 2012 Roberto Alsina y otros.
# 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, copy, modify, merge, pub... | servalproject/nikola | nikola/plugins/compile_rest/youtube.py | Python | mit | 2,306 |
# Copyright (C) 2008 The Android Open Source Project
#
# 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 ... | anwarMov/android_device_asus_a500cg-1 | libintelprov/releasetools/common.py | Python | apache-2.0 | 29,131 |
"""
Tests for the functionality and infrastructure of grades tasks.
"""
import itertools
from collections import OrderedDict
from contextlib import contextmanager
from datetime import datetime, timedelta
import ddt
import pytz
import six
from django.conf import settings
from django.db.utils import IntegrityError
fro... | msegado/edx-platform | lms/djangoapps/grades/tests/test_tasks.py | Python | agpl-3.0 | 28,433 |
import numpy as np
import math
from gstar import *
# Do some simple computations to check on the background evolution
# Constants and conversion factors
Pi=math.pi
Mpl=2.435e27 # Mpl in eV, 1/\sqrt{8 \pi G}
MH=2.13e-33 # MH in eV, 100 km s^-1 Mpc^-1
eVtoMsol=1.78e-36/1.99e30 # eV in kg / Msol in kg
eVtominv=1./1.973... | DoddyPhysics/AxionNet | RadiationBackground/radiation_background.py | Python | mit | 826 |
from django.contrib import admin
import reversion
from .models import *
class CatchAllInline(admin.TabularInline):
model = CatchAll
extra = 0
class EmailAliasInline(admin.TabularInline):
model = EmailAlias
extra = 0
class EmailForwardInline(admin.TabularInline):
model = EmailForward
extr... | voltgrid/mailmanager | project/mail/admin.py | Python | bsd-3-clause | 851 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distrib... | srgblnch/LinacGUI | ctli/widgets/evr300.py | Python | gpl-3.0 | 3,187 |
#!/usr/bin/env python
# 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.
import argparse
import json
import logging
import random
import sys
import time
from multiprocessing import Process, current_process
... | nicko96/Chrome-Infra | infra/experimental/luci_driver/__main__.py | Python | bsd-3-clause | 7,168 |
#!/usr/bin/env python2.2
#-----------------------------------------------------------------------------
# Name: wxPyPlot.py
# Purpose:
#
# Author: Gordon Williams
#
# Created: 2003/11/03
# RCS-ID: $Id$
# Copyright: (c) 2002
# Licence: Use as you wish.
#----------------------------------... | nagyistoce/devide | external/wxPyPlot.py | Python | bsd-3-clause | 57,752 |
# -*- coding: utf-8 -*-
# Python3 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
logging.basicConfig(level=logging.INFO)
# QT classes
# Required QT classes
from qtpy import QtC... | dschreij/osf-api-python-toolkit | QOpenScienceFramework/loginwindow.py | Python | apache-2.0 | 3,467 |
"""Do the prerelease, actual release and post release in one fell swoop!
"""
import logging
import os
from zest.releaser import prerelease
from zest.releaser import release
from zest.releaser import postrelease
from zest.releaser import utils
logger = logging.getLogger(__name__)
def main():
logging.basicConfig... | gforcada/zest.releaser | zest/releaser/fullrelease.py | Python | gpl-2.0 | 847 |
#!/usr/bin/env python
from __future__ import print_function
try:
text_input = raw_input
except:
text_input = input
# path hack
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
from vingd import Vingd
# sandbox backend:
v = Vingd(username="test@vingd.com", password="123", endpoint=Vingd.URL_ENDP... | vingd/vingd-api-python | example/test.py | Python | mit | 2,514 |
__author__ = 'Kasper H Steenstrup'
import rhinoscriptsyntax as rs
import Rhino.Geometry.Point3f as Point3f
def extend(s, mm_len):
"""
Extend a ruled surface such that all the ruling are 400mm long
:param s: A ruled surface
:param mm_len: Desired Length of each ruling
:return: Ruled surface with r... | steenstrup/rhinoscripts | extend-ruling-to-equal-length.py | Python | mit | 1,410 |
#!/usr/bin/env python
###############################################################################
# $Id: contour.py 33793 2016-03-26 13:02:07Z goatbar $
#
# Project: GDAL/OGR Test Suite
# Purpose: ContourGenerate() testing
# Author: Even Rouault <even dot rouault @ mines-paris dot org>
#
#######################... | nextgis-extra/tests | lib_gdal/alg/contour.py | Python | gpl-2.0 | 8,122 |
#!/usr/bin/python3
#
# Copyright (c) 2012 Mikkel Schubert <MikkelSch@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
... | MikkelSchubert/paleomix | paleomix/tools/depths.py | Python | mit | 14,098 |
from models import Administrator
from custom_exception import CustomErrorMessages, CustomException
import logging
logger = logging.getLogger(__name__)
def user_can_perform_cover_management(user_id, article):
try:
user = Administrator.objects.get(id=user_id)
except Administrator.DoesNotExist:
... | Infobase/pulsemob_webservices | pulsemob_webservices/webservices/validator.py | Python | bsd-2-clause | 1,125 |
"""Operations for implementing attention.
"""
import tensorflow.python.platform
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import gen_attention_ops
# pylint: disable=wildcard-import
from... | rickyHong/Tensorflow_modi | tensorflow/python/ops/attention_ops.py | Python | apache-2.0 | 1,132 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2019 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program 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,... | ndp-systemes/odoo-addons | xlsxwriter_utility/models/__init__.py | Python | agpl-3.0 | 806 |
# -*- coding: utf-8 -*-
"""Provides Creative Approval object for working with creatives."""
from __future__ import absolute_import
from ..errors import ClientError
from ..entity import Entity
class CreativeApproval(Entity):
"""T1 Creative entity, or an atomic_creative entity."""
collection = 'creative_approv... | leiforion/t1-python | terminalone/models/creativeapproval.py | Python | bsd-3-clause | 978 |
"""
DecMeg2014 example code.
Simple prediction of the class labels of the test set by:
- pooling all the training trials of all subjects in one dataset.
- Extracting the MEG data in the first 500ms from when the
stimulus starts.
- Projecting with RandomProjection
- Using a classifier.
Copyright Emanuele Olivetti 20... | kastnerkyle/kaggle-decmeg2014 | tensor_decomp_clf.py | Python | bsd-3-clause | 9,794 |
import stripe
import json
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView, DetailView, ListView
from carton.cart import Cart
from .models import Sale, SaleProduct, SaleError
from products.models import Product
... | azul-cloud/serendipity | shopping/views.py | Python | mit | 6,846 |
# coding=utf-8
# EPM Plugins
import Plugins as ep
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
@ep.DatasetFunctionPlugin('Remover Outliers', 1)
def removeoutlier():
if len(ep.EpmDatasetPens.SelectedPens) != 1:
ep.showMsgBox("EPM - Histograma",
... | lucaskotres/ElipseExamples | EPM/Plugins/Outliers/Outliers.py | Python | mit | 853 |
import logging
from PySide2.QtGui import QIcon
from PySide2.QtWidgets import (
QDialog,
QDialogButtonBox,
QFormLayout,
QGroupBox,
QLabel,
QRadioButton,
)
from sportorg import config
from sportorg.gui.global_access import GlobalAccess
from sportorg.gui.utils.custom_controls import AdvComboBox
f... | sportorg/pysport | sportorg/gui/dialogs/sportorg_import_dialog.py | Python | gpl-3.0 | 6,177 |
"""
Plugin for Pyramid apps to submit errors to Rollbar
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import copy
import functools
import inspect
import json
import logging
import os
import socket
import sys
import threading
import time
import traceback
import types
import uuid
imp... | LS80/script.module.pyrollbar | lib/rollbar/__init__.py | Python | mit | 49,977 |
import OOMP
newPart = OOMP.oompItem(9407)
newPart.addTag("oompType", "RESE")
newPart.addTag("oompSize", "0603")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "O684")
newPart.addTag("oompIndex", "67")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_RESE_0603_X_O684_67.py | Python | cc0-1.0 | 243 |
"""
Django settings for dlog project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
#... | c0hen/django-venv | dlog/dlog/settings.py | Python | gpl-3.0 | 3,326 |
# Third-Party
import pytest
from rest_framework import status
# Django
from django.urls import reverse
pytestmark = pytest.mark.django_db
def test_appearance_endpoint(admin_api_client, appearance, django_assert_max_num_queries):
with django_assert_max_num_queries(10):
path = reverse('appearance-list')
... | dbinetti/barberscore-django | project/apps/adjudication/tests/test_api_as_admin.py | Python | bsd-2-clause | 3,054 |
from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user'):
request._cached_user = auth.get_user(request)
return request._cached_user
class AuthenticationM... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/auth/middleware.py | Python | bsd-3-clause | 3,501 |
#!/usr/bin/env python3
from euler import *
def solution():
return nth(primes(), 10000)
if __name__ == "__main__":
print(solution())
| Undeterminant/euler-python | p007.py | Python | cc0-1.0 | 134 |
#!/usr/bin/env python
# encoding: utf-8
"""
SyntaxHighlight.py
Created by Rui Carmo on 2007-01-11.
Published under the MIT license.
"""
import yaki.Engine, yaki.Store
from BeautifulSoup import *
import re, hashlib
class TOCWikiPlugin(yaki.Plugins.WikiPlugin):
def __init__(self, registry, webapp):
registry.regi... | rcarmo/yaki-gae | plugins/_legacy/TOC.py | Python | mit | 2,117 |
# -*- coding: utf8 -*-
import logging
import logging.handlers
import traceback
from argparse import ArgumentParser
from config import Config
from telegram import Telegram
TRACE = 5
def main():
parser = ArgumentParser()
parser.add_argument("-c", "--config", help="yaml config file name", defau... | Fly33/telegram-ingress-bot | src/main.py | Python | bsd-2-clause | 1,204 |
# 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/.
try:
from django.conf.urls import include, patterns, url
except ImportError:
from django.conf.urls.defaults impor... | jgmize/nucleus | vendor-local/lib/python/django_browserid/tests/urls.py | Python | bsd-3-clause | 550 |
import os
import json
from google.appengine.api import urlfetch
from sirius.errors import APIError
API_BASE = 'https://app.getsentry.com/api/0'
class SentryError(APIError):
"""Raised when an error is received from Sentry."""
def create_project(name):
"""Creates a project in Sentry.
This assumes that sen... | bruxr/Sirius2 | sirius/services/sentry.py | Python | mit | 1,881 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('snisi_cataract', '0004_catsurgeryr_number'),
]
operations = [
migrations.AddField(
model_name='catmissionr',
... | yeleman/snisi | snisi_cataract/migrations/0005_auto_20160225_1611.py | Python | mit | 4,210 |
import openmdao.api as om
from pycycle.thermo.cea import species_data
from pycycle.thermo.thermo import Thermo, ThermoAdd
from pycycle.constants import ALLOWED_THERMOS, THERMO_DEFAULT_COMPOSITIONS
from pycycle.flow_in import FlowIn
from pycycle.element_base import Element
class CombineCooling(om.ExplicitComponent):... | JustinSGray/pyCycle | pycycle/elements/cooling.py | Python | apache-2.0 | 16,058 |
def simpleSort(arr):
n = len(arr)
for i in range(n):
j = 0
stop = n - i
while j < stop - 1:
if arr[j] > arr[j + 1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
j += 1
return arr
| emirot/codefights | python/simpleSort.py | Python | apache-2.0 | 248 |
# Generated by Django 2.1.4 on 2018-12-20 14:57
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rdrf', '0092_auto_20181203_1705'),
]
operations = [
migrations.AlterField(... | muccg/rdrf | rdrf/rdrf/migrations/0093_auto_20181220_1457.py | Python | agpl-3.0 | 1,356 |
"""
Method agnostic utility functions for linear progamming
"""
import numpy as np
import scipy.sparse as sps
from warnings import warn
from ._optimize import OptimizeWarning
from scipy.optimize._remove_redundancy import (
_remove_redundancy_svd, _remove_redundancy_pivot_sparse,
_remove_redundancy_pivot_dense,... | andyfaff/scipy | scipy/optimize/_linprog_util.py | Python | bsd-3-clause | 61,618 |
T_INSTANCE_OFF = 0
T_TIME_FROM_OFF = 1
T_TIME_TO_OFF = 2
T_REL_TIME_OFF = 3
T_DEADLINE_OFF = 4
T_EXEC_LEFT_OFF = 5
T_PERIOD_OFF = 6
T_ACTIVE_OFF = 7
T_PROMOTION_OFF = 8
def gcd(*numbers):
"""Return the greatest common divisor of the given integers"""
from fractions import gcd
return reduce(gcd, ... | avirajsaha/rts_scheduler | rts_util.py | Python | gpl-2.0 | 1,521 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.