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 |
|---|---|---|---|---|---|
from __future__ import print_function, division
__all__ = ['Linearizer']
from sympy.core.backend import Matrix, eye, zeros
from sympy.core.compatibility import Iterable
from sympy import Dummy
from sympy.utilities.iterables import flatten
from sympy.physics.vector import dynamicsymbols
from sympy.physics.mechanics.fu... | wxgeo/geophar | wxgeometrie/sympy/physics/mechanics/linearize.py | Python | gpl-2.0 | 15,409 |
#-*- coding:utf-8 -*-
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distri... | eort/OpenSesame | openexp/exceptions.py | Python | gpl-3.0 | 976 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... | potash/drain | travis_pypi_setup.py | Python | mit | 3,750 |
# aesthetics_totals.py - Report Twitter aesthetics terms in (oversized) console.
# Copyright (C) 2014 Rob Myers rob@robmyers.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 ... | robmyers/streaming-aesthetics | streaming_aesthetics_cli/aesthetics_totals.py | Python | gpl-3.0 | 6,039 |
# Simple list commprehensions
#
# Python2 grammar includes:
# list_compr ::= BUILD_LIST_0 list_iter
# list_iter ::= list_for
# list_for ::= expr _for store list_iter JUMP_BACK
# list_iter ::= lc_body
# lc_body ::= expr LIST_APPEND
#
# Python 3 grammar includes:
# listcomp ::= LOAD_LISTCOMP LOAD_CONST MAKE_FUNCTIO... | rocky/python-uncompyle6 | test/simple_source/comprehension/01_list_comprehension.py | Python | gpl-3.0 | 545 |
from django.contrib.auth.models import User
from django.db import models
from piston.handler import AnonymousBaseHandler, BaseHandler
class Fork(models.Model):
maintainer = models.ForeignKey(User, help_text='The user who own this '
'fork.', blank=True, null=True)
name = models.CharField(max_length... | ProgVal/Supybot-website | root/models.py | Python | bsd-3-clause | 683 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# Sandesh Connection
#
import gevent
import os
from transport import TTransport
from protocol import TXMLProtocol
from sandesh_session import SandeshSession, SandeshReader
from sandesh_state_machine import SandeshStateMachine, Event
from sandesh_u... | Juniper/contrail-sandesh | library/python/pysandesh/sandesh_connection.py | Python | apache-2.0 | 5,203 |
"""
self-similarity driven demosaicking ipol demo web app
"""
from lib import base_app, build, http, image
from lib.misc import ctime
from lib.misc import prod
from lib.base_app import init_app
import shutil
import cherrypy
from cherrypy import TimeoutError
import os.path
import time
from math import ceil
class app(b... | juan-cardelino/matlab_demos | ipol_demo-light-1025b85/app_available/bcms_self_similarity_driven_demosaicking/app.py | Python | gpl-2.0 | 12,468 |
# 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 ... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer/_generated/_configuration.py | Python | mit | 3,229 |
# -*- encoding: utf-8 -*-
# Pilas engine - A video game framework.
#
# Copyright 2010 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilas.actores import Actor
import pilas
DEMORA = 14
class Menu(Actor):
"""Un actor que puede mostra... | fsalamero/pilas | pilas/actores/menu.py | Python | lgpl-3.0 | 7,370 |
# -*- coding: utf-8 -*-
#
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
#
# Copyright 2006,2007 Frank Scholz <coherence@beebits.net>
# Copyright 2014 Hartmut Goebel <h.goebel@crazy-compilers.com>
#
"""
little helper to get the proper ElementTree package
"""
import re
import exceptio... | coherence-project/Coherence | coherence/extern/et.py | Python | mit | 4,662 |
import sys
from collections import Counter
def get_domain(email_address):
return email_address.lower().split("@")[-1]
with open('email_addresses.txt','r') as f:
domain_counts = Counter(get_domain(line.strip())
for line in f
if "@" in line) | buckiracer/data-science-from-scratch | RefMaterials/Text-Manipulation/find_email.py | Python | unlicense | 258 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# MonsterTV - XBMC Add-on by Juarrox (juarrox@gmail.com)
# Version 0.2.9 (18.07.2014)
#------------------------------------------------------------
# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html)
# Gracias a la librería plug... | manusev/plugin.video.kuchitv | resources/tools/update.py | Python | gpl-2.0 | 5,231 |
from SloppyCell.ReactionNetworks import *
import Nets
reload(Nets)
import Experiments as Expts
import Calculations as Calcs
m = Model([
Expts.ErkMekTraverse2EGF.expt,
Expts.ErkMekTraverse2NGF.expt,
Expts.Raf1LandrethEGF.expt,
Expts.Rap1YorkNGF.expt,
Expts.RasGree... | GutenkunstLab/SloppyCell | Example/PC12/PC12Run.py | Python | bsd-3-clause | 1,172 |
from deuce.drivers.disk import diskstoragedriver
DiskStorageDriver = diskstoragedriver.DiskStorageDriver
| rackerlabs/deuce | deuce/drivers/disk/__init__.py | Python | apache-2.0 | 106 |
from openerp.osv import fields, osv
class timetable_entry(osv.osv_memory):
def _get_day(self, cr, uid, context={}):
day_id = self.pool.get('sms.day').search(cr, uid, [('name','=','Monday')])
return day_id[0]
_name = "timetable.entry"
_description = "Timetable Entry"
_columns = {
... | inovtec-solutions/OpenERP | openerp/addons/sms/wizard/sms_wizard_timetable_entry.py | Python | agpl-3.0 | 7,063 |
import functools
def get_if_none(arg, default):
return arg if arg else default
def compose(*functions):
def compose2(f, g):
return lambda x: f(g(x))
return functools.reduce(compose2, functions, lambda x: x)
| dbracewell/pyHermes | hermes/util/funcs.py | Python | apache-2.0 | 232 |
#! coding: utf-8
from django.contrib import admin
from simple_faq.models import Topic, Question
admin.site.register(Topic)
admin.site.register(Question)
__author__ = 'lgomez'
| devartis/django-simple-faq | simple_faq/admin.py | Python | mit | 177 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 dud
#
# This file is part of weboob.
#
# weboob 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) a... | blckshrk/Weboob | modules/velib/test.py | Python | agpl-3.0 | 1,139 |
from ..vpn import create_vpn
def test_return_hello_world():
assert create_vpn() == 'Hello World !'
| beeworking/voyant | server/tests/test_create_vpn.py | Python | mit | 105 |
import dataset
import os.path
import sys
import database.src.contributions.ContributionSvg
class SvgCreator:
def __init__(self, path_dir_db, usernames=None):
self.__SetPathDirDb(path_dir_db)
self.__SetUsernames(usernames)
"""
SVGファイルを作成する。1ユーザ1年毎に1ファイル。
is_overwrite: ファイルが既存でも上書きするか否か。(... | trysrv/GitHub.Uploader.CuiCmd.201706231541 | database/src/contributions/SvgCreator.py | Python | cc0-1.0 | 4,165 |
from __future__ import print_function
import os
import sys
import importlib
import re
import requests
import zipfile
import shutil
class PluginLoader(object):
folder_cache = []
def _get_correct_path(self, path):
extension = os.path.splitext(path)[1]
if extension == '.zip':
correct_path = path
e... | DBa2016/PokemonGo-Bot | pokemongo_bot/plugin_loader.py | Python | mit | 4,067 |
from __future__ import unicode_literals
import sys
import spotify
__all__ = [
'AlsaSink',
'PortAudioSink',
]
class Sink(object):
def on(self):
"""Turn on the audio sink.
This is done automatically when the sink is instantiated, so you'll
only need to call this method if you ev... | felix1m/pyspotify | spotify/sink.py | Python | apache-2.0 | 6,107 |
#!/usr/bin/env python3
# Copyright (C) 2017 Fioratto Raffaele
# 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 ... | ImperiumMaximus/budgie-cpupower-applet | applet/cpupower.py | Python | gpl-3.0 | 11,958 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from dataclasses import dataclass
from os import path
from typing import cast
from pants.backend.docker.registries import DockerRegistrie... | patricklaw/pants | src/python/pants/backend/docker/goals/package_image.py | Python | apache-2.0 | 7,471 |
#!/usr/bin/env python
import sys
import numpy as np
# import statepoint
sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally resu... | bhermanmit/cdash | tests/test_tally_assumesep/results.py | Python | mit | 1,251 |
# SimpleCV Image Object
#load required libraries
from SimpleCV.base import *
from SimpleCV.Color import *
from numpy import int32
from numpy import uint8
import pygame as pg
class ColorSpace:
"""
This class is used to encapsulates the color space of a given image.
This class acts like C/C++ sty... | intelie/pycollector | src/third/SimpleCV/ImageClass.py | Python | bsd-3-clause | 96,392 |
# -*- coding: utf-8 -*-
#
# Mitty documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 21 12:40:18 2014.
#
# 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
# autogenerated file.
#
# All... | latticelabs/Mitty | docs/conf.py | Python | gpl-2.0 | 8,651 |
#!/usr/bin/env python
# Copyright 2013 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.
"""Wrapper around chrome.
Replaces all the child processes (renderer, GPU, plugins and utility) with the
IPC fuzzer. The fuzzer will t... | Philippe12/external_chromium_org | tools/ipc_fuzzer/play_testcase.py | Python | bsd-3-clause | 2,200 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | eneldoserrata/marcos_openerp | openerp/addons/base/ir/workflow/workflow.py | Python | agpl-3.0 | 9,030 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-21 18:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('core', '0018_auto_20180921_1... | interlegis/saap | saap/core/migrations/0019_auto_20180921_1540.py | Python | gpl-3.0 | 943 |
#!/usr/bin/env python
# This file should be compatible with both Python 2 and 3.
# If it is not, please file a bug report.
"""
Module used for the loading and saving of permissions.json files. Contains the default permissions list.
"""
#external imports
import json
import collections
import sys
import os
#internal im... | ruipgpinheiro/subuser | logic/subuserlib/permissions.py | Python | lgpl-3.0 | 11,015 |
# -*- coding: utf-8 -*-
"""
################################################################################
# Copyright (c) 2010, Ilgar Mashayev
#
# E-mail: pyzimbra@lab.az
# Website: http://github.com/ilgarm/pyzimbra
################################################################################
# This file is part... | ilgarm/pyzimbra | test/tests/soap_auth.py | Python | lgpl-3.0 | 2,299 |
import string, os, sys, time
import keystoneclient.v2_0.client as keystoneclient
import ConfigParser
import pdb
class BaseHandler(object):
def __init__(self, set_conf):
self.set_conf = set_conf
def keystone_handle(self, key_type, service_type, endpoint_type):
cf = ConfigParser.ConfigParser()
... | fs714/drcontroller | drcontroller/replication/controller/base_handler.py | Python | apache-2.0 | 986 |
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | viktorTarasov/PyKMIP | kmip/tests/unit/services/server/test_server.py | Python | apache-2.0 | 17,129 |
"""
Pyicos 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 distributed in the hope that it will be useful,
but WITHOUT ANY W... | RegulatoryGenomicsUPF/pyicoteo | pyicoteolib/operation_with_classes.py | Python | gpl-3.0 | 3,208 |
# -*- coding: utf-8 -*-
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(... | stvstnfrd/edx-platform | common/djangoapps/xblock_django/migrations/0001_initial.py | Python | agpl-3.0 | 1,168 |
"""
=============
sections
=============
This theme is very similar to 'default', except that
the output from each module is hidden by default.
Clicking the module names in the side-navigation
(on the left) hide the visible module and show the
module that was clicked on.
This approach is useful when reports are very... | ewels/MultiQC | multiqc/templates/sections/__init__.py | Python | gpl-3.0 | 630 |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
'''... | lakepay/lake | qa/rpc-tests/maxuploadtarget.py | Python | mit | 10,735 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-11 21:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Emiliemorais/ido | blog/migrations/0002_auto_20160611_2119.py | Python | bsd-2-clause | 2,997 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from frappe.defaults import *
class TestDefaults(unittest.TestCase):
def test_global(self):
clear_user_default("key1")
set_global_default("key1",... | rohitwaghchaure/vestasi-frappe | frappe/tests/test_defaults.py | Python | mit | 1,674 |
#!/usr/bin/env python3
import os
bundleFilesDir = 'tmp/bundleSizeDownloads'
yarnLockFile = 'yarn.lock'
packagesFile = 'package.json'
def isDividerLine(line):
# At least 80 chars, all slashes except the last (which is newline). The number is inconsistent for some reason.
return (len(line)>=80
and line.... | Discordius/Telescope | scripts/analyzeBundle.py | Python | mit | 4,048 |
from __future__ import absolute_import
import datetime
from navigation.api import register_links
from main import __version__
from .links import (link_bootstrap_setup_create, link_bootstrap_setup_execute,
link_bootstrap_setup_list, link_bootstrap_setup_edit, link_bootstrap_setup_delete,
link_bootstrap_setup_... | rosarior/mayan | apps/bootstrap/post_init.py | Python | gpl-3.0 | 2,706 |
import logging
from org.slf4j import Logger, LoggerFactory
__all__ = ["SLF4JHandler"]
class SLF4JHandler(logging.Handler):
def __init__(self, logger=None):
logging.Handler.__init__(self)
if logger is None:
logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)
self.logger... | jythontools/logbridge | logbridge/__init__.py | Python | apache-2.0 | 1,772 |
#!/usr/bin/env python3
from pkg_resources import resource_filename
from time import time
from sanic import Sanic
from sanic.response import html, json
from jinja2 import Environment, PackageLoader, Markup
from asyncpg import create_pool
from monocle import sanitized as conf
from monocle.bounds import center
from mon... | DavisPoGo/Monocle | web_sanic.py | Python | mit | 6,434 |
import numpy as np
from random import shuffle
def svm_loss_naive(W, X, y, reg):
"""
Structured SVM loss function, naive implementation (with loops).
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
... | gourie/cs231n | classifiers/linear_svm.py | Python | gpl-3.0 | 6,828 |
import mock
import pytest
from django.utils import timezone
from api_tests import utils as test_utils
from osf_tests.factories import (
PreprintFactory,
AuthUserFactory,
SubjectFactory,
)
from osf.utils.permissions import WRITE
from osf.utils.workflows import DefaultStates
@pytest.mark.django_db
class Pr... | Johnetordoff/osf.io | api_tests/preprints/views/test_preprint_list_mixin.py | Python | apache-2.0 | 11,142 |
# -*- coding: utf-8 -*-
'''
Load datasets with the relevant columns
'''
from __future__ import division, print_function
import pandas as pd
import numpy as np
import os
# Each data set defines: filename, timecol, eventcol, xcols
_pbc = dict(filename="data/pbc.csv",
timecol="time",
eventcol="st... | spacecowboy/article-annriskgroups-source | datasets.py | Python | gpl-3.0 | 10,150 |
model = """R1:
S1 > S2
k1*S1
R2:
S2 > S1
k1*S2
R3:
S2 > S3
k1*S2
R4:
S3 > S2
k1*S3
R5:
S3 > S4
k1*S3
R6:
S4 > S3
k1*S4
R7:
S4 > S5
k1*S4
R8:
S5 > S4
k1*S5
R9:
S5 > S6
k1*S5
R10:
S6 > S5
k1*S6
R11:
S6 > S7
k1*S6... | SystemsBioinformatics/stochpy | stochpy/pscmodels/chain1500.py | Python | gpl-3.0 | 126,125 |
from example_util import get_filename
from glc import Gif
from glc.color import Color, hsva
with Gif(get_filename(__file__)) as a:
a.set_bg_color(Color("black")).set_duration(2).set_size(300, 300)
l = a.render_list
res = 250
c = [hsva((i / res) * 360, 1, 1) for i in range(res)]
l.gradient_pie(x=a.... | leovoel/glc.py | examples/gradient.py | Python | mit | 412 |
"""Settings for edn layout designer module.
"""
# python import
import os
# django import
from django.conf import settings
# specific media url for edld
MEDIA_URL = settings.MEDIA_URL + 'edld/'
# specific media url for edld
MEDIA_ROOT = os.path.join(settings.MEDIA_ROOT, 'edld')
| pygloo/emencia-django-layout-designer | emencia/django/layout/designer/settings.py | Python | mit | 284 |
import numpy as np
import pylab as pyl
from matplotlib.artist import setp
class ndmesh(np.ndarray):
"""This class provides utilities for manipulating mgrids such as
plotting, filling data...etc.. FOR NOW the plotting stuff work
for 2D only it works only with 2D meshes.
methods :
NOTES : se... | mherkazandjian/ismcpak | ndmesh.py | Python | gpl-3.0 | 8,691 |
import os
import os.path
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from handlers import base
from handlers import websockets
from ui import modules
from panoptes.utils import database
from panoptes.utils.config.client import get_config
from panopt... | panoptes/PAWS | app.py | Python | mit | 2,383 |
# Copyright (c) 2015-2016 Tigera, 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 applicabl... | quater/calico-containers | calicoctl/calico_ctl/status.py | Python | apache-2.0 | 9,262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
It adds an extra column with the counts of reads which are ambiguous.
Author: Daniel Nicorici, Daniel.Nicorici@gmail.com
Copyright (c) 2009-2021 Daniel Nicorici
This file is part of FusionCatcher.
FusionCatcher is free software: you can redistribute it and/or modi... | ndaniel/fusioncatcher | bin/add_ambiguous_counts.py | Python | gpl-3.0 | 4,713 |
#encoding:utf8
from flask import Flask, request, render_template, abort
import git
import markdown
import json
import codecs
import shutil
import os
import zipfile
import tarfile
app = Flask(__name__)
app.debug = True
doc_save_to = os.path.join(os.path.split(app.instance_path)[0], 'docs')
if not os.path.isdir(doc_sav... | ptolemaios/ptolemaios | new_builder.py | Python | mit | 5,888 |
#!/usr/bin/python3
#####################################################################################
# #
# Prob: Implement a python code to check a) whether a VM is up or not #
# b) check the VM’s IP. ... | karthik-kumar-u/pyth | Part-C/py027.py | Python | gpl-3.0 | 865 |
from setuptools import setup, find_packages
import cutils
setup(
name='CUtils',
version=cutils.__version__,
packages=find_packages(),
install_requires=['kivy'],
author='Matthew Einhorn',
author_email='moiein2000@gmail.com',
license='MIT',
description=' Various kivy utilities.'
)
| matham/cutils | setup.py | Python | mit | 318 |
from django.dispatch import receiver
from django.db.backends.signals import connection_created
from django.db.models.signals import post_save
from django.utils import timezone
from gunmel.models import Product, PriceHistory
@receiver(connection_created)
def activate_foreign_keys(sender, connection, **kwargs):
""... | zhenkai/xgunicorn | gunmel/signals.py | Python | apache-2.0 | 692 |
from django.contrib import admin
from blog.models import BlogPost
admin.site.register(BlogPost)
| funkbit/django-dynamicresponse | examples/myblog/blog/admin.py | Python | bsd-2-clause | 97 |
from __future__ import print_function
import aaf
import aaf.mob
import aaf.define
import aaf.iterator
import aaf.dictionary
import aaf.storage
import aaf.base
import unittest
import traceback
import os
cur_dir = os.path.dirname(os.path.abspath(__file__))
sandbox = os.path.join(cur_dir,'sandbox')
if not os.path.exis... | wjt/pyaaf | tests/test_root.py | Python | mit | 2,172 |
# Generated by Django 2.0.2 on 2018-03-11 18:54
from collections import defaultdict
from typing import List
from django.db import migrations
def get_attributes_display_map(obj, attributes):
"""Return attributes associated with an object, as dict of AttrPK: AttributeValue.
Args:
obj: The variant or p... | maferelo/saleor | saleor/product/migrations/0059_generate_variant_name_from_attrs.py | Python | bsd-3-clause | 2,025 |
# Copyright (c) 2013, GlaxoSmithKline Research & Development Ltd.
# 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
# ... | rvianello/rdkit | Contrib/fraggle/atomcontrib.py | Python | bsd-3-clause | 5,091 |
#
# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | dmacvicar/spacewalk | backend/server/test/TestRedhat.py | Python | gpl-2.0 | 3,529 |
# Copyright 2017 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... | mlperf/training_results_v0.5 | v0.5.0/google/cloud_v3.8/resnet-tpuv3-8/code/resnet/model/staging/models/rough/nmt_gpu/nmt.py | Python | apache-2.0 | 46,513 |
# -*- coding: utf-8 -*-
# Spearmint
#
# Academic and Non-Commercial Research Use Software License and Terms
# of Use
#
# Spearmint is a software package to perform Bayesian optimization
# according to specific algorithms (the “Software”). The Software is
# designed to automatically run experiments (thus the code name
... | DavidMcDonald1993/ghsom | spearmint/spearmint/choosers/default_chooser.py | Python | gpl-2.0 | 28,796 |
from ..core.shared_functions import test_kwarg
from ..core.parameters import edge_id_separator
from ..core.shared_functions import test_kwarg
def write_network_textfile(the_network, **kwargs):
""" Write a simple tab-delimited textfile that can serve as
table to import the network to cytoscape
Arguments:
... | hostviralnetworks/nampy | nampy/networkio/cytoscapeio.py | Python | gpl-3.0 | 9,748 |
#!/usr/bin/env python
from re import sub
from sys import argv,exit
from os import system,getenv,path
from time import clock,time
import json
which = int(argv[1])
submit_id = int(argv[2])
sname = argv[0]
argv=[]
import ROOT as root
from PandaCore.Tools.Misc import *
from PandaCore.Tools.Load import *
import PandaCore... | sidnarayanan/RedPanda | T3/inputs/pf_tmpl.py | Python | mit | 6,716 |
import numpy as np
def fminbnd(func,x1,x2):
'''
Find minimum of single-variable function on fixed interval
The algorithm is based on golden section search and parabolic interpolation
'''
pass | longyangking/Husky | Husky/Optimize/fminbnd.py | Python | lgpl-2.1 | 213 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import os
from azure_devtools.perfstress_tests import PerfStressTest
from azure.identity import DefaultAzureCredential
from azure.identity.aio import DefaultAzureCreden... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/tests/perfstress_tests/unwrap.py | Python | mit | 2,903 |
from weppy.handler import url
@url('/')
class HelloWorldHandler:
def get(self, request):
return 'Hello, World!'
| ral99/weppy | scripts/weppy_project/controller.py | Python | bsd-3-clause | 125 |
from unittest.mock import Mock, patch
import pytest
from pyoffers.models import Offer
def test_str(advertiser, conversion):
offer = Offer(manager=Mock(), id=1)
assert str(advertiser) == "Advertiser: Test"
assert str(conversion) == "Conversion: 99630"
assert str(offer) == "Offer: 1"
def test_repr(a... | Stranger6667/pyoffers | test/models/test_core.py | Python | mit | 2,534 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsXmlUtils.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__aut... | physycom/QGIS | tests/src/python/test_qgsxmlutils.py | Python | gpl-2.0 | 6,048 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 自省
"""
# 列出常规对象没有而函数有的属性
class C: pass
obj = C()
def func(): pass
print(sorted(set(dir(func)) - set(dir(obj))))
| yidao620c/core-python | ch05function/my_introspection.py | Python | apache-2.0 | 208 |
import curses
import readline
import bz2
assert(bz2.decompress(bz2.compress(b'IT WORKS IT WORKS IT WORKS')) == b'IT WORKS IT WORKS IT WORKS')
import platform
if platform.python_implementation() != 'PyPy' and platform.python_version_tuple()[0] != '2':
# PyPy and Python 2 don't support lzma
import lzma
asse... | benbc/docker-official-images | test/tests/python-imports/container.py | Python | apache-2.0 | 535 |
import NodeDefender
default_config = {'enabled' : False,
'host' : '',
'port' : '',
'database' : ''}
config = default_config.copy()
def load_config(parser):
if eval(parser['REDIS']['ENABLED']):
config.update(parser['REDIS'])
config['enabled'] =... | CTSNE/NodeDefender | NodeDefender/config/redis.py | Python | mit | 865 |
# Preleva le prime n istanze e sostituisce l'attributo "Dates"
# con gli attributi "Season" e "Daily range"
from utilities import *
from featureEngineering import *
ds, intest = dsFromCSV('./Dataset/train.csv')
new_ds, new_intest = processSDR(ds, intest)
#i = 0
#for el in intest:
# if(el == "X"):
# del(i... | Luke092/MLDM_SFCrime | src/trainSDR.py | Python | gpl-3.0 | 564 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2021 RERO
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that... | rero/reroils-app | rero_ils/modules/notifications/extensions.py | Python | gpl-2.0 | 2,895 |
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that it will be usef... | mgbarrero/bob.db.biosecurid.hand | bob/db/biosecurid/hand/test.py | Python | gpl-3.0 | 10,011 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
from hypothesis import given
import numpy as np
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import caffe2.python.hypot... | xzturn/caffe2 | caffe2/python/operator_test/elementwise_op_broadcast_test.py | Python | apache-2.0 | 20,128 |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 10 16:45:00 2017
@author: Callum
"""
import matplotlib
#matplotlib.use('pdf')
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.collections import LineCollection
from matplotlib.widgets import Lasso
from matplotlib import colors as mcolors
import pdb
cla... | ab9621/PogoLibrary | PolyInterface/polyGui.py | Python | gpl-3.0 | 2,912 |
#
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# 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,... | maximumG/exscript | Exscript/util/ipv6.py | Python | mit | 4,847 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from categoria.categoria_model import ProdutoForm
from distutils import log
from gaecookie.decorator import no_csrf
from gaepermission.decorator import login_required, login_not_required
from tekton.gae.middleware.json_middleware import Js... | SamaraCardoso27/eMakeup | backend/appengine/routes/produtos/rest.py | Python | mit | 703 |
from __future__ import division
import re
import textwrap
import wifi.subprocess_compat as subprocess
from wifi.utils import db2dbm
from wifi.exceptions import InterfaceError
class Cell(object):
"""
Presents a Python interface to the output of iwlist.
"""
def __init__(self):
self.bitrates =... | nicupavel/wifi | wifi/scan.py | Python | bsd-2-clause | 5,377 |
# Copyright 2019 The dm_control 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 i... | deepmind/dm_control | dm_control/locomotion/soccer/soccer_ball_test.py | Python | apache-2.0 | 2,711 |
# -----------------------------------------------------------------------------
# Module: dpa.user
# Author: Josh Tomlinson (jtomlin@clemson.edu)
# -----------------------------------------------------------------------------
"""Classes and functions related to DPA pipeline users
Classes
-------
User
Read-only int... | Clemson-DPA/dpa-pipe | dpa/user/__init__.py | Python | mit | 4,326 |
#!/usr/bin/env python3
from influxdb import InfluxDBClient
import os
import sys
import re
import datetime
import calendar
from stravalib.client import Client
######### Variables ############
path_for_files = "./authfiles/"
influxhost = os.getenv("GRAVA_INFLUX_HOST", "localhost")
influxport = os.getenv("GRAVA_INFLUX_P... | rotti/grava | grava_init_backend.py | Python | mit | 15,168 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
salt.utils.context
~~~~~~~~~~~~~~~~~~
Context managers used throughout Salt's source... | MadeiraCloud/salt | sources/salt/utils/context.py | Python | apache-2.0 | 1,521 |
# -*- test-case-name: twisted.test.test_tcp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Various asynchronous TCP/IP classes.
End users shouldn't use this module directly - use the reactor APIs instead.
"""
from __future__ import division, absolute_import
# System Imports
import s... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/internet/tcp.py | Python | mit | 43,046 |
# -*- coding: UTF-8
""" Entry decorators for python plugins
Functions
=========
chat_message -- Decorator for chat message plugin
chat_command -- Decorator for chat command plugin
chat_accost -- Decorator for chat accost plugin
"""
from dewyatochka.core.plugin.loader.internal import entry_point
from dew... | kawashiro/dewyatochka2 | src/dewyatochka/core/plugin/subsystem/message/py_entry.py | Python | gpl-3.0 | 2,198 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_US... | hovel/django-ratings | djangoratings/migrations/0001_initial.py | Python | bsd-2-clause | 4,232 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import datetime
import pytz
from django.core.management.base import BaseCommand
from django.db.models import Count
from zerver.models import UserProfile, Realm, Stream, Message, Recipient, UserActivity, \
... | dwrpayne/zulip | analytics/management/commands/realm_stats.py | Python | apache-2.0 | 7,897 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | audio/etc/voicemail.py | Python | apache-2.0 | 1,358 |
#
# 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 us... | practice-vishnoi/dev-spark-1 | examples/src/main/python/ml/simple_text_classification_pipeline.py | Python | apache-2.0 | 2,809 |
"""This is the Bokeh charts interface. It gives you a high level API to build
complex plot is a simple way.
This is the Line class which lets you build your Line charts just
passing the arguments to the Chart class and calling the proper functions.
"""
# ----------------------------------------------------------------... | schoolie/bokeh | bokeh/charts/builders/line_builder.py | Python | bsd-3-clause | 9,608 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-17 14:10
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('campaign', '0009_transaction_status'),
... | toast38coza/FlashGiving | campaign/migrations/0010_auto_20160717_1410.py | Python | mit | 892 |
import json
from keras.utils.io_utils import H5Dict
from ..json import save_json
class LinearMixin:
def get_config(self):
raise NotImplemented
def to_json(self, **kwargs) -> str:
m = {
'class_name': self.__class__.__name__,
'config': self.get_config()
}
... | rafaeltg/pydl | pydl/models/linear/base.py | Python | mit | 814 |
import itertools
import numpy as np
def geometric (x, degree):
"""Returns the geometric series (1, x, x**2, ..., x**degree) as a numpy.ndarray."""
return np.fromiter((x**d for d in xrange(degree+1)), type(x), count=degree+1)
def python_function_from_coefficients (coefficients):
def python_function (x):
... | vdods/heisenberg | attic/library/polynomial.py | Python | mit | 5,220 |
#!/usr/bin/python
from avocado import Test
from avocado import main
class MultiplexTest(Test):
"""
Execute a test that uses provided parameters (for multiplexing testing).
:param *: All params are only logged, they have no special meaning
"""
def setUp(self):
self.compile_code()
... | Hao-Liu/avocado | examples/tests/multiplextest.py | Python | gpl-2.0 | 2,771 |
# This script tests the displaying of custom messages and images.
# Created by Toni Sagrista
from py4j.java_gateway import JavaGateway, GatewayParameters
gateway = JavaGateway(gateway_parameters=GatewayParameters(auto_convert=True))
gs = gateway.entry_point
"""
Prints a notice on the screen and waits for any input.... | ari-zah/gaiasky | assets/scripts/tests/text-test.py | Python | lgpl-3.0 | 2,557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.