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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Renato Lima - Akretion #
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models
| thinkopensolutions/l10n-brazil | l10n_br_sale_product/__init__.py | Python | agpl-3.0 | 191 |
import paraBEM
from paraBEM import pan3d
from paraBEM.mesh import mesh_object
mesh = mesh_object.from_OBJ("../mesh/box_minimal.obj")
case = pan3d.DirichletDoublet0Case3(mesh.panels)
case.v_inf = paraBEM.Vector3(1, 0, 0)
a = case.panels[0]
b = case.panels[1]
print(a.center, " ", a.n)
print(b.center, " ", b.n)
print(... | looooo/paraBEM | examples/tests/test_parallel.py | Python | gpl-3.0 | 359 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Script to install ARM root image for cross building of ARM chrome on linux.
This script can be run manually but is more often ru... | AndroidOpenDevelopment/android_external_chromium_org | build/linux/install-arm-sysroot.py | Python | bsd-3-clause | 2,718 |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... | pyk/google-python-exercise | basic/string1.py | Python | apache-2.0 | 3,677 |
#! /usr/bin/python
#-*- coding:utf-8 -*
__author__ = "Cedric Bonhomme"
__version__ = "$Revision: 0.1 $"
__date__ = "$Date: 2015/08/31$"
__revision__ = "$Date: 2015/08/31 $"
__copyright__ = ""
__license__ = ""
from math import sqrt
def pearson(v1, v2):
sum1 = sum(v1)
sum2 = sum(v2)
sum1Sq = sum([pow(v, 2... | cedricbonhomme/k-means-clustering | distance.py | Python | mit | 857 |
from io import StringIO
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import connection
from ....account.utils import create_superuser
from ...utils.random_data import (
add_address_to_admin,
create_gift_card,
... | maferelo/saleor | saleor/core/management/commands/populatedb.py | Python | bsd-3-clause | 3,909 |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... | foxdog-studios/pyddp | ddp/messages/client/constants.py | Python | apache-2.0 | 889 |
from pupa.scrape import Jurisdiction, Organization
from .people import IDPersonScraper
from .committees import IDCommitteeScraper
from .bills import IDBillScraper
class Idaho(Jurisdiction):
"""
IDAHO Scraper
"""
division_id = "ocd-division/country:us/state:id"
classification = "government"
n... | cliftonmcintosh/openstates | openstates/id/__init__.py | Python | gpl-3.0 | 4,242 |
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import RedirectView
from .models import Tag
from .models import Callbacks
from .forms import regTagForm
from datetime import datetime
import json
import urllib2
HARDCODED_PASS = 'password'
def index(request):
return Ht... | ahhh/HoneyTags | tag/views.py | Python | mpl-2.0 | 2,813 |
# Author: Pontus Laestadius.
# Since: 2nd of March, 2017.
# Maintained since: 17th of April 2017.
from receiver import Receiver
import traceback
import os
abspath = os.path.abspath("") + "\\"
abspath = abspath.replace("\\", "/")
print(abspath)
def main():
# Clears the generated file.
open(abspath + '_testc... | DIT524-V17/group-7 | Testing/server.py | Python | gpl-3.0 | 1,859 |
from django.apps import AppConfig
class RedirectorConfig(AppConfig):
name = 'pythonpro.redirector'
| pythonprobr/pythonpro-website | pythonpro/redirector/apps.py | Python | agpl-3.0 | 105 |
#ImportModules
import ShareYourSystem as SYS
#figure
MyPyploter=SYS.PyploterClass(
).mapSet(
{
'-Charts':
{
'|a':{
'-Draws':[
('|0',{
'PyplotingDrawVariable':
[
(
'plot',
{
'#liarg':[
[1,2,3],
[2,6,3]
],
... | Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Viewers/Pyploter/05_ExampleDoc.py | Python | mit | 925 |
from __future__ import unicode_literals
class SRPException(Exception):
"""Base srptools exception class."""
| idlesign/srptools | srptools/exceptions.py | Python | bsd-3-clause | 114 |
import json
from slyd.gitstorage.repoman import Repoman
from slyd.gitstorage.projects import GitProjectsManager, run_in_thread, Repoman
from .dashclient import import_project, deploy_project, set_dash_url
class ProjectsManager(GitProjectsManager):
@classmethod
def setup(cls, storage_backend, location, dash_... | flip111/portia | slyd/slyd/dash/projects.py | Python | bsd-3-clause | 1,020 |
import csv, sys
#sys.path.insert(0, '..')
#from views import lis
#print lis
f = open('../some.csv')
sp = csv.reader(f, delimiter=' ')
for i in sp:
data = i
stories=int(data[0]) #Number of stories
dep_of_foun=float(data[1]) #Depth of Foundation
plinth_lev=float(data[2... | amarjeetkapoor1/Sim | Sim_site/drawing_freecad/FreeCAD_macros/building_specs.py | Python | mit | 2,039 |
from setuptools import setup
setup(
name="cre",
packages=["cre"],
version="0.1.0",
author="Philipp Schiffmann",
author_email="philippschiffmann@icloud.com",
url="https://github.com/elaru/python3-cre",
description="A regular expression processor implemented in python.",
license="ISC",
classifiers=[
"Developm... | elaru/python3-cre | setup.py | Python | isc | 618 |
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
from queue import Queue
from os import read, getcwd
from os.path import join
import select
import errno
from logging import getLogger, debug, info, error, basicConfig, exception, DEBUG #, INFO
from avatar.bintools.gdb.mi_parser import parse, Strea... | jmatthed/avatar-python | avatar/bintools/gdb/mi.py | Python | apache-2.0 | 5,260 |
# coding=utf-8
# Copyright 2019 The SEED 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 agre... | google-research/seed_rl | mujoco/toy_env.py | Python | apache-2.0 | 4,588 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | numenta/htmresearch | htmresearch/frameworks/pytorch/model_utils.py | Python | agpl-3.0 | 4,820 |
#!/usr/bin/env python3
# Copyright (C) 2017-2021 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... | fametrano/BitcoinBlockchainTechnology | btclib/ecc/curve_group.py | Python | mit | 25,313 |
# Copyright 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
from odoo.addons.partner_firstname... | syci/partner-contact | partner_second_lastname/models/res_partner.py | Python | agpl-3.0 | 4,120 |
# coding=utf-8
# Copyright 2022 The TensorFlow GAN 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 applicabl... | tensorflow/gan | tensorflow_gan/examples/evaluation_helper_test.py | Python | apache-2.0 | 17,432 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | citrix-openstack-build/neutron | neutron/tests/unit/nec/test_agent_scheduler.py | Python | apache-2.0 | 4,714 |
"""Support for HomeMatic sensors."""
import logging
from homeassistant.const import (
DEGREE,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
ENERGY_WATT_HOUR,
FREQUENCY_HERTZ,
POWER_WATT,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
... | nkgilley/home-assistant | homeassistant/components/homematic/sensor.py | Python | apache-2.0 | 3,930 |
# Copyright 2018 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... | googleapis/python-bigquery | samples/snippets/jupyter_tutorial_test.py | Python | apache-2.0 | 5,407 |
# Copyright 2008 Thomas Quemard
#
# Paste-It 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.0, or (at your option)
# any later version.
#
# Paste-It is distributed in the hope that it will be... | Pragith/p8ste | src/page/pastes/sitemap/__init__.py | Python | gpl-3.0 | 1,442 |
__all__ = [ name for name, obj in locals().items()
if not (name.startswith('_')) ]
| asedunov/intellij-community | python/testData/inspections/PyUnresolvedReferencesInspection/compoundDunderAll.py | Python | apache-2.0 | 107 |
from django import db
from django.core.management.base import NoArgsCommand
from data.models import RaceCombo
# National Priorities Project Data Repository
# load_race_combo.py
# Created 7/21/2011
# Populates the race combo reference table
# source model(s): none. categories based on those used for census annual pop... | npp/npp-api | data/management/commands/load_race_combo.py | Python | mit | 803 |
from django.conf import settings
def check_session_csrf_enabled():
if "session_csrf.CsrfMiddleware" not in settings.MIDDLEWARE_CLASSES:
return [ "SESSION_CSRF_DISABLED"]
return []
check_session_csrf_enabled.messages = { "SESSION_CSRF_DISABLED" : "Please add 'session_csrf.CsrfMiddleware' to MIDDLEWARE_... | ParliamentTree/parliamenttree | webapp/pt/site/checks.py | Python | mit | 1,251 |
# Copyright 2015 iWeb Technologies Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | redhat-openstack/python-openstackclient | openstackclient/volume/v2/qos_specs.py | Python | apache-2.0 | 9,320 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Sentry logging tests."""
from __future__ import absolute_import, print_function
... | tiborsimko/invenio-logging | tests/test_sentry.py | Python | mit | 5,040 |
from hmdclogger import HMDCLogger
| hmdc/hmdc-logger | hmdclogger/__init__.py | Python | gpl-2.0 | 34 |
import click
from .comm import pdserver_request
@click.group()
@click.pass_context
def routers(ctx):
"""
(deprecated) Access router information on the controller.
These commands are deprecated. Please use the equivalent commands under
`pdtools cloud --help`.
"""
ctx.obj['routers_url'] = ctx.... | ParadropLabs/Paradrop | tools/pdtools/pdtools/routers.py | Python | apache-2.0 | 2,305 |
"""
Wraps individual functions in openjp2 library.
"""
# Standard library imports
import ctypes
import queue
import textwrap
# 3rd party library imports
import numpy as np
# Local imports
from ..config import glymur_config
OPENJP2 = glymur_config('openjp2')
class OpenJPEGLibraryError(IOError):
"""
Issue w... | quintusdias/glymur | glymur/lib/openjp2.py | Python | mit | 43,699 |
from django.conf.urls import patterns, url
from lift_tables import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
)
| rbjorklin/lift-meet-manager | lift_tables/urls.py | Python | bsd-2-clause | 148 |
#!/usr/bin/env python
from nose.tools import *
from networkx.utils import uniform_sequence,powerlaw_sequence,\
create_degree_sequence,zipf_rv,zipf_sequence,random_weighted_sample,\
weighted_choice
import networkx.utils
def test_degree_sequences():
seq=create_degree_sequence(10,uniform_sequence)
assert_... | LumPenPacK/NetworkExtractionFromImages | win_build/nefi2_win_amd64_msvc_2015/site-packages/networkx/utils/tests/test_random_sequence.py | Python | bsd-2-clause | 1,005 |
# Just ? and To Sb. are considered
# regular expression
import re,sys
def preprocessing(f,sf,logg):
excep = ['ALL','All','all','BOTH','Both','both','AND','And','and','BUT','But','but', ',']
stage = set()
nodes = []
temp_file = open('temp.xml','w+')
coun = 0 # to determine if no one is specified after exit
last_g... | smellydog521/classicPlayParsing | parse_shake.py | Python | apache-2.0 | 15,424 |
# 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/.
import os
import cPickle
import WebIDL
from Configuration import *
from Codegen import CGBindingRoot, replaceFileIfChang... | sergecodd/FireFox-OS | B2G/gecko/dom/bindings/BindingGen.py | Python | apache-2.0 | 2,361 |
"""
WSGI config for openems project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | psephologic/everyonevoting | everyonevoting/config/wsgi.py | Python | agpl-3.0 | 391 |
AUTH_URL = "https://quality.hubwoo.com/rest/auth/latest/session"
| AlexWPerfComm/Python-JIRA | const/Constants.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-12-25 23:46
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 = [
migrations.swappable_depende... | basu96/crux-judge | src/server/contest/migrations/0003_profile.py | Python | mit | 849 |
import os
import json
import requests
import base64
import urllib
import logging
_logger = logging.getLogger(__name__)
def anchore_auth_init(username, password, auth_file, client_info_url, token_url, conn_timeout, max_retries):
if not username or not password or not auth_file or not client_info_url or not token_... | anchore/anchore | anchore/anchore_auth.py | Python | apache-2.0 | 9,967 |
# Copyright 2013-2017 Luc Saffre
# This file is part of Lino Welfare.
#
# Lino Welfare 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 ve... | khchine5/lino-welfare | lino_welfare/modlib/contacts/__init__.py | Python | agpl-3.0 | 1,499 |
# -*- coding: utf-8 -*-
import os
import twitter
class TwitterClient:
def __init__(self, verify_credentials=True):
self.tweet_live = os.environ.get("TWEETING_ALLOWED", "false").lower() == "true"
if self.tweet_live:
self.api = twitter.Api(
consumer_key=os.environ.get("... | Vilsepi/nysseituu | src/tweet/__init__.py | Python | mit | 1,068 |
#! /usr/bin/env python
#_*_ coding:utf-8 _*_
import os
import re
import sys
import time
import json
import pickle
import random
import struct
import base64
import select
import socket
import signal
import hashlib
import getpass
import paramiko
import traceback
import threading
pid = os.getpid()
err_fd = None
parent_p... | hejingsong/smileShell | main.py | Python | mit | 18,166 |
"""
This file is a modification of the pygear project (https://sourceforge.net/projects/pygear/)
and is distribuited under the same license of his parent
license:
This code is published under the terms of the GNU General Public License v3
http://www.gnu.org/licenses/gpl-3.0.html
"""
from copy import deepcopy
from math... | efirvida/python-gearbox | gearbox/libs/gearprofile.py | Python | lgpl-2.1 | 41,407 |
# Generated by Django 3.2.6 on 2021-09-02 09:17
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
import webframe.CurrentUserMiddleware
import webframe.models
class Migration(migrations.Migration):
dependencies = [... | kensonman/webframe | migrations/0022_menuitem.py | Python | apache-2.0 | 4,855 |
import py
import sys
class TestDistribution:
def test_n1_pass(self, testdir):
p1 = testdir.makepyfile("""
def test_ok():
pass
""")
result = testdir.runpytest(p1, "-n1")
assert result.ret == 0
result.stdout.fnmatch_lines([
"*1 passed*",... | curzona/pytest-xdist | testing/acceptance_test.py | Python | mit | 14,699 |
test = "#{0}:{1};"
import re
regex = re.compile(test,re.IGNORECASE)
pattern = r'[{]\d[}]'
regex = re.compile(pattern,re.IGNORECASE)
print regex
parsed = []
for idx,match in enumerate(regex.finditer(test)):
parsed.append({'start':match.start(),'end':match.end()})
print "%s: %s-%s: %s" % (str(idx),match.start... | Melon-PieldeSapo/IoTFramework | src/tests/test_ground.py | Python | gpl-3.0 | 1,704 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | highco-groupe/odoo | addons/share/wizard/share_wizard.py | Python | agpl-3.0 | 50,906 |
# Copyright (c) 2016 Dell Inc. or its subsidiaries.
# 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 requi... | ge0rgi/cinder | cinder/tests/unit/volume/drivers/dell_emc/unity/test_utils.py | Python | apache-2.0 | 9,007 |
import os
import unittest
from itertools import islice
from mock import Mock
try:
from unittest import skip
except ImportError:
def skip(f):
return lambda self: None
from bpython import config, repl, cli, autocomplete
def setup_config(conf):
config_struct = config.Struct()
config.loadini(confi... | hirochachacha/apython | bpython/test/test_repl.py | Python | mit | 17,059 |
from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.clickjacking import xframe_options_exempt
import urllib.request
import json
API_URL = 'http://tracker.wallinginfosystems.com/api/v1/'
# API_URL='http://yeahthattrolley.azurewebsites.net/api/v1/'
# Create your view... | dacohenii/trolley-tracker-web | trolley/trolleytracker/views.py | Python | apache-2.0 | 4,585 |
name = "pydad"
version = "2"
requires = ["pyson-2"]
| saddingtonbaynes/rez | src/rez/tests/data/solver/packages/pydad/2/package.py | Python | gpl-3.0 | 53 |
#!/usr/bin/python
import Bio.PDB.PDBParser
from Bio.PDB.PSC.usm import USM
import os
import numpy as np
def get_ca_atom_list(model):
atoms = []
for chain in model:
for res in chain:
try:
atoms.append(res['CA'])
except:
pass
return atoms
def get_contact_map_complexities(in_dir... | xulesc/algos | psc/test_usm_bp.py | Python | gpl-3.0 | 1,016 |
# Copyright (c) 2012 Peter de Rivaz
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted.
import ctypes
# Pick up our constants extracted from the header files with prepare_constants.py
from egl_constants import *
# Define verbose=True to get debug messages
verbose = Fa... | gasman/shortcrust | shortcrust/raspi/egl.py | Python | mit | 3,308 |
#!/usr/bin/env python
__author__ = "Mari Wahl"
__copyright__ = "Copyright 2014, The Cogent Project"
__credits__ = ["Mari Wahl"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Mari Wahl"
__email__ = "marina.w4hl@gmail.com"
import sys
import math
import numpy as np
class AdaBoost(objec... | bt3gl/MLNet-Classifying-Complex-Networks | MLNet-2.0/classifiers/adaboost/src/adaboost.py | Python | mit | 2,658 |
"""Line-like geometrical entities.
Contains
--------
LinearEntity
Line
Ray
Segment
"""
from sympy.core import S, C
from sympy.simplify import simplify
from sympy.geometry.exceptions import GeometryError
from entity import GeometryEntity
from point import Point
class LinearEntity(GeometryEntity):
"""An abstract b... | pernici/sympy | sympy/geometry/line.py | Python | bsd-3-clause | 33,203 |
import matplotlib.pyplot as plt
import tensorflow as tf
import numpy as np
from sklearn.metrics import confusion_matrix
import time
from datetime import timedelta
import math
import os
import help_function as h
import cifar10
cifar10.maybe_download_and_extract()
class_names = cifar10.load_class_names()
class_names
ima... | dashmoment/moxa_ai_training | tutorial/02_CNN/utility/test.py | Python | mit | 3,035 |
# -*- coding: utf-8 -*-
import re
import sys
import contextlib
from random import randrange
from datetime import datetime, timedelta
from .exceptions import ClientException
# Python 2/3 compatibility for capture_stdout
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
class Dat... | bendtherules/pontoon | pontoon/mocking.py | Python | mit | 9,262 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2020 Anuj Bansal <bansalanuj1996@gmail.com> #
# ... | mgorny/PyGithub | tests/NamedUser1430.py | Python | lgpl-3.0 | 2,035 |
#!/usr/bin/env python
'''Parameter sweeps of network with extra E->E connections and flat E-I
profiles.
2D parameter sweep that simulates a stationary bump and records spiking
activity and synaptic currents from selected neurons.'''
from __future__ import absolute_import, print_function, division
from grid_cell_model... | MattNolanLab/ei-attractor | grid_cell_model/simulations/007_noise/submit_param_sweep_gamma_ee_connections_ei_flat.py | Python | gpl-3.0 | 1,331 |
import logging
from django.conf import settings
from registry.patients.models import Patient
from rest_framework.reverse import reverse
logger = logging.getLogger(__name__)
class CalculatedFieldScriptCreatorError(Exception):
pass
class CalculatedFieldScriptCreator(object):
def __init__(
self,
... | muccg/rdrf | rdrf/rdrf/forms/dynamic/calculated_fields.py | Python | agpl-3.0 | 2,395 |
#!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test addr relay
"""
import time
from test_framework.messages import (
CAddress,
NODE_NETWORK,
... | Darknet-Crypto/Darknet | test/functional/p2p_addr_relay.py | Python | mit | 2,115 |
"""
A collection of the pyconll types for interfacing with the CoNLL format. These
types are inter-dependent. Tokens make up Sentences which make up a Conll
treebank.
"""
__all__ = ['conll', 'sentence', 'token']
| pyconll/pyconll | pyconll/unit/__init__.py | Python | mit | 213 |
import _plotly_utils.basevalidators
class SizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="size",
parent_name="barpolar.marker.colorbar.title.font",
**kwargs
):
super(SizeValidator, self).__init__(
plotly_name=plo... | plotly/plotly.py | packages/python/plotly/plotly/validators/barpolar/marker/colorbar/title/font/_size.py | Python | mit | 496 |
import unittest
import xml.etree.ElementTree as ET
from lelei import parser as structureparser
class TestASTChecker(unittest.TestCase):
"""
this testcase checks for things that are common
to _every_ correctly parsed document: the AST.
"""
def setUp(self):
with open("tests/test_d... | alfateam123/lelei | tests/test_ast_structure.py | Python | bsd-2-clause | 12,908 |
class SiteDataMixin(object):
fixtures = ['users', 'bounties']
# existing users: admin | qwe123, test | test
def _fill_form(self, form, data):
for field, value in data.iteritems():
form[field] = value
| bountyful/bountyfulcoins | bountyfulcoinsapp/tests/common.py | Python | mit | 235 |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | mlperf/training_results_v0.7 | Google/benchmarks/transformer/implementations/transformer-research-TF-tpu-v4-16/lingvo/core/generic_input.py | Python | apache-2.0 | 5,898 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Laurawly/tvm-1 | python/tvm/relay/op/_transform.py | Python | apache-2.0 | 39,080 |
"""Sphinx builder"""
| andialbrecht/crunchyfrog | utils/builder/__init__.py | Python | gpl-3.0 | 21 |
#!/usr/bin/env python
# Read mouse events if X isn't running -- for instance, on a Raspberry Pi.
# Needs root, or at least read access to /dev/input/*
import evdev
import select
import time
import sys
class MouseReader:
def __init__(self):
self.mousedevice = None
devices = map(evdev.InputDevice, ... | eadains09/scripts | mouseevent.py | Python | gpl-2.0 | 2,847 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | erahhal/dev-environment-setup | vim/ycm_extra_conf.py | Python | mit | 6,644 |
# -*- coding: utf-8 -*-
from tests.unit import AWSMockServiceTestCase
from boto.mturk.connection import MTurkConnection
GET_FILE_UPLOAD_URL = b"""
<GetFileUploadURLResult>
<Request>
<IsValid>True</IsValid>
</Request>
<FileUploadURL>http://s3.amazonaws.com/myawsbucket/puppy.jpg</FileUploadURL>
</GetFileUpl... | Chilledheart/chromium | tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/mturk/test_connection.py | Python | bsd-3-clause | 860 |
"""Setup for my_google_drive XBlock."""
from __future__ import absolute_import
import os
from setuptools import setup
def package_data(pkg, roots):
"""Generic function to find package_data.
All of the files under each of the `roots` will be declared as package
data for package `pkg`.
"""
data ... | edx-solutions/xblock-google-drive | setup.py | Python | agpl-3.0 | 1,245 |
# -*- coding: utf-8 -*-
from flask import Flask, session, request
from werkzeug.contrib.fixers import ProxyFix
from decouple import config as config_from_env
from .. import constants
from .. import utils
from .extensions import session_store, login_manager
from .login import UserLogin
from . import forms
def _create... | radical-software/mongrey | mongrey/web/wsgi.py | Python | bsd-3-clause | 7,376 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | jumpstarter-io/keystone | keystone/token/providers/fernet/core.py | Python | apache-2.0 | 11,058 |
import urllib
import sys
import json
from collections import defaultdict as dd
import argparse
from tabulate import tabulate
# Usage https://asciinema.org/a/18026
url_format = 'http://query.yahooapis.com/v1/public/yql?{0}&format=json'
query_format = '''select LastTradePriceOnly,symbol,Name
from yahoo.finan... | dotslash/MiniProjects | archive/quotes/quotes.py | Python | mit | 2,534 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | kamcpp/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined_test.py | Python | apache-2.0 | 42,068 |
from django.test import TestCase
from django.contrib.auth.models import User
from models import *
import random
import datetime
from decimal import *
alphabet = [chr(i) for i in range(97,123)]
def random_name():
return ''.join([random.choice(alphabet) for i in range (10)])
def random_date():
random_second = rando... | RedwoodAdmin/RedwoodFramework | expecon/tests.py | Python | bsd-2-clause | 1,415 |
import sys
import os
from cntk import StreamConfiguration, text_format_minibatch_source
import dataloader
import hyperparameters as hp
import helper
from model import Model
dataloader.load()
train_file = "data/MNIST/Train-28x28_cntk_text.txt"
if os.path.isfile(train_file):
path = train_file
else:
print("Can... | wbuchwalter/on-demand-training-cntk | src/train.py | Python | mit | 744 |
import logging
import os
import sys
from pprint import pprint, pformat
import sloelib
from .sloeyoutube.sloeyoutubeplaylist import SloeYouTubePlaylist
from .sloeyoutube.sloeyoutubesession import SloeYouTubeSession
from .sloeyoutube.sloeyoutubetree import SloeYouTubeTree
from .sloeyoutube.sloeyoutubeupload import Sloe... | sloe/chan | sloeplugins/sloeplugin_youtube.py | Python | apache-2.0 | 8,831 |
import Queue
import curses
import logging
import traceback
from curses import ascii
from assertEquals.interactive.summary import Summary
from assertEquals.interactive.utils import ScrollArea, Spinner
from assertEquals.interactive.screens.base import BaseScreen
from assertEquals.interactive.screens.detail import Detail... | whit537/assertEquals | assertEquals/interactive/screens/summary.py | Python | bsd-2-clause | 14,064 |
#!/usr/bin/env python
import re
import os
import time
import sys
import unittest
import ConfigParser
from setuptools import setup, Command
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class SQLiteTest(Command):
"""
Run the tests on SQLite
"""
description = ... | fulfilio/trytond-product-warehouse-location | setup.py | Python | bsd-3-clause | 3,972 |
# Copyright (c) 2012-2013, 2015 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 implementation of the fun... | HwisooSo/gemV-update | src/cpu/BaseCPU.py | Python | bsd-3-clause | 13,380 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for lp.testing.systemdocs module."""
__metaclass__ = type
import doctest
import logging
import os
import shutil
import tempfile
import unittest
from lp.services.config ... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/testing/tests/test_systemdocs.py | Python | agpl-3.0 | 5,456 |
from hashlib import sha1
import bisect
from django.utils.encoding import smart_unicode, smart_str
HEX_DIGITS = 7
MAX_NODES = 16**HEX_DIGITS
class Node(object):
def __init__(self, client, value, id):
self.value = value
self._client = client
self.id = id
def __repr__(self):
retu... | Lab305/django-redis-cache | redis_cache/sharder.py | Python | bsd-3-clause | 3,163 |
""" Form widget classes """
from __future__ import absolute_import
from django.conf import settings
from django.forms.utils import flatatt
from django.forms.widgets import CheckboxInput
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.u... | ESOedX/edx-platform | openedx/core/djangoapps/api_admin/widgets.py | Python | agpl-3.0 | 1,985 |
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_less, assert_equal
from skcv.multiview.util.synthetic_point_cloud import *
def test_random_sphere():
n_points = 10
radius = 7
center = np.array((1, 2, 3))
points = random_sphere(n_points, radius=radius, center=center)
... | guillempalou/scikit-cv | skcv/multiview/util/tests/test_point_clouds.py | Python | bsd-3-clause | 1,109 |
# Copyright (c) 2017 CorpNewt
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
import discord
def name(member : discord.Member):
# A helper function to return the member's display name
nick = name = None
try:
nick = member.nick
except AttributeError:
... | StarbotDiscord/Starbot | libs/displayname.py | Python | apache-2.0 | 6,488 |
from ROOT import TH1F, TCanvas, TLegend, TFile, gStyle, gPad
import itertools
#Options:
#Traces 1: traces from first 2 layers go in the front, 5 layers to the back
#Traces 2 (default): traces from first 3 layers go in the front, 5 layers to the back
#Impedance: 50 (default) or 33 Ohm
#Shields width: 2 (default) or 4 -... | faltovaj/FCC_calo_analysis_cpp | scripts/elecNoise_ecalBarrel.py | Python | gpl-2.0 | 9,573 |
import sys
import os
import json
import numpy as np
from pyimpute import load_training_rasters, load_targets, impute, stratified_sample_raster
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import ExtraTreesClassifier
from pprint import pprint
import time
import warnings
warnings.filterwarni... | Ecotrust/climate-prediction | agzones/aez_predict.py | Python | mit | 5,310 |
from jinja2 import Environment
from django_tex.filters import FILTERS
def environment(**options):
options.update(
{
"autoescape": None,
"extensions": ["django_tex.extensions.GraphicspathExtension"],
}
)
env = Environment(**options)
env.filters = FILTERS
ret... | weinbusch/django-tex | django_tex/environment.py | Python | mit | 328 |
'''
Closeness centrality at a node is 1/average distance to all other nodes.
The closeness centrality is normalized to to n-1 / size(G)-1 where n is the number of nodes in the connected part of graph containing the node. If the graph is not completely connected, this algorithm computes the closeness centrality for eac... | bt3gl/NetAna-Complex-Network-Analysis | src/calculate_features_advanced/helpers/features/centrality.py | Python | mit | 842 |
"""
Tests for search API functions.
"""
from __future__ import unicode_literals
from importer.tasks import import_file
from learningresources.api import create_repo
from search.api import construct_queryset
from search.tests.base import SearchTestCase
class TestAPI(SearchTestCase):
"""Test API."""
def impo... | amir-qayyum-khan/lore | search/tests/test_api.py | Python | agpl-3.0 | 1,255 |
import tensorflow as tf
import math
import collections
from motifwalk.models import EmbeddingModel
from motifwalk.utils import timer
from tensorflow import train
import numpy as np
from numpy.random import randint, seed
from random import shuffle
seed(42)
GDO = train.GradientDescentOptimizer
ADAM = train.AdamOptimize... | gear/motifwalk | motifwalk/models/skipgram.py | Python | mit | 27,370 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/unit/reporters/test_generators_utils.py | Python | gpl-2.0 | 13,510 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Message'
db.create_table(u'message_message', (
(u'id', self.gf('django.db.models... | ContributeToScience/participant-booking-app | booking/message/migrations/0001_initial.py | Python | gpl-2.0 | 7,560 |
"""
=====================================
Structured Arrays (and Record Arrays)
=====================================
Introduction
============
Numpy provides powerful capabilities to create arrays of structs or records.
These arrays permit one to manipulate the data by the structs or by fields of
the struct. A simpl... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/numpy/doc/structured_arrays.py | Python | agpl-3.0 | 8,762 |
#!/usr/bin/env python
import argparse
import os
import sys
from saml2.metadata import entity_descriptor, metadata_tostring_fix
from saml2.metadata import entities_descriptor
from saml2.metadata import sign_entity_descriptor
from saml2.sigver import security_context
from saml2.validate import valid_instance
from saml2.... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/pysaml2-2.4.0/tools/make_metadata.py | Python | gpl-2.0 | 2,900 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.